调试接口
This commit is contained in:
@ -18,7 +18,8 @@
|
||||
<view class="coupon-tab">
|
||||
<wd-tabs v-model="tab" swipeable slidable="always" @click="Collect.handleChangeTab" :lazy="false">
|
||||
<wd-tab title="茶室"></wd-tab>
|
||||
<wd-tab title="茶艺师"></wd-tab>
|
||||
<!-- TODO 茶艺师内容先隐藏 -->
|
||||
<!-- <wd-tab title="茶艺师"></wd-tab> -->
|
||||
</wd-tabs>
|
||||
|
||||
<view class="">
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
showChecked
|
||||
:checked="item.id === checkedId"
|
||||
:onCheck="Coupons.handleCheck"
|
||||
couponType="coupon"
|
||||
:class="index !== couponList.use.length - 1 ? 'mb-20rpx' : ''"
|
||||
></coupon>
|
||||
</wd-radio-group>
|
||||
@ -51,6 +52,7 @@
|
||||
:coupon="item"
|
||||
:canUse="false"
|
||||
showChecked
|
||||
couponType="coupon"
|
||||
:checked="item.id === checkedId"
|
||||
:onCheck="Coupons.handleCheck"
|
||||
:class="index !== couponList.no_use.length - 1 ? 'mb-20rpx' : ''"
|
||||
@ -65,7 +67,7 @@
|
||||
<view class="mx-30rpx">
|
||||
<view class="mx30rpx">
|
||||
<text class="text-[#303133] font-bold text-30rpx leading-42rpx">可用团购券</text>
|
||||
<text class="text-[#606266] font-400 text-28rpx leading-40rpx ml-24rpx">2张</text>
|
||||
<text class="text-[#606266] font-400 text-28rpx leading-40rpx ml-24rpx">{{ groupCouponList.length }}张</text>
|
||||
</view>
|
||||
<view class="mt-28rpx radio">
|
||||
<wd-radio-group v-model="checkedId" size="large" checked-color="#4C9F44">
|
||||
@ -74,6 +76,7 @@
|
||||
:key="item.id"
|
||||
:coupon="item"
|
||||
canUse
|
||||
couponType="groupCoupon"
|
||||
:checked="item.id === checkedId"
|
||||
:onCheck="Coupons.handleCheck"
|
||||
:class="index !== groupCouponList.length - 1 ? 'mb-20rpx' : ''"
|
||||
@ -128,7 +131,7 @@
|
||||
no_use: [],
|
||||
use: []
|
||||
})
|
||||
const groupCouponList = ref<any>()
|
||||
const groupCouponList = ref<Array<any>>([])
|
||||
const checkedId = ref<number>(0)
|
||||
|
||||
const unCouponList = ref([
|
||||
@ -141,6 +144,7 @@
|
||||
|
||||
onLoad((args) => {
|
||||
teaRoomId.value = args.id
|
||||
console.log("🚀 ~ teaRoomId.value:", teaRoomId.value)
|
||||
storeId.value = args.storeId || 0
|
||||
couponType.value = args.type // 1:优惠券 2:团购券
|
||||
|
||||
@ -168,7 +172,9 @@
|
||||
* 初始化团购券列表
|
||||
*/
|
||||
handleInitGroupCoupon: async (id: number, numbers: number) => {
|
||||
const res = await getTeaRoomGroupCouponList({store_id: storeId.value})
|
||||
console.log("🚀 ~ teaRoomId.value2:", teaRoomId.value)
|
||||
|
||||
const res = await getTeaRoomGroupCouponList({store_id: storeId.value, room_id: teaRoomId.value})
|
||||
groupCouponList.value = res.list
|
||||
},
|
||||
|
||||
|
||||
@ -342,6 +342,7 @@
|
||||
|
||||
// 团购套餐
|
||||
const comboOrder = ref<ITeaRoomPackageOrderDetailsResult>({
|
||||
id: 0,
|
||||
pay: 0,
|
||||
pay_way_title: '',
|
||||
order_amount: '',
|
||||
@ -366,6 +367,11 @@
|
||||
store_id: 0,
|
||||
distance: '',
|
||||
operation_type: 1
|
||||
},
|
||||
user_group: {
|
||||
qr_url: '',
|
||||
qr_sn: '',
|
||||
status: 0
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@ -15,26 +15,27 @@
|
||||
</view>
|
||||
|
||||
<view class="text-[#909399] text-26rpx leading-36rpx mx-102rpx mb-40rpx">
|
||||
<text v-if="orderStatus === OrderStatus.ToUse">请在2025.12.31(含)前使用</text>
|
||||
<text v-if="orderStatus === OrderStatus.Used">品一口香茗,让生活慢下来,从一杯好茶开始</text>
|
||||
<!-- TODO 暂时不做 -->
|
||||
<!-- <text v-if="orderStatus === OrderStatus.ToUse">请在2025.12.31(含)前使用</text> -->
|
||||
<text v-if="orderStatus === DouYinOrderStatus.Used">品一口香茗,让生活慢下来,从一杯好茶开始</text>
|
||||
</view>
|
||||
|
||||
<!-- 待使用下显示 -->
|
||||
<view class="mx-30rpx bg-white rounded-16rpx p-30rpx">
|
||||
<view class="flex items-center">
|
||||
<view class="mr-30rpx">
|
||||
<wd-img width="190rpx" height="190rpx" :src="`${OSS}images/home/home_image5.png`" mode="scaleToFill"></wd-img>
|
||||
<wd-img width="190rpx" height="190rpx" :src="order.group.img" mode="scaleToFill"></wd-img>
|
||||
</view>
|
||||
<view class="flex-1">
|
||||
<view class="flex justify-between items-center">
|
||||
<view class="font-bold text-30rpx leading-42rpx text-[#303133] mr-10rpx w-300rpx line-1">这是团购套餐的名字</view>
|
||||
<view class="text-26rpx leading-36rpx text-[#909399] mt-8rpx">¥324</view>
|
||||
<view class="font-bold text-30rpx leading-42rpx text-[#303133] mr-10rpx w-300rpx line-1">{{ order.group.title }}</view>
|
||||
<view class="text-26rpx leading-36rpx text-[#909399] mt-8rpx">¥{{ order.group.price }}</view>
|
||||
</view>
|
||||
<view class="flex justify-between items-center text-26rpx leading-36rpx text-[#909399] mt-18rpx">
|
||||
3小时
|
||||
{{ order.group.hour }}小时
|
||||
</view>
|
||||
<view class="font-400 text-26rpx text-[#606266] leading-40rpx mt-40rpx">
|
||||
适用包间:青茶、红茶、绿茶
|
||||
适用包间:{{ order.room_name }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -45,24 +46,24 @@
|
||||
<view class="pt-32rpx text-[#303133] text-32rpx leading-44rpx">适用门店</view>
|
||||
<view class="mt-26rpx flex items-center">
|
||||
<view class="mr-24rpx">
|
||||
<wd-img width="170rpx" height="170rpx" :src="`${OSS}images/home/home_image5.png`"></wd-img>
|
||||
<wd-img width="170rpx" height="170rpx" :src="order.store.image"></wd-img>
|
||||
</view>
|
||||
<view class="flex-1 flex justify-between items-center relative">
|
||||
<view class="">
|
||||
<view class="text-[#303133] text-30rpx leading-40rpx line-2">这是商家的名称这是</view>
|
||||
<view class="mt-26rpx text-[#909399] text-24rpx leading-34rpx">距您9km</view>
|
||||
<view class="text-[#303133] text-30rpx leading-40rpx line-2">{{ order.store.name }}</view>
|
||||
<view class="mt-26rpx text-[#909399] text-24rpx leading-34rpx">距您{{ order.store.distance }}km</view>
|
||||
<view class="flex items-center mt-14rpx">
|
||||
<view class="mr-8rpx">
|
||||
<wd-img width="28rpx" height="28rpx" :src="`${OSS}icon/icon_location.png`"/>
|
||||
</view>
|
||||
<view class="ml-2rpx text-26rpx text-[#606266] line-1 w-300rpx">青浦区仓路478号青浦区仓路478号青浦区仓路478号青浦区仓路478号青浦区仓路478号青浦区仓路478号</view>
|
||||
<view class="ml-2rpx text-26rpx text-[#606266] line-1 w-300rpx">{{ order.store.address }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex absolute top-1/2 right-0 -translate-y-1/2">
|
||||
<view class="text-center mr-20rpx" @click="douyinOrderDetail.handleLocation">
|
||||
<view class="text-center mr-20rpx" @click="DouYinOrderDetail.handleLocation">
|
||||
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_nav.png`"/>
|
||||
</view>
|
||||
<view class="text-center" @click="douyinOrderDetail.handleCallPhone">
|
||||
<view class="text-center" @click="DouYinOrderDetail.handleCallPhone">
|
||||
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_phone.png`"/>
|
||||
</view>
|
||||
</view>
|
||||
@ -76,48 +77,64 @@
|
||||
<view class="text-28rpx leading-40rpx text-[#606266] flex items-center justify-between mt-22rpx">
|
||||
<view>订单编号</view>
|
||||
<view>
|
||||
<text>7327328627526903</text>
|
||||
<text>{{ order.order_sn }}</text>
|
||||
<wd-divider vertical />
|
||||
<text class="text-[#4C9F44]">复制</text>
|
||||
<text class="text-[#4C9F44]" @click="copy(order.order_sn)">复制</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="text-28rpx leading-40rpx text-[#606266] flex items-center justify-between mt-22rpx">
|
||||
<view>创建时间</view>
|
||||
<view>2019-05-16 12:20:26</view>
|
||||
<view>{{ order.dtime }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<view class="w-full fixed bottom-0 left-0 right-0 bg-white h-152rpx" v-if="orderStatus !== OrderStatus.Used">
|
||||
<view class="mt-34rpx">
|
||||
<!-- 待使用 -->
|
||||
<view class="text-32rpx leading-44rpx flex items-center justify-center leading-90rpx text-center" v-if="orderStatus === OrderStatus.ToUse">
|
||||
<view class="w-692rpx h-90rpx bg-[#4C9F44] rounded-8rpx text-[#fff]">立即预定</view>
|
||||
</view>
|
||||
<view class="w-full fixed bottom-0 left-0 right-0 bg-white h-152rpx" v-if="orderStatus !== DouYinOrderStatus.Used">
|
||||
<!-- 待使用 -->
|
||||
<view class="text-32rpx leading-44rpx flex items-center justify-center leading-90rpx text-center pt-34rpx" >
|
||||
<view class="w-692rpx h-90rpx bg-[#4C9F44] rounded-8rpx text-[#fff]">立即预定</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { OrderSource, OrderStatus, OrderStatusTitle } from '@/utils/order'
|
||||
console.log("🚀 ~ OrderStatusTitle:", OrderStatusTitle)
|
||||
import {toast} from '@/utils/toast'
|
||||
import { OrderSource, OrderStatus, OrderStatusTitle, DouYinOrderStatus, DouYinOrderStatusTextValue } from '@/utils/order'
|
||||
import { toast } from '@/utils/toast'
|
||||
import { getTeaRoomPackageOrderDetail } from '@/api/tea-room'
|
||||
import { router, copy } from '@/utils/tools'
|
||||
|
||||
const OSS = inject('OSS')
|
||||
|
||||
const title = ref<string>('')
|
||||
const type = ref<string>('') // 订单类型:团购、抖音等
|
||||
const orderStatus = ref<string>('') // 订单状态:待使用、退款等
|
||||
|
||||
// 订单
|
||||
const orderId = ref<number>(0)
|
||||
const orderStatus = ref<number>(0) // 订单状态:待使用、退款等
|
||||
const order = ref<any>({})
|
||||
|
||||
onLoad((args) => {
|
||||
title.value = OrderStatusTitle[OrderSource.DouYin][args.orderStatus] || '订单详情'
|
||||
|
||||
type.value = args.type
|
||||
orderStatus.value = args.orderStatus
|
||||
orderId.value = args.orderId
|
||||
DouYinOrderDetail.handleInit()
|
||||
})
|
||||
|
||||
const douyinOrderDetail = {
|
||||
const DouYinOrderDetail = {
|
||||
/**
|
||||
* 获取订单详情
|
||||
*/
|
||||
handleInit: async () => {
|
||||
const res = await getTeaRoomPackageOrderDetail({
|
||||
id: orderId.value,
|
||||
latitude: uni.getStorageSync('latitude'),
|
||||
longitude: uni.getStorageSync('longitude')
|
||||
})
|
||||
order.value = res.details
|
||||
title.value = DouYinOrderStatusTextValue[order.value.user_group.status].title || '订单详情'
|
||||
orderStatus.value = order.value.user_group.status
|
||||
},
|
||||
|
||||
// 跳转到套餐详情
|
||||
handleToCombo: () => {
|
||||
|
||||
@ -130,16 +147,20 @@
|
||||
|
||||
// 处理导航逻辑
|
||||
handleLocation: () => {
|
||||
toast.info('正在导航...')
|
||||
// 可以使用uni.navigateTo或其他方式打开地图应用
|
||||
uni.navigateTo({
|
||||
url: '/pages/map/map' // 假设有一个地图页面
|
||||
uni.openLocation({
|
||||
latitude: Number(order.value.store.latitude),
|
||||
longitude: Number(order.value.store.longitude),
|
||||
name: order.value.store.name,
|
||||
address: order.value.store.address,
|
||||
scale: 18
|
||||
})
|
||||
},
|
||||
|
||||
// 处理拨打电话逻辑
|
||||
handleCallPhone: () => {
|
||||
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: order.value.store.contact_phone
|
||||
})
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -44,12 +44,12 @@
|
||||
</view>
|
||||
|
||||
<!-- 间隔线 -->
|
||||
<view>
|
||||
<!-- <view>
|
||||
<wd-gap bg-color="#F4F5F6" height="20rpx"></wd-gap>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<!-- 兑换记录 -->
|
||||
<view class="px-30rpx">
|
||||
<!-- <view class="px-30rpx">
|
||||
<view class="text-32rpx text-[#303133] leading-144rpx h-144rpx border-b-2rpx border-b-solid border-b-[#E5E5E5]">兑换记录</view>
|
||||
<view class="w-full">
|
||||
<view class="h-144rpx border-b-2rpx border-b-solid border-b-[#E5E5E5] flex justify-between items-center" v-for="(item, index) in 3" :key="index">
|
||||
@ -60,7 +60,7 @@
|
||||
<view class="font-bold text-36rpx text-[#303133] leading-50rpx">¥129</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<wd-message-box selector="wd-message-box-slot"></wd-message-box>
|
||||
</view>
|
||||
@ -91,13 +91,13 @@
|
||||
uni.scanCode({
|
||||
success: async (res) => {
|
||||
console.log("🚀 ~ res:", res)
|
||||
if(res.result) {
|
||||
code.value = res.result
|
||||
if(res.rawData) {
|
||||
code.value = res.rawData
|
||||
uni.showLoading({ title: '兑换中...' })
|
||||
try {
|
||||
const params = {
|
||||
store_id: storeId.value,
|
||||
code: res.result.replace(/\s+/g, ''),
|
||||
code: res.rawData.replace(/\s+/g, ''),
|
||||
type: 1
|
||||
}
|
||||
|
||||
|
||||
@ -84,7 +84,8 @@
|
||||
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, DouYinOrderStatusText } from '@/utils/order'
|
||||
import { OrderSource, DouYinOrderStatusText, DouYinOrderStatusValue } from '@/utils/order'
|
||||
import { getTeaRoomPackageOrderList } from '@/api/tea-room'
|
||||
|
||||
|
||||
/* mescroll */
|
||||
@ -107,47 +108,26 @@
|
||||
const tab = ref<string>('all')
|
||||
|
||||
const OrderList = {
|
||||
// 上拉加载的回调: 其中num:当前页 从1开始, size:每页数据条数,默认10
|
||||
upCallback: (mescroll) => {
|
||||
// 需要留一下数据为空的时候显示的空数据图标内容
|
||||
// list({
|
||||
// page: mescroll.num,
|
||||
// size: mescroll.size
|
||||
// }).then((res: { list: Array<any>, totalPages: Number }) => {
|
||||
// const curPageData = res.list || [] // 当前页数据
|
||||
// if(mescroll.num == 1) goods.value = []; // 第一页需手动制空列表
|
||||
// goods.value = goods.value.concat(curPageData); //追加新数据
|
||||
|
||||
// console.log("🚀 ~ goods:", goods)
|
||||
|
||||
// mescroll.endByPage(curPageData.length, res.totalPages); //必传参数(当前页的数据个数, 总页数)
|
||||
|
||||
// }).catch(() => {
|
||||
// mescroll.endErr(); // 请求失败, 结束加载
|
||||
// })
|
||||
// apiGoods(mescroll.num, mescroll.size).then(res=>{
|
||||
// const curPageData = res.list || [] // 当前页数据
|
||||
// if(mescroll.num == 1) goods.value = []; // 第一页需手动制空列表
|
||||
// goods.value = goods.value.concat(curPageData); //追加新数据
|
||||
// //联网成功的回调,隐藏下拉刷新和上拉加载的状态;
|
||||
// //mescroll会根据传的参数,自动判断列表如果无任何数据,则提示空;列表无下一页数据,则提示无更多数据;
|
||||
|
||||
// //方法一(推荐): 后台接口有返回列表的总页数 totalPage
|
||||
// //mescroll.endByPage(curPageData.length, totalPage); //必传参数(当前页的数据个数, 总页数)
|
||||
|
||||
// //方法二(推荐): 后台接口有返回列表的总数据量 totalSize
|
||||
// //mescroll.endBySize(curPageData.length, totalSize); //必传参数(当前页的数据个数, 总数据量)
|
||||
|
||||
// //方法三(推荐): 您有其他方式知道是否有下一页 hasNext
|
||||
// //mescroll.endSuccess(curPageData.length, hasNext); //必传参数(当前页的数据个数, 是否有下一页true/false)
|
||||
|
||||
// //方法四 (不推荐),会存在一个小问题:比如列表共有20条数据,每页加载10条,共2页.如果只根据当前页的数据个数判断,则需翻到第三页才会知道无更多数据.
|
||||
// mescroll.endSuccess(curPageData.length); // 请求成功, 结束加载
|
||||
// }).catch(()=>{
|
||||
mescroll.endErr(); // 请求失败, 结束加载
|
||||
// })
|
||||
upCallback: (mescroll) => {
|
||||
const filter = {
|
||||
page: mescroll.num,
|
||||
size: mescroll.size,
|
||||
operation_type: currentType.value,
|
||||
use_status: orderStatus.value,
|
||||
search: keywords.value,
|
||||
type: 2 // 1:本地套餐 2.抖音套餐
|
||||
}
|
||||
getTeaRoomPackageOrderList(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() // 请求失败, 结束加载
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
// 去兑换
|
||||
handleToExcharge: () => {
|
||||
uni.navigateTo({
|
||||
@ -164,10 +144,10 @@
|
||||
// 切换tab
|
||||
handleChangeTabs: (e: {index: number, name: string}) => {
|
||||
tab.value = e.name
|
||||
if (e.name === TeaRoomOrderStatusText.Pending) {
|
||||
if (e.name === DouYinOrderStatusText.ToUse) {
|
||||
orderStatus.value = '0'
|
||||
} else {
|
||||
orderStatus.value = TeaRoomOrderStatusValue[e.name] || ''
|
||||
orderStatus.value = DouYinOrderStatusValue[e.name] || ''
|
||||
}
|
||||
|
||||
// 切换tab时,重置当前的mescroll
|
||||
|
||||
@ -9,14 +9,18 @@
|
||||
|
||||
<template>
|
||||
<view class="pb-254rpx">
|
||||
<!-- 申请退款 -->
|
||||
<wd-message-box selector="wd-message-box-slot"></wd-message-box>
|
||||
|
||||
<view>
|
||||
<navbar :title="title" custom-class='!bg-[#F6F7F8]'></navbar>
|
||||
</view>
|
||||
|
||||
<view class="text-[#909399] text-26rpx leading-36rpx mx-102rpx mb-40rpx">
|
||||
<!-- <text v-if="orderStatus === OrderStatus.ToUse">请在2025.12.31(含)前使用</text> -->
|
||||
<text v-if="orderStatus === TeaRoomPackageOrderStatus.Used">感谢购买,期待再次光临!</text>
|
||||
<view v-if="orderStatus === TeaRoomPackageOrderStatus.Refunded" class="text-center mt-14rpx">
|
||||
<!-- TODO 暂时隐藏 -->
|
||||
<!-- <text v-if="orderStatus === GroupComboOrderStatus.ToUse">请在2025.12.31(含)前使用</text> -->
|
||||
<text v-if="orderStatus === GroupComboOrderStatus.Used">感谢购买,期待再次光临!</text>
|
||||
<view v-if="orderStatus === GroupComboOrderStatus.Refunded" class="text-center mt-14rpx">
|
||||
<view class="text-40rpx text-[#303133] leading-56rpx">
|
||||
<view>退款成功{{ order.order_amount }}</view>
|
||||
</view>
|
||||
@ -27,7 +31,7 @@
|
||||
|
||||
<view class="">
|
||||
<!-- 待使用下显示 -->
|
||||
<view class="mx-30rpx" v-if="orderStatus === TeaRoomPackageOrderStatus.ToUse">
|
||||
<view class="mx-30rpx" v-if="orderStatus === GroupComboOrderStatus.ToUse">
|
||||
<view class="bg-white rounded-16rpx p-30rpx">
|
||||
<view class="flex items-center">
|
||||
<view class="mr-30rpx">
|
||||
@ -51,10 +55,11 @@
|
||||
</view>
|
||||
<!-- 平台团购直营店待使用 -->
|
||||
<view class="mt-30rpx font-500 leading-48rpx" v-if="order.store.operation_type === StoreType.Direct">
|
||||
<!-- TODO 暂时隐藏 -->
|
||||
<!-- <view class="text-26rpx text-[#606266]">有效期:2025.04.04-2025.12.31</view> -->
|
||||
<view class="text-28rpx text-[#303133] mt-18rpx">
|
||||
<text class="mr-20rpx">券码 {{ order.coupon_code }}</text>
|
||||
<text class="text-[#4C9F44]" @click="copy(order.coupon_code)">复制</text>
|
||||
<text class="mr-20rpx">券码 {{ order.user_group.qr_sn }}</text>
|
||||
<text class="text-[#4C9F44]" @click="copy(order.user_group.qr_sn)">复制</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -62,18 +67,18 @@
|
||||
<view class="mt-30rpx font-500 leading-48rpx" v-if="order.store.operation_type === StoreType.Franchise">
|
||||
<view class="px-30rpx mt-60rpx">
|
||||
<view class="text-center">
|
||||
<wd-img width="230rpx" height="230rpx" :src="order.coupon_code_img"></wd-img>
|
||||
<wd-img width="230rpx" height="230rpx" :src="order.user_group.qr_url"></wd-img>
|
||||
</view>
|
||||
<view class="text-28rpx text-[#303133] mt-32rpx text-center">
|
||||
<text class="mr-20rpx">券码 {{ order.coupon_code }}</text>
|
||||
<text class="text-[#4C9F44]" @click="copy(order.coupon_code)">复制</text>
|
||||
<text class="mr-20rpx">券码 {{ order.user_group.qr_sn }}</text>
|
||||
<text class="text-[#4C9F44]" @click="copy(order.user_group.qr_sn)">复制</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 已使用下显示 -->
|
||||
<view class="mx-30rpx coupon-bg" v-if="orderStatus === TeaRoomPackageOrderStatus.Used">
|
||||
<view class="mx-30rpx coupon-bg" v-if="orderStatus === GroupComboOrderStatus.Used">
|
||||
<view class="flex items-center px-30rpx pt-30rpx pb-40rpx">
|
||||
<view class="mr-30rpx">
|
||||
<wd-img width="190rpx" height="190rpx" :src="`${OSS}images/home/home_image5.png`" mode="scaleToFill"></wd-img>
|
||||
@ -133,7 +138,7 @@
|
||||
</view>
|
||||
<view class="text-28rpx leading-40rpx text-[#606266] flex items-center justify-between mt-22rpx">
|
||||
<view>付款时间</view>
|
||||
<view>{{ order.pay_dtime }}</view>
|
||||
<view>{{ order.update_dtime }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -142,32 +147,32 @@
|
||||
<!-- 直营店 -->
|
||||
<view class="mt-34rpx" v-if="order.store.operation_type == StoreType.Direct">
|
||||
<!-- 待使用 -->
|
||||
<view class="text-32rpx leading-44rpx flex items-center justify-center leading-90rpx text-center" v-if="orderStatus === TeaRoomPackageOrderStatus.ToUse">
|
||||
<view class="text-32rpx leading-44rpx flex items-center justify-center leading-90rpx text-center" v-if="orderStatus === GroupComboOrderStatus.ToUse">
|
||||
<view class="w-330rpx h-90rpx bg-[#F6F7F8] rounded-8rpx text-[#303133] mr-30rpx" @click="OrderDetail.handleToRefund">申请退款</view>
|
||||
<view class="w-330rpx h-90rpx bg-[#4C9F44] rounded-8rpx text-[#fff]" @click="OrderDetail.handleUsePackage">立即预定</view>
|
||||
</view>
|
||||
|
||||
<!-- 已使用 -->
|
||||
<view class="text-32rpx leading-44rpx flex items-center justify-center leading-90rpx text-center" v-if="orderStatus === TeaRoomPackageOrderStatus.Used">
|
||||
<view class="w-630rpx h-90rpx bg-[#4C9F44] rounded-8rpx text-[#fff]">再次预定</view>
|
||||
<view class="text-32rpx leading-44rpx flex items-center justify-center leading-90rpx text-center" v-if="orderStatus === GroupComboOrderStatus.Used">
|
||||
<view class="w-630rpx h-90rpx bg-[#4C9F44] rounded-8rpx text-[#fff]" @click="OrderDetail.handleAgainResrve">再次预定</view>
|
||||
</view>
|
||||
|
||||
<!-- 已退款 -->
|
||||
<view class="text-32rpx leading-44rpx flex items-center justify-center leading-90rpx text-center" v-if="orderStatus === TeaRoomPackageOrderStatus.Refunded">
|
||||
<view class="text-32rpx leading-44rpx flex items-center justify-center leading-90rpx text-center" v-if="orderStatus === GroupComboOrderStatus.Refunded">
|
||||
<view class="w-330rpx h-90rpx bg-[#F6F7F8] rounded-8rpx text-[#303133] mr-30rpx" @click="OrderDetail.handleCallPhone">联系商家</view>
|
||||
<view class="w-330rpx h-90rpx bg-[#F6F7F8] rounded-8rpx text-[#303133]" @click="OrderDetail.handleCallPhone">联系平台</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加盟店 -->
|
||||
<view class="mt-34rpx" v-if="order.store.operation_type === StoreType.Franchise && orderStatus !== TeaRoomPackageOrderStatus.Used">
|
||||
<view class="mt-34rpx" v-if="order.store.operation_type === StoreType.Franchise && orderStatus !== GroupComboOrderStatus.Used">
|
||||
<!-- 待使用 -->
|
||||
<view class="text-32rpx leading-44rpx flex items-center justify-center leading-90rpx text-center" v-if="orderStatus === TeaRoomPackageOrderStatus.ToUse">
|
||||
<view class="text-32rpx leading-44rpx flex items-center justify-center leading-90rpx text-center" v-if="orderStatus === GroupComboOrderStatus.ToUse">
|
||||
<view class="w-660rpx h-90rpx bg-[#F6F7F8] rounded-8rpx text-[#303133]" @click="OrderDetail.handleToRefund">申请退款</view>
|
||||
</view>
|
||||
|
||||
<!-- 已退款 -->
|
||||
<view class="text-32rpx leading-44rpx flex items-center justify-center leading-90rpx text-center" v-if="orderStatus === TeaRoomPackageOrderStatus.Refunded">
|
||||
<view class="text-32rpx leading-44rpx flex items-center justify-center leading-90rpx text-center" v-if="orderStatus === GroupComboOrderStatus.Refunded">
|
||||
<view class="w-330rpx h-90rpx bg-[#F6F7F8] rounded-8rpx text-[#303133] mr-30rpx" @click="OrderDetail.handleCallPhone">联系商家</view>
|
||||
<view class="w-330rpx h-90rpx bg-[#F6F7F8] rounded-8rpx text-[#303133]" @click="OrderDetail.handleCallPhone">联系平台</view>
|
||||
</view>
|
||||
@ -177,15 +182,16 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { OrderSource, OrderStatus, OrderStatusTitle, TeaRoomPackageOrderStatusTextValue, TeaRoomPackageOrderStatus } from '@/utils/order'
|
||||
import { OrderSource, OrderStatusTitle, TeaRoomPackageOrderStatus, GroupComboOrderStatus, GroupComboOrderStatusTextValue } from '@/utils/order'
|
||||
import { getTeaRoomPackageOrderDetail } from '@/api/tea-room'
|
||||
import type { ITeaRoomPackageOrderDetailsResult } from '@/api/types/tea-room'
|
||||
import { toast } from '@/utils/toast'
|
||||
import { handleToTRStoreHooks, handleToTGComboHooks } from '@/hooks/useOrder'
|
||||
import { handleToTRStoreHooks, handleToTGComboHooks, handleRefundOrderHooks } from '@/hooks/useOrder'
|
||||
import { router, copy } from '@/utils/tools'
|
||||
import { ReserveServiceCategory } from '@/utils/order'
|
||||
import UseStore from '@/components/UseStore.vue'
|
||||
import { StoreType } from '@/utils/tea'
|
||||
import { useMessage } from 'wot-design-uni'
|
||||
import { PayOrderType } from '@/utils/pay'
|
||||
|
||||
const OSS = inject('OSS')
|
||||
|
||||
@ -196,6 +202,7 @@
|
||||
const orderId = ref<number>(0)
|
||||
const orderStatus = ref<number>(0) // 订单状态:待使用、退款等
|
||||
const order = ref<ITeaRoomPackageOrderDetailsResult>({
|
||||
id: 0,
|
||||
pay: 0,
|
||||
pay_way_title: '',
|
||||
order_amount: '',
|
||||
@ -222,18 +229,23 @@
|
||||
store_id: 0,
|
||||
distance: '',
|
||||
operation_type: 1
|
||||
},
|
||||
user_group: {
|
||||
qr_url: '',
|
||||
qr_sn: '',
|
||||
status: 0
|
||||
}
|
||||
})
|
||||
|
||||
const message = useMessage('wd-message-box-slot')
|
||||
|
||||
onLoad((args) => {
|
||||
title.value = OrderStatusTitle[OrderSource.Combo][args.orderStatus] || '订单详情'
|
||||
|
||||
orderId.value = args.orderId
|
||||
// 获取订单详情
|
||||
OrderDetail.handleInit()
|
||||
|
||||
type.value = args.type
|
||||
orderStatus.value = args.orderStatus
|
||||
})
|
||||
|
||||
const OrderDetail = {
|
||||
@ -247,11 +259,8 @@
|
||||
longitude: uni.getStorageSync('longitude')
|
||||
})
|
||||
order.value = res.details
|
||||
|
||||
// order.value = res.details
|
||||
// console.log("🚀 ~ order.value :", order.value )
|
||||
title.value = TeaRoomPackageOrderStatusTextValue[order.value.order_status].title || '订单详情'
|
||||
orderStatus.value = order.value.order_status
|
||||
title.value = GroupComboOrderStatusTextValue[order.value.user_group.status].title || '订单详情'
|
||||
orderStatus.value = order.value.user_group.status
|
||||
},
|
||||
|
||||
/**
|
||||
@ -284,10 +293,30 @@
|
||||
},
|
||||
|
||||
/**
|
||||
* 跳转到申请退款页面
|
||||
* 申请退款
|
||||
*/
|
||||
handleToRefund: () => {
|
||||
router.navigateTo(`/bundle/order/after-sales/after-sales?orderId=${orderId.value}&storeId=${order.value.store.id}&comboId=${order.value.group.id}&orderType=${OrderSource.Combo}&orderStatus=${OrderStatus.AfterSaleApply}`)
|
||||
message.confirm({
|
||||
title: '是否申请退款?',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
cancelButtonProps: {
|
||||
customClass: '!bg-[#F6F7F8] !text-[#303133] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
confirmButtonProps: {
|
||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
}
|
||||
}).then((res) => {
|
||||
if (res.action == 'confirm') {
|
||||
let res = handleRefundOrderHooks(order.value.user_group.id, PayOrderType.ComboRefund)
|
||||
if (res) {
|
||||
OrderDetail.handleInit()
|
||||
uni.$emit('refreshComboOrderList')
|
||||
}
|
||||
}
|
||||
}).catch(() => {
|
||||
// 点击取消按钮回调事件
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
@ -303,6 +332,13 @@
|
||||
handleUsePackage: () => {
|
||||
router.navigateTo(`/bundle/tea-room/choose-room?groupCouponId=${order.value.group.id}&teaRoomId=${order.value.store.id}`)
|
||||
},
|
||||
|
||||
/**
|
||||
* 再次预定
|
||||
*/
|
||||
handleAgainResrve: () => {
|
||||
router.navigateTo( `/bundle/tea-room/room?id=${order.value.store.id}&type=${order.value.store.operation_type}`)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@ -24,15 +24,13 @@
|
||||
|
||||
<view class="tabs bg-[#F6F7F9] pb-20rpx">
|
||||
<wd-tabs v-model="tab" swipeable slidable="always" @change="OrderList.handleChangeTabs" :lazy="false">
|
||||
<wd-tab title="全部" :name="TeaRoomPackageOrderStatusText.All"></wd-tab>
|
||||
<wd-tab title="待使用" :name="TeaRoomPackageOrderStatusText.ToUse"></wd-tab>
|
||||
<wd-tab title="已使用" :name="TeaRoomPackageOrderStatusText.Used"></wd-tab>
|
||||
<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-tabs>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<view class="content mx-30rpx mt-34rpx">
|
||||
<mescroll-body ref="mescrollItem" @init="mescrollInit" @down="downCallback" @up="OrderList.upCallback" :down="downOption" :up="upOption">
|
||||
<view class="mb-20rpx" v-for="(item, index) in list" :key="index">
|
||||
@ -50,7 +48,7 @@
|
||||
import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js"
|
||||
import { OrderSource } from '@/utils/order'
|
||||
import { getTeaRoomPackageOrderList } from '@/api/tea-room'
|
||||
import { TeaRoomPackageOrderStatusText, TeaRoomPackageOrderStatusValue } from '@/utils/order'
|
||||
import { GroupComboOrderStatusValue, GroupComboOrderStatusText } from '@/utils/order'
|
||||
|
||||
// mescroll
|
||||
const { mescrollInit, downCallback, getMescroll } = useMescroll(onPageScroll, onReachBottom) // 调用mescroll的hook
|
||||
@ -82,14 +80,14 @@
|
||||
const tab = ref<string>('all')
|
||||
|
||||
onLoad(() => {
|
||||
uni.$on('refreshPackageOrderList', () => {
|
||||
uni.$on('refreshComboOrderList', () => {
|
||||
list.value = []
|
||||
getMescroll().resetUpScroll()
|
||||
})
|
||||
})
|
||||
|
||||
onUnload(() => {
|
||||
uni.$off('refreshPackageOrderList')
|
||||
uni.$off('refreshComboOrderList')
|
||||
})
|
||||
|
||||
const OrderList = {
|
||||
@ -99,7 +97,8 @@
|
||||
size: mescroll.size,
|
||||
operation_type: currentType.value,
|
||||
use_status: orderStatus.value,
|
||||
search: keywords.value
|
||||
search: keywords.value,
|
||||
type: 1 // 1:本地套餐 2.抖音套餐
|
||||
}
|
||||
getTeaRoomPackageOrderList(filter).then((res) => {
|
||||
const curPageData = res.list || [] // 当前页数据
|
||||
@ -125,10 +124,10 @@
|
||||
*/
|
||||
handleChangeTabs: (e: {index: number, name: string}) => {
|
||||
tab.value = e.name
|
||||
if (e.name === TeaRoomPackageOrderStatusText.ToUse) {
|
||||
if (e.name === GroupComboOrderStatusText.ToUse) {
|
||||
orderStatus.value = '0'
|
||||
} else {
|
||||
orderStatus.value = TeaRoomPackageOrderStatusValue[e.name] || ''
|
||||
orderStatus.value = GroupComboOrderStatusValue[e.name] || ''
|
||||
}
|
||||
|
||||
// 切换tab时,重置当前的mescroll
|
||||
|
||||
@ -271,6 +271,8 @@
|
||||
<view class="w-630rpx h-90rpx bg-[#4C9F44] rounded-8rpx text-[#fff]">再次预定</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -285,12 +287,19 @@
|
||||
import { ReserveServiceCategory, OrderType } from '@/utils/order'
|
||||
import type { ITeaSpecialistFuture7DaysResult } from '@/api/types/tea'
|
||||
import { getNext7Days, renewTeaRoomOrder } from '@/api/tea-room'
|
||||
import { transferOrder } from '@/api/user'
|
||||
import { toTimes, copy } from '@/utils/tools'
|
||||
import { useUserStore } from '@/store'
|
||||
|
||||
|
||||
const OSS = inject('OSS')
|
||||
const title = ref<string>('')
|
||||
const orderStatus = ref<number>(0) // 订单状态:待使用、退款等
|
||||
|
||||
// 消息弹窗
|
||||
const message = useMessage('wd-message-box-slot')
|
||||
|
||||
|
||||
// 续订包间
|
||||
const showRenewPopup = ref<boolean>(false)
|
||||
const timeList = [
|
||||
@ -333,9 +342,6 @@
|
||||
// 订单倒计时取消
|
||||
const time = ref<number>(30 * 60 * 60 * 1000)
|
||||
|
||||
// 取消订单弹窗
|
||||
const message = useMessage('wd-message-box-slot')
|
||||
|
||||
// 费用明细
|
||||
const showCostPopup = ref<boolean>(false) // 是否显示退款详情弹出框
|
||||
|
||||
@ -392,11 +398,30 @@
|
||||
const day = String(now.getDate()).padStart(2, '0');
|
||||
const currentDate = `${year}-${month}-${day}`;
|
||||
|
||||
onLoad(async (args) => {
|
||||
orderId.value = args.orderId
|
||||
// 获取订单详情
|
||||
OrderDetail.handleInit()
|
||||
// 页面分享来源
|
||||
const shareSource = ref<string>('')
|
||||
|
||||
onLoad((args) => {
|
||||
shareSource.value = args.shareSource || ''
|
||||
if (args.orderId) {
|
||||
orderId.value = args.orderId
|
||||
// 获取订单详情
|
||||
OrderDetail.handleInit()
|
||||
}
|
||||
|
||||
const token = uni.getStorageSync('token')
|
||||
|
||||
if (token && shareSource.value === 'TransferOrder') {
|
||||
// 处理转让订单
|
||||
OrderDetail.handleTransferOrder()
|
||||
}
|
||||
|
||||
// 如果是从分享进入的未登录的情况下(TransferOrder),需要转让订单
|
||||
uni.$on('transferOrder', () => {
|
||||
// 处理未登录的情况下
|
||||
uni.$off('transferOrder')
|
||||
OrderDetail.handleTransferOrder()
|
||||
})
|
||||
})
|
||||
|
||||
onUnload(() => {
|
||||
@ -407,7 +432,8 @@
|
||||
if (e.from === 'button') {
|
||||
return {
|
||||
title: `我在${order.value.store_msg.name}预定了${order.value.room_msg.title},一起来吧!`,
|
||||
path: `/pages/share/tea-room/share-order-detail?orderId=${orderId.value}`,
|
||||
// path: `/pages/share/tea-room/share-order-detail?orderId=${orderId.value}&shareSource=TransferOrder`,
|
||||
path: `/bundle/order/tea-room/order-detail?orderId=${orderId.value}&shareSource=TransferOrder`,
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -564,8 +590,40 @@
|
||||
handleChooseRenewTime: (item) => {
|
||||
console.log("🚀 ~ item:", item)
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 转让订单
|
||||
*/
|
||||
handleTransferOrder: async () => {
|
||||
console.log('开始转让订单2')
|
||||
|
||||
message.confirm({
|
||||
title: '提示',
|
||||
msg: '是否接收该笔订单?',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
cancelButtonProps: {
|
||||
customClass: '!bg-[#F6F7F8] !text-[#303133] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
},
|
||||
confirmButtonProps: {
|
||||
customClass: '!bg-[#4C9F44] !text-[#fff] !text-32rpx !leading-44rpx !rounded-8rpx',
|
||||
}
|
||||
}).then((res) => {
|
||||
if (res.action == 'confirm') {
|
||||
console.log('开始转让订单3')
|
||||
|
||||
transferOrder(orderId.value).then(res => {
|
||||
console.log('开始转让订单4', res)
|
||||
|
||||
toast.success('订单接收成功')
|
||||
router.redirectTo('/bundle/order/tea-room/order-list', 500)
|
||||
})
|
||||
}
|
||||
}).catch(() => {
|
||||
// 点击取消按钮回调事件
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@ -509,7 +509,7 @@
|
||||
uni.$off('refreshOrderDetail')
|
||||
})
|
||||
|
||||
handleRefundOrderHooks(orderId.value, 'order')
|
||||
// handleRefundOrderHooks(orderId.value, 'order')
|
||||
|
||||
},
|
||||
|
||||
|
||||
@ -86,7 +86,7 @@
|
||||
</view>
|
||||
|
||||
<!-- 昵称 -->
|
||||
<view class="flex justify-between items-center mb-54rpx" @click="showEditNicknamePopup = true">
|
||||
<view class="flex justify-between items-center" @click="showEditNicknamePopup = true">
|
||||
<view class="font-400 text-[#303133] text-30rpx leading-42rpx">昵称</view>
|
||||
<view class="flex justify-end">
|
||||
<view class="flex items-center">
|
||||
@ -100,8 +100,8 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 修改手机号 -->
|
||||
<view class="flex justify-between items-center" @click="Profile.handleToEditMobile">
|
||||
<!-- TODO 暂时隐藏-修改手机号 -->
|
||||
<!-- <view class="flex justify-between items-center" @click="Profile.handleToEditMobile">
|
||||
<view class="font-400 text-[#303133] text-30rpx leading-42rpx">修改手机号</view>
|
||||
<view class="flex justify-end">
|
||||
<view class="flex items-center">
|
||||
@ -113,7 +113,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<view class="bg-white rounded-16rpx mt-144rpx mx-30rpx px-30rpx py-32rpx text-center font-400 text-[#303133] text-30rpx leading-42rpx" @click="showLogoutPopup = true">
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
import { getNavBarHeight } from '@/utils/index'
|
||||
import { toast } from '@/utils/toast'
|
||||
import { router } from '@/utils/tools'
|
||||
// import { wxpay } from '@/hooks/usePay'
|
||||
// import { wechatPay } from '@/hooks/usePay'
|
||||
import { teaRoomRecharge } from '@/api/tea-room'
|
||||
|
||||
let navbarHeight = ref<number>(0)
|
||||
|
||||
@ -92,6 +92,7 @@
|
||||
const groupCouponOrderId = ref<number>(0)
|
||||
const orderStatus = ref<number>(0) // 订单状态:待使用、退款等
|
||||
const order = ref<ITeaRoomPackageOrderDetailsResult>({
|
||||
id: 0,
|
||||
pay: 0,
|
||||
pay_way_title: '',
|
||||
order_amount: '',
|
||||
@ -116,6 +117,11 @@
|
||||
store_id: 0,
|
||||
distance: '',
|
||||
operation_type: 1
|
||||
},
|
||||
user_group: {
|
||||
qr_url: '',
|
||||
qr_sn: '',
|
||||
status: 0
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}</route>
|
||||
|
||||
<template>
|
||||
<view class="pb-180rpx">
|
||||
<!-- 费用明细 -->
|
||||
@ -77,8 +78,8 @@
|
||||
<template v-for="(label, labelIndex) in teaRoom.label" :key="labelIndex">
|
||||
<view class="mr-20rpx flex items-start">
|
||||
<wd-tag
|
||||
:color="randomLabelColor(labelIndex)"
|
||||
:bg-color="randomLabelColor(labelIndex)"
|
||||
:color="randomLabelColor(Number(labelIndex))"
|
||||
:bg-color="randomLabelColor(Number(labelIndex))"
|
||||
plain
|
||||
custom-class="!rounded-4rpx"
|
||||
>{{ label.label_name }}</wd-tag>
|
||||
@ -269,7 +270,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="mr-30rpx">
|
||||
<wd-button custom-class='!bg-[#4C9F44] !rounded-8rpx !h-70rpx' @click='Detail.handleSubmitOrder'>{{ isGroupBuying ? '立即购买' : '立即预定' }}</wd-button>
|
||||
<wd-button custom-class='!bg-[#4C9F44] !rounded-8rpx !h-70rpx' :disabled="isSubmitting" @click='Detail.handleSubmitOrder'>{{ isGroupBuying ? '立即购买' : '立即预定' }}</wd-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -387,6 +388,9 @@
|
||||
})
|
||||
})
|
||||
|
||||
// 防止重复提交
|
||||
const isSubmitting = ref(false)
|
||||
|
||||
const Detail = {
|
||||
/**
|
||||
* 初始包间详情
|
||||
@ -414,7 +418,6 @@
|
||||
Object.assign(sevenDay, {minimum_time: teaRoom.value.room.hours})
|
||||
}
|
||||
|
||||
|
||||
// 获取门店余额
|
||||
const balance = await getTeaRoomBalance({ store_id: storeId.value })
|
||||
storeMoney.value = balance.data.money || 0
|
||||
@ -473,7 +476,7 @@
|
||||
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}` }
|
||||
selectedGroupCoupon.value = {id: params.coupon.group_id, name: `团购券-${params.coupon?.title}` }
|
||||
bill.value.groupCoupon = params.coupon.coupon_price
|
||||
}
|
||||
|
||||
@ -489,13 +492,14 @@
|
||||
* 提交订单
|
||||
*/
|
||||
handleSubmitOrder: async () => {
|
||||
|
||||
if (isSubmitting.value) return
|
||||
// 只有预定茶室才会选择时间
|
||||
if (!isGroupBuying.value && bill.value.service.num == 0) {
|
||||
toast.info('请选择预定时间')
|
||||
return
|
||||
}
|
||||
|
||||
isSubmitting.value = true
|
||||
uni.showLoading({
|
||||
title: '提交中...'
|
||||
})
|
||||
@ -503,6 +507,7 @@
|
||||
try {
|
||||
let res: any = null
|
||||
if (isGroupBuying.value) {
|
||||
// 团购套餐ID
|
||||
res = await createTeaRoomPackageOrder({
|
||||
group_id: id.value,
|
||||
room_id: 0
|
||||
@ -528,6 +533,7 @@
|
||||
uni.$on('payment', params => {
|
||||
setTimeout(() => {
|
||||
uni.$off("payment")
|
||||
isSubmitting.value = false
|
||||
if (params.result) {
|
||||
uni.redirectTo({
|
||||
url: `/pages/notice/reserve?type=${OrderType.TeaRoomOrder}&orderId=${params.orderId}&isGroupBuying=${isGroupBuying.value ? 1 : 0}`
|
||||
@ -546,14 +552,16 @@
|
||||
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}`
|
||||
`/pages/cashier/cashier?from=${OrderType.TeaRoomOrder}&orderId=${res.id}&name=${name}&storeId=${storeId.value}&isGroupBuying=${isGroupBuying.value ? 1 : 0}&cmoboId=${id.value || 0}`
|
||||
)
|
||||
}, 800)
|
||||
}, 500)
|
||||
} catch (error) {
|
||||
uni.hideLoading()
|
||||
isSubmitting.value = false
|
||||
toast.info('订单提交失败,请稍后重试')
|
||||
return
|
||||
}
|
||||
// 正常流程下,isSubmitting.value 会在支付回调中重置
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<!-- 使用 type="home" 属性设置首页,其他页面不需要设置,默认为page -->
|
||||
<route lang="jsonc" type="page">{
|
||||
"needLogin": true,
|
||||
"layout": "tabbar",
|
||||
"style": {
|
||||
"navigationStyle": "custom"
|
||||
@ -45,6 +46,7 @@
|
||||
<view class="text-26rpx mt-18rpx leading-48rpx text-[#606266]">营业时间:{{ teaRoom.day_time }} {{ teaRoom.start_time }}-{{ teaRoom.end_time }}</view>
|
||||
</view>
|
||||
<view class="flex flex-col items-end">
|
||||
<!-- TODO 后续改为门店充值 -->
|
||||
<view @click="Room.handleToRecharge">
|
||||
<recharge-btn name="充值"></recharge-btn>
|
||||
</view>
|
||||
@ -176,14 +178,7 @@
|
||||
// 随机颜色列表
|
||||
const tagColors = ['#40AE36', '#F55726']
|
||||
|
||||
onShow(() => {
|
||||
// 刷新茶室详情
|
||||
list.value = []
|
||||
getMescroll().resetUpScroll()
|
||||
})
|
||||
|
||||
onLoad((args) => {
|
||||
console.log("🚀 ~ args:", uni.getStorageSync('latitude'), uni.getStorageSync('longitude'))
|
||||
if (args.id) {
|
||||
teaRoomId.value = Number(args.id)
|
||||
storeType.value = Number(args.type) || StoreType.Direct
|
||||
@ -194,8 +189,18 @@
|
||||
|
||||
Room.handleInit()
|
||||
}
|
||||
|
||||
uni.$on('refreshTeaRoomDetail', () => {
|
||||
list.value = []
|
||||
getMescroll().resetUpScroll()
|
||||
})
|
||||
})
|
||||
|
||||
onUnload(() => {
|
||||
console.log("🚀 ~ 卸载refreshTeaRoomDetail事件:")
|
||||
uni.$off('refreshTeaRoomDetail')
|
||||
})
|
||||
|
||||
const Room = {
|
||||
sheetMenuType: '', // 记录菜单类型
|
||||
|
||||
@ -366,7 +371,8 @@
|
||||
* 跳转到门店充值页面
|
||||
*/
|
||||
handleToRecharge: () => {
|
||||
router.navigateTo(`/bundle/store-recharge/store-recharge?id=${teaRoom.value.id}&storeName=${teaRoom.value.name}`)
|
||||
// router.navigateTo(`/bundle/store-recharge/store-recharge?id=${teaRoom.value.id}&storeName=${teaRoom.value.name}`)
|
||||
router.navigateTo('/bundle/wallet/recharge')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -108,9 +108,9 @@
|
||||
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { PayList, PayCategory, PayValue } from '@/utils/pay'
|
||||
import { PayList, PayCategory, PayValue, PayOrderType, PayOrderSource } from '@/utils/pay'
|
||||
import { wechatPay } from '@/hooks/usePay'
|
||||
import { prePay, balancePay } from '@/api/pay'
|
||||
import { prePay } from '@/api/pay'
|
||||
import { toast } from '@/utils/toast'
|
||||
|
||||
const pay = ref<number>(PayValue.WeChatPay) // 默认微信支付方式
|
||||
@ -127,9 +127,9 @@
|
||||
|
||||
onLoad(() => {
|
||||
// 模拟获取用户身份
|
||||
setTimeout(() => {
|
||||
currentVipType.value = 'partner'
|
||||
}, 1000)
|
||||
// setTimeout(() => {
|
||||
// currentVipType.value = 'partner'
|
||||
// }, 1000)
|
||||
})
|
||||
|
||||
const buy = {
|
||||
@ -147,8 +147,8 @@
|
||||
from: 'wx',
|
||||
order_id: 0,
|
||||
pay_way: 2,
|
||||
order_source: 1, //订单来源:1-小程序; 2-h5; 3app
|
||||
order_type: 3 // 0为茶艺师 1为茶室包间 2为茶室套餐
|
||||
order_source: PayOrderSource.MINI, //订单来源:1-小程序; 2-h5; 3app
|
||||
order_type: PayOrderType.BuyVip // 0为茶艺师 1为茶室包间 2为茶室套餐
|
||||
})
|
||||
|
||||
wechatPay(pay.pay.config).then((res) => {
|
||||
|
||||
@ -39,6 +39,7 @@
|
||||
<view class="mt-26rpx mb-20rpx border-b-2rpx border-b-dashed border-[#E5E5E5] mx-18rpx"></view>
|
||||
|
||||
<view class="text-28rpx leading-40rpx text-[#606266] mx-28rpx">
|
||||
<!-- TODO 内容先隐藏 -->
|
||||
<!-- <view class="flex justify-between items-center mb-16rpx">
|
||||
<view>茶艺师</view>
|
||||
<view>茶艺师的昵称</view>
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
<template>
|
||||
<view class="mt-26rpx mx-30rpx">
|
||||
<bill-notice :type="type" :money="10.00" :time="bill.create_time" :order="bill.source_sn"></bill-notice>
|
||||
<bill-notice :type="type" :money="bill.amount" :time="bill.create_time" :order="bill.source_sn"></bill-notice>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
const id = ref<number>(0)
|
||||
const bill = ref({
|
||||
id: 0,
|
||||
amount: 0,
|
||||
change_type: 0,
|
||||
create_time: '',
|
||||
source_sn: ''
|
||||
|
||||
@ -34,14 +34,14 @@
|
||||
<view class="flex items-center">
|
||||
<view class="font-400 text-36rpx leading-50rpx text-[#303133] mr-20rpx mt-40rpx">¥</view>
|
||||
<view class="mt-44rpx">
|
||||
<wd-input type="text" v-model="person" placeholder="请输入金额" no-border custom-input-class="!h-80rpx !text-48rpx !leading-66rpx" >
|
||||
<wd-input type="text" v-model="rechargeMoney" placeholder="请输入金额" no-border custom-input-class="!h-80rpx !text-48rpx !leading-66rpx" >
|
||||
</wd-input>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 推广方式 -->
|
||||
<view class="mt-60rpx">
|
||||
<!-- <view class="mt-60rpx">
|
||||
<view class="mx-30rpx text-32rpx leading-44rpx text-[#303133]">
|
||||
<text class="mr-12rpx">推广方式</text>
|
||||
<text class="text-26rpx leading-36rpx text-[#909399]">(选填)</text>
|
||||
@ -74,9 +74,9 @@
|
||||
</wd-tab>
|
||||
</wd-tabs>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<view class="fixed left-0 right-0 bottom-92rpx z-2 bg-[#4C9F44] text-[#fff] flex justify-center items-center h-90rpx rounded-8rpx mx-60rpx" @click="buy.handleConfirmRecharge">
|
||||
<view class="fixed left-0 right-0 bottom-92rpx z-2 bg-[#4C9F44] text-[#fff] flex justify-center items-center h-90rpx rounded-8rpx mx-60rpx" @click="buy.handleRecharge">
|
||||
确定转入
|
||||
</view>
|
||||
</view>
|
||||
@ -114,13 +114,20 @@
|
||||
|
||||
|
||||
<script lang="ts" setup>
|
||||
const OSS = inject('OSS')
|
||||
import { PayList, PayCategory, PayValue, PayOrderType, PayOrderSource } from '@/utils/pay'
|
||||
import { teaRoomRecharge } from '@/api/tea-room'
|
||||
import { wechatPay } from '@/hooks/usePay'
|
||||
import { prePay, balancePay } from '@/api/pay'
|
||||
import { toast } from '@/utils/toast'
|
||||
|
||||
const pay = ref<number>(PayValue.WeChatPay) // 默认微信支付方式
|
||||
const OSS = inject('OSS')
|
||||
|
||||
// 推广方式
|
||||
const tab = ref<number>(0)
|
||||
const person = ref<string>('') // 个人推广码
|
||||
const showStorePopup = ref<boolean>(false) // 显示门店列表弹窗
|
||||
const rechargeMoney = ref<string>('')
|
||||
|
||||
onLoad(() => {
|
||||
|
||||
@ -137,6 +144,52 @@
|
||||
uni.navigateTo({
|
||||
url: '/pages/notice/pay?type=vip'
|
||||
})
|
||||
},
|
||||
|
||||
// 购买会员
|
||||
handleRecharge: async () => {
|
||||
if (!rechargeMoney.value) {
|
||||
toast.info('请输入转入金额')
|
||||
return
|
||||
}
|
||||
|
||||
uni.showLoading({ title: '支付中...' })
|
||||
try {
|
||||
// 先请求充值接口
|
||||
const res = await teaRoomRecharge(Number(rechargeMoney.value))
|
||||
|
||||
// 预支付
|
||||
const pay = await prePay({
|
||||
from: 'recharge',
|
||||
order_id: res.order_id,
|
||||
pay_way: 2,
|
||||
order_source: PayOrderSource.MINI, //订单来源:1-小程序; 2-h5; 3app
|
||||
order_type: PayOrderType.Recharge
|
||||
})
|
||||
|
||||
wechatPay(pay.pay.config).then((res) => {
|
||||
uni.hideLoading()
|
||||
if (res === 'success') {
|
||||
toast.success('支付成功')
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 800)
|
||||
return
|
||||
} else if (res === 'cancel') {
|
||||
toast.info('已取消支付')
|
||||
return
|
||||
} else {
|
||||
toast.info('支付失败,请重试')
|
||||
return
|
||||
}
|
||||
}).catch(() => {
|
||||
uni.hideLoading()
|
||||
toast.info('支付失败,请重试')
|
||||
})
|
||||
} catch (error) {
|
||||
uni.hideLoading()
|
||||
toast.info('支付失败,请重试')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -105,12 +105,19 @@ import { router } from '@/utils/tools'
|
||||
}
|
||||
const list = ref<Array<any>>([]) // 茶室列表
|
||||
const userMoney = ref<number>(0) // 用户余额
|
||||
const canReset = ref<boolean>(false) // 避免onShow重复加载
|
||||
|
||||
// 日期过滤
|
||||
const value = ref<number>(Date.now())
|
||||
const selectTime = ref<string>('')
|
||||
|
||||
onShow(() => {
|
||||
if (canReset.value) {
|
||||
list.value = []
|
||||
getMescroll().resetUpScroll();
|
||||
}
|
||||
canReset.value = true
|
||||
|
||||
getUserInfo().then(res => {
|
||||
userMoney.value = Number(res.user_money)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user