|  | @@ -10,14 +10,22 @@
 | 
	
		
			
				|  |  |        <div class="add-customer-btn">
 | 
	
		
			
				|  |  |          <el-button
 | 
	
		
			
				|  |  |            class="el-button--small-yh"
 | 
	
		
			
				|  |  | -          style="right: 245px;"
 | 
	
		
			
				|  |  |            type="primary"
 | 
	
		
			
				|  |  |            :disabled="detailData.seeDisabled"
 | 
	
		
			
				|  |  | +          size="small"
 | 
	
		
			
				|  |  | +          @click="applySettlement"
 | 
	
		
			
				|  |  | +        >申请结算</el-button>
 | 
	
		
			
				|  |  | +        <el-button
 | 
	
		
			
				|  |  | +          class="el-button--small-yh"
 | 
	
		
			
				|  |  | +          type="primary"
 | 
	
		
			
				|  |  | +          :disabled="detailData.seeDisabled"
 | 
	
		
			
				|  |  | +          size="small"
 | 
	
		
			
				|  |  |            @click="saveSell"
 | 
	
		
			
				|  |  |          >生成采购单</el-button>
 | 
	
		
			
				|  |  |          <el-button
 | 
	
		
			
				|  |  |            class="el-button--small-yh"
 | 
	
		
			
				|  |  | -          type="success" style="right: 140px;" @click="copyOrder"
 | 
	
		
			
				|  |  | +          type="success" @click="copyOrder"
 | 
	
		
			
				|  |  | +          size="small"
 | 
	
		
			
				|  |  |            :disabled="detailData.seeDisabled || !this.form.id">
 | 
	
		
			
				|  |  |            复制新单
 | 
	
		
			
				|  |  |          </el-button>
 | 
	
	
		
			
				|  | @@ -26,6 +34,7 @@
 | 
	
		
			
				|  |  |            type="primary"
 | 
	
		
			
				|  |  |            :disabled="disabled || detailData.seeDisabled"
 | 
	
		
			
				|  |  |            :loading="saveLoading"
 | 
	
		
			
				|  |  | +          size="small"
 | 
	
		
			
				|  |  |            @click="editCustomer(false)"
 | 
	
		
			
				|  |  |          >{{ form.id ? '确认修改' : '确认新增' }}
 | 
	
		
			
				|  |  |          </el-button>
 | 
	
	
		
			
				|  | @@ -229,8 +238,8 @@
 | 
	
		
			
				|  |  |                @saveColumn="saveColumn('fees')"
 | 
	
		
			
				|  |  |            >
 | 
	
		
			
				|  |  |              <template slot="code" slot-scope="{row,index}">
 | 
	
		
			
				|  |  | +              <el-button type="text" size="mini" style="padding:4px 10px;float:left" @click="choice(row)" :disabled="detailData.seeDisabled || !row.$cellEdit">选择</el-button>
 | 
	
		
			
				|  |  |                <span>{{ row.code }}</span>
 | 
	
		
			
				|  |  | -              <el-button type="text" size="mini" style="padding:4px 10px;float:left" @click="choice(row)" :disabled="detailData.seeDisabled">选择</el-button>
 | 
	
		
			
				|  |  |              </template>
 | 
	
		
			
				|  |  |              <template slot="corpId" slot-scope="{ row }">
 | 
	
		
			
				|  |  |                <selectComponent v-if="row.$cellEdit" v-model="row.corpId"
 | 
	
	
		
			
				|  | @@ -869,7 +878,6 @@ export default {
 | 
	
		
			
				|  |  |              label: '制单人',
 | 
	
		
			
				|  |  |              prop: 'createUserName',
 | 
	
		
			
				|  |  |              disabled: true,
 | 
	
		
			
				|  |  | -            span: 24,
 | 
	
		
			
				|  |  |              rules: [
 | 
	
		
			
				|  |  |                {
 | 
	
		
			
				|  |  |                  required: false,
 | 
	
	
		
			
				|  | @@ -1269,35 +1277,71 @@ export default {
 | 
	
		
			
				|  |  |      //生成发货单
 | 
	
		
			
				|  |  |      generateShipmentD() {
 | 
	
		
			
				|  |  |        let lsit = []
 | 
	
		
			
				|  |  | -      for (let item in this.selection) {
 | 
	
		
			
				|  |  | -        if (!this.selection[item].id) {
 | 
	
		
			
				|  |  | -          return this.$confirm('商品信息有未保存数据, 是否立即保存?', '提示', {
 | 
	
		
			
				|  |  | -            confirmButtonText: '确定',
 | 
	
		
			
				|  |  | -            cancelButtonText: '取消',
 | 
	
		
			
				|  |  | -            type: 'warning'
 | 
	
		
			
				|  |  | -          }).then(() => {
 | 
	
		
			
				|  |  | -            this.editCustomer(false)
 | 
	
		
			
				|  |  | -          }).catch(() => {
 | 
	
		
			
				|  |  | -            this.$message({
 | 
	
		
			
				|  |  | -              type: 'info',
 | 
	
		
			
				|  |  | -              message: '已取消'
 | 
	
		
			
				|  |  | +      if (contrastObj(this.form, this.oldForm) ||
 | 
	
		
			
				|  |  | +        contrastList(this.contactsData, this.oldGoodsList) ||
 | 
	
		
			
				|  |  | +        contrastList(this.advantageProjectData, this.oldFeesList) ||
 | 
	
		
			
				|  |  | +        contrastList(this.bankOfDepositData, this.oldUploadList)
 | 
	
		
			
				|  |  | +      ) {
 | 
	
		
			
				|  |  | +        this.$confirm("数据发生变化未有提交记录, 是否保存?", "提示", {
 | 
	
		
			
				|  |  | +          confirmButtonText: "确定",
 | 
	
		
			
				|  |  | +          cancelButtonText: "取消",
 | 
	
		
			
				|  |  | +          type: "warning"
 | 
	
		
			
				|  |  | +        }).then(() => {
 | 
	
		
			
				|  |  | +          this.editCustomer(false)
 | 
	
		
			
				|  |  | +        }).catch(() => {
 | 
	
		
			
				|  |  | +          // this.$message({
 | 
	
		
			
				|  |  | +          //   type: 'info',
 | 
	
		
			
				|  |  | +          //   message: '已取消'
 | 
	
		
			
				|  |  | +          // });
 | 
	
		
			
				|  |  | +          this.selection.forEach(item => {
 | 
	
		
			
				|  |  | +            lsit.push(item.id)
 | 
	
		
			
				|  |  | +          })
 | 
	
		
			
				|  |  | +          let data = {
 | 
	
		
			
				|  |  | +            id: this.form.id,
 | 
	
		
			
				|  |  | +            orderItemIds: lsit
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +          generateShipment(data).then(res => {
 | 
	
		
			
				|  |  | +            this.$router.$avueRouter.closeTag("/businessManagement/deliveryNotice/index");
 | 
	
		
			
				|  |  | +            this.$router.push({
 | 
	
		
			
				|  |  | +              path: "/businessManagement/deliveryNotice/index",
 | 
	
		
			
				|  |  | +              query: {form: JSON.stringify(res.data.data)},
 | 
	
		
			
				|  |  |              });
 | 
	
		
			
				|  |  | -          });
 | 
	
		
			
				|  |  | -        } else {
 | 
	
		
			
				|  |  | -          lsit.push(this.selection[item].id)
 | 
	
		
			
				|  |  | +          })
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +      } else {
 | 
	
		
			
				|  |  | +        // lsit.push(this.selection[item].id)
 | 
	
		
			
				|  |  | +        this.selection.forEach(item => {
 | 
	
		
			
				|  |  | +          lsit.push(item.id)
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +        let data = {
 | 
	
		
			
				|  |  | +          id: this.form.id,
 | 
	
		
			
				|  |  | +          orderItemIds: lsit
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        generateShipment(data).then(res => {
 | 
	
		
			
				|  |  | +          this.$router.$avueRouter.closeTag("/businessManagement/deliveryNotice/index");
 | 
	
		
			
				|  |  | +          this.$router.push({
 | 
	
		
			
				|  |  | +            path: "/businessManagement/deliveryNotice/index",
 | 
	
		
			
				|  |  | +            query: {form: JSON.stringify(res.data.data)},
 | 
	
		
			
				|  |  | +          });
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  | -      let data = {
 | 
	
		
			
				|  |  | -        id: this.form.id,
 | 
	
		
			
				|  |  | -        orderItemIds: lsit
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | -      generateShipment(data).then(res => {
 | 
	
		
			
				|  |  | -        this.$router.$avueRouter.closeTag("/businessManagement/deliveryNotice/index");
 | 
	
		
			
				|  |  | -        this.$router.push({
 | 
	
		
			
				|  |  | -          path: "/businessManagement/deliveryNotice/index",
 | 
	
		
			
				|  |  | -          query: {form: JSON.stringify(res.data.data)},
 | 
	
		
			
				|  |  | -        });
 | 
	
		
			
				|  |  | -      })
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    // 生成结算
 | 
	
		
			
				|  |  | +    applySettlement() {
 | 
	
		
			
				|  |  | +      if (contrastObj(this.form, this.oldForm) ||
 | 
	
		
			
				|  |  | +        contrastList(this.contactsData, this.oldGoodsList) ||
 | 
	
		
			
				|  |  | +        contrastList(this.advantageProjectData, this.oldFeesList) ||
 | 
	
		
			
				|  |  | +        contrastList(this.bankOfDepositData, this.oldUploadList)
 | 
	
		
			
				|  |  | +      ) {
 | 
	
		
			
				|  |  | +        this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
 | 
	
		
			
				|  |  | +          confirmButtonText: "确定",
 | 
	
		
			
				|  |  | +          cancelButtonText: "取消",
 | 
	
		
			
				|  |  | +          type: "warning"
 | 
	
		
			
				|  |  | +        }).then(() => {
 | 
	
		
			
				|  |  | +          this.editCustomer(true)
 | 
	
		
			
				|  |  | +        }).catch(() => {
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +      } else {}
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      //商品选中触发
 | 
	
		
			
				|  |  |      productSelection(selection) {
 | 
	
	
		
			
				|  | @@ -1528,7 +1572,9 @@ export default {
 | 
	
		
			
				|  |  |            typeno: list[item].typeno
 | 
	
		
			
				|  |  |          }).then(res => {
 | 
	
		
			
				|  |  |            this.$set(list[item], 'storageQuantity', res.data.data)
 | 
	
		
			
				|  |  | -          this.$set(buyFree[item], 'storageQuantity', res.data.data)
 | 
	
		
			
				|  |  | +          if (this.policyDataTwo.length > 0) {
 | 
	
		
			
				|  |  | +            this.$set(buyFree[item], 'storageQuantity', res.data.data)
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  |          })
 | 
	
		
			
				|  |  |          if (this.policyData.length > 0) {
 | 
	
		
			
				|  |  |            this.$set(list[item], 'price', list[item].specialOffer)
 | 
	
	
		
			
				|  | @@ -1546,13 +1592,16 @@ export default {
 | 
	
		
			
				|  |  |          this.$set(list[item], 'sort', this.maxGoodsNum + 1)
 | 
	
		
			
				|  |  |          this.$set(list[item], 'purchaseAmount', list[item].purchasePrice)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        this.$set(buyFree[item], 'actualQuantity', 0)
 | 
	
		
			
				|  |  | -        this.$set(buyFree[item], 'amount', 0)
 | 
	
		
			
				|  |  | -        this.$set(buyFree[item], 'priceCategory', list[item].productCategory)
 | 
	
		
			
				|  |  | -        this.$set(buyFree[item], 'priceType', this.policyForm.cname)
 | 
	
		
			
				|  |  | -        this.$set(buyFree[item], 'cname', list[item].productCategory)
 | 
	
		
			
				|  |  | -        this.$set(buyFree[item], 'sort', this.maxGoodsNum + 1)
 | 
	
		
			
				|  |  | -        this.$set(buyFree[item], 'purchaseAmount', list[item].purchasePrice)
 | 
	
		
			
				|  |  | +        if (this.policyDataTwo.length > 0) {
 | 
	
		
			
				|  |  | +          this.$set(buyFree[item], 'actualQuantity', 0)
 | 
	
		
			
				|  |  | +          this.$set(buyFree[item], 'amount', 0)
 | 
	
		
			
				|  |  | +          this.$set(buyFree[item], 'priceCategory', list[item].productCategory)
 | 
	
		
			
				|  |  | +          this.$set(buyFree[item], 'priceType', this.policyForm.cname)
 | 
	
		
			
				|  |  | +          this.$set(buyFree[item], 'cname', list[item].productCategory)
 | 
	
		
			
				|  |  | +          this.$set(buyFree[item], 'sort', this.maxGoodsNum + 2)
 | 
	
		
			
				|  |  | +          this.$set(buyFree[item], 'purchaseAmount', list[item].purchasePrice)
 | 
	
		
			
				|  |  | +          this.maxGoodsNum++
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          delete list[item].id
 | 
	
		
			
				|  |  |          delete list[item].pid
 | 
	
		
			
				|  |  |          delete list[item].isDeleted
 | 
	
	
		
			
				|  | @@ -1564,7 +1613,9 @@ export default {
 | 
	
		
			
				|  |  |          this.maxGoodsNum++
 | 
	
		
			
				|  |  |          this.$refs.crudContact.rowCellAdd(list[item]);
 | 
	
		
			
				|  |  |          // this.$refs.crudContact.rowCell(list[item], this.contactsData.length - 1)
 | 
	
		
			
				|  |  | -        this.$refs.crudContact.rowCellAdd(buyFree[item]);
 | 
	
		
			
				|  |  | +        if (this.policyDataTwo.length > 0) {
 | 
	
		
			
				|  |  | +          this.$refs.crudContact.rowCellAdd(buyFree[item]);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          // this.$refs.crudContact.rowCell(buyFree[item], this.contactsData.length - 1)
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |        this.policyDialog = false
 | 
	
	
		
			
				|  | @@ -1799,6 +1850,8 @@ export default {
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                this.queryData(res.data.data.id)
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +          }).finally(() => {
 | 
	
		
			
				|  |  | +            this.saveLoading = false
 | 
	
		
			
				|  |  |            })
 | 
	
		
			
				|  |  |          } else {
 | 
	
		
			
				|  |  |            return false;
 |