feat: 商品详情日期初始化问题修复

This commit is contained in:
duanshuwen
2025-12-22 21:58:32 +08:00
parent 5027abc239
commit b7fbe99cd0

View File

@@ -1,21 +1,11 @@
<template> <template>
<view <view class="card bg-white border-box p-8 rounded-12 flex flex-items-start m-12" @click.stop="handleClick(item)">
class="card bg-white border-box p-8 rounded-12 flex flex-items-start m-12" <image class="left rounded-10" :src="item.commodityPhoto" mode="aspectFill" />
@click.stop="handleClick(item)"
>
<image
class="left rounded-10"
:src="item.commodityPhoto"
mode="aspectFill"
/>
<view class="right border-box flex-full pl-12"> <view class="right border-box flex-full pl-12">
<view class="font-size-16 line-height-24 color-171717 mb-4"> <view class="font-size-16 line-height-24 color-171717 mb-4">
{{ item.commodityName }} {{ item.commodityName }}
</view> </view>
<view <view v-if="item.commodityFacility" class="font-size-12 line-height-16 color-99A0AE mb-4 ellipsis-1">
v-if="item.commodityFacility"
class="font-size-12 line-height-16 color-99A0AE mb-4 ellipsis-1"
>
{{ item.commodityFacility.join(" ") }} {{ item.commodityFacility.join(" ") }}
</view> </view>
<view class="font-size-12 line-height-18 color-43669A"> <view class="font-size-12 line-height-18 color-43669A">
@@ -23,19 +13,13 @@
</view> </view>
<view class="flex flex-items-center flex-justify-end"> <view class="flex flex-items-center flex-justify-end">
<text <text class="amt font-size-18 font-500 font-family-misans-vf line-height-24 color-FF3D60 mr-4">
class="amt font-size-18 font-500 font-family-misans-vf line-height-24 color-FF3D60 mr-4"
>
{{ item.specificationPrice }} {{ item.specificationPrice }}
</text> </text>
<text class="font-size-12 line-height-16 color-99A0AE"> <text class="font-size-12 line-height-16 color-99A0AE">
/{{ item.stockUnitLabel }} /{{ item.stockUnitLabel }}
</text> </text>
<text <text class="btn border-box rounded-10 color-white ml-16" @click.stop="handleBooking(item)"></text>
class="btn border-box rounded-10 color-white ml-16"
@click.stop="handleBooking(item)"
></text
>
</view> </view>
</view> </view>
</view> </view>
@@ -64,24 +48,22 @@ const props = defineProps({
}, },
selectedDate: { selectedDate: {
type: Object, type: Object,
default: () => {}, default: () => { },
}, },
}); });
const handleClick = ({ commodityId }) => {
uni.navigateTo({ url: `/pages/goods/index?commodityId=${commodityId}` });
};
const selectedDateStore = useSelectedDateStore(); const selectedDateStore = useSelectedDateStore();
const handleBooking = ({ commodityId }) => {
const { startDate, endDate, totalDays } = props.selectedDate;
const navigateToPage = (commodityId, path) => {
const { startDate, endDate, totalDays } = props.selectedDate;
selectedDateStore.setData({ startDate, endDate, totalDays }); selectedDateStore.setData({ startDate, endDate, totalDays });
uni.navigateTo({ uni.navigateTo({ url: `${path}?commodityId=${commodityId}` });
url: `/pages-booking/index?commodityId=${commodityId}`,
});
}; };
const handleClick = ({ commodityId }) => navigateToPage(commodityId, "/pages/goods/index")
const handleBooking = ({ commodityId }) => navigateToPage(commodityId, "/pages-booking/index")
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">