feat: 商品类型的改动commodityTypeCode改为orderType

This commit is contained in:
2026-03-26 22:45:35 +08:00
parent 0b33727815
commit 2ed4373a8f
6 changed files with 28 additions and 27 deletions

View File

@@ -7,7 +7,7 @@
:shadow="false" :shadow="false"
> >
<template #title> <template #title>
{{ GOODS_TYPE[orderData.commodityTypeCode] }} {{ GOODS_TYPE[orderData.orderType] }}
</template> </template>
</TopNavBar> </TopNavBar>
@@ -18,7 +18,7 @@
<view class="border-box bg-white p-12 rounded-12 mb-12"> <view class="border-box bg-white p-12 rounded-12 mb-12">
<!-- 酒店类型入住离店日期部分 --> <!-- 酒店类型入住离店日期部分 -->
<DateRangeSection <DateRangeSection
v-if="orderData.commodityTypeCode === '0'" v-if="orderData.orderType === 0"
:selectedDate="selectedDate" :selectedDate="selectedDate"
:showBtn="true" :showBtn="true"
@click="navigateToDetail(orderData)" @click="navigateToDetail(orderData)"
@@ -64,7 +64,7 @@
<!-- 非酒店类型 --> <!-- 非酒店类型 -->
<ContactSection <ContactSection
v-if="orderData.commodityTypeCode !== '0'" v-if="orderData.orderType !== 0"
v-model="quantity" v-model="quantity"
:userFormList="userFormList" :userFormList="userFormList"
v-model:reservationDate="selectedReservationDate" v-model:reservationDate="selectedReservationDate"
@@ -72,7 +72,7 @@
<!-- 酒店类型 --> <!-- 酒店类型 -->
<UserSection <UserSection
v-if="orderData.commodityTypeCode === '0'" v-if="orderData.orderType === 0"
v-model="quantity" v-model="quantity"
:userFormList="userFormList" :userFormList="userFormList"
/> />
@@ -253,7 +253,7 @@ const handlePayClick = ThrottleUtils.createThrottle(async (goodsData) => {
}; };
//酒店类型添加入住时间、离店时间 //酒店类型添加入住时间、离店时间
if (goodsData.commodityTypeCode === "0" && selectedDate.value) { if (goodsData.orderType === 0 && selectedDate.value) {
const { startDate, endDate } = selectedDate.value; const { startDate, endDate } = selectedDate.value;
// 入住时间 // 入住时间
params.checkInData = startDate; params.checkInData = startDate;

View File

@@ -1,11 +1,11 @@
<template> <template>
<view <view
v-if="commodityTypeCode === '0'" v-if="orderType === '0'"
class="border-box bg-white p-12 rounded-12 mb-12" class="border-box bg-white p-12 rounded-12 mb-12"
> >
<!-- 酒店类型入住离店日期部分 --> <!-- 酒店类型入住离店日期部分 -->
<DateRangeSection <DateRangeSection
v-if="orderData.commodityTypeCode === '0'" v-if="orderData.orderType === 0"
:selectedDate="selectedDate" :selectedDate="selectedDate"
/> />
@@ -32,7 +32,7 @@
</view> </view>
<view <view
v-if="commodityTypeCode !== '0'" v-if="orderType !== '0'"
class="border-box bg-white p-12 rounded-12 mb-12" class="border-box bg-white p-12 rounded-12 mb-12"
> >
<view <view
@@ -80,12 +80,12 @@ const selectedDate = computed(() => {
}; };
}); });
const commodityTypeCode = computed(() => props.orderData.commodityTypeCode); const orderType = computed(() => props.orderData.orderType);
const commodityAmount = computed(() => { const commodityAmount = computed(() => {
// 门票单位:张、餐饮单位:份 // 门票单位:张、餐饮单位:份
const { commodityAmount } = props.orderData; const { commodityAmount } = props.orderData;
return commodityTypeCode.value === "2" return orderType.value === "2"
? `${parseInt(commodityAmount)}` ? `${parseInt(commodityAmount)}`
: `${parseInt(commodityAmount)}`; : `${parseInt(commodityAmount)}`;
}); });

View File

@@ -11,7 +11,7 @@
<GoodsInfo :orderData="orderData" /> <GoodsInfo :orderData="orderData" />
<UserInfo v-if="orderData.commodityTypeCode === '0'" :orderData="orderData" /> <UserInfo v-if="orderData.orderType === 0" :orderData="orderData" />
<OrderInfo :orderData="orderData" /> <OrderInfo :orderData="orderData" />
</view> </view>

View File

@@ -2,8 +2,8 @@
display: flex; display: flex;
align-items: flex-end; align-items: flex-end;
justify-content: space-between; justify-content: space-between;
margin: 24rpx 0 12rpx; margin: 12px 0;
padding: 12rpx 0; padding: 0 12px;
} }
.date-item { .date-item {

View File

@@ -39,7 +39,7 @@
}}</view> }}</view>
<view class="goods-price"> <view class="goods-price">
<text class="currency">¥</text> <text class="currency">¥</text>
<template v-if="goodsData.commodityTypeCode === '0'"> <template v-if="goodsData.orderType === 0">
<text class="price"> <text class="price">
{{ goodsData.calculatedTotalPrice || 0 }} {{ goodsData.calculatedTotalPrice || 0 }}
</text> </text>
@@ -106,7 +106,7 @@
<!-- 总价区域 --> <!-- 总价区域 -->
<SumCard <SumCard
:referencePrice=" :referencePrice="
goodsData.commodityTypeCode === '0' goodsData.orderType === 0
? goodsData.calculatedTotalPrice ? goodsData.calculatedTotalPrice
: goodsData.specificationPrice : goodsData.specificationPrice
" "
@@ -153,9 +153,9 @@ const isValidUserForm = (user) => {
// 常量定义 // 常量定义
const COMMODITY_TYPES = { const COMMODITY_TYPES = {
HOTEL: "0", HOTEL: 0,
TICKET: "1", TICKET: 1,
DINING: "2", DINING: 2,
}; };
const DEFAULT_PRICE = 399; const DEFAULT_PRICE = 399;
@@ -166,7 +166,7 @@ const props = defineProps({
goodsData: { goodsData: {
type: Object, type: Object,
default: () => ({ default: () => ({
commodityTypeCode: "0", orderType: "0",
specificationPrice: "", specificationPrice: "",
commodityName: "", commodityName: "",
commodityPhotoList: [], commodityPhotoList: [],
@@ -195,14 +195,14 @@ const isDeleting = ref(false); // 标志位防止删除时watch冲突
// 计算属性 // 计算属性
const totalPrice = computed(() => { const totalPrice = computed(() => {
const price = const price =
props.goodsData?.commodityTypeCode === "0" props.goodsData?.orderType === 0
? props.goodsData?.calculatedTotalPrice ? props.goodsData?.calculatedTotalPrice
: props.goodsData?.specificationPrice || 0; : props.goodsData?.specificationPrice || 0;
return (price * quantity.value).toFixed(0); return (price * quantity.value).toFixed(0);
}); });
const isHotelType = computed(() => { const isHotelType = computed(() => {
return props.goodsData?.commodityTypeCode === COMMODITY_TYPES.HOTEL; return props.goodsData?.orderType === COMMODITY_TYPES.HOTEL;
}); });
const sectionTitle = computed(() => { const sectionTitle = computed(() => {
@@ -332,7 +332,7 @@ const confirmOrder = () => {
visitorName: user.visitorName.trim(), visitorName: user.visitorName.trim(),
contactPhone: user.contactPhone.trim(), contactPhone: user.contactPhone.trim(),
})), })),
commodityType: props.goodsData?.commodityTypeCode, commodityType: props.goodsData?.orderType,
timestamp: Date.now(), timestamp: Date.now(),
}; };

View File

@@ -25,7 +25,7 @@
<!-- 日期选择区域 --> <!-- 日期选择区域 -->
<DateSelector <DateSelector
v-if="goodsData.commodityTypeCode === '0'" v-if="goodsData.orderType === 0"
@showCalendar="showCalendar" @showCalendar="showCalendar"
:checkInDate="selectedDate.startDate" :checkInDate="selectedDate.startDate"
:checkOutDate="selectedDate.endDate" :checkOutDate="selectedDate.endDate"
@@ -34,10 +34,11 @@
:nights="selectedDate.totalDays" :nights="selectedDate.totalDays"
/> />
<GoodPackage v-if="goodsData.commodityPackageConfig && goodsData.commodityPackageConfig.length > 0" :goodsData="goodsData" /> <!-- 商品套餐组件 -->
<GoodPackage v-if="goodsData.orderType !== 0 && goodsData.commodityPackageConfig && goodsData.commodityPackageConfig.length > 0" :goodsData="goodsData" />
<!-- 商品设施组件 --> <!-- 商品设施组件 -->
<GoodFacility :goodsData="goodsData" /> <GoodFacility v-if="goodsData.commodityEquipment && goodsData.commodityEquipment.length > 0" :goodsData="goodsData" />
<!-- 商品详情组件 --> <!-- 商品详情组件 -->
<GoodDetail :goodsData="goodsData" /> <GoodDetail :goodsData="goodsData" />
@@ -127,7 +128,7 @@ const goodsInfo = async (params) => {
calculatedTotalPrice.value = goodsData.value.specificationPrice || 0; calculatedTotalPrice.value = goodsData.value.specificationPrice || 0;
// 判断是酒店类型订单再获取获取商品日价格及库存 // 判断是酒店类型订单再获取获取商品日价格及库存
if (goodsData.value.commodityTypeCode === "0") { if (goodsData.value.orderType === 0) {
configGoodsData(); configGoodsData();
getGoodsDailyPrice({ getGoodsDailyPrice({
commodityId: goodsData.value.commodityId, commodityId: goodsData.value.commodityId,
@@ -188,7 +189,7 @@ const handleDateSelect = (data) => {
selectedDateStore.setData(selectedDate.value); selectedDateStore.setData(selectedDate.value);
// 根据商品类型计算价格 // 根据商品类型计算价格
if (goodsData.value.commodityTypeCode === "0") { if (goodsData.value.orderType === 0) {
// 酒店类型计算dateRange总价格排除最后一天同一天除外 // 酒店类型计算dateRange总价格排除最后一天同一天除外
if (data.dateRange && Array.isArray(data.dateRange)) { if (data.dateRange && Array.isArray(data.dateRange)) {
// 获取默认价格作为回退值 // 获取默认价格作为回退值