|
@@ -202,7 +202,6 @@
|
|
import {
|
|
import {
|
|
onMounted,
|
|
onMounted,
|
|
ref,
|
|
ref,
|
|
- nextTick,
|
|
|
|
reactive,
|
|
reactive,
|
|
computed,
|
|
computed,
|
|
} from "vue";
|
|
} from "vue";
|
|
@@ -518,13 +517,13 @@
|
|
const orderData = {
|
|
const orderData = {
|
|
orders: {
|
|
orders: {
|
|
serviceOnePrice: businessPrice.value,
|
|
serviceOnePrice: businessPrice.value,
|
|
- serviceTotalPrice: computeMoney.value, //需要传获取到的总价
|
|
|
|
- serviceCategory: serviceCategory.value, //大类别参数
|
|
|
|
- totalTimes: totalTimes.value, //点击的次数
|
|
|
|
|
|
+ serviceTotalPrice: computeMoney.value,
|
|
|
|
+ serviceCategory: serviceCategory.value,
|
|
|
|
+ totalTimes: totalTimes.value,
|
|
serviceStartDate: "2025-04-18",
|
|
serviceStartDate: "2025-04-18",
|
|
startTime: "8:00",
|
|
startTime: "8:00",
|
|
serviceDuration: 4,
|
|
serviceDuration: 4,
|
|
- paymentMethod: paymentMethod.value, // Use the selected payment method
|
|
|
|
|
|
+ paymentMethod: paymentMethod.value,
|
|
volunteerId: volunteerId.value,
|
|
volunteerId: volunteerId.value,
|
|
remark: remark.value,
|
|
remark: remark.value,
|
|
businessManagementId: businessManagementId.value,
|
|
businessManagementId: businessManagementId.value,
|
|
@@ -540,27 +539,40 @@
|
|
workStartTime: item.time
|
|
workStartTime: item.time
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
+
|
|
try {
|
|
try {
|
|
const res = await ordersCreateOrder(orderData);
|
|
const res = await ordersCreateOrder(orderData);
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
|
|
+ if (paymentMethod.value === 2) { // 微信支付
|
|
|
|
+ // 调用微信支付
|
|
|
|
+ const [err, payRes] = await uni.requestPayment({
|
|
|
|
+ ...res.data,
|
|
|
|
+ package: res.data.packageValue,
|
|
|
|
+ });
|
|
|
|
+ if (err) {
|
|
|
|
+ throw new Error('微信支付失败');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
uni.showToast({
|
|
uni.showToast({
|
|
title: '支付成功',
|
|
title: '支付成功',
|
|
- icon: 'success', // 或者 'none'
|
|
|
|
- duration: 1500, // 显示时间,单位毫秒,默认1500
|
|
|
|
- mask: true, // 是否显示透明蒙层,防止触摸穿透,默认false
|
|
|
|
|
|
+ icon: 'success',
|
|
|
|
+ duration: 1500,
|
|
|
|
+ mask: true,
|
|
});
|
|
});
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
uni.reLaunch({
|
|
uni.reLaunch({
|
|
url: '/pages/index'
|
|
url: '/pages/index'
|
|
});
|
|
});
|
|
- }, 1500)
|
|
|
|
|
|
+ }, 1500);
|
|
}
|
|
}
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
|
+ console.error('支付失败:', error);
|
|
uni.showToast({
|
|
uni.showToast({
|
|
title: '支付失败',
|
|
title: '支付失败',
|
|
- icon: 'error', // 或者 'none'
|
|
|
|
- duration: 1500, // 显示时间,单位毫秒,默认1500
|
|
|
|
- mask: true, // 是否显示透明蒙层,防止触摸穿透,默认false
|
|
|
|
|
|
+ icon: 'error',
|
|
|
|
+ duration: 1500,
|
|
|
|
+ mask: true,
|
|
});
|
|
});
|
|
}
|
|
}
|
|
};
|
|
};
|