|
@@ -6,38 +6,18 @@
|
|
|
ref="ruleForm"
|
|
|
:model="ruleForm"
|
|
|
status-icon
|
|
|
+ :size="'mini'"
|
|
|
:rules="rulesThis"
|
|
|
label-width="95px"
|
|
|
class="demo-ruleForm"
|
|
|
>
|
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="商品名称" prop="goods_class">
|
|
|
- search-sort
|
|
|
- 555
|
|
|
- <!-- <good-class
|
|
|
- :value="ruleForm.goods_class"
|
|
|
- :disabled="true"
|
|
|
- :placeholder="'商品分类'"
|
|
|
- /> -->
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="商品名称" prop="good_code">
|
|
|
- <el-input
|
|
|
- v-model="ruleForm.good_name"
|
|
|
- disabled
|
|
|
- readonly
|
|
|
- @focus="showGoodsModel = true"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="销售方" prop="supplierName">
|
|
|
+ <el-form-item label="销售方" prop="supplierNo">
|
|
|
<search-supplier
|
|
|
:type="'1'"
|
|
|
- :size="searchSize"
|
|
|
- :value="ruleForm.supplierName"
|
|
|
+ :value="ruleForm.supplierNo"
|
|
|
+ :size="'mini'"
|
|
|
:disabled="
|
|
|
!(status === '0' && powers.some((item) => item == '005'))
|
|
|
"
|
|
@@ -50,6 +30,7 @@
|
|
|
<el-form-item label="企业客户" prop="customer_code">
|
|
|
<search-customer
|
|
|
:value="ruleForm.customer_code"
|
|
|
+ :size="'mini'"
|
|
|
:names="companyName"
|
|
|
:disabled="
|
|
|
!(status === '0' && powers.some((item) => item == '005'))
|
|
@@ -60,6 +41,116 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="所属平台" prop="is_activity">
|
|
|
+ <el-input
|
|
|
+ v-model="ruleForm.good_name"
|
|
|
+ disabled
|
|
|
+ readonly
|
|
|
+ @focus="showGoodsModel = true"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item
|
|
|
+ label="平台订单编号"
|
|
|
+ label-width="120px"
|
|
|
+ prop="is_activity"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="ruleForm.good_name"
|
|
|
+ disabled
|
|
|
+ readonly
|
|
|
+ @focus="showGoodsModel = true"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="参与活动" prop="is_activity">
|
|
|
+ <el-input
|
|
|
+ v-model="ruleForm.good_name"
|
|
|
+ disabled
|
|
|
+ readonly
|
|
|
+ @focus="showGoodsModel = true"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item
|
|
|
+ label="商品类型"
|
|
|
+ prop="is_activity"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="ruleForm.good_name"
|
|
|
+ disabled
|
|
|
+ readonly
|
|
|
+ @focus="showGoodsModel = true"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="发货类型" prop="is_activity">
|
|
|
+ <el-input
|
|
|
+ v-model="ruleForm.good_name"
|
|
|
+ disabled
|
|
|
+ readonly
|
|
|
+ @focus="showGoodsModel = true"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item
|
|
|
+ label="要求到货时间"
|
|
|
+ label-width="120px"
|
|
|
+ prop="is_activity"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="ruleForm.good_name"
|
|
|
+ disabled
|
|
|
+ readonly
|
|
|
+ @focus="showGoodsModel = true"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item
|
|
|
+ label="销售数量"
|
|
|
+ prop="is_activity"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="ruleForm.good_name"
|
|
|
+ disabled
|
|
|
+ readonly
|
|
|
+ @focus="showGoodsModel = true"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item
|
|
|
+ label="销售单价"
|
|
|
+ prop="is_activity"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-model="ruleForm.good_name"
|
|
|
+ disabled
|
|
|
+ readonly
|
|
|
+ @focus="showGoodsModel = true"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="商品名称" prop="good_code">
|
|
|
+ <el-input
|
|
|
+ v-model="ruleForm.good_name"
|
|
|
+ disabled
|
|
|
+ readonly
|
|
|
+ @focus="showGoodsModel = true"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
<el-col :span="24">
|
|
|
<search-stock-good-modal
|
|
|
:show-model="showGoodsModel"
|
|
@@ -71,99 +162,6 @@
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
</el-col>
|
|
|
- <el-col :span="24" style="padding: 0 0 20px 0">
|
|
|
- <el-form :model="stockForm" ref="stockForm" :size="'mini'">
|
|
|
- <el-table
|
|
|
- :data="stockForm.good_stock"
|
|
|
- border
|
|
|
- :size="'mini'"
|
|
|
- style="width: 100%"
|
|
|
- row-key="key"
|
|
|
- >
|
|
|
- <el-table-column
|
|
|
- prop="wsm_supplierNo"
|
|
|
- label="发货公司编号"
|
|
|
- width="142"
|
|
|
- />
|
|
|
-
|
|
|
- <el-table-column
|
|
|
- show-overflow-tooltip
|
|
|
- prop="wsm_supplier"
|
|
|
- label="发货公司名称"
|
|
|
- min-width="165"
|
|
|
- />
|
|
|
- <el-table-column prop="wsm_code" label="发货仓库编码" width="170" />
|
|
|
- <el-table-column
|
|
|
- show-overflow-tooltip
|
|
|
- prop="wsm_name"
|
|
|
- label="发货仓库名称"
|
|
|
- min-width="100"
|
|
|
- />
|
|
|
- <el-table-column
|
|
|
- prop="usable_stock"
|
|
|
- label="商品可用库存"
|
|
|
- width="120"
|
|
|
- />
|
|
|
-
|
|
|
- <el-table-column prop="num" label="下单数量" width="150">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-form-item
|
|
|
- :prop="'good_stock.' + scope.$index + '.' + 'num'"
|
|
|
- :rules="{}"
|
|
|
- :size="'mini'"
|
|
|
- style="margin-bottom: 0"
|
|
|
- >
|
|
|
- <el-input
|
|
|
- v-model="scope.row.num"
|
|
|
- :disabled="!scope.row.edit"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="original_price" label="销售价" width="110" />
|
|
|
-
|
|
|
- <el-table-column
|
|
|
- fixed="right"
|
|
|
- width="80"
|
|
|
- label="操作"
|
|
|
- v-if="status === '0' && powers.some((item) => item == '005')"
|
|
|
- >
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-tooltip
|
|
|
- effect="dark"
|
|
|
- content="编辑"
|
|
|
- v-if="!scope.row.edit"
|
|
|
- placement="top"
|
|
|
- >
|
|
|
- <i
|
|
|
- class="el-icon-edit tb-icon"
|
|
|
- @click="editRow(scope.$index)"
|
|
|
- ></i>
|
|
|
- </el-tooltip>
|
|
|
-
|
|
|
- <el-tooltip
|
|
|
- effect="dark"
|
|
|
- content="保存"
|
|
|
- v-if="scope.row.edit"
|
|
|
- placement="top"
|
|
|
- >
|
|
|
- <i
|
|
|
- class="el-icon-circle-check tb-icon"
|
|
|
- @click="checkStockRow(scope.$index)"
|
|
|
- ></i>
|
|
|
- </el-tooltip>
|
|
|
-
|
|
|
- <el-tooltip effect="dark" content="删除" placement="top">
|
|
|
- <i
|
|
|
- class="el-icon-delete tb-icon"
|
|
|
- @click="deleteRow(scope.$index, stockForm.good_stock, 0)"
|
|
|
- ></i>
|
|
|
- </el-tooltip>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </el-form>
|
|
|
- </el-col>
|
|
|
<el-col :span="24" style="padding: 0 0 22px 0">
|
|
|
<el-form :model="addrForm" ref="addrForm" :size="'mini'">
|
|
|
<el-table
|
|
@@ -260,7 +258,7 @@
|
|
|
</el-col>
|
|
|
<el-col
|
|
|
:span="24"
|
|
|
- style="text-align: right;padding:0 0 20px 0;"
|
|
|
+ style="text-align: right; padding: 0 0 20px 0"
|
|
|
v-if="status === '0' && powers.some((item) => item == '005')"
|
|
|
>
|
|
|
<el-button :size="'mini'" type="primary" @click="submitForm"
|
|
@@ -281,7 +279,7 @@ import AddrAddEditModal from "@/components/addr-add-edit-modal";
|
|
|
export default {
|
|
|
name: "salesOrderDetail",
|
|
|
mixins: [mixinPage, resToken],
|
|
|
- props: ["newTime", "id", "sitem"],
|
|
|
+ props: ["newTime", "id", "sitem", "type"],
|
|
|
components: { searchStockGoodModal, inAddrModel, AddrAddEditModal },
|
|
|
watch: {
|
|
|
newTime: function (val) {
|
|
@@ -336,7 +334,7 @@ export default {
|
|
|
companyName: "",
|
|
|
ruleForm: {
|
|
|
supplierNo: "", //销售方编码
|
|
|
- supplierName: "", //
|
|
|
+ supplierNo: "", //
|
|
|
goods_class: [],
|
|
|
good_name: "",
|
|
|
good_code: "", // 商品选择
|
|
@@ -367,7 +365,7 @@ export default {
|
|
|
trigger: "change",
|
|
|
},
|
|
|
],
|
|
|
- supplierName: [
|
|
|
+ supplierNo: [
|
|
|
{
|
|
|
type: "array",
|
|
|
required: true,
|
|
@@ -416,9 +414,7 @@ export default {
|
|
|
trigger: "blur",
|
|
|
},
|
|
|
},
|
|
|
- stockForm: {
|
|
|
- good_stock: [], //出货仓库
|
|
|
- },
|
|
|
+
|
|
|
loading: false,
|
|
|
queryId: "",
|
|
|
status: "",
|
|
@@ -461,50 +457,6 @@ export default {
|
|
|
}
|
|
|
this.$refs.addrForm.validateField("addrlist");
|
|
|
},
|
|
|
- async getstock(code) {
|
|
|
- this.loading = true;
|
|
|
- let model = {
|
|
|
- wsm_code: "",
|
|
|
- page: 1,
|
|
|
- size: 100,
|
|
|
- type_code: code,
|
|
|
- good_code: "",
|
|
|
- good_name: "",
|
|
|
- supplierNo: "",
|
|
|
- stock_low: "",
|
|
|
- stock_up: "",
|
|
|
- warn_low: "",
|
|
|
- warn_up: "",
|
|
|
- stock_max: "1",
|
|
|
- };
|
|
|
- const res = await asyncRequest.getGoodStock(model);
|
|
|
- if (res && res.code === 0 && res.data) {
|
|
|
- this.stockForm = {
|
|
|
- good_stock: [], //出货仓库
|
|
|
- };
|
|
|
- const { list } = res.data;
|
|
|
- list.forEach((v) => {
|
|
|
- let model = {
|
|
|
- num: v.usable_stock,
|
|
|
- usable_stock: v.usable_stock,
|
|
|
- wsm_name: v.wsm_name,
|
|
|
- wsm_supplier: v.wsm_supplier,
|
|
|
- wsm_supplierNo: v.wsm_supplierNo,
|
|
|
- wsm_code: v.wsm_code,
|
|
|
- original_price: v.original_price,
|
|
|
- id: "",
|
|
|
- is_del: 0,
|
|
|
- edit: false,
|
|
|
- };
|
|
|
- this.stockForm.good_stock.push(model);
|
|
|
- });
|
|
|
- } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- await this.logout();
|
|
|
- } else {
|
|
|
- this.$message.warning(res.message);
|
|
|
- }
|
|
|
- this.loading = false;
|
|
|
- },
|
|
|
|
|
|
getNewTime() {
|
|
|
this.newTime = new Date().valueOf();
|
|
@@ -522,7 +474,6 @@ export default {
|
|
|
customer_code,
|
|
|
companyName,
|
|
|
status,
|
|
|
- supplierName,
|
|
|
supplierNo,
|
|
|
} = this.sitem;
|
|
|
this.companyName = companyName;
|
|
@@ -534,40 +485,14 @@ export default {
|
|
|
});
|
|
|
this.ruleForm = {
|
|
|
supplierNo: supplierNo ? [supplierNo] : [], //销售方编码
|
|
|
- supplierName: [supplierName] || "", //
|
|
|
+ supplierNo: [supplierNo] || "", //
|
|
|
goods_class: goods_class || [],
|
|
|
good_code: good_code || "", // 商品选择
|
|
|
good_name: good_name || "",
|
|
|
customer_code: customer_code ? [customer_code] : "", // 企业客户选择
|
|
|
};
|
|
|
}
|
|
|
- if (this.$refs.stockForm) {
|
|
|
- this.$refs.stockForm.resetFields();
|
|
|
- this.$refs.stockForm.clearValidate();
|
|
|
- const { info } = this.sitem;
|
|
|
- this.stockForm = {
|
|
|
- good_stock: [], //出货仓库
|
|
|
- };
|
|
|
- this.delStockList = [];
|
|
|
- if (info && info.length > 0) {
|
|
|
- info.forEach((v) => {
|
|
|
- let model = {
|
|
|
- id: v.id,
|
|
|
- num: v.num || "",
|
|
|
- usable_stock: v.usable_stock || "",
|
|
|
- wsm_name: v.wsm_name || "",
|
|
|
- wsm_supplier: v.wsm_supplier || "",
|
|
|
- wsm_supplierNo: v.wsm_supplierNo || "",
|
|
|
- wsm_code: v.wsm_code || "",
|
|
|
- original_price: v.sale_price || "",
|
|
|
- edit: false,
|
|
|
- is_del: 0,
|
|
|
- };
|
|
|
- this.delStockList.push(model);
|
|
|
- this.stockForm.good_stock.push(model);
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
if (this.$refs.addrForm) {
|
|
|
this.$refs.addrForm.resetFields();
|
|
|
this.$refs.addrForm.clearValidate();
|
|
@@ -611,37 +536,10 @@ export default {
|
|
|
}
|
|
|
this.$refs.ruleForm.validateField("good_code");
|
|
|
if (this.ruleForm.good_code !== "" && this.queryId === "add") {
|
|
|
- await this.getstock(this.ruleForm.good_code);
|
|
|
- } else {
|
|
|
- // this.stockForm = {
|
|
|
- // good_stock: [], //出货仓库
|
|
|
- // };
|
|
|
- }
|
|
|
- },
|
|
|
- editRow(index) {
|
|
|
- let findex = this.stockForm.good_stock.findIndex((v) => v.edit === true);
|
|
|
- if (findex !== -1) {
|
|
|
- this.$message.warning("当前已有发货仓库信息在编辑,请保存后再试!");
|
|
|
- return;
|
|
|
- } else {
|
|
|
- this.stockForm.good_stock[index].edit = true;
|
|
|
- }
|
|
|
- },
|
|
|
- checkStockRow(index) {
|
|
|
- let total = parseInt(this.stockForm.good_stock[index].usable_stock),
|
|
|
- num = parseInt(this.stockForm.good_stock[index].num);
|
|
|
- if (total === 0) {
|
|
|
- this.$message.warning("该仓库已无该商品库存!不能销售!");
|
|
|
- return;
|
|
|
} else {
|
|
|
- if (num > total) {
|
|
|
- this.$message.warning("销售数量不能大于可用库存!");
|
|
|
- return;
|
|
|
- } else {
|
|
|
- this.stockForm.good_stock[index].edit = false;
|
|
|
- }
|
|
|
}
|
|
|
},
|
|
|
+
|
|
|
customer_code_change(e) {
|
|
|
if (e && e.code) {
|
|
|
this.ruleForm.customer_code = [e.code];
|
|
@@ -719,13 +617,8 @@ export default {
|
|
|
const { good_code, customer_code, supplierNo } = JSON.parse(
|
|
|
JSON.stringify(this.ruleForm)
|
|
|
);
|
|
|
- const { good_stock } = JSON.parse(JSON.stringify(this.stockForm));
|
|
|
const { order_addr } = JSON.parse(JSON.stringify(this.addrForm));
|
|
|
- if (good_stock.length === 0) {
|
|
|
- this.$message.warning("请填写仓库信息!");
|
|
|
- this.loading = false;
|
|
|
- return;
|
|
|
- }
|
|
|
+
|
|
|
if (order_addr.length === 0) {
|
|
|
this.$message.warning("请填写仓库信息!");
|
|
|
this.loading = false;
|
|
@@ -737,29 +630,9 @@ export default {
|
|
|
good_code,
|
|
|
customer_code: customer_code.join(","), // 账号
|
|
|
order_addr: [],
|
|
|
- good_stock: [],
|
|
|
};
|
|
|
- let stockT = 0,
|
|
|
- addrT = 0,
|
|
|
- isStockOk = true,
|
|
|
- isSEdit = false,
|
|
|
- isAEdit = false;
|
|
|
- good_stock.forEach((v1) => {
|
|
|
- if (v1.edit) {
|
|
|
- isSEdit = true;
|
|
|
- }
|
|
|
- if (parseInt(v1.usable_stock) < parseInt(v1.num)) {
|
|
|
- isStockOk = false;
|
|
|
- }
|
|
|
- stockT += parseInt(v1.num);
|
|
|
- let model1 = {
|
|
|
- num: v1.num,
|
|
|
- wsm_code: v1.wsm_code,
|
|
|
- id: v1.id,
|
|
|
- is_del: 0,
|
|
|
- };
|
|
|
- model.good_stock.push(model1);
|
|
|
- });
|
|
|
+ (addrT = 0), (isStockOk = true), (isSEdit = false), (isAEdit = false);
|
|
|
+
|
|
|
order_addr.forEach((v2) => {
|
|
|
if (v2.edit) {
|
|
|
isAEdit = true;
|
|
@@ -792,21 +665,9 @@ export default {
|
|
|
this.loading = false;
|
|
|
return;
|
|
|
}
|
|
|
- if (stockT !== addrT) {
|
|
|
- this.$message.warning(
|
|
|
- "库存出库总数量,与收货地址信息中的总数量不一致!"
|
|
|
- );
|
|
|
- this.loading = false;
|
|
|
- return;
|
|
|
- }
|
|
|
let dAList = JSON.parse(JSON.stringify(this.delAddrList));
|
|
|
let dSList = JSON.parse(JSON.stringify(this.delStockList));
|
|
|
- good_stock.forEach((v) => {
|
|
|
- let findex = dSList.findIndex((v1) => v1.wsm_code === v.wsm_code);
|
|
|
- if (findex !== -1) {
|
|
|
- dSList.splice(findex, 1);
|
|
|
- }
|
|
|
- });
|
|
|
+
|
|
|
order_addr.forEach((v) => {
|
|
|
let findex = dAList.findIndex(
|
|
|
(v1) => v1.id !== "" && v1.id === v.id
|