|
@@ -210,7 +210,6 @@
|
|
|
<el-tooltip
|
|
|
effect="dark"
|
|
|
content="编辑"
|
|
|
- v-if="!scope.row.edit"
|
|
|
placement="top"
|
|
|
>
|
|
|
<i
|
|
@@ -219,17 +218,7 @@
|
|
|
></i>
|
|
|
</el-tooltip>
|
|
|
|
|
|
- <el-tooltip
|
|
|
- effect="dark"
|
|
|
- content="保存"
|
|
|
- v-if="scope.row.edit"
|
|
|
- placement="top"
|
|
|
- >
|
|
|
- <i
|
|
|
- class="el-icon-circle-check tb-icon"
|
|
|
- @click="checkRow(scope.$index)"
|
|
|
- ></i>
|
|
|
- </el-tooltip>
|
|
|
+
|
|
|
|
|
|
<el-tooltip effect="dark" content="删除" placement="top">
|
|
|
<i
|
|
@@ -248,10 +237,17 @@
|
|
|
@cancel="addrmodel = false"
|
|
|
@refresh="addrRefresh"
|
|
|
/>
|
|
|
+ <addr-add-edit-modal
|
|
|
+ :showModel="showAddrAddEditModal"
|
|
|
+ :index="AddrAddEditModalIndex"
|
|
|
+ :sitem="AddrAddEditModalSitem"
|
|
|
+ @cancel="showAddrAddEditModal = false"
|
|
|
+ @refresh="showAddrAddEditModalRefresh"
|
|
|
+ />
|
|
|
</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"
|
|
@@ -267,11 +263,12 @@ import resToken from "@/mixins/resToken";
|
|
|
import asyncRequest from "@/apis/service/sheetOrder/zxOrder/detail";
|
|
|
import { isnumber, isMobile } from "@/utils/validate";
|
|
|
import inAddrModel from "@/components/in-addr-model";
|
|
|
+import AddrAddEditModal from "@/components/addr-add-edit-modal";
|
|
|
export default {
|
|
|
name: "salesOrderDetail",
|
|
|
mixins: [mixinPage, resToken],
|
|
|
props: ["newTime", "id", "sitem"],
|
|
|
- components: { inAddrModel },
|
|
|
+ components: { inAddrModel, AddrAddEditModal },
|
|
|
watch: {
|
|
|
newTime: function (val) {
|
|
|
if (val) {
|
|
@@ -294,17 +291,7 @@ export default {
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
- const validatemobile = (rule, value, callback) => {
|
|
|
- if (value === "") {
|
|
|
- callback(new Error("手机号不能为空!"));
|
|
|
- } else {
|
|
|
- if (!isMobile(value)) {
|
|
|
- callback(new Error("手机号格式不正确!"));
|
|
|
- } else {
|
|
|
- callback();
|
|
|
- }
|
|
|
- }
|
|
|
- };
|
|
|
+
|
|
|
const validateWeight = (rule, value, callback) => {
|
|
|
if (value === "") {
|
|
|
callback(new Error("收货总数不能为空!"));
|
|
@@ -318,6 +305,9 @@ export default {
|
|
|
};
|
|
|
return {
|
|
|
addrmodel: false,
|
|
|
+ showAddrAddEditModal: false,
|
|
|
+ AddrAddEditModalIndex: -1,
|
|
|
+ AddrAddEditModalSitem: {},
|
|
|
stock_code: "",
|
|
|
companyName: "",
|
|
|
supplierName: "",
|
|
@@ -423,42 +413,6 @@ export default {
|
|
|
},
|
|
|
delAddrList: [],
|
|
|
delStockList: [],
|
|
|
- addrRules: {
|
|
|
- arrive_time: {
|
|
|
- required: true,
|
|
|
- message: "最晚收货日期不能为空",
|
|
|
- trigger: "change",
|
|
|
- },
|
|
|
- receipt_quantity: {
|
|
|
- required: true,
|
|
|
- validator: validateWeight,
|
|
|
- trigger: "blur",
|
|
|
- },
|
|
|
-
|
|
|
- contactor: {
|
|
|
- required: true,
|
|
|
- trigger: "blur",
|
|
|
- message: "联系人不能为空",
|
|
|
- },
|
|
|
- mobile: {
|
|
|
- required: true,
|
|
|
- validator: validatemobile,
|
|
|
- trigger: "blur",
|
|
|
- },
|
|
|
-
|
|
|
- order_addr: {
|
|
|
- type: "array",
|
|
|
- required: true,
|
|
|
- message: "收货省市区不能为空",
|
|
|
- trigger: "change",
|
|
|
- },
|
|
|
- addr: {
|
|
|
- required: true,
|
|
|
- message: "详细地址不能为空",
|
|
|
- trigger: "blur",
|
|
|
- },
|
|
|
- },
|
|
|
-
|
|
|
loading: false,
|
|
|
queryId: "",
|
|
|
status: "",
|
|
@@ -569,43 +523,19 @@ export default {
|
|
|
},
|
|
|
|
|
|
openHouseModal(index) {
|
|
|
- let findex = this.addrForm.order_addr.findIndex((v) => v.edit === true);
|
|
|
- if (findex !== -1) {
|
|
|
- this.$message.warning("当前已有地址在编辑,请保存后再试!");
|
|
|
- return;
|
|
|
+ this.AddrAddEditModalIndex = index;
|
|
|
+
|
|
|
+ if (index === -1) {
|
|
|
+ this.AddrAddEditModalSitem = {};
|
|
|
} else {
|
|
|
- if (index === -1) {
|
|
|
- this.addrForm.order_addr.push({
|
|
|
- edit: true,
|
|
|
- arrive_time: "",
|
|
|
- receipt_quantity: "",
|
|
|
- contactor: "",
|
|
|
- mobile: "",
|
|
|
- addr_code: [],
|
|
|
- addr: "",
|
|
|
- id: "",
|
|
|
- is_del: 0,
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.addrForm.order_addr[index].edit = true;
|
|
|
- }
|
|
|
+ this.AddrAddEditModalSitem = JSON.parse(
|
|
|
+ JSON.stringify(this.addrForm.order_addr[index])
|
|
|
+ );
|
|
|
}
|
|
|
+ this.showAddrAddEditModal = 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, type) {
|
|
|
const id = rows[index].id;
|
|
@@ -620,6 +550,35 @@ export default {
|
|
|
}
|
|
|
rows.splice(index, 1);
|
|
|
},
|
|
|
+ showAddrAddEditModalRefresh(e) {
|
|
|
+ const { index, item } = e;
|
|
|
+ // console.log(addr_code_name);
|
|
|
+ console.log(item);
|
|
|
+ if (index === -1) {
|
|
|
+ this.addrForm.order_addr.push(JSON.parse(JSON.stringify(item)));
|
|
|
+ } else {
|
|
|
+ const {
|
|
|
+ arrive_time,
|
|
|
+ receipt_quantity,
|
|
|
+ contactor,
|
|
|
+ mobile,
|
|
|
+ addr_code,
|
|
|
+ addr_code_name,
|
|
|
+ addr,
|
|
|
+ id,
|
|
|
+ } = JSON.parse(JSON.stringify(item));
|
|
|
+
|
|
|
+ this.addrForm.order_addr[index].receipt_quantity = receipt_quantity;
|
|
|
+ this.addrForm.order_addr[index].arrive_time = arrive_time;
|
|
|
+ this.addrForm.order_addr[index].contactor = contactor;
|
|
|
+ this.addrForm.order_addr[index].mobile = mobile;
|
|
|
+ this.addrForm.order_addr[index].addr_code = addr_code;
|
|
|
+ this.addrForm.order_addr[index].addr_code_name = addr_code_name;
|
|
|
+ this.addrForm.order_addr[index].addr = addr;
|
|
|
+ this.addrForm.order_addr[index].id = id;
|
|
|
+ }
|
|
|
+ this.$refs.addrForm.validateField("order_addr");
|
|
|
+ },
|
|
|
async submitForm() {
|
|
|
await this.$refs.ruleForm.validate(async (valid) => {
|
|
|
if (valid) {
|
|
@@ -689,7 +648,7 @@ export default {
|
|
|
dAList.forEach((v) => {
|
|
|
v.is_del = 1;
|
|
|
});
|
|
|
- model.addrlist.push(dAList);
|
|
|
+ model.addrlist.push(...dAList);
|
|
|
}
|
|
|
|
|
|
let res = await asyncRequest.update(model);
|