refactor: 优化购物车与订单页面逻辑

- 更新购物车页面,增强商品展示与交互体验。
- 调整订单页面的状态反馈与用户操作逻辑,确保信息清晰。
- 改进组件样式与布局,提升整体用户体验。
- 修复多个页面中的样式与功能问题,确保一致性与流畅性。
This commit is contained in:
pikachu1995@126.com
2026-09-29 10:22:57 +08:00
parent 0bffe81c6b
commit a3193c3b68
19 changed files with 1631 additions and 1480 deletions

View File

@@ -159,7 +159,7 @@
title="申请原因"
@confirm="reasonSelectConfirm"
></u-picker>
<u-toast ref="uToast" />
<u-toast ref="toastRef" />
</view>
</template>
@@ -186,7 +186,7 @@ const sku = ref<any>({})
const reasonSelectShow = ref(false)
const reasonList = ref<any[]>([])
const applyInfo = ref<any>({})
const uToast = ref<any>(null)
const toastRef = ref<any>(null)
const isAppointmentAfterSale = ref(false)
const form = reactive({
@@ -335,8 +335,8 @@ function onUploadAfterRead(event: any) {
function showToast(message: string, type = 'error') {
const text = message || (type === 'success' ? '操作成功' : '操作失败')
if (uToast.value) {
uToast.value.show({ message: text, type })
if (toastRef.value) {
toastRef.value.show({ message: text, type })
return
}
uni.showToast({

View File

@@ -69,7 +69,7 @@
@confirm="onTimeConfirm"
@close="timeshow = false"
/>
<u-toast ref="uToast"/>
<u-toast ref="toastRef"/>
</view>
</template>
@@ -96,7 +96,7 @@ const form = reactive({
})
const serviceDetail = reactive<{ sn: string }>({ sn: '' })
const sku = ref<any>({})
const uToast = ref<any>(null)
const toastRef = ref<any>(null)
onLoad((options) => {
sku.value = storage.getAfterSaleData()
@@ -136,15 +136,15 @@ function onSubmit() {
delete submitForm.courierCompany
if (form.logisticsId == '') {
uToast.value?.show({ title: '请选择快递公司', type: 'error' })
toastRef.value?.show({ title: '请选择快递公司', type: 'error' })
return
}
if (form.logisticsNo == '') {
uToast.value?.show({ title: '请填写快递单号', type: 'error' })
toastRef.value?.show({ title: '请填写快递单号', type: 'error' })
return
}
if (form.mDeliverTime == '') {
uToast.value?.show({ title: '请选择发货时间', type: 'error' })
toastRef.value?.show({ title: '请选择发货时间', type: 'error' })
return
}
@@ -152,7 +152,7 @@ function onSubmit() {
fillShipInfo(serviceDetail.sn, submitForm).then((res) => {
hideLoadingIfNeeded()
if (res.statusCode === 200) {
uToast.value?.show({
toastRef.value?.show({
title: '提交成功',
type: 'success',
back: true,

View File

@@ -417,7 +417,11 @@ function openOrder(order: any) {
}
function changeTab(e: any) {
tabCurrentIndex.value = e.target.current
// H5 的 swiper change 把下标放在 detail.current。
// 读 target.current 会得到 undefined,选中态被清掉,列表就停在「全部」。
const current = Number(e?.detail?.current ?? e?.target?.current)
if (!Number.isInteger(current) || current < 0 || current >= navList.length) return
tabCurrentIndex.value = current
}
function tabClick(index: number) {

View File

@@ -34,7 +34,7 @@
<verification-codes :items="verificationCodeItems" />
</view>
<view v-else-if="isECouponOrder" class="card-key-entry">
<view v-if="ecouponCardKeyDelivered" class="card-key-entry__btn" @click="goCardKeyDetail">
<view v-if="ecouponCardKeyDelivered" class="btn" @click="goCardKeyDetail">
查看卡密
</view>
<view v-else-if="order.orderStatus === 'CANCELLED'" class="card-key-entry__tip">
@@ -1055,17 +1055,14 @@ page,
.card-key-entry {
width: 100%;
text-align: center;
}
.card-key-entry__btn {
display: inline-block;
padding: 20rpx 80rpx;
border: 2rpx solid $main-color;
border-radius: 12rpx;
color: $main-color;
font-size: 28rpx;
font-weight: 600;
.btn {
width: 100%;
height: 80rpx;
line-height: 80rpx;
border-radius: 40rpx;
font-size: 30rpx;
}
}
.card-key-entry__tip {