refactor: 优化订单页面和支付组件代码

- 移除订单页面冗余的 `onShow` 逻辑,避免重复刷新订单数据
- 调整账单组件中加载状态和类型映射逻辑,简化代码结构
- 修改支付组件备注框高度和 z-index 值,提升用户体验
This commit is contained in:
yindongqi 2025-04-23 16:47:35 +08:00
parent 0540292497
commit 70640e6432
3 changed files with 25 additions and 21 deletions

View File

@ -78,9 +78,6 @@ const list = ref([
{
name: '消费'
},
// {
// name: ''
// },
{
name: '退款'
}
@ -99,7 +96,7 @@ const current = ref(0)
const swiperCurrent = ref(0)
const tabsHeight = ref(0)
const dx = ref(0)
const loadStatus = ref(['loadmore', 'loadmore', 'loadmore', 'loadmore'])
const loadStatus = ref(['loadmore', 'loadmore', 'loadmore'])
const page = ref(1)
const pageSize = ref(20)
const tabs = ref()
@ -116,7 +113,13 @@ const getBill = async () => {
return;
}
loadStatus.value.splice(swiperCurrent.value, 1, "loading")
let data = await balanceGetBillList({ cate: cate.value, type: swiperCurrent.value, page: page.value, pagesize: pageSize.value });
let data;
if(swiperCurrent.value === 2) {
data = await balanceGetBillList({ cate: cate.value, type: 3, page: page.value, pagesize: pageSize.value });
}else {
data = await balanceGetBillList({ cate: cate.value, type: swiperCurrent.value, page: page.value, pagesize: pageSize.value });
}
if (page.value == 1) {
orderList.value[swiperCurrent.value] = [];
}
@ -137,8 +140,8 @@ const reachBottom = () => {
}
// tab
const change = (e) => {
if (e.name == '退款') {
swiperCurrent.value = 3;
if (e.index === 2) {
swiperCurrent.value = 2;
page.value = 1;
} else {

View File

@ -215,20 +215,21 @@
</view> -->
<view class="flex-fill">
<textarea placeholder-class="text-color-assist font-size-base" v-model="form.remark"
class="bg-white w-100 border-box font-size-base"
:class="{ 'text-color-danger': remarkLength > 50, 'text-color-assist': remarkLength <= 50 }"
placeholder="请填写备注信息" />
<view class="tips"
:class="{ 'text-color-danger': remarkLength > 50, 'text-color-assist': remarkLength <= 50 }">
{{ remarkLength }}/50
</view>
<textarea placeholder-class="text-color-assist font-size-base" v-model="form.remark"
class="bg-white w-100 border-box font-size-base"
:class="{ 'text-color-danger': remarkLength > 50, 'text-color-assist': remarkLength <= 50 }"
placeholder="请填写备注信息"
style="height: 100rpx;" />
<view class="tips"
:class="{ 'text-color-danger': remarkLength > 50, 'text-color-assist': remarkLength <= 50 }">
{{ remarkLength }}/50
</view>
</view>
</list-cell>
<!-- 备注 end -->
</view>
<!-- 付款栏 begin -->
<view style="z-index: 1"
<view style="z-index: 9999"
class="w-100 pay-box position-fixed fixed-bottom d-flex align-items-center justify-content-between bg-white">
<view class="font-size-sm" style="margin-left: 20rpx">合计</view>
<view class="font-size-lg flex-fill">{{ amount }}</view>

View File

@ -162,11 +162,11 @@ onLoad(() => {
getOrders(true); //
}
});
onShow(() => {
if (isLogin.value) {
getOrders(true); //
}
});
// onShow(() => {
// if (isLogin.value) {
// getOrders(true); //
// }
// });
onPullDownRefresh(() => {
getOrders(true);
});