【订单】 优化# 商品价格
parent
8522757d3f
commit
28591c62da
|
@ -128,12 +128,23 @@ const handleTimeSlot = (timeSlot: TimeSlotObj[]) => {
|
||||||
const time = new Date() // 时间戳转换成标准日期时间
|
const time = new Date() // 时间戳转换成标准日期时间
|
||||||
const min = time.getMinutes()
|
const min = time.getMinutes()
|
||||||
const startTime = time.getHours() + '' + (min <= 9 ? '0' + min : min) // 获取时分并组合成标准格式(时分)比如 10:30 --> 1030
|
const startTime = time.getHours() + '' + (min <= 9 ? '0' + min : min) // 获取时分并组合成标准格式(时分)比如 10:30 --> 1030
|
||||||
|
// const time = new Date() // 时间戳转换成标准日期时间
|
||||||
|
// const min = time.getMinutes()
|
||||||
|
// const hour = time.getHours()
|
||||||
|
// const currentMinutes = hour * 60 + min
|
||||||
timeSlot.forEach(item => {
|
timeSlot.forEach(item => {
|
||||||
const end = item.endTime.replace(':', '')
|
const end = item.endTime.replace(':', '')
|
||||||
// 只可预约半小时后的时间段
|
// 只可预约半小时后的时间段
|
||||||
item.disabled = Number(startTime) + 50 >= Number(end)
|
item.disabled = Number(startTime) + 50 >= Number(end)
|
||||||
// console.log("startTime: " + startTime);
|
// console.log("startTime: " + startTime);
|
||||||
// console.log("end: " + end);
|
// console.log("end: " + end);
|
||||||
|
|
||||||
|
// const [endHour, endMin] = item.endTime.split(':').map(Number)
|
||||||
|
// // 将结束时间转换为分钟数
|
||||||
|
// const endMinutes = endHour * 60 + endMin
|
||||||
|
|
||||||
|
// // 只可预约半小时后的时间段
|
||||||
|
// item.disabled = currentMinutes + 30 >= endMinutes
|
||||||
})
|
})
|
||||||
return timeSlot
|
return timeSlot
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,8 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="mt-[24rpx]">
|
<view class="mt-[24rpx]">
|
||||||
<price
|
<price
|
||||||
:price="orderData.orderGoods?.goodsPrice"
|
:goodsData="orderData.orderGoods"
|
||||||
|
:priceType="orderData.orderGoods.priceType"
|
||||||
:desc="orderData.orderGoods?.unitName"
|
:desc="orderData.orderGoods?.unitName"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="primary">
|
<view class="primary">
|
||||||
<text class="text-lg font-medium text">{{ price }}</text>
|
<text class="text-lg font-medium text">{{ parsePrice }}</text>
|
||||||
<text class="text-xs text">{{ desc }}</text>
|
<text class="text-xs text">{{ desc }}</text>
|
||||||
<text v-if="scribingPrice" class="text-xs line-through ml-2 text-muted">
|
<text v-if="scribingPrice" class="text-xs line-through ml-2 text-muted">
|
||||||
{{ scribingPrice }}{{ desc }}
|
{{ scribingPrice }}{{ desc }}
|
||||||
|
@ -9,6 +9,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { PriceEnum } from '@/enums/appEnums'
|
||||||
|
import { GOODS } from '@/pages/goods/index.vue'
|
||||||
|
import { computed } from 'vue'
|
||||||
import { ref, withDefaults } from 'vue'
|
import { ref, withDefaults } from 'vue'
|
||||||
|
|
||||||
/** Props Start **/
|
/** Props Start **/
|
||||||
|
@ -17,13 +20,23 @@ const props = withDefaults(
|
||||||
price?: string | number // 价格
|
price?: string | number // 价格
|
||||||
desc?: string // 介绍
|
desc?: string // 介绍
|
||||||
scribingPrice?: string | number // 划线价
|
scribingPrice?: string | number // 划线价
|
||||||
|
goodsData: Partial<GOODS>
|
||||||
|
priceType: PriceEnum
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
price: '',
|
price: '',
|
||||||
desc: '',
|
desc: '',
|
||||||
scribingPrice: ''
|
scribingPrice: '',
|
||||||
|
goodsData: {},
|
||||||
|
priceType: PriceEnum.CUSTOMER_PRICE
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
const parsePrice = computed(() => {
|
||||||
|
const { priceType, goodsData } = props
|
||||||
|
return priceType == PriceEnum.CUSTOMER_PRICE
|
||||||
|
? goodsData.price
|
||||||
|
: goodsData.minPrice + '-' + goodsData.maxPrice
|
||||||
|
})
|
||||||
/** Props End **/
|
/** Props End **/
|
||||||
|
|
||||||
/** Methods Start **/
|
/** Methods Start **/
|
||||||
|
|
|
@ -146,3 +146,7 @@ export const WithdrawStatusMap: Recordable<number, string> = {
|
||||||
[WithdrawStatusEnum.SUCCESS]: '提现成功',
|
[WithdrawStatusEnum.SUCCESS]: '提现成功',
|
||||||
[WithdrawStatusEnum.FAIL]: '提现失败'
|
[WithdrawStatusEnum.FAIL]: '提现失败'
|
||||||
}
|
}
|
||||||
|
export enum PriceEnum {
|
||||||
|
CUSTOMER_PRICE = 0, //固定价格
|
||||||
|
TEACHER_PRICE = 1 // 价格区间
|
||||||
|
}
|
||||||
|
|
|
@ -33,7 +33,11 @@
|
||||||
></u-image>
|
></u-image>
|
||||||
<view class="mt-[20rpx] truncate">{{ item4.name }}</view>
|
<view class="mt-[20rpx] truncate">{{ item4.name }}</view>
|
||||||
<view class="text-primary mt-[10rpx]">
|
<view class="text-primary mt-[10rpx]">
|
||||||
<price :price="item4.price" :desc="item4.unit"></price>
|
<price
|
||||||
|
:goodsData="item4"
|
||||||
|
:priceType="item4.priceType"
|
||||||
|
:desc="item4.unit"
|
||||||
|
></price>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
|
|
|
@ -37,7 +37,8 @@
|
||||||
<view class="flex justify-between padding">
|
<view class="flex justify-between padding">
|
||||||
<view class="text-primary">
|
<view class="text-primary">
|
||||||
<price
|
<price
|
||||||
:price="goodsData.price"
|
:goodsData="goodsData"
|
||||||
|
:priceType="goodsData.priceType"
|
||||||
:desc="goodsData.unit"
|
:desc="goodsData.unit"
|
||||||
:scribingPrice="goodsData.scribingPrice"
|
:scribingPrice="goodsData.scribingPrice"
|
||||||
/>
|
/>
|
||||||
|
@ -257,6 +258,7 @@ import { FieldType } from '@/enums/appEnums'
|
||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
import { useTabs } from '@/hooks/useCoupon'
|
import { useTabs } from '@/hooks/useCoupon'
|
||||||
import { apiRecommendService } from '@/api/store'
|
import { apiRecommendService } from '@/api/store'
|
||||||
|
import { PriceEnum } from '@/enums/appEnums'
|
||||||
|
|
||||||
interface Rule {
|
interface Rule {
|
||||||
intervalTime: number
|
intervalTime: number
|
||||||
|
@ -280,6 +282,9 @@ export type GOODS = {
|
||||||
goods_comment_total: number //评价总量
|
goods_comment_total: number //评价总量
|
||||||
[index: string]: string | number | any
|
[index: string]: string | number | any
|
||||||
rules: Rule[]
|
rules: Rule[]
|
||||||
|
priceType: PriceEnum
|
||||||
|
maxPrice: number
|
||||||
|
minPrice: number
|
||||||
}
|
}
|
||||||
|
|
||||||
type TIME = {
|
type TIME = {
|
||||||
|
@ -304,7 +309,10 @@ const goodsData = reactive<GOODS>({
|
||||||
goods_comment: [],
|
goods_comment: [],
|
||||||
staffList: [],
|
staffList: [],
|
||||||
goods_comment_total: 0,
|
goods_comment_total: 0,
|
||||||
rules: []
|
rules: [],
|
||||||
|
priceType: PriceEnum.CUSTOMER_PRICE,
|
||||||
|
maxPrice: 0,
|
||||||
|
minPrice: 0
|
||||||
})
|
})
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const appStore = useAppStore()
|
const appStore = useAppStore()
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
></u-image>
|
></u-image>
|
||||||
<view class="ml-[20rpx] service-text">
|
<view class="ml-[20rpx] service-text">
|
||||||
<view class="service-text--name truncate">
|
<view class="service-text--name truncate">
|
||||||
{{ orderInfo.orderGoodsDetailVo.goodsName }}
|
{{ orderInfo.orderGoodsDetailVo?.goodsName }}
|
||||||
</view>
|
</view>
|
||||||
<view class="mt-[16rpx]">
|
<view class="mt-[16rpx]">
|
||||||
预约时间: {{ orderInfo.appointTime }} {{ orderInfo.weekDay }}
|
预约时间: {{ orderInfo.appointTime }} {{ orderInfo.weekDay }}
|
||||||
|
|
|
@ -61,7 +61,11 @@
|
||||||
<text class="num">x{{ goodsForm.goods_num }}</text>
|
<text class="num">x{{ goodsForm.goods_num }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="mt-[24rpx]">
|
<view class="mt-[24rpx]">
|
||||||
<price :price="orderData.goodsPrice" :desc="orderData.unitName"></price>
|
<price
|
||||||
|
:goodsData="orderData"
|
||||||
|
:priceType="orderData.priceType"
|
||||||
|
:desc="orderData.unitName"
|
||||||
|
></price>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
|
@ -70,7 +70,8 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="mt-[24rpx]">
|
<view class="mt-[24rpx]">
|
||||||
<price
|
<price
|
||||||
:price="orderData.orderGoods?.goodsPrice"
|
:goodsData="orderData.orderGoods"
|
||||||
|
:priceType="orderData.orderGoods.priceType"
|
||||||
:desc="orderData.orderGoods?.unitName"
|
:desc="orderData.orderGoods?.unitName"
|
||||||
></price>
|
></price>
|
||||||
</view>
|
</view>
|
||||||
|
|
Loading…
Reference in New Issue