feat(custom): 新增支付方式动态获取
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-07-18 19:18:21 +08:00
parent d1e5e92955
commit c4645fdc17
2 changed files with 26 additions and 18 deletions

View File

@@ -90,3 +90,6 @@ export const checkTradePwd = (data: object) =>
// 获取活动商品或者活动积分商品
export const getHdOrJfGoods = (data: object) =>
request('/activity/goods', data, 'POST');
// 获取支付列表
export const getPayList = (data: object) => request('/payType', data, 'POST');

View File

@@ -8,21 +8,25 @@
<view class="line"></view>
<nut-price position="after" symbol="积分" :price="b" size="large" />
</view>
{{ payVal }}
<nut-radio-group class="w-[95%]" v-model="payVal">
<nut-cell-group class="w-full">
<nut-cell class="text-[#333333]" title="支付方式"></nut-cell>
<nut-cell
v-for="(item, index) in payList"
:key="index"
class="flex items-center"
title="微信支付"
@click="cellClick(1, false)">
:title="item.name"
:desc="item.number > 0 ? item.number : ''"
@click="cellClick(item.ID)">
<template #icon>
<IconFont size="30" :name="require('../../../static/wx.png')" />
<IconFont size="30" :name="item.icon" />
</template>
<template #link>
<nut-radio :label="1"></nut-radio>
<nut-radio :label="item.ID"></nut-radio>
</template>
</nut-cell>
<nut-cell
<!-- <nut-cell
class="flex items-center"
title="平台积分支付"
:desc="`剩余积分:${orderData.User?.integral || 0}`"
@@ -49,7 +53,7 @@
:disabled="orderData.integral === 0"
:label="3"></nut-radio>
</template>
</nut-cell>
</nut-cell> -->
</nut-cell-group>
</nut-radio-group>
<view class="w-[90%] mt-[100px]">
@@ -99,7 +103,7 @@
import Taro from '@tarojs/taro';
import {IconFont} from '@nutui/icons-vue-taro';
import {onUnmounted, ref} from 'vue';
import {getActiveOrderDetail, checkTradePwd} from '@/api/goods';
import {getActiveOrderDetail, checkTradePwd, getPayList} from '@/api/goods';
import {getUserPoint} from '@/api/admin';
import {payOrder} from '@/api/order';
import {isCheckTradePwd} from '@/api/user';
@@ -130,12 +134,21 @@ const opt = ref<any>({});
Taro.useLoad(e => {
const {oid, bid, OrderType} = e;
opt.value = e;
get_pay_list();
getData(oid, bid, OrderType);
});
const a = ref(0);
const b = ref(0);
const payList = ref<any>([]);
const get_pay_list = async () => {
const res = await getPayList({});
// console.log(res);
payList.value = res.data.data || [];
};
const getData = async (oid: string, bid: string, OrderType: number) => {
const user_info = Taro.getStorageSync('userInfo');
const data = await getUserPoint({
@@ -163,7 +176,7 @@ const getData = async (oid: string, bid: string, OrderType: number) => {
b.value += item.exchange;
});
console.log(orderData.value);
// console.log(orderData.value);
if (!orderData.value.oid)
return Taro.showToast({
title: '未获取到订单信息~',
@@ -290,16 +303,8 @@ const shortClose = (isMsg: boolean = true) => {
if (isMsg) Taro.showToast({title: '支付取消', icon: 'none'});
};
const cellClick = (val: number, isTrue: boolean) => {
if (isTrue) {
Taro.showToast({
title: '该支付暂不可用!',
icon: 'none',
});
payVal.value = undefined;
} else {
payVal.value = val;
}
const cellClick = (val: number) => {
payVal.value = val;
};
const countdownTime = () => {