fix: 接入抖音原生支付并修复App支付服务缺失
This commit is contained in:
@@ -45,7 +45,8 @@
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
<script>
|
||||
import { appDypayFun, prepareDouyinPay, filterDouyinPayWays } from '@/utils/douyin-pay.js';
|
||||
import Header from '@/components/header.vue';
|
||||
import {
|
||||
getRechargeSupportPay,
|
||||
@@ -103,11 +104,14 @@
|
||||
async getWayOption() {
|
||||
const result = await getRechargeSupportPay();
|
||||
if (result && result.bizcode === 100) {
|
||||
this.wayOption = result.data;
|
||||
this.wayOption = filterDouyinPayWays(result.data);
|
||||
}
|
||||
},
|
||||
// 立即充值
|
||||
async rechargeOk() {
|
||||
async rechargeOk() {
|
||||
if (this._paySubmitting) return;
|
||||
this._paySubmitting = true;
|
||||
try {
|
||||
console.log('aaaaa', this.form);
|
||||
const params = this.form;
|
||||
if (!params.amount) {
|
||||
@@ -145,12 +149,15 @@
|
||||
|
||||
console.log("params---", params);
|
||||
|
||||
const result = await recharge(params);
|
||||
if (!await prepareDouyinPay(params.payway)) return;
|
||||
const result = await recharge(params);
|
||||
console.log("result", result);
|
||||
if (result && result.bizcode === 100) {
|
||||
const item = result.data;
|
||||
console.log("item", item);
|
||||
if (item.wechat && Object.keys(item.wechat).length !== 0) {
|
||||
if (item.douyin) {
|
||||
await appDypayFun(item);
|
||||
} else if (item.wechat && Object.keys(item.wechat).length !== 0) {
|
||||
this.appWxpay(item.wechat, item.orderId, item.orderNum);
|
||||
} else if (item.alipay && Object.keys(item.alipay).length !== 0 && item.alipay) {
|
||||
this.zfbPay(item.alipay, item.orderId, item.orderNum);
|
||||
@@ -162,8 +169,11 @@
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
// app 微信支付
|
||||
} catch (error) {
|
||||
uni.showToast({ title: error.message || error.msg || '充值请求失败,请查看订单后重试', icon: 'none' });
|
||||
} finally { this._paySubmitting = false; }
|
||||
},
|
||||
// app 微信支付
|
||||
async appWxpay(alipay, orderId, orderNum) {
|
||||
try {
|
||||
const result = await appWxpayFun(alipay, orderId, orderNum);
|
||||
@@ -263,4 +273,4 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
Reference in New Issue
Block a user