优化功能
This commit is contained in:
@ -25,11 +25,20 @@
|
||||
</template>
|
||||
</wd-navbar>
|
||||
<view class="tabs">
|
||||
<wd-tabs v-model="tab" swipeable slidable="always" :lazy="false" @click="Order.handleChangeTabs">
|
||||
<!-- 直营店 -->
|
||||
<wd-tabs v-model="tab" swipeable slidable="always" :lazy="false" @click="Order.handleChangeTabs" v-if="useStore.defaultStore.operationType == 1">
|
||||
<wd-tab title="全部" :name="AdminOrderStatusText.All"></wd-tab>
|
||||
<wd-tab title="待使用" :name="AdminOrderStatusText.ToUse"></wd-tab>
|
||||
<wd-tab title="使用中" :name="AdminOrderStatusText.Consuming"></wd-tab>
|
||||
<wd-tab title="已完成" :name="AdminOrderStatusText.Finished"></wd-tab>
|
||||
</wd-tabs>
|
||||
|
||||
<!-- 加盟店 -->
|
||||
<wd-tabs v-model="tab" swipeable slidable="always" :lazy="false" @click="Order.handleChangeTabs" v-if="useStore.defaultStore.operationType == 2">
|
||||
<wd-tab title="全部" :name="GroupComboOrderStatusText.All"></wd-tab>
|
||||
<wd-tab title="待使用" :name="GroupComboOrderStatusText.ToUse"></wd-tab>
|
||||
<wd-tab title="已使用" :name="GroupComboOrderStatusText.Used"></wd-tab>
|
||||
<wd-tab title="已退款" :name="GroupComboOrderStatusText.Refunded"></wd-tab>
|
||||
</wd-tabs>
|
||||
</view>
|
||||
</view>
|
||||
@ -37,7 +46,7 @@
|
||||
<view class="tabs mt-18rpx mx-30rpx">
|
||||
<mescroll-body ref="mescrollItem0" @init="mescrollInit" @down="downCallback" @up="Order.upCallback" :down="downOption" :up="upOption">
|
||||
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
|
||||
<combo-card :type="OrderSource.Admin" :order="item" @refresh="Order.handleResetSearch"></combo-card>
|
||||
<combo-card :type="useStore.defaultStore.operationType == 1 ? OrderSource.Admin : OrderSource.GroupComboOrder" :order="item" @refresh="Order.handleResetSearch"></combo-card>
|
||||
</view>
|
||||
</mescroll-body>
|
||||
</view>
|
||||
@ -52,9 +61,9 @@
|
||||
import ComboCard from '@/components/order/ComboCard.vue'
|
||||
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
|
||||
import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js"
|
||||
import { OrderSource, AdminOrderStatusText, TeaSpecialistOrderStatusText, TeaSpecialistOrderStatusValue, AdminOrderStatusValue } from '@/utils/order'
|
||||
import { OrderSource, AdminOrderStatusText, AdminOrderStatusValue, GroupComboOrderStatusText, GroupComboOrderStatusValue } from '@/utils/order'
|
||||
import { router } from '@/utils/tools'
|
||||
import { getStoreOrderList} from '@/api/order'
|
||||
import { getStoreOrderList, getGroupComboOrderList} from '@/api/order'
|
||||
import { useStoreStore } from '@/store'
|
||||
|
||||
const useStore = useStoreStore()
|
||||
@ -111,14 +120,27 @@
|
||||
search: keywords.value,
|
||||
}
|
||||
|
||||
getStoreOrderList(filter).then((res) => {
|
||||
const curPageData = res.list || [] // 当前页数据
|
||||
if(mescroll.num == 1) list.value = [] // 第一页需手动制空列表
|
||||
list.value = list.value.concat(curPageData) //追加新数据
|
||||
mescroll.endSuccess(curPageData.length, Boolean(res.more))
|
||||
}).catch(() => {
|
||||
mescroll.endErr() // 请求失败, 结束加载
|
||||
})
|
||||
if (useStore.defaultStore.operationType == 1) {
|
||||
// 直营店订单
|
||||
getStoreOrderList(filter).then((res) => {
|
||||
const curPageData = res.list || [] // 当前页数据
|
||||
if(mescroll.num == 1) list.value = [] // 第一页需手动制空列表
|
||||
list.value = list.value.concat(curPageData) //追加新数据
|
||||
mescroll.endSuccess(curPageData.length, Boolean(res.more))
|
||||
}).catch(() => {
|
||||
mescroll.endErr() // 请求失败, 结束加载
|
||||
})
|
||||
} else {
|
||||
// 加盟店订单
|
||||
getGroupComboOrderList(filter).then((res) => {
|
||||
const curPageData = res.list || [] // 当前页数据
|
||||
if(mescroll.num == 1) list.value = [] // 第一页需手动制空列表
|
||||
list.value = list.value.concat(curPageData) //追加新数据
|
||||
mescroll.endSuccess(curPageData.length, Boolean(res.more))
|
||||
}).catch(() => {
|
||||
mescroll.endErr() // 请求失败, 结束加载
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@ -148,10 +170,20 @@
|
||||
*/
|
||||
handleChangeTabs: (e: {index: number, name: string}) => {
|
||||
tab.value = e.name
|
||||
if (e.name === AdminOrderStatusText.Pending) {
|
||||
orderStatus.value = '0'
|
||||
if (useStore.defaultStore.operationType == 1) {
|
||||
if (e.name === AdminOrderStatusText.Pending) {
|
||||
orderStatus.value = '0'
|
||||
} else {
|
||||
orderStatus.value = AdminOrderStatusValue[e.name] || ''
|
||||
}
|
||||
} else {
|
||||
orderStatus.value = AdminOrderStatusValue[e.name] || ''
|
||||
console.log("🚀 ~ e.name:", e.name)
|
||||
console.log("🚀 ~ e.name:",GroupComboOrderStatusValue[e.name])
|
||||
if (e.name === GroupComboOrderStatusText.ToUse) {
|
||||
orderStatus.value = '0'
|
||||
} else {
|
||||
orderStatus.value = GroupComboOrderStatusValue[e.name] || ''
|
||||
}
|
||||
}
|
||||
|
||||
// 切换tab时,重置当前的mescroll
|
||||
|
||||
Reference in New Issue
Block a user