@uxda/appkit 4.3.12 → 4.3.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMPONENT_USAGE.md +3 -3
- package/dist/index.js +97 -32
- package/package.json +1 -1
- package/src/balance/api/index.ts +1 -1
- package/src/notice/api/index.ts +1 -1
- package/src/payment/api/endpoints.ts +14 -0
- package/src/payment/api/index.ts +1 -1
- package/src/payment/components/RechargeView.vue +45 -13
- package/src/payment/components/TradeView.vue +47 -11
- package/src/payment/services/request-payment.ts +7 -3
- package/src/user/api/index.ts +1 -1
package/COMPONENT_USAGE.md
CHANGED
|
@@ -152,7 +152,7 @@ const handleAgreeClick = () => {
|
|
|
152
152
|
### 注意事项
|
|
153
153
|
|
|
154
154
|
1. **环境要求**
|
|
155
|
-
- H5环境:必须在微信浏览器中打开
|
|
155
|
+
<!-- - H5环境:必须在微信浏览器中打开 -->
|
|
156
156
|
- 小程序环境:需要配置微信登录权限
|
|
157
157
|
|
|
158
158
|
2. **数据获取**
|
|
@@ -228,7 +228,7 @@ const handleRechargeComplete = (result) => {
|
|
|
228
228
|
|
|
229
229
|
1. 组件会自动获取充值金额列表
|
|
230
230
|
2. 必须勾选协议才能进行支付
|
|
231
|
-
3. H5环境需要在微信浏览器中打开
|
|
231
|
+
<!-- 3. H5环境需要在微信浏览器中打开 -->
|
|
232
232
|
|
|
233
233
|
---
|
|
234
234
|
|
|
@@ -586,7 +586,7 @@ A:
|
|
|
586
586
|
### Q4: H5环境支付失败怎么办?
|
|
587
587
|
|
|
588
588
|
A: 确保:
|
|
589
|
-
1. 在微信浏览器中打开
|
|
589
|
+
<!-- 1. 在微信浏览器中打开 -->
|
|
590
590
|
2. 已正确配置 `payFinishJumpUrl`
|
|
591
591
|
3. 检查网络连接和接口权限
|
|
592
592
|
|
package/dist/index.js
CHANGED
|
@@ -1122,7 +1122,7 @@ function useHttp$3() {
|
|
|
1122
1122
|
const headers = {
|
|
1123
1123
|
Token: appkitOptions.tempToken() || appkitOptions.token(),
|
|
1124
1124
|
Appcode: appkitOptions.app(),
|
|
1125
|
-
|
|
1125
|
+
tid: appkitOptions.tenant(),
|
|
1126
1126
|
gray: appkitOptions.gray ? appkitOptions.gray() : "0"
|
|
1127
1127
|
};
|
|
1128
1128
|
const $http = createHttp({
|
|
@@ -3151,7 +3151,8 @@ const endpointsList$2 = {
|
|
|
3151
3151
|
translate: (data) => ({
|
|
3152
3152
|
appCode: data.app,
|
|
3153
3153
|
// caseCode: 'recharge', // 这个参数可以不要
|
|
3154
|
-
tenantId: data.tenant
|
|
3154
|
+
tenantId: data.tenant,
|
|
3155
|
+
scene: data.scene
|
|
3155
3156
|
}),
|
|
3156
3157
|
transform: (data) => data.amountList.map((d) => ({
|
|
3157
3158
|
token: d.desc,
|
|
@@ -3184,6 +3185,9 @@ const endpointsList$2 = {
|
|
|
3184
3185
|
return {
|
|
3185
3186
|
json,
|
|
3186
3187
|
// 拉起微信支付用的JSON串
|
|
3188
|
+
paymentType: data.paymentType,
|
|
3189
|
+
prePayStr: data.prePayStr,
|
|
3190
|
+
thirdPayId: data.thirdPayId,
|
|
3187
3191
|
paymentId: data.payId
|
|
3188
3192
|
// 查询用支付ID
|
|
3189
3193
|
};
|
|
@@ -3212,6 +3216,9 @@ const endpointsList$2 = {
|
|
|
3212
3216
|
return {
|
|
3213
3217
|
json,
|
|
3214
3218
|
// 拉起微信支付用的JSON串
|
|
3219
|
+
paymentType: data.paymentType,
|
|
3220
|
+
prePayStr: data.prePayStr,
|
|
3221
|
+
thirdPayId: data.thirdPayId,
|
|
3215
3222
|
paymentId: data.payId
|
|
3216
3223
|
// 查询用支付ID
|
|
3217
3224
|
};
|
|
@@ -3220,6 +3227,13 @@ const endpointsList$2 = {
|
|
|
3220
3227
|
\u83B7\u53D6\u589E\u503C\u6743\u76CA\u7C7B\u76EE: {
|
|
3221
3228
|
path: "/payment/paymentCaseConfig/getBalanceAndRiskQueryPriceConfig",
|
|
3222
3229
|
transform: (data) => data
|
|
3230
|
+
},
|
|
3231
|
+
\u83B7\u53D6\u652F\u4ED8\u7ED3\u679C: {
|
|
3232
|
+
path: "/payment/outer/payment/getPayResult",
|
|
3233
|
+
translate: (data) => ({
|
|
3234
|
+
thirdPayId: data.thirdPayId
|
|
3235
|
+
}),
|
|
3236
|
+
transform: (data) => data
|
|
3223
3237
|
}
|
|
3224
3238
|
};
|
|
3225
3239
|
const endpoints$1 = Object.fromEntries(
|
|
@@ -3284,7 +3298,7 @@ function useHttp$2(defaultHeader) {
|
|
|
3284
3298
|
const headers = {
|
|
3285
3299
|
Token: appkitOptions.tempToken() || appkitOptions.token(),
|
|
3286
3300
|
Appcode: defaultHeader?.Appcode || appkitOptions.app(),
|
|
3287
|
-
|
|
3301
|
+
tid: defaultHeader?.Tenant || appkitOptions.tenant(),
|
|
3288
3302
|
gray: appkitOptions.gray ? appkitOptions.gray() : "0"
|
|
3289
3303
|
};
|
|
3290
3304
|
const $http = createHttp({
|
|
@@ -3389,12 +3403,14 @@ const requestBrandWCPay = (params, Appcode = "") => {
|
|
|
3389
3403
|
$http.post(endpoints$1.\u83B7\u53D6\u5FAE\u4FE1\u652F\u4ED8\u53C2\u6570\u5305, {
|
|
3390
3404
|
...params
|
|
3391
3405
|
}).then((response) => {
|
|
3392
|
-
if (!response.json) {
|
|
3406
|
+
if (!response.json && !response.prePayStr) {
|
|
3393
3407
|
showToast({
|
|
3394
3408
|
title: response.message,
|
|
3395
3409
|
icon: "none"
|
|
3396
3410
|
});
|
|
3397
3411
|
resolve(false);
|
|
3412
|
+
} else if (!response.json && response.prePayStr) {
|
|
3413
|
+
resolve(response);
|
|
3398
3414
|
} else if (params.fromMini) {
|
|
3399
3415
|
resolve(response.json);
|
|
3400
3416
|
} else {
|
|
@@ -3418,12 +3434,14 @@ const requestBrandWCPayByBean = (params, Appcode = "") => {
|
|
|
3418
3434
|
$http.post(endpoints$1.\u83B7\u53D6\u6743\u76CA\u5FAE\u4FE1\u652F\u4ED8, {
|
|
3419
3435
|
...params
|
|
3420
3436
|
}).then((response) => {
|
|
3421
|
-
if (!response.json) {
|
|
3437
|
+
if (!response.json && !response.prePayStr) {
|
|
3422
3438
|
showToast({
|
|
3423
3439
|
title: response.message,
|
|
3424
3440
|
icon: "none"
|
|
3425
3441
|
});
|
|
3426
3442
|
resolve(false);
|
|
3443
|
+
} else if (!response.json && response.prePayStr) {
|
|
3444
|
+
resolve(response);
|
|
3427
3445
|
} else if (params.fromMini) {
|
|
3428
3446
|
resolve(response.json);
|
|
3429
3447
|
} else {
|
|
@@ -3455,6 +3473,10 @@ function isWechat() {
|
|
|
3455
3473
|
let ua = window.navigator.userAgent.toLowerCase();
|
|
3456
3474
|
return ua.includes("micromessenger");
|
|
3457
3475
|
}
|
|
3476
|
+
function isAlipay() {
|
|
3477
|
+
let ua = window.navigator.userAgent.toLowerCase();
|
|
3478
|
+
return ua.includes("alipayclient");
|
|
3479
|
+
}
|
|
3458
3480
|
const isIOS = () => {
|
|
3459
3481
|
if (typeof window !== "undefined") {
|
|
3460
3482
|
return /iPhone|iPad|iPod/i.test(window.navigator.userAgent);
|
|
@@ -3474,7 +3496,7 @@ var script$E = /* @__PURE__ */ defineComponent({
|
|
|
3474
3496
|
payFinishJumpUrl: { type: String, required: false }
|
|
3475
3497
|
},
|
|
3476
3498
|
emits: ["complete", "agree", "loaded"],
|
|
3477
|
-
setup(__props, { emit: __emit }) {
|
|
3499
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
3478
3500
|
const props = __props;
|
|
3479
3501
|
const { params } = useRouter();
|
|
3480
3502
|
const emit = __emit;
|
|
@@ -3482,7 +3504,8 @@ var script$E = /* @__PURE__ */ defineComponent({
|
|
|
3482
3504
|
agreed: false,
|
|
3483
3505
|
selected: 0,
|
|
3484
3506
|
agreementOpen: false,
|
|
3485
|
-
buttonLoading: false
|
|
3507
|
+
buttonLoading: false,
|
|
3508
|
+
thirdPayId: ""
|
|
3486
3509
|
});
|
|
3487
3510
|
const amounts = ref([]);
|
|
3488
3511
|
const onAgreementLinkClick = (e) => {
|
|
@@ -3497,7 +3520,8 @@ var script$E = /* @__PURE__ */ defineComponent({
|
|
|
3497
3520
|
const $http = useHttp$2({ Appcode: props.app !== "cloudkitPro" ? props.app : "", Tenant: props.tenant });
|
|
3498
3521
|
$http.get(endpoints$1.\u83B7\u53D6\u5145\u503C\u91D1\u989D\u5217\u8868, {
|
|
3499
3522
|
app: props.app,
|
|
3500
|
-
tenant: props.tenant
|
|
3523
|
+
tenant: props.tenant,
|
|
3524
|
+
scene: isWechat() ? "" : "APP"
|
|
3501
3525
|
}).then((response) => {
|
|
3502
3526
|
amounts.value = response;
|
|
3503
3527
|
emit("loaded");
|
|
@@ -3513,28 +3537,22 @@ var script$E = /* @__PURE__ */ defineComponent({
|
|
|
3513
3537
|
}
|
|
3514
3538
|
state.buttonLoading = true;
|
|
3515
3539
|
if (Taro.getEnv() === "WEB") {
|
|
3516
|
-
if (!isWechat()) {
|
|
3517
|
-
showToast({
|
|
3518
|
-
title: "\u8BF7\u4F7F\u7528\u5FAE\u4FE1\u6D4F\u89C8\u5668\u6253\u5F00",
|
|
3519
|
-
icon: "none"
|
|
3520
|
-
});
|
|
3521
|
-
state.buttonLoading = false;
|
|
3522
|
-
return false;
|
|
3523
|
-
}
|
|
3524
3540
|
requestBrandWCPay({
|
|
3525
3541
|
amount: amounts.value[state.selected].amount,
|
|
3526
3542
|
app: "loankitMp",
|
|
3527
3543
|
tenant: props.tenant,
|
|
3528
3544
|
accountAuthFlag: false,
|
|
3529
|
-
channelCode:
|
|
3545
|
+
channelCode: getChannelCode(),
|
|
3530
3546
|
payFinishJumpUrl: props.payFinishJumpUrl,
|
|
3531
3547
|
fromMini: !!params.from,
|
|
3532
3548
|
clientInfo: "H5"
|
|
3533
3549
|
}).then((result) => {
|
|
3534
|
-
console.log(result, "------requestBrandWCPay");
|
|
3535
3550
|
state.buttonLoading = false;
|
|
3536
3551
|
if (typeof result === "boolean" && result) {
|
|
3537
3552
|
window.location.href = props.payFinishJumpUrl;
|
|
3553
|
+
} else if (typeof result === "object" && result?.paymentType === "H5" && result?.prePayStr) {
|
|
3554
|
+
state.thirdPayId = result?.thirdPayId || "";
|
|
3555
|
+
window.location.href = result?.prePayStr;
|
|
3538
3556
|
} else {
|
|
3539
3557
|
emit("complete", result);
|
|
3540
3558
|
}
|
|
@@ -3557,6 +3575,29 @@ var script$E = /* @__PURE__ */ defineComponent({
|
|
|
3557
3575
|
});
|
|
3558
3576
|
}
|
|
3559
3577
|
};
|
|
3578
|
+
function getChannelCode() {
|
|
3579
|
+
if (isWechat()) {
|
|
3580
|
+
return "centergzh";
|
|
3581
|
+
} else if (isAlipay()) {
|
|
3582
|
+
return "YundouZfb";
|
|
3583
|
+
} else {
|
|
3584
|
+
return "distributor";
|
|
3585
|
+
}
|
|
3586
|
+
}
|
|
3587
|
+
const payResultCheck = () => {
|
|
3588
|
+
if (!state.thirdPayId) return;
|
|
3589
|
+
const $http = useHttp$2();
|
|
3590
|
+
$http.get(endpoints$1.\u83B7\u53D6\u652F\u4ED8\u7ED3\u679C, {
|
|
3591
|
+
thirdPayId: state.thirdPayId
|
|
3592
|
+
}).then((response) => {
|
|
3593
|
+
if (response.payStatus === "paid") {
|
|
3594
|
+
emit("complete", true);
|
|
3595
|
+
}
|
|
3596
|
+
});
|
|
3597
|
+
};
|
|
3598
|
+
__expose({
|
|
3599
|
+
payResultCheck
|
|
3600
|
+
});
|
|
3560
3601
|
return (_ctx, _cache) => {
|
|
3561
3602
|
const _component_nut_checkbox = Checkbox;
|
|
3562
3603
|
const _component_nut_button = Button;
|
|
@@ -3872,7 +3913,7 @@ var script$A = /* @__PURE__ */ defineComponent({
|
|
|
3872
3913
|
apps: { type: String, required: false }
|
|
3873
3914
|
},
|
|
3874
3915
|
emits: ["complete", "agree", "loaded"],
|
|
3875
|
-
setup(__props, { emit: __emit }) {
|
|
3916
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
3876
3917
|
const props = __props;
|
|
3877
3918
|
const { formatAmount } = useAmount();
|
|
3878
3919
|
const { params } = useRouter();
|
|
@@ -3881,7 +3922,8 @@ var script$A = /* @__PURE__ */ defineComponent({
|
|
|
3881
3922
|
agreed: false,
|
|
3882
3923
|
selected: 0,
|
|
3883
3924
|
// agreementOpen: false,
|
|
3884
|
-
buttonLoading: false
|
|
3925
|
+
buttonLoading: false,
|
|
3926
|
+
thirdPayId: ""
|
|
3885
3927
|
});
|
|
3886
3928
|
const balance = ref(0);
|
|
3887
3929
|
const amounts = ref([]);
|
|
@@ -3921,7 +3963,8 @@ var script$A = /* @__PURE__ */ defineComponent({
|
|
|
3921
3963
|
onMounted(() => {
|
|
3922
3964
|
const $http = useHttp$2({ Appcode: props.headerApp, Tenant: props.tenant });
|
|
3923
3965
|
$http.get(endpoints$1.\u83B7\u53D6\u589E\u503C\u6743\u76CA\u7C7B\u76EE, {
|
|
3924
|
-
rightCode: props.app === "corporateStar" ? "riskQueryCompany" : "riskQueryMulti"
|
|
3966
|
+
rightCode: props.app === "corporateStar" ? "riskQueryCompany" : "riskQueryMulti",
|
|
3967
|
+
scene: isWechat() ? "" : "APP"
|
|
3925
3968
|
}).then((res) => {
|
|
3926
3969
|
balance.value = res.balance;
|
|
3927
3970
|
amounts.value = res.paymentCaseConfigVOS;
|
|
@@ -3961,28 +4004,24 @@ var script$A = /* @__PURE__ */ defineComponent({
|
|
|
3961
4004
|
}
|
|
3962
4005
|
state.buttonLoading = true;
|
|
3963
4006
|
if (Taro.getEnv() === "WEB") {
|
|
3964
|
-
if (!isWechat()) {
|
|
3965
|
-
showToast({
|
|
3966
|
-
title: "\u8BF7\u4F7F\u7528\u5FAE\u4FE1\u6D4F\u89C8\u5668\u6253\u5F00",
|
|
3967
|
-
icon: "none"
|
|
3968
|
-
});
|
|
3969
|
-
state.buttonLoading = false;
|
|
3970
|
-
return false;
|
|
3971
|
-
}
|
|
3972
4007
|
requestBrandWCPayByBean({
|
|
3973
4008
|
caseConfigId: amounts.value[state.selected].id,
|
|
3974
4009
|
amount: currentAmount.value,
|
|
3975
4010
|
app: "loankitMp",
|
|
3976
4011
|
tenant: props.tenant,
|
|
3977
4012
|
accountAuthFlag: false,
|
|
3978
|
-
channelCode:
|
|
4013
|
+
channelCode: getChannelCode(),
|
|
3979
4014
|
payFinishJumpUrl: props.payFinishJumpUrl,
|
|
3980
4015
|
fromMini: !!params.from,
|
|
3981
4016
|
useCloudBean: isCombinedPayment.value
|
|
3982
4017
|
}).then((result) => {
|
|
4018
|
+
console.log(result, "------requestBrandWCPayByBean");
|
|
3983
4019
|
state.buttonLoading = false;
|
|
3984
4020
|
if (typeof result === "boolean" && result) {
|
|
3985
4021
|
window.location.href = props.payFinishJumpUrl;
|
|
4022
|
+
} else if (typeof result === "object" && result?.paymentType === "H5" && result?.prePayStr) {
|
|
4023
|
+
state.thirdPayId = result?.thirdPayId || "";
|
|
4024
|
+
window.location.href = result?.prePayStr;
|
|
3986
4025
|
} else {
|
|
3987
4026
|
emit("complete", {
|
|
3988
4027
|
result,
|
|
@@ -4034,6 +4073,15 @@ var script$A = /* @__PURE__ */ defineComponent({
|
|
|
4034
4073
|
});
|
|
4035
4074
|
}
|
|
4036
4075
|
}
|
|
4076
|
+
function getChannelCode() {
|
|
4077
|
+
if (isWechat()) {
|
|
4078
|
+
return "centergzh";
|
|
4079
|
+
} else if (isAlipay()) {
|
|
4080
|
+
return "YundouZfb";
|
|
4081
|
+
} else {
|
|
4082
|
+
return "distributor";
|
|
4083
|
+
}
|
|
4084
|
+
}
|
|
4037
4085
|
const onPayClick = async () => {
|
|
4038
4086
|
if (selectBean.value && !isCombinedPayment.value) {
|
|
4039
4087
|
showDialog.value = true;
|
|
@@ -4074,6 +4122,23 @@ var script$A = /* @__PURE__ */ defineComponent({
|
|
|
4074
4122
|
});
|
|
4075
4123
|
});
|
|
4076
4124
|
}
|
|
4125
|
+
const payResultCheck = () => {
|
|
4126
|
+
if (!state.thirdPayId) return;
|
|
4127
|
+
const $http = useHttp$2();
|
|
4128
|
+
$http.get(endpoints$1.\u83B7\u53D6\u652F\u4ED8\u7ED3\u679C, {
|
|
4129
|
+
thirdPayId: state.thirdPayId
|
|
4130
|
+
}).then((response) => {
|
|
4131
|
+
if (response.payStatus === "paid") {
|
|
4132
|
+
emit("complete", {
|
|
4133
|
+
result: true,
|
|
4134
|
+
type: isCombinedPayment.value ? "combined" : "wePay"
|
|
4135
|
+
});
|
|
4136
|
+
}
|
|
4137
|
+
});
|
|
4138
|
+
};
|
|
4139
|
+
__expose({
|
|
4140
|
+
payResultCheck
|
|
4141
|
+
});
|
|
4077
4142
|
return (_ctx, _cache) => {
|
|
4078
4143
|
const _component_nut_checkbox = Checkbox;
|
|
4079
4144
|
const _component_nut_button = Button;
|
|
@@ -7011,7 +7076,7 @@ function useHttp$1() {
|
|
|
7011
7076
|
const headers = {
|
|
7012
7077
|
Token: appkitOptions.tempToken() || appkitOptions.token(),
|
|
7013
7078
|
Appcode: appkitOptions.app(),
|
|
7014
|
-
|
|
7079
|
+
tid: appkitOptions.tenant(),
|
|
7015
7080
|
gray: appkitOptions.gray ? appkitOptions.gray() : "0"
|
|
7016
7081
|
};
|
|
7017
7082
|
const $http = createHttp({
|
|
@@ -8460,7 +8525,7 @@ function useHttp() {
|
|
|
8460
8525
|
const headers = {
|
|
8461
8526
|
Token: appkitOptions.tempToken() || appkitOptions.token(),
|
|
8462
8527
|
Appcode: appkitOptions.app(),
|
|
8463
|
-
|
|
8528
|
+
tid: appkitOptions.tenant(),
|
|
8464
8529
|
gray: appkitOptions.gray ? appkitOptions.gray() : "0"
|
|
8465
8530
|
};
|
|
8466
8531
|
const $http = createHttp({
|
package/package.json
CHANGED
package/src/balance/api/index.ts
CHANGED
|
@@ -65,7 +65,7 @@ function useHttp() {
|
|
|
65
65
|
const headers = {
|
|
66
66
|
Token: appkitOptions.tempToken() || appkitOptions.token(),
|
|
67
67
|
Appcode: appkitOptions.app(),
|
|
68
|
-
|
|
68
|
+
tid: appkitOptions.tenant(),
|
|
69
69
|
gray: appkitOptions.gray ? appkitOptions.gray() : '0',
|
|
70
70
|
}
|
|
71
71
|
/**
|
package/src/notice/api/index.ts
CHANGED
|
@@ -65,7 +65,7 @@ function useHttp() {
|
|
|
65
65
|
const headers = {
|
|
66
66
|
Token: appkitOptions.tempToken() || appkitOptions.token(),
|
|
67
67
|
Appcode: appkitOptions.app(),
|
|
68
|
-
|
|
68
|
+
tid: appkitOptions.tenant(),
|
|
69
69
|
gray: appkitOptions.gray ? appkitOptions.gray() : '0',
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
@@ -13,6 +13,7 @@ const endpointsList: HttpEndpoints = {
|
|
|
13
13
|
appCode: data.app,
|
|
14
14
|
// caseCode: 'recharge', // 这个参数可以不要
|
|
15
15
|
tenantId: data.tenant,
|
|
16
|
+
scene: data.scene,
|
|
16
17
|
}),
|
|
17
18
|
transform: (data: any) =>
|
|
18
19
|
data.amountList.map((d: any) => ({
|
|
@@ -44,6 +45,9 @@ const endpointsList: HttpEndpoints = {
|
|
|
44
45
|
} catch (e) {}
|
|
45
46
|
return {
|
|
46
47
|
json, // 拉起微信支付用的JSON串
|
|
48
|
+
paymentType: data.paymentType,
|
|
49
|
+
prePayStr: data.prePayStr,
|
|
50
|
+
thirdPayId: data.thirdPayId,
|
|
47
51
|
paymentId: data.payId, // 查询用支付ID
|
|
48
52
|
}
|
|
49
53
|
},
|
|
@@ -69,6 +73,9 @@ const endpointsList: HttpEndpoints = {
|
|
|
69
73
|
} catch (e) {}
|
|
70
74
|
return {
|
|
71
75
|
json, // 拉起微信支付用的JSON串
|
|
76
|
+
paymentType: data.paymentType,
|
|
77
|
+
prePayStr: data.prePayStr,
|
|
78
|
+
thirdPayId: data.thirdPayId,
|
|
72
79
|
paymentId: data.payId, // 查询用支付ID
|
|
73
80
|
}
|
|
74
81
|
},
|
|
@@ -77,6 +84,13 @@ const endpointsList: HttpEndpoints = {
|
|
|
77
84
|
path: '/payment/paymentCaseConfig/getBalanceAndRiskQueryPriceConfig',
|
|
78
85
|
transform: (data: any) => data,
|
|
79
86
|
},
|
|
87
|
+
获取支付结果: {
|
|
88
|
+
path: '/payment/outer/payment/getPayResult',
|
|
89
|
+
translate: (data: any) => ({
|
|
90
|
+
thirdPayId: data.thirdPayId,
|
|
91
|
+
}),
|
|
92
|
+
transform: (data: any) => data,
|
|
93
|
+
},
|
|
80
94
|
} as const
|
|
81
95
|
|
|
82
96
|
const keys = Object.keys(endpointsList as any)
|
package/src/payment/api/index.ts
CHANGED
|
@@ -71,7 +71,7 @@ function useHttp(defaultHeader?: DefaultHeaderType) {
|
|
|
71
71
|
const headers = {
|
|
72
72
|
Token: appkitOptions.tempToken() || appkitOptions.token(),
|
|
73
73
|
Appcode: defaultHeader?.Appcode || appkitOptions.app(),
|
|
74
|
-
|
|
74
|
+
tid: defaultHeader?.Tenant || appkitOptions.tenant(),
|
|
75
75
|
gray: appkitOptions.gray ? appkitOptions.gray() : '0',
|
|
76
76
|
}
|
|
77
77
|
|
|
@@ -22,7 +22,7 @@ import AmountPicker from './AmountPicker.vue'
|
|
|
22
22
|
import { useHttp, endpoints } from '../api'
|
|
23
23
|
import { requestBrandWCPay, requestPayment } from '../services'
|
|
24
24
|
import Taro, { showToast, useRouter } from '@tarojs/taro'
|
|
25
|
-
import { isWechat } from '../../shared/composables/useDeviceEnv'
|
|
25
|
+
import { isAlipay, isWechat } from '../../shared/composables/useDeviceEnv'
|
|
26
26
|
|
|
27
27
|
// 充值用户界面
|
|
28
28
|
// 配置了必须的属性后
|
|
@@ -61,6 +61,7 @@ const state = reactive({
|
|
|
61
61
|
selected: 0,
|
|
62
62
|
agreementOpen: false,
|
|
63
63
|
buttonLoading: false,
|
|
64
|
+
thirdPayId: '',
|
|
64
65
|
})
|
|
65
66
|
|
|
66
67
|
const amounts = ref<any[]>([])
|
|
@@ -81,7 +82,8 @@ onMounted(async () => {
|
|
|
81
82
|
|
|
82
83
|
$http.get<any[]>(endpoints.获取充值金额列表, {
|
|
83
84
|
app: props.app,
|
|
84
|
-
tenant: props.tenant
|
|
85
|
+
tenant: props.tenant,
|
|
86
|
+
scene: isWechat() ? '' : 'APP'
|
|
85
87
|
}).then(response => {
|
|
86
88
|
amounts.value = response
|
|
87
89
|
emit('loaded')
|
|
@@ -99,28 +101,30 @@ const onPayClick = () => {
|
|
|
99
101
|
state.buttonLoading = true
|
|
100
102
|
|
|
101
103
|
if (Taro.getEnv() === 'WEB') {
|
|
102
|
-
if (!isWechat()) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
104
|
+
// if (!isWechat()) {
|
|
105
|
+
// showToast({
|
|
106
|
+
// title: '请使用微信浏览器打开',
|
|
107
|
+
// icon: 'none',
|
|
108
|
+
// })
|
|
109
|
+
// state.buttonLoading = false
|
|
110
|
+
// return false
|
|
111
|
+
// }
|
|
110
112
|
requestBrandWCPay({
|
|
111
113
|
amount: amounts.value[state.selected].amount,
|
|
112
114
|
app: 'loankitMp',
|
|
113
115
|
tenant: props.tenant,
|
|
114
116
|
accountAuthFlag: false,
|
|
115
|
-
channelCode:
|
|
117
|
+
channelCode: getChannelCode(),
|
|
116
118
|
payFinishJumpUrl: props.payFinishJumpUrl,
|
|
117
119
|
fromMini: !!params.from,
|
|
118
120
|
clientInfo: 'H5'
|
|
119
|
-
}).then(result => {
|
|
120
|
-
console.log(result, '------requestBrandWCPay')
|
|
121
|
+
}).then((result: any) => {
|
|
121
122
|
state.buttonLoading = false
|
|
122
123
|
if (typeof result === 'boolean' && result) {
|
|
123
124
|
window.location.href = props.payFinishJumpUrl as string
|
|
125
|
+
} else if (typeof result === 'object' && result?.paymentType === 'H5' && result?.prePayStr) {
|
|
126
|
+
state.thirdPayId = result?.thirdPayId || ''
|
|
127
|
+
window.location.href = result?.prePayStr;
|
|
124
128
|
} else {
|
|
125
129
|
emit('complete', result)
|
|
126
130
|
}
|
|
@@ -143,6 +147,34 @@ const onPayClick = () => {
|
|
|
143
147
|
})
|
|
144
148
|
}
|
|
145
149
|
}
|
|
150
|
+
|
|
151
|
+
// 根据环境判断渠道编码
|
|
152
|
+
function getChannelCode() {
|
|
153
|
+
if (isWechat()) {
|
|
154
|
+
return 'centergzh';
|
|
155
|
+
} else if (isAlipay()) {
|
|
156
|
+
return 'YundouZfb';
|
|
157
|
+
} else {
|
|
158
|
+
return 'distributor';
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const payResultCheck = () => {
|
|
163
|
+
if (!state.thirdPayId) return
|
|
164
|
+
|
|
165
|
+
const $http = useHttp()
|
|
166
|
+
$http.get<any>(endpoints.获取支付结果, {
|
|
167
|
+
thirdPayId: state.thirdPayId
|
|
168
|
+
}).then(response => {
|
|
169
|
+
if (response.payStatus === 'paid') {
|
|
170
|
+
emit('complete', true)
|
|
171
|
+
}
|
|
172
|
+
})
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
defineExpose({
|
|
176
|
+
payResultCheck
|
|
177
|
+
})
|
|
146
178
|
</script>
|
|
147
179
|
|
|
148
180
|
<style lang="scss">
|
|
@@ -108,7 +108,7 @@ import { endpoints as balanceEndpoints } from "../../balance/api";
|
|
|
108
108
|
import { requestBrandWCPayByBean, requestPaymentByBean } from "../services";
|
|
109
109
|
import Taro, { showToast, useRouter, showModal } from "@tarojs/taro";
|
|
110
110
|
import { useAmount } from "../../shared/composables/useAmount";
|
|
111
|
-
import { isWechat } from "../../shared/composables/useDeviceEnv";
|
|
111
|
+
import { isAlipay, isWechat } from "../../shared/composables/useDeviceEnv";
|
|
112
112
|
|
|
113
113
|
// 充值用户界面
|
|
114
114
|
// 配置了必须的属性后
|
|
@@ -156,6 +156,7 @@ const state = reactive({
|
|
|
156
156
|
selected: 0,
|
|
157
157
|
// agreementOpen: false,
|
|
158
158
|
buttonLoading: false,
|
|
159
|
+
thirdPayId: '',
|
|
159
160
|
});
|
|
160
161
|
|
|
161
162
|
const balance = ref<number>(0);
|
|
@@ -219,6 +220,7 @@ onMounted(() => {
|
|
|
219
220
|
.get<any[]>(endpoints.获取增值权益类目, {
|
|
220
221
|
rightCode:
|
|
221
222
|
props.app === "corporateStar" ? "riskQueryCompany" : "riskQueryMulti",
|
|
223
|
+
scene: isWechat() ? '' : 'APP'
|
|
222
224
|
})
|
|
223
225
|
.then((res: any) => {
|
|
224
226
|
balance.value = res.balance;
|
|
@@ -267,14 +269,14 @@ function proceedWechatPayment() {
|
|
|
267
269
|
state.buttonLoading = true;
|
|
268
270
|
|
|
269
271
|
if (Taro.getEnv() === "WEB") {
|
|
270
|
-
if (!isWechat()) {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}
|
|
272
|
+
// if (!isWechat()) {
|
|
273
|
+
// showToast({
|
|
274
|
+
// title: "请使用微信浏览器打开",
|
|
275
|
+
// icon: "none",
|
|
276
|
+
// });
|
|
277
|
+
// state.buttonLoading = false;
|
|
278
|
+
// return false;
|
|
279
|
+
// }
|
|
278
280
|
// 组合支付或纯微信支付:传递caseConfigId和amount,后端会自动处理云豆扣减
|
|
279
281
|
requestBrandWCPayByBean({
|
|
280
282
|
caseConfigId: amounts.value[state.selected].id,
|
|
@@ -282,15 +284,19 @@ function proceedWechatPayment() {
|
|
|
282
284
|
app: "loankitMp",
|
|
283
285
|
tenant: props.tenant,
|
|
284
286
|
accountAuthFlag: false,
|
|
285
|
-
channelCode:
|
|
287
|
+
channelCode: getChannelCode(),
|
|
286
288
|
payFinishJumpUrl: props.payFinishJumpUrl,
|
|
287
289
|
fromMini: !!params.from,
|
|
288
290
|
useCloudBean: isCombinedPayment.value
|
|
289
291
|
})
|
|
290
|
-
.then((result) => {
|
|
292
|
+
.then((result: any) => {
|
|
293
|
+
console.log(result, '------requestBrandWCPayByBean')
|
|
291
294
|
state.buttonLoading = false;
|
|
292
295
|
if (typeof result === "boolean" && result) {
|
|
293
296
|
window.location.href = props.payFinishJumpUrl as string;
|
|
297
|
+
} else if (typeof result === 'object' && result?.paymentType === 'H5' && result?.prePayStr) {
|
|
298
|
+
state.thirdPayId = result?.thirdPayId || ''
|
|
299
|
+
window.location.href = result?.prePayStr;
|
|
294
300
|
} else {
|
|
295
301
|
emit("complete", {
|
|
296
302
|
result,
|
|
@@ -346,6 +352,17 @@ function proceedWechatPayment() {
|
|
|
346
352
|
}
|
|
347
353
|
}
|
|
348
354
|
|
|
355
|
+
// 根据环境判断渠道编码
|
|
356
|
+
function getChannelCode() {
|
|
357
|
+
if (isWechat()) {
|
|
358
|
+
return 'centergzh';
|
|
359
|
+
} else if (isAlipay()) {
|
|
360
|
+
return 'YundouZfb';
|
|
361
|
+
} else {
|
|
362
|
+
return 'distributor';
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
349
366
|
const onPayClick = async () => {
|
|
350
367
|
// 用云豆支付(纯云豆支付)
|
|
351
368
|
if (selectBean.value && !isCombinedPayment.value) {
|
|
@@ -399,6 +416,25 @@ const onPayClick = async () => {
|
|
|
399
416
|
})
|
|
400
417
|
}
|
|
401
418
|
|
|
419
|
+
const payResultCheck = () => {
|
|
420
|
+
if (!state.thirdPayId) return
|
|
421
|
+
|
|
422
|
+
const $http = useHttp()
|
|
423
|
+
$http.get<any>(endpoints.获取支付结果, {
|
|
424
|
+
thirdPayId: state.thirdPayId
|
|
425
|
+
}).then(response => {
|
|
426
|
+
if (response.payStatus === 'paid') {
|
|
427
|
+
emit("complete", {
|
|
428
|
+
result: true,
|
|
429
|
+
type: isCombinedPayment.value ? "combined" : "wePay",
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
})
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
defineExpose({
|
|
436
|
+
payResultCheck
|
|
437
|
+
})
|
|
402
438
|
</script>
|
|
403
439
|
|
|
404
440
|
<style lang="scss">
|
|
@@ -68,13 +68,15 @@ const requestBrandWCPay = (params: PaymentParams, Appcode = '') => {
|
|
|
68
68
|
...params,
|
|
69
69
|
})
|
|
70
70
|
.then((response: any) => {
|
|
71
|
-
if (!response.json) {
|
|
71
|
+
if (!response.json && !response.prePayStr) {
|
|
72
72
|
showToast({
|
|
73
73
|
title: response.message,
|
|
74
74
|
icon: 'none',
|
|
75
75
|
})
|
|
76
76
|
resolve(false)
|
|
77
|
-
} else if (
|
|
77
|
+
} else if (!response.json && response.prePayStr) {
|
|
78
|
+
resolve(response)
|
|
79
|
+
} else if (params.fromMini) {
|
|
78
80
|
resolve(response.json)
|
|
79
81
|
} else {
|
|
80
82
|
requestWxH5Pay(response.json).then((result) => {
|
|
@@ -100,12 +102,14 @@ const requestBrandWCPayByBean = (params: PaymentParams, Appcode = '') => {
|
|
|
100
102
|
...params,
|
|
101
103
|
})
|
|
102
104
|
.then((response: any) => {
|
|
103
|
-
if (!response.json) {
|
|
105
|
+
if (!response.json && !response.prePayStr) {
|
|
104
106
|
showToast({
|
|
105
107
|
title: response.message,
|
|
106
108
|
icon: 'none',
|
|
107
109
|
})
|
|
108
110
|
resolve(false)
|
|
111
|
+
} else if (!response.json && response.prePayStr) {
|
|
112
|
+
resolve(response)
|
|
109
113
|
} else if (params.fromMini) {
|
|
110
114
|
resolve(response.json)
|
|
111
115
|
} else {
|
package/src/user/api/index.ts
CHANGED
|
@@ -65,7 +65,7 @@ function useHttp() {
|
|
|
65
65
|
const headers: any = {
|
|
66
66
|
Token: appkitOptions.tempToken() || appkitOptions.token(),
|
|
67
67
|
Appcode: appkitOptions.app(),
|
|
68
|
-
|
|
68
|
+
tid: appkitOptions.tenant(),
|
|
69
69
|
gray: appkitOptions.gray ? appkitOptions.gray() : '0',
|
|
70
70
|
}
|
|
71
71
|
|