|
@@ -403,13 +403,12 @@
|
|
|
<el-form-item label="产地" prop="origin_place">
|
|
|
<search-area
|
|
|
:value="ruleForm.origin_place"
|
|
|
+ :names="origin_place_cn"
|
|
|
:is-detail="true"
|
|
|
:disabled="type === 'view'"
|
|
|
size="mini"
|
|
|
:placeholder="'产地'"
|
|
|
:level="3"
|
|
|
- :searchCode="true"
|
|
|
- :names="ruleForm.origin_place_codes"
|
|
|
@searchChange="selectAreaoriginChange($event)"
|
|
|
/>
|
|
|
</el-form-item>
|
|
@@ -418,6 +417,7 @@
|
|
|
<el-form-item label="发货地" prop="delivery_place">
|
|
|
<search-area
|
|
|
:value="ruleForm.delivery_place"
|
|
|
+ :names="delivery_place_cn"
|
|
|
:is-detail="true"
|
|
|
:disabled="type === 'view'"
|
|
|
size="mini"
|
|
@@ -511,7 +511,7 @@
|
|
|
</el-row>
|
|
|
</el-col>
|
|
|
|
|
|
- <el-col :span="24" v-show="is_noble">
|
|
|
+ <el-col :span="24" v-if="is_noble">
|
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="金属重量" prop="gold_weight">
|
|
@@ -559,7 +559,7 @@
|
|
|
:key="item + index"
|
|
|
:label="item"
|
|
|
:value="item"
|
|
|
- ></el-option>
|
|
|
+ />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -701,6 +701,8 @@ export default {
|
|
|
|
|
|
data() {
|
|
|
return {
|
|
|
+ origin_place_cn: "",
|
|
|
+ delivery_place_cn: "",
|
|
|
supplierName: [],
|
|
|
pid: "",
|
|
|
cat_id_name: "",
|
|
@@ -768,7 +770,6 @@ export default {
|
|
|
|
|
|
//判断其他文件规格
|
|
|
beforeOtherUpload(file) {
|
|
|
- console.log(file);
|
|
|
let isJPG = false;
|
|
|
if (
|
|
|
file.type === "application/vnd.ms-excel" ||
|
|
@@ -806,7 +807,6 @@ export default {
|
|
|
this.loading = false;
|
|
|
},
|
|
|
number_change(e, key) {
|
|
|
- console.log("----" + e + "--" + key);
|
|
|
this.ruleForm[key] = e + "" || "0";
|
|
|
const { is_determine_price, type } = this.ruleForm;
|
|
|
if (key === "price" && String(is_determine_price) == "1") {
|
|
@@ -827,7 +827,6 @@ export default {
|
|
|
|
|
|
//计算单价
|
|
|
getPrice(key) {
|
|
|
- console.log(key);
|
|
|
const { is_determine_price, type } = this.ruleForm;
|
|
|
if (
|
|
|
(key === "price" && String(is_determine_price) == "1") ||
|
|
@@ -865,7 +864,6 @@ export default {
|
|
|
},
|
|
|
//计算比例
|
|
|
getProp() {
|
|
|
- // console.log("222222222222");
|
|
|
const { is_determine_price, expect_service_proportion } = this.ruleForm;
|
|
|
if (String(is_determine_price) == "0") {
|
|
|
this.ruleForm.expect_service = accMul(
|
|
@@ -960,104 +958,109 @@ export default {
|
|
|
},
|
|
|
|
|
|
async submitForm() {
|
|
|
- await this.$refs.ruleForm.validate(async valid => {
|
|
|
- if (valid) {
|
|
|
- if (!this.loading) {
|
|
|
- this.loading = true;
|
|
|
- if (this.ruleForm.good_img.length > 10) {
|
|
|
- this.$message.warning("上传图片不能超过10张");
|
|
|
- this.loading = false;
|
|
|
- return;
|
|
|
- }
|
|
|
- if (this.spec_tableData.length === 0) {
|
|
|
- this.$message.warning("请填写规格!");
|
|
|
- this.loading = false;
|
|
|
- return;
|
|
|
- }
|
|
|
- if (this.is_noble) {
|
|
|
- this.ruleForm.cgd_charge = "0";
|
|
|
- }
|
|
|
+ try {
|
|
|
+ await this.$refs.ruleForm.validate();
|
|
|
|
|
|
- const {
|
|
|
- is_determine_price,
|
|
|
- expect_service,
|
|
|
- expect_service_proportion
|
|
|
- } = this.ruleForm;
|
|
|
- const prop = is_determine_price === "1" ? "price" : "cgd_charge";
|
|
|
- const label = is_determine_price === "1" ? "销售价" : "裸价";
|
|
|
+ if (!this.loading) {
|
|
|
+ this.loading = true;
|
|
|
+ if (this.ruleForm.good_img.length > 10) {
|
|
|
+ this.$message.warning("上传图片不能超过10张");
|
|
|
+ this.loading = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.spec_tableData.length === 0) {
|
|
|
+ this.$message.warning("请填写规格!");
|
|
|
+ this.loading = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.is_noble) {
|
|
|
+ this.ruleForm.cgd_charge = "0";
|
|
|
+ }
|
|
|
|
|
|
- if (!Number(this.ruleForm[prop])) {
|
|
|
- this.$message.warning(label + "不能为空");
|
|
|
- this.loading = false;
|
|
|
- return;
|
|
|
- }
|
|
|
+ const {
|
|
|
+ is_determine_price,
|
|
|
+ expect_service,
|
|
|
+ expect_service_proportion
|
|
|
+ } = this.ruleForm;
|
|
|
+ const prop = is_determine_price === "1" ? "price" : "cgd_charge";
|
|
|
+ const label = is_determine_price === "1" ? "销售价" : "裸价";
|
|
|
|
|
|
- if (!Number(expect_service) && !Number(expect_service_proportion)) {
|
|
|
- this.$message.warning("服务费比例和服务费不能同时为空");
|
|
|
- this.loading = false;
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (!Number(this.ruleForm[prop]) && !this.is_noble) {
|
|
|
+ this.$message.warning(label + "不能为空");
|
|
|
+ this.loading = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- //没有服务费存在服务费比例 重新计算服务费
|
|
|
- if (!Number(expect_service) && Number(expect_service_proportion)) {
|
|
|
- this.handleProportionrChange(expect_service_proportion);
|
|
|
- }
|
|
|
+ if (
|
|
|
+ !Number(expect_service) &&
|
|
|
+ !Number(expect_service_proportion) &&
|
|
|
+ !this.is_noble
|
|
|
+ ) {
|
|
|
+ this.$message.warning("服务费比例和服务费不能同时为空");
|
|
|
+ this.loading = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- //没有服务费存在服务费比例或者两个都存在 以服务费计算服务费比例
|
|
|
- if (
|
|
|
- (!Number(expect_service_proportion) && Number(expect_service)) ||
|
|
|
- (Number(expect_service_proportion) && Number(expect_service))
|
|
|
- ) {
|
|
|
- this.handleExpectChange(expect_service);
|
|
|
- }
|
|
|
- let model = Object.assign(
|
|
|
- other_ruleForm,
|
|
|
- JSON.parse(JSON.stringify(this.ruleForm))
|
|
|
- );
|
|
|
+ //没有服务费存在服务费比例 重新计算服务费
|
|
|
+ if (!Number(expect_service) && Number(expect_service_proportion)) {
|
|
|
+ this.handleProportionrChange(expect_service_proportion);
|
|
|
+ }
|
|
|
|
|
|
- model.cat_id = model.cat_id[model.cat_id.length - 1];
|
|
|
- model.brand_id = model.brand_id.toString();
|
|
|
- model.origin_place = model.originPlace;
|
|
|
- model.delivery_place = model.deliveryPlace;
|
|
|
- model.unit_id = model.unit_id.toString();
|
|
|
- model.config = model.config.toString();
|
|
|
- model.tax = parseInt(model.tax + "") + "";
|
|
|
- model.spec_list = [];
|
|
|
- model.supplierNo = model.supplierNo.toString();
|
|
|
- let list = JSON.parse(JSON.stringify(this.spec_tableData));
|
|
|
- list.forEach(a => {
|
|
|
- let am = {
|
|
|
- spec_id: a.specid,
|
|
|
- spec_value_id: a.spec_value_id
|
|
|
- };
|
|
|
- model.spec_list.push(am);
|
|
|
- });
|
|
|
+ //没有服务费存在服务费比例或者两个都存在 以服务费计算服务费比例
|
|
|
+ if (
|
|
|
+ (!Number(expect_service_proportion) && Number(expect_service)) ||
|
|
|
+ (Number(expect_service_proportion) && Number(expect_service))
|
|
|
+ ) {
|
|
|
+ this.handleExpectChange(expect_service);
|
|
|
+ }
|
|
|
+ let model = Object.assign(
|
|
|
+ other_ruleForm,
|
|
|
+ JSON.parse(JSON.stringify(this.ruleForm))
|
|
|
+ );
|
|
|
|
|
|
- let res = {};
|
|
|
- if (this.type === "add") {
|
|
|
- res = await asyncRequest.add(model);
|
|
|
- } else {
|
|
|
- res = await asyncRequest.good_update(model);
|
|
|
- }
|
|
|
+ model.cat_id = model.cat_id[model.cat_id.length - 1];
|
|
|
+ model.brand_id = model.brand_id.toString();
|
|
|
+ model.origin_place = model.originPlace;
|
|
|
+ model.delivery_place = model.deliveryPlace;
|
|
|
+ model.unit_id = model.unit_id.toString();
|
|
|
+ model.config = model.config.toString();
|
|
|
+ model.tax = parseInt(model.tax + "") + "";
|
|
|
+ model.spec_list = [];
|
|
|
+ model.supplierNo = model.supplierNo.toString();
|
|
|
|
|
|
- const { code } = await this.useResHandle(res);
|
|
|
+ delete model.originPlace;
|
|
|
+ let list = JSON.parse(JSON.stringify(this.spec_tableData));
|
|
|
+ list.forEach(a => {
|
|
|
+ let am = {
|
|
|
+ spec_id: a.specid,
|
|
|
+ spec_value_id: a.spec_value_id
|
|
|
+ };
|
|
|
+ model.spec_list.push(am);
|
|
|
+ });
|
|
|
|
|
|
- this.loading = false;
|
|
|
- if (code === 0) {
|
|
|
- const title = this.type === "add" ? "新建成功!" : "修改成功!";
|
|
|
- this.$notify.success({
|
|
|
- title: title,
|
|
|
- message: ""
|
|
|
- });
|
|
|
- this.showModelThis = false;
|
|
|
- this.$router.push("/supplierSellOut/supplierFiling");
|
|
|
- }
|
|
|
+ let res = {};
|
|
|
+ if (this.type === "add") {
|
|
|
+ res = await asyncRequest.add(model);
|
|
|
+ } else {
|
|
|
+ res = await asyncRequest.update(model);
|
|
|
+ }
|
|
|
+
|
|
|
+ const { code } = await this.useResHandle(res);
|
|
|
+
|
|
|
+ this.loading = false;
|
|
|
+ if (code === 0) {
|
|
|
+ const title = this.type === "add" ? "新建成功!" : "修改成功!";
|
|
|
+ this.$notify.success({
|
|
|
+ title: title,
|
|
|
+ message: ""
|
|
|
+ });
|
|
|
+ this.showModelThis = false;
|
|
|
+ this.$router.push("/sellOut/filing");
|
|
|
}
|
|
|
- } else {
|
|
|
- console.log("error submit!!");
|
|
|
- return false;
|
|
|
}
|
|
|
- });
|
|
|
+ } catch (err) {
|
|
|
+ console.log(err);
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
handleProportionrChange(e) {
|
|
@@ -1138,6 +1141,7 @@ export default {
|
|
|
if (code !== 0) return;
|
|
|
|
|
|
const {
|
|
|
+ id,
|
|
|
companyName,
|
|
|
num,
|
|
|
is_determine_price,
|
|
@@ -1162,16 +1166,35 @@ export default {
|
|
|
make_day,
|
|
|
origin_place,
|
|
|
delivery_place,
|
|
|
+ origin_place_cn,
|
|
|
+ delivery_place_cn,
|
|
|
supply_area,
|
|
|
pay_way,
|
|
|
remark,
|
|
|
cost_desc,
|
|
|
good_img,
|
|
|
- specinfo
|
|
|
+ specinfo,
|
|
|
+ fill_url,
|
|
|
+ expect_service,
|
|
|
+ noble_metal,
|
|
|
+ config,
|
|
|
+ gold_weight,
|
|
|
+ other_config
|
|
|
} = data;
|
|
|
|
|
|
+ if (Number(gold_weight) !== 0) {
|
|
|
+ this.is_noble = true;
|
|
|
+ }
|
|
|
+
|
|
|
this.ruleForm = {
|
|
|
...ruleForm1,
|
|
|
+ other_config: other_config || "",
|
|
|
+ gold_weight: gold_weight || "",
|
|
|
+ noble_metal: noble_metal || "",
|
|
|
+ config: config ? config.split(",") : [],
|
|
|
+ expect_service: expect_service || "",
|
|
|
+ id: id || "",
|
|
|
+ fill_url: fill_url || "",
|
|
|
is_determine_price: is_determine_price || "",
|
|
|
companyName: companyName || "",
|
|
|
num: num || "",
|
|
@@ -1192,13 +1215,19 @@ export default {
|
|
|
brand_id: brand_id ? [brand_id] : "",
|
|
|
unit_id: unit_id ? [unit_id] : "",
|
|
|
unit_name: unit_name ? [unit_name] : "",
|
|
|
- tax: tax || "",
|
|
|
+ tax: tax ? `${tax}%` : "",
|
|
|
weight: weight || "",
|
|
|
preservation_day: preservation_day || "",
|
|
|
delivery_day: delivery_day || "",
|
|
|
make_day: make_day || "",
|
|
|
- origin_place: origin_place || "",
|
|
|
- delivery_place: delivery_place || "",
|
|
|
+ originPlace: origin_place,
|
|
|
+ deliveryPlace: delivery_place,
|
|
|
+ origin_place: Array.isArray(origin_place)
|
|
|
+ ? [origin_place[origin_place.length - 1]]
|
|
|
+ : origin_place,
|
|
|
+ delivery_place: Array.isArray(delivery_place)
|
|
|
+ ? [delivery_place[delivery_place.length - 1]]
|
|
|
+ : delivery_place,
|
|
|
supply_area: supply_area || "",
|
|
|
pay_way: pay_way || "",
|
|
|
remark: remark || "",
|
|
@@ -1206,7 +1235,15 @@ export default {
|
|
|
good_img: good_img || []
|
|
|
};
|
|
|
|
|
|
- this.spec_tableData = specinfo;
|
|
|
+ this.origin_place_cn = [origin_place_cn];
|
|
|
+ this.delivery_place_cn = [delivery_place_cn];
|
|
|
+
|
|
|
+ this.spec_tableData = specinfo.map(item => ({
|
|
|
+ ...item,
|
|
|
+ specid: item.spec_id
|
|
|
+ }));
|
|
|
+
|
|
|
+ console.log(this.ruleForm);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
@@ -1307,7 +1344,6 @@ export default {
|
|
|
const { id, code } = e;
|
|
|
this.ruleForm.origin_place = id ? [id] : [];
|
|
|
this.ruleForm.originPlace = id ? code.split(",") : [];
|
|
|
- console.log(this.ruleForm.originPlace);
|
|
|
this.$refs.ruleForm.validateField("origin_place");
|
|
|
},
|
|
|
|
|
@@ -1315,7 +1351,6 @@ export default {
|
|
|
const { id, code } = e;
|
|
|
this.ruleForm.delivery_place = id ? [id] : [];
|
|
|
this.ruleForm.deliveryPlace = id ? code.split(",") : [];
|
|
|
- console.log(this.ruleForm.deliveryPlace);
|
|
|
this.$refs.ruleForm.validateField("delivery_place");
|
|
|
},
|
|
|
|
|
@@ -1350,7 +1385,6 @@ export default {
|
|
|
this.ruleForm.good_img.push(url);
|
|
|
this.$refs.ruleForm.validateField("good_img");
|
|
|
}
|
|
|
- console.log(this.ruleForm.good_img.length);
|
|
|
this.$message.success("图片上传成功!");
|
|
|
}
|
|
|
},
|