Commit 1e2ada3f authored by Facius's avatar Facius

feat: 接入支付宝

parent 91ad6dc5
Pipeline #5699 canceled with stages
......@@ -35,18 +35,20 @@
data() {
return {
show: false,
list: [{
image: '/static/image/mine/weixinzhifu@3x.png',
title: '微信支付',
list: [ {
image: '/static/image/mine/zhifubaozhifu@3x.png',
title: '支付宝',
select: true,
provider: 'wxpay'
provider: 'alipay',
channel: 'ALIPAY'
},
// {
// image: '/static/images/mine/zhifubaozhifu@3x.png',
// title: '支付宝',
// select: false,
// provider: 'alipay',
// },
{
image: '/static/image/mine/weixinzhifu@3x.png',
title: '微信支付',
select: false,
provider: 'wxpay',
channel: 'WX'
}
]
}
},
......@@ -67,13 +69,13 @@
// });
// return
// }
// for (var item of this.list) {
// if (item.provider == provider) {
// item.select = !item.select
// } else {
// item.select = false
// }
// }
for (var item of this.list) {
if (item.provider == provider) {
item.select = !item.select
} else {
item.select = false
}
}
},
changeVisibleValue(val) {
this.$emit('update:visible', val)
......@@ -82,8 +84,13 @@
this.changeVisibleValue(false)
},
handleClickBuy() {
this.$emit('click')
this.changeVisibleValue(false)
for (var item of this.list) {
if (item.select) {
this.$emit('buy', item)
this.changeVisibleValue(false)
break
}
}
}
},
}
......
......@@ -111,6 +111,9 @@
"__platform__" : [ "ios", "android" ],
"appid" : "wxf0a780908851623f",
"UniversalLinks" : "https://kaying.cc/uni-universallinks/__UNI__EDB8C7C/"
},
"alipay" : {
"__platform__" : [ "ios", "android" ]
}
},
"share" : {
......
......@@ -92,7 +92,7 @@
</view>
</view>
<view v-if="!hidePay" class="bottom-view"><button class="buy-button" @tap="$u.throttle(handleClickBuy, 500)">立即购买</button></view>
<BottomPay :visible.sync="showPayBottom" @click="$u.throttle(getPaymentInfo, 500)" />
<BottomPay :visible.sync="showPayBottom" @buy="handleClickBottom" />
</view>
</template>
......@@ -219,10 +219,14 @@ export default {
this.showPayBottom = true;
}
} else {
this.getPaymentInfo();
this.getPaymentInfo({channel: 'WX',provider: 'wxpay'});
}
},
async getPaymentInfo() {
handleClickBottom(item) {
this.getPaymentInfo(item)
},
async getPaymentInfo(item) {
console.log('-------getPaymentInfo--------', item)
uni.showLoading({
title: '正在获取订单信息'
});
......@@ -230,17 +234,19 @@ export default {
goodsId: this.selected.id,
loginChannel: this.loginChannel,
authType: this.authType,
payChannel: this.platform == '4' && this.isIOS ? 'APPLEPAY' : 'WX'
payChannel: this.platform == '4' && this.isIOS ? 'APPLEPAY' : item.channel
};
console.log('-------params-------',params)
try {
let { data } = await getOrderInfo(params);
this.startPay(data);
console.log('-------getOrderInfos-------',data)
this.startPay(data,item.provider);
} catch (e) {
this.showToast('获取订单信息失败');
//TODO handle the exception
}
},
startPay(charge) {
startPay(charge,provider) {
uni.showLoading({
title: '支付中'
});
......@@ -263,7 +269,7 @@ export default {
orderInfo: charge.orderInfo,
// #endif
// #ifdef APP-PLUS
provider: this.isIOS ? 'appleiap' : 'wxpay',
provider: this.isIOS ? 'appleiap' : provider,
manualFinishTransaction: this.isIOS ? true : false,
orderInfo: charge.orderInfo,
// #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment