feat: 商品详情的调整

This commit is contained in:
2025-09-06 16:24:44 +08:00
parent 7973743644
commit f6821ade2d
6 changed files with 136 additions and 32 deletions

View File

@@ -83,8 +83,12 @@
:form="item"
:showDeleteIcon="userFormList.length > 1"
:key="index"
@update:name="(value) => updateUserForm(index, 'name', value)"
@update:phone="(value) => updateUserForm(index, 'phone', value)"
@update:visitorName="
(value) => updateUserForm(index, 'visitorName', value)
"
@update:contactPhone="
(value) => updateUserForm(index, 'contactPhone', value)
"
@delete="() => deleteUserForm(index)"
/>
</scroll-view>
@@ -126,10 +130,10 @@ const showToast = (title, icon = "none", duration = 2000) => {
const isValidUserForm = (user) => {
return (
user &&
typeof user.name === "string" &&
user.name.trim() !== "" &&
typeof user.phone === "string" &&
user.phone.trim() !== ""
typeof user.visitorName === "string" &&
user.visitorName.trim() !== "" &&
typeof user.contactPhone === "string" &&
user.contactPhone.trim() !== ""
);
};
@@ -165,7 +169,7 @@ const emits = defineEmits(["confirm", "close"]);
// 工具函数
const createEmptyUserForm = () => {
return { name: "", phone: "" };
return { visitorName: "", contactPhone: "" };
};
// 响应式数据
@@ -243,7 +247,7 @@ const updateUserForm = (index, field, value) => {
return;
}
if (!["name", "phone"].includes(field)) {
if (!["visitorName", "contactPhone"].includes(field)) {
return;
}
@@ -308,8 +312,8 @@ const confirmOrder = () => {
quantity: quantity.value,
totalPrice: parseFloat(totalPrice.value),
userFormList: userFormList.value.map((user) => ({
name: user.name.trim(),
phone: user.phone.trim(),
visitorName: user.visitorName.trim(),
contactPhone: user.contactPhone.trim(),
})),
commodityType: props.goodsData?.commodityTypeCode,
timestamp: Date.now(),
@@ -349,4 +353,4 @@ defineExpose({
<style scoped lang="scss">
@import "./styles/index.scss";
</style>
</style>

View File

@@ -21,7 +21,7 @@
<!-- 地址区域 -->
<view class="address-section">
<LocationInfo :orderData="goodsData" />
<LocationCard :orderData="goodsData" />
</view>
<!-- 设施信息区域 -->
@@ -41,7 +41,7 @@
<script setup>
import { computed, defineProps, defineEmits } from "vue";
import LocationInfo from "@/components/LocationInfo/index.vue";
import LocationCard from "@/components/LocationCard/index.vue";
// 事件定义
const emits = defineEmits(["showCalendar"]);
@@ -77,4 +77,4 @@ const isShowCalendar = computed(() => {
<style scoped lang="scss">
@import "./styles/index.scss";
</style>
</style>

View File

@@ -38,9 +38,7 @@
// 地址区域
.address-section {
padding: 12px 0;
border-top: 1px solid #f0f0f0;
border-bottom: 1px solid #f0f0f0;
padding: 6px 0;
.address-item {
display: flex;