fix(custom): \!
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-09-23 20:43:11 +08:00
parent b5361277ca
commit 097029128c
2 changed files with 38 additions and 13 deletions

View File

@@ -11,9 +11,9 @@
<!-- 商品信息 -->
<view class="w-full" v-for="(itm, idx) in orderData" :key="idx">
<view class="order-card">
<view class="mb-[10px] text-[28px] text-[#9C9C9C]">{{
itm.Store.name
}}</view>
<view class="mb-[10px] text-[28px] text-[#9C9C9C]"
>{{ itm.Store.name }}
</view>
<view
class="center mb-[20px]"
v-for="(item, index) in itm.OrderGoods"
@@ -21,9 +21,9 @@
<view class="top">
<image :src="item.Goods.cover" />
<view class="flex flex-col justify-between flex-1 h-[150px]">
<view class="title line-clamp-2 text-[25px]">{{
item.Goods?.name
}}</view>
<view class="title line-clamp-2 text-[25px]"
>{{ item.Goods?.name }}
</view>
<view class="text-[#F83D3D] mt-5">
<view
>{{ item.pay_price }}
@@ -83,6 +83,7 @@
<nut-button
shape="square"
:loading="isLoading"
:disabled="isLoading"
type="primary"
block
@click="pay"
@@ -97,7 +98,6 @@ import Taro from '@tarojs/taro';
import {IconFont} from '@nutui/icons-vue-taro';
import {onUnmounted, ref} from 'vue';
import {getActiveOrderDetail, getPayList} from '@/api/goods';
import {getUserPoint} from '@/api/admin';
import {payOrder} from '@/api/order';
import * as dayjs from 'dayjs';
@@ -132,7 +132,7 @@ const get_pay_list = async () => {
};
const getData = async (oid: string, bid: string, OrderType: number) => {
const user_info = Taro.getStorageSync('userInfo');
// const user_info = Taro.getStorageSync('userInfo');
// const data = await getUserPoint({
// phone: user_info.data.phone,
// bid,
@@ -173,18 +173,16 @@ const getData = async (oid: string, bid: string, OrderType: number) => {
const pay = async () => {
try {
if (isLoading.value) return;
isLoading.value = true;
if (!payVal.value)
return Taro.showToast({title: '请选择支付方式', icon: 'none'});
await confirmPay();
} catch (error) {
Taro.showToast({
title: error.msg,
icon: 'none',
});
} finally {
isLoading.value = false;
}
};
@@ -219,15 +217,16 @@ const confirmPay = async () => {
url: `/pages/users/order_list/index?type=0`,
});
}, 2000);
isLoading.value = false;
},
});
isLoading.value = false;
} catch (err) {
isLoading.value = false;
Taro.showToast({
title: err.msg,
icon: 'none',
});
} finally {
isLoading.value = false;
}
};

View File

@@ -83,3 +83,29 @@ export function showTips(msg: string) {
icon: 'none',
});
}
// 防抖函数
export function debounce(fn: Function, delay: number = 500) {
let timer: any = null;
return function (...args: any[]) {
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(() => {
fn.apply(this, args);
}, delay);
};
}
// 节流函数
export function throttle(fn: Function, delay: number) {
let timer: any = null;
return function (...args: any[]) {
if (!timer) {
timer = setTimeout(() => {
fn.apply(this, args);
timer = null;
}, delay);
}
};
}