diff --git a/src/api/user.ts b/src/api/user.ts index a294076..3840120 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -78,24 +78,12 @@ export function userAddressDetails(data: IUserAddressDetailsParams) { * 优惠券列表(从订单页获取) */ export interface IGetCouponsParams { - id: number - numbers: number type_id: number + price: number } export function getCoupons(data: IGetCouponsParams) { - return http.Post('/api/UserCoupon/UserCoupinList', data) -} - -/** - * 优惠券列表(从个人中心点击进去) - */ -export interface IGetMyCouponsParams { - status: number - type_id: number -} -export function getMyCoupons(data: IGetMyCouponsParams) { - return http.Post('/api/UserCoupon/UserCoupinList', data) + return http.Post('/api/UserCoupon/UserCoupinList', data) } /** diff --git a/src/bundle/coupon/coupon.vue b/src/bundle/coupon/coupon.vue index e1d929d..e75d432 100644 --- a/src/bundle/coupon/coupon.vue +++ b/src/bundle/coupon/coupon.vue @@ -51,7 +51,7 @@ :key="item.id" :coupon="item" :canUse="false" - showChecked + :showChecked="false" couponType="coupon" :checked="item.id === checkedId" :onCheck="Coupons.handleCheck" @@ -131,14 +131,15 @@ no_use: [], use: [] }) + + // 可用优惠券数量 + const useCoupon = ref(0) + // 不可用优惠券数量 + const unUseCoupon = ref(0) + const groupCouponList = ref>([]) const checkedId = ref(0) - const unCouponList = ref([ - { id: 1, amount: 20, limit: 100, expire: '2024.08.20' }, - { id: 2, amount: 10, limit: 50, expire: '2024.08.25' } - ]) - const storeId = ref(0) // 门店ID const teaRoomId = ref(0) // 包间ID const couponId = ref(0) // 选中的优惠券ID @@ -151,7 +152,7 @@ // 初始化优惠券数据 if (args.id && args.numbers && args.type == 1) { // 获取到包间ID和预定了几个小时 - await Coupons.handleInitCoupon(args.id, args.numbers) + await Coupons.handleInitCoupon(args.price) checkedId.value = Number(args.couponId) || 0 } else if (args.id && args.type == 2) { @@ -167,9 +168,19 @@ * @param id 包间ID * @param numbers 预定时长 */ - handleInitCoupon: async (id: number, numbers: number) => { - const res = await getCoupons({id, numbers, type_id: 2}) - couponList.value = res + handleInitCoupon: async (price: number) => { + const res = await getCoupons({type_id: 2, price}) // 1茶艺师 2茶室 3 个人中心 + // couponList.value = res + useCoupon.value = res.count.yes_use + unUseCoupon.value = res.count.no_use + + if (res.result.length > 0) { + couponList.value.use = res.result.filter(item => item.is_use == 0) + couponList.value.no_use = res.result.filter(item => item.is_use == 1) + } + console.log("🚀 ~ couponList.value:", couponList.value) + console.log("🚀 ~ couponList.value:", useCoupon.value) + console.log("🚀 ~ couponList.value:", unUseCoupon.value) }, /** @@ -201,7 +212,7 @@ if (checkedId.value > 0) { if (couponType.value == CouponType.Discount) { - coupon = couponList.value.use.find(item => item.user_coupon_id === checkedId.value) + coupon = couponList.value.use.find(item => item.id === checkedId.value) } else { coupon = groupCouponList.value.find(item => item.id === checkedId.value) } diff --git a/src/bundle/coupon/my-coupon.vue b/src/bundle/coupon/my-coupon.vue index 06b2749..620b5cf 100644 --- a/src/bundle/coupon/my-coupon.vue +++ b/src/bundle/coupon/my-coupon.vue @@ -10,153 +10,103 @@ @@ -166,17 +116,11 @@ background-color: $cz-page-background; } - .coupon-tab { + .radio { :deep() { - .wd-tabs, - .wd-tabs__nav, - .wd-tabs__line { + .wd-radio-group { background-color: transparent !important; } - - .wd-tabs__nav-item.is-active { - font-size: 32rpx !important; - } } } diff --git a/src/bundle/coupon/my-coupon_bck.vue b/src/bundle/coupon/my-coupon_bck.vue new file mode 100644 index 0000000..f774c92 --- /dev/null +++ b/src/bundle/coupon/my-coupon_bck.vue @@ -0,0 +1,182 @@ + +{ + "needLogin": true, + "layout": "default", + "style": { + "navigationStyle": "custom" + } +} + + + + + + + diff --git a/src/bundle/settle-in/tea-room.vue b/src/bundle/settle-in/tea-room.vue index f75f84e..bf94b1c 100644 --- a/src/bundle/settle-in/tea-room.vue +++ b/src/bundle/settle-in/tea-room.vue @@ -15,7 +15,7 @@ - + @@ -26,25 +26,14 @@ - - - - - - - 申请加盟合作成功 - 请登录商家端查看信息 - 如您遇到任何问题,可随时联系客服热线 400-6245-123,我们将竭诚为您服务! - + + + - - - - - - 您的信息已成功提交 - 目前正在审核中,请您耐心等待 - + + 申请加盟合作成功 + 请登录【茶址商户端】查看信息 + 如您遇到任何问题,可随时联系客服,我们将竭诚为您服务! @@ -242,7 +231,7 @@ onLoad(async () => { const res = await getJoinCooperationStatus() - status.value = res.status + status.value = Number(res.status) token.value = uni.getStorageSync('token') TeaRoom.handleInit() diff --git a/src/bundle/tea-room/detail.vue b/src/bundle/tea-room/detail.vue index 6aae26b..801cf7a 100644 --- a/src/bundle/tea-room/detail.vue +++ b/src/bundle/tea-room/detail.vue @@ -556,7 +556,7 @@ // 获取预定了几个小时 const count = bill.value.service.num - router.navigateTo(`/bundle/coupon/coupon?id=${id.value}&numbers=${count}&type=${type}&storeId=${storeId.value}&couponId=${selectCouponId.value}&groupCouponId=${selectGroupCouponId.value}`) + router.navigateTo(`/bundle/coupon/coupon?id=${id.value}&price=${bill.value.total}&numbers=${count}&type=${type}&storeId=${storeId.value}&couponId=${selectCouponId.value}&groupCouponId=${selectGroupCouponId.value}`) }, /** @@ -571,10 +571,6 @@ } isSubmitting.value = true - uni.showLoading({ - title: '提交中...' - }) - try { let res: any = null if (isGroupBuying.value) { @@ -598,7 +594,7 @@ } res = await createTeaRoomOrder(params) } - uni.hideLoading() + // uni.hideLoading() // 支付后的处理 uni.$on('payment', params => { @@ -628,7 +624,6 @@ ) }, 500) } catch (error) { - uni.hideLoading() isSubmitting.value = false return } diff --git a/src/bundle_b/pages/tea-specialist/coupon.vue b/src/bundle_b/pages/tea-specialist/coupon.vue index 0a088a8..38c57f6 100644 --- a/src/bundle_b/pages/tea-specialist/coupon.vue +++ b/src/bundle_b/pages/tea-specialist/coupon.vue @@ -57,6 +57,7 @@ import type { IUserCouponListResult } from '@/api/types/user' import { router } from '@/utils/tools' import { CouponType } from '@/utils/coupon' + import { getCoupons } from '@/api/user' const couponType = ref(2) // couponType 1:优惠券 2:团购券 @@ -67,21 +68,17 @@ const groupCouponList = ref>([]) const checkedId = ref(0) - const unCouponList = ref([ - { id: 1, amount: 20, limit: 100, expire: '2024.08.20' }, - { id: 2, amount: 10, limit: 50, expire: '2024.08.25' } - ]) - - const storeId = ref(0) // 门店ID const teaRoomId = ref(0) // 包间ID const couponId = ref(0) // 选中的优惠券ID + + // 可用优惠券数量 + const useCoupon = ref(0) onLoad(async (args) => { teaRoomId.value = args.id - storeId.value = args.storeId || 0 checkedId.value = args.couponId || 0 - await Coupons.handleInitCoupon() + await Coupons.handleInitCoupon(args.price) checkedId.value = Number(args.couponId) || 0 }) @@ -89,15 +86,18 @@ /** * 初始化优惠券列表 */ - handleInitCoupon: async () => { - const res = await getTeaSpecialistCoupons() - const coupon = res.map( item => { - return { - ...item, - user_coupon_id: item.id, - } - }) - couponList.value.use = coupon + handleInitCoupon: async (price) => { + // const res = await getTeaSpecialistCoupons() + // const coupon = res.map( item => { + // return { + // ...item, + // user_coupon_id: item.id, + // } + // }) + // couponList.value.use = coupon + const res = await getCoupons({type_id: 1, price}) // 1茶艺师 2茶室 3 个人中心 + useCoupon.value = res.count.yes_use + couponList.value.use = res.result.filter(item => item.is_use == 0) console.log("🚀 ~ couponList.value.use:", couponList.value.use) }, @@ -106,13 +106,13 @@ * @param id 优惠券ID */ handleCheck: (id: number) => { - console.log("🚀 ~ id:", id) // 如果是优惠券的话则是可以取消选择 if (checkedId.value === id) { checkedId.value = 0 // 再次点击已选中时取消选择 } else { checkedId.value = id } + console.log("🚀 ~ checkedId.value:", checkedId.value) }, /** @@ -121,7 +121,7 @@ handleConfirmCoupon: () => { let coupon = null coupon = couponList.value.use.find(item => { - return item.user_coupon_id === checkedId.value + return item.id === checkedId.value }) uni.$emit('chooseCoupon', { coupon }) router.navigateBack() diff --git a/src/bundle_b/pages/tea-specialist/list.vue b/src/bundle_b/pages/tea-specialist/list.vue index 4ac2917..0b0e6a7 100644 --- a/src/bundle_b/pages/tea-specialist/list.vue +++ b/src/bundle_b/pages/tea-specialist/list.vue @@ -87,7 +87,9 @@ class="flex items-center bg-white p-20rpx rounded-10rpx mx-30rpx mb-20rpx relative" v-for="(item, index) in list" :key="index" > - {{ item.state == 0 ? '可约' : '工作中' }} + 可约 + 工作中 + 不可约 diff --git a/src/bundle_b/pages/tea-specialist/reserve.vue b/src/bundle_b/pages/tea-specialist/reserve.vue index 62f79c7..2ca68e5 100644 --- a/src/bundle_b/pages/tea-specialist/reserve.vue +++ b/src/bundle_b/pages/tea-specialist/reserve.vue @@ -662,6 +662,11 @@ return } + if (info.value.state === 2) { + toast.show('茶艺师已离线,暂不可预约') + return + } + if (serviceTypeValue.value === 1 && teaHouse.value.id === 0) { // 到店服务必须要选择门店 toast.show('请先选择门店') @@ -789,6 +794,7 @@ uni.$off('chooseCoupon'); uni.$on('chooseCoupon', params => { + console.log("🚀 ~ params:", params) uni.$off('chooseCoupon') if (params.coupon) { selectedCoupon.value = {id: params.coupon.id, name: params.coupon.name} @@ -807,7 +813,7 @@ }) // 获取预定了几个小时 - router.navigateTo(`/bundle_b/pages/tea-specialist/coupon?couponId=${selectCouponId.value}`) + router.navigateTo(`/bundle_b/pages/tea-specialist/coupon?couponId=${selectCouponId.value}&price=${costBill.value.order_amount}`) }, /** @@ -848,6 +854,11 @@ if (info.value.state === 1) { toast.show('茶艺师工作中,暂不可预约') return + } + + if (info.value.state === 2) { + toast.show('茶艺师已离线,暂不可预约') + return } if (totalHour.value == 0) { diff --git a/src/components/coupon/coupon.vue b/src/components/coupon/coupon.vue index feefa87..9035c30 100644 --- a/src/components/coupon/coupon.vue +++ b/src/components/coupon/coupon.vue @@ -1,5 +1,5 @@