修改代码
This commit is contained in:
@ -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<IUserCouponListResult>('/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<any>('/api/UserCoupon/UserCoupinList', data)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -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<number>(0)
|
||||
// 不可用优惠券数量
|
||||
const unUseCoupon = ref<number>(0)
|
||||
|
||||
const groupCouponList = ref<Array<any>>([])
|
||||
const checkedId = ref<number>(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<number>(0) // 门店ID
|
||||
const teaRoomId = ref<number>(0) // 包间ID
|
||||
const couponId = ref<number>(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)
|
||||
}
|
||||
|
||||
@ -10,153 +10,103 @@
|
||||
|
||||
<template>
|
||||
<view class="pb-180rpx">
|
||||
<view>
|
||||
<view>
|
||||
<navbar title="优惠券" custom-class='!bg-[#F6F7F8]'></navbar>
|
||||
</view>
|
||||
|
||||
<view>
|
||||
<view class="coupon-tab">
|
||||
<wd-tabs v-model="tab" swipeable slidable="always" @click="MyCoupon.handleChangeTab" :lazy="false">
|
||||
<wd-tab title="茶室优惠券">
|
||||
<view class="mx-30rpx">
|
||||
<view class="flex">
|
||||
<view v-for="(item, index) in tag" :key="index"
|
||||
@click="MyCoupon.handleChangeTag(item.value)"
|
||||
class="font-400 text-28rpx leading-40rpx w-116rpx h-64rpx flex justify-center items-center border-2rpx border-solid rounded-12rpx mr-20rpx"
|
||||
:class="item.value === currentTag ? ' border-[#4C9F44] bg-[#F0F6EF] text-[#4C9F44]' : 'border-[#fff] bg-[#fff]'">
|
||||
{{ item.label }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="mt-32rpx">
|
||||
<coupon
|
||||
v-for="(item, index) in couponList"
|
||||
:key="item.id"
|
||||
:coupon="item"
|
||||
canUse
|
||||
:showChecked="false"
|
||||
:checked="item.id === checkedId"
|
||||
:onCheck="MyCoupon.handleCouponCheck"
|
||||
:class="index !== couponList.length - 1 ? 'mb-20rpx' : ''"
|
||||
></coupon>
|
||||
</view>
|
||||
</view>
|
||||
</wd-tab>
|
||||
<wd-tab title="茶艺师优惠券">
|
||||
<view class="mx-30rpx">
|
||||
<view class="flex">
|
||||
<view v-for="(item, index) in tag" :key="index"
|
||||
@click="MyCoupon.handleChangeTag(item.value)"
|
||||
class="font-400 text-28rpx leading-40rpx w-116rpx h-64rpx flex justify-center items-center border-2rpx border-solid rounded-12rpx mr-20rpx"
|
||||
:class="item.value === currentTag ? ' border-[#4C9F44] bg-[#F0F6EF] text-[#4C9F44]' : 'border-[#fff] bg-[#fff]'">
|
||||
{{ item.label }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="mt-32rpx">
|
||||
<coupon
|
||||
v-for="(item, index) in couponList"
|
||||
:key="item.id"
|
||||
:coupon="item"
|
||||
canUse
|
||||
:showChecked="false"
|
||||
:checked="item.id === checkedId"
|
||||
:onCheck="MyCoupon.handleCouponCheck"
|
||||
:class="index !== couponList.length - 1 ? 'mb-20rpx' : ''"
|
||||
></coupon>
|
||||
</view>
|
||||
</view>
|
||||
</wd-tab>
|
||||
</wd-tabs>
|
||||
<view class="mt-30rpx">
|
||||
<!-- 优惠券 -->
|
||||
<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">{{ couponList.use.length }}张</text>
|
||||
</view>
|
||||
<view class="mt-28rpx radio">
|
||||
<wd-radio-group v-model="checkedId" size="large" checked-color="#4C9F44">
|
||||
<coupon
|
||||
v-for="(item, index) in couponList.use"
|
||||
:key="item.id"
|
||||
:coupon="item"
|
||||
canUse
|
||||
:showChecked="false"
|
||||
:checked="item.id === checkedId"
|
||||
:onCheck="Coupons.handleCheck"
|
||||
couponType="coupon"
|
||||
:class="index !== couponList.use.length - 1 ? 'mb-20rpx' : ''"
|
||||
></coupon>
|
||||
</wd-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
<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">{{ couponList.no_use.length }}张</text>
|
||||
</view>
|
||||
<view class="mt-28rpx radio">
|
||||
<wd-radio-group v-model="checkedId" size="large" checked-color="#4C9F44">
|
||||
<coupon
|
||||
v-for="(item, index) in couponList.no_use"
|
||||
:key="item.id"
|
||||
:coupon="item"
|
||||
:canUse="false"
|
||||
:showChecked="false"
|
||||
couponType="coupon"
|
||||
:checked="item.id === checkedId"
|
||||
:onCheck="Coupons.handleCheck"
|
||||
:class="index !== couponList.no_use.length - 1 ? 'mb-20rpx' : ''"
|
||||
></coupon>
|
||||
</wd-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {ref} from 'vue'
|
||||
import Coupon from '@/components/coupon/Coupon.vue'
|
||||
import GroupCoupon from '@/components/coupon/GroupCoupon.vue'
|
||||
import { getMyCoupons } from '@/api/user'
|
||||
import { getCoupons } from '@/api/user'
|
||||
import type { IUserCouponListResult } from '@/api/types/user'
|
||||
|
||||
//
|
||||
const tab = ref<number>(0)
|
||||
const tag = ref<Array<any>>([
|
||||
{label: '全部', value: 0 },
|
||||
{label: '已使用', value: 1 },
|
||||
{label: '快过期', value: 3 },
|
||||
])
|
||||
const currentTab = ref<number>(0)
|
||||
const currentTag = ref<number>(0)
|
||||
|
||||
const couponType = ref<number>(2) // couponType 1:优惠券 2:团购券
|
||||
const OSS = inject('OSS')
|
||||
|
||||
const couponList = ref<any[]>([])
|
||||
const checkedId = ref<number>(0)
|
||||
|
||||
const unCouponList = ref([
|
||||
{ id: 1, amount: 20, limit: 100, expire: '2024.08.20' },
|
||||
{ id: 2, amount: 10, limit: 50, expire: '2024.08.25' }
|
||||
])
|
||||
|
||||
onLoad((args) => {
|
||||
if (args.type) {
|
||||
couponType.value = args.type
|
||||
}
|
||||
|
||||
MyCoupon.handleInit()
|
||||
const couponList = ref<IUserCouponListResult>({
|
||||
no_use: [],
|
||||
use: []
|
||||
})
|
||||
|
||||
const MyCoupon = {
|
||||
// 可用优惠券数量
|
||||
const useCoupon = ref<number>(0)
|
||||
// 不可用优惠券数量
|
||||
const unUseCoupon = ref<number>(0)
|
||||
|
||||
const checkedId = ref<number>(0)
|
||||
|
||||
onLoad(async (args) => {
|
||||
// 获取到包间ID和预定了几个小时
|
||||
await Coupons.handleInitCoupon()
|
||||
})
|
||||
|
||||
const Coupons = {
|
||||
/**
|
||||
* 初始化优惠券列表
|
||||
* @param id 包间ID
|
||||
* @param numbers 预定时长
|
||||
*/
|
||||
handleInit: async () => {
|
||||
const res: any = await getMyCoupons({status: currentTag.value, type_id: currentTab.value == 0 ? 2 : 1})
|
||||
handleInitCoupon: async () => {
|
||||
const res = await getCoupons({type_id: 3, price: 0}) // 1茶艺师 2茶室 3 个人中心
|
||||
// couponList.value = res
|
||||
useCoupon.value = res.count.yes_use
|
||||
unUseCoupon.value = res.count.no_use
|
||||
|
||||
if (Array.isArray(res)) {
|
||||
res.map((res) => {
|
||||
couponList.value.push({
|
||||
id: res.coupon_id,
|
||||
coupon_price: res.userCouponType[0].coupon_price,
|
||||
use_price: res.userCouponType[0].use_price,
|
||||
title: res.userCouponType[0].title,
|
||||
effect_time: res.userCouponType[0].effect_time,
|
||||
user_coupon_id: res.coupon_id,
|
||||
expire: res.expire
|
||||
})
|
||||
})
|
||||
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)
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 切换tab
|
||||
* @param item 切换项
|
||||
*/
|
||||
handleChangeTab: (item: {index: number}) => {
|
||||
currentTab.value = item.index
|
||||
currentTag.value = 0
|
||||
couponList.value = []
|
||||
MyCoupon.handleInit()
|
||||
},
|
||||
handleCheck: () => {
|
||||
|
||||
/**
|
||||
* 切换tag
|
||||
* @param item 切换项
|
||||
*/
|
||||
handleChangeTag: (item: number) => {
|
||||
currentTag.value = item
|
||||
couponList.value = []
|
||||
MyCoupon.handleInit()
|
||||
},
|
||||
|
||||
/**
|
||||
* 选择优惠券-保留这个函数,暂时用不着
|
||||
* @param id 切换项
|
||||
*/
|
||||
handleCouponCheck: (id: number) => {
|
||||
checkedId.value = id
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
182
src/bundle/coupon/my-coupon_bck.vue
Normal file
182
src/bundle/coupon/my-coupon_bck.vue
Normal file
@ -0,0 +1,182 @@
|
||||
<route lang="jsonc" type="page">
|
||||
{
|
||||
"needLogin": true,
|
||||
"layout": "default",
|
||||
"style": {
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}
|
||||
</route>
|
||||
|
||||
<template>
|
||||
<view class="pb-180rpx">
|
||||
<view>
|
||||
<navbar title="优惠券" custom-class='!bg-[#F6F7F8]'></navbar>
|
||||
</view>
|
||||
|
||||
<view>
|
||||
<view class="coupon-tab">
|
||||
<wd-tabs v-model="tab" swipeable slidable="always" @click="MyCoupon.handleChangeTab" :lazy="false">
|
||||
<wd-tab title="茶室优惠券">
|
||||
<view class="mx-30rpx">
|
||||
<view class="flex">
|
||||
<view v-for="(item, index) in tag" :key="index"
|
||||
@click="MyCoupon.handleChangeTag(item.value)"
|
||||
class="font-400 text-28rpx leading-40rpx w-116rpx h-64rpx flex justify-center items-center border-2rpx border-solid rounded-12rpx mr-20rpx"
|
||||
:class="item.value === currentTag ? ' border-[#4C9F44] bg-[#F0F6EF] text-[#4C9F44]' : 'border-[#fff] bg-[#fff]'">
|
||||
{{ item.label }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="mt-32rpx">
|
||||
<coupon
|
||||
v-for="(item, index) in couponList"
|
||||
:key="item.id"
|
||||
:coupon="item"
|
||||
canUse
|
||||
:showChecked="false"
|
||||
:checked="item.id === checkedId"
|
||||
:onCheck="MyCoupon.handleCouponCheck"
|
||||
:class="index !== couponList.length - 1 ? 'mb-20rpx' : ''"
|
||||
></coupon>
|
||||
</view>
|
||||
</view>
|
||||
</wd-tab>
|
||||
<wd-tab title="茶艺师优惠券">
|
||||
<view class="mx-30rpx">
|
||||
<view class="flex">
|
||||
<view v-for="(item, index) in tag" :key="index"
|
||||
@click="MyCoupon.handleChangeTag(item.value)"
|
||||
class="font-400 text-28rpx leading-40rpx w-116rpx h-64rpx flex justify-center items-center border-2rpx border-solid rounded-12rpx mr-20rpx"
|
||||
:class="item.value === currentTag ? ' border-[#4C9F44] bg-[#F0F6EF] text-[#4C9F44]' : 'border-[#fff] bg-[#fff]'">
|
||||
{{ item.label }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="mt-32rpx">
|
||||
<coupon
|
||||
v-for="(item, index) in couponList"
|
||||
:key="item.id"
|
||||
:coupon="item"
|
||||
canUse
|
||||
:showChecked="false"
|
||||
:checked="item.id === checkedId"
|
||||
:onCheck="MyCoupon.handleCouponCheck"
|
||||
:class="index !== couponList.length - 1 ? 'mb-20rpx' : ''"
|
||||
></coupon>
|
||||
</view>
|
||||
</view>
|
||||
</wd-tab>
|
||||
</wd-tabs>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {ref} from 'vue'
|
||||
import Coupon from '@/components/coupon/Coupon.vue'
|
||||
import GroupCoupon from '@/components/coupon/GroupCoupon.vue'
|
||||
import { getCoupons } from '@/api/user'
|
||||
|
||||
//
|
||||
const tab = ref<number>(0)
|
||||
const tag = ref<Array<any>>([
|
||||
{label: '全部', value: 0 },
|
||||
{label: '已使用', value: 1 },
|
||||
{label: '快过期', value: 3 },
|
||||
])
|
||||
const currentTab = ref<number>(0)
|
||||
const currentTag = ref<number>(0)
|
||||
|
||||
const couponType = ref<number>(2) // couponType 1:优惠券 2:团购券
|
||||
const OSS = inject('OSS')
|
||||
|
||||
const couponList = ref<any[]>([])
|
||||
const checkedId = ref<number>(0)
|
||||
|
||||
const unCouponList = ref([
|
||||
{ id: 1, amount: 20, limit: 100, expire: '2024.08.20' },
|
||||
{ id: 2, amount: 10, limit: 50, expire: '2024.08.25' }
|
||||
])
|
||||
|
||||
onLoad((args) => {
|
||||
if (args.type) {
|
||||
couponType.value = args.type
|
||||
}
|
||||
|
||||
MyCoupon.handleInit()
|
||||
})
|
||||
|
||||
const MyCoupon = {
|
||||
/**
|
||||
* 初始化优惠券列表
|
||||
*/
|
||||
handleInit: async () => {
|
||||
const res: any = await getCoupons({type_id: 3, price: 0 }) // 1茶艺师 2茶室 3 个人中心
|
||||
|
||||
if (Array.isArray(res)) {
|
||||
res.map((res) => {
|
||||
couponList.value.push({
|
||||
id: res.coupon_id,
|
||||
coupon_price: res.userCouponType[0].coupon_price,
|
||||
use_price: res.userCouponType[0].use_price,
|
||||
title: res.userCouponType[0].title,
|
||||
effect_time: res.userCouponType[0].effect_time,
|
||||
user_coupon_id: res.coupon_id,
|
||||
expire: res.expire
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 切换tab
|
||||
* @param item 切换项
|
||||
*/
|
||||
handleChangeTab: (item: {index: number}) => {
|
||||
currentTab.value = item.index
|
||||
currentTag.value = 0
|
||||
couponList.value = []
|
||||
MyCoupon.handleInit()
|
||||
},
|
||||
|
||||
/**
|
||||
* 切换tag
|
||||
* @param item 切换项
|
||||
*/
|
||||
handleChangeTag: (item: number) => {
|
||||
currentTag.value = item
|
||||
couponList.value = []
|
||||
MyCoupon.handleInit()
|
||||
},
|
||||
|
||||
/**
|
||||
* 选择优惠券-保留这个函数,暂时用不着
|
||||
* @param id 切换项
|
||||
*/
|
||||
handleCouponCheck: (id: number) => {
|
||||
checkedId.value = id
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: $cz-page-background;
|
||||
}
|
||||
|
||||
.coupon-tab {
|
||||
:deep() {
|
||||
.wd-tabs,
|
||||
.wd-tabs__nav,
|
||||
.wd-tabs__line {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.wd-tabs__nav-item.is-active {
|
||||
font-size: 32rpx !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -15,7 +15,7 @@
|
||||
</view>
|
||||
|
||||
<!-- 待审核 -->
|
||||
<view class="mt-84rpx" v-if="status === 0">
|
||||
<view class="mt-84rpx" v-if="status == 0">
|
||||
<view class="flex justify-center items-center">
|
||||
<wd-img width="300rpx" height="278rpx" :src="`${OSS}images/settle_in/settle_in_image2.png`"/>
|
||||
</view>
|
||||
@ -26,25 +26,14 @@
|
||||
</view>
|
||||
|
||||
<!-- 申请成功提示 -->
|
||||
<view class="mt-84rpx" v-if="tips">
|
||||
<view v-if="isSuccess">
|
||||
<view class="flex justify-center items-center">
|
||||
<wd-img width="300rpx" height="278rpx" :src="`${OSS}images/settle_in/settle_in_image1.png`"/>
|
||||
</view>
|
||||
<view class="mt-60rpx text-center">
|
||||
<view class="text-36rpx leading-50rpx text-#303133">申请加盟合作成功</view>
|
||||
<view class="font-400 text-28rpx leading-42rpx text-#303133 mt-20rpx">请登录商家端查看信息</view>
|
||||
<view class="font-400 text-26rpx leading-42rpx text-#9CA3AF mt-28rpx mx-102rpx">如您遇到任何问题,可随时联系客服热线 400-6245-123,我们将竭诚为您服务!</view>
|
||||
</view>
|
||||
<view class="mt-84rpx" v-if="status == 1">
|
||||
<view class="flex justify-center items-center">
|
||||
<wd-img width="300rpx" height="278rpx" :src="`${OSS}images/settle_in/settle_in_image1.png`"/>
|
||||
</view>
|
||||
<view v-else>
|
||||
<view class="flex justify-center items-center">
|
||||
<wd-img width="300rpx" height="278rpx" :src="`${OSS}images/settle_in/settle_in_image2.png`"/>
|
||||
</view>
|
||||
<view class="mt-60rpx text-center">
|
||||
<view class="text-36rpx leading-50rpx text-#303133">您的信息已成功提交</view>
|
||||
<view class="font-400 text-28rpx leading-42rpx text-#303133 mt-20rpx text-#9CA3AF">目前正在审核中,请您耐心等待</view>
|
||||
</view>
|
||||
<view class="mt-60rpx text-center">
|
||||
<view class="text-36rpx leading-50rpx text-#303133">申请加盟合作成功</view>
|
||||
<view class="font-400 text-28rpx leading-42rpx text-#303133 mt-20rpx">请登录【茶址商户端】查看信息</view>
|
||||
<view class="font-400 text-26rpx leading-42rpx text-#9CA3AF mt-28rpx mx-102rpx">如您遇到任何问题,可随时联系客服,我们将竭诚为您服务!</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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<number>(2) // couponType 1:优惠券 2:团购券
|
||||
|
||||
@ -67,21 +68,17 @@
|
||||
const groupCouponList = ref<Array<any>>([])
|
||||
const checkedId = ref<number>(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<number>(0) // 门店ID
|
||||
const teaRoomId = ref<number>(0) // 包间ID
|
||||
const couponId = ref<number>(0) // 选中的优惠券ID
|
||||
|
||||
// 可用优惠券数量
|
||||
const useCoupon = ref<number>(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()
|
||||
|
||||
@ -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" >
|
||||
<view class="tea-specialist-time absolute z-3 top-6rpx left-0 bg-[#4C9F44] text-[#fff] font-400 text-18rpx flex items-center justify-center">
|
||||
{{ item.state == 0 ? '可约' : '工作中' }}
|
||||
<text v-if="item.state == 0">可约</text>
|
||||
<text v-if="item.state == 1">工作中</text>
|
||||
<text v-if="item.state == 2">不可约</text>
|
||||
</view>
|
||||
<view class="mr-28rpx relative z-2" @click="List.handlePreviewImage(item.image)">
|
||||
<wd-img width="200rpx" height="200rpx" :src="item.image" mode="aspectFill"></wd-img>
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="mb-20rpx" @click="onCheck(coupon.user_coupon_id)">
|
||||
<view class="mb-20rpx" @click="onCheck(coupon.id)">
|
||||
<view class="coupon h-210rpx flex items-center">
|
||||
<view class="w-260rpx h-[100%] rounded-l-16rpx rounded-tr-0 rounded-br-0 flex flex-col items-center justify-center" :class="canUse ? 'bg-[#4C9F44]' : 'bg-[#F2F2F2]'">
|
||||
<view class="flex" :class="canUse ? 'text-[#fff]' : 'text-[#BFC2CC]'">
|
||||
@ -14,7 +14,7 @@
|
||||
<view class="mt-40rpx text-[#909399] text-24rpx leading-34rpx" :class="canUse ? 'text-[#909399]' : 'text-[#BFC2CC]'">有效期至 {{ coupon.effect_time }}</view>
|
||||
</view>
|
||||
<view class="h-100% mr-70rpx mt-58rpx" v-if="showChecked">
|
||||
<wd-radio :value="coupon.user_coupon_id" shape="dot" :disabled="!canUse"></wd-radio>
|
||||
<wd-radio :value="coupon.id" shape="dot" :disabled="!canUse"></wd-radio>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -176,6 +176,7 @@
|
||||
<text v-if="order.order_status === TeaSpecialistOrderStatus.Pending" class="text-[#FF5951]">待接单</text>
|
||||
<text v-if="order.order_status >= TeaSpecialistOrderStatus.SpecialistRefund && order.order_status <= TeaSpecialistOrderStatus.CustomerRefundAfterArrive" class="text-[#606266]">已退款</text>
|
||||
<text v-if="order.order_status === TeaSpecialistOrderStatus.Accepted">已预约</text>
|
||||
<text v-if="order.order_status === TeaSpecialistOrderStatus.Departed">已出发</text>
|
||||
<text v-if="order.order_status === TeaSpecialistOrderStatus.Arrived">服务中</text>
|
||||
<text v-if="order.order_status === TeaSpecialistOrderStatus.Completed" class="text-[#606266]">完成</text>
|
||||
<text v-if="order.order_status === TeaSpecialistOrderStatus.Cancelled" class="text-[#C9C9C9]">订单取消</text>
|
||||
|
||||
@ -225,6 +225,15 @@
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "coupon/my-coupon_bck",
|
||||
"type": "page",
|
||||
"needLogin": true,
|
||||
"layout": "default",
|
||||
"style": {
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "demo/index",
|
||||
"type": "page",
|
||||
|
||||
@ -9,14 +9,14 @@
|
||||
}</route>
|
||||
|
||||
<template>
|
||||
<view class="home-bg">
|
||||
<view class="">
|
||||
<!-- 领取优惠券 -->
|
||||
<wd-overlay :show="showCoupon" @click="showCoupon = false">
|
||||
<view class="flex flex-col justify-center items-center h-100%">
|
||||
<view class="w-652rpx h-590rpx relative" >
|
||||
<wd-img :src="`${OSS}images/home/home_image10.png`" width="100%" height="100%"></wd-img>
|
||||
<view class="absolute top-200rpx left-1/2 transform -translate-x-1/2 flex flex-col items-center">
|
||||
<view class="mt-220rpx " @click.stop="showCoupon = false">
|
||||
<view class="mt-220rpx" @click.stop="showCoupon = false">
|
||||
<view class="h-90rpx relative">
|
||||
<wd-img :src="`${OSS}images/home/home_image9.png`" width="342rpx" height="90rpx"></wd-img>
|
||||
<view class="absolute top-20rpx left-1/2 transform -translate-x-1/2 flex flex-col items-center" @click.stop="Index.handleToGetCoupon">立即领取</view>
|
||||
@ -31,8 +31,8 @@
|
||||
</view>
|
||||
</wd-overlay>
|
||||
|
||||
<view class="home-bg w-[100%] fixed top-0 left-0 z-100">
|
||||
<wd-navbar safeAreaInsetTop :bordered="false" custom-style="background-color: transparent !important;">
|
||||
<view class="w-[100%] fixed top-0 left-0 z-100">
|
||||
<wd-navbar safeAreaInsetTop :bordered="false" custom-style="background-color: #F9FAFB !important;">
|
||||
<template #left>
|
||||
<view class="flex items-center line-1 w-130rpx" @click="Index.handleToCity">
|
||||
<view class="mr-10rpx font-400 leading-44rpx text-32rpx pl-10rpx line-1">{{ city || LOCATION_DEFAULT_CITY }}</view>
|
||||
@ -41,7 +41,7 @@
|
||||
</template>
|
||||
<template #title>
|
||||
<view class="search-box flex items-center ml-26rpx" @click="Index.handleToSearch">
|
||||
<wd-search placeholder="搜索茶址名称" hide-cancel disabled :placeholder-left="true"
|
||||
<wd-search placeholder="搜索高端茶室" hide-cancel disabled :placeholder-left="true"
|
||||
placeholderStyle="text-align:left;padding-left: 24rpx;line-heigt: 44rpx;color: #C9C9C9; font-size: 32rpx;font-weight: normal;">
|
||||
</wd-search>
|
||||
</view>
|
||||
@ -52,22 +52,27 @@
|
||||
<view :style="{ paddingTop: navbarHeight + 'px' }">
|
||||
<view class="mt-32rpx mx-30rpx">
|
||||
<wd-swiper
|
||||
height="240rpx"
|
||||
height="320rpx"
|
||||
indicatorPosition="bottom-left"
|
||||
:indicator="{ type: 'dots-bar' }"
|
||||
:list="swiperList"
|
||||
v-model:current="current"
|
||||
mode="aspectFit"
|
||||
@click="Index.handleBanner"></wd-swiper>
|
||||
@click="Index.handlePreviewImage"
|
||||
></wd-swiper>
|
||||
</view>
|
||||
|
||||
<view class="mt-40rpx flex items-center h-36rpx mx-30rpx">
|
||||
<wd-img width="160rpx" height="36rpx" :src="`${OSS}images/home/home_image1.png`" mode="aspectFit" />
|
||||
<text class="text-22rpx leading-32rpx text-[#818CA9] ml-36rpx">更多茶艺师点击预约</text>
|
||||
<text class="text-22rpx leading-32rpx text-[#818CA9] ml-36rpx">甄选茗师</text>
|
||||
<text class="text-22rpx leading-32rpx text-[#818CA9] ml-10rpx">·</text>
|
||||
<text class="text-22rpx leading-32rpx text-[#818CA9] ml-10rpx">商务雅趣</text>
|
||||
<text class="text-22rpx leading-32rpx text-[#818CA9] ml-10rpx">·</text>
|
||||
<text class="text-22rpx leading-32rpx text-[#818CA9] ml-10rpx">尊享奉茶</text>
|
||||
</view>
|
||||
|
||||
<view class="mt-16rpx relative w-690rpx h-180rpx mx-30rpx" @click="router.navigateTo(`/bundle_b/pages/tea-specialist/list`)">
|
||||
<wd-img width="690rpx" height="180rpx" :src="`${OSS}images/home/home_image7.png`" mode="scaleToFill" />
|
||||
<view class="mt-16rpx relative w-690rpx h-224rpx mx-30rpx" @click="router.navigateTo(`/bundle_b/pages/tea-specialist/list`)">
|
||||
<wd-img width="690rpx" height="224rpx" :src="`${OSS}images/home/home_image14.png`" mode="scaleToFill" />
|
||||
</view>
|
||||
|
||||
<!-- <view class="relative mt-40rpx h-44rpx mx-30rpx">
|
||||
@ -83,50 +88,67 @@
|
||||
<wd-img width="22rpx" height="18.06rpx" :src="`${OSS}icon/icon_arrow_right.png`" mode="aspectFit" />
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
|
||||
<view class="mx-30rpx mt-36rpx mb-10rpx">
|
||||
<scroll-view class="w-[100%] whitespace-nowrap " :scroll-x="true" :show-scrollbar="false" :enhanced="true">
|
||||
<!-- <view class="scroll-item text-26rpx text-#333 mr-16rpx" :class="distance === 1 ? 'active' : ''" @click="Index.handleSort('distance')">距离优先</view> -->
|
||||
<view class="scroll-item text-26rpx text-#333 mr-16rpx" :class="sort.sales === 1 ? 'active' : ''" @click="Index.handleSort('sales')">销量优先</view>
|
||||
<view class="scroll-item text-26rpx text-#333 mr-16rpx" :class="sort.open === 1 ? 'active' : ''" @click="Index.handleSort('open')">24小时营业</view>
|
||||
<view class="scroll-item text-26rpx text-#333 mr-16rpx" :class="sort.use === 1 ? 'active' : ''" @click="Index.handleSort('use')">常去</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<view>
|
||||
<mescroll-body @init="mescrollInit" :down="downOption" @down="downCallback" :up="upOption" @up="Index.upCallback" top="28rpx"
|
||||
:fixed="true">
|
||||
<view class="relative p-20rp mb-24rpx" v-for="(item, index) in list" :key="index" @click="Index.handleToReserveRoom(item.id, item.operation_type)">
|
||||
<view class="absolute top--28rpx left-0 z-1" v-if="item.operation_type == 1">
|
||||
<!-- <view class="absolute top--28rpx left-0 z-1" v-if="item.operation_type == 1">
|
||||
<wd-img width="110rpx" height="110rpx" :src="`${OSS}images/home/home_image6.png`"/>
|
||||
</view>
|
||||
|
||||
</view> -->
|
||||
<view class="mx-30rpx p-30rpx flex bg-white rounded-10rpx">
|
||||
<wd-img width="200rpx" height="200rpx" :src="item.image" radius="10rpx" />
|
||||
<view class="relative">
|
||||
<wd-img width="200rpx" height="200rpx" :src="item.image" radius="10rpx" />
|
||||
<view class="bg-#34C759 text-#fff text-center w-200rpx font-700 text-20rpx absolute bottom-0 left-0 right-0 hour" v-if="item.operation_type == 1">24小时营业</view>
|
||||
</view>
|
||||
<view class="flex-1 ml-28rpx flex justify-between line-1 items-start relative">
|
||||
<view class="line-1">
|
||||
<view class="font-bold text-30rpx leading-42rpx line-1">
|
||||
{{ item.name }}
|
||||
</view>
|
||||
<view class="flex items-center mt-12rpx leading-34rpx">
|
||||
<view class="font-400 text-[#F29747] text-24rpx mr-18rpx" v-if="item.operation_type == 1">半年预约{{ item.half_year_nums > 300 ? item.half_year_nums + '+' : item.half_year_nums }}</view>
|
||||
<view class="font-400 bg-[#F3F3F3] text-[#818CA9] text-22rpx px-8rpx rounded-4rpx">刚有人预约了</view>
|
||||
</view>
|
||||
<view class="flex items-center mt-12rpx leading-34rpx">
|
||||
<view class="font-400 text-[#606266] text-24rpx mr-10rpx">
|
||||
营业时间:{{ item.start_time }}-{{ item.end_time }}
|
||||
<view class="flex items-center justify-between">
|
||||
<view class="font-bold text-30rpx leading-42rpx line-1 w-400rpx">
|
||||
{{ item.name }}
|
||||
</view>
|
||||
<view class="font-400 bg-[#FFEEED] text-[#FF5951] text-22rpx px-4rpx rounded-4rpx border-[#F2E2E1]" v-if="item.shop_status == 0">
|
||||
<view class="text-24rpx text-[#92928C] font-400 mt-12rpx ml-20rpx">距您{{ item.distance }}</view>
|
||||
</view>
|
||||
|
||||
<view class="flex items-center mt-20rpx leading-34rpx">
|
||||
<view class="font-400 bg-#FFF3E0 text-[#F29747] text-24rpx mr-18rpx px-20rpx py-10rpx rounded-8rpx" v-if="item.operation_type == 1">半年预约{{ item.half_year_nums > 300 ? '300+' : item.half_year_nums }}</view>
|
||||
<view class="font-400 bg-[#E8F5E9] text-[#2E7D32] text-22rpx px-8rpx py-10rpx rounded-8rpx">刚有人预约</view>
|
||||
</view>
|
||||
<view class="flex items-center mt-12rpx leading-34rpx">
|
||||
<view class="font-400 text-[#606266] text-24rpx mr-10rpx flex items-center">
|
||||
<wd-img width="26rpx" height="26rpx" :src="`${OSS}icon/icon_time3.png`" mode="aspectFit" />
|
||||
<view class="ml-10rpx">
|
||||
{{ item.start_time }}-{{ item.end_time }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="font-400 bg-[#FFEEED] text-[#FF5951] text-22rpx px-4rpx rounded-8rpx border-[#F2E2E1]" v-if="item.shop_status == 0">
|
||||
打烊了
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex items-center mt-20rpx">
|
||||
<wd-img width="26rpx" height="26rpx" :src="`${OSS}icon/icon_location.png`"
|
||||
<wd-img width="26rpx" height="26rpx" :src="`${OSS}icon/icon_location5.png`"
|
||||
mode="aspectFit" />
|
||||
<view class="ml-4rpx line-1 font-400 text-22rpx text-[#606266] leading-32rpx w-175rpx">
|
||||
<view class="ml-4rpx line-1 font-400 text-22rpx text-[#606266] leading-32rpx w-300rpx">
|
||||
{{ item.address }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="absolute bottom-0 right-0">
|
||||
<view class="flex justify-end">
|
||||
<view class="bg-[#4C9F44] w-72rpx h-40rpx rounded-18rpx flex items-center justify-center">
|
||||
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_add.png`"
|
||||
mode="aspectFit" />
|
||||
<!-- <view class="flex justify-end">
|
||||
<view class="bg-[#34C759] w-64rpx h-64rpx rounded-64rpx flex items-center justify-center add-box-shadow">
|
||||
<wd-icon name="add" color="#fff" size="20rpx" custom-style="font-weight: bold;" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="text-24rpx text-[#92928C] font-400 mt-12rpx">距您{{ item.distance }}</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -138,7 +160,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { router } from '@/utils/tools'
|
||||
import { router, previewImage } from '@/utils/tools'
|
||||
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
|
||||
import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js"
|
||||
import { LOCATION_DENY_TIME_KEY, handleEnsureLocationAuthHooks, LOCATION_DEFAULT_CITY, handleGetLocationCity, LOCATION_CITY_KEY, handleForceGetLocation } from '@/hooks/useLocation'
|
||||
@ -170,6 +192,12 @@
|
||||
const keywords = ref<string>('')
|
||||
const list = ref<Array<any>>([])
|
||||
const city_id = ref<number>(0)
|
||||
const distance = ref<number>(0)
|
||||
const sort = ref({
|
||||
sales: 0, // 销量优先
|
||||
open: 0, // 24小时
|
||||
use: 0, // 常去
|
||||
})
|
||||
|
||||
let lastLocation = { lat: 0, lng: 0 }
|
||||
const canLocation = ref<boolean>(false)
|
||||
@ -266,7 +294,9 @@
|
||||
longitude: longitude.value,
|
||||
search: keywords.value,
|
||||
user_id: userId,
|
||||
city_area_id: city_id.value || 0
|
||||
city_area_id: city_id.value || 0,
|
||||
// 合并排序条件
|
||||
...sort.value
|
||||
}
|
||||
|
||||
uni.showLoading({ title: '加载中...' })
|
||||
@ -395,17 +425,47 @@
|
||||
|
||||
console.log("🚀 ~ e:", e)
|
||||
// const index = e.currentTarget.dataset.index
|
||||
}
|
||||
},
|
||||
|
||||
handleSort(type: 'distance' | 'sales' | 'open' | 'use') {
|
||||
const userStore = useUserStore()
|
||||
const userId = userStore.userInfo?.id
|
||||
console.log("🚀 ~ userId:", userId)
|
||||
if (type === 'use' && !userId) {
|
||||
toast.info('请先登录账号')
|
||||
router.navigateTo('/pages/login/login', 100)
|
||||
return
|
||||
}
|
||||
|
||||
if (type === 'distance') {
|
||||
distance.value = distance.value === 1 ? 0 : 1
|
||||
} else {
|
||||
if (sort.value[type] === 1) {
|
||||
sort.value[type] = 0
|
||||
} else {
|
||||
sort.value[type] = 1
|
||||
}
|
||||
console.log("🚀 ~ sort.value:", sort.value)
|
||||
Index.handleResetSearch()
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 预览图片
|
||||
*/
|
||||
handlePreviewImage: (e: {index: number, item: any}) => {
|
||||
previewImage(swiperList.value[e.index], swiperList.value)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: $cz-page-background;
|
||||
background-color: #F9FAFB;
|
||||
}
|
||||
|
||||
.home-bg {
|
||||
background-color: $cz-page-background;
|
||||
background-color: #F9FAFB;
|
||||
background-image: url(#{$OSS}images/home/home_bg.png);
|
||||
background-size: 100%;
|
||||
background-repeat: no-repeat;
|
||||
@ -425,7 +485,7 @@ page {
|
||||
}
|
||||
|
||||
.wd-search__block {
|
||||
background-color: #fff !important;
|
||||
background-color: #F3F4F6 !important;
|
||||
}
|
||||
|
||||
.wd-search__input {
|
||||
@ -449,4 +509,24 @@ page {
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
.scroll-item {
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
background-color: #fff;
|
||||
border: 2rpx solid #E5E7EB;
|
||||
border-radius: 20rpx;
|
||||
padding: 16rpx 32rpx;
|
||||
}
|
||||
|
||||
.active {
|
||||
border: 2rpx solid #34C759;
|
||||
color: #34C759;
|
||||
}
|
||||
|
||||
.hour {
|
||||
height: 44rpx;
|
||||
line-height: 44rpx;
|
||||
border-radius: 0 0 16rpx 16rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -53,8 +53,7 @@
|
||||
<!-- 余额显示 -->
|
||||
<view class="mt-16rpx mx-30rpx flex justify-between">
|
||||
<view class="flex items-center">
|
||||
<!-- <view class="w-160rpx text-[#303133] text-center" @click="router.navigateTo('/bundle/coupon/my-coupon')"> -->
|
||||
<view class="w-160rpx text-[#303133] text-center">
|
||||
<view class="w-160rpx text-[#303133] text-center" @click="router.navigateTo('/bundle/coupon/my-coupon')">
|
||||
<view class="font-bold text-36rpx leading-50rpx"> {{ isLogin ? user.coupon_count : '- -' }}</view>
|
||||
<view class="text-24rpx leading-34rpx">优惠券</view>
|
||||
</view>
|
||||
@ -347,6 +346,7 @@
|
||||
if (isLogin.value) {
|
||||
// 获取用户详情信息接口
|
||||
getUserInfo().then(res => {
|
||||
//@ts-ignore
|
||||
user.value = res
|
||||
if (res.member === 1) {
|
||||
isVip.value = true
|
||||
|
||||
Reference in New Issue
Block a user