|
@@ -98,8 +98,8 @@
|
|
|
<search-brand
|
|
|
:value="ruleForm.brand_id"
|
|
|
:size="'mini'"
|
|
|
- :isDetail="type !== 'add'"
|
|
|
- :names="brand_name"
|
|
|
+ :isDetail="listindex !== '-1'"
|
|
|
+ :names="ruleForm.brand_name"
|
|
|
:placeholder="'品牌'"
|
|
|
@searchChange="brand_id_searchChange"
|
|
|
/>
|
|
@@ -144,8 +144,8 @@
|
|
|
<search-unit
|
|
|
:value="ruleForm.unit"
|
|
|
:size="'mini'"
|
|
|
- :isDetail="unit_name !== ''"
|
|
|
- :names="unit_name"
|
|
|
+ :isDetail="listindex !== '-1'"
|
|
|
+ :names="ruleForm.unit_name"
|
|
|
:placeholder="'单位'"
|
|
|
@searchChange="unitsearchChange"
|
|
|
/>
|
|
@@ -158,8 +158,8 @@
|
|
|
:placeholder="'商品分类'"
|
|
|
:disabled="false"
|
|
|
:size="'mini'"
|
|
|
- :names="cat_id_name"
|
|
|
- :isDetail="false"
|
|
|
+ :names="ruleForm.cat_id_name"
|
|
|
+ :isDetail="listindex !== '-1'"
|
|
|
@searchChange="goods_class_change"
|
|
|
/>
|
|
|
</el-form-item>
|
|
@@ -205,8 +205,8 @@
|
|
|
style="width: 100%"
|
|
|
height="120px"
|
|
|
>
|
|
|
- <el-table-column prop="spec_value" label="规格类型" />
|
|
|
- <el-table-column prop="spec_value_value" label="规格值" />
|
|
|
+ <el-table-column prop="spec_name" label="规格类型" />
|
|
|
+ <el-table-column prop="spec_value_name" label="规格值" />
|
|
|
<el-table-column fixed="right" width="88px">
|
|
|
<template slot="header" slot-scope="scope">
|
|
|
<span>操作</span>
|
|
@@ -284,7 +284,7 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="6">
|
|
|
+ <el-col :span="6" v-if="is_noble">
|
|
|
<el-form-item label="启用金价" prop="is_gold_price">
|
|
|
<el-select
|
|
|
v-model="ruleForm.is_gold_price"
|
|
@@ -339,7 +339,7 @@
|
|
|
<search-metal-kind
|
|
|
:value="ruleForm.metal_id"
|
|
|
:size="'mini'"
|
|
|
- :isDetail="type !== 'add'"
|
|
|
+ :isDetail="listindex !== '-1'"
|
|
|
:placeholder="'贵金属种类'"
|
|
|
@searchChange="noble_metalsearchChange"
|
|
|
/>
|
|
@@ -356,7 +356,8 @@
|
|
|
placeholder="当前金价"
|
|
|
maxlength="500"
|
|
|
>
|
|
|
- <template slot="append">元</template></el-input>
|
|
|
+ <template slot="append">元</template></el-input
|
|
|
+ >
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8" class="fr tr">
|
|
@@ -412,7 +413,6 @@ export default {
|
|
|
modelSitem: {},
|
|
|
showOtherModel: false,
|
|
|
spec_tableData: [],
|
|
|
- old_spec_tableData: [],
|
|
|
loading: false,
|
|
|
is_noble: false,
|
|
|
is_addrs_options: [
|
|
@@ -430,15 +430,11 @@ export default {
|
|
|
config_options: ["证书", "包装盒", "绒布袋", "标签", "其他"],
|
|
|
title: "添加咨询商品",
|
|
|
showModelThis: this.showModel,
|
|
|
- findex: "-1",
|
|
|
- select: "1",
|
|
|
pickerOptions: {
|
|
|
disabledDate(time) {
|
|
|
return time.getTime() <= Date.now();
|
|
|
},
|
|
|
},
|
|
|
- activeOptions: [],
|
|
|
- actionList: [],
|
|
|
ruleForm: {
|
|
|
p_cat_info: [],
|
|
|
p_cat_id: "",
|
|
@@ -470,9 +466,9 @@ export default {
|
|
|
metal_id: "",
|
|
|
gold_price: "0",
|
|
|
},
|
|
|
- unit_name: "",
|
|
|
rulesThis: this.rules,
|
|
|
rules: rules,
|
|
|
+ listindex: "-1",
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -492,9 +488,8 @@ export default {
|
|
|
async initForm() {
|
|
|
this.loading = true;
|
|
|
const { index } = this.sitem;
|
|
|
- console.log(index);
|
|
|
- this.findex = index ? index + "" : "-1";
|
|
|
- if (this.findex === "-1") {
|
|
|
+ this.listindex = index + "";
|
|
|
+ if (this.listindex === "-1") {
|
|
|
this.title = "添加咨询商品";
|
|
|
} else {
|
|
|
this.title = "修改咨询商品";
|
|
@@ -514,24 +509,18 @@ export default {
|
|
|
//规格编辑修改结果
|
|
|
refreshEdit(e) {
|
|
|
let item = JSON.parse(JSON.stringify(e));
|
|
|
- const {
|
|
|
- index,
|
|
|
- id,
|
|
|
- spec_id,
|
|
|
- spec_value,
|
|
|
- spec_value_id,
|
|
|
- spec_value_value,
|
|
|
- } = item;
|
|
|
+ const { index, id, specid, spec_name, spec_value_id, spec_value_name } =
|
|
|
+ item;
|
|
|
if (index + "" === "-1") {
|
|
|
this.spec_tableData.push(item);
|
|
|
} else {
|
|
|
this.spec_tableData.forEach((i, findex) => {
|
|
|
if (i.spec_id === spec_id) {
|
|
|
this.spec_tableData[findex].id = id;
|
|
|
- this.spec_tableData[findex].spec_id = spec_id;
|
|
|
- this.spec_tableData[findex].spec_value = spec_value;
|
|
|
+ this.spec_tableData[findex].specid = specid;
|
|
|
+ this.spec_tableData[findex].spec_name = spec_name;
|
|
|
this.spec_tableData[findex].spec_value_id = spec_value_id;
|
|
|
- this.spec_tableData[findex].spec_value_value = spec_value_value;
|
|
|
+ this.spec_tableData[findex].spec_value_name = spec_value_name;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -539,7 +528,6 @@ export default {
|
|
|
},
|
|
|
async resetForm() {
|
|
|
this.spec_tableData = [];
|
|
|
- this.old_spec_tableData = [];
|
|
|
// 重置
|
|
|
await this.$nextTick(() => {
|
|
|
if (this.$refs.ruleForm) {
|
|
@@ -580,15 +568,24 @@ export default {
|
|
|
p_good_name,
|
|
|
p_good_img,
|
|
|
p_arrtime,
|
|
|
+ brand_name,
|
|
|
+ specinfo,
|
|
|
+ cat_id_name,
|
|
|
+ cat_arr_id,
|
|
|
} = this.sitem;
|
|
|
- this.unit_name = unit_name || "";
|
|
|
- console.log(p_cat_info);
|
|
|
+ console.log(this.sitem);
|
|
|
+ // console.log(p_cat_info);
|
|
|
let asd = [];
|
|
|
if (p_cat_info && p_cat_info.length > 0) {
|
|
|
p_cat_info.forEach((sd) => {
|
|
|
asd.push(sd.id);
|
|
|
});
|
|
|
}
|
|
|
+ if (specinfo && specinfo.length > 0) {
|
|
|
+ this.spec_tableData = JSON.parse(JSON.stringify(specinfo));
|
|
|
+ } else {
|
|
|
+ this.spec_tableData = [];
|
|
|
+ }
|
|
|
this.ruleForm = {
|
|
|
p_cat_info: p_cat_info,
|
|
|
p_cat_id: p_cat_id,
|
|
@@ -600,22 +597,25 @@ export default {
|
|
|
p_good_name: p_good_name,
|
|
|
p_good_img: p_good_img,
|
|
|
p_arrtime: p_arrtime,
|
|
|
+
|
|
|
pgNo: fi === "-1" && p_pgNo ? p_pgNo : pgNo || "",
|
|
|
arrival_time:
|
|
|
fi === "-1" && p_pgNo ? p_arrtime : arrival_time || "",
|
|
|
budget_price:
|
|
|
fi === "-1" && p_pgNo ? p_budget_price : budget_price || "0.00",
|
|
|
num: fi === "-1" && p_pgNo ? p_num : num || "0",
|
|
|
- brand_id: brand_id ? [brand_id] : [],
|
|
|
- cat_id: [],
|
|
|
- cat_arr_id: [],
|
|
|
+ brand_id: brand_id ? brand_id : [],
|
|
|
+ brand_name: brand_name ? brand_name : "",
|
|
|
+ cat_id: cat_id ? cat_id : [],
|
|
|
+ cat_arr_id: cat_arr_id ? cat_arr_id : [],
|
|
|
+ cat_id_name: cat_id_name ? cat_id_name : "",
|
|
|
good_img: fi === "-1" && p_pgNo ? p_good_img : good_img || "",
|
|
|
good_name: fi === "-1" && p_pgNo ? p_good_name : good_name || "",
|
|
|
total_weight: total_weight || "0",
|
|
|
is_addrs: is_addrs || "0",
|
|
|
is_custom: is_custom || "0",
|
|
|
is_gold_price: is_gold_price || "0",
|
|
|
- config: config ? [config] : [],
|
|
|
+ config: config ? config : [],
|
|
|
specs_weight: specs_weight || "0.000",
|
|
|
other_config: other_config || "",
|
|
|
cost_desc: cost_desc || "",
|
|
@@ -623,8 +623,17 @@ export default {
|
|
|
remark: remark || "",
|
|
|
metal_id: metal_id || "",
|
|
|
gold_price: gold_price || "0",
|
|
|
- unit: unit ? [unit] : [],
|
|
|
+ unit: unit ? unit : [],
|
|
|
+ unit_name: unit_name ? unit_name : "",
|
|
|
};
|
|
|
+ this.is_noble = false;
|
|
|
+ if (cat_arr_id && cat_arr_id.length > 0) {
|
|
|
+ cat_arr_id.forEach((e) => {
|
|
|
+ if (e === "6") {
|
|
|
+ this.is_noble = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -633,6 +642,7 @@ export default {
|
|
|
console.log(e);
|
|
|
const { code, pid, id, label, item } = e;
|
|
|
this.ruleForm.cat_id = id ? [id] : [];
|
|
|
+ this.ruleForm.cat_id_name = label ? label : "";
|
|
|
this.ruleForm.cat_arr_id = item;
|
|
|
this.$refs.ruleForm.validateField("cat_id");
|
|
|
this.is_noble = pid === "6";
|
|
@@ -640,8 +650,9 @@ export default {
|
|
|
|
|
|
//单位选择
|
|
|
unitsearchChange(e) {
|
|
|
- const { code } = e;
|
|
|
+ const { code, label } = e;
|
|
|
this.ruleForm.unit = code ? [code] : [];
|
|
|
+ this.ruleForm.unit_name = label ? label : "";
|
|
|
this.$refs.ruleForm.validateField("unit");
|
|
|
},
|
|
|
//购买数量
|
|
@@ -651,15 +662,16 @@ export default {
|
|
|
},
|
|
|
//品牌选择
|
|
|
brand_id_searchChange(e) {
|
|
|
- const { id } = e;
|
|
|
+ const { id, label } = e;
|
|
|
this.ruleForm.brand_id = id ? [id] : [];
|
|
|
+ this.ruleForm.brand_name = label ? label : "";
|
|
|
this.$refs.ruleForm.validateField("brand_id");
|
|
|
},
|
|
|
//贵金属种类选择
|
|
|
noble_metalsearchChange(e) {
|
|
|
const { id, price } = e;
|
|
|
this.ruleForm.metal_id = id ? id : "";
|
|
|
- this.$refs.ruleForm.validateField("noble_metal");
|
|
|
+ this.$refs.ruleForm.validateField("metal_id");
|
|
|
this.ruleForm.gold_price = price ? price : "0";
|
|
|
this.$refs.ruleForm.validateField("gold_price");
|
|
|
},
|
|
@@ -667,6 +679,11 @@ export default {
|
|
|
await this.$refs.ruleForm.validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
this.loading = true;
|
|
|
+ if (this.spec_tableData.length === 0) {
|
|
|
+ this.$message.warning("请选择商品规格!");
|
|
|
+ this.loading = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
let model = JSON.parse(JSON.stringify(this.ruleForm));
|
|
|
const { total_weight, specs_weight, p_cat_info } = model;
|
|
|
if (total_weight * 1000 < specs_weight * 1000) {
|
|
@@ -674,7 +691,7 @@ export default {
|
|
|
this.loading = false;
|
|
|
return;
|
|
|
}
|
|
|
- model.index = this.findex;
|
|
|
+ model.index = this.listindex;
|
|
|
model.specinfo = JSON.parse(JSON.stringify(this.spec_tableData));
|
|
|
this.loading = false;
|
|
|
this.showModelThis = false;
|