|
@@ -89,38 +89,60 @@ function next() {
|
|
|
|
|
|
|
|
async function pay() {
|
|
async function pay() {
|
|
|
loading.value = true
|
|
loading.value = true
|
|
|
- console.log(info.value.chooseSeatList)
|
|
|
|
|
- query.value.fastTicket = isWithin45Minutes(new Date(), info.value.showTime)
|
|
|
|
|
- query.value.movieOrderItems = info.value.chooseSeatList.map((item: any) => {
|
|
|
|
|
- if (isWithin45Minutes(new Date(), info.value.showTime)) { // 如果在45分钟内,快速出票
|
|
|
|
|
- return {
|
|
|
|
|
- name: item.seatName,
|
|
|
|
|
- price: item.fastPrice,
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ query.value.fastTicket = isWithin45Minutes(new Date(), info.value.showTime)
|
|
|
|
|
+ query.value.movieOrderItems = info.value.chooseSeatList.map((item: any) => {
|
|
|
|
|
+ if (isWithin45Minutes(new Date(), info.value.showTime)) { // 如果在45分钟内,快速出票
|
|
|
|
|
+ return {
|
|
|
|
|
+ name: item.seatName,
|
|
|
|
|
+ price: item.fastPrice,
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ return {
|
|
|
|
|
+ name: item.seatName,
|
|
|
|
|
+ price: item.ticketPrice,
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ const { data: orderNumber } = await Apis.film.addFilmOrder({ data: query.value })
|
|
|
|
|
+ const payMent = await useUserStore().getPayMent(orderNumber)
|
|
|
|
|
+ if (payMent.payType !== 'point') {
|
|
|
|
|
+ try {
|
|
|
|
|
+ // #ifdef MP-WEIXIN
|
|
|
|
|
+ const res = await useUserStore().handleCommonPayMent(orderNumber)
|
|
|
|
|
+ await useUserStore().getWxCommonPayment(res)
|
|
|
|
|
+ await useUserStore().paySuccess('film-order', 'subPack-film/index/index')
|
|
|
|
|
+ // #endif
|
|
|
|
|
+ // #ifdef H5
|
|
|
|
|
+ useUserStore().handleCommonWechatPay(orderNumber)
|
|
|
|
|
+ await handleH5PayResult(orderNumber)
|
|
|
|
|
+ // #endif
|
|
|
|
|
+ }
|
|
|
|
|
+ catch {
|
|
|
|
|
+ await useUserStore().payError('film-order', 'subPack-film/index/index')
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
- return {
|
|
|
|
|
- name: item.seatName,
|
|
|
|
|
- price: item.ticketPrice,
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ await useUserStore().handleCommonPayMent(orderNumber)
|
|
|
|
|
+ await useUserStore().paySuccess('film-order', 'subPack-film/index/index')
|
|
|
}
|
|
}
|
|
|
- })
|
|
|
|
|
- const { data: orderNumber } = await Apis.film.addFilmOrder({ data: query.value })
|
|
|
|
|
- const res = await useUserStore().handleCommonPayMent(orderNumber)
|
|
|
|
|
- loading.value = false
|
|
|
|
|
- if (res.payType !== 1) {
|
|
|
|
|
- // await getWxCommonPayment(res)
|
|
|
|
|
- uni.showToast({
|
|
|
|
|
- title: '当前只支持积分支付',
|
|
|
|
|
- icon: 'none',
|
|
|
|
|
- duration: 2000,
|
|
|
|
|
- })
|
|
|
|
|
}
|
|
}
|
|
|
- else {
|
|
|
|
|
|
|
+ catch (error) {
|
|
|
|
|
+ console.error('支付失败:', error)
|
|
|
|
|
+ }
|
|
|
|
|
+ finally {
|
|
|
|
|
+ loading.value = false
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+async function handleH5PayResult(orderNumber: string) {
|
|
|
|
|
+ const isPaySuccess = await useUserStore().pollOrderPaySuccess(orderNumber)
|
|
|
|
|
+ if (isPaySuccess) {
|
|
|
await useUserStore().paySuccess('film-order', 'subPack-film/index/index')
|
|
await useUserStore().paySuccess('film-order', 'subPack-film/index/index')
|
|
|
|
|
+ return
|
|
|
}
|
|
}
|
|
|
|
|
+ useGlobalToast().show({ msg: '暂未查询到支付成功,请稍后在订单列表查看' })
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
function call() {
|
|
function call() {
|
|
|
uni.makePhoneCall({
|
|
uni.makePhoneCall({
|
|
|
phoneNumber: info.value.phone,
|
|
phoneNumber: info.value.phone,
|