feat(custom):

This commit is contained in:
2024-05-20 19:59:36 +08:00
parent 4245ae6c80
commit 09840d72ed
11 changed files with 268 additions and 46 deletions

View File

@@ -1,8 +1,8 @@
<template>
<view class="flex flex-col items-center justify-center">
<view class="mt-6 text-[#8C8C8C] text-[25px]"
>交易剩余时间{{ tStr }}</view
>
>交易剩余时间{{ tStr }}
</view>
<view class="flex items-center mt-5 mb-5">
<nut-price :price="orderData.price" size="large" />
<view class="line"></view>
@@ -31,7 +31,7 @@
class="flex items-center"
title="平台积分支付"
:desc="`剩余积分:${orderData.User?.integral || 0}`"
@click="cellClick(2, orderData.User?.integral === 0 ? true : false)">
@click="cellClick(2, orderData.User?.integral === 0)">
<template #icon>
<IconFont size="30" :name="require('../../../static/pt.png')" />
</template>
@@ -45,7 +45,7 @@
class="flex items-center"
title="天才小猪积分支付"
:desc="`剩余积分:${orderData.integral || 0}`"
@click="cellClick(3, orderData.integral === 0 ? true : false)">
@click="cellClick(3, orderData.integral === 0)">
<template #icon>
<IconFont size="30" :name="require('../../../static/jh.png')" />
</template>
@@ -64,13 +64,13 @@
type="primary"
block
@click="pay"
>确认支付</nut-button
>
>确认支付
</nut-button>
</view>
<nut-short-password
title="请输入交易密码"
tips=" "
tips="忘记密码"
desc=" "
:error-msg="error_msg"
v-model="shortVal"
@@ -79,13 +79,23 @@
:close-on-click-overlay="false"
@focus="showKeyboard = true"
@complete="shortComplete"
@close="shortClose">
@close="shortClose"
@tips="onTips">
</nut-short-password>
<nut-number-keyboard
v-model="shortVal"
v-model:visible="showKeyboard"
@blur="showKeyboard = false">
</nut-number-keyboard>
<nut-dialog
title="设置交易密码"
content="您还未设置交易密码,请前往设置"
cancel-text="选择其他支付方式"
ok-text="设置交易密码"
v-model:visible="visible2"
@cancel="visible2 = false"
@ok="onTips" />
</view>
</template>
@@ -96,6 +106,7 @@ import {onUnmounted, ref} from 'vue';
import {getActiveOrderDetail, checkTradePwd} from '@/api/goods';
import {getUserPoint} from '@/api/admin';
import {payOrder} from '@/api/order';
import {isCheckTradePwd} from '@/api/user';
import * as dayjs from 'dayjs';
const payVal = ref();
@@ -116,6 +127,8 @@ const showKeyboard = ref(false);
const isLoading = ref(false);
const visible2 = ref(false);
const opt = ref<any>({});
Taro.useLoad(e => {
@@ -152,10 +165,16 @@ const pay = async () => {
if (!payVal.value)
return Taro.showToast({title: '请选择支付方式', icon: 'none'});
if (payVal.value !== 1) {
visible.value = true;
showKeyboard.value = true;
const res = await isCheckTradePwd();
if (res.data.pay_password) {
visible.value = true;
showKeyboard.value = true;
} else {
isLoading.value = false;
visible2.value = true;
}
} else {
confirmPay();
await confirmPay();
}
} catch (error) {
isLoading.value = false;
@@ -172,7 +191,7 @@ const shortComplete = async value => {
pay_password: value,
});
shortClose(false);
confirmPay();
await confirmPay();
} catch (error) {
error_msg.value = error.msg;
shortVal.value = '';
@@ -208,7 +227,7 @@ const confirmPay = async () => {
});
},
complete: function () {
Taro.navigateTo({
Taro.redirectTo({
url: `/pages/users/order_list_detail/index?orderId=${opt.value.oid}`,
});
},
@@ -226,7 +245,7 @@ const confirmPay = async () => {
icon: 'none',
});
setTimeout(() => {
Taro.navigateTo({
Taro.redirectTo({
url: `/pages/users/order_list_detail/index?orderId=${opt.value.oid}`,
});
}, 2000);
@@ -273,6 +292,12 @@ const countdownTime = () => {
}, 1000);
};
const onTips = () => {
Taro.redirectTo({
url: '/pages/users/pwd/index',
});
};
Taro.useDidHide(() => {
clearInterval(t_id.value);
});