feat: 更新预约功能与礼品卡支持

- 新增礼品卡页面,支持礼品卡的选择与使用。
- 调整预约下单流程,增强预约信息展示与用户交互。
- 更新支付成功页面的导航逻辑,确保用户体验流畅。
- 优化搜索页面的历史关键词加载逻辑,提升性能。
This commit is contained in:
pikachu1995@126.com
2026-09-28 14:37:26 +08:00
parent 2107e3f03a
commit 0bffe81c6b
25 changed files with 2272 additions and 1038 deletions

View File

@@ -17,7 +17,7 @@
</view>
<view>
<template v-for="(item,index) in sku.orderItems" :key="index">
<view class="goods-item-view" v-if="item.sn == sn"
<view class="goods-item-view" v-if="item && item.sn == sn"
@click="gotoGoodsDetail(sku.goodsId || sku.goods_id)">
<view class="goods-img">
<u-image
@@ -32,7 +32,7 @@
<view class="goods-title">{{ getGoodsName(item) }}</view>
<view class="goods-price">
<text>¥{{ unitPrice(displayRefundPrice) }}</text>
<text class="num">购买数量: {{ item.num }}</text>
<text class="num">购买数量: {{ item.num || 0 }}</text>
</view>
</view>
</view>
@@ -41,10 +41,10 @@
<view class="after-num">
<text class="after-num-label">申请数量</text>
<u-number-box
:value="parseInt(form.num)"
:value="applyNum"
disabled-input
:min="1"
:max="parseInt(sku.num)"
:max="maxApplyNum"
bg-color="#fff"
@change="valChange"
></u-number-box>
@@ -164,7 +164,7 @@
</template>
<script setup lang="ts">
import { ref, reactive, computed, getCurrentInstance, watch } from 'vue'
import { ref, reactive, computed, getCurrentInstance } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { useStore } from '@/store'
import { unitPrice, parseGoodsImageUrl } from '@/utils/filters.js'
@@ -189,22 +189,6 @@ const applyInfo = ref<any>({})
const uToast = ref<any>(null)
const isAppointmentAfterSale = ref(false)
const displayRefundPrice = computed(() => {
if (!isAppointmentAfterSale.value) return applyInfo.value?.applyRefundPrice
return computePartialRefundPrice(applyInfo.value, form.num)
})
watch(
() => form.num,
() => {
if (!isAppointmentAfterSale.value) return
applyInfo.value = {
...applyInfo.value,
displayRefundPrice: displayRefundPrice.value,
}
}
)
const form = reactive({
orderItemSn: '',
skuId: '',
@@ -222,6 +206,21 @@ const form = reactive({
bankAccountNumber: '',
})
const displayRefundPrice = computed(() => {
if (!isAppointmentAfterSale.value) return applyInfo.value?.applyRefundPrice
return computePartialRefundPrice(applyInfo.value, form.num)
})
const maxApplyNum = computed(() => {
const value = Number(sku.value?.num)
return value > 0 ? value : 1
})
const applyNum = computed(() => {
const value = Number(form.num)
return value > 0 ? value : 1
})
onLoad((options) => {
let navTitle = '申请售后'
form.serviceType = 'RETURN_GOODS'
@@ -239,12 +238,14 @@ onLoad((options) => {
}
uni.setNavigationBarTitle({ title: navTitle })
sn.value = options?.sn || ''
sku.value = storage.getAfterSaleData()
const cached = storage.getAfterSaleData()
sku.value = cached && typeof cached === 'object' ? cached : { orderItems: [] }
if (!Array.isArray(sku.value.orderItems)) sku.value.orderItems = []
isAppointmentAfterSale.value = isAppointmentOrder(sku.value?.orderType)
form.orderItemSn = options?.sn || ''
form.skuId = sku.value.skuId
form.num = sku.value.num
form.goodsId = sku.value.goodsId
form.skuId = sku.value.skuId || ''
form.num = Number(sku.value.num) > 0 ? Number(sku.value.num) : 1
form.goodsId = sku.value.goodsId || ''
fetchReasonActions(form.serviceType)
init(options?.sn || '')
})