feat(test): 对接测试支付功能
This commit is contained in:
parent
592e71d338
commit
b1c5c0c14d
|
@ -17,7 +17,23 @@
|
|||
<text class="label">订单标题</text>
|
||||
<input class="value-input" v-model="orderInfo.billContent" placeholder="测试商品" />
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<text class="label">支付通道</text>
|
||||
<view class="radio-group">
|
||||
<view
|
||||
v-for="(item, index) in wayCodeList"
|
||||
:key="index"
|
||||
class="radio-item"
|
||||
:class="{ active: orderInfo.wayCode === item.value }"
|
||||
@click="orderInfo.wayCode = item.value"
|
||||
>
|
||||
<view class="radio-circle">
|
||||
<view v-if="orderInfo.wayCode === item.value" class="radio-inner"></view>
|
||||
</view>
|
||||
<text>{{ item.label }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="info-item">
|
||||
<text class="label">分账方式</text>
|
||||
<view class="radio-group">
|
||||
|
@ -72,6 +88,7 @@ export default {
|
|||
"billHeader": null,
|
||||
"billReceiverEmail": null,
|
||||
"billReceiverPhone": null,
|
||||
"wayCode":'WX_JSAPI',
|
||||
"billType": 0,
|
||||
"id": "",
|
||||
"orderSn": "",
|
||||
|
@ -83,6 +100,10 @@ export default {
|
|||
{ label: "支付完成自动分账", value: 1 },
|
||||
{ label: "手动分账", value: 2 }
|
||||
],
|
||||
wayCodeList: [
|
||||
{ label: "微信支付", value: 'WX_JSAPI' },
|
||||
{ label: "拉卡拉微信支付", value: 'LKL_WX_NATIVE' },
|
||||
],
|
||||
buttonLoading: false,
|
||||
officialAccount: {
|
||||
appid: '',
|
||||
|
@ -141,18 +162,18 @@ export default {
|
|||
|
||||
// 调用支付API
|
||||
this.$api.orderApi.addPayOrder({
|
||||
orderId: this.orderInfo.id || this.orderInfo.orderSn,
|
||||
orderId: this.orderInfo.orderSn,
|
||||
channelExtra: JSON.stringify({'openid': this.openId}),
|
||||
wayCode: 'LKL_WX_JSAPI',
|
||||
wayCode: this.orderInfo.wayCode,
|
||||
amount: amountInCents,
|
||||
subject: this.orderInfo.billContent || '测试商品'
|
||||
}).then((res) => {
|
||||
console.log("获取支付详情", res)
|
||||
this.buttonLoading = false;
|
||||
|
||||
if (res.code == 200 && res.data) {
|
||||
if ((res.code == 200 || res.code == 0) && res.data && res.data.payData) {
|
||||
// 调用微信支付
|
||||
this.wxpay(res.data);
|
||||
this.wxpay(res.data.payData);
|
||||
} else {
|
||||
this.$refs.uToast.show({
|
||||
title: '获取支付参数失败',
|
||||
|
@ -224,12 +245,21 @@ export default {
|
|||
},
|
||||
|
||||
wxpay(data) {
|
||||
// data = {
|
||||
// "timeStamp": "1744272425",
|
||||
// "packageValue": "prepay_id=wx10160704960354e4b2ac41d79c59680000",
|
||||
// "package": "prepay_id=wx10160704960354e4b2ac41d79c59680000",
|
||||
// "paySign": "65B0E88C3B0812D363C292B717C6162C",
|
||||
// "appId": "wx12bc01c230cde36e",
|
||||
// "signType": "MD5",
|
||||
// "nonceStr": "jmQDznBltwWXme14"
|
||||
// }
|
||||
jweixin.config({
|
||||
debug: false,
|
||||
appId: data.appId,
|
||||
timestamp: data.timestamp,
|
||||
nonceStr: data.nonceStr,
|
||||
signature: data.signature,
|
||||
// signature: data.signature,
|
||||
jsApiList: ['chooseWXPay']
|
||||
});
|
||||
|
||||
|
@ -335,7 +365,6 @@ export default {
|
|||
}
|
||||
|
||||
.value-input {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 10rpx;
|
||||
|
|
Loading…
Reference in New Issue