|
@@ -33,6 +33,7 @@
|
|
|
:value="ruleForm.supplierNo"
|
|
|
:placeholder="'供应商'"
|
|
|
:size="'mini'"
|
|
|
+ :names="supplierNo_name"
|
|
|
:disabled="type === 'view'"
|
|
|
:isDetail="type !== 'add'"
|
|
|
@searchChange="supplierNosearchChange"
|
|
@@ -210,13 +211,13 @@
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
<!-- 弹窗 新增/修改 -->
|
|
|
- <!-- <base-form-add-edit
|
|
|
+ <base-form-add-edit
|
|
|
:index="modelIndex"
|
|
|
:show-model="showOtherModel"
|
|
|
:sitem="modelSitem"
|
|
|
@refresh="refreshEdit"
|
|
|
@cancel="showOtherModel = false"
|
|
|
- /> -->
|
|
|
+ />
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-col>
|
|
@@ -431,7 +432,7 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
|
- <el-col :span="24" v-if="is_noble">
|
|
|
+ <el-col :span="24" v-show="is_noble">
|
|
|
<el-col :span="6">
|
|
|
<el-form-item label="金属重量" prop="noble_weight">
|
|
|
<digital-input
|
|
@@ -454,8 +455,8 @@
|
|
|
<search-metal-kind
|
|
|
:value="ruleForm.metal_id"
|
|
|
:size="'mini'"
|
|
|
- :disabled="type === 'view'"
|
|
|
- :isDetail="type !== 'add'"
|
|
|
+ :disabled="true"
|
|
|
+ :isDetail="true"
|
|
|
:placeholder="'金属种类'"
|
|
|
@searchChange="metal_idsearchChange"
|
|
|
/>
|
|
@@ -635,6 +636,7 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
cat_id_name: "",
|
|
|
+ supplierNo: "",
|
|
|
brand_name: "",
|
|
|
unit_name: "",
|
|
|
title: "",
|
|
@@ -659,7 +661,7 @@ export default {
|
|
|
options10: options10,
|
|
|
options11: options11,
|
|
|
ruleForm: {},
|
|
|
- rules: rules,
|
|
|
+ rules: JSON.parse(JSON.stringify(rules)),
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
@@ -667,6 +669,7 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
async initForm() {
|
|
|
+ this.supplierNo = [];
|
|
|
console.log(this.id);
|
|
|
this.loading = true;
|
|
|
if (this.type === "add") {
|
|
@@ -676,13 +679,15 @@ export default {
|
|
|
} else {
|
|
|
this.title = "采返商品详情";
|
|
|
}
|
|
|
+ console.log(this.type);
|
|
|
this.resetFormData();
|
|
|
this.rulesThis = this.rules;
|
|
|
await this.resetForm();
|
|
|
+
|
|
|
if (this.type === "edit" || this.type === "view") {
|
|
|
await this.initData();
|
|
|
}
|
|
|
-
|
|
|
+ this.setrules();
|
|
|
this.loading = false;
|
|
|
},
|
|
|
|
|
@@ -701,7 +706,7 @@ export default {
|
|
|
bidNo,
|
|
|
good_name, //string 名称
|
|
|
cat_id, //array 分类
|
|
|
- cat_name,
|
|
|
+ cat_info,
|
|
|
brand_id, //string 品牌id
|
|
|
unit, // string 单位
|
|
|
unit_id, //单位ID
|
|
@@ -728,9 +733,6 @@ export default {
|
|
|
delivery_fee, // string 物流费
|
|
|
status, // string 状态
|
|
|
brand_name,
|
|
|
- color, //颜色
|
|
|
- model, //型号
|
|
|
- material, //材质
|
|
|
work_day,
|
|
|
pay_way,
|
|
|
send_way,
|
|
@@ -738,45 +740,36 @@ export default {
|
|
|
config,
|
|
|
nake_fee,
|
|
|
other_config,
|
|
|
+ supplierName,
|
|
|
+ specinfo,
|
|
|
} = JSON.parse(JSON.stringify(data));
|
|
|
-
|
|
|
+ if (specinfo && specinfo.length > 0) {
|
|
|
+ this.spec_tableData = JSON.parse(JSON.stringify(specinfo));
|
|
|
+ }
|
|
|
+ this.cat_id_name = "";
|
|
|
+ if (cat_info && cat_info.length) {
|
|
|
+ cat_info.forEach((e, ei) => {
|
|
|
+ this.cat_id_name += `${ei !== 0 ? "_" : ""}${e.name}`;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.supplierNo_name = supplierName || "";
|
|
|
+ console.log(this.supplierNo_name);
|
|
|
this.is_noble = this.askItem.is_metal;
|
|
|
- this.cat_id_name =
|
|
|
- this.type === "add" ? this.askItem.cat_name : cat_name || "";
|
|
|
- console.log(this.cat_id_name);
|
|
|
- console.log(this.askItem);
|
|
|
- this.brand_name =
|
|
|
- this.type === "add" ? this.askItem.brand : brand_name || "";
|
|
|
- this.unit_name =
|
|
|
- this.type === "add" ? this.askItem.unit_name : unit || "";
|
|
|
+ this.brand_name = brand_name || "";
|
|
|
+ this.unit_name = unit || "";
|
|
|
this.ruleForm = {
|
|
|
infoNo: this.id || "",
|
|
|
bidNo: bidNo || "",
|
|
|
infoNo: this.id || "",
|
|
|
- cat_id: this.type === "add" ? [this.askItem.cat_id] : [cat_id] || [],
|
|
|
+ cat_id: cat_id ? [cat_id] : [],
|
|
|
supplierNo: supplierNo ? [supplierNo] : [],
|
|
|
- pname: this.type === "add" ? this.askItem.good_name : good_name || "",
|
|
|
+ pname: good_name || "",
|
|
|
expire_day: expire_day || "0", //有效期
|
|
|
delivery_day: delivery_day || "0", //物流时间
|
|
|
work_day: work_day || "0", //生产工期
|
|
|
- color: this.type === "add" ? this.askItem.color : color || "",
|
|
|
- model: this.type === "add" ? this.askItem.model : model || "",
|
|
|
- material:
|
|
|
- this.type === "add" ? this.askItem.material : material || "",
|
|
|
- brandid:
|
|
|
- this.type === "add" && this.askItem.brand_id
|
|
|
- ? [this.askItem.brand_id]
|
|
|
- : brand_id
|
|
|
- ? [brand_id]
|
|
|
- : [],
|
|
|
- unit_id:
|
|
|
- this.type === "add"
|
|
|
- ? [this.askItem.unit]
|
|
|
- : unit_id
|
|
|
- ? [unit_id]
|
|
|
- : [],
|
|
|
- weight:
|
|
|
- this.type === "add" ? this.askItem.total_weight : weight || "0.000",
|
|
|
+ brandid: brand_id ? [brand_id] : [],
|
|
|
+ unit_id: unit_id ? [unit_id] : [],
|
|
|
+ weight: weight || "0.000",
|
|
|
tax: tax ? tax + "%" : "",
|
|
|
supply_area: supply_area || "",
|
|
|
origin_place: origin_place ? origin_place.split(",") : [],
|
|
@@ -790,28 +783,20 @@ export default {
|
|
|
nake_fee: nake_fee || "0.00",
|
|
|
pay_way: pay_way || "",
|
|
|
send_way: send_way || "",
|
|
|
- noble_weight:
|
|
|
- this.type === "add"
|
|
|
- ? this.askItem.specs_weight
|
|
|
- : noble_weight || "0.000",
|
|
|
+ noble_weight: noble_weight || "0.000",
|
|
|
|
|
|
- metal_id:
|
|
|
- this.type === "add" ? this.askItem.metal_id : metal_id || "",
|
|
|
- is_gold_price:
|
|
|
- this.type === "add"
|
|
|
- ? this.askItem.is_gold_price
|
|
|
- : is_gold_price || "",
|
|
|
+ metal_id: metal_id || "",
|
|
|
+ is_gold_price: is_gold_price || "",
|
|
|
is_diff: is_diff || "",
|
|
|
- config: config ? [config] : [],
|
|
|
+ config: config ? config.split(",") : [],
|
|
|
other_config: other_config || "",
|
|
|
remark: remark || "",
|
|
|
cost_desc: cost_desc || "",
|
|
|
- good_img:
|
|
|
- this.type === "add" ? this.askItem.good_img : good_img || "",
|
|
|
+ good_img: good_img || "",
|
|
|
};
|
|
|
|
|
|
- console.log(this.ruleForm);
|
|
|
this.status = status;
|
|
|
+ console.log(this.ruleForm.origin_place);
|
|
|
} else if (code >= 100 && code <= 104) {
|
|
|
await this.logout();
|
|
|
} else {
|
|
@@ -822,7 +807,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));
|
|
|
model.cat_id = model.cat_id[model.cat_id.length - 1];
|
|
|
model.brandid = model.brandid.toString();
|
|
@@ -831,6 +820,15 @@ export default {
|
|
|
model.unit_id = model.unit_id.toString();
|
|
|
model.config = model.config.toString();
|
|
|
model.tax = parseInt(model.tax + "") + "";
|
|
|
+ model.specinfo = [];
|
|
|
+ let list = JSON.parse(JSON.stringify(this.spec_tableData));
|
|
|
+ list.forEach((a) => {
|
|
|
+ let am = {
|
|
|
+ specid: a.specid,
|
|
|
+ spec_value_id: a.spec_value_id,
|
|
|
+ };
|
|
|
+ model.specinfo.push(am);
|
|
|
+ });
|
|
|
console.log(model);
|
|
|
let res = {};
|
|
|
if (this.type === "add") {
|
|
@@ -850,6 +848,10 @@ export default {
|
|
|
this.showModelThis = false;
|
|
|
// 刷新
|
|
|
this.$emit("refresh");
|
|
|
+ } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
+ await this.logout();
|
|
|
+ } else {
|
|
|
+ this.$message.warning(res.message);
|
|
|
}
|
|
|
} else {
|
|
|
console.log("error submit!!");
|
|
@@ -864,12 +866,12 @@ export default {
|
|
|
if (this.$refs.ruleForm) {
|
|
|
this.$refs.ruleForm.resetFields();
|
|
|
this.$refs.ruleForm.clearValidate();
|
|
|
+ this.spec_tableData = [];
|
|
|
console.log(this.askItem);
|
|
|
// const { can_id_arr } = this.askItem;
|
|
|
this.is_noble = this.askItem.is_metal;
|
|
|
- this.cat_id_name = this.type === "add" ? this.askItem.cat_name : "";
|
|
|
- // console.log(this.cat_id_name);
|
|
|
- // console.log(this.askItem);
|
|
|
+ this.cat_id_name = this.type === "add" ? this.askItem.can_name : "";
|
|
|
+
|
|
|
this.brand_name = this.type === "add" ? this.askItem.brand : "";
|
|
|
this.unit_name = this.type === "add" ? this.askItem.unit_name : "";
|
|
|
this.ruleForm = {
|
|
@@ -880,9 +882,6 @@ export default {
|
|
|
expire_day: "0", //有效期
|
|
|
delivery_day: "0", //物流时间
|
|
|
work_day: "0", //生产工期
|
|
|
- color: this.type === "add" ? this.askItem.color : "",
|
|
|
- model: this.type === "add" ? this.askItem.model : "",
|
|
|
- material: this.type === "add" ? this.askItem.material : "",
|
|
|
brandid:
|
|
|
this.type === "add" && this.askItem.brand_id
|
|
|
? [this.askItem.brand_id]
|
|
@@ -908,12 +907,22 @@ export default {
|
|
|
is_gold_price:
|
|
|
this.type === "add" ? this.askItem.is_gold_price : "",
|
|
|
is_diff: "",
|
|
|
- config: [],
|
|
|
- other_config: "",
|
|
|
+ config:
|
|
|
+ this.type === "add"
|
|
|
+ ? this.askItem.config
|
|
|
+ ? this.askItem.config.split(",")
|
|
|
+ : []
|
|
|
+ : [],
|
|
|
+ other_config: this.type === "add" ? this.askItem.other_config : "",
|
|
|
remark: "",
|
|
|
- cost_desc: "",
|
|
|
+ cost_desc: this.type === "add" ? this.askItem.cost_desc : "",
|
|
|
good_img: this.type === "add" ? this.askItem.good_img : "",
|
|
|
};
|
|
|
+ if (this.type === "add") {
|
|
|
+ this.spec_tableData = JSON.parse(
|
|
|
+ JSON.stringify(this.askItem.specinfo)
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -944,14 +953,23 @@ export default {
|
|
|
//分类选择
|
|
|
async cat_id_change(e) {
|
|
|
const { pid, id, label } = e;
|
|
|
- if (id) {
|
|
|
- this.ruleForm.cat_id = [id];
|
|
|
- this.is_noble = pid === "6";
|
|
|
- } else {
|
|
|
- this.ruleForm.cat_id = [];
|
|
|
- this.is_noble = false;
|
|
|
- }
|
|
|
+ this.ruleForm.cat_id = id ? [id] : [];
|
|
|
+ this.is_noble = pid === "6";
|
|
|
this.$refs.ruleForm.validateField("cat_id");
|
|
|
+ this.setrules();
|
|
|
+ },
|
|
|
+ setrules() {
|
|
|
+ let list = [
|
|
|
+ "noble_weight",
|
|
|
+ "metal_id",
|
|
|
+ "is_gold_price",
|
|
|
+ "is_diff",
|
|
|
+ "config",
|
|
|
+ "other_config",
|
|
|
+ ];
|
|
|
+ for (let i = 0; i < list.length; i++) {
|
|
|
+ this.rules[list[i]][0].required = this.is_noble;
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
//品牌选择
|
|
@@ -1105,6 +1123,50 @@ export default {
|
|
|
good_img: "",
|
|
|
};
|
|
|
},
|
|
|
+ addFormData() {
|
|
|
+ this.status = "";
|
|
|
+ this.is_noble = false;
|
|
|
+ this.cat_id_name = "";
|
|
|
+ this.brand_name = "";
|
|
|
+ this.unit_name = "";
|
|
|
+ this.ruleForm = {
|
|
|
+ infoNo: "",
|
|
|
+ cat_id: [],
|
|
|
+ supplierNo: [],
|
|
|
+ pname: "",
|
|
|
+ expire_day: "0", //有效期
|
|
|
+ delivery_day: "0", //物流时间
|
|
|
+ work_day: "0", //生产工期
|
|
|
+ color: "",
|
|
|
+ model: "",
|
|
|
+ material: "",
|
|
|
+ brandid: [],
|
|
|
+ unit_id: [],
|
|
|
+ weight: "0.000",
|
|
|
+ tax: "",
|
|
|
+ supply_area: "",
|
|
|
+ origin_place: [],
|
|
|
+ cert_fee: "0.00",
|
|
|
+ pakge_fee: "0.00",
|
|
|
+ cost_fee: "0.00",
|
|
|
+ mark_fee: "0.00",
|
|
|
+ demo_fee: "0.00",
|
|
|
+ open_fee: "0.00",
|
|
|
+ delivery_fee: "0.00",
|
|
|
+ nake_fee: "0.00",
|
|
|
+ pay_way: "",
|
|
|
+ send_way: "",
|
|
|
+ noble_weight: "0.000",
|
|
|
+ metal_id: "",
|
|
|
+ is_gold_price: "",
|
|
|
+ is_diff: "",
|
|
|
+ config: [],
|
|
|
+ other_config: "",
|
|
|
+ remark: "",
|
|
|
+ cost_desc: "",
|
|
|
+ good_img: "",
|
|
|
+ };
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|