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