|
|
@@ -1,13 +1,13 @@
|
|
|
<template>
|
|
|
- <CommonDialog v-model:show="show" title="升级付款" :showDivider="false">
|
|
|
+ <CommonDialog v-model:show="show" title="升级付款" :showDivider="false" :showCloseButton="false">
|
|
|
<FlexCol gap="gap.lg" padding="padding.md" width="600rpx">
|
|
|
<template v-if="uploadStep === 'form'">
|
|
|
<Text textAlign="center" text="选择支付方式" fontConfig="contentSpeicalText" />
|
|
|
<Height :height="10" />
|
|
|
<FlexCol gap="gap.md">
|
|
|
- <BoxMid justify="space-between">
|
|
|
+ <BoxMid direction="row" justify="space-between">
|
|
|
<Text text="微信支付" fontConfig="lightImportantTitle" :fontSize="42" />
|
|
|
- <CheckBox :modelValue="payMethod == 'wechat'" @update="payMethod = 'wechat'" />
|
|
|
+ <CheckBox :modelValue="payMethod == 'wechat'" shape="round" @update="payMethod = 'wechat'" />
|
|
|
</BoxMid>
|
|
|
</FlexCol>
|
|
|
<FlexRow justify="space-around" gap="gap.md">
|
|
|
@@ -32,22 +32,18 @@
|
|
|
<script setup lang="ts">
|
|
|
import { ref } from "vue";
|
|
|
import { toast } from "@/components/dialog/CommonRoot";
|
|
|
-import { useAliOssUploadCo } from "@/common/components/upload/AliOssUploadCo";
|
|
|
import { showError } from "@/common/composeabe/ErrorDisplay";
|
|
|
-import type { IDynamicFormOptions, IDynamicFormRef } from "@/components/dynamic";
|
|
|
-import type { UploaderFieldProps } from "@/components/form/UploaderField.vue";
|
|
|
import CommonDialog from "@/common/components/CommonDialog.vue";
|
|
|
import FrameButton from "@/common/components/FrameButton.vue";
|
|
|
import FlexCol from "@/components/layout/FlexCol.vue";
|
|
|
import FlexRow from "@/components/layout/FlexRow.vue";
|
|
|
import Height from "@/components/layout/space/Height.vue";
|
|
|
import Text from "@/components/basic/Text.vue";
|
|
|
-import DynamicForm from "@/components/dynamic/DynamicForm.vue";
|
|
|
import Result from "@/components/feedback/Result.vue";
|
|
|
-import ProvideVar from "@/components/theme/ProvideVar.vue";
|
|
|
import BoxMid from "@/common/components/box/BoxMid.vue";
|
|
|
import TreeApi from "@/api/light/TreeApi";
|
|
|
import CheckBox from "@/components/form/CheckBox.vue";
|
|
|
+import type { UpgradeOrderConfirm } from "@/api/light/TreeApi";
|
|
|
|
|
|
const emit = defineEmits(['success']);
|
|
|
|
|
|
@@ -57,21 +53,43 @@ const uploadStep = ref<'form' | 'finished'>('form');
|
|
|
const payMethod = ref('wechat');
|
|
|
const orderId = ref<number>(0);
|
|
|
|
|
|
-function handleSubmitPay() {
|
|
|
+async function handleSubmitPay() {
|
|
|
if (!orderId.value) {
|
|
|
showError('缺少必要参数');
|
|
|
return;
|
|
|
}
|
|
|
switch (payMethod.value) {
|
|
|
case 'wechat':
|
|
|
- // 微信支付
|
|
|
+ try {
|
|
|
+ const payInfo: UpgradeOrderConfirm = await TreeApi.upgradePay(orderId.value);
|
|
|
+ if (payInfo && payInfo.pay) {
|
|
|
+ uni.requestPayment({
|
|
|
+ provider: 'wxpay',
|
|
|
+ appId: payInfo.pay.appId,
|
|
|
+ timeStamp: payInfo.pay.timeStamp,
|
|
|
+ nonceStr: payInfo.pay.nonceStr,
|
|
|
+ package: payInfo.pay.package,
|
|
|
+ signType: payInfo.pay.signType,
|
|
|
+ paySign: payInfo.pay.paySign,
|
|
|
+ success: () => {
|
|
|
+ uploadStep.value = 'finished';
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ toast(`支付失败: ${err.errMsg}`);
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (err) {
|
|
|
+ showError('支付接口调用失败');
|
|
|
+ }
|
|
|
break;
|
|
|
default:
|
|
|
- break;
|
|
|
+ throw new Error('未知支付方式');
|
|
|
}
|
|
|
}
|
|
|
function handleFinish() {
|
|
|
emit('success');
|
|
|
+ show.value = false;
|
|
|
}
|
|
|
|
|
|
defineExpose({
|
|
|
@@ -81,4 +99,4 @@ defineExpose({
|
|
|
show.value = true;
|
|
|
},
|
|
|
});
|
|
|
-</script>
|
|
|
+</script>
|