对接订单管理接口
This commit is contained in:
@ -483,6 +483,7 @@
|
||||
dtime: '',
|
||||
update_dtime: '',
|
||||
renew_price: 0,
|
||||
renew_hour: 0,
|
||||
renew_dtime: {
|
||||
start_time: '',
|
||||
end_time: '',
|
||||
|
||||
@ -7,18 +7,18 @@
|
||||
|
||||
<template>
|
||||
<view class="pb-180rpx">
|
||||
<!-- 改价弹窗 -->
|
||||
<!-- 团购有效期 -->
|
||||
<wd-popup v-model="showExpireTimePooup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;background-color: #F8F9FA;" position="bottom">
|
||||
<view class="relative pb-56rpx">
|
||||
<view class="absolute top-18rpx right-30rpx" @click="showExpireTimePooup = false">
|
||||
<wd-img width="60rpx" height='60rpx' :src="`${OSS}icon/icon_close.png`"></wd-img>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="text-36rpx text-[#121212] leading-50rpx text-center pt-50rpx pb-40rpx">团购有效期</view>
|
||||
|
||||
<view class="bg-white mx-30rpx rounded-10rpx px-30rpx py-32rpx">
|
||||
<view class="">
|
||||
<view class="flex items-center">
|
||||
<view class="flex items-center" @click="chekcedType = 1">
|
||||
<wd-img width="48rpx" height="48rpx" :src="chekcedType == 1 ? `${OSS}icon/icon_pay_success.png` : `${OSS}icon/icon_no_checked.png`"></wd-img>
|
||||
<view class="font-bold text-28rpx leading-40rpx text-[#303133] ml-40rpx">指定天数内有效</view>
|
||||
</view>
|
||||
@ -34,8 +34,8 @@
|
||||
|
||||
<view class="bg-white mx-30rpx rounded-10rpx px-30rpx py-32rpx">
|
||||
<view class="">
|
||||
<view class="flex items-center">
|
||||
<wd-img width="48rpx" height="48rpx" :src="chekcedType == 1 ? `${OSS}icon/icon_pay_success.png` : `${OSS}icon/icon_no_checked.png`"></wd-img>
|
||||
<view class="flex items-center" @click="chekcedType = 2">
|
||||
<wd-img width="48rpx" height="48rpx" :src="chekcedType == 2 ? `${OSS}icon/icon_pay_success.png` : `${OSS}icon/icon_no_checked.png`"></wd-img>
|
||||
<view class="font-bold text-28rpx leading-40rpx text-[#303133] ml-40rpx">指定时间段内有效</view>
|
||||
</view>
|
||||
<view class="flex items0-center ml-60rpx" >
|
||||
@ -44,7 +44,33 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="font-400 mx-48rpx h-90rpx leading-90rpx rounded-8rpx text-center mt-80rpx text-[#fff] bg-[#4C9F44] text-30rpx font-400" @click="">确定</view>
|
||||
<view class="font-400 mx-48rpx h-90rpx leading-90rpx rounded-8rpx text-center mt-80rpx text-[#fff] bg-[#4C9F44] text-30rpx font-400">确定</view>
|
||||
</view>
|
||||
</wd-popup>
|
||||
|
||||
<!-- 选择包间 -->
|
||||
<wd-popup v-model="showRoomListPopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;background-color: #fff;" position="bottom">
|
||||
<view class="relative pb-56rpx">
|
||||
<view class="absolute top-18rpx right-30rpx" @click="showRoomListPopup = false">
|
||||
<wd-img width="60rpx" height='60rpx' :src="`${OSS}icon/icon_close.png`"></wd-img>
|
||||
</view>
|
||||
|
||||
<view class="text-36rpx text-[#121212] leading-50rpx text-center pt-50rpx pb-40rpx">选择包间</view>
|
||||
|
||||
<view class="px-32rpx">
|
||||
<wd-checkbox-group v-model="roomId" @change="Add.handleChooseAllTypeRoom">
|
||||
<wd-checkbox :modelValue="0" checked-color="#4C9F44" size="large" custom-class="!mb-40rpx">
|
||||
全部适用
|
||||
</wd-checkbox>
|
||||
<scroll-view scroll-y class="h-500rpx">
|
||||
<wd-checkbox :modelValue="item.id" v-for="item in roomList " :key="item.id" checked-color="#4C9F44" size="large" custom-class="!mb-40rpx">
|
||||
{{ item.label }}
|
||||
</wd-checkbox>
|
||||
</scroll-view>
|
||||
</wd-checkbox-group>
|
||||
</view>
|
||||
|
||||
<view class="font-400 mx-48rpx h-90rpx leading-90rpx rounded-8rpx text-center mt-80rpx text-[#fff] bg-[#4C9F44] text-30rpx font-400" @click="Add.handleChooseRoom">确定</view>
|
||||
</view>
|
||||
</wd-popup>
|
||||
|
||||
@ -92,7 +118,7 @@
|
||||
<view class="flex items-center mt-46rpx" v-if="form.type == 2">
|
||||
<view class="text-28rpx leading-40rpx text-[#303133] mr-66rpx font-400">抖音skuid</view>
|
||||
<view class="flex-1">
|
||||
<wd-input no-border placeholder="请输入抖音skuid"
|
||||
<wd-input v-model="form.sku_id" no-border placeholder="请输入抖音skuid"
|
||||
custom-class="!bg-[#F6F7F8] !rounded-16rpx !px-28rpx !py-20rpx"></wd-input>
|
||||
</view>
|
||||
</view>
|
||||
@ -104,7 +130,7 @@
|
||||
<wd-img width="16rpx" height="16rpx" :src="`${OSS}icon/icon_validate.png`"></wd-img>
|
||||
</view>
|
||||
</view>
|
||||
<wd-textarea v-model="form.name"
|
||||
<wd-textarea v-model="form.title"
|
||||
custom-class='!rounded-18rpx !border-2rpx !border-[#EFF0EF] !bg-[#F8F9FA] !mt-20rpx'
|
||||
custom-textarea-class='!bg-[#F8F9FA] !h-100rpx' :maxlength='30' show-word-limit />
|
||||
</view>
|
||||
@ -116,12 +142,12 @@
|
||||
<wd-img width="16rpx" height="16rpx" :src="`${OSS}icon/icon_validate.png`"></wd-img>
|
||||
</view>
|
||||
</view>
|
||||
<wd-textarea v-model="form.name"
|
||||
<wd-textarea v-model="form.description"
|
||||
custom-class='!rounded-18rpx !border-2rpx !border-[#EFF0EF] !bg-[#F8F9FA] !mt-20rpx'
|
||||
custom-textarea-class='!bg-[#F8F9FA] !h-100rpx' :maxlength='30' show-word-limit />
|
||||
</view>
|
||||
|
||||
<view class="mt-28rpx add-textarea">
|
||||
<!-- <view class="mt-28rpx add-textarea">
|
||||
<view class="flex items-center mb-28rpx">
|
||||
<view class="text-32rpx leading-44rpx text-#303133 mr-10rpx font-bold">团购视频</view>
|
||||
</view>
|
||||
@ -136,7 +162,7 @@
|
||||
<view class="font-400 text-26rpx leading-36rpx text-#303133">添加视频</view>
|
||||
</view>
|
||||
</wd-upload>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<view class="mt-28rpx add-textarea">
|
||||
<view class="flex items-center justify-between mb-28rpx">
|
||||
@ -150,7 +176,7 @@
|
||||
最多可上传9张图片
|
||||
</view>
|
||||
</view>
|
||||
<wd-upload :file-list="fileList" :limit="9" image-mode="scaleToFill" accept="image" :action="action"
|
||||
<wd-upload :header="{'token': token}" :file-list="fileList" :limit="9" image-mode="scaleToFill" multiple accept="image" :action="action"
|
||||
@change="Add.handleUploadFile">
|
||||
<view
|
||||
class="border-2rpx border-dashed border-[#E5E5E5] w-184rpx h-184rpx flex flex-col items-center justify-center rounded-16rpx">
|
||||
@ -174,7 +200,7 @@
|
||||
<wd-img width="16rpx" height="16rpx" :src="`${OSS}icon/icon_validate.png`"></wd-img>
|
||||
</view>
|
||||
</view>
|
||||
<wd-input no-border placeholder="请输入门市价"
|
||||
<wd-input v-model="form.price" no-border placeholder="请输入门市价"
|
||||
custom-class="!bg-[#F6F7F8] !rounded-16rpx !px-28rpx !py-20rpx"></wd-input>
|
||||
</view>
|
||||
<view class="">
|
||||
@ -184,12 +210,12 @@
|
||||
<wd-img width="16rpx" height="16rpx" :src="`${OSS}icon/icon_validate.png`"></wd-img>
|
||||
</view>
|
||||
</view>
|
||||
<wd-input no-border placeholder="请输入团购价"
|
||||
<wd-input v-model="form.discount_price" no-border placeholder="请输入团购价"
|
||||
custom-class="!bg-[#F6F7F8] !rounded-16rpx !px-28rpx !py-20rpx"></wd-input>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class=" mb-28rpx">
|
||||
<view class="mb-28rpx">
|
||||
<view class="mr-30rpx">
|
||||
<view class="flex items-center mb-20rpx w-[100%]">
|
||||
<view class="flex items-center justify-between w-[100%]">
|
||||
@ -203,7 +229,7 @@
|
||||
<view class="font-400 text-24rpx leading-34rpx text-[#9CA3AF]">输入范围1~999</view>
|
||||
</view>
|
||||
</view>
|
||||
<wd-input no-border placeholder="请输入库存"
|
||||
<wd-input v-model="form.number" no-border placeholder="请输入库存"
|
||||
custom-class="!bg-[#F6F7F8] !rounded-16rpx !px-28rpx !py-20rpx"></wd-input>
|
||||
</view>
|
||||
</view>
|
||||
@ -225,7 +251,7 @@
|
||||
<view class="font-400 text-24rpx leading-34rpx text-[#9CA3AF]">每条内容之间需要换行输入</view>
|
||||
</view>
|
||||
</view>
|
||||
<wd-textarea v-model="form.name"
|
||||
<wd-textarea v-model="form.introduce"
|
||||
custom-class='!rounded-18rpx !border-2rpx !border-[#EFF0EF] !bg-[#F8F9FA] !mt-20rpx'
|
||||
custom-textarea-class='!bg-[#F8F9FA]' />
|
||||
</view>
|
||||
@ -234,7 +260,7 @@
|
||||
<view class="flex items-center mb-20rpx w-[100%]">
|
||||
<view class="text-30rpx leading-44rpx text-#303133 mr-10rpx font-bold">其他说明</view>
|
||||
</view>
|
||||
<wd-textarea v-model="form.name"
|
||||
<wd-textarea v-model="form.rests_introduce"
|
||||
custom-class='!rounded-18rpx !border-2rpx !border-[#EFF0EF] !bg-[#F8F9FA] !mt-20rpx'
|
||||
custom-textarea-class='!bg-[#F8F9FA]' />
|
||||
</view>
|
||||
@ -245,7 +271,7 @@
|
||||
<view class="font-bold text-34rpx text-[#303133] leading-48rpx mb-30rpx">购买须知</view>
|
||||
<view class="mb-28rpx">
|
||||
<!-- 团购有效期 -->
|
||||
<view class="mr-30rpx" @click="showExpireTimePooup = true">
|
||||
<!-- <view class="mr-30rpx" @click="showExpireTimePooup = true">
|
||||
<view class="flex items-center mb-20rpx w-[100%]">
|
||||
<view class="flex items-center justify-between w-[100%]">
|
||||
<view class="flex items-center">
|
||||
@ -267,19 +293,21 @@
|
||||
</template>
|
||||
</wd-input>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<!-- 适用包间 -->
|
||||
<view class="mt-28rpx">
|
||||
<view class="flex items-center mb-20rpx">
|
||||
<!-- TODO 有包间的显示包间(还需要添加一个全使适合用),没有包间的显示通用 -->
|
||||
<!-- TODO 有包间的显示包间(还需要添加一个全适合用),没有包间的显示通用 -->
|
||||
<view class="text-30rpx leading-44rpx text-#303133 mr-10rpx font-bold">适用包间</view>
|
||||
<view class="flex items-center">
|
||||
<wd-img width="16rpx" height="16rpx" :src="`${OSS}icon/icon_validate.png`"></wd-img>
|
||||
</view>
|
||||
</view>
|
||||
<wd-input no-border placeholder="请输入全部适用或是指定包间名称"
|
||||
<view class="" @click="showRoomListPopup = true">
|
||||
<wd-input v-model="room" no-border placeholder="请输入全部适用或是指定包间名称" readonly
|
||||
custom-class="!bg-[#F6F7F8] !rounded-16rpx !px-28rpx !py-20rpx"></wd-input>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 适用时长 -->
|
||||
@ -290,7 +318,7 @@
|
||||
<wd-img width="16rpx" height="16rpx" :src="`${OSS}icon/icon_validate.png`"></wd-img>
|
||||
</view>
|
||||
</view>
|
||||
<wd-input no-border placeholder="请输入适用时长"
|
||||
<wd-input v-model="form.hour" no-border placeholder="请输入适用时长"
|
||||
custom-class="!bg-[#F6F7F8] !rounded-16rpx !px-28rpx !py-20rpx">
|
||||
<template #suffix>
|
||||
小时
|
||||
@ -298,7 +326,7 @@
|
||||
</wd-input>
|
||||
</view>
|
||||
|
||||
<!-- 使用人数 -->
|
||||
<!-- 使用人数说明 -->
|
||||
<view class="mt-28rpx">
|
||||
<view class="flex items-center mb-20rpx">
|
||||
<view class="text-30rpx leading-44rpx text-#303133 mr-10rpx font-bold">使用人数</view>
|
||||
@ -306,7 +334,7 @@
|
||||
<wd-img width="16rpx" height="16rpx" :src="`${OSS}icon/icon_validate.png`"></wd-img>
|
||||
</view>
|
||||
</view>
|
||||
<wd-input no-border placeholder="请输入使用人数,如每张团购券不限使用人数"
|
||||
<wd-input v-model="form.pl_number" no-border placeholder="请输入使用人数,如每张团购券不限使用人数"
|
||||
custom-class="!bg-[#F6F7F8] !rounded-16rpx !px-28rpx !py-20rpx"></wd-input>
|
||||
</view>
|
||||
|
||||
@ -318,16 +346,16 @@
|
||||
<wd-img width="16rpx" height="16rpx" :src="`${OSS}icon/icon_validate.png`"></wd-img>
|
||||
</view>
|
||||
</view>
|
||||
<wd-textarea v-model="form.name"
|
||||
<wd-textarea v-model="form.returd_details"
|
||||
custom-class='!rounded-18rpx !border-2rpx !border-[#EFF0EF] !bg-[#F8F9FA] !mt-20rpx'
|
||||
custom-textarea-class='!bg-[#F8F9FA]'/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="w-full fixed bottom-0 left-0 right-0 bg-white h-152rpx">
|
||||
<view class="w-full fixed bottom-0 left-0 right-0 bg-white h-152rpx z-9">
|
||||
<view class="flex items-center justify-center text-32rpx leading-44rpx leading-90rpx text-center !mt-34rpx">
|
||||
<wd-button custom-class="!text-32rpx !w-630rpx !h-90rpx !bg-[#4C9F44] !rounded-8rpx !text-[#fff]" @click="router.navigateTo('/bundle/setmeal/add?type=add')">发布</wd-button>
|
||||
<wd-button custom-class="!text-32rpx !w-630rpx !h-90rpx !bg-[#4C9F44] !rounded-8rpx !text-[#fff]" @click="Add.handleRelease">发布</wd-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -336,8 +364,14 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { router } from '@/utils/tools'
|
||||
import { getAllRoomList } from '@/api/store'
|
||||
import { addTeaSpecialistOrderPackage, getTeaSpecialistOrderPackageDetail, editTeaSpecialistOrderPackage } from '@/api/order'
|
||||
import { useStoreStore } from '@/store'
|
||||
import { toast } from '@/utils/toast'
|
||||
|
||||
const OSS = inject('OSS')
|
||||
const token = ref<string>('') // 用户token
|
||||
const useStore = useStoreStore()
|
||||
|
||||
// 页面标题
|
||||
const title = ref<string>('新建套餐')
|
||||
@ -348,20 +382,32 @@
|
||||
|
||||
// 上传文件
|
||||
const fileList = ref<any[]>([])
|
||||
const action = 'https://www.mocky.io/v2/5cc8019d300000980a055e76' // 仅做测试使用,实际请换成真实上传接口
|
||||
const action = import.meta.env.VITE_UPLOAD_BASEURL
|
||||
|
||||
// 表单
|
||||
const form = reactive<{
|
||||
type: number,
|
||||
code: string,
|
||||
message: string,
|
||||
name: string
|
||||
}>({
|
||||
type: 1,
|
||||
code: '',
|
||||
message: '',
|
||||
name: ''
|
||||
})
|
||||
const form = ref({
|
||||
store_id: useStore.defaultStore.id,
|
||||
type: 1, // 套餐属性 1本地套餐 2抖音套餐
|
||||
sku_id: '', // 抖音skuid
|
||||
title: '', // 团购名称
|
||||
description: '', // 环境描述
|
||||
img: '', // 团购图片
|
||||
price: '', //门市价
|
||||
discount_price: '', // 团购价
|
||||
number: '', // 库存
|
||||
introduce: '', // 套餐介绍
|
||||
rests_introduce: '', // 其他说明
|
||||
room_id: '', // 适用包间
|
||||
hour: '', // 适用时长
|
||||
pl_number: '', // 使用人数说明
|
||||
returd_details: '', // 退改说明
|
||||
status: 0, // 状态 0下架1上架
|
||||
})
|
||||
const roomId = ref<Array<number>>([]) // 选择的包间id
|
||||
const room = ref<string>('')
|
||||
const roomList = ref<Array<{label: string, id: number}>>([])
|
||||
const showRoomListPopup = ref<boolean>(false)
|
||||
const orderId = ref<number>(0) // 订单ID
|
||||
|
||||
// 日期过滤
|
||||
const value = ref<number>(Date.now())
|
||||
@ -373,16 +419,79 @@
|
||||
const startTime = ref<number>(Date.now())
|
||||
const endTime = ref<number>(Date.now())
|
||||
|
||||
onLoad((args) => {
|
||||
// TODO 如果是编辑页面咋额
|
||||
onLoad(async (args) => {
|
||||
token.value = uni.getStorageSync('token')
|
||||
await Add.handleGetRoomList()
|
||||
|
||||
// TODO 如果是编辑页面
|
||||
type.value = args.type || 'add'
|
||||
if (type.value === 'edit') {
|
||||
orderId.value = Number(args.id) || 0
|
||||
title.value = '修改套餐信息'
|
||||
// 获取套餐信息
|
||||
await Add.handleGetPackageDetail()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
const Add = {
|
||||
fileList: [],
|
||||
|
||||
/**
|
||||
* 获取包间列表
|
||||
*/
|
||||
handleGetRoomList: async () => {
|
||||
const res = await getAllRoomList(useStore.defaultStore.id)
|
||||
roomList.value = res.list.map((item: any) => ({
|
||||
label: item.title,
|
||||
id: item.id
|
||||
}))
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取套餐详情
|
||||
*/
|
||||
handleGetPackageDetail: async () => {
|
||||
// TODO 获取套餐详情接口
|
||||
const res = await getTeaSpecialistOrderPackageDetail(orderId.value)
|
||||
form.value = {
|
||||
store_id: useStore.defaultStore.id,
|
||||
type: res.type, // 套餐属性 1本地套餐 2抖音套餐
|
||||
sku_id: res.sku_id, // 抖音skuid
|
||||
title: res.title, // 团购名称
|
||||
description: res.description, // 环境描述
|
||||
img: res.img, // 团购图片
|
||||
price: res.price, //门市价
|
||||
discount_price: res.discount_price, // 团购价
|
||||
number: res.number, // 库存
|
||||
introduce: res.introduce, // 套餐介绍
|
||||
rests_introduce: res.rests_introduce, // 其他说明
|
||||
room_id: res.room_id, // 适用包间
|
||||
hour: res.hour, // 适用时长
|
||||
pl_number: res.pl_number, // 使用人数说明
|
||||
returd_details: res.returd_details, // 退改说明
|
||||
status: res.status, // 状态 0下架1上架
|
||||
}
|
||||
|
||||
fileList.value = res.img.split(',').map((item: string) => ({
|
||||
name: item,
|
||||
url: item
|
||||
}))
|
||||
Add.fileList = fileList.value
|
||||
|
||||
if (Number(res.room_id) == 0) {
|
||||
room.value = '全部适用'
|
||||
// 全选:0 + 所有包间id
|
||||
const allIds = roomList.value.map(item => item.id)
|
||||
console.log("🚀 ~ allIds:", allIds)
|
||||
roomId.value = [0, ...allIds]
|
||||
} else {
|
||||
const roomIds = res.room_id.split(',').map((id: string) => Number(id))
|
||||
roomId.value = roomIds
|
||||
room.value = res.room_title
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 切换tab
|
||||
*/
|
||||
@ -393,8 +502,25 @@
|
||||
/**
|
||||
* 图片选择/删除
|
||||
*/
|
||||
handleUploadFile: (event: any) => {
|
||||
fileList.value = event.fileList
|
||||
handleUploadFile: ({ fileList: files }) => {
|
||||
let url = ''
|
||||
let name = ''
|
||||
let response = null
|
||||
|
||||
const res = files.map(item => {
|
||||
if (item.response) {
|
||||
response = JSON.parse(item.response)
|
||||
url = response.data.uri
|
||||
name = response.data.name
|
||||
}
|
||||
return {
|
||||
name: name || item.name,
|
||||
url: url || item.url
|
||||
}
|
||||
})
|
||||
|
||||
fileList.value = files
|
||||
Add.fileList = res
|
||||
},
|
||||
|
||||
/**
|
||||
@ -411,6 +537,153 @@
|
||||
console.log("🚀 ~ date:", date)
|
||||
startTime.value = date.value[0]
|
||||
endTime.value = date.value[1]
|
||||
},
|
||||
|
||||
/**
|
||||
* 选择全部适用房间
|
||||
*/
|
||||
handleChooseAllTypeRoom: (e: { value: number[] }) => {
|
||||
// 如果选择了0,则所有房间都勾选(包含全部id和0)
|
||||
if (Array.isArray(e.value) && e.value.includes(0)) {
|
||||
// 获取所有房间id
|
||||
const allIds = roomList.value.map(item => item.id)
|
||||
roomId.value = [0, ...allIds]
|
||||
} else {
|
||||
roomId.value = e.value
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 确认选择包间列表
|
||||
*/
|
||||
handleChooseRoom: () => {
|
||||
if (roomId.value.includes(0)) {
|
||||
room.value = '全部适用'
|
||||
} else {
|
||||
const selectedRooms = roomList.value.filter(item => roomId.value.includes(item.id))
|
||||
room.value = selectedRooms.map(item => item.label).join(',')
|
||||
}
|
||||
showRoomListPopup.value = false
|
||||
},
|
||||
|
||||
/**
|
||||
* 发布套餐
|
||||
*/
|
||||
handleRelease: async () => {
|
||||
const formData = form.value
|
||||
|
||||
// 抖音套餐下需要填写抖音UID
|
||||
if (formData.type == 2 && !formData.sku_id) {
|
||||
toast.info('请输入抖音skuid')
|
||||
return
|
||||
} else {
|
||||
formData.sku_id = '0'
|
||||
}
|
||||
|
||||
// 团购套餐
|
||||
if (!formData.title) {
|
||||
toast.info('请输入团购名称')
|
||||
return
|
||||
}
|
||||
|
||||
// 环境描述
|
||||
if (!formData.description) {
|
||||
toast.info('请输入环境描述')
|
||||
return
|
||||
}
|
||||
|
||||
// 团购图片
|
||||
if (Add.fileList.length == 0) {
|
||||
toast.info('请上传团购图片')
|
||||
return
|
||||
}
|
||||
|
||||
// 门市价
|
||||
if (!formData.price) {
|
||||
toast.info('请输入门市价')
|
||||
return
|
||||
}
|
||||
|
||||
// 团购价
|
||||
if (!formData.discount_price) {
|
||||
toast.info('请输入团购价')
|
||||
return
|
||||
}
|
||||
|
||||
// 库存
|
||||
if (!formData.number) {
|
||||
toast.info('请输入库存')
|
||||
return
|
||||
}
|
||||
|
||||
// 套餐介绍
|
||||
if (!formData.introduce) {
|
||||
toast.info('请输入套餐介绍')
|
||||
return
|
||||
}
|
||||
|
||||
// 其他说明
|
||||
// if (!formData.rests_introduce) {
|
||||
// toast.info('请输入其他说明')
|
||||
// return
|
||||
// }
|
||||
|
||||
// 适用包间
|
||||
if (roomId.value.length == 0) {
|
||||
toast.info('请选择适用包间')
|
||||
return
|
||||
}
|
||||
|
||||
// 适用时长
|
||||
if (!formData.hour) {
|
||||
toast.info('请输入适用时长')
|
||||
return
|
||||
}
|
||||
|
||||
// 使用人数
|
||||
if (!formData.pl_number) {
|
||||
toast.info('请输入使用人数说明')
|
||||
return
|
||||
}
|
||||
|
||||
// 退改说明
|
||||
if (!formData.returd_details) {
|
||||
toast.info('请输入退改说明')
|
||||
return
|
||||
}
|
||||
|
||||
formData.img = Add.fileList.map(item => item.url).join(',')
|
||||
|
||||
if (roomId.value.includes(0)) {
|
||||
formData.room_id = '0'
|
||||
} else {
|
||||
formData.room_id = roomId.value.join(',')
|
||||
}
|
||||
|
||||
if (type.value == 'add') {
|
||||
formData.status = 1
|
||||
}
|
||||
|
||||
uni.showLoading({
|
||||
title: '发布中...'
|
||||
})
|
||||
|
||||
try {
|
||||
// TODO 调用发布接口
|
||||
if (type.value == 'add') {
|
||||
await addTeaSpecialistOrderPackage(formData)
|
||||
} else if (type.value == 'edit') {
|
||||
// @ts-ignore
|
||||
formData.group_id = orderId.value
|
||||
await editTeaSpecialistOrderPackage(formData)
|
||||
}
|
||||
|
||||
uni.hideLoading()
|
||||
toast.info(type.value == 'add' ? '发布成功' : '编辑成功')
|
||||
router.navigateBack(1, 500)
|
||||
} catch(e) {
|
||||
uni.hideLoading()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -7,89 +7,8 @@
|
||||
}</route>
|
||||
<template>
|
||||
<view class="pb-180rpx">
|
||||
<!-- 费用明细 -->
|
||||
<wd-popup v-model="showCostPopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;" @close="showCostPopup = false" position="bottom">
|
||||
<view class='bg-[#FBFBFB] py-40rpx realtive'>
|
||||
<view class="absolute top-18rpx right-30rpx" @click="showCostPopup = false">
|
||||
<wd-img width="60rpx" height='60rpx' :src="`${OSS}icon/icon_close.png`"></wd-img>
|
||||
</view>
|
||||
<view class="text-36rpx text-[#121212] leading-50rpx text-center">费用明细</view>
|
||||
<view class="mx-30rpx bg-white rounded-16rpx px-30rpx pt-40rpx mt-40rpx pb-30rpx">
|
||||
<view class="flex justify-between items-center text-30rpx text-[#303133] leading-42rpx">
|
||||
<view>茶室费</view>
|
||||
<view>¥{{ bill.service.total }}</view>
|
||||
</view>
|
||||
|
||||
<view class="flex justify-between items-center text-24rpx text-[#909399] leading-34rpx mt-16rpx">
|
||||
<view>茶室费(¥{{ teaRoomPrice }}元/小时)</view>
|
||||
<view>x{{ bill.service.num }}</view>
|
||||
</view>
|
||||
|
||||
<view class="mt-52rpx">
|
||||
<view class="flex justify-between items-center text-30rpx text-[#303133] leading-42rpx">
|
||||
<view>优惠</view>
|
||||
<view class="text-[#4C9F44]">-¥{{ bill.totalDiscount }}</view>
|
||||
</view>
|
||||
<view class="flex justify-between items-center text-24rpx text-[#909399] leading-34rpx mt-16rpx">
|
||||
<view>优惠券</view>
|
||||
<view>-¥{{ bill.coupon || 0 }}</view>
|
||||
</view>
|
||||
<view class="flex justify-between items-center text-24rpx text-[#909399] leading-34rpx mt-16rpx">
|
||||
<view>团购券</view>
|
||||
<view>-¥{{ bill.groupCoupon || 0 }}</view>
|
||||
</view>
|
||||
<view class="flex justify-between items-center text-24rpx text-[#909399] leading-34rpx mt-16rpx">
|
||||
<view>会员八折</view>
|
||||
<view>-¥{{ bill.discount || 0 }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="my-30rpx">
|
||||
<wd-gap height="2rpx" bgColor='#F6F7F9'></wd-gap>
|
||||
</view>
|
||||
|
||||
<view class="flex justify-between items-center text-30rpx text-[#303133] leading-42rpx">
|
||||
<view>实付金额</view>
|
||||
<view>¥{{ bill.total }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</wd-popup>
|
||||
|
||||
<!-- 支付 -->
|
||||
<wd-popup v-model="showPayPopup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;" @close="showPayPopup = false" position="bottom">
|
||||
<view class='bg-[#FBFBFB] py-40rpx realtive'>
|
||||
<view class="absolute top-18rpx right-30rpx" @click="showPayPopup = false">
|
||||
<wd-img width="60rpx" height='60rpx' :src="`${OSS}icon/icon_close.png`"></wd-img>
|
||||
</view>
|
||||
<view class="text-36rpx text-[#121212] leading-50rpx text-center">支付</view>
|
||||
<view class="mx-30rpx bg-white rounded-16rpx px-30rpx pt-40rpx mt-40rpx pb-30rpx">
|
||||
<wd-radio-group v-model="pay" shape="dot" checked-color="#4C9F44">
|
||||
<view class="pay" v-for="(item, index) in payList" :key="index" @click="pay = item.id">
|
||||
<view class="flex justify-between items-center" v-if="pay == item.value" >
|
||||
<view class="flex items-center">
|
||||
<wd-img width="50rpx" height="50rpx" :src="item.icon"></wd-img>
|
||||
<view class="ml-20rpx text-30rpx text-[#303133] leading-42rpx">{{ item.name }}</view>
|
||||
</view>
|
||||
<view class="flex items-center">
|
||||
<wd-radio :value="item.value">
|
||||
<view class="text-[#303133] text-26rpx leading-36rpx mr-20rpx">可用202.22</view>
|
||||
</wd-radio>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</wd-radio-group>
|
||||
</view>
|
||||
|
||||
<view class='bg-[#4C9F44] text-[#fff] rounded-8rpx h-90rpx leading-90rpx mx-60rpx box-border text-center mt-170rpx' @click="Detail.handlePay">确定付款</view>
|
||||
</view>
|
||||
</wd-popup>
|
||||
|
||||
<!-- 选择预定时间 -->
|
||||
<booking-time v-model="showBookTimePopup" :day="sevenDay" @selectedTime="Detail.handleChooseReserveTime"></booking-time>
|
||||
|
||||
<view>
|
||||
<navbar :title="isGroupBuying ? '团购套餐' : '预定'" custom-class='!bg-[#F6F7F8]'></navbar>
|
||||
<navbar title="套餐详情" custom-class='!bg-[#F6F7F8]'></navbar>
|
||||
</view>
|
||||
|
||||
<view>
|
||||
@ -100,126 +19,105 @@
|
||||
</view>
|
||||
|
||||
<view class="bg-white rounded-16rpx py-26rpx px-30rpx mt-24rpx mx-30rpx">
|
||||
<view class="font-bold text-36rpx text-[#303133] leading-50rpx">{{ isGroupBuying ? teaRoomPackage.title : teaRoom.name }}</view>
|
||||
<view class="mt-14rpx flex" v-if="!isGroupBuying">
|
||||
<template v-for="(label, labelIndex) in teaRoom.label" :key="labelIndex">
|
||||
<view class="mr-20rpx flex items-start" v-if="label.category_id == 1">
|
||||
<wd-tag color="#40AE36" bg-color="#40AE36" plain custom-class="!rounded-4rpx">文艺小清新</wd-tag>
|
||||
</view>
|
||||
<view class="flex items-start" v-if="label.category_id == 2">
|
||||
<wd-tag color="#F55726" bg-color="#F55726" plain>全息投影</wd-tag>
|
||||
</view>
|
||||
</template>
|
||||
<view class="flex justify-between items-center">
|
||||
<view class="flex items-center">
|
||||
<price-format color="#FF5951" :first-size="36" :second-size="36" :subscript-size="24" :price="detail.discount_price"></price-format>
|
||||
<view class="rounded-4rpx w-60rpx text-center text-[#FF5951] border-2rpx border-solid border-[#FF5951] text-22rpx pb-4rpx mx-14rpx">{{ detail.discount }}折</view>
|
||||
<price-format color="#BFC2CC" :first-size="22" :second-size="22" :subscript-size="22" :price="detail.price" lineThrough></price-format>
|
||||
</view>
|
||||
<view class="text-[#6A6363] flex-1 text-22rpx leading-32rpx text-right">已售 10+</view>
|
||||
</view>
|
||||
<view class="flex justify-between items-center" :class="`${ isGroupBuying ? 'mt-24rpx' : ''}`">
|
||||
<view class="text-[#303133] text-26rpx leading-48rpx font-500" v-if="isGroupBuying">{{ teaRoomPackage.introduce }}</view>
|
||||
<!-- <view class="text-[#6A6363] flex-1 text-22rpx leading-32rpx text-right">已售 10+</view> -->
|
||||
</view>
|
||||
<view v-if="isGroupBuying">
|
||||
<view class="font-bold text-36rpx text-[#303133] leading-50rpx mt-26rpx">{{ detail.title }}</view>
|
||||
<view class="font-500 text-26rpx leading-48rpx text-[#303133] mt-24rpx">{{ detail.description }}</view>
|
||||
<view>
|
||||
<view class="mt-20rpx mb-24rpx" >
|
||||
<wd-gap height="2rpx" bgColor="#F6F7F9"></wd-gap>
|
||||
</view>
|
||||
<view class="text-[#303133] text-28rpx leading-48rpx">
|
||||
<rich-text :nodes="teaRoomPackage.details"></rich-text>
|
||||
<!-- <view>
|
||||
<text class="font-bold mr-26rpx">须知</text>
|
||||
<text class="font-500">{{ teaRoomPackage.details }}</text>
|
||||
</view>
|
||||
<view class="mt-22rpx">
|
||||
<text class="font-bold mr-26rpx">保障</text>
|
||||
<text class="font-500">随时退</text>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="!isGroupBuying">
|
||||
<!-- 使用说明 -->
|
||||
<view class="bg-white rounded-16rpx py-26rpx px-30rpx mt-24rpx mx-30rpx">
|
||||
<view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">使用说明</view>
|
||||
<view class="">
|
||||
<rich-text :nodes="teaRoom.textarea1"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 预定时间 -->
|
||||
<view class="bg-white rounded-16rpx py-26rpx px-30rpx mt-24rpx mx-30rpx" @click="showBookTimePopup = true">
|
||||
<view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">预定时间</view>
|
||||
<view class="flex items-center justify-between">
|
||||
<view class="text-[26rpx] text-[#606266] leading-36rpx">{{ sevenDay.minimum_time }}小时起订</view>
|
||||
<view class="flex items-center">
|
||||
<view class="text-[28rpx] text-[#909399] leading-40rpx w-430rpx line-1 text-right">
|
||||
<template v-if="reserveTime.length > 0">
|
||||
{{ reserveTime[0] }} {{ reserveTime[1].join(',') }}
|
||||
</template>
|
||||
<template v-else>
|
||||
请选择
|
||||
</template>
|
||||
</view>
|
||||
<view class="flex items-cenenter justify-between">
|
||||
<view class="text-[#303133] text-28rpx leading-48rpx">
|
||||
<view>
|
||||
<wd-icon name="chevron-right" size="32rpx" color="#909399"></wd-icon>
|
||||
<text class="font-bold mr-26rpx">须知</text>
|
||||
<text class="font-500">需预约</text>
|
||||
</view>
|
||||
<view class="mt-22rpx">
|
||||
<text class="font-bold mr-26rpx">保障</text>
|
||||
<text class="font-500">随时退</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 优惠券 -->
|
||||
<view class="bg-white rounded-16rpx py-26rpx px-30rpx mt-24rpx mx-30rpx" @click="Detail.handleToCoupon(CouponType.Discount)">
|
||||
<view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">优惠券</view>
|
||||
<view class="flex items-center justify-between">
|
||||
<view class="text-[26rpx] text-[#606266] leading-36rpx">优惠券</view>
|
||||
<view class="flex items-center">
|
||||
<view class="text-[28rpx] text-[#909399] leading-40rpx">
|
||||
<template v-if="selectedCoupon?.id > 0">
|
||||
{{ selectedCoupon.name }}
|
||||
</template>
|
||||
<template v-else>
|
||||
请选择
|
||||
</template>
|
||||
</view>
|
||||
<view class="mt-4rpx">
|
||||
<wd-icon name="chevron-right" size="22px" color="#909399"></wd-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 团购券 -->
|
||||
<view class="bg-white rounded-16rpx py-26rpx px-30rpx mt-24rpx mx-30rpx" @click="Detail.handleToCoupon(CouponType.GroupBuy)">
|
||||
<view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">团购券</view>
|
||||
<view class="flex items-center justify-between">
|
||||
<view class="text-[26rpx] text-[#606266] leading-36rpx">团购券</view>
|
||||
<view class="flex items-center">
|
||||
<view class="text-[28rpx] text-[#909399] leading-40rpx">
|
||||
<template v-if="selectedGroupCoupon?.id > 0">
|
||||
{{ selectedGroupCoupon.name }}
|
||||
</template>
|
||||
<template v-else>
|
||||
请选择
|
||||
</template>
|
||||
</view>
|
||||
<view class="mt-4rpx">
|
||||
<wd-icon name="chevron-right" size="22px" color="#909399"></wd-icon>
|
||||
</view>
|
||||
<view class="">
|
||||
<wd-img width="160rpx" height="120rpx" :src="detail.status == 1 ? `${OSS}icon/icon_sj.png` : `${OSS}icon/icon_xj.png`"></wd-img>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="isGroupBuying">
|
||||
<view>
|
||||
<!-- 套餐详情 -->
|
||||
<view class="bg-white rounded-16rpx py-26rpx px-30rpx mt-24rpx mx-30rpx">
|
||||
<view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">套餐详情</view>
|
||||
<view class="">
|
||||
<rich-text :nodes="teaRoomPackage.introduce_details"></rich-text>
|
||||
<view class="mt-24rpx" v-if="detail.introduce">
|
||||
<view class="flex items-center mb-20rpx">
|
||||
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_tcsm.png`"></wd-img>
|
||||
<view class="font-bold text-28rpx leading-48rpx text-[#303133] ml-6rpx">套餐介绍</view>
|
||||
</view>
|
||||
<rich-text :nodes="detail.introduce"></rich-text>
|
||||
</view>
|
||||
|
||||
<view class="mt-30rpx" v-if="detail.rests_introduce">
|
||||
<view class="flex items-center mb-20rpx">
|
||||
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_qtsm.png`"></wd-img>
|
||||
<view class="font-bold text-28rpx leading-48rpx text-[#303133] ml-6rpx"> 其他说明</view>
|
||||
</view>
|
||||
<rich-text :nodes="detail.rests_introduce"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 购买须知 -->
|
||||
<view class="bg-white rounded-16rpx py-26rpx px-30rpx mt-24rpx mx-30rpx">
|
||||
<view class="text-[#303133] text-32rpx leading-44rpx font-bold mb-24rpx">购买须知</view>
|
||||
<view class="">
|
||||
<rich-text :nodes="teaRoomPackage.buy_details"></rich-text>
|
||||
<!-- TODO 有效期暂时频闭、还未开发 -->
|
||||
<!-- <view class="mt-24rpx" v-if="detail.introduce">
|
||||
<view class="flex items-center">
|
||||
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_yxq.png`"></wd-img>
|
||||
<view class="font-bold text-28rpx leading-48rpx text-[#303133] ml-6rpx">有效期</view>
|
||||
</view>
|
||||
<rich-text :nodes="detail.introduce"></rich-text>
|
||||
</view> -->
|
||||
|
||||
<view class="mt-30rpx" v-if="detail.room_title">
|
||||
<view class="flex items-center mb-20rpx">
|
||||
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_sybj.png`"></wd-img>
|
||||
<view class="font-bold text-28rpx leading-48rpx text-[#303133] ml-6rpx">适用包间</view>
|
||||
</view>
|
||||
<rich-text :nodes="detail.room_title"></rich-text>
|
||||
</view>
|
||||
|
||||
<view class="mt-30rpx" v-if="detail.hour">
|
||||
<view class="flex items-center mb-20rpx">
|
||||
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_sysc.png`"></wd-img>
|
||||
<view class="font-bold text-28rpx leading-48rpx text-[#303133] ml-6rpx">适用时长</view>
|
||||
</view>
|
||||
<view class="">{{ detail.hour }}小时</view>
|
||||
</view>
|
||||
|
||||
<view class="mt-30rpx" v-if="detail.pl_number">
|
||||
<view class="flex items-center mb-20rpx">
|
||||
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_syrs.png`"></wd-img>
|
||||
<view class="font-bold text-28rpx leading-48rpx text-[#303133] ml-6rpx">使用人数</view>
|
||||
</view>
|
||||
<view class="">{{ detail.pl_number }}</view>
|
||||
</view>
|
||||
|
||||
<view class="mt-20rpx mb-24rpx">
|
||||
<wd-gap height="2rpx" bgColor="#F6F7F9"></wd-gap>
|
||||
</view>
|
||||
|
||||
<view class="mt-30rpx" v-if="detail.returd_details">
|
||||
<view class="flex items-center mb-20rpx">
|
||||
<wd-img width="36rpx" height="36rpx" :src="`${OSS}icon/icon_tgsm.png`"></wd-img>
|
||||
<view class="font-bold text-28rpx leading-48rpx text-[#303133] ml-6rpx">退改说明</view>
|
||||
</view>
|
||||
<rich-text :nodes="detail.returd_details"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -231,14 +129,13 @@
|
||||
import {toast} from '@/utils/toast'
|
||||
import { ReserveServiceCategory, OrderType } from '@/utils/order'
|
||||
import type { ITeaSpecialistFuture7DaysResult } from '@/api/types/tea'
|
||||
import { getNext7Days, getTeaRoomBalance, createTeaRoomOrder } from '@/api/tea-room'
|
||||
import { getTeaSpecialistOrderPackageDetail } from '@/api/order'
|
||||
import { CouponType } from '@/utils/coupon'
|
||||
import { router, toTimes, toPlus, toMinus } from '@/utils/tools'
|
||||
import type { IUserInfoVo } from '@/api/types/login'
|
||||
import { useUserStore } from '@/store'
|
||||
import { getTeaRoomDetail, createTeaRoomPackageOrder, getTeaRoomPackageDetail, calculateTeaRoomPrice } from '@/api/tea-room'
|
||||
import PriceFormat from '@/components/PriceFormat.vue'
|
||||
import BookingTime from '@/components/BookingTime.vue'
|
||||
|
||||
import { getUserInfo } from '@/api/user'
|
||||
|
||||
const OSS = inject('OSS')
|
||||
@ -251,29 +148,6 @@
|
||||
const html: string = '<p>这里是富文本内容,需要后台传递</p>'
|
||||
const isGroupBuying = ref<boolean>(false)// 是否是团购套餐
|
||||
const pay = ref<number>(1) // 支付方式
|
||||
const payList = ref<Array<any>>([
|
||||
{
|
||||
id: 1,
|
||||
name: '平台余额',
|
||||
icon: `${OSS}icon/icon_platform_balance.png`,
|
||||
balance: 0,
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '门店余额',
|
||||
icon: `${OSS}icon/icon_store_balance.png`,
|
||||
balance: 0,
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: '微信支付',
|
||||
icon: `${OSS}icon/icon_weichat.png`,
|
||||
balance: 0,
|
||||
value: 3
|
||||
}
|
||||
])
|
||||
|
||||
// 选择预定时间
|
||||
const showBookTimePopup = ref<boolean>(false)
|
||||
@ -283,64 +157,30 @@
|
||||
})
|
||||
const reserveTime = ref<Array<any>>([])
|
||||
|
||||
// 计算费用明细 service(服务费) coupon(优惠券) discount(会员优惠) totalDiscount(总优惠) total(总费用) groupCoupon(团购券)
|
||||
const bill = ref<{service: any, discount:number, totalDiscount: number, coupon: number, groupCoupon: number, total: number}>({
|
||||
service: {
|
||||
total: 0,
|
||||
unitPrice: 0,
|
||||
num: 0,
|
||||
startTime: 0,
|
||||
endTime: 0,
|
||||
dayTime: '',
|
||||
startHour: '',
|
||||
endHour: ''
|
||||
},
|
||||
discount: 0,
|
||||
totalDiscount: 0,
|
||||
coupon: 0,
|
||||
groupCoupon: 0,
|
||||
total: 0
|
||||
})
|
||||
|
||||
// 费用明细相关
|
||||
const showCostPopup = ref<boolean>(false) // 费用明细popup
|
||||
const showPayPopup = ref<boolean>(false) // 支付popup
|
||||
|
||||
// 包间内容
|
||||
const storeId = ref<number>(0) // 门店ID
|
||||
const id = ref<number>(0) // id
|
||||
const teaRoom = ref<any>({})
|
||||
const detail = ref<any>({})
|
||||
const teaRoomPrice = ref<number>(0)
|
||||
|
||||
// 门店余额
|
||||
const storeMoney = ref<number>(0)
|
||||
|
||||
// 选择的优惠券
|
||||
const selectedCoupon = ref<{id: number, name: string}>({id: 0, name: ''})
|
||||
const selectedGroupCoupon = ref<{id: number, name: string}>({id: 0, name: ''})
|
||||
|
||||
// 用户信息
|
||||
const user = ref<any>(null)
|
||||
|
||||
// 套餐
|
||||
const teaRoomPackage = ref<any>({})
|
||||
|
||||
onLoad((args) => {
|
||||
storeId.value = Number(args.storeId)
|
||||
id.value = Number(args.id)
|
||||
teaRoomPrice.value = Number(args.price) || 0
|
||||
|
||||
if (args.type == ReserveServiceCategory.GroupBuying) {
|
||||
isGroupBuying.value = true
|
||||
pay.value = 3
|
||||
// if (args.type == ReserveServiceCategory.GroupBuying) {
|
||||
// isGroupBuying.value = true
|
||||
// pay.value = 3
|
||||
Detail.handleInitGroupBuying()
|
||||
}
|
||||
Detail.handleInitReserveRoom()
|
||||
// }
|
||||
// Detail.handleInitReserveRoom()
|
||||
|
||||
// 获取用户需求详
|
||||
getUserInfo().then(res => {
|
||||
user.value = res
|
||||
})
|
||||
// getUserInfo().then(res => {
|
||||
// user.value = res
|
||||
// })
|
||||
})
|
||||
|
||||
const Detail = {
|
||||
@ -360,161 +200,17 @@
|
||||
})
|
||||
teaRoom.value = res.details
|
||||
swiperList.value = teaRoom.value.img_arr
|
||||
|
||||
// 预定时间
|
||||
const next7 = await getNext7Days()
|
||||
Object.assign(sevenDay, next7)
|
||||
|
||||
// 获取门店余额
|
||||
const balance = await getTeaRoomBalance({ store_id: storeId.value })
|
||||
storeMoney.value = balance.data.money || 0
|
||||
},
|
||||
|
||||
/*
|
||||
* 初始化套餐详情
|
||||
*/
|
||||
handleInitGroupBuying: async () => {
|
||||
const res = await getTeaRoomPackageDetail({ id: id.value })
|
||||
teaRoomPackage.value = res.details
|
||||
const res = await getTeaSpecialistOrderPackageDetail(id.value)
|
||||
swiperList.value = res.img_list
|
||||
detail.value = res
|
||||
},
|
||||
|
||||
/**
|
||||
* 选中预定时间
|
||||
*/
|
||||
handleChooseReserveTime: (params: any) => {
|
||||
reserveTime.value = params
|
||||
|
||||
bill.value.service = {
|
||||
total: 0,
|
||||
unitPrice: 0,
|
||||
num: params[3],
|
||||
startTime: params[2][0],
|
||||
endTime: params[2][params[2].length - 1],
|
||||
dayTime: params[0],
|
||||
startHour: params[1][0],
|
||||
endHour: params[1][params[1].length - 1]
|
||||
}
|
||||
|
||||
Detail.handleCalculateTeaRoomPrice()
|
||||
},
|
||||
|
||||
/**
|
||||
* 跳转优惠券页面
|
||||
*/
|
||||
handleToCoupon(type) {
|
||||
if (reserveTime.value.length == 0) {
|
||||
toast.info('请选择预定时间')
|
||||
return
|
||||
}
|
||||
uni.$on('chooseCoupon', params => {
|
||||
console.log("🚀 ~ params:", params)
|
||||
uni.$off('chooseCoupon')
|
||||
|
||||
if (type === CouponType.Discount) {
|
||||
selectedCoupon.value = {id: params.coupon.user_coupon_id, name: `${params.coupon.name}减${params.coupon.coupon_price}` }
|
||||
bill.value.coupon = params.coupon.coupon_price
|
||||
} else {
|
||||
selectedGroupCoupon.value = {id: params.coupon.id, name: `团购券-${params.coupon.tea_store_group.title}` }
|
||||
bill.value.groupCoupon = params.coupon.coupon_price
|
||||
}
|
||||
|
||||
Detail.handleCalculateTeaRoomPrice()
|
||||
})
|
||||
|
||||
// 获取预定了几个小时
|
||||
const count = bill.value.service.num
|
||||
router.navigateTo(`/bundle/coupon/coupon?id=${id.value}&numbers=${count}&type=${type}&storeId=${storeId.value}`)
|
||||
},
|
||||
|
||||
// 选择支付方式
|
||||
handleGetPayValue: (value: number) => {
|
||||
pay.value = value
|
||||
},
|
||||
|
||||
/**
|
||||
* 提交订单
|
||||
*/
|
||||
handleSubmitOrder: async () => {
|
||||
// 只有预定茶室才会选择时间
|
||||
if (!isGroupBuying.value && bill.value.service.num == 0) {
|
||||
toast.info('请选择预定时间')
|
||||
return
|
||||
}
|
||||
|
||||
uni.showLoading({
|
||||
title: '提交中...'
|
||||
})
|
||||
|
||||
try {
|
||||
let res: any = null
|
||||
if (isGroupBuying.value) {
|
||||
res = await createTeaRoomPackageOrder({
|
||||
group_id: id.value
|
||||
})
|
||||
} else {
|
||||
res = await createTeaRoomOrder({
|
||||
store_id: storeId.value,
|
||||
room_id: id.value,
|
||||
day_time: bill.value.service.dayTime,
|
||||
start_time: bill.value.service.startHour,
|
||||
end_time: bill.value.service.endHour,
|
||||
user_coupon_id: selectedCoupon.value.id || 0,
|
||||
hours: bill.value.service.num,
|
||||
group_coupon_id: selectedGroupCoupon.value.id || 0
|
||||
})
|
||||
}
|
||||
|
||||
uni.hideLoading()
|
||||
|
||||
// 支付后的处理
|
||||
uni.$on('payment', params => {
|
||||
setTimeout(() => {
|
||||
uni.$off("payment")
|
||||
if (params.result) {
|
||||
uni.redirectTo({
|
||||
url: `/pages/notice/reserve?type=${OrderType.TeaRoomOrder}&orderId=${params.orderId}&isGroupBuying=${isGroupBuying.value ? 1 : 0}`
|
||||
})
|
||||
} else {
|
||||
if (isGroupBuying.value) {
|
||||
router.redirectTo(`/bundle/order/platform/order-list`)
|
||||
} else {
|
||||
router.redirectTo(`/bundle/order/tea-room/order-list?isGroupBuying=${isGroupBuying.value ? 1 : 0}`)
|
||||
}
|
||||
}
|
||||
}, 1000)
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
const name = isGroupBuying.value ? teaRoomPackage.value.title : teaRoom.value.name
|
||||
|
||||
router.navigateTo(
|
||||
`/pages/cashier/cashier?from=${OrderType.TeaRoomOrder}&orderId=${res.id}&name=${name}&storeId=${storeId.value}&isGroupBuying=${isGroupBuying.value ? 1 : 0}`
|
||||
)
|
||||
}, 800)
|
||||
} catch (error) {
|
||||
uni.hideLoading()
|
||||
toast.info('订单提交失败,请稍后重试')
|
||||
return
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 计算茶室价格
|
||||
*/
|
||||
handleCalculateTeaRoomPrice: async () => {
|
||||
const res = await calculateTeaRoomPrice({
|
||||
room_id: id.value,
|
||||
coupon_id: selectedCoupon.value.id || 0,
|
||||
group_coupon_id: selectedGroupCoupon.value.id,
|
||||
nums: bill.value.service.num,
|
||||
})
|
||||
|
||||
bill.value.service.total = res.details.room_price // 茶室价格
|
||||
bill.value.discount = res.details.discount_room_price // 茶室总价
|
||||
bill.value.totalDiscount = res.details.discount_all_price // 总优惠
|
||||
bill.value.groupCoupon = res.details.group_price // 团购优惠
|
||||
bill.value.total = res.details.order_amount // 订单金额
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@ -15,24 +15,24 @@
|
||||
<wd-icon name="thin-arrow-left" size="30rpx"></wd-icon>
|
||||
</view>
|
||||
<view class="search-box">
|
||||
<wd-search v-model="keywords" hide-cancel placeholder-left light placeholder="搜索套餐名称" @search="OrderList.handleSearch()"></wd-search>
|
||||
<wd-search v-model="keywords" hide-cancel placeholder-left light placeholder="搜索套餐名称" @search="Setmeal.handleSearch()"></wd-search>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</wd-navbar>
|
||||
<view class="tabs">
|
||||
<wd-tabs v-model="tab" swipeable slidable="always" :lazy="false" @click="OrderList.handleChangeTabs">
|
||||
<wd-tabs v-model="tab" swipeable slidable="always" :lazy="false" @click="Setmeal.handleChangeTabs">
|
||||
<wd-tab :title="item.title + `(${item.num})`" :name="item.name" v-for="(item, index) in tabList" :key="index"></wd-tab>
|
||||
</wd-tabs>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="tabs mt-18rpx mx-30rpx">
|
||||
<!-- <mescroll-body ref="mescrollItem0" @init="mescrollInit" @down="downCallback" @up="OrderList.upCallback" :down="downOption" :up="upOption"> -->
|
||||
<view class="mb-20rpx" v-for="(item, index) in 10" :key="index">
|
||||
<combo-card :type="OrderSource.SetMeal" :order="item"></combo-card>
|
||||
<mescroll-body ref="mescrollItem0" @init="mescrollInit" @down="downCallback" @up="Setmeal.upCallback" :down="downOption" :up="upOption">
|
||||
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
|
||||
<combo-card :type="OrderSource.SetMeal" :order="item" @refresh="Setmeal.handleSearch"></combo-card>
|
||||
</view>
|
||||
<!-- </mescroll-body> -->
|
||||
</mescroll-body>
|
||||
</view>
|
||||
|
||||
<view class="w-full fixed bottom-0 left-0 right-0 bg-white h-152rpx">
|
||||
@ -45,11 +45,11 @@
|
||||
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { OrderSource, OrderStatus, TeaRoomOrderStatusText, TeaRoomOrderStatusValue } from '@/utils/order'
|
||||
import { OrderSource } from '@/utils/order'
|
||||
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 { getTeaRoomOrderList } from '@/api/tea-room'
|
||||
import { getTeaSpecialistOrderPackageList } from '@/api/order'
|
||||
import { router } from '@/utils/tools'
|
||||
|
||||
// mescroll
|
||||
@ -61,16 +61,15 @@
|
||||
auto: true,
|
||||
textNoMore: '~ 已经到底啦 ~', //无更多数据的提示
|
||||
}
|
||||
const orderStatus = ref<string>('')
|
||||
const list = ref<Array<any>>([]) // 茶室列表
|
||||
const keywords = ref<string>('') // 搜索关键词
|
||||
|
||||
// tab
|
||||
const tab = ref<string>('list')
|
||||
const tabList = ref<Array<{title: string, num: number, name: string}>>([
|
||||
{ title: '已上架', num: 10, name: 'list'},
|
||||
{ title: '已下架', num: 11, name: 'delist' },
|
||||
// { title: '草稿箱', num: 0, name: 'draft' }
|
||||
const tab = ref<number>(1)
|
||||
const tabList = ref<Array<{title: string, num: number, name: number}>>([
|
||||
{ title: '已上架', num: 0, name: 1},
|
||||
{ title: '已下架', num: 0, name: 0},
|
||||
// { title: '草稿箱', num: 0, name: 2 }
|
||||
])
|
||||
|
||||
onLoad((args) => {
|
||||
@ -78,64 +77,60 @@
|
||||
list.value = []
|
||||
getMescroll().resetUpScroll()
|
||||
})
|
||||
|
||||
// 根据传过来的参数决定显示哪个tab
|
||||
if (args.orderStatus) {
|
||||
tab.value = args.orderStatus
|
||||
}
|
||||
})
|
||||
|
||||
onUnload(() => {
|
||||
uni.$off('refreshOrderList')
|
||||
})
|
||||
|
||||
const OrderList = {
|
||||
const Setmeal = {
|
||||
/**
|
||||
* 分页加载
|
||||
* @param mescroll
|
||||
*/
|
||||
upCallback: (mescroll) => {
|
||||
// 需要留一下数据为空的时候显示的空数据图标内容
|
||||
// const filter = {
|
||||
// page: mescroll.num,
|
||||
// size: mescroll.size,
|
||||
// order_status: orderStatus.value,
|
||||
// search: keywords.value
|
||||
// }
|
||||
const filter = {
|
||||
page: mescroll.num,
|
||||
size: mescroll.size,
|
||||
status: tab.value,
|
||||
search: keywords.value,
|
||||
}
|
||||
|
||||
// getTeaRoomOrderList(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(() => {
|
||||
getTeaSpecialistOrderPackageList(filter).then((res) => {
|
||||
tabList.value[0].num = res.online || 0
|
||||
tabList.value[1].num = res.offline || 0
|
||||
// tabList.value[2].num = res.draft || 0
|
||||
|
||||
const curPageData = res.list || [] // 当前页数据
|
||||
console.log("🚀 ~ curPageData:", curPageData)
|
||||
if(mescroll.num == 1) list.value = [] // 第一页需手动制空列表
|
||||
list.value = list.value.concat(curPageData) //追加新数据
|
||||
mescroll.endSuccess(curPageData.length, Boolean(res.more))
|
||||
console.log("🚀 ~ res.more:", res.more)
|
||||
}).catch(() => {
|
||||
mescroll.endErr() // 请求失败, 结束加载
|
||||
// })
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 切换订单状态
|
||||
* @param e
|
||||
*/
|
||||
handleChangeTabs: (e: {index: number, name: string}) => {
|
||||
// tab.value = e.name
|
||||
// if (e.name === TeaRoomOrderStatusText.Pending) {
|
||||
// orderStatus.value = '0'
|
||||
// } else {
|
||||
// orderStatus.value = TeaRoomOrderStatusValue[e.name] || ''
|
||||
// }
|
||||
handleChangeTabs: (e: {index: number, name: number}) => {
|
||||
tab.value = e.name
|
||||
|
||||
// // 切换tab时,重置当前的mescroll
|
||||
// list.value = []
|
||||
// getMescroll().resetUpScroll();
|
||||
// 切换tab时,重置当前的mescroll
|
||||
list.value = []
|
||||
getMescroll().resetUpScroll();
|
||||
},
|
||||
|
||||
/**
|
||||
* 内容搜索
|
||||
*/
|
||||
handleSearch: () => {
|
||||
// list.value = []
|
||||
// getMescroll().resetUpScroll();
|
||||
list.value = []
|
||||
getMescroll().resetUpScroll();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -124,7 +124,6 @@
|
||||
const token = ref<string>('') // 用户token
|
||||
|
||||
// 上传文件
|
||||
// const fileList = ref<any[]>([])
|
||||
const fileList = ref<any[]>([])
|
||||
const action = import.meta.env.VITE_UPLOAD_BASEURL
|
||||
|
||||
@ -313,7 +312,6 @@
|
||||
toast.info('保存失败,请稍后重试')
|
||||
return
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user