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: ''
// },
{ {
name: '退款' name: '退款'
} }
@ -99,7 +96,7 @@ const current = ref(0)
const swiperCurrent = ref(0) const swiperCurrent = ref(0)
const tabsHeight = ref(0) const tabsHeight = ref(0)
const dx = ref(0) const dx = ref(0)
const loadStatus = ref(['loadmore', 'loadmore', 'loadmore', 'loadmore']) const loadStatus = ref(['loadmore', 'loadmore', 'loadmore'])
const page = ref(1) const page = ref(1)
const pageSize = ref(20) const pageSize = ref(20)
const tabs = ref() const tabs = ref()
@ -116,7 +113,13 @@ const getBill = async () => {
return; return;
} }
loadStatus.value.splice(swiperCurrent.value, 1, "loading") 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) { if (page.value == 1) {
orderList.value[swiperCurrent.value] = []; orderList.value[swiperCurrent.value] = [];
} }
@ -137,8 +140,8 @@ const reachBottom = () => {
} }
// tab // tab
const change = (e) => { const change = (e) => {
if (e.name == '退款') { if (e.index === 2) {
swiperCurrent.value = 3; swiperCurrent.value = 2;
page.value = 1; page.value = 1;
} else { } else {

View File

@ -218,7 +218,8 @@
<textarea placeholder-class="text-color-assist font-size-base" v-model="form.remark" <textarea placeholder-class="text-color-assist font-size-base" v-model="form.remark"
class="bg-white w-100 border-box font-size-base" class="bg-white w-100 border-box font-size-base"
:class="{ 'text-color-danger': remarkLength > 50, 'text-color-assist': remarkLength <= 50 }" :class="{ 'text-color-danger': remarkLength > 50, 'text-color-assist': remarkLength <= 50 }"
placeholder="请填写备注信息" /> placeholder="请填写备注信息"
style="height: 100rpx;" />
<view class="tips" <view class="tips"
:class="{ 'text-color-danger': remarkLength > 50, 'text-color-assist': remarkLength <= 50 }"> :class="{ 'text-color-danger': remarkLength > 50, 'text-color-assist': remarkLength <= 50 }">
{{ remarkLength }}/50 {{ remarkLength }}/50
@ -228,7 +229,7 @@
<!-- 备注 end --> <!-- 备注 end -->
</view> </view>
<!-- 付款栏 begin --> <!-- 付款栏 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"> 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-sm" style="margin-left: 20rpx">合计</view>
<view class="font-size-lg flex-fill">{{ amount }}</view> <view class="font-size-lg flex-fill">{{ amount }}</view>

View File

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