|
@@ -12,7 +12,7 @@
|
|
|
>
|
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="商品名称" prop="goods_class">
|
|
|
+ <el-form-item label="商品分类" prop="goods_class">
|
|
|
<good-class
|
|
|
:value="ruleForm.goods_class"
|
|
|
:disabled="true"
|
|
@@ -30,20 +30,79 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="24">
|
|
|
- <el-form-item label="企业客户" prop="customer_code">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="销售方" prop="customer_code">
|
|
|
+ <search-supplier
|
|
|
+ :value="ruleForm.supplierNo"
|
|
|
+ :placeholder="'销售方公司'"
|
|
|
+ :disabled="false"
|
|
|
+ :isDetail="false"
|
|
|
+ :type="'1'"
|
|
|
+ @searchChange="supplierChange"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="购买方" prop="customer_code">
|
|
|
<search-customer
|
|
|
:value="ruleForm.customer_code"
|
|
|
:names="companyName"
|
|
|
- :disabled="
|
|
|
- !(status === '0' && powers.some((item) => item == '005'))
|
|
|
- "
|
|
|
+ :placeholder="'购买方公司'"
|
|
|
+ :disabled="true"
|
|
|
:is-detail="true"
|
|
|
- @searchChange="customer_code_change"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="商品单价" prop="sale_fee">
|
|
|
+ <el-input
|
|
|
+ v-model="ruleForm.sale_fee"
|
|
|
+ placeholder="商品单价"
|
|
|
+ disabled
|
|
|
+ ><template slot="append">元</template></el-input
|
|
|
+ >
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="下单数量" prop="good_num">
|
|
|
+ <el-input v-model="ruleForm.good_num" placeholder="下单数量" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="商品类型" prop="goodtype">
|
|
|
+ <el-select
|
|
|
+ v-model="ruleForm.goodtype"
|
|
|
+ style="width: 100%"
|
|
|
+ placeholder="商品类型"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in goodtypeOptions"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="发货类型" prop="sendtype">
|
|
|
+ <el-select
|
|
|
+ v-model="ruleForm.sendtype"
|
|
|
+ style="width: 100%"
|
|
|
+ placeholder="发货类型"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in options"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
<el-col :span="24">
|
|
|
<search-stock-good-modal
|
|
|
:show-model="showGoodsModel"
|
|
@@ -55,99 +114,7 @@
|
|
|
</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
|
|
@@ -406,36 +373,77 @@ export default {
|
|
|
stock_code: "",
|
|
|
companyName: "",
|
|
|
ruleForm: {
|
|
|
+ zxNo: "",
|
|
|
+ customer_code: [],
|
|
|
+ supplierNo: [],
|
|
|
+ sendtype: "1",
|
|
|
+ good_num: "",
|
|
|
+ goodtype: "1",
|
|
|
goods_class: [],
|
|
|
- good_name: "",
|
|
|
+ goods_name: "",
|
|
|
+ sale_fee: "",
|
|
|
good_code: "", // 商品选择
|
|
|
- customer_code: [], // 企业客户选择
|
|
|
},
|
|
|
rulesThis: this.rules,
|
|
|
rules: {
|
|
|
- goods_class: [
|
|
|
+ zxNo: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "咨询单号不能为空!",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ customer_code: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请选择购买方公司",
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ class_cat: [
|
|
|
{
|
|
|
- type: "array",
|
|
|
required: true,
|
|
|
message: "请选择商品分类",
|
|
|
trigger: "change",
|
|
|
},
|
|
|
],
|
|
|
- good_code: [
|
|
|
+ supplierNo: [
|
|
|
+ {
|
|
|
+ type: "array",
|
|
|
+ required: true,
|
|
|
+ message: "请选择销售方公司",
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ sendtype: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请选择商品",
|
|
|
+ message: "请选择发货类型",
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+
|
|
|
+ good_num: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ validator: validateWeight,
|
|
|
trigger: "blur",
|
|
|
},
|
|
|
],
|
|
|
- customer_code: [
|
|
|
+ goodtype: [
|
|
|
{
|
|
|
- type: "array",
|
|
|
required: true,
|
|
|
- message: "请选择企业客户",
|
|
|
+ message: "请选择是否特殊商品",
|
|
|
trigger: "change",
|
|
|
},
|
|
|
],
|
|
|
+ sale_fee: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请输入商品单价",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
+ ],
|
|
|
},
|
|
|
addrForm: {
|
|
|
order_addr: [], //收货地址
|
|
@@ -477,9 +485,7 @@ export default {
|
|
|
trigger: "blur",
|
|
|
},
|
|
|
},
|
|
|
- stockForm: {
|
|
|
- good_stock: [], //出货仓库
|
|
|
- },
|
|
|
+
|
|
|
loading: false,
|
|
|
queryId: "",
|
|
|
status: "",
|
|
@@ -495,49 +501,13 @@ export default {
|
|
|
this.rulesThis = this.rules;
|
|
|
this.resetForm();
|
|
|
},
|
|
|
- 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();
|
|
|
+ async supplierChange(e) {
|
|
|
+ if (e && e.id) {
|
|
|
+ this.ruleForm.supplierNo = [e.code];
|
|
|
} else {
|
|
|
- this.$message.warning(res.message);
|
|
|
+ this.ruleForm.supplierNo = [];
|
|
|
}
|
|
|
- this.loading = false;
|
|
|
+ this.$refs.ruleForm.validateField("supplierNo");
|
|
|
},
|
|
|
|
|
|
getNewTime() {
|
|
@@ -556,6 +526,11 @@ export default {
|
|
|
customer_code,
|
|
|
companyName,
|
|
|
status,
|
|
|
+ supplierNo,
|
|
|
+ good_num,
|
|
|
+ goodtype,
|
|
|
+ sendtype,
|
|
|
+ sale_fee,
|
|
|
} = this.sitem;
|
|
|
this.companyName = companyName;
|
|
|
this.status = status;
|
|
@@ -565,39 +540,18 @@ export default {
|
|
|
goods_class.push(v.id);
|
|
|
});
|
|
|
this.ruleForm = {
|
|
|
+ good_num,
|
|
|
+ goodtype,
|
|
|
+ sendtype,
|
|
|
+ sale_fee,
|
|
|
goods_class: goods_class || [],
|
|
|
+ supplierNo: supplierNo || [],
|
|
|
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();
|
|
@@ -631,55 +585,7 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- async addGoodsRes(e) {
|
|
|
- if (e && e.length === 1) {
|
|
|
- this.ruleForm.good_name = e[0].good_name;
|
|
|
- this.ruleForm.good_code = e[0].type_code;
|
|
|
- } else {
|
|
|
- this.ruleForm.good_name = "";
|
|
|
- this.ruleForm.good_code = "";
|
|
|
- }
|
|
|
- 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];
|
|
|
- } else {
|
|
|
- this.ruleForm.customer_code = [];
|
|
|
- }
|
|
|
- this.$refs.ruleForm.validateField("customer_code");
|
|
|
- },
|
|
|
+
|
|
|
openHouseModal(index) {
|
|
|
let findex = this.addrForm.order_addr.findIndex((v) => v.edit === true);
|
|
|
if (findex !== -1) {
|