优化功能
This commit is contained in:
@ -29,6 +29,29 @@ export function getStoreOrderList(data: IGetStoreOrderListParams) {
|
||||
return http.Post<any>('/storeapi/order/orderStoreList', data)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 团购套餐订单列表页
|
||||
*/
|
||||
export interface IGetGroupComboOrderListParams {
|
||||
page: number
|
||||
size: number
|
||||
store_id: number
|
||||
status?: string
|
||||
search?: string
|
||||
}
|
||||
|
||||
export function getGroupComboOrderList(data: IGetGroupComboOrderListParams) {
|
||||
return http.Post<any>('/storeapi/store/storeOperationGroup', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 团购套餐订单详情
|
||||
*/
|
||||
export function getGroupComboOrderDetail(id: number) {
|
||||
return http.Post<any>('/storeapi/store/storeOperationGroupDetails', { id })
|
||||
}
|
||||
|
||||
/**
|
||||
* 续单
|
||||
* @param id 订单ID
|
||||
|
||||
@ -152,7 +152,7 @@
|
||||
<view class="flex-1">
|
||||
<view @click="ComboCard.handleToOrderDetail(order.id)">
|
||||
<view class="flex justify-between items-center">
|
||||
<view class="font-500 text-30rpx text-[#303133] leading-42rpx line-1 w-300rpx">{{ order.room_name }}</view>
|
||||
<view class="font-500 text-30rpx text-[#303133] leading-42rpx line-1 w-260rpx">{{ order.room_name }}</view>
|
||||
<view class="text-[#303133] text-30rpx leading-42rpx font-bold">¥{{order.price || 0}}</view>
|
||||
</view>
|
||||
<view class="font-400 leading-36rpx text-26rpx text-[#606266] mt-34rpx">
|
||||
@ -185,13 +185,57 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 茶室管理端-套餐订单管理 -->
|
||||
<view v-if="type === OrderSource.GroupComboOrder" class="bg-white rounded-10rpx p-30rpx">
|
||||
<view class="flex justify-between items-center">
|
||||
<view class="flex items-center">
|
||||
<view class="mr-10rpx flex items-center">
|
||||
<wd-img width="40rpx" height="40rpx" :src="`${OSS}icon/icon_tea_room.png`"></wd-img>
|
||||
</view>
|
||||
<view class="flex items-center w-400rpx">
|
||||
<view class="font-bold text-30rpx leading-42rpx text-[#303133] mr-10rpx line-1">{{ order.store_name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="font-400 text-28rpx leading-40rpx mt-12rpx text-[#4C9F44]">
|
||||
<text class="text-[#4C9F44]" v-if="order.order_status === GroupComboOrderStatus.ToUse">待使用</text>
|
||||
<text class="text-[#606266]" v-if="order.order_status === GroupComboOrderStatus.Used">已使用</text>
|
||||
<text class="text-[#C9C9C9]" v-if="order.order_status === GroupComboOrderStatus.Refunded">已退款</text>
|
||||
<text class="text-[#C9C9C9]" v-if="order.order_status === GroupComboOrderStatus.Refunding">退款中</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mt-22rpx">
|
||||
<view class="flex items-center justify-between" @click="ComboCard.handleToOrderDetail(order.id)">
|
||||
<view class="mr-28rpx">
|
||||
<wd-img width="200rpx" height="200rpx" :src="order.tea_store_group.img" radius="10rpx"></wd-img>
|
||||
</view>
|
||||
<view class="flex-1">
|
||||
<view >
|
||||
<view class="flex justify-between items-center">
|
||||
<view class="font-500 text-30rpx text-[#303133] leading-42rpx line-1 w-260rpx truncate">{{ order.tea_store_group.title }}</view>
|
||||
<view class="text-[#303133] text-30rpx leading-42rpx font-bold ml-12rpx" style="flex-shrink:0;max-width:120rpx;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">
|
||||
¥{{order.order_amount || 0}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="font-400 leading-36rpx text-26rpx text-[#606266] mt-12rpx">
|
||||
<view>
|
||||
<wd-tag bg-color="#F3F3F3" color="#606266" custom-class="!px-16rpx">{{ order.tea_store_group.hour }}小时</wd-tag>
|
||||
</view>
|
||||
<!-- <view class="mt-20rpx" v-if="order.end_day">有效期至:{{ order.end_day }}</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 取消订单, 删除订单 -->
|
||||
<wd-message-box selector="wd-message-box-slot"></wd-message-box>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="ComboCard">
|
||||
import { OrderSource, AdminOrderStatus } from '@/utils/order'
|
||||
import { OrderSource, AdminOrderStatus, GroupComboOrderStatus } from '@/utils/order'
|
||||
import { useMessage } from 'wot-design-uni'
|
||||
import { toast } from '@/utils/toast'
|
||||
import { handleReleaseTeaRoomOrderHookds, handleCancelOrderHooks, handleDeleteOrderHooks } from '@/hooks/useOrder'
|
||||
@ -227,7 +271,6 @@
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
const ComboCard = {
|
||||
@ -237,6 +280,8 @@
|
||||
handleToOrderDetail: (id: number) => {
|
||||
if (props.type == OrderSource.Admin) {
|
||||
router.navigateTo(`/pages/order/order-detail?id=${id}`)
|
||||
} else if (props.type == OrderSource.GroupComboOrder) {
|
||||
router.navigateTo(`/pages/order/group-detail?id=${id}`)
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -25,19 +25,28 @@
|
||||
</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>
|
||||
|
||||
<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
|
||||
|
||||
@ -51,6 +51,7 @@ export enum OrderSource {
|
||||
TeaSpecialist = 'teaSpecialist', // 茶艺师
|
||||
SetMeal = 'setMeal', // 茶室管理端-套餐管理
|
||||
Admin = 'admin', // 茶室管理端-套餐管理
|
||||
GroupComboOrder = 'groupComboOrder', // 茶室管理端-团购套餐订单管理
|
||||
}
|
||||
|
||||
// 订单来源对应名称
|
||||
@ -61,6 +62,7 @@ export const OrderSourceText: Record<OrderSource, string> = {
|
||||
[OrderSource.TeaSpecialist]: '茶艺师',
|
||||
[OrderSource.SetMeal]: '套餐管理',
|
||||
[OrderSource.Admin]: '管理员',
|
||||
[OrderSource.GroupComboOrder]: '团购套餐订单管理',
|
||||
}
|
||||
|
||||
// 订单状态
|
||||
@ -181,6 +183,20 @@ export const OrderStatusTitle: Record<OrderSource, Record<OrderStatus, string>>
|
||||
[OrderStatus.AfterSaleApply]: '申请售后',
|
||||
[OrderStatus.AfterSaleProcessing]: '申请售后中'
|
||||
},
|
||||
[OrderSource.GroupComboOrder]: {
|
||||
[OrderStatus.Consuming]: '消费中',
|
||||
[OrderStatus.Reserved]: '已预约',
|
||||
[OrderStatus.Serving]: '服务中',
|
||||
[OrderStatus.Pending]: '待付款',
|
||||
[OrderStatus.Confirm]: '订单待确认',
|
||||
[OrderStatus.Finished]: '已完结',
|
||||
[OrderStatus.Cancelled]: '订单取消',
|
||||
[OrderStatus.ToUse]: '待使用',
|
||||
[OrderStatus.Used]: '交易完成',
|
||||
[OrderStatus.Refunded]: '售后完成',
|
||||
[OrderStatus.AfterSaleApply]: '申请售后',
|
||||
[OrderStatus.AfterSaleProcessing]: '申请售后中'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -381,3 +397,43 @@ export const AdminOrderStatusValue: Record<AdminOrderStatusText, string | number
|
||||
[AdminOrderStatusText.Finished]: 3,
|
||||
[AdminOrderStatusText.Cancelled]: 4,
|
||||
}
|
||||
|
||||
|
||||
// 本地-团购套餐订单状态
|
||||
export enum GroupComboOrderStatus {
|
||||
ToUse = 0, // 待使用
|
||||
Used = 1, // 已使用
|
||||
Refunded = 3, // 已退款
|
||||
Refunding = 4, // 退款中
|
||||
}
|
||||
|
||||
export enum GroupComboOrderStatusText {
|
||||
All = 'all', // 全部
|
||||
ToUse = 'toUse', // 待使用
|
||||
Used = 'used', // 已使用
|
||||
Refunded = 'refunded', // 已退款
|
||||
Refunding = 'refunding', // 退款中
|
||||
}
|
||||
|
||||
export const GroupComboOrderStatusValue: Record<GroupComboOrderStatusText, string | number> = {
|
||||
[GroupComboOrderStatusText.All]: '',
|
||||
[GroupComboOrderStatusText.ToUse]: 0,
|
||||
[GroupComboOrderStatusText.Used]: 1,
|
||||
[GroupComboOrderStatusText.Refunded]: 3,
|
||||
[GroupComboOrderStatusText.Refunding]: 4,
|
||||
}
|
||||
|
||||
export const GroupComboOrderStatusTextValue: Record<GroupComboOrderStatus, any> = {
|
||||
[GroupComboOrderStatus.ToUse]: {
|
||||
title: '待使用'
|
||||
},
|
||||
[GroupComboOrderStatus.Used]: {
|
||||
title: '交易完成'
|
||||
},
|
||||
[GroupComboOrderStatus.Refunded]: {
|
||||
title: '退款成功'
|
||||
},
|
||||
[GroupComboOrderStatus.Refunding]: {
|
||||
title: '退款中'
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user