|
@@ -15,7 +15,7 @@
|
|
|
append-to-body
|
|
|
>
|
|
|
<el-card style="margin-top: -20px">
|
|
|
- <el-row :gutter="10">
|
|
|
+ <el-row>
|
|
|
<el-col :span="24">
|
|
|
<show-data-table
|
|
|
style="margin: 0; padding: 0"
|
|
@@ -35,46 +35,98 @@
|
|
|
/>
|
|
|
<div>{{ sitem.good_name }}</div>
|
|
|
</template>
|
|
|
- <template slot="speclist">
|
|
|
- <span v-for="(si, i) in sitem.speclist" :key="si.spec_id + i">
|
|
|
- <span v-if="i !== 0">-</span><span>{{ si.spec_value }}</span>
|
|
|
- </span>
|
|
|
- </template>
|
|
|
<template slot="specinfo">
|
|
|
<span v-for="(si, sii) in sitem.specinfo" :key="si.specid + sii">
|
|
|
<span v-if="sii !== 0">--</span
|
|
|
><span>{{ si.spec_name }}[{{ si.spec_value_name }}]</span></span
|
|
|
>
|
|
|
</template>
|
|
|
- </show-data-table>
|
|
|
+ <template slot="is_noble">
|
|
|
+ <span v-if="sitem.is_noble">
|
|
|
+ {{ sitem.noble_weight }}g--{{ sitem.metal_name }}--{{
|
|
|
+ sitem.is_diff === "1" ? "有" : "无"
|
|
|
+ }}工差--{{ sitem.config }}--{{ sitem.other_config }}</span
|
|
|
+ >
|
|
|
+ <span v-else>非贵金属商品</span>
|
|
|
+ </template>
|
|
|
+ <template slot="in_num">
|
|
|
+ <span>{{ sitem.in_num }}{{ sitem.unit }}</span>
|
|
|
+ </template>
|
|
|
+ </show-data-table>
|
|
|
</el-col>
|
|
|
-
|
|
|
- <!-- <el-col :span="24" style="padding: 0 0 22px 0">
|
|
|
- <div style="height: 40px; margin: -10px 0 0 0" class="tr">
|
|
|
- <download-addr />
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- size="mini"
|
|
|
- @click="addrmodel = true"
|
|
|
- style="margin: 0 0 0 10px"
|
|
|
- >导入收货地址</el-button
|
|
|
- >
|
|
|
- </div>
|
|
|
+ <el-col :span="24" style="padding: 18px 0 0 0">
|
|
|
+ <el-form
|
|
|
+ ref="ruleForm"
|
|
|
+ :model="ruleForm"
|
|
|
+ status-icon
|
|
|
+ :rules="rulesThis"
|
|
|
+ :size="'mini'"
|
|
|
+ label-width="90px"
|
|
|
+ class="demo-ruleForm"
|
|
|
+ >
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="10">
|
|
|
+ <el-form-item label="购买数量" prop="good_num">
|
|
|
+ <digital-input
|
|
|
+ :values="ruleForm.good_num"
|
|
|
+ :placeholder="'购买数量'"
|
|
|
+ :min="0"
|
|
|
+ :max="sitem.in_num"
|
|
|
+ :position="'right'"
|
|
|
+ :precision="2"
|
|
|
+ :size="'mini'"
|
|
|
+ :controls="false"
|
|
|
+ :disabled="false"
|
|
|
+ :append="sitem.unit"
|
|
|
+ @reschange="num_change($event, 'good_num')"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="10">
|
|
|
+ <el-form-item label="发货方式" prop="sendtype">
|
|
|
+ <el-select
|
|
|
+ v-model="ruleForm.sendtype"
|
|
|
+ placeholder="发货方式"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <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="4" style="text-align: right">
|
|
|
+ <el-button :size="'mini'" type="primary" @click="submitForm"
|
|
|
+ >保 存
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" v-if="ruleForm.sendtype === '1'">
|
|
|
<el-form :model="addrForm" ref="addrForm" :size="'mini'">
|
|
|
<el-table
|
|
|
:data="addrForm.order_addr"
|
|
|
border
|
|
|
:size="'mini'"
|
|
|
style="width: 100%"
|
|
|
+ max-height="300px"
|
|
|
row-key="key"
|
|
|
>
|
|
|
+ <el-table-column type="index" width="80" show-overflow-tooltip />
|
|
|
<el-table-column
|
|
|
prop="receipt_quantity"
|
|
|
label="收货总数"
|
|
|
min-width="125"
|
|
|
+ show-overflow-tooltip
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
+ v-if="scope.row.edit"
|
|
|
:prop="
|
|
|
'order_addr.' + scope.$index + '.' + 'receipt_quantity'
|
|
|
"
|
|
@@ -87,40 +139,21 @@
|
|
|
:disabled="!scope.row.edit"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
+ <span v-if="!scope.row.edit">{{
|
|
|
+ scope.row.receipt_quantity
|
|
|
+ }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column
|
|
|
- prop="arrive_time"
|
|
|
- label="最晚收货日期"
|
|
|
- width="150"
|
|
|
- >
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-form-item
|
|
|
- :prop="'order_addr.' + scope.$index + '.' + 'arrive_time'"
|
|
|
- :rules="addrRules.arrive_time"
|
|
|
- :size="'mini'"
|
|
|
- :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
|
|
|
- >
|
|
|
- <el-date-picker
|
|
|
- :disabled="!scope.row.edit"
|
|
|
- v-model="scope.row.arrive_time"
|
|
|
- type="date"
|
|
|
- style="width: 100%"
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
- :picker-options="pickerOptions"
|
|
|
- >
|
|
|
- </el-date-picker>
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
<el-table-column
|
|
|
prop="contactor"
|
|
|
label="收件联系人"
|
|
|
min-width="110"
|
|
|
+ show-overflow-tooltip
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
+ v-if="scope.row.edit"
|
|
|
:prop="'order_addr.' + scope.$index + '.' + 'contactor'"
|
|
|
:rules="addrRules.contactor"
|
|
|
:size="'mini'"
|
|
@@ -131,6 +164,7 @@
|
|
|
:disabled="!scope.row.edit"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
+ <span v-if="!scope.row.edit">{{ scope.row.contactor }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
@@ -138,9 +172,11 @@
|
|
|
prop="mobile"
|
|
|
label="收货联系电话"
|
|
|
min-width="130"
|
|
|
+ show-overflow-tooltip
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
+ v-if="scope.row.edit"
|
|
|
:prop="'order_addr.' + scope.$index + '.' + 'mobile'"
|
|
|
:rules="addrRules.mobile"
|
|
|
:size="'mini'"
|
|
@@ -151,6 +187,7 @@
|
|
|
:disabled="!scope.row.edit"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
+ <span v-if="!scope.row.edit">{{ scope.row.mobile }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
@@ -158,9 +195,11 @@
|
|
|
prop="addr_code"
|
|
|
label="收货省市区"
|
|
|
min-width="230"
|
|
|
+ show-overflow-tooltip
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
+ v-if="scope.row.edit"
|
|
|
:prop="'order_addr.' + scope.$index + '.' + 'addr_code'"
|
|
|
:rules="addrRules.addr_code"
|
|
|
:size="'mini'"
|
|
@@ -173,11 +212,20 @@
|
|
|
@selectChange="select_area_change($event, scope.$index)"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
+ <span v-if="!scope.row.edit">{{
|
|
|
+ scope.row.addr_code_name
|
|
|
+ }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="addr" label="详细地址" min-width="170">
|
|
|
+ <el-table-column
|
|
|
+ prop="addr"
|
|
|
+ label="详细地址"
|
|
|
+ min-width="170"
|
|
|
+ show-overflow-tooltip
|
|
|
+ >
|
|
|
<template slot-scope="scope">
|
|
|
<el-form-item
|
|
|
+ v-if="scope.row.edit"
|
|
|
:prop="'order_addr.' + scope.$index + '.' + 'addr'"
|
|
|
:rules="addrRules.addr"
|
|
|
:size="'mini'"
|
|
@@ -188,18 +236,17 @@
|
|
|
:disabled="!scope.row.edit"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
+ <span v-if="!scope.row.edit">{{ scope.row.addr }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
- <el-table-column fixed="right" width="80">
|
|
|
+ <el-table-column fixed="right" width="94" show-overflow-tooltip>
|
|
|
<template slot="header" slot-scope="scope">
|
|
|
- <span>操作</span>
|
|
|
-
|
|
|
<el-tooltip
|
|
|
class="fr"
|
|
|
- style="margin: 3px 0 0 0"
|
|
|
+ style="margin: 3px 0 0 8px"
|
|
|
effect="dark"
|
|
|
- content="添加"
|
|
|
+ content="手动添加地址"
|
|
|
placement="top"
|
|
|
>
|
|
|
<i
|
|
@@ -208,6 +255,33 @@
|
|
|
@click="openHouseModal(-1)"
|
|
|
></i>
|
|
|
</el-tooltip>
|
|
|
+ <el-tooltip
|
|
|
+ class="fr"
|
|
|
+ style="margin: 3px 0 0 8px"
|
|
|
+ effect="dark"
|
|
|
+ content="导入收货地址"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
+ <i
|
|
|
+ class="el-icon-upload2 tb-icon"
|
|
|
+ style="color: #63cbe7"
|
|
|
+ @click="addrmodel = true"
|
|
|
+ ></i>
|
|
|
+ </el-tooltip>
|
|
|
+ <el-tooltip
|
|
|
+ class="fr"
|
|
|
+ style="margin: 3px 0 0 0"
|
|
|
+ effect="dark"
|
|
|
+ content="下载收货地址模板"
|
|
|
+ placement="top"
|
|
|
+ >
|
|
|
+ <a class="downloadAddr" href="./static/收货地址模板.xlsx">
|
|
|
+ <i
|
|
|
+ class="el-icon-download tb-icon"
|
|
|
+ style="color: #63cbe7; margin: 0"
|
|
|
+ ></i>
|
|
|
+ </a>
|
|
|
+ </el-tooltip>
|
|
|
</template>
|
|
|
<template slot-scope="scope">
|
|
|
<el-tooltip
|
|
@@ -245,18 +319,12 @@
|
|
|
</el-table>
|
|
|
</el-form>
|
|
|
</el-col>
|
|
|
-
|
|
|
<el-col :span="24">
|
|
|
<in-addr-model
|
|
|
:show-model="addrmodel"
|
|
|
@cancel="addrmodel = false"
|
|
|
@refresh="addrRefresh"
|
|
|
/>
|
|
|
- </el-col> -->
|
|
|
- <el-col :span="24" style="text-align: right">
|
|
|
- <el-button :size="'mini'" type="primary" @click="submitForm"
|
|
|
- >保 存
|
|
|
- </el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-card>
|
|
@@ -264,7 +332,7 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import resToken from "@/mixins/resToken";
|
|
|
-// import asyncRequest from "@/apis/service/sellOut/zxOrder/detail";
|
|
|
+import asyncRequest from "@/apis/service/sellOut/zixunOrder";
|
|
|
import searchStockGoodModal from "@/components/search-stock-good-modal";
|
|
|
import { isnumber, isMobile } from "@/utils/validate";
|
|
|
import inAddrModel from "@/components/in-addr-model";
|
|
@@ -303,36 +371,37 @@ export default {
|
|
|
showModelThis: this.showModel,
|
|
|
showGoodsModel: false,
|
|
|
ShowDataTableColumns: ShowDataTableColumns,
|
|
|
+ options: [
|
|
|
+ {
|
|
|
+ value: "1",
|
|
|
+ label: "直接发货",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: "2",
|
|
|
+ label: "延时发货",
|
|
|
+ },
|
|
|
+ ],
|
|
|
stock_code: "",
|
|
|
cat_id: "",
|
|
|
ruleForm: {
|
|
|
- goods_class: [],
|
|
|
- good_name: "",
|
|
|
- good_code: "", // 商品选择
|
|
|
- customer_code: [], // 企业客户选择
|
|
|
+ bidNo: "", //咨询单反馈编号
|
|
|
+ good_num: "", //商品数量
|
|
|
+ sendtype: "1", // 发货方式
|
|
|
+ arrtime: "", // 到货时间
|
|
|
},
|
|
|
rulesThis: this.rules,
|
|
|
rules: {
|
|
|
- goods_class: [
|
|
|
- {
|
|
|
- type: "array",
|
|
|
- required: true,
|
|
|
- message: "请选择商品分类",
|
|
|
- trigger: "change",
|
|
|
- },
|
|
|
- ],
|
|
|
- good_code: [
|
|
|
+ good_num: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请选择商品",
|
|
|
+ message: "商品数量",
|
|
|
trigger: "blur",
|
|
|
},
|
|
|
],
|
|
|
- customer_code: [
|
|
|
+ sendtype: [
|
|
|
{
|
|
|
- type: "array",
|
|
|
required: true,
|
|
|
- message: "请选择企业客户",
|
|
|
+ message: "请选择商品",
|
|
|
trigger: "change",
|
|
|
},
|
|
|
],
|
|
@@ -341,13 +410,6 @@ export default {
|
|
|
order_addr: [], //收货地址
|
|
|
},
|
|
|
addrRules: {
|
|
|
- arrive_time: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: "最晚收货日期不能为空",
|
|
|
- trigger: "change",
|
|
|
- },
|
|
|
- ],
|
|
|
receipt_quantity: [
|
|
|
{
|
|
|
required: true,
|
|
@@ -411,249 +473,184 @@ export default {
|
|
|
console.log("closeModel!!");
|
|
|
this.showModelThis = false;
|
|
|
},
|
|
|
+ num_change(e, key) {
|
|
|
+ this.ruleForm[key] = e + "";
|
|
|
+ this.$refs.ruleForm.validateField(key);
|
|
|
+ },
|
|
|
async initForm() {
|
|
|
+ this.loading = true;
|
|
|
+ this.rulesThis = this.rules;
|
|
|
console.log(this.sitem);
|
|
|
- console.log(ShowDataTableColumns);
|
|
|
- // this.loading = true;
|
|
|
- // this.rulesThis = this.rules;
|
|
|
- // await this.resetForm();
|
|
|
- // this.loading = false;
|
|
|
+ const { can } = this.sitem;
|
|
|
+ this.sitem.can_name = "";
|
|
|
+ this.sitem.is_noble = false;
|
|
|
+ if (can && can.length > 0) {
|
|
|
+ can.forEach((a, ai) => {
|
|
|
+ this.sitem.is_noble = a.id === "6";
|
|
|
+ this.sitem.can_name += `${ai !== 0 ? "_" : ""}${a.name}`;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ await this.resetForm();
|
|
|
+ this.getNewTime();
|
|
|
+ this.loading = false;
|
|
|
+ },
|
|
|
+ addrRefresh(e) {
|
|
|
+ const { list } = e;
|
|
|
+ this.addrForm.order_addr.push(...list);
|
|
|
},
|
|
|
- // hand() {
|
|
|
- // if (this.ruleForm.goods_class.length === 0) {
|
|
|
- // this.$message.warning("请选择商品分类!");
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // this.showGoodsModel = true;
|
|
|
- // },
|
|
|
- // addrRefresh(e) {
|
|
|
- // const { list } = e;
|
|
|
- // this.addrForm.order_addr.push(...list);
|
|
|
- // },
|
|
|
-
|
|
|
- // goods_class_change(e) {
|
|
|
- // this.ruleForm.goods_class = e;
|
|
|
- // this.cat_id = e.length > 0 ? e[e.length - 1] : "";
|
|
|
- // this.$refs.ruleForm.validateField("goods_class");
|
|
|
- // this.ruleForm.good_code = "";
|
|
|
- // this.ruleForm.good_name = "";
|
|
|
- // this.$refs.ruleForm.validateField("good_code");
|
|
|
- // },
|
|
|
- // refresh(e) {
|
|
|
- // this.showModelThis = e;
|
|
|
- // this.$emit("refresh", true);
|
|
|
- // },
|
|
|
|
|
|
getNewTime() {
|
|
|
this.newTime = new Date().valueOf();
|
|
|
},
|
|
|
async resetForm() {
|
|
|
- this.getNewTime();
|
|
|
- // 重置
|
|
|
- // await this.$nextTick(() => {
|
|
|
- // if (this.$refs.ruleForm) {
|
|
|
- // this.$refs.ruleForm.resetFields();
|
|
|
- // this.$refs.ruleForm.clearValidate();
|
|
|
- // this.cat_id = "";
|
|
|
- // this.ruleForm = {
|
|
|
- // goods_class: [],
|
|
|
- // good_code: "", // 商品选择
|
|
|
- // customer_code: [], // 企业客户选择
|
|
|
- // };
|
|
|
- // }
|
|
|
- // if (this.$refs.stockForm) {
|
|
|
- // this.$refs.stockForm.resetFields();
|
|
|
- // this.$refs.stockForm.clearValidate();
|
|
|
+ //重置
|
|
|
+ await this.$nextTick(() => {
|
|
|
+ if (this.$refs.ruleForm) {
|
|
|
+ this.$refs.ruleForm.resetFields();
|
|
|
+ this.$refs.ruleForm.clearValidate();
|
|
|
+ const { bidNo, in_num, in_arrival_time } = this.sitem;
|
|
|
+ this.ruleForm = {
|
|
|
+ bidNo: bidNo || "", //咨询单反馈编号
|
|
|
+ good_num: in_num || "0", //商品数量
|
|
|
+ sendtype: "1", // 发货方式
|
|
|
+ arrtime: in_arrival_time || "", // 到货时间
|
|
|
+ };
|
|
|
+ }
|
|
|
|
|
|
- // this.stockForm = {
|
|
|
- // good_stock: [], //出货仓库
|
|
|
- // };
|
|
|
- // }
|
|
|
- // if (this.$refs.addrForm) {
|
|
|
- // this.$refs.addrForm.resetFields();
|
|
|
- // this.$refs.addrForm.clearValidate();
|
|
|
- // this.addrForm = {
|
|
|
- // order_addr: [],
|
|
|
- // };
|
|
|
- // }
|
|
|
- // });
|
|
|
+ if (this.$refs.addrForm) {
|
|
|
+ this.$refs.addrForm.resetFields();
|
|
|
+ this.$refs.addrForm.clearValidate();
|
|
|
+ this.addrForm = {
|
|
|
+ order_addr: [],
|
|
|
+ };
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
- // 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");
|
|
|
- // },
|
|
|
- // 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) {
|
|
|
- // this.$message.warning("当前已有地址在编辑,请保存后再试!");
|
|
|
- // return;
|
|
|
- // } else {
|
|
|
- // if (index === -1) {
|
|
|
- // this.addrForm.order_addr.push({
|
|
|
- // edit: true,
|
|
|
- // arrive_time: "",
|
|
|
- // receipt_quantity: "",
|
|
|
- // contactor: "",
|
|
|
- // mobile: "",
|
|
|
- // addr_code: [],
|
|
|
- // addr: "",
|
|
|
- // });
|
|
|
- // } else {
|
|
|
- // this.addrForm.order_addr[index].edit = true;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // },
|
|
|
- // //省市区选择
|
|
|
- // select_area_change(e, index) {
|
|
|
- // this.addrForm.order_addr[index].addr_code = e;
|
|
|
- // },
|
|
|
- // //省市区保存某一行
|
|
|
- // checkRow(rowIndex) {
|
|
|
- // this.$refs.addrForm.validate((valid) => {
|
|
|
- // if (valid) {
|
|
|
- // this.addrForm.order_addr[rowIndex].edit = false;
|
|
|
- // } else {
|
|
|
- // console.log("error submit!!");
|
|
|
- // return false;
|
|
|
- // }
|
|
|
- // });
|
|
|
- // },
|
|
|
- // // 省市区删除行操作
|
|
|
- // deleteRow(index, rows) {
|
|
|
- // rows.splice(index, 1);
|
|
|
- // },
|
|
|
- // async submitForm() {
|
|
|
- // await this.$refs.ruleForm.validate(async (valid) => {
|
|
|
- // if (valid) {
|
|
|
- // this.loading = true;
|
|
|
- // const { good_code, customer_code } = JSON.parse(
|
|
|
- // JSON.stringify(this.ruleForm)
|
|
|
- // );
|
|
|
- // const { good_stock } = JSON.parse(JSON.stringify(this.stockForm));
|
|
|
- // const { order_addr } = JSON.parse(JSON.stringify(this.addrForm));
|
|
|
- // let model = {
|
|
|
- // 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,
|
|
|
- // };
|
|
|
- // model.good_stock.push(model1);
|
|
|
- // });
|
|
|
- // order_addr.forEach((v2) => {
|
|
|
- // if (v2.edit) {
|
|
|
- // isAEdit = true;
|
|
|
- // }
|
|
|
- // addrT += parseInt(v2.receipt_quantity);
|
|
|
- // let model2 = {
|
|
|
- // contactor: v2.contactor,
|
|
|
- // mobile: v2.mobile,
|
|
|
- // arrive_time: v2.arrive_time,
|
|
|
- // addr: v2.addr,
|
|
|
- // receipt_quantity: v2.receipt_quantity,
|
|
|
- // addr_code: v2.addr_code,
|
|
|
- // };
|
|
|
- // model.order_addr.push(model2);
|
|
|
- // });
|
|
|
- // if (isSEdit) {
|
|
|
- // this.$message.warning("请保存仓库信息!");
|
|
|
- // this.loading = false;
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // if (isAEdit) {
|
|
|
- // this.$message.warning("请保存地址信息!");
|
|
|
- // this.loading = false;
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // if (!isStockOk) {
|
|
|
- // this.$message.warning("部分仓库销售数量已大于可用数量!");
|
|
|
- // this.loading = false;
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // if (stockT !== addrT) {
|
|
|
- // this.$message.warning(
|
|
|
- // "库存出库总数量,与收货地址信息中的总数量不一致!"
|
|
|
- // );
|
|
|
- // this.loading = false;
|
|
|
- // return;
|
|
|
- // }
|
|
|
-
|
|
|
- // let res = await asyncRequest.add(model);
|
|
|
+ openHouseModal(index) {
|
|
|
+ let findex = this.addrForm.order_addr.findIndex((v) => v.edit === true);
|
|
|
+ if (findex !== -1) {
|
|
|
+ this.$message.warning("当前已有地址在编辑,请保存后再试!");
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ if (index === -1) {
|
|
|
+ this.addrForm.order_addr.push({
|
|
|
+ edit: true,
|
|
|
+ receipt_quantity: "",
|
|
|
+ contactor: "",
|
|
|
+ mobile: "",
|
|
|
+ addr_code: [],
|
|
|
+ addr: "",
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.addrForm.order_addr[index].edit = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //省市区选择
|
|
|
+ async select_area_change(e, index) {
|
|
|
+ this.addrForm.order_addr[index].addr_code = e;
|
|
|
+ const { addr_code } = this.addrForm.order_addr[index];
|
|
|
+ if (addr_code && addr_code.length === 3) {
|
|
|
+ let arrCode = addr_code[addr_code.length - 1];
|
|
|
+ // console.log(model);
|
|
|
+ let { code, data, message } = await asyncRequest.addrall({
|
|
|
+ code: arrCode,
|
|
|
+ });
|
|
|
+ if (code === 0) {
|
|
|
+ const { province, city, area } = data;
|
|
|
+ let province_name = province && province.name ? province.name : "";
|
|
|
+ let city_name = city && city.name ? city.name : "";
|
|
|
+ let area_name = area && area.name ? area.name : "";
|
|
|
+ this.addrForm.order_addr[index].addr_code_name =
|
|
|
+ province_name && city_name && area_name
|
|
|
+ ? `${province_name}/${city_name}/${area_name}`
|
|
|
+ : "";
|
|
|
+ } else if (code >= 100 && code <= 104) {
|
|
|
+ await this.logout();
|
|
|
+ } else {
|
|
|
+ this.$message.warning(message);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.addrForm.order_addr[index].addr_code_name = "";
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //省市区保存某一行
|
|
|
+ checkRow(rowIndex) {
|
|
|
+ this.$refs.addrForm.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.addrForm.order_addr[rowIndex].edit = false;
|
|
|
+ } else {
|
|
|
+ console.log("error submit!!");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 省市区删除行操作
|
|
|
+ deleteRow(index, rows) {
|
|
|
+ rows.splice(index, 1);
|
|
|
+ },
|
|
|
+ async submitForm() {
|
|
|
+ await this.$refs.ruleForm.validate(async (valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.loading = true;
|
|
|
+ let model = JSON.parse(JSON.stringify(this.ruleForm));
|
|
|
+ model.order_addr = [];
|
|
|
+ const { sendtype, good_num } = model;
|
|
|
+ const { order_addr } = JSON.parse(JSON.stringify(this.addrForm));
|
|
|
+ if (sendtype === "2" && order_addr && order_addr.length === 0) {
|
|
|
+ this.$message.warning("至少上传一个地址信息!");
|
|
|
+ this.loading = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let addrT = 0,
|
|
|
+ isAEdit = false;
|
|
|
+ order_addr.forEach((v2) => {
|
|
|
+ if (v2.edit) {
|
|
|
+ isAEdit = true;
|
|
|
+ }
|
|
|
+ addrT += parseInt(v2.receipt_quantity + "");
|
|
|
+ let model2 = {
|
|
|
+ addr_code: v2.addr_code.toString(),
|
|
|
+ contactor: v2.contactor,
|
|
|
+ mobile: v2.mobile,
|
|
|
+ addr: v2.addr,
|
|
|
+ receipt_quantity: v2.receipt_quantity,
|
|
|
+ };
|
|
|
+ model.order_addr.push(model2);
|
|
|
+ });
|
|
|
|
|
|
- // this.loading = false;
|
|
|
- // if (res && res.code === 0) {
|
|
|
- // this.$notify.success({
|
|
|
- // title: "添加成功",
|
|
|
- // message: "",
|
|
|
- // });
|
|
|
- // this.showModelThis = false;
|
|
|
- // // 刷新
|
|
|
- // this.$emit("refresh");
|
|
|
- // } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- // await this.logout();
|
|
|
- // } else {
|
|
|
- // this.$message.warning(res.message);
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // console.log("error submit!!");
|
|
|
- // return false;
|
|
|
- // }
|
|
|
- // });
|
|
|
- // },
|
|
|
+ if (isAEdit) {
|
|
|
+ this.$message.warning("请保存地址信息!");
|
|
|
+ this.loading = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (parseInt(good_num + "") !== addrT && sendtype === "2") {
|
|
|
+ this.$message.warning("收货总数量与购买不一致!");
|
|
|
+ this.loading = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ console.log(model);
|
|
|
+ let res = await asyncRequest.consultorder(model);
|
|
|
+ this.loading = false;
|
|
|
+ if (res && res.code === 0) {
|
|
|
+ this.$notify.success({
|
|
|
+ title: "下单成功!",
|
|
|
+ message: "",
|
|
|
+ });
|
|
|
+ this.showModelThis = false;
|
|
|
+ // 刷新
|
|
|
+ this.$emit("refresh");
|
|
|
+ } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
+ await this.logout();
|
|
|
+ } else {
|
|
|
+ this.$message.warning(res.message);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log("error submit!!");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|