|
@@ -259,6 +259,7 @@
|
|
|
<search-good-online-modal
|
|
|
:once="true"
|
|
|
:sitem="addshowModel"
|
|
|
+ is_combind="0"
|
|
|
:active="true"
|
|
|
:show-model="showModel"
|
|
|
@resultList="resultList"
|
|
@@ -334,7 +335,7 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- isCombindChild: true,
|
|
|
+ isCombindChild: true,
|
|
|
ShowDataTableColumns: addColumns,
|
|
|
AddrAddEditModalIndex: -1,
|
|
|
AddrAddEditModalSitem: {},
|
|
@@ -445,7 +446,6 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
manageridChange(e) {
|
|
|
- console.log(e);
|
|
|
const { id, label } = e;
|
|
|
this.ruleForm.managerid = id ? [id] : [];
|
|
|
this.ruleForm.manager = label || "";
|
|
@@ -473,6 +473,7 @@ export default {
|
|
|
|
|
|
this.ruleForm = {
|
|
|
managerid: [],
|
|
|
+ manager:"",
|
|
|
order_type: "1",
|
|
|
companyNo: this.currentCompany || "", //销售方编码
|
|
|
customer_code: [], // 企业客户选择
|
|
@@ -525,7 +526,6 @@ export default {
|
|
|
item.code = item.areaCode ? [item.areaCode] : [];
|
|
|
item.names = item.label ? [item.label] : [];
|
|
|
});
|
|
|
- console.log(list);
|
|
|
this.addrForm.order_addr.push(...list);
|
|
|
},
|
|
|
async resultList(e) {
|
|
@@ -533,7 +533,6 @@ export default {
|
|
|
if (e.length === 1) {
|
|
|
let ssitem = JSON.parse(JSON.stringify(e[0]));
|
|
|
const result = await this.get_goods_detail(ssitem.skuCode);
|
|
|
- console.log(result,"----")
|
|
|
this.ruleForm.good_code = this.goods_sitem.skuCode;
|
|
|
} else {
|
|
|
this.goods_sitem = {};
|
|
@@ -547,7 +546,6 @@ export default {
|
|
|
});
|
|
|
if (code === 0) {
|
|
|
const { is_combind_child } = data;
|
|
|
- console.log((is_combind_child === false ? '是' : '不是') + "子商品")
|
|
|
this.isCombindChild = is_combind_child === false;
|
|
|
this.goods_sitem = data;
|
|
|
this.goods_sitem.good_info_img = this.goods_sitem.good_info_img.split(
|
|
@@ -614,8 +612,10 @@ export default {
|
|
|
|
|
|
if (!this.priceLoding) {
|
|
|
const { isok, price, stock } = await this.set_salegetprice();
|
|
|
+
|
|
|
+ console.log("商品:" , price, stock)
|
|
|
this.ruleForm.good_price = isok ? price : 0;
|
|
|
- this.ruleForm.good_stock = isok ? stock : 0;
|
|
|
+ this.ruleForm.activity_stock = isok ? stock : 0;
|
|
|
}
|
|
|
},
|
|
|
change_good_code() {
|
|
@@ -722,115 +722,31 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- // 删除收货地址操作
|
|
|
- deleteRow(index, rows) {
|
|
|
- rows.splice(index, 1);
|
|
|
- },
|
|
|
- async submitForm() {
|
|
|
- if(this.ruleForm.good_code && this.isCombindChild){
|
|
|
- this.$confirm("当前商品为其他组合商品的子商品,请留意",{
|
|
|
- title:'提示',
|
|
|
- type:'warning',
|
|
|
- confirmButtonText:"我已知晓!",
|
|
|
- cancelButtonText:"取消"
|
|
|
- }).then(() => {
|
|
|
- this.isCombindChild = false
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
+ async submitForm() {
|
|
|
await this.$refs.ruleForm.validate(async valid => {
|
|
|
if (valid) {
|
|
|
- if (this.loading) {
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (this.loading) { return; }
|
|
|
this.loading = true;
|
|
|
- const { sendtype, good_num, goodtype } = JSON.parse(
|
|
|
- JSON.stringify(this.ruleForm)
|
|
|
- );
|
|
|
- const { order_addr } = JSON.parse(JSON.stringify(this.addrForm));
|
|
|
-
|
|
|
- let key_0 = goodtype[0];
|
|
|
- let key_1 = goodtype[1];
|
|
|
- if (order_addr.length === 0 && sendtype === "1") {
|
|
|
- this.$message.warning("至少填写一条地址信息!");
|
|
|
- this.loading = false;
|
|
|
- return;
|
|
|
- }
|
|
|
- let model = JSON.parse(JSON.stringify(this.ruleForm));
|
|
|
- model.addrlist = [];
|
|
|
- model.customer_code = model.customer_code.toString();
|
|
|
- const { good_price, new_good_price } = model;
|
|
|
- let a = accMul(good_price, "1"),
|
|
|
- b = accMul(new_good_price, "1");
|
|
|
- if (a !== b) {
|
|
|
- model.good_price = model.new_good_price;
|
|
|
- }
|
|
|
- // if (model.new_good_price == model.good_price) {
|
|
|
- // model.good_price = model.new_good_price;
|
|
|
- // }
|
|
|
- delete model["proof_type"];
|
|
|
- delete model["proof_url"];
|
|
|
- delete model["new_good_price"];
|
|
|
- if (sendtype === "1") {
|
|
|
- let addrT = 0,
|
|
|
- isAEdit = false;
|
|
|
-
|
|
|
- order_addr.forEach(v2 => {
|
|
|
- if (v2.edit) {
|
|
|
- isAEdit = true;
|
|
|
- }
|
|
|
- addrT += parseInt(v2.receipt_quantity);
|
|
|
- let model2 = {
|
|
|
- contactor: v2.contactor,
|
|
|
- mobile: v2.mobile,
|
|
|
- addr: v2.addr,
|
|
|
- receipt_quantity: v2.receipt_quantity,
|
|
|
- addr_code: v2.addr_code
|
|
|
- };
|
|
|
- model.addrlist.push(model2);
|
|
|
- });
|
|
|
|
|
|
- if (isAEdit) {
|
|
|
- this.$message.warning("请保存地址信息!");
|
|
|
- this.loading = false;
|
|
|
- return;
|
|
|
- }
|
|
|
- if (good_num * 1 !== addrT) {
|
|
|
- this.$message.warning("地址收货总数与销售总数量不一致!");
|
|
|
- this.loading = false;
|
|
|
- return;
|
|
|
- }
|
|
|
+ const { companyNo, customer_code, platform_id, good_num,good_price, good_code: skuCode, managerid, manager ,remark: fill_remark } = this.ruleForm;
|
|
|
+ const model = {
|
|
|
+ customerCode: Array.isArray(customer_code) ? customer_code[0] : customer_code,
|
|
|
+ managerid: Array.isArray(managerid) ? managerid[0] : managerid,
|
|
|
+ fill_remark,
|
|
|
+ platform_id,
|
|
|
+ good_price,
|
|
|
+ companyNo,
|
|
|
+ good_num,
|
|
|
+ skuCode,
|
|
|
+ manager
|
|
|
}
|
|
|
- let priceres = await this.set_salegetprice();
|
|
|
- if (!priceres.isok) {
|
|
|
- this.loading = false;
|
|
|
- return;
|
|
|
- }
|
|
|
- model.is_activity = key_0 === "is_activity_0" ? "0" : "1";
|
|
|
- model.goodtype = key_0 === "is_activity_1" ? "1" : key_1;
|
|
|
- model.act_code = key_0 === "is_activity_1" ? key_1 : "";
|
|
|
-
|
|
|
- Object.keys(model).forEach(key => {
|
|
|
- if (typeof model[key] === "string") {
|
|
|
- model[key] = replaceTextWrapAndSpace(model[key]);
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- let res = await asyncRequest.add({
|
|
|
- ...model,
|
|
|
- managerid: Array.isArray(model.managerid) ? model.managerid[0] : model.managerid
|
|
|
- });
|
|
|
|
|
|
+ let res = await asyncRequest.create(model);
|
|
|
this.loading = false;
|
|
|
if (res && res.code === 0) {
|
|
|
- this.$notify.success({
|
|
|
- title: "订单创建成功!",
|
|
|
- message: ""
|
|
|
- });
|
|
|
-
|
|
|
- this.$emit("refresh");
|
|
|
+ this.$notify.success({ title: "订单创建成功!", message: "" });
|
|
|
+ this.$router.push("/sellOut/businessFiling")
|
|
|
} else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
await this.logout();
|
|
|
} else {
|
|
@@ -850,26 +766,21 @@ export default {
|
|
|
const { good_num, good_code, goodtype } = this.ruleForm;
|
|
|
let key_1 = goodtype[1];
|
|
|
let key_0 = goodtype[0];
|
|
|
- let model = {
|
|
|
- skuCode: good_code,
|
|
|
- sale_num: good_num,
|
|
|
- is_activity: key_0 === "is_activity_0" ? "0" : "1",
|
|
|
+
|
|
|
+ let model = {
|
|
|
+ skuCode: good_code,
|
|
|
+ sale_num: good_num,
|
|
|
+ is_activity: key_0 === "is_activity_0" ? "0" : "1",
|
|
|
act_code: key_0 === "is_activity_1" ? key_1 : ""
|
|
|
};
|
|
|
+
|
|
|
let { code, message, data } = await asyncRequest.salegetprice(model);
|
|
|
- console.log(code, message, data);
|
|
|
+
|
|
|
if (code === 0) {
|
|
|
const { sale_price } = data;
|
|
|
resModel.price = sale_price + "";
|
|
|
+ resModel.stock = data.stock;
|
|
|
|
|
|
- let oldGood_type = goodtype.length === 2 ? goodtype[1] : "";
|
|
|
-
|
|
|
- if (
|
|
|
- key_0 === "is_activity_0" &&
|
|
|
- (oldGood_type == 2 || oldGood_type == 3)
|
|
|
- ) {
|
|
|
- resModel.price = 0 + "";
|
|
|
- }
|
|
|
} else if (code >= 100 && code <= 104) {
|
|
|
await this.logout();
|
|
|
} else {
|