|  | @@ -14,7 +14,7 @@
 | 
											
												
													
														|  |            </el-button>
 |  |            </el-button>
 | 
											
												
													
														|  |              <!--<el-button type="primary" size="small" v-if="form.confirmStatus == 1" @click="newAddfun">新建销售单-->
 |  |              <!--<el-button type="primary" size="small" v-if="form.confirmStatus == 1" @click="newAddfun">新建销售单-->
 | 
											
												
													
														|  |              <!--</el-button>-->
 |  |              <!--</el-button>-->
 | 
											
												
													
														|  | -            <el-button type="warning" size="small" :disabled="form.purchaseAmount == form.settlmentAmount" v-if="form.confirmStatus == 1" @click.stop="clickPayment">收款
 |  | 
 | 
											
												
													
														|  | 
 |  | +            <el-button type="warning" size="small" :disabled="form.debitAmount == form.settlmentAmount" v-if="form.confirmStatus == 1" @click.stop="clickPayment">收款
 | 
											
												
													
														|  |              </el-button>
 |  |              </el-button>
 | 
											
												
													
														|  |            <el-button type="info" icon="el-icon-printer" size="small" @click.stop="openReport()">报表打印
 |  |            <el-button type="info" icon="el-icon-printer" size="small" @click.stop="openReport()">报表打印
 | 
											
												
													
														|  |            </el-button>
 |  |            </el-button>
 | 
											
										
											
												
													
														|  | @@ -63,7 +63,7 @@
 | 
											
												
													
														|  |                <!--@change="amountChange"-->
 |  |                <!--@change="amountChange"-->
 | 
											
												
													
														|  |            </template>
 |  |            </template>
 | 
											
												
													
														|  |              <template slot="memberBalance">
 |  |              <template slot="memberBalance">
 | 
											
												
													
														|  | -                <el-input-number v-model="form.memberBalance" :disabled="detailData.status == 1"
 |  | 
 | 
											
												
													
														|  | 
 |  | +                <el-input-number v-model="form.memberBalance" :disabled="form.debitAmount == form.settlmentAmount && mebertype"
 | 
											
												
													
														|  |                                   placeholder="请输入" size="small" :controls="false"
 |  |                                   placeholder="请输入" size="small" :controls="false"
 | 
											
												
													
														|  |                                   @change="memberchange"></el-input-number>
 |  |                                   @change="memberchange"></el-input-number>
 | 
											
												
													
														|  |                  <span style="margin-left: 10px;border: 1px solid #E4E7ED;padding: 6px;border-radius: 4px">
 |  |                  <span style="margin-left: 10px;border: 1px solid #E4E7ED;padding: 6px;border-radius: 4px">
 | 
											
										
											
												
													
														|  | @@ -162,7 +162,13 @@
 | 
											
												
													
														|  |            width="35%"
 |  |            width="35%"
 | 
											
												
													
														|  |            :before-close="paymentClose">
 |  |            :before-close="paymentClose">
 | 
											
												
													
														|  |            <div>
 |  |            <div>
 | 
											
												
													
														|  | -              <div>本次收款需要支付金额为{{this.form.currentAmount}}</div>
 |  | 
 | 
											
												
													
														|  | 
 |  | +              <div>本次收款需要支付金额为{{form.currentAmount}}</div>
 | 
											
												
													
														|  | 
 |  | +              <div style="display: flex;align-items: center;margin-top: 20px">
 | 
											
												
													
														|  | 
 |  | +                  <div style="margin-right: 10px">支付金额:</div>
 | 
											
												
													
														|  | 
 |  | +                  <div>
 | 
											
												
													
														|  | 
 |  | +                      <el-input v-model="form.currentAmount" placeholder="请输入支付金额"></el-input>
 | 
											
												
													
														|  | 
 |  | +                  </div>
 | 
											
												
													
														|  | 
 |  | +              </div>
 | 
											
												
													
														|  |                <div style="display: flex;align-items: center;margin-top: 20px">
 |  |                <div style="display: flex;align-items: center;margin-top: 20px">
 | 
											
												
													
														|  |                    <div style="margin-right: 10px">支付账户:</div>
 |  |                    <div style="margin-right: 10px">支付账户:</div>
 | 
											
												
													
														|  |                    <div>
 |  |                    <div>
 | 
											
										
											
												
													
														|  | @@ -210,6 +216,7 @@ export default {
 | 
											
												
													
														|  |    name: "index",
 |  |    name: "index",
 | 
											
												
													
														|  |    data() {
 |  |    data() {
 | 
											
												
													
														|  |      return {
 |  |      return {
 | 
											
												
													
														|  | 
 |  | +        mebertype:false,
 | 
											
												
													
														|  |          // 收款账户
 |  |          // 收款账户
 | 
											
												
													
														|  |          accountdata:[],
 |  |          accountdata:[],
 | 
											
												
													
														|  |          // 付款的弹窗开启和关闭
 |  |          // 付款的弹窗开启和关闭
 | 
											
										
											
												
													
														|  | @@ -357,7 +364,7 @@ export default {
 | 
											
												
													
														|  |          column: [
 |  |          column: [
 | 
											
												
													
														|  |            {
 |  |            {
 | 
											
												
													
														|  |              label: "订单金额",
 |  |              label: "订单金额",
 | 
											
												
													
														|  | -            prop: "purchaseAmount",
 |  | 
 | 
											
												
													
														|  | 
 |  | +            prop: "orderAmount",
 | 
											
												
													
														|  |              disabled: true,
 |  |              disabled: true,
 | 
											
												
													
														|  |              span: 4,
 |  |              span: 4,
 | 
											
												
													
														|  |            },
 |  |            },
 | 
											
										
											
												
													
														|  | @@ -373,7 +380,7 @@ export default {
 | 
											
												
													
														|  |              },
 |  |              },
 | 
											
												
													
														|  |            {
 |  |            {
 | 
											
												
													
														|  |              label: "应收金额",
 |  |              label: "应收金额",
 | 
											
												
													
														|  | -            prop: "balanceAmount",
 |  | 
 | 
											
												
													
														|  | 
 |  | +            prop: "debitAmount",
 | 
											
												
													
														|  |              disabled: true,
 |  |              disabled: true,
 | 
											
												
													
														|  |              span: 8,
 |  |              span: 8,
 | 
											
												
													
														|  |            },
 |  |            },
 | 
											
										
											
												
													
														|  | @@ -542,6 +549,7 @@ export default {
 | 
											
												
													
														|  |        optionList
 |  |        optionList
 | 
											
												
													
														|  |      );
 |  |      );
 | 
											
												
													
														|  |      if (this.detailData.id) {
 |  |      if (this.detailData.id) {
 | 
											
												
													
														|  | 
 |  | +        this.mebertype = true
 | 
											
												
													
														|  |        this.getDetail(this.detailData.id);
 |  |        this.getDetail(this.detailData.id);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |      if (this.detailData.status == 1) {
 |  |      if (this.detailData.status == 1) {
 | 
											
										
											
												
													
														|  | @@ -575,14 +583,14 @@ export default {
 | 
											
												
													
														|  |                    this.form.thisUsedProfit = 0
 |  |                    this.form.thisUsedProfit = 0
 | 
											
												
													
														|  |                })
 |  |                })
 | 
											
												
													
														|  |            }
 |  |            }
 | 
											
												
													
														|  | -          if (Number(this.form.thisUsedProfit) > Number(this.form.purchaseAmount)) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +          if (Number(this.form.thisUsedProfit) > Number(this.form.orderAmount)) {
 | 
											
												
													
														|  |                this.$nextTick(()=>{
 |  |                this.$nextTick(()=>{
 | 
											
												
													
														|  | -                  this.form.thisUsedProfit = Number(this.form.purchaseAmount)
 |  | 
 | 
											
												
													
														|  | 
 |  | +                  this.form.thisUsedProfit = Number(this.form.orderAmount)
 | 
											
												
													
														|  |                    this.form.memberBalance = 0
 |  |                    this.form.memberBalance = 0
 | 
											
												
													
														|  |                    this.form.currentAmount = 0
 |  |                    this.form.currentAmount = 0
 | 
											
												
													
														|  |                })
 |  |                })
 | 
											
												
													
														|  |            }
 |  |            }
 | 
											
												
													
														|  | -          let sum = Number(this.form.purchaseAmount) - Number(this.form.memberBalance)
 |  | 
 | 
											
												
													
														|  | 
 |  | +          let sum = Number(this.form.orderAmount) - Number(this.form.memberBalance)
 | 
											
												
													
														|  |            if (Number(this.form.thisUsedProfit) > sum){
 |  |            if (Number(this.form.thisUsedProfit) > sum){
 | 
											
												
													
														|  |                this.$nextTick(()=>{
 |  |                this.$nextTick(()=>{
 | 
											
												
													
														|  |                    console.log(this.form.thisUsedProfit)
 |  |                    console.log(this.form.thisUsedProfit)
 | 
											
										
											
												
													
														|  | @@ -594,6 +602,7 @@ export default {
 | 
											
												
													
														|  |            this.$nextTick(()=>{
 |  |            this.$nextTick(()=>{
 | 
											
												
													
														|  |                console.log(sum - this.form.thisUsedProfit)
 |  |                console.log(sum - this.form.thisUsedProfit)
 | 
											
												
													
														|  |                this.form.currentAmount = sum - this.form.thisUsedProfit
 |  |                this.form.currentAmount = sum - this.form.thisUsedProfit
 | 
											
												
													
														|  | 
 |  | +              this.form.debitAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit)
 | 
											
												
													
														|  |            })
 |  |            })
 | 
											
												
													
														|  |        },
 |  |        },
 | 
											
												
													
														|  |        // 会员卡金额的监听
 |  |        // 会员卡金额的监听
 | 
											
										
											
												
													
														|  | @@ -615,7 +624,7 @@ export default {
 | 
											
												
													
														|  |                    this.form.memberBalance = Number(this.balanceAmounts)
 |  |                    this.form.memberBalance = Number(this.balanceAmounts)
 | 
											
												
													
														|  |                })
 |  |                })
 | 
											
												
													
														|  |            }
 |  |            }
 | 
											
												
													
														|  | -          let sum = Number(this.form.purchaseAmount) - Number(this.form.thisUsedProfit)
 |  | 
 | 
											
												
													
														|  | 
 |  | +          let sum = Number(this.form.orderAmount) - Number(this.form.thisUsedProfit)
 | 
											
												
													
														|  |            if (this.form.memberBalance > sum) {
 |  |            if (this.form.memberBalance > sum) {
 | 
											
												
													
														|  |                this.$nextTick(()=>{
 |  |                this.$nextTick(()=>{
 | 
											
												
													
														|  |                    this.form.memberBalance = sum
 |  |                    this.form.memberBalance = sum
 | 
											
										
											
												
													
														|  | @@ -654,14 +663,21 @@ export default {
 | 
											
												
													
														|  |        },
 |  |        },
 | 
											
												
													
														|  |        // 收款弹窗的确认
 |  |        // 收款弹窗的确认
 | 
											
												
													
														|  |        querenfun(){
 |  |        querenfun(){
 | 
											
												
													
														|  | 
 |  | +          if(this.this.form.currentAmount <= 0){
 | 
											
												
													
														|  | 
 |  | +              return this.$message.error('支付金额不能为零和负数');
 | 
											
												
													
														|  | 
 |  | +          }
 | 
											
												
													
														|  | 
 |  | +          let balance = Number(this.form.debitAmount) - Number(this.form.settlmentAmount)
 | 
											
												
													
														|  | 
 |  | +          if(this.this.form.currentAmount > balance){
 | 
											
												
													
														|  | 
 |  | +              return this.$message.error('支付金额不能大于未收金额');
 | 
											
												
													
														|  | 
 |  | +          }
 | 
											
												
													
														|  |            let form = {
 |  |            let form = {
 | 
											
												
													
														|  |                ...this.form,
 |  |                ...this.form,
 | 
											
												
													
														|  |                orderFilesList: this.orderFilesList
 |  |                orderFilesList: this.orderFilesList
 | 
											
												
													
														|  |            }
 |  |            }
 | 
											
												
													
														|  |            collectPayment(form).then(res=>{
 |  |            collectPayment(form).then(res=>{
 | 
											
												
													
														|  |                this.$message.success('收款成功');
 |  |                this.$message.success('收款成功');
 | 
											
												
													
														|  | 
 |  | +              this.paymentVisible = false
 | 
											
												
													
														|  |                this.getDetail(this.detailData.id);
 |  |                this.getDetail(this.detailData.id);
 | 
											
												
													
														|  | -              this.paymentClose = false
 |  | 
 | 
											
												
													
														|  |            })
 |  |            })
 | 
											
												
													
														|  |        },
 |  |        },
 | 
											
												
													
														|  |        // // 付款弹窗的关闭
 |  |        // // 付款弹窗的关闭
 | 
											
										
											
												
													
														|  | @@ -743,14 +759,18 @@ export default {
 | 
											
												
													
														|  |          this.form.orderAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit)
 |  |          this.form.orderAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit)
 | 
											
												
													
														|  |        })
 |  |        })
 | 
											
												
													
														|  |      },
 |  |      },
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      countChange(row) {
 |  |      countChange(row) {
 | 
											
												
													
														|  |        row.amount = multiply(row.price, row.storageInQuantity)
 |  |        row.amount = multiply(row.price, row.storageInQuantity)
 | 
											
												
													
														|  |        row.storageAmount = multiply(row.purchaseAmount, row.storageInQuantity)
 |  |        row.storageAmount = multiply(row.purchaseAmount, row.storageInQuantity)
 | 
											
												
													
														|  |        let val = 0
 |  |        let val = 0
 | 
											
												
													
														|  |        this.data.forEach(e => {
 |  |        this.data.forEach(e => {
 | 
											
												
													
														|  |          val = sum(val, e.amount)
 |  |          val = sum(val, e.amount)
 | 
											
												
													
														|  | 
 |  | +          console.log(val,'val')
 | 
											
												
													
														|  |          this.form.purchaseAmount = val
 |  |          this.form.purchaseAmount = val
 | 
											
												
													
														|  | -        this.form.orderAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit)
 |  | 
 | 
											
												
													
														|  | 
 |  | +          this.form.orderAmount = val
 | 
											
												
													
														|  | 
 |  | +        this.form.debitAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit)
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |        })
 |  |        })
 | 
											
												
													
														|  |        this.$refs.crud.refreshTable();
 |  |        this.$refs.crud.refreshTable();
 | 
											
												
													
														|  |      },
 |  |      },
 | 
											
										
											
												
													
														|  | @@ -894,6 +914,7 @@ export default {
 | 
											
												
													
														|  |                }
 |  |                }
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |            }
 |  |            }
 | 
											
												
													
														|  | 
 |  | +          this.form.currentAmount = 0
 | 
											
												
													
														|  |            this.loadingBtn = true;
 |  |            this.loadingBtn = true;
 | 
											
												
													
														|  |            save({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList, orderFilesList: this.orderFilesList })
 |  |            save({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList, orderFilesList: this.orderFilesList })
 | 
											
												
													
														|  |              .then(res => {
 |  |              .then(res => {
 | 
											
										
											
												
													
														|  | @@ -964,6 +985,7 @@ export default {
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |            }
 |  |            }
 | 
											
												
													
														|  |            this.loadingBtn = true;
 |  |            this.loadingBtn = true;
 | 
											
												
													
														|  | 
 |  | +            this.form.currentAmount = 0
 | 
											
												
													
														|  |            submit({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList, orderFilesList: this.orderFilesList })
 |  |            submit({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList, orderFilesList: this.orderFilesList })
 | 
											
												
													
														|  |              .then(res => {
 |  |              .then(res => {
 | 
											
												
													
														|  |                this.$message.success("提交成功");
 |  |                this.$message.success("提交成功");
 | 
											
										
											
												
													
														|  | @@ -988,6 +1010,7 @@ export default {
 | 
											
												
													
														|  |          type: 'warning'
 |  |          type: 'warning'
 | 
											
												
													
														|  |        }).then(() => {
 |  |        }).then(() => {
 | 
											
												
													
														|  |          this.loadingBtn = true;
 |  |          this.loadingBtn = true;
 | 
											
												
													
														|  | 
 |  | +          this.form.currentAmount = 0
 | 
											
												
													
														|  |          revoke({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList })
 |  |          revoke({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList })
 | 
											
												
													
														|  |            .then(res => {
 |  |            .then(res => {
 | 
											
												
													
														|  |              this.$message.success("撤销成功");
 |  |              this.$message.success("撤销成功");
 |