|  | @@ -62,6 +62,7 @@
 | 
	
		
			
				|  |  |                      <el-tab-pane label="销售明细" name="sale_detail">
 | 
	
		
			
				|  |  |                          <avue-crud :option="optionContacts" v-model="formContacts" ref="formContacts"
 | 
	
		
			
				|  |  |                              :data="form.orderItemsList" :key="key" @row-save="rowSave" @row-update="rowUpdate"
 | 
	
		
			
				|  |  | +                            @row-close="rowClose" :before-close="beforeClose"
 | 
	
		
			
				|  |  |                              @resetColumn="resetColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.1)"
 | 
	
		
			
				|  |  |                              @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.1)">
 | 
	
		
			
				|  |  |                              <template slot-scope="{scope,row}" slot="menuLeft">
 | 
	
	
		
			
				|  | @@ -156,21 +157,26 @@ import check from "@/components/check/check";
 | 
	
		
			
				|  |  |  import { getList } from "@/api/paymentManagement/paymentRecord"
 | 
	
		
			
				|  |  |  import TicketDistribution from "../../../oceanShipping/maritimeExport/components/ticketDistribution.vue";
 | 
	
		
			
				|  |  |  import M from "minimatch";
 | 
	
		
			
				|  |  | +import da from "element-ui/src/locale/lang/da";
 | 
	
		
			
				|  |  | +import { number } from "echarts";
 | 
	
		
			
				|  |  |  export default {
 | 
	
		
			
				|  |  |      name: "detailsPage",
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      data() {
 | 
	
		
			
				|  |  |          return {
 | 
	
		
			
				|  |  |              inventory: 0,
 | 
	
		
			
				|  |  | +            isStatus: 1,
 | 
	
		
			
				|  |  |              goodsIdoptions: [],
 | 
	
		
			
				|  |  |              dataList: [],
 | 
	
		
			
				|  |  |              dicUrlWithCustomId: '',
 | 
	
		
			
				|  |  | +            sharedCompanyId: 0,
 | 
	
		
			
				|  |  |              isAddBtn: true,
 | 
	
		
			
				|  |  |              isSaveBtn: false,
 | 
	
		
			
				|  |  |              viewDisabled: false,
 | 
	
		
			
				|  |  |              isAdd: false,
 | 
	
		
			
				|  |  |              editButton: true,
 | 
	
		
			
				|  |  |              isEditButton: false,
 | 
	
		
			
				|  |  | +            goods: [],
 | 
	
		
			
				|  |  |              isDisabled: false,
 | 
	
		
			
				|  |  |              isDisabledTask: false,
 | 
	
		
			
				|  |  |              contactsOption: [],
 | 
	
	
		
			
				|  | @@ -459,8 +465,11 @@ export default {
 | 
	
		
			
				|  |  |                          trigger: "blur"
 | 
	
		
			
				|  |  |                      }, {
 | 
	
		
			
				|  |  |                          validator: (rule, value, callback) => {
 | 
	
		
			
				|  |  | +                            console.log(this.formContacts.inventory);
 | 
	
		
			
				|  |  |                              if (value < 0) {
 | 
	
		
			
				|  |  |                                  callback(new Error("数量不能小于0"));
 | 
	
		
			
				|  |  | +                            } else if (Number(value) > Number(this.formContacts.inventory)) {
 | 
	
		
			
				|  |  | +                                callback(new Error("数量不能大于库存"));
 | 
	
		
			
				|  |  |                              } else {
 | 
	
		
			
				|  |  |                                  callback();
 | 
	
		
			
				|  |  |                              }
 | 
	
	
		
			
				|  | @@ -703,6 +712,7 @@ export default {
 | 
	
		
			
				|  |  |          this.findObject(this.optionContactsBack.column, "goodsId").change = ({ value, column }) => {
 | 
	
		
			
				|  |  |              if (this.formContacts.goodsId !== value) {
 | 
	
		
			
				|  |  |                  goodsDetail({ id: value, customId: this.dicUrlWithCustomId, stock: this.form.storageId ? this.form.storageId : '' }).then(res => {
 | 
	
		
			
				|  |  | +                    this.goods = res.data.data
 | 
	
		
			
				|  |  |                      this.formContacts.goodsNo = res.data.data.code
 | 
	
		
			
				|  |  |                      this.formContacts.brandId = res.data.data.brandId
 | 
	
		
			
				|  |  |                      this.formContacts.inventory = res.data.data.inventory
 | 
	
	
		
			
				|  | @@ -714,6 +724,21 @@ export default {
 | 
	
		
			
				|  |  |                      this.formContacts.goodsDescription = res.data.data.goodsDescription
 | 
	
		
			
				|  |  |                      this.formContacts.units = res.data.data.unit
 | 
	
		
			
				|  |  |                      this.formContacts.price = res.data.data.price
 | 
	
		
			
				|  |  | +                    //
 | 
	
		
			
				|  |  | +                    this.formContacts.sharedCompanyId = res.data.data.sharedCompanyId
 | 
	
		
			
				|  |  | +                    console.log(res.data.data.sharedCompanyId);
 | 
	
		
			
				|  |  | +                    console.log(res.data.data.sharedCompanyName);
 | 
	
		
			
				|  |  | +                    this.form.sharedCompanyId = res.data.data.sharedCompanyId
 | 
	
		
			
				|  |  | +                    this.form.sharedCompanyName = res.data.data.sharedCompanyName
 | 
	
		
			
				|  |  | +                    this.sharedCompanyId = res.data.data.sharedCompanyId
 | 
	
		
			
				|  |  | +                    console.log(res.data.data.sharedCompanyId);
 | 
	
		
			
				|  |  | +                    console.log(this.form.orderItemsList);
 | 
	
		
			
				|  |  | +                    for (let i = 0; i < this.form.orderItemsList.length; i++) {
 | 
	
		
			
				|  |  | +                        console.log(Number(this.form.orderItemsList[i].sharedCompanyId));
 | 
	
		
			
				|  |  | +                        if (Number(this.form.orderItemsList[i].sharedCompanyId) != Number(res.data.data.sharedCompanyId)) {
 | 
	
		
			
				|  |  | +                            this.isStatus = 0
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  |                      if (res.data.data.whether == 0) {
 | 
	
		
			
				|  |  |                          this.findObject(this.optionContactsBack.column, "dot").disabled = true
 | 
	
		
			
				|  |  |                      } else {
 | 
	
	
		
			
				|  | @@ -736,16 +761,26 @@ export default {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              if (this.formContacts.goodsId !== value) {
 | 
	
		
			
				|  |  |                  goodsDetail({ id: value, customId: this.dicUrlWithCustomId, stock: this.form.storageId ? this.form.storageId : '' }).then(res => {
 | 
	
		
			
				|  |  | +                    this.goods = res.data.data
 | 
	
		
			
				|  |  |                      this.formContacts.goodsNo = res.data.data.code
 | 
	
		
			
				|  |  |                      this.formContacts.brandId = res.data.data.brandId
 | 
	
		
			
				|  |  |                      this.formContacts.inventory = res.data.data.inventory
 | 
	
		
			
				|  |  |                      // this.formContacts.brandId = res.data.data.brandName
 | 
	
		
			
				|  |  |                      // this.formContacts.brandName = res.data.data.brandId
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |                      this.formContacts.propertyName = res.data.data.specificationAndModel
 | 
	
		
			
				|  |  |                      this.formContacts.pattern = res.data.data.brandItem
 | 
	
		
			
				|  |  |                      this.formContacts.goodsDescription = res.data.data.goodsDescription
 | 
	
		
			
				|  |  |                      this.formContacts.units = res.data.data.unit
 | 
	
		
			
				|  |  | +                    this.sharedCompanyId = res.data.data.sharedCompanyId
 | 
	
		
			
				|  |  | +                    this.formContacts.sharedCompanyId = res.data.data.sharedCompanyId
 | 
	
		
			
				|  |  | +                    //
 | 
	
		
			
				|  |  | +                    this.form.sharedCompanyId = res.data.data.sharedCompanyId
 | 
	
		
			
				|  |  | +                    this.form.sharedCompanyName = res.data.data.sharedCompanyName
 | 
	
		
			
				|  |  | +                    for (let i = 0; i < this.form.orderItemsList.length; i++) {
 | 
	
		
			
				|  |  | +                        if (this.form.orderItemsList[i].sharedCompanyId != res.data.data.sharedCompanyId) {
 | 
	
		
			
				|  |  | +                            this.isStatus = 0
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  |                      if (res.data.data.whether == 0) {
 | 
	
		
			
				|  |  |                          this.findObject(this.optionContacts.column, "dot").disabled = true
 | 
	
		
			
				|  |  |                      } else {
 | 
	
	
		
			
				|  | @@ -817,6 +852,30 @@ export default {
 | 
	
		
			
				|  |  |                  this.findObject(this.optionContactsBack.column, "goodsId").dicData = res.data.data
 | 
	
		
			
				|  |  |              })
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  | +        'form.orderItemsList.length'(newformContacts, oldformContacts) {
 | 
	
		
			
				|  |  | +            console.log(this.formContacts);
 | 
	
		
			
				|  |  | +            console.log(this.form.orderItemsList);
 | 
	
		
			
				|  |  | +            // for (let i = 0; i < this.form.orderItemsList.length - 1; i++) {
 | 
	
		
			
				|  |  | +            //     const currentItem = this.form.orderItemsList[i];
 | 
	
		
			
				|  |  | +            //     const nextItem = this.form.orderItemsList[i + 1];
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            //     if (currentItem.sharedCompanyId !== nextItem.sharedCompanyId) {
 | 
	
		
			
				|  |  | +            //         console.log('不能添加');
 | 
	
		
			
				|  |  | +            //     }
 | 
	
		
			
				|  |  | +            // }
 | 
	
		
			
				|  |  | +            if (this.form.orderItemsList.length) {
 | 
	
		
			
				|  |  | +                this.findObject(this.optionForm.column, 'storageId').disabled = true
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                this.findObject(this.optionForm.column, 'storageId').disabled = false
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        'form.sharedCompanyId'(newSharedCompanyId, oldSharedCompanyId) {
 | 
	
		
			
				|  |  | +            console.log(newSharedCompanyId, oldSharedCompanyId);
 | 
	
		
			
				|  |  | +            if (newSharedCompanyId != oldSharedCompanyId) {
 | 
	
		
			
				|  |  | +                console.log('不能添加');
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            console.log(this.sharedCompanyId);
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  |          $route(to, from) {
 | 
	
		
			
				|  |  |              if (this.onLoad.id && this.detailData.id) {
 | 
	
		
			
				|  |  |                  this.$set(this.optionForm, 'disabled', true)
 | 
	
	
		
			
				|  | @@ -901,7 +960,7 @@ export default {
 | 
	
		
			
				|  |  |              this.isDisabled = false
 | 
	
		
			
				|  |  |              this.isAdd = false
 | 
	
		
			
				|  |  |              if (this.form.businessSource == "外部销售") {
 | 
	
		
			
				|  |  | -                if(this.form.status == '待发货'){
 | 
	
		
			
				|  |  | +                if (this.form.status == '待发货') {
 | 
	
		
			
				|  |  |                      this.isSaveBtn = false;
 | 
	
		
			
				|  |  |                      this.isDisabledTask = false;
 | 
	
		
			
				|  |  |                      this.viewDisabled = false;
 | 
	
	
		
			
				|  | @@ -1031,7 +1090,7 @@ export default {
 | 
	
		
			
				|  |  |                      })
 | 
	
		
			
				|  |  |                      loading.close()
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -                if(this.form.status == '待发货'){
 | 
	
		
			
				|  |  | +                if (this.form.status == '待发货') {
 | 
	
		
			
				|  |  |                      this.isSaveBtn = false;
 | 
	
		
			
				|  |  |                      this.isDisabledTask = false;
 | 
	
		
			
				|  |  |                      this.viewDisabled = false;
 | 
	
	
		
			
				|  | @@ -1065,7 +1124,6 @@ export default {
 | 
	
		
			
				|  |  |                          this.$set(this.optionForm, 'disabled', true)
 | 
	
		
			
				|  |  |                          this.$set(this.optionContactsBack, 'disabled', true)
 | 
	
		
			
				|  |  |                          this.$refs["form"].validate((valid, done) => {
 | 
	
		
			
				|  |  | -                            done();
 | 
	
		
			
				|  |  |                              if (valid) {
 | 
	
		
			
				|  |  |                                  const loading = this.$loading({
 | 
	
		
			
				|  |  |                                      lock: true,
 | 
	
	
		
			
				|  | @@ -1083,22 +1141,48 @@ export default {
 | 
	
		
			
				|  |  |                                  //     items.goodsName = goodsName
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                                  // })
 | 
	
		
			
				|  |  | -                                this.save()
 | 
	
		
			
				|  |  | -                                generateShipTask(this.form).then(res => {
 | 
	
		
			
				|  |  | -                                    console.log(2);
 | 
	
		
			
				|  |  | -                                    console.log(res.data);
 | 
	
		
			
				|  |  | -                                    this.refresh(res.data.data.id, true)
 | 
	
		
			
				|  |  | -                                    this.isContacts = true
 | 
	
		
			
				|  |  | -                                    // 将按钮文本更改为"撤销任务"
 | 
	
		
			
				|  |  | -                                    this.buttonText = '撤销任务';
 | 
	
		
			
				|  |  | -                                    // 将按钮颜色更改为对应的颜色
 | 
	
		
			
				|  |  | -                                    this.buttonColor = 'warning'; // 比如改为warning
 | 
	
		
			
				|  |  | -                                    this.$message.success("生成出库任务成功");
 | 
	
		
			
				|  |  | -                                    this.isApplySettlement = false
 | 
	
		
			
				|  |  | -                                    loading.close();
 | 
	
		
			
				|  |  | -                                }).finally(() => {
 | 
	
		
			
				|  |  | -                                    loading.close();
 | 
	
		
			
				|  |  | +                                this.$refs["form"].validate((valid, done) => {
 | 
	
		
			
				|  |  | +                                    done();
 | 
	
		
			
				|  |  | +                                    if (valid) {
 | 
	
		
			
				|  |  | +                                        const loading = this.$loading({
 | 
	
		
			
				|  |  | +                                            lock: true,
 | 
	
		
			
				|  |  | +                                            text: '加载中',
 | 
	
		
			
				|  |  | +                                            spinner: 'el-icon-loading',
 | 
	
		
			
				|  |  | +                                            background: 'rgba(255,255,255,0.7)'
 | 
	
		
			
				|  |  | +                                        });
 | 
	
		
			
				|  |  | +                                        submit({
 | 
	
		
			
				|  |  | +                                            bsType: "XS",
 | 
	
		
			
				|  |  | +                                            ...this.form
 | 
	
		
			
				|  |  | +                                        }).then(res => {
 | 
	
		
			
				|  |  | +                                            console.log(1);
 | 
	
		
			
				|  |  | +                                            this.refresh(res.data.data.id)
 | 
	
		
			
				|  |  | +                                            this.isDisabledTask = false
 | 
	
		
			
				|  |  | +                                            generateShipTask(this.form).then(res => {
 | 
	
		
			
				|  |  | +                                                console.log(2);
 | 
	
		
			
				|  |  | +                                                console.log(res.data);
 | 
	
		
			
				|  |  | +                                                this.refresh(res.data.data.id, true)
 | 
	
		
			
				|  |  | +                                                this.isContacts = true
 | 
	
		
			
				|  |  | +                                                // 将按钮文本更改为"撤销任务"
 | 
	
		
			
				|  |  | +                                                this.buttonText = '撤销任务';
 | 
	
		
			
				|  |  | +                                                // 将按钮颜色更改为对应的颜色
 | 
	
		
			
				|  |  | +                                                this.buttonColor = 'warning'; // 比如改为warning
 | 
	
		
			
				|  |  | +                                                this.$message.success("生成出库任务成功");
 | 
	
		
			
				|  |  | +                                                this.isApplySettlement = false
 | 
	
		
			
				|  |  | +                                                loading.close();
 | 
	
		
			
				|  |  | +                                            }).finally(() => {
 | 
	
		
			
				|  |  | +                                                loading.close();
 | 
	
		
			
				|  |  | +                                            });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                                            loading.close();
 | 
	
		
			
				|  |  | +                                        }).finally(() => {
 | 
	
		
			
				|  |  | +                                            loading.close();
 | 
	
		
			
				|  |  | +                                        });
 | 
	
		
			
				|  |  | +                                    } else {
 | 
	
		
			
				|  |  | +                                        return false;
 | 
	
		
			
				|  |  | +                                    }
 | 
	
		
			
				|  |  |                                  });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                                done();
 | 
	
		
			
				|  |  |                              } else {
 | 
	
		
			
				|  |  |                                  this.$message.error('请选择仓库')
 | 
	
		
			
				|  |  |                              }
 | 
	
	
		
			
				|  | @@ -1106,9 +1190,8 @@ export default {
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  } else {
 | 
	
		
			
				|  |  |                      this.$refs["form"].validate((valid, done) => {
 | 
	
		
			
				|  |  | -                        done();
 | 
	
		
			
				|  |  |                          console.log(valid);
 | 
	
		
			
				|  |  | -                        if (true) {
 | 
	
		
			
				|  |  | +                        if (valid) {
 | 
	
		
			
				|  |  |                              const loading = this.$loading({
 | 
	
		
			
				|  |  |                                  lock: true,
 | 
	
		
			
				|  |  |                                  text: '加载中',
 | 
	
	
		
			
				|  | @@ -1146,6 +1229,8 @@ export default {
 | 
	
		
			
				|  |  |                              }).finally(() => {
 | 
	
		
			
				|  |  |                                  loading.close();
 | 
	
		
			
				|  |  |                              });
 | 
	
		
			
				|  |  | +                            done();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                      })
 | 
	
		
			
				|  |  |                  }
 | 
	
	
		
			
				|  | @@ -1229,6 +1314,17 @@ export default {
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              });
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  | +        //关闭弹窗表单
 | 
	
		
			
				|  |  | +        beforeClose(done, type) {
 | 
	
		
			
				|  |  | +            console.log(type);
 | 
	
		
			
				|  |  | +            // if(row == "add"){
 | 
	
		
			
				|  |  | +            //     this.form.sharedCompanyId = this.form.sharedCompanyId?this.form.sharedCompanyId:''
 | 
	
		
			
				|  |  | +            //     this.form.sharedCompanyName = this.form.sharedCompanyName?this.form.sharedCompanyName:''
 | 
	
		
			
				|  |  | +            // }
 | 
	
		
			
				|  |  | +            console.log('this.form.sharedCompanyId', this.form.sharedCompanyId);
 | 
	
		
			
				|  |  | +            console.log('this.form.sharedCompanyName', this.form.sharedCompanyName);
 | 
	
		
			
				|  |  | +            done()
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  |          refresh(id, type) {
 | 
	
		
			
				|  |  |              const loading = this.$loading({
 | 
	
		
			
				|  |  |                  lock: true,
 | 
	
	
		
			
				|  | @@ -1259,7 +1355,7 @@ export default {
 | 
	
		
			
				|  |  |                      this.isSaveBtn = true;
 | 
	
		
			
				|  |  |                      this.isDisabledTask = true;
 | 
	
		
			
				|  |  |                      this.viewDisabled = true;
 | 
	
		
			
				|  |  | -                }else{
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  |                      this.isSaveBtn = true;
 | 
	
		
			
				|  |  |                      this.isDisabledTask = true;
 | 
	
		
			
				|  |  |                      this.viewDisabled = true;
 | 
	
	
		
			
				|  | @@ -1485,7 +1581,14 @@ export default {
 | 
	
		
			
				|  |  |              );
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  |          rowSave(form, done, loading) {
 | 
	
		
			
				|  |  | -            done(form)
 | 
	
		
			
				|  |  | +            if (this.isStatus) {
 | 
	
		
			
				|  |  | +                done(form)
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                this.$message.error('请选择相同商户的轮胎')
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            console.log(form);
 | 
	
		
			
				|  |  | +            // this.form.sharedCompanyId = res.data.data.sharedCompanyId
 | 
	
		
			
				|  |  | +            // this.form.sharedCompanyName = res.data.data.sharedCompanyName
 | 
	
		
			
				|  |  |          },
 | 
	
		
			
				|  |  |          rowUpdate(form, index, done, loading) {
 | 
	
		
			
				|  |  |              done(form)
 |