优化功能
This commit is contained in:
@ -54,7 +54,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="DouYinExcharge">
|
||||
import { useMessage, useToast } from 'wot-design-uni'
|
||||
import { useMessage, useToast } from 'wot-design-uni'
|
||||
import { checkDouyinCoupon } from '@/api/user'
|
||||
import { router } from '@/utils/tools'
|
||||
|
||||
|
||||
@ -64,6 +64,7 @@
|
||||
|
||||
<!-- 团购券 -->
|
||||
<view v-if="couponType == 2">
|
||||
checkedId--{{checkedId}}
|
||||
<view class="mx-30rpx">
|
||||
<view class="mx30rpx">
|
||||
<text class="text-[#303133] font-bold text-30rpx leading-42rpx">可用团购券</text>
|
||||
@ -181,11 +182,16 @@
|
||||
},
|
||||
|
||||
/**
|
||||
* 选择优惠券
|
||||
* 选择/取消选择优惠券
|
||||
* @param id 优惠券ID
|
||||
*/
|
||||
handleCheck: (id: number) => {
|
||||
checkedId.value = id
|
||||
// 如果是优惠券的话则是可以取消选择
|
||||
if (couponType.value == 1 && checkedId.value === id) {
|
||||
checkedId.value = 0 // 再次点击已选中时取消选择
|
||||
} else {
|
||||
checkedId.value = id
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@ -193,12 +199,14 @@
|
||||
*/
|
||||
handleConfirmCoupon: () => {
|
||||
let coupon = null
|
||||
if (couponType.value == CouponType.Discount) {
|
||||
coupon = couponList.value.use.find(item => item.user_coupon_id === checkedId.value)
|
||||
} else {
|
||||
coupon = groupCouponList.value.find(item => item.id === checkedId.value)
|
||||
|
||||
if (checkedId.value > 0) {
|
||||
if (couponType.value == CouponType.Discount) {
|
||||
coupon = couponList.value.use.find(item => item.user_coupon_id === checkedId.value)
|
||||
} else {
|
||||
coupon = groupCouponList.value.find(item => item.id === checkedId.value)
|
||||
}
|
||||
}
|
||||
console.log("🚀 ~ coupon:", coupon)
|
||||
|
||||
uni.$emit('chooseCoupon', { coupon })
|
||||
router.navigateBack()
|
||||
|
||||
@ -68,7 +68,7 @@
|
||||
<view>
|
||||
<view class="mt-20rpx mx-30rpx swiper">
|
||||
<wd-swiper value-key="image" height="320rpx"
|
||||
:indicator="{ type: 'dots-bar' }" :list="swiperList" v-model:current="current" mode="aspectFit">
|
||||
:indicator="{ type: 'dots-bar' }" :list="swiperList" v-model:current="current" mode="aspectFit" @click="Detail.handlePreviewImage">
|
||||
</wd-swiper>
|
||||
</view>
|
||||
|
||||
@ -90,7 +90,7 @@
|
||||
<view class="text-[#303133] text-26rpx leading-48rpx font-500" v-if="isGroupBuying">{{ teaRoomPackage.description }}</view>
|
||||
<view class="text-[#6A6363] flex-1 text-22rpx leading-32rpx text-right">已售
|
||||
<template v-if="isGroupBuying">
|
||||
{{ teaRoomPackage.sold > 10 ? '10+' : teaRoomPackage.sold }}
|
||||
{{ teaRoomPackage.sold + '+' }}
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ teaRoom.room?.sold > 10 ? '10+' : teaRoom.room?.sold }}
|
||||
@ -285,7 +285,7 @@
|
||||
import type { ITeaSpecialistFuture7DaysResult } from '@/api/types/tea'
|
||||
import { getNext7Days, getTeaRoomBalance, createTeaRoomOrder } from '@/api/tea-room'
|
||||
import { CouponType } from '@/utils/coupon'
|
||||
import { router, randomLabelColor } from '@/utils/tools'
|
||||
import { router, randomLabelColor, previewImage } from '@/utils/tools'
|
||||
import type { IUserInfoVo } from '@/api/types/login'
|
||||
import { useUserStore } from '@/store'
|
||||
import { getTeaRoomDetail, createTeaRoomPackageOrder, getTeaRoomPackageDetail, calculateTeaRoomPrice } from '@/api/tea-room'
|
||||
@ -502,18 +502,30 @@
|
||||
|
||||
uni.$off('chooseCoupon');
|
||||
uni.$on('chooseCoupon', params => {
|
||||
console.log("🚀 ~ params:", params)
|
||||
uni.$off('chooseCoupon')
|
||||
if (type === CouponType.Discount) {
|
||||
selectedCoupon.value = {id: params.coupon.id, name: `${params.coupon.name}减${params.coupon.coupon_price}` }
|
||||
bill.value.coupon = params.coupon.coupon_price
|
||||
selectCouponId.value = params.coupon.id // 这里的ID是在数据表自增的ID,保存下来是为了回显列表的,没有其他作用
|
||||
if (params.coupon) {
|
||||
if (type === CouponType.Discount) {
|
||||
selectedCoupon.value = {id: params.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.id, name: `团购券-${params.coupon?.title}` }
|
||||
bill.value.groupCoupon = params.coupon.coupon_price
|
||||
selectGroupCouponId.value = params.coupon.id // 这里的ID是在数据表自增的ID,保存下来是为了回显列表的,没有其他作用
|
||||
}
|
||||
} else {
|
||||
console.log('gropu')
|
||||
selectedGroupCoupon.value = {id: params.coupon.id, name: `团购券-${params.coupon?.title}` }
|
||||
bill.value.groupCoupon = params.coupon.coupon_price
|
||||
selectGroupCouponId.value = params.coupon.id // 这里的ID是在数据表自增的ID,保存下来是为了回显列表的,没有其他作用
|
||||
// 清空选择
|
||||
if (type === CouponType.Discount) {
|
||||
selectedCoupon.value = {id: 0, name: '' }
|
||||
bill.value.coupon = 0
|
||||
selectCouponId.value = 0
|
||||
} else {
|
||||
selectedGroupCoupon.value = {id: 0, name: '' }
|
||||
bill.value.groupCoupon = 0
|
||||
selectGroupCouponId.value = 0
|
||||
}
|
||||
}
|
||||
|
||||
Detail.handleCalculateTeaRoomPrice()
|
||||
})
|
||||
|
||||
@ -533,7 +545,7 @@
|
||||
toast.info('请选择预定时间')
|
||||
return
|
||||
}
|
||||
|
||||
return false
|
||||
isSubmitting.value = true
|
||||
uni.showLoading({
|
||||
title: '提交中...'
|
||||
@ -615,6 +627,13 @@
|
||||
bill.value.groupCoupon = res.details.group_price // 团购优惠
|
||||
bill.value.total = res.details.order_amount // 订单金额
|
||||
},
|
||||
|
||||
/**
|
||||
* 预览图片
|
||||
*/
|
||||
handlePreviewImage: (e: {index: number, item: any}) => {
|
||||
previewImage(swiperList.value[e.index], swiperList.value)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@ -28,9 +28,9 @@
|
||||
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_sc.png`"></wd-img>
|
||||
</template>
|
||||
</view> -->
|
||||
<view @click="showServicePopup = true" class="flex items-center">
|
||||
<!-- <view @click="showServicePopup = true" class="flex items-center">
|
||||
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_kefu.png`"></wd-img>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</template>
|
||||
</navbar>
|
||||
@ -39,7 +39,7 @@
|
||||
<view class="mt-20rpx mx-30rpx swiper">
|
||||
<view>
|
||||
<wd-swiper value-key="image" height="320rpx"
|
||||
:indicator="{ type: 'dots-bar' }" :list="swiperList" v-model:current="current" mode="aspectFit">
|
||||
:indicator="{ type: 'dots-bar' }" :list="swiperList" v-model:current="current" mode="aspectFit" @click="Room.handlePreviewImage">
|
||||
</wd-swiper>
|
||||
</view>
|
||||
<view class="mt-38rpx flex justify-between">
|
||||
@ -122,7 +122,7 @@
|
||||
|
||||
<!-- 抖音兑换 -->
|
||||
<view v-if="storeType == StoreType.Direct && tab === 2">
|
||||
<dou-yin-excharge :store-id="teaRoomId" @success="Room.handleExchargeSuccess"/>
|
||||
<dou-yin-excharge :store-id="teaRoomId" @success=""/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -152,7 +152,7 @@
|
||||
import type { ITeaRoomDetailResult } from '@/api/types/tea-room'
|
||||
import type {IUserInfoVo } from '@/api/types/login'
|
||||
import { useUserStore } from '@/store'
|
||||
import { router } from '@/utils/tools'
|
||||
import { router, previewImage } from '@/utils/tools'
|
||||
import { StoreType } from '@/utils/tea'
|
||||
import DouYinExcharge from '@/bundle/components/DouYinExcharge.vue'
|
||||
|
||||
@ -401,6 +401,13 @@
|
||||
router.navigateBack().catch(err => {
|
||||
router.switchTab('/pages/index/index')
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 预览图片
|
||||
*/
|
||||
handlePreviewImage: (e: {index: number, item: any}) => {
|
||||
previewImage(swiperList.value[e.index], swiperList.value)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -99,7 +99,7 @@
|
||||
<!-- 轮播图 -->
|
||||
<view class="mx-30rpx">
|
||||
<wd-swiper value-key="image" height="400rpx"
|
||||
:indicator="{ type: 'dots-bar' }" :list="info.image_arr" mode="aspectFit"></wd-swiper>
|
||||
:indicator="{ type: 'dots-bar' }" :list="info.image_arr" mode="aspectFit" @click="Detail.handlePreviewImage"></wd-swiper>
|
||||
</view>
|
||||
|
||||
<!-- 昵称显示 -->
|
||||
@ -362,7 +362,7 @@
|
||||
import type { ITeaSpecialistRewardAmountsResult } from '@/api/types/tea'
|
||||
import { toast } from '@/utils/toast'
|
||||
import { TeaSpecialistLevelValue } from '@/utils/teaSpecialist'
|
||||
import { router } from '@/utils/tools'
|
||||
import { router, previewImage } from '@/utils/tools'
|
||||
import { useUserStore } from '@/store'
|
||||
import type {IUserInfoVo } from '@/api/types/login'
|
||||
|
||||
@ -565,6 +565,13 @@
|
||||
router.navigateBack().catch(err => {
|
||||
router.switchTab('/pages/index/index')
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 预览图片
|
||||
*/
|
||||
handlePreviewImage: (e: {index: number, item: any}) => {
|
||||
previewImage(info.value.image_arr[e.index], info.value.image_arr)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
</template>
|
||||
</view>
|
||||
<view class="flex justify-between items-end">
|
||||
<view class="flex items-center">
|
||||
<view class="flex items-center whitespace-nowrap">
|
||||
<view class="flex items-center mr-14rpx">
|
||||
<price-format color="#FF5951" :first-size="34" :second-size="26" :subscript-size="26" :price="item.price" weight="500"></price-format>
|
||||
<view class="text-[#6A6363] text-22rpx leading-30rpx mt-8rpx">/小时</view>
|
||||
@ -53,20 +53,17 @@
|
||||
<view class="bg-[#818CA9] font-400 text-26rpx text-[#fff] h-40rpx wait2-clear-border">预定</view>
|
||||
</view>
|
||||
|
||||
<!-- 预定状态-维护中 -->
|
||||
<view class="w-108rpx h-52rpx leading-52rpx border-2rpx border-solid border-[#FF5951] rounded-8rpx text-[#FF5951] font-bold text-26rpx text-center" v-if="item.status === RoomStatus.MAINTENANCE">维护中</view>
|
||||
|
||||
<!-- <view class="w-108rpx h-52rpx leading-52rpx border-2rpx border-solid border-[#F29747] rounded-8rpx text-[#F29747] font-bold text-26rpx text-center"
|
||||
@click="RoomList.handleToPage(ReserveServiceCategory.ReserveRoom, item.store_id, item.id, item.price)"
|
||||
v-if="item.status === RoomStatus.IN_USE">
|
||||
使用中
|
||||
</view> -->
|
||||
|
||||
<!-- 使用人数 -->
|
||||
<view class="font-400 text-22rpx text-[#6A6363] leading-32rpx w-200rpx text-right mt-8rpx" v-if="item.people_number">{{ item.people_number }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 团购套餐 -->
|
||||
<view class="flex-1 ml-32rpx flex justify-between items-start h-220rpx relative" v-if="isGroupBuying">
|
||||
<view class="flex-1 ml-32rpx flex justify-between items-start h-220rpx relative" v-if="isGroupBuying" @click="RoomList.handleToPage(ReserveServiceCategory.GroupBuying, item.store_id, item.id, item.price)">
|
||||
<view>
|
||||
<view class="text-28rpx text-[#303133] leading-40rpx line-1 w-420rpx">{{ item.title }}</view>
|
||||
<view class="mt-20rpx flex items-center h-32rpx">
|
||||
@ -74,7 +71,7 @@
|
||||
<wd-tag color="#40AE36" bg-color="#40AE36" plain custom-class="!rounded-4rpx">{{ item.hour }}小时</wd-tag>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="item.introduce" class="text-[#999] text-22rpx leading-30rpx mt-12rpx w-300rpx line-2">{{ item.introduce }}</view>
|
||||
<view class="text-[#999] text-22rpx leading-30rpx mt-12rpx w-300rpx line-2 h-64rpx">适用包间:{{ item.room_name }}</view>
|
||||
<view class="flex mb-52rpx" :class="`${spec ? 'mt-10rpx' : 'mt-55rpx'}`">
|
||||
<view class="mr-14rpx">
|
||||
<price-format color="#FF5951" :first-size="34" :second-size="26"
|
||||
@ -87,11 +84,9 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="absolute bottom-0 right-0">
|
||||
<view class="text-[#6A6363] text-22rpx leading-30rpx">已售 {{ item.sold > 10 ? '10+' : item.sold }}</view>
|
||||
<view
|
||||
class="w-104rpx h-52rpx mt-16rpx text-26rpx font-400 text-[#4C9F44] leading-52rpx text-center border-[2rpx] border-[#4C9F44] rounded-10rpx"
|
||||
@click="RoomList.handleToPage(ReserveServiceCategory.GroupBuying, item.store_id, item.id, item.price)">
|
||||
抢购
|
||||
<view class="text-[#6A6363] text-22rpx leading-30rpx">已售 {{ item.sold + '+' }}</view>
|
||||
<view class="w-104rpx h-52rpx mt-16rpx text-26rpx font-400 text-[#4C9F44] leading-52rpx text-center border-[2rpx] border-[#4C9F44] rounded-10rpx">
|
||||
抢购
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -167,3 +167,12 @@ export function getCurrentDate() {
|
||||
return `${year}-${month}-${day}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 预览图片
|
||||
*/
|
||||
export function previewImage(current: string, urls: string[]) {
|
||||
uni.previewImage({
|
||||
current,
|
||||
urls
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user