feat(test): 对接测试支付功能

This commit is contained in:
fhysy 2025-04-14 10:37:06 +08:00
parent 592e71d338
commit b1c5c0c14d
1 changed files with 36 additions and 7 deletions

View File

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