|
@@ -1,3 +1,8 @@
|
|
|
|
|
+<!--
|
|
|
|
|
+ 花店后台编辑商品
|
|
|
|
|
+ 谁用:hdApp 管理端修改花束
|
|
|
|
|
+ 解决问题:详情 specList 首项即主记录自身;提交时把首规格名称回写主表单 specName
|
|
|
|
|
+-->
|
|
|
<template>
|
|
<template>
|
|
|
<view class="app-content">
|
|
<view class="app-content">
|
|
|
|
|
|
|
@@ -441,7 +446,8 @@ export default {
|
|
|
this.form.useCaseIdList = Array.isArray(useCaseIdList)
|
|
this.form.useCaseIdList = Array.isArray(useCaseIdList)
|
|
|
? useCaseIdList.map(id => Number(id)).filter(id => id > 0)
|
|
? useCaseIdList.map(id => Number(id)).filter(id => id > 0)
|
|
|
: [];
|
|
: [];
|
|
|
- this.form.specEnabled = Number(res.data.specEnabled || 0);
|
|
|
|
|
|
|
+ this.form.specEnabled = Number(res.data.specEnabled || res.data.goodsStyle || 0);
|
|
|
|
|
+ // 详情 specList 首项即主记录自身(id=主商品id),createSpecData 直接兼容
|
|
|
this.form.specList = (res.data.specList || []).map(item => this.createSpecData(item));
|
|
this.form.specList = (res.data.specList || []).map(item => this.createSpecData(item));
|
|
|
|
|
|
|
|
// 设置价格类型
|
|
// 设置价格类型
|
|
@@ -683,9 +689,13 @@ export default {
|
|
|
}
|
|
}
|
|
|
return '';
|
|
return '';
|
|
|
},
|
|
},
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 提交前规范化规格:多规格把首规格价库和名称回写主表单字段,specList 仍整表提交由后端拆主/子
|
|
|
|
|
+ */
|
|
|
normalizeSpecSubmitData(formData) {
|
|
normalizeSpecSubmitData(formData) {
|
|
|
if (formData.specEnabled != 1) {
|
|
if (formData.specEnabled != 1) {
|
|
|
formData.specList = [];
|
|
formData.specList = [];
|
|
|
|
|
+ formData.specName = '';
|
|
|
return formData;
|
|
return formData;
|
|
|
}
|
|
}
|
|
|
formData.specList = formData.specList.map(item => {
|
|
formData.specList = formData.specList.map(item => {
|
|
@@ -704,6 +714,7 @@ export default {
|
|
|
return spec;
|
|
return spec;
|
|
|
});
|
|
});
|
|
|
const firstSpec = formData.specList[0];
|
|
const firstSpec = formData.specList[0];
|
|
|
|
|
+ formData.specName = firstSpec.specName || '';
|
|
|
formData.priceType = String(firstSpec.priceType);
|
|
formData.priceType = String(firstSpec.priceType);
|
|
|
formData.price = firstSpec.price;
|
|
formData.price = firstSpec.price;
|
|
|
formData.stockSet = String(firstSpec.stockSet);
|
|
formData.stockSet = String(firstSpec.stockSet);
|