调试接口
This commit is contained in:
@ -41,7 +41,7 @@
|
||||
<view>-¥{{ bill.groupCoupon || 0 }}</view>
|
||||
</view>
|
||||
<view class="flex justify-between items-center text-24rpx text-[#909399] leading-34rpx mt-16rpx">
|
||||
<view>会员八折</view>
|
||||
<view>会员九折</view>
|
||||
<view>-¥{{ bill.discount || 0 }}</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -93,7 +93,7 @@
|
||||
{{ teaRoomPackage.sold > 10 ? teaRoomPackage.sold + '+' : teaRoomPackage.sold }}
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ teaRoom.sold > 10 ? teaRoom.sold + '+' : teaRoom.sold }}
|
||||
{{ teaRoom.room?.sold > 10 ? teaRoom.room?.sold + '+' : teaRoom.room?.sold }}
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
@ -144,6 +144,27 @@
|
||||
</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>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 优惠券 -->
|
||||
<view class="bg-white rounded-16rpx py-26rpx px-30rpx mt-24rpx mx-30rpx" @click="Detail.handleToCoupon(CouponType.Discount)">
|
||||
@ -166,26 +187,6 @@
|
||||
</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>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="isGroupBuying">
|
||||
@ -291,6 +292,7 @@
|
||||
import PriceFormat from '@/components/PriceFormat.vue'
|
||||
import BookingTime from '@/components/BookingTime.vue'
|
||||
import { getUserInfo } from '@/api/user'
|
||||
import { getTeaRoomGroupCouponList } from '@/api/tea-room'
|
||||
|
||||
const OSS = inject('OSS')
|
||||
|
||||
@ -360,6 +362,8 @@
|
||||
// 选择的优惠券
|
||||
const selectedCoupon = ref<{id: number, name: string}>({id: 0, name: ''})
|
||||
const selectedGroupCoupon = ref<{id: number, name: string}>({id: 0, name: ''})
|
||||
const selectCouponId = ref<number>(0)
|
||||
const selectGroupCouponId = ref<number>(0)
|
||||
|
||||
// 用户信息
|
||||
const user = ref<any>(null)
|
||||
@ -370,6 +374,12 @@
|
||||
// 页面类型
|
||||
const pageType = ref<string>('')
|
||||
|
||||
// 防止重复提交
|
||||
const isSubmitting = ref(false)
|
||||
|
||||
// 团购套餐列表
|
||||
const groupCouponList = ref<Array<any>>([])
|
||||
|
||||
onLoad((args) => {
|
||||
storeId.value = Number(args.storeId)
|
||||
id.value = Number(args.id) // 在茶室下这个id是包间ID,在团购下是套餐ID
|
||||
@ -389,7 +399,6 @@
|
||||
})
|
||||
|
||||
// 防止重复提交
|
||||
const isSubmitting = ref(false)
|
||||
|
||||
const Detail = {
|
||||
/**
|
||||
@ -421,8 +430,12 @@
|
||||
// 获取门店余额
|
||||
const balance = await getTeaRoomBalance({ store_id: storeId.value })
|
||||
storeMoney.value = balance.data.money || 0
|
||||
},
|
||||
|
||||
// 获取团购券
|
||||
const group = await getTeaRoomGroupCouponList({store_id: storeId.value, room_id: id.value})
|
||||
groupCouponList.value = group.list
|
||||
},
|
||||
|
||||
/*
|
||||
* 初始化套餐详情
|
||||
*/
|
||||
@ -468,6 +481,19 @@
|
||||
toast.info('请选择预定时间')
|
||||
return
|
||||
}
|
||||
|
||||
// 在选择优惠券之前需要先选择团购券
|
||||
if (type === CouponType.Discount && groupCouponList.value.length > 0 && selectedGroupCoupon.value.id == 0) {
|
||||
toast.info('请先选择团购券')
|
||||
return
|
||||
}
|
||||
|
||||
// 如果选择优惠券之前订单金额已经是0的话则不用再选择优惠券
|
||||
if (type === CouponType.Discount && selectedGroupCoupon.value.id > 0 && bill.value.total <= 0) {
|
||||
toast.info('当前订单金额已为0,无需选择优惠券')
|
||||
return
|
||||
}
|
||||
|
||||
uni.$on('chooseCoupon', params => {
|
||||
console.log("🚀 ~ params:", params)
|
||||
uni.$off('chooseCoupon')
|
||||
@ -475,9 +501,11 @@
|
||||
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
|
||||
selectCouponId.value = params.coupon.id // 这里的ID是在数据表自增的ID,保存下来是为了回显列表的,没有其他作用
|
||||
} else {
|
||||
selectedGroupCoupon.value = {id: params.coupon.group_id, name: `团购券-${params.coupon?.title}` }
|
||||
bill.value.groupCoupon = params.coupon.coupon_price
|
||||
selectGroupCouponId.value = params.coupon.id // 这里的ID是在数据表自增的ID,保存下来是为了回显列表的,没有其他作用
|
||||
}
|
||||
|
||||
Detail.handleCalculateTeaRoomPrice()
|
||||
@ -485,7 +513,9 @@
|
||||
|
||||
// 获取预定了几个小时
|
||||
const count = bill.value.service.num
|
||||
router.navigateTo(`/bundle/coupon/coupon?id=${id.value}&numbers=${count}&type=${type}&storeId=${storeId.value}`)
|
||||
console.log("🚀 ~ selectCouponId:", selectCouponId.value)
|
||||
|
||||
router.navigateTo(`/bundle/coupon/coupon?id=${id.value}&numbers=${count}&type=${type}&storeId=${storeId.value}&couponId=${selectCouponId.value}&groupCouponId=${selectGroupCouponId.value}`)
|
||||
},
|
||||
|
||||
/**
|
||||
@ -523,7 +553,7 @@
|
||||
user_coupon_id: selectedCoupon.value.id || 0,
|
||||
hours: bill.value.service.num,
|
||||
group_coupon_id: selectedGroupCoupon.value.id || 0,
|
||||
timeslot: timeSlots.value
|
||||
timeslot: timeSlots.value.join(',')
|
||||
}
|
||||
res = await createTeaRoomOrder(params)
|
||||
}
|
||||
@ -571,7 +601,7 @@
|
||||
const res = await calculateTeaRoomPrice({
|
||||
room_id: id.value,
|
||||
coupon_id: selectedCoupon.value.id || 0,
|
||||
group_coupon_id: selectedGroupCoupon.value.id,
|
||||
group_coupon_id: selectedGroupCoupon.value.id || 0,
|
||||
nums: bill.value.service.num,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user