|
@@ -5,6 +5,7 @@
|
|
|
:rules="rulesThis"
|
|
|
ref="ruleForm"
|
|
|
:size="'mini'"
|
|
|
+ v-loading="loading"
|
|
|
label-width="110px"
|
|
|
class="demo-ruleForm"
|
|
|
>
|
|
@@ -24,7 +25,9 @@
|
|
|
<good-class
|
|
|
:value="ruleForm.cat_id"
|
|
|
@handleChange="goods_class_change"
|
|
|
- :disabled="type === 'view' || type === 'editBase'"
|
|
|
+ :disabled="
|
|
|
+ type === 'view' || type === 'editBase' || type === 'editCoin'
|
|
|
+ "
|
|
|
:size="'mini'"
|
|
|
:isDetail="type !== 'add'"
|
|
|
:placeholder="'商品分类'"
|
|
@@ -36,7 +39,7 @@
|
|
|
<el-input
|
|
|
placeholder="商品名称"
|
|
|
maxlength="100"
|
|
|
- :disabled="type === 'view'"
|
|
|
+ :disabled="type === 'view'||type === 'editCoin'"
|
|
|
v-model="ruleForm.good_name"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
@@ -47,7 +50,7 @@
|
|
|
<search-work-company
|
|
|
:value="ruleForm.company_id"
|
|
|
:placeholder="'业务公司'"
|
|
|
- :disabled="type === 'view' || type === 'editBase'"
|
|
|
+ :disabled="type === 'view' || type === 'editBase'||type === 'editCoin'"
|
|
|
:size="'mini'"
|
|
|
:isDetail="type !== 'add'"
|
|
|
@searchChange="company_idsearchChange"
|
|
@@ -59,7 +62,7 @@
|
|
|
<search-supplier
|
|
|
:value="ruleForm.supplierNo"
|
|
|
:placeholder="'供应商'"
|
|
|
- :disabled="type === 'view' || type === 'editBase'"
|
|
|
+ :disabled="type === 'view' ||type === 'editCoin'"
|
|
|
:size="'mini'"
|
|
|
:isDetail="type !== 'add'"
|
|
|
@searchChange="supplierNosearchChange"
|
|
@@ -72,7 +75,7 @@
|
|
|
v-model="ruleForm.is_auth"
|
|
|
filterable
|
|
|
clearable
|
|
|
- :disabled="type === 'view'"
|
|
|
+ :disabled="type === 'view'||type === 'editCoin'"
|
|
|
style="width: 100%"
|
|
|
placeholder="销售权限"
|
|
|
>
|
|
@@ -89,7 +92,7 @@
|
|
|
<el-form-item label="商品品牌" prop="brandid">
|
|
|
<search-brand
|
|
|
:value="ruleForm.brandid"
|
|
|
- :disabled="type === 'view'"
|
|
|
+ :disabled="type === 'view'||type === 'editCoin'"
|
|
|
:size="'mini'"
|
|
|
:isDetail="type !== 'add'"
|
|
|
:names="brand_name"
|
|
@@ -102,7 +105,7 @@
|
|
|
<el-form-item label="商品单位" prop="unit">
|
|
|
<search-unit
|
|
|
:value="ruleForm.unit"
|
|
|
- :disabled="type === 'view' || type === 'editBase'"
|
|
|
+ :disabled="type === 'view' ||type === 'editCoin'"
|
|
|
:size="'mini'"
|
|
|
:isDetail="type !== 'add'"
|
|
|
:names="unit_name"
|
|
@@ -117,7 +120,7 @@
|
|
|
v-model="ruleForm.is_exclusive"
|
|
|
filterable
|
|
|
clearable
|
|
|
- :disabled="type === 'view'"
|
|
|
+ :disabled="type === 'view'||type === 'editCoin'"
|
|
|
style="width: 100%"
|
|
|
placeholder="专属类型"
|
|
|
>
|
|
@@ -136,7 +139,7 @@
|
|
|
<el-input
|
|
|
placeholder="商品总重量"
|
|
|
v-model="ruleForm.weight"
|
|
|
- :disabled="type === 'view'"
|
|
|
+ :disabled="type === 'view'||type === 'editCoin'"
|
|
|
type="number"
|
|
|
:min="0"
|
|
|
:max="9999999999.99"
|
|
@@ -152,7 +155,7 @@
|
|
|
v-model="ruleForm.is_stock"
|
|
|
filterable
|
|
|
clearable
|
|
|
- :disabled="type === 'view' || type === 'editBase'"
|
|
|
+ :disabled="type === 'view' || type === 'editBase'||type === 'editCoin'"
|
|
|
style="width: 100%"
|
|
|
placeholder="是否库存品"
|
|
|
>
|
|
@@ -169,7 +172,7 @@
|
|
|
<el-form-item label="税点" prop="tax">
|
|
|
<search-tax
|
|
|
:value="ruleForm.tax"
|
|
|
- :disabled="type === 'view' || type === 'editBase'"
|
|
|
+ :disabled="type === 'view' || type === 'editBase'||type === 'editCoin'"
|
|
|
:size="'mini'"
|
|
|
:isDetail="type !== 'add'"
|
|
|
:placeholder="'税点'"
|
|
@@ -182,7 +185,7 @@
|
|
|
<el-input
|
|
|
placeholder="贵金属重量"
|
|
|
v-model="ruleForm.noble_weight"
|
|
|
- :disabled="type === 'view' || type === 'editBase'"
|
|
|
+ :disabled="type === 'view' || type === 'editBase'||type === 'editCoin'"
|
|
|
type="number"
|
|
|
:min="0"
|
|
|
:max="9999999999.99"
|
|
@@ -196,7 +199,7 @@
|
|
|
<el-form-item label="贵金属种类" prop="noble_metal">
|
|
|
<search-metal-kind
|
|
|
:value="ruleForm.noble_metal"
|
|
|
- :disabled="type === 'view' || type === 'editBase'"
|
|
|
+ :disabled="type === 'view' || type === 'editBase'||type === 'editCoin'"
|
|
|
:size="'mini'"
|
|
|
:isDetail="type !== 'add'"
|
|
|
:placeholder="'贵金属种类'"
|
|
@@ -210,7 +213,7 @@
|
|
|
v-model="ruleForm.is_gold_price"
|
|
|
filterable
|
|
|
clearable
|
|
|
- :disabled="type === 'view' || type === 'editBase'"
|
|
|
+ :disabled="type === 'view' || type === 'editBase'||type === 'editCoin'"
|
|
|
style="width: 100%"
|
|
|
placeholder="启用实时金价"
|
|
|
>
|
|
@@ -229,7 +232,7 @@
|
|
|
<el-input
|
|
|
type="textarea"
|
|
|
:rows="4"
|
|
|
- :disabled="type === 'view'"
|
|
|
+ :disabled="type === 'view'||type === 'editCoin'"
|
|
|
placeholder="售后说明"
|
|
|
v-model="ruleForm.after_sales"
|
|
|
>
|
|
@@ -241,7 +244,7 @@
|
|
|
<el-input
|
|
|
type="textarea"
|
|
|
:rows="4"
|
|
|
- :disabled="type === 'view'"
|
|
|
+ :disabled="type === 'view'||type === 'editCoin'"
|
|
|
placeholder="商品备注"
|
|
|
v-model="ruleForm.good_remark"
|
|
|
>
|
|
@@ -252,7 +255,7 @@
|
|
|
<el-form-item label="工艺说明" prop="craft_desc">
|
|
|
<el-input
|
|
|
type="textarea"
|
|
|
- :disabled="type === 'view'"
|
|
|
+ :disabled="type === 'view'||type === 'editCoin'"
|
|
|
:rows="4"
|
|
|
placeholder="工艺说明"
|
|
|
v-model="ruleForm.craft_desc"
|
|
@@ -265,7 +268,7 @@
|
|
|
<el-select
|
|
|
v-model="ruleForm.good_type"
|
|
|
filterable
|
|
|
- :disabled="type === 'view' || type === 'editBase'"
|
|
|
+ :disabled="type === 'view' || type === 'editBase'||type === 'editCoin'"
|
|
|
clearable
|
|
|
style="width: 100%"
|
|
|
placeholder="是否定制"
|
|
@@ -285,7 +288,7 @@
|
|
|
placeholder="定制起订量"
|
|
|
v-model="ruleForm.moq"
|
|
|
type="number"
|
|
|
- :disabled="type === 'view'"
|
|
|
+ :disabled="type === 'view'||type === 'editCoin'"
|
|
|
:min="0"
|
|
|
:max="9999999999"
|
|
|
:step="0"
|
|
@@ -297,7 +300,7 @@
|
|
|
<el-input
|
|
|
placeholder="定制工期"
|
|
|
v-model="ruleForm.customized"
|
|
|
- :disabled="type === 'view'"
|
|
|
+ :disabled="type === 'view'||type === 'editCoin'"
|
|
|
type="number"
|
|
|
:min="0"
|
|
|
:max="9999999999"
|
|
@@ -321,10 +324,15 @@
|
|
|
</ul>
|
|
|
</el-col>
|
|
|
<el-col :span="23" class="dmain" style="padding: 20px 0 20px 18px">
|
|
|
- <el-table :data="tableData" :size="'mini'" border style="width: 100%">
|
|
|
+ <el-table
|
|
|
+ :data="spec_tableData"
|
|
|
+ :size="'mini'"
|
|
|
+ border
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
<el-table-column prop="spec_value" label="规格类型" />
|
|
|
<el-table-column prop="spec_value_value" label="规格值" />
|
|
|
- <el-table-column fixed="right">
|
|
|
+ <el-table-column fixed="right" v-if="type === 'add'||type === 'editBase'">
|
|
|
<template slot="header" slot-scope="scope">
|
|
|
<span>操作</span>
|
|
|
<el-tooltip
|
|
@@ -378,7 +386,7 @@
|
|
|
<el-form-item label="包装清单" prop="packing_list">
|
|
|
<el-input
|
|
|
placeholder="包装清单"
|
|
|
- :disabled="type === 'view'"
|
|
|
+ :disabled="type === 'view'||type === 'editCoin'"
|
|
|
v-model="ruleForm.packing_list"
|
|
|
maxlength="250"
|
|
|
/>
|
|
@@ -388,7 +396,7 @@
|
|
|
<el-form-item label="包装方式" prop="packing_way">
|
|
|
<el-input
|
|
|
placeholder="包装方式"
|
|
|
- :disabled="type === 'view'"
|
|
|
+ :disabled="type === 'view'||type === 'editCoin'"
|
|
|
v-model="ruleForm.packing_way"
|
|
|
maxlength="250"
|
|
|
/>
|
|
@@ -398,7 +406,7 @@
|
|
|
<el-form-item label="装箱规格" prop="packing_spec">
|
|
|
<el-input
|
|
|
placeholder="装箱规格"
|
|
|
- :disabled="type === 'view'"
|
|
|
+ :disabled="type === 'view'||type === 'editCoin'"
|
|
|
v-model="ruleForm.packing_spec"
|
|
|
maxlength="250"
|
|
|
/>
|
|
@@ -408,7 +416,7 @@
|
|
|
<el-form-item label="装箱重量" prop="packing_weight">
|
|
|
<el-input
|
|
|
placeholder="装箱重量"
|
|
|
- :disabled="type === 'view'"
|
|
|
+ :disabled="type === 'view'||type === 'editCoin'"
|
|
|
v-model="ruleForm.packing_weight"
|
|
|
type="number"
|
|
|
:min="0"
|
|
@@ -423,7 +431,7 @@
|
|
|
<el-form-item label="装箱尺寸" prop="packing_size">
|
|
|
<el-input
|
|
|
placeholder="装箱尺寸"
|
|
|
- :disabled="type === 'view'"
|
|
|
+ :disabled="type === 'view'||type === 'editCoin'"
|
|
|
v-model="ruleForm.packing_size"
|
|
|
maxlength="250"
|
|
|
/>
|
|
@@ -434,7 +442,7 @@
|
|
|
<el-form-item label="商品条形码" prop="good_bar">
|
|
|
<el-input
|
|
|
placeholder="物流时间"
|
|
|
- :disabled="type === 'view'"
|
|
|
+ :disabled="type === 'view'||type === 'editCoin'"
|
|
|
v-model="ruleForm.good_bar"
|
|
|
type="number"
|
|
|
:min="0"
|
|
@@ -463,7 +471,7 @@
|
|
|
v-model="ruleForm.supply_area"
|
|
|
filterable
|
|
|
clearable
|
|
|
- :disabled="type === 'view'"
|
|
|
+ :disabled="type === 'view'||type === 'editCoin'"
|
|
|
style="width: 100%"
|
|
|
placeholder="供货区域"
|
|
|
>
|
|
@@ -482,7 +490,7 @@
|
|
|
:placeholder="'发货地'"
|
|
|
:value="ruleForm.delivery_place"
|
|
|
:is-detail="id !== 'add'"
|
|
|
- :disabled="type === 'view'"
|
|
|
+ :disabled="type === 'view'||type === 'editCoin'"
|
|
|
:size="'mini'"
|
|
|
@selectChange="selectAreadelivery_place"
|
|
|
/>
|
|
@@ -495,7 +503,7 @@
|
|
|
:value="ruleForm.origin_place"
|
|
|
:size="'mini'"
|
|
|
:is-detail="id !== 'add'"
|
|
|
- :disabled="type === 'view'"
|
|
|
+ :disabled="type === 'view'||type === 'editCoin'"
|
|
|
@selectChange="selectAreaorigin_place"
|
|
|
/>
|
|
|
</el-form-item>
|
|
@@ -507,7 +515,7 @@
|
|
|
v-model="ruleForm.delivery_day"
|
|
|
type="number"
|
|
|
:min="0"
|
|
|
- :disabled="type === 'view'"
|
|
|
+ :disabled="type === 'view'||type === 'editCoin'"
|
|
|
:max="9999999999"
|
|
|
:step="0"
|
|
|
>
|
|
@@ -522,7 +530,7 @@
|
|
|
v-model="ruleForm.lead_time"
|
|
|
type="number"
|
|
|
:min="0"
|
|
|
- :disabled="type === 'view'"
|
|
|
+ :disabled="type === 'view'||type === 'editCoin'"
|
|
|
:max="9999999999"
|
|
|
:step="0"
|
|
|
>
|
|
@@ -537,7 +545,7 @@
|
|
|
v-model="ruleForm.sample_day"
|
|
|
type="number"
|
|
|
:min="0"
|
|
|
- :disabled="type === 'view'"
|
|
|
+ :disabled="type === 'view'||type === 'editCoin'"
|
|
|
:max="9999999999"
|
|
|
:step="0"
|
|
|
>
|
|
@@ -574,7 +582,7 @@
|
|
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
<file-upload
|
|
|
class="Upload"
|
|
|
- :disabled="type === 'view'"
|
|
|
+ :disabled="type === 'view'||type === 'editCoin'"
|
|
|
:accept="'.jpg,.png,.jpeg'"
|
|
|
:multiple="true"
|
|
|
:uploadcondition="beforeAvatarUpload"
|
|
@@ -628,7 +636,7 @@
|
|
|
<div class="img-show-li-div">
|
|
|
<img :src="img" class="img-show" alt="" />
|
|
|
<i
|
|
|
- v-if="type !== 'view'"
|
|
|
+ v-if="type == 'add'||type==='editBase'"
|
|
|
class="el-icon-close"
|
|
|
@click="closeImg(iindex)"
|
|
|
></i>
|
|
@@ -636,14 +644,14 @@
|
|
|
</li>
|
|
|
<li
|
|
|
class="img-show-li"
|
|
|
- v-if="ruleForm.good_info_img.length < 10 && type !== 'view'"
|
|
|
+ v-if="ruleForm.good_info_img.length < 10 && (type == 'add'||type==='editBase')"
|
|
|
>
|
|
|
<div class="activity-upload">
|
|
|
<div class="btnupload" style="position: relative">
|
|
|
<i class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
<file-upload
|
|
|
class="Upload"
|
|
|
- :disabled="type === 'view'"
|
|
|
+ :disabled="type === 'view'||type === 'editCoin'"
|
|
|
:accept="'.jpg,.png,.jpeg'"
|
|
|
:multiple="true"
|
|
|
:uploadcondition="beforeAvatarUpload"
|
|
@@ -841,7 +849,7 @@
|
|
|
</el-col>
|
|
|
<el-col :span="24" style="padding-left: 18px">
|
|
|
<el-table
|
|
|
- :data="tableData1"
|
|
|
+ :data="ladder_tableData"
|
|
|
:size="'mini'"
|
|
|
border
|
|
|
stripe
|
|
@@ -890,7 +898,7 @@
|
|
|
</el-col>
|
|
|
<el-col
|
|
|
:span="24"
|
|
|
- v-if="id !== '007'"
|
|
|
+ v-if="type === 'editBase' || type === 'add' || type === 'editCoin'"
|
|
|
style="
|
|
|
text-align: right;
|
|
|
padding: 15px 0 15px 0;
|
|
@@ -963,8 +971,8 @@ export default {
|
|
|
status: "",
|
|
|
rulesThis: this.rules,
|
|
|
activeName: "1",
|
|
|
- loading: false,
|
|
|
- tableData: [],
|
|
|
+ loading: true,
|
|
|
+
|
|
|
options1: options1,
|
|
|
options2: options2,
|
|
|
options3: options3,
|
|
@@ -973,7 +981,10 @@ export default {
|
|
|
options6: options6,
|
|
|
options7: options7,
|
|
|
ruleForm: {},
|
|
|
- tableData1: [],
|
|
|
+ spec_tableData: [],
|
|
|
+ old_spec_tableData: [],
|
|
|
+ ladder_tableData: [],
|
|
|
+ old_ladder_tableData: [],
|
|
|
rules: rules,
|
|
|
};
|
|
|
},
|
|
@@ -983,6 +994,7 @@ export default {
|
|
|
methods: {
|
|
|
async initForm() {
|
|
|
this.loading = true;
|
|
|
+
|
|
|
this.resetFormData();
|
|
|
this.rulesThis = this.rules;
|
|
|
await this.resetForm();
|
|
@@ -1005,18 +1017,16 @@ export default {
|
|
|
await this.$refs.ruleForm.validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
this.loading = true;
|
|
|
- if (this.tableData.length === 0) {
|
|
|
+ if (this.spec_tableData.length === 0) {
|
|
|
this.$message.warning("请录入商品规格信息!");
|
|
|
this.loading = false;
|
|
|
return;
|
|
|
}
|
|
|
- if (this.tableData1.length === 0) {
|
|
|
+ if (this.ladder_tableData.length === 0) {
|
|
|
this.$message.warning("请录入阶梯成本!");
|
|
|
this.loading = false;
|
|
|
}
|
|
|
let model = JSON.parse(JSON.stringify(this.ruleForm));
|
|
|
- model.speclist = JSON.parse(JSON.stringify(this.tableData));
|
|
|
- model.good_ladder = JSON.parse(JSON.stringify(this.tableData1));
|
|
|
model.cat_id = model.cat_id[model.cat_id.length - 1];
|
|
|
model.brandid = model.brandid.toString();
|
|
|
model.supplierNo = model.supplierNo.toString();
|
|
@@ -1024,27 +1034,38 @@ export default {
|
|
|
model.origin_place = model.origin_place.toString();
|
|
|
model.good_info_img = model.good_info_img.toString();
|
|
|
model.unit = model.unit.toString();
|
|
|
+ model.speclist = JSON.parse(JSON.stringify(this.setResData(1)));
|
|
|
+ model.good_ladder = JSON.parse(JSON.stringify(this.setResData(2)));
|
|
|
let res = {};
|
|
|
+ delete model["id"];
|
|
|
if (this.type === "add") {
|
|
|
delete model["id"];
|
|
|
delete model["spuCode"];
|
|
|
res = await asyncRequest.add(model);
|
|
|
} else if (this.type === "editBase") {
|
|
|
- res = await asyncRequest.update(model);
|
|
|
+ let item1 = this.setModel(model, "1");
|
|
|
+ res = await asyncRequest.update(item1);
|
|
|
} else {
|
|
|
- res = await asyncRequest.updateP(model);
|
|
|
+ let item2 = this.setModel(model, "2");
|
|
|
+ res = await asyncRequest.updateP(item2);
|
|
|
}
|
|
|
console.log(res);
|
|
|
this.loading = false;
|
|
|
if (res && res.code === 0) {
|
|
|
- // const title = this.id === "add" ? "!" : "修改成功!";
|
|
|
+ const { spuCode } = res.data;
|
|
|
+ const title =
|
|
|
+ this.type === "add"
|
|
|
+ ? "新建成功!"
|
|
|
+ : this.type === "editBase"
|
|
|
+ ? "基础信息修改成功!"
|
|
|
+ : "成本信息修改成功!";
|
|
|
this.$notify.success({
|
|
|
- title: "添加成功",
|
|
|
+ title: title,
|
|
|
message: "",
|
|
|
});
|
|
|
this.showModelThis = false;
|
|
|
// 刷新
|
|
|
- this.$emit("refresh");
|
|
|
+ this.$emit("refresh", { spuCode: spuCode });
|
|
|
}
|
|
|
} else {
|
|
|
console.log("error submit!!");
|
|
@@ -1052,7 +1073,105 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
-
|
|
|
+ //获取规格值
|
|
|
+ setResData(type) {
|
|
|
+ let list = JSON.parse(
|
|
|
+ JSON.stringify(type === 1 ? this.spec_tableData : this.ladder_tableData)
|
|
|
+ );
|
|
|
+ let oldlist = JSON.parse(
|
|
|
+ JSON.stringify(
|
|
|
+ type === 1 ? this.old_spec_tableData : this.old_ladder_tableData
|
|
|
+ )
|
|
|
+ );
|
|
|
+ let hasIDlist = [];
|
|
|
+ list.forEach((a) => {
|
|
|
+ if (a.id !== "") {
|
|
|
+ hasIDlist.push(a);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ let newList = [];
|
|
|
+ let resList = [];
|
|
|
+ oldlist.forEach((a, ai) => {
|
|
|
+ let item = null;
|
|
|
+ let index = hasIDlist.findIndex((b) => a.id === b.id);
|
|
|
+ if (index === -1) {
|
|
|
+ item = JSON.parse(JSON.stringify(a));
|
|
|
+ item.is_del = "1";
|
|
|
+ } else {
|
|
|
+ item = JSON.parse(JSON.stringify(hasIDlist[index]));
|
|
|
+ }
|
|
|
+ newList.push(item);
|
|
|
+ });
|
|
|
+ list.forEach((b) => {
|
|
|
+ if (b.id === "") {
|
|
|
+ b.is_del = "0";
|
|
|
+ newList.push(b);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (type === 1) {
|
|
|
+ newList.forEach((a) => {
|
|
|
+ let m = {
|
|
|
+ id: a.id,
|
|
|
+ spec_id: a.spec_id,
|
|
|
+ spec_value_id: a.spec_value_id,
|
|
|
+ is_del: a.is_del || "0",
|
|
|
+ };
|
|
|
+ resList.push(m);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ newList.forEach((a) => {
|
|
|
+ let m = {
|
|
|
+ id: a.id,
|
|
|
+ min_num: a.min_num,
|
|
|
+ nake_fee: a.nake_fee,
|
|
|
+ cost_fee: a.cost_fee,
|
|
|
+ delivery_fee: a.delivery_fee,
|
|
|
+ is_del: a.is_del || "0",
|
|
|
+ };
|
|
|
+ resList.push(m);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return resList;
|
|
|
+ },
|
|
|
+ setladder() {
|
|
|
+ let list = JSON.parse(JSON.stringify(this.ladder_tableData));
|
|
|
+ let oldlist = JSON.parse(JSON.stringify(this.old_ladder_tableData));
|
|
|
+ let hasIDlist = [];
|
|
|
+ list.forEach((a) => {
|
|
|
+ if (a.id !== "") {
|
|
|
+ hasIDlist.push(a);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ let newList = [];
|
|
|
+ let resList = [];
|
|
|
+ oldlist.forEach((a, ai) => {
|
|
|
+ let item = null;
|
|
|
+ let index = hasIDlist.findIndex((b) => a.id === b.id);
|
|
|
+ if (index === -1) {
|
|
|
+ item = JSON.parse(JSON.stringify(a));
|
|
|
+ item.is_del = "1";
|
|
|
+ } else {
|
|
|
+ item = JSON.parse(JSON.stringify(b));
|
|
|
+ }
|
|
|
+ newList.push(item);
|
|
|
+ });
|
|
|
+ list.forEach((b) => {
|
|
|
+ if (b.id === "") {
|
|
|
+ b.is_del = "0";
|
|
|
+ newList.push(b);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ newList.forEach((a) => {
|
|
|
+ let m = {
|
|
|
+ id: a.id,
|
|
|
+ min_num: a.min_num,
|
|
|
+ spec_value_id: a.spec_value_id,
|
|
|
+ is_del: a.is_del || "0",
|
|
|
+ };
|
|
|
+ resList.push(m);
|
|
|
+ });
|
|
|
+ return resList;
|
|
|
+ },
|
|
|
//规格编辑修改
|
|
|
refreshEdit(e) {
|
|
|
let item = JSON.parse(JSON.stringify(e));
|
|
@@ -1065,15 +1184,15 @@ export default {
|
|
|
spec_value_value,
|
|
|
} = item;
|
|
|
if (index + "" === "-1") {
|
|
|
- this.tableData.push(item);
|
|
|
+ this.spec_tableData.push(item);
|
|
|
} else {
|
|
|
- this.tableData.forEach((i, findex) => {
|
|
|
+ this.spec_tableData.forEach((i, findex) => {
|
|
|
if (i.spec_id === spec_id) {
|
|
|
- this.tableData[findex].id = id;
|
|
|
- this.tableData[findex].spec_id = spec_id;
|
|
|
- this.tableData[findex].spec_value = spec_value;
|
|
|
- this.tableData[findex].spec_value_id = spec_value_id;
|
|
|
- this.tableData[findex].spec_value_value = spec_value_value;
|
|
|
+ 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].spec_value_id = spec_value_id;
|
|
|
+ this.spec_tableData[findex].spec_value_value = spec_value_value;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -1086,18 +1205,20 @@ export default {
|
|
|
const { index, id, cost_fee, delivery_fee, min_num, spec_value_value } =
|
|
|
item;
|
|
|
if (index + "" === "-1") {
|
|
|
- this.tableData1.push(item);
|
|
|
+ this.ladder_tableData.push(item);
|
|
|
} else {
|
|
|
- this.tableData1.forEach((i, findex) => {
|
|
|
+ this.ladder_tableData.forEach((i, findex) => {
|
|
|
if (i.id === id && findex === parseInt(i.index)) {
|
|
|
- this.tableData[findex].id = id;
|
|
|
- this.tableData[findex].cost_fee = cost_fee;
|
|
|
- this.tableData[findex].delivery_fee = delivery_fee;
|
|
|
- this.tableData[findex].min_num = min_num;
|
|
|
- this.tableData[findex].spec_value_value = spec_value_value;
|
|
|
+ this.spec_tableData[findex].id = id;
|
|
|
+ this.spec_tableData[findex].cost_fee = cost_fee;
|
|
|
+ this.spec_tableData[findex].delivery_fee = delivery_fee;
|
|
|
+ this.spec_tableData[findex].min_num = min_num;
|
|
|
+ this.spec_tableData[findex].spec_value_value = spec_value_value;
|
|
|
}
|
|
|
});
|
|
|
- this.tableData1 = this.tableData1.sort(this.dataSort("min_num"));
|
|
|
+ this.ladder_tableData = this.ladder_tableData.sort(
|
|
|
+ this.dataSort("min_num")
|
|
|
+ );
|
|
|
}
|
|
|
this.showModel = false;
|
|
|
},
|
|
@@ -1110,6 +1231,10 @@ export default {
|
|
|
},
|
|
|
|
|
|
resetFormData() {
|
|
|
+ this.spec_tableData = [];
|
|
|
+ this.old_spec_tableData = [];
|
|
|
+ this.ladder_tableData = [];
|
|
|
+ this.old_ladder_tableData = [];
|
|
|
const {
|
|
|
id,
|
|
|
spuCode, //string 商品spuCode
|
|
@@ -1147,7 +1272,7 @@ export default {
|
|
|
lead_time, // string 供货周期
|
|
|
sample_day, //string 调样周期
|
|
|
sample_fee, // string 调样费有
|
|
|
- good_img, // string 商品图片
|
|
|
+ // good_img, // string 商品图片
|
|
|
good_thumb_img, // string 商品说略图
|
|
|
good_info_img, // string 商品详情图
|
|
|
cert_fee, // string 证书费
|
|
@@ -1162,7 +1287,7 @@ export default {
|
|
|
market_price, // string 市场价
|
|
|
nake_price, // string 成本裸价
|
|
|
is_step, // string 是否使用阶梯价
|
|
|
- is_online, // string 是否上线
|
|
|
+ // is_online, // string 是否上线
|
|
|
status, // string 状态
|
|
|
nakelist, //階梯成本
|
|
|
speclist, //商品规格
|
|
@@ -1181,12 +1306,12 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
this.is_noble = isok;
|
|
|
- this.tableData = [];
|
|
|
- let list1 =
|
|
|
+
|
|
|
+ let spec_list1 =
|
|
|
speclist && speclist.length > 0
|
|
|
? JSON.parse(JSON.stringify(speclist))
|
|
|
: [];
|
|
|
- list1.forEach((a) => {
|
|
|
+ spec_list1.forEach((a) => {
|
|
|
let model = {
|
|
|
id: a.id,
|
|
|
is_del: a.is_del,
|
|
@@ -1196,14 +1321,18 @@ export default {
|
|
|
spec_value_id: a.spec_value_id,
|
|
|
spuCode: a.spuCode,
|
|
|
};
|
|
|
- this.tableData.push(model);
|
|
|
+ this.spec_tableData.push(model);
|
|
|
});
|
|
|
- this.tableData1 = [];
|
|
|
+ this.old_spec_tableData = JSON.parse(JSON.stringify(this.spec_tableData));
|
|
|
+
|
|
|
let list2 =
|
|
|
nakelist && nakelist.length > 0
|
|
|
? JSON.parse(JSON.stringify(nakelist))
|
|
|
: [];
|
|
|
- this.tableData1 = list2;
|
|
|
+ this.ladder_tableData = list2;
|
|
|
+ this.old_ladder_tableData = JSON.parse(
|
|
|
+ JSON.stringify(this.ladder_tableData)
|
|
|
+ );
|
|
|
this.status = status;
|
|
|
this.brand_name = brand_name;
|
|
|
this.unit_name = unit;
|
|
@@ -1219,7 +1348,7 @@ export default {
|
|
|
supplierNo: supplierNo ? [supplierNo] : [],
|
|
|
company_id: "GSec37220215151111",
|
|
|
is_auth: is_auth || "",
|
|
|
- tax: tax + "%" || "",
|
|
|
+ tax: tax ? tax + "%" : "",
|
|
|
good_name: good_name || "",
|
|
|
unit: good_unit ? [good_unit] : [],
|
|
|
is_exclusive: is_exclusive || "",
|
|
@@ -1245,7 +1374,7 @@ export default {
|
|
|
sample_day: sample_day || "",
|
|
|
good_thumb_img: good_thumb_img || "",
|
|
|
// good_img: "",
|
|
|
- good_info_img: (good_info_img || "").split(","),
|
|
|
+ good_info_img: good_info_img ? (good_info_img || "").split(",") : [],
|
|
|
//固定阶梯成本
|
|
|
cert_fee: cert_fee || "",
|
|
|
packing_fee: packing_fee || "",
|
|
@@ -1269,6 +1398,59 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ setModel(model, type) {
|
|
|
+ let item = null;
|
|
|
+ if (type === 1) {
|
|
|
+ item = JSON.parse(JSON.stringify(model));
|
|
|
+ delete item["cert_fee"];
|
|
|
+ delete item["packing_fee"];
|
|
|
+ delete item["cost_fee"];
|
|
|
+ delete item["mark_fee"];
|
|
|
+ delete item["demo_fee"];
|
|
|
+ delete item["open_fee"];
|
|
|
+ delete item["noble_metal"];
|
|
|
+ delete item["noble_weight"];
|
|
|
+ delete item["is_gold_price"];
|
|
|
+ delete item["market_price"];
|
|
|
+ delete item["nake_price"];
|
|
|
+ delete item["is_step"];
|
|
|
+ delete item["good_ladder"];
|
|
|
+ } else {
|
|
|
+ const {
|
|
|
+ cert_fee,
|
|
|
+ packing_fee,
|
|
|
+ cost_fee,
|
|
|
+ mark_fee,
|
|
|
+ demo_fee,
|
|
|
+ open_fee,
|
|
|
+ noble_metal,
|
|
|
+ noble_weight,
|
|
|
+ is_gold_price,
|
|
|
+ market_price,
|
|
|
+ nake_price,
|
|
|
+ is_step,
|
|
|
+ good_ladder,
|
|
|
+ spuCode,
|
|
|
+ } = model;
|
|
|
+ item = {
|
|
|
+ cert_fee: cert_fee || "",
|
|
|
+ packing_fee: packing_fee || "",
|
|
|
+ cost_fee: cost_fee || "",
|
|
|
+ mark_fee: mark_fee || "",
|
|
|
+ demo_fee: demo_fee || "",
|
|
|
+ open_fee: open_fee || "",
|
|
|
+ noble_metal: noble_metal || "",
|
|
|
+ noble_weight: noble_weight || "",
|
|
|
+ is_gold_price: is_gold_price || "",
|
|
|
+ market_price: market_price || "",
|
|
|
+ nake_price: nake_price || "",
|
|
|
+ is_step: is_step || "",
|
|
|
+ good_ladder: good_ladder || [],
|
|
|
+ spuCode: spuCode || "",
|
|
|
+ };
|
|
|
+ }
|
|
|
+ return model;
|
|
|
+ },
|
|
|
//商品分类选择
|
|
|
goods_class_change(e) {
|
|
|
const { value, item } = e;
|