feat(custom): 新增后结订单

This commit is contained in:
2024-03-02 19:27:20 +08:00
parent 725127c29b
commit 72b5f91102
43 changed files with 7854 additions and 12640 deletions

View File

@@ -14,11 +14,37 @@
<nut-cell-group
:style="{ margin: interval ? '40rpx 0 150rpx 0' : '40rpx 0' }"
>
<nut-cell
title="微信支付"
desc="使用微信快捷支付"
<nut-cell
title="微信支付"
desc="使用微信快捷支付"
is-link
@click="goPay(1)"
>
<template v-slot:icon>
<IconFont
size="30"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
/>
</template>
</nut-cell>
<nut-cell
title="积分支付"
:desc="`剩余积分:${info.integral || 0}`"
is-link
@click="goPay(2)"
>
<template v-slot:icon>
<IconFont
size="30"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
/>
</template>
</nut-cell>
<!-- <nut-cell
title="挂帐后结"
desc="先消费后结账"
is-link
@click="goPay(1)"
@click="goPay(3)"
>
<template v-slot:icon>
<IconFont
@@ -26,20 +52,7 @@
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
/>
</template>
</nut-cell>
<nut-cell
title="积分支付"
:desc="`剩余积分:${info.integral || 0}`"
is-link
@click="goPay(2)"
>
<template v-slot:icon>
<IconFont
size="30"
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
/>
</template>
</nut-cell>
</nut-cell> -->
</nut-cell-group>
</view>
</nut-popup>
@@ -106,51 +119,58 @@ const goPay = async (type: number) => {
icon: "none",
});
try {
const { data } = await payOrder({
oid: prop.jfInfo,
OrderType: prop.OrderType,
PayType: type,
});
// 1微信支付 2积分支付
if (type === 1) {
if (data.data) {
Taro.requestPayment({
timeStamp: data.data.timeStamp,
nonceStr: data.data.nonceStr,
package: data.data.package,
signType: data.data.signType,
paySign: data.data.paySign,
success: function () {
Taro.showToast({
title: "支付成功",
icon: "success",
duration: 2000,
});
emit("successPay", false);
},
fail: function () {
Taro.showToast({
title: "支付失败",
icon: "none",
duration: 2000,
});
emit("closePay", false);
},
});
} else {
// 1微信支付 2积分支付 3挂帐
if (type === 1 || type === 2) {
const { data } = await payOrder({
oid: prop.jfInfo,
OrderType: prop.OrderType,
PayType: type,
});
if (type === 1) {
if (data.data) {
Taro.requestPayment({
timeStamp: data.data.timeStamp,
nonceStr: data.data.nonceStr,
package: data.data.package,
signType: data.data.signType,
paySign: data.data.paySign,
success: function () {
Taro.showToast({
title: "支付成功",
icon: "success",
duration: 2000,
});
emit("successPay", false);
},
fail: function () {
Taro.showToast({
title: "支付失败",
icon: "none",
duration: 2000,
});
emit("closePay", false);
},
});
} else {
Taro.showToast({
title: "未知异常",
icon: "none",
});
emit("closePay", false);
}
} else if (type === 2) {
Taro.showToast({
title: "未知异常",
icon: "none",
title: "支付成功",
icon: "success",
duration: 2000,
});
emit("closePay", false);
emit("successPay", false);
}
} else {
Taro.showToast({
title: "支付成功",
icon: "success",
duration: 2000,
title: "挂帐后结账",
icon: "none",
});
emit("successPay", false);
}
} catch (e) {
Taro.showToast({