feat(custom): 新增聚合积分支付
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -4,7 +4,7 @@ import Taro from "@tarojs/taro";
|
||||
import { addCart, getCart, clearCart } from "@/api/cart";
|
||||
import { Del2 } from "@nutui/icons-vue-taro";
|
||||
import { createActiveOrder } from "@/api/goods";
|
||||
import { createAfterOrder } from "@/api/admin";
|
||||
import { createAfterOrder, getUserPoint } from "@/api/admin";
|
||||
import Pay from "@/components/Pay.vue";
|
||||
|
||||
interface CardList {
|
||||
@@ -142,11 +142,21 @@ const create_order = async () => {
|
||||
url: `/pages/admin/add_order/pending_order/pending_order_detail/index?oid=${res.data.oid}&bid=${props.merInfo.bid}`,
|
||||
});
|
||||
} else {
|
||||
const mer_info = Taro.getStorageSync("mer_info");
|
||||
const user_info = Taro.getStorageSync("userInfo");
|
||||
const data = await getUserPoint({
|
||||
phone: user_info.data.phone,
|
||||
bid: mer_info.bid,
|
||||
});
|
||||
res = await createActiveOrder({
|
||||
Bid: [props.merInfo.bid],
|
||||
custID: data.data.store_user_id,
|
||||
});
|
||||
if (res.data.oid) {
|
||||
orderData.value = res.oid;
|
||||
orderData.value = {
|
||||
jh_info: data.data,
|
||||
oid: res.data.oid,
|
||||
};
|
||||
isShowPay.value = true;
|
||||
}
|
||||
}
|
||||
@@ -174,9 +184,10 @@ defineExpose({
|
||||
<view class="container">
|
||||
<view>购物车数量: {{ cartInfo.count }}</view>
|
||||
<view v-if="cartInfo.count > 0">
|
||||
<text>总金额: {{ cartInfo.price.toFixed(2) }}元</text
|
||||
<text>总金额: {{ cartInfo.price.toFixed(2) }}元</text>
|
||||
<text v-if="!IsPendingOrder"
|
||||
>,总积分: {{ cartInfo.exchange.toFixed(2) }}</text
|
||||
>
|
||||
<text v-if="!IsPendingOrder">,总积分: {{ cartInfo.exchange.toFixed(2) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="cartInfo.count > 0" class="payBtn" @click.stop="create_order"
|
||||
|
||||
@@ -14,45 +14,40 @@
|
||||
<nut-cell-group
|
||||
:style="{ margin: interval ? '40rpx 0 150rpx 0' : '40rpx 0' }"
|
||||
>
|
||||
<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="先消费后结账"
|
||||
<nut-cell
|
||||
title="微信支付"
|
||||
desc="使用微信快捷支付"
|
||||
is-link
|
||||
@click="goPay(1)"
|
||||
>
|
||||
<template v-slot:icon>
|
||||
<IconFont size="30" :name="require('../static/wx.png')" />
|
||||
</template>
|
||||
</nut-cell>
|
||||
<nut-cell
|
||||
title="平台积分支付"
|
||||
:desc="`剩余积分:${info.integral || 0}`"
|
||||
is-link
|
||||
@click="goPay(2)"
|
||||
>
|
||||
<template v-slot:icon>
|
||||
<IconFont size="30" :name="require('../static/pt.png')" />
|
||||
</template>
|
||||
</nut-cell>
|
||||
<nut-cell
|
||||
v-if="
|
||||
jfInfo.jh_info?.store_user_id ||
|
||||
jfInfo.jh_info?.store_user_id?.length > 0
|
||||
"
|
||||
title="聚合积分支付"
|
||||
:desc="`剩余积分:${jfInfo.jh_info?.integral || 0}`"
|
||||
is-link
|
||||
@click="goPay(3)"
|
||||
>
|
||||
<template v-slot:icon>
|
||||
<IconFont
|
||||
size="30"
|
||||
name="https://img11.360buyimg.com/imagetools/jfs/t1/137646/13/7132/1648/5f4c748bE43da8ddd/a3f06d51dcae7b60.png"
|
||||
/>
|
||||
<IconFont size="30" :name="require('../static/jh.png')" />
|
||||
</template>
|
||||
</nut-cell> -->
|
||||
</nut-cell>
|
||||
</nut-cell-group>
|
||||
</view>
|
||||
</nut-popup>
|
||||
@@ -112,21 +107,22 @@ const getInfo = async () => {
|
||||
};
|
||||
|
||||
const goPay = async (type: number) => {
|
||||
console.log(prop);
|
||||
if (!prop.jfInfo)
|
||||
return Taro.showToast({
|
||||
title: "未获取到订单信息",
|
||||
title: "未获取到订单信息~",
|
||||
icon: "none",
|
||||
});
|
||||
try {
|
||||
// 1微信支付 2积分支付 3挂帐
|
||||
if (type === 1 || type === 2) {
|
||||
const { data } = await payOrder({
|
||||
oid: prop.jfInfo,
|
||||
OrderType: prop.OrderType,
|
||||
PayType: type,
|
||||
});
|
||||
if (type === 1) {
|
||||
console.log(prop.jfInfo);
|
||||
// 1微信支付 2积分支付 3专属积分兑换
|
||||
const { data } = await payOrder({
|
||||
oid: prop.jfInfo.oid,
|
||||
OrderType: prop.OrderType,
|
||||
PayType: type,
|
||||
});
|
||||
|
||||
switch (type) {
|
||||
case 1:
|
||||
if (data.data) {
|
||||
Taro.requestPayment({
|
||||
timeStamp: data.data.timeStamp,
|
||||
@@ -153,24 +149,19 @@ const goPay = async (type: number) => {
|
||||
});
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: "未知异常",
|
||||
title: "支付失败,请稍后再试~",
|
||||
icon: "none",
|
||||
});
|
||||
emit("closePay", false);
|
||||
}
|
||||
} else if (type === 2) {
|
||||
break;
|
||||
default:
|
||||
Taro.showToast({
|
||||
title: "支付成功",
|
||||
icon: "success",
|
||||
duration: 2000,
|
||||
icon: "none",
|
||||
});
|
||||
emit("successPay", false);
|
||||
}
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: "挂帐后结账",
|
||||
icon: "none",
|
||||
});
|
||||
break;
|
||||
}
|
||||
} catch (e) {
|
||||
Taro.showToast({
|
||||
|
||||
Reference in New Issue
Block a user