|
@@ -10,10 +10,9 @@
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
import { getConfigByCode } from '@/api/common'
|
|
import { getConfigByCode } from '@/api/common'
|
|
-import { bindingAddress, orderCancel, orderDetail, orderPink, orderStatusEnum } from '@/api/order'
|
|
|
|
|
|
+import { orderCancel, orderDetail, orderPink, orderStatusEnum, payOrder } from '@/api/order'
|
|
import DialogBox from '@/components/DialogBox/DialogBox.vue'
|
|
import DialogBox from '@/components/DialogBox/DialogBox.vue'
|
|
import { DialogUtils } from '@/components/DialogBox/utils'
|
|
import { DialogUtils } from '@/components/DialogBox/utils'
|
|
-import { t } from '@/locale'
|
|
|
|
import { formatNumber } from '@/utils'
|
|
import { formatNumber } from '@/utils'
|
|
import { getPageParams, toPage } from '@/utils/page'
|
|
import { getPageParams, toPage } from '@/utils/page'
|
|
import { toast } from '@/utils/toast'
|
|
import { toast } from '@/utils/toast'
|
|
@@ -107,36 +106,6 @@ function selectAddress() {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
-// 绑定地址到订单
|
|
|
|
-async function bindAddressToOrder(addressId: number) {
|
|
|
|
- try {
|
|
|
|
- uni.showLoading({
|
|
|
|
- title: t('addressBook.select.binding'),
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- const res = await bindingAddress({
|
|
|
|
- orderId: id.value,
|
|
|
|
- addressId,
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- if (res.code === '200') {
|
|
|
|
- toast.success(t('addressBook.select.success'))
|
|
|
|
- // 刷新订单详情
|
|
|
|
- getDetail()
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- toast.error(res.message || t('addressBook.select.failed'))
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- catch (error: any) {
|
|
|
|
- console.error('Bind address error:', error)
|
|
|
|
- toast.error(t('addressBook.select.networkError'))
|
|
|
|
- }
|
|
|
|
- finally {
|
|
|
|
- uni.hideLoading()
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// 显示取消订单确认对话框
|
|
// 显示取消订单确认对话框
|
|
function showCancelOrderDialog() {
|
|
function showCancelOrderDialog() {
|
|
Object.assign(dialogConfig.value, DialogUtils.info(
|
|
Object.assign(dialogConfig.value, DialogUtils.info(
|
|
@@ -191,19 +160,27 @@ function handleDialogConfirm() {
|
|
}
|
|
}
|
|
|
|
|
|
// 关闭对话框
|
|
// 关闭对话框
|
|
- handleDialogCancel()
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// 处理对话框取消事件
|
|
|
|
-function handleDialogCancel() {
|
|
|
|
- // 关闭对话框
|
|
|
|
- dialogConfig.value.show = false
|
|
|
|
|
|
+ handleDialogClose()
|
|
}
|
|
}
|
|
|
|
|
|
// 处理对话框关闭事件
|
|
// 处理对话框关闭事件
|
|
function handleDialogClose() {
|
|
function handleDialogClose() {
|
|
dialogConfig.value.show = false
|
|
dialogConfig.value.show = false
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+async function handleClick() {
|
|
|
|
+ if (detail.value?.status === 1) {
|
|
|
|
+ // 去支付
|
|
|
|
+ const payRes = await payOrder({
|
|
|
|
+ orderId: detail.value?.orderId,
|
|
|
|
+ type: detail.value?.storePink?.kId ? 'open' : 'join',
|
|
|
|
+ })
|
|
|
|
+ console.log(payRes)
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ // 去分享
|
|
|
|
+ }
|
|
|
|
+}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<template>
|
|
<template>
|
|
@@ -233,7 +210,7 @@ function handleDialogClose() {
|
|
</view>
|
|
</view>
|
|
<!-- 未开奖||未支付 -->
|
|
<!-- 未开奖||未支付 -->
|
|
<view v-else-if="detail?.storePink?.status === 1 || detail?.status === 1" class="mb-20rpx bg-#fff py-20rpx text-center text-28rpx text-white">
|
|
<view v-else-if="detail?.storePink?.status === 1 || detail?.status === 1" class="mb-20rpx bg-#fff py-20rpx text-center text-28rpx text-white">
|
|
- <text v-if="detail?.storePink?.status === 1" class="text-[var(--wot-color-theme)]">
|
|
|
|
|
|
+ <text v-if="detail?.storePink?.status === 1 && detail?.status !== 1" class="text-[var(--wot-color-theme)]">
|
|
Please wait for the draw of this group
|
|
Please wait for the draw of this group
|
|
</text>
|
|
</text>
|
|
<text v-else class="text-[var(--wot-color-theme)]">
|
|
<text v-else class="text-[var(--wot-color-theme)]">
|
|
@@ -355,7 +332,9 @@ function handleDialogClose() {
|
|
>
|
|
>
|
|
Cancel
|
|
Cancel
|
|
</wd-button>
|
|
</wd-button>
|
|
- <wd-button>Share Now</wd-button>
|
|
|
|
|
|
+ <wd-button @click="handleClick">
|
|
|
|
+ {{ detail?.status !== 1 ? 'Share Now' : 'Pay Now' }}
|
|
|
|
+ </wd-button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -363,7 +342,7 @@ function handleDialogClose() {
|
|
<DialogBox
|
|
<DialogBox
|
|
v-bind="dialogConfig"
|
|
v-bind="dialogConfig"
|
|
@confirm="handleDialogConfirm"
|
|
@confirm="handleDialogConfirm"
|
|
- @cancel="handleDialogCancel"
|
|
|
|
|
|
+ @cancel="handleDialogClose"
|
|
@close="handleDialogClose"
|
|
@close="handleDialogClose"
|
|
/>
|
|
/>
|
|
</z-paging>
|
|
</z-paging>
|