feat: 商品详情的调整
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user