feat:【MALL 商城】佣金提现,优化字段,以及支持更多 API 自动打款
parent
1948aae067
commit
098057b2de
|
@ -58,7 +58,7 @@
|
||||||
|
|
||||||
const typeList = [
|
const typeList = [
|
||||||
{
|
{
|
||||||
icon: '/static/img/shop/pay/wechat.png',
|
icon: '/static/img/shop/pay/wallet.png',
|
||||||
title: '钱包余额',
|
title: '钱包余额',
|
||||||
value: '1',
|
value: '1',
|
||||||
},
|
},
|
||||||
|
@ -69,19 +69,24 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: '/static/img/shop/pay/wechat.png',
|
icon: '/static/img/shop/pay/wechat.png',
|
||||||
title: '微信账户', // 微信手动转账
|
title: '微信收款码', // 微信手动转账
|
||||||
value: '3',
|
value: '3',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: '/static/img/shop/pay/alipay.png',
|
icon: '/static/img/shop/pay/alipay.png',
|
||||||
title: '支付宝账户',
|
title: '支付宝收款码', // 支付宝手动转账
|
||||||
value: '4',
|
value: '4',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: '/static/img/shop/pay/wechat.png',
|
icon: '/static/img/shop/pay/wechat_api.png',
|
||||||
title: '微信零钱', // 微信 API 转账
|
title: '微信零钱', // 微信 API 转账
|
||||||
value: '5',
|
value: '5',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
icon: '/static/img/shop/pay/alipay_api.png',
|
||||||
|
title: '支付宝余额', // 支付宝 API 转账
|
||||||
|
value: '6',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
function onChange(e) {
|
function onChange(e) {
|
||||||
|
|
|
@ -49,18 +49,18 @@
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
<!-- 提现账号 -->
|
<!-- 提现账号 -->
|
||||||
<view class="card-title" v-show="['2', '3', '4', '5'].includes(state.accountInfo.type)">
|
<view class="card-title" v-show="['2', '6'].includes(state.accountInfo.type)">
|
||||||
提现账号
|
提现账号
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
class="input-box ss-flex ss-col-center border-bottom"
|
class="input-box ss-flex ss-col-center border-bottom"
|
||||||
v-show="['2', '3', '4'].includes(state.accountInfo.type)"
|
v-show="['2', '6'].includes(state.accountInfo.type)"
|
||||||
>
|
>
|
||||||
<view class="unit" />
|
<view class="unit" />
|
||||||
<uni-easyinput
|
<uni-easyinput
|
||||||
:inputBorder="false"
|
:inputBorder="false"
|
||||||
class="ss-flex-1 ss-p-l-10"
|
class="ss-flex-1 ss-p-l-10"
|
||||||
v-model="state.accountInfo.accountNo"
|
v-model="state.accountInfo.userAccount"
|
||||||
placeholder="请输入提现账号"
|
placeholder="请输入提现账号"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
@ -73,27 +73,29 @@
|
||||||
<view class="unit" />
|
<view class="unit" />
|
||||||
<view class="upload-img">
|
<view class="upload-img">
|
||||||
<s-uploader
|
<s-uploader
|
||||||
v-model:url="state.accountInfo.accountQrCodeUrl"
|
v-model:url="state.accountInfo.qrCodeUrl"
|
||||||
fileMediatype="image"
|
fileMediatype="image"
|
||||||
limit="1"
|
limit="1"
|
||||||
mode="grid"
|
mode="grid"
|
||||||
:imageStyles="{ width: '168rpx', height: '168rpx' }"
|
:imageStyles="{ width: '168rpx', height: '168rpx' }"
|
||||||
@success="(payload) => (state.accountInfo.accountQrCodeUrl = payload.tempFilePaths[0])"
|
@success="(payload) => (state.accountInfo.qrCodeUrl = payload.tempFilePaths[0])"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 持卡人姓名 -->
|
<!-- 持卡人姓名 -->
|
||||||
<view class="card-title" v-show="state.accountInfo.type === '2'">持卡人</view>
|
<view class="card-title" v-show="['2', '5', '6'].includes(state.accountInfo.type)">
|
||||||
|
收款款真名
|
||||||
|
</view>
|
||||||
<view
|
<view
|
||||||
class="input-box ss-flex ss-col-center border-bottom"
|
class="input-box ss-flex ss-col-center border-bottom"
|
||||||
v-show="state.accountInfo.type === '2'"
|
v-show="['2', '5', '6'].includes(state.accountInfo.type)"
|
||||||
>
|
>
|
||||||
<view class="unit" />
|
<view class="unit" />
|
||||||
<uni-easyinput
|
<uni-easyinput
|
||||||
:inputBorder="false"
|
:inputBorder="false"
|
||||||
class="ss-flex-1 ss-p-l-10"
|
class="ss-flex-1 ss-p-l-10"
|
||||||
v-model="state.accountInfo.name"
|
v-model="state.accountInfo.userName"
|
||||||
placeholder="请输入持卡人姓名"
|
placeholder="请输入收款款真名"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
<!-- 提现银行 -->
|
<!-- 提现银行 -->
|
||||||
|
@ -162,7 +164,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, onBeforeMount, reactive } from 'vue';
|
import { onBeforeMount, reactive } from 'vue';
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import accountTypeSelect from './components/account-type-select.vue';
|
import accountTypeSelect from './components/account-type-select.vue';
|
||||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||||
|
@ -170,19 +172,18 @@
|
||||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||||
import DictApi from '@/sheep/api/system/dict';
|
import DictApi from '@/sheep/api/system/dict';
|
||||||
import SLayout from '@/sheep/components/s-layout/s-layout.vue';
|
import SLayout from '@/sheep/components/s-layout/s-layout.vue';
|
||||||
|
import { goBindWeixin } from '@/sheep/platform/pay';
|
||||||
|
|
||||||
const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
|
const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
|
||||||
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
||||||
|
|
||||||
const userStore = sheep.$store('user');
|
|
||||||
const userInfo = computed(() => userStore.userInfo);
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
accountInfo: {
|
accountInfo: {
|
||||||
// 提现表单
|
// 提现表单
|
||||||
type: undefined,
|
type: undefined,
|
||||||
accountNo: undefined,
|
userAccount: undefined,
|
||||||
accountQrCodeUrl: undefined,
|
userName: undefined,
|
||||||
name: undefined,
|
qrCodeUrl: undefined,
|
||||||
bankName: undefined,
|
bankName: undefined,
|
||||||
bankAddress: undefined,
|
bankAddress: undefined,
|
||||||
},
|
},
|
||||||
|
@ -218,11 +219,25 @@
|
||||||
sheep.$helper.toast('请选择提现方式');
|
sheep.$helper.toast('请选择提现方式');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
let openid;
|
||||||
|
if (state.accountInfo.type === '5') {
|
||||||
|
openid = await sheep.$platform.useProvider('wechat').getOpenid();
|
||||||
|
// 如果获取不到 openid,微信无法发起支付,此时需要引导
|
||||||
|
if (!openid) {
|
||||||
|
goBindWeixin();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 提交请求
|
// 提交请求
|
||||||
let { code } = await BrokerageApi.createBrokerageWithdraw({
|
const data = {
|
||||||
...state.accountInfo,
|
...state.accountInfo,
|
||||||
price: state.accountInfo.price * 100,
|
price: state.accountInfo.price * 100,
|
||||||
});
|
};
|
||||||
|
if (state.accountInfo.type === '5') {
|
||||||
|
data.userAccount = openid;
|
||||||
|
}
|
||||||
|
let { code } = await BrokerageApi.createBrokerageWithdraw(data);
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,7 +235,7 @@ export default class SheepPay {
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uni.requestPayment({
|
uni.requestPayment({
|
||||||
provider: 'alipay',
|
provider: 'alipay',
|
||||||
orderInfo: data.displayContent, // 直接使用返回的支付参数
|
orderInfo: data.displayContent, // 直接使用返回的支付参数
|
||||||
|
@ -264,7 +264,7 @@ export default class SheepPay {
|
||||||
|
|
||||||
// 解析支付参数
|
// 解析支付参数
|
||||||
const payConfig = JSON.parse(data.displayContent);
|
const payConfig = JSON.parse(data.displayContent);
|
||||||
|
|
||||||
// 调用微信支付
|
// 调用微信支付
|
||||||
uni.requestPayment({
|
uni.requestPayment({
|
||||||
provider: 'wxpay',
|
provider: 'wxpay',
|
||||||
|
@ -283,7 +283,7 @@ export default class SheepPay {
|
||||||
sheep.$helper.toast('支付失败:' + err.errMsg);
|
sheep.$helper.toast('支付失败:' + err.errMsg);
|
||||||
that.payResult('fail');
|
that.payResult('fail');
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,15 +294,7 @@ export default class SheepPay {
|
||||||
|
|
||||||
// 引导绑定微信
|
// 引导绑定微信
|
||||||
bindWeixin() {
|
bindWeixin() {
|
||||||
uni.showModal({
|
goBindWeixin();
|
||||||
title: '微信支付',
|
|
||||||
content: '请先绑定微信再使用微信支付',
|
|
||||||
success: function (res) {
|
|
||||||
if (res.confirm) {
|
|
||||||
sheep.$platform.useProvider('wechat').bind();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,3 +375,15 @@ export function goPayResult(id, orderType, resultType) {
|
||||||
payState: resultType,
|
payState: resultType,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function goBindWeixin() {
|
||||||
|
uni.showModal({
|
||||||
|
title: '微信支付',
|
||||||
|
content: '请先绑定微信再使用微信支付',
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
sheep.$platform.useProvider('wechat').bind();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue