商品信息回显第一版

dev
wxy 2024-05-13 20:40:18 +08:00
parent a89ffd8be1
commit 5018955b90
1 changed files with 43 additions and 4 deletions

View File

@ -96,8 +96,6 @@
<img :src="scope.row.carouselImages" alt="加载失败" width="80px" height="80px"/>
</template>
</el-table-column>
<el-table-column label="商品评论数" align="center" prop="commentCount" />
<el-table-column label="商品收藏人气" align="center" prop="collectCount" />
<el-table-column label="品牌信息" align="center" prop="brand" />
<el-table-column label="品牌状态" align="center" prop="status">
@ -117,7 +115,6 @@
</el-table-column>
<el-table-column label="单位" align="center" prop="unit" />
<el-table-column label="搜索关键字" align="center" prop="keywords" />
<el-table-column label="规格信息" align="center" prop="ruleId" />
<el-table-column label="0添加商品信息 1添加规格信息 2添加描述信息" align="center" prop="step"/>
<el-table-column label="商品描述" align="center" prop="productDesc">
@ -323,6 +320,8 @@ import ImageUpload from "@/components/ImageUpload"
import {listBrand} from "@/api/product/brand"
import { listRule } from "@/api/product/rule"
import {listAll7 } from "@/api/product/type"
import data from "@/views/system/dict/data.vue";
import item from "@/layout/components/Sidebar/Item.vue";
export default {
@ -486,6 +485,17 @@ export default {
cartesian(ruleAttrJson, 0, {});
this.tableBodyTemplate.forEach(item=>{
let sku = [];
for (let itemKey in item) {
if(itemKey.indexOf("xxx") > -1){
sku.push(item[itemKey])
}
}
sku = sku.join(',');
item['sku'] = sku;
})
this.tableColumnHeaderTemplate.push(
{prop:'stock',label:'商品库存'},
{prop:'price',label:'商品价格'},
@ -628,7 +638,30 @@ export default {
this.reset();
const id = row.id || this.ids
getInfo(id).then(response => {
this.form = response.data;
let typeList = [];
let data = response.data;
this.active = Number(data.step);
let ruleId = data.ruleId;
this.changeRuleInfoListByRuleId(ruleId);
if(data.skuInfoList !=null && data.skuInfoList.size > 0){
data.skuInfoList.forEach(item => {
if (item.sku !== null) {
let skuArray = item.sku.split(',');
for (let i = 0; i < skuArray.length; i++) {
item[`xxx${i}`] = skuArray[i];
}
}
});
}
this.tableBodyTemplate=data.skuInfoList;
this.form = data;
let typeAttr = data.typeIds.split(",")
typeAttr.forEach(item => {
typeList.push(item * 1)
});
this.form.type = typeList
this.open = true;
this.title = "修改商品信息";
});
@ -637,6 +670,12 @@ export default {
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
let typeIds = this.form.type.join(',');
let type = this.form.type[this.form.type - 1];
this.form.typeIds = typeIds;
this.form.type = type;
this.form["skuInfoList"] = this.tableBodyTemplate;
if (this.form.id != null) {
this.updateInfoById(this.form)
} else {