|  | @@ -24,24 +24,24 @@
 | 
	
		
			
				|  |  |      <div style="margin-top: 50px">
 | 
	
		
			
				|  |  |        <trade-card title="基础信息">
 | 
	
		
			
				|  |  |          <avue-form :option="optionForm" v-model="form" ref="form">
 | 
	
		
			
				|  |  | -            <!--<template slot-scope="scope" slot="corpId">-->
 | 
	
		
			
				|  |  | -            <!--    <el-select v-model="form.corpId" placeholder="请选择">-->
 | 
	
		
			
				|  |  | -            <!--        <el-option-->
 | 
	
		
			
				|  |  | -            <!--            v-for="item in corpIdData"-->
 | 
	
		
			
				|  |  | -            <!--            :key="item.id"-->
 | 
	
		
			
				|  |  | -            <!--            :label="item.cname"-->
 | 
	
		
			
				|  |  | -            <!--            :value="item.id">-->
 | 
	
		
			
				|  |  | -            <!--        </el-option>-->
 | 
	
		
			
				|  |  | -            <!--    </el-select>-->
 | 
	
		
			
				|  |  | -            <!--</template>-->
 | 
	
		
			
				|  |  | -            <!--<template slot-scope="scope" slot="settlementDate">-->
 | 
	
		
			
				|  |  | -            <!--    <el-date-picker-->
 | 
	
		
			
				|  |  | -            <!--        v-model="value1"-->
 | 
	
		
			
				|  |  | -            <!--        type="date"-->
 | 
	
		
			
				|  |  | -            <!--        format="yyyy-MM-dd",-->
 | 
	
		
			
				|  |  | -            <!--        placeholder="选择日期">-->
 | 
	
		
			
				|  |  | -            <!--    </el-date-picker>-->
 | 
	
		
			
				|  |  | -            <!--</template>-->
 | 
	
		
			
				|  |  | +          <!--<template slot-scope="scope" slot="corpId">-->
 | 
	
		
			
				|  |  | +          <!--    <el-select v-model="form.corpId" placeholder="请选择">-->
 | 
	
		
			
				|  |  | +          <!--        <el-option-->
 | 
	
		
			
				|  |  | +          <!--            v-for="item in corpIdData"-->
 | 
	
		
			
				|  |  | +          <!--            :key="item.id"-->
 | 
	
		
			
				|  |  | +          <!--            :label="item.cname"-->
 | 
	
		
			
				|  |  | +          <!--            :value="item.id">-->
 | 
	
		
			
				|  |  | +          <!--        </el-option>-->
 | 
	
		
			
				|  |  | +          <!--    </el-select>-->
 | 
	
		
			
				|  |  | +          <!--</template>-->
 | 
	
		
			
				|  |  | +          <!--<template slot-scope="scope" slot="settlementDate">-->
 | 
	
		
			
				|  |  | +          <!--    <el-date-picker-->
 | 
	
		
			
				|  |  | +          <!--        v-model="value1"-->
 | 
	
		
			
				|  |  | +          <!--        type="date"-->
 | 
	
		
			
				|  |  | +          <!--        format="yyyy-MM-dd",-->
 | 
	
		
			
				|  |  | +          <!--        placeholder="选择日期">-->
 | 
	
		
			
				|  |  | +          <!--    </el-date-picker>-->
 | 
	
		
			
				|  |  | +          <!--</template>-->
 | 
	
		
			
				|  |  |          </avue-form>
 | 
	
		
			
				|  |  |        </trade-card>
 | 
	
		
			
				|  |  |        <trade-card title="明细信息">
 | 
	
	
		
			
				|  | @@ -57,6 +57,16 @@
 | 
	
		
			
				|  |  |              <span style="color: #409EFF;cursor: pointer" @click.stop="viewDocuments(row)">{{ row.contractNumber }}
 | 
	
		
			
				|  |  |              </span>
 | 
	
		
			
				|  |  |            </template>
 | 
	
		
			
				|  |  | +          <template slot-scope="{ row, index }" slot="thisAmount">
 | 
	
		
			
				|  |  | +            <el-input-number size="small" v-model="row.thisAmount" :precision="2" :controls="false"
 | 
	
		
			
				|  |  | +              v-if="row.$cellEdit && row.businesType == 'XS'" @change="thisAmountChange(row)"></el-input-number>
 | 
	
		
			
				|  |  | +            <span v-else>{{ row.thisAmount }}</span>
 | 
	
		
			
				|  |  | +          </template>
 | 
	
		
			
				|  |  | +          <template slot-scope="{ row, index }" slot="thisRefundAmount">
 | 
	
		
			
				|  |  | +            <el-input-number size="small" width="100" v-model="row.thisRefundAmount" :precision="2" :controls="false"
 | 
	
		
			
				|  |  | +              v-if="row.$cellEdit && row.businesType == 'TKXS'" @change="thisReAmountChange(row)"></el-input-number>
 | 
	
		
			
				|  |  | +            <span v-else>{{ row.thisRefundAmount }}</span>
 | 
	
		
			
				|  |  | +          </template>
 | 
	
		
			
				|  |  |            <template slot-scope="{type,size,row,index,disabled}" slot="menu">
 | 
	
		
			
				|  |  |              <el-button :size="size" :disabled="form.financeStatus == '已收款' || isMenu" :type="type"
 | 
	
		
			
				|  |  |                :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'" @click="$refs.formContacts.rowCell(row, index)">{{
 | 
	
	
		
			
				|  | @@ -69,10 +79,10 @@
 | 
	
		
			
				|  |  |          </avue-crud>
 | 
	
		
			
				|  |  |        </trade-card>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        <containerTitle title="上传附件"></containerTitle>
 | 
	
		
			
				|  |  | -        <c-upload v-loading="loadingBtn" typeUpload="LT" :disabled="isMenu"
 | 
	
		
			
				|  |  | -                  deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId" :data="filesList" display
 | 
	
		
			
				|  |  | -                  :enumerationValue="35.1"></c-upload>
 | 
	
		
			
				|  |  | +      <containerTitle title="上传附件"></containerTitle>
 | 
	
		
			
				|  |  | +      <c-upload v-loading="loadingBtn" typeUpload="LT" :disabled="isMenu"
 | 
	
		
			
				|  |  | +        deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId" :data="filesList" display
 | 
	
		
			
				|  |  | +        :enumerationValue="35.1"></c-upload>
 | 
	
		
			
				|  |  |      </div>
 | 
	
		
			
				|  |  |      <el-dialog title="导入订单" v-if="billDetailDialog" append-to-body class="el-dialogDeep" :visible.sync="billDetailDialog"
 | 
	
		
			
				|  |  |        width="80%" :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" top="10vh"
 | 
	
	
		
			
				|  | @@ -88,7 +98,7 @@
 | 
	
		
			
				|  |  |  import billDetail from "@/components/bill/selectOrderDetailList";
 | 
	
		
			
				|  |  |  import { saveSubmit, collectionAndPayment, revokeCollectionAndPayment, detail, removeItems, getFinanceList, remove } from '@/api/accountingManagement/index.js';
 | 
	
		
			
				|  |  |  import { getList } from "@/api/collectionSettlement/index.js";
 | 
	
		
			
				|  |  | -import {skgetKh} from "@/api/tirePartsMall/salesManagement/saleOrder";
 | 
	
		
			
				|  |  | +import { skgetKh } from "@/api/tirePartsMall/salesManagement/saleOrder";
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  export default {
 | 
	
	
		
			
				|  | @@ -98,11 +108,11 @@ export default {
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    data() {
 | 
	
		
			
				|  |  |      return {
 | 
	
		
			
				|  |  | -        // 上传附件的需要参数
 | 
	
		
			
				|  |  | -        loadingBtn:false,
 | 
	
		
			
				|  |  | -        filesList:[],
 | 
	
		
			
				|  |  | +      // 上传附件的需要参数
 | 
	
		
			
				|  |  | +      loadingBtn: false,
 | 
	
		
			
				|  |  | +      filesList: [],
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        corpIdData:[],
 | 
	
		
			
				|  |  | +      corpIdData: [],
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |        // 经办人list
 | 
	
		
			
				|  |  |        financeList: [],
 | 
	
	
		
			
				|  | @@ -187,11 +197,11 @@ export default {
 | 
	
		
			
				|  |  |            format: "yyyy-MM-dd",
 | 
	
		
			
				|  |  |            valueFormat: "yyyy-MM-dd HH:mm:ss",
 | 
	
		
			
				|  |  |            value: '',
 | 
	
		
			
				|  |  | -            rules: [{
 | 
	
		
			
				|  |  | -                required: true,
 | 
	
		
			
				|  |  | -                message: " ",
 | 
	
		
			
				|  |  | -                trigger: "blur"
 | 
	
		
			
				|  |  | -            }]
 | 
	
		
			
				|  |  | +          rules: [{
 | 
	
		
			
				|  |  | +            required: true,
 | 
	
		
			
				|  |  | +            message: " ",
 | 
	
		
			
				|  |  | +            trigger: "blur"
 | 
	
		
			
				|  |  | +          }]
 | 
	
		
			
				|  |  |          }, {
 | 
	
		
			
				|  |  |            label: '单据编号',
 | 
	
		
			
				|  |  |            prop: "sysNo",
 | 
	
	
		
			
				|  | @@ -244,13 +254,16 @@ export default {
 | 
	
		
			
				|  |  |            }, {
 | 
	
		
			
				|  |  |              label: '本次金额',
 | 
	
		
			
				|  |  |              prop: 'thisAmount',
 | 
	
		
			
				|  |  | -            cell: true
 | 
	
		
			
				|  |  | +            width: 140,
 | 
	
		
			
				|  |  | +          }, {
 | 
	
		
			
				|  |  | +            label: '本次退货金额',
 | 
	
		
			
				|  |  | +            prop: 'thisRefundAmount',
 | 
	
		
			
				|  |  | +            width: 140,
 | 
	
		
			
				|  |  |            }, {
 | 
	
		
			
				|  |  |              label: '来源主表id',
 | 
	
		
			
				|  |  |              hide: true,
 | 
	
		
			
				|  |  |              showColumn: false,
 | 
	
		
			
				|  |  |              prop: 'srcParentId',
 | 
	
		
			
				|  |  | -            cell: true
 | 
	
		
			
				|  |  |            }, {
 | 
	
		
			
				|  |  |              label: '来源单据编号',
 | 
	
		
			
				|  |  |              prop: 'srcBillNo',
 | 
	
	
		
			
				|  | @@ -339,24 +352,55 @@ export default {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // 先处理时间在赋值哦 防止数据渲染不上页面
 | 
	
		
			
				|  |  | -      let thisAmountSum = 0
 | 
	
		
			
				|  |  | -      this.optionContacts = await this.getColumnData(this.getColumnName(267.1), this.optionContactsBack);
 | 
	
		
			
				|  |  | -      this.findObject(this.optionContacts.column, "thisAmount").change = ({ value, column }) => {
 | 
	
		
			
				|  |  | -          thisAmountSum = 0
 | 
	
		
			
				|  |  | -          for (let item of this.form.settlementItemsList) {
 | 
	
		
			
				|  |  | -              thisAmountSum += item.thisAmount;
 | 
	
		
			
				|  |  | -          }
 | 
	
		
			
				|  |  | -          this.form.amount = Number(thisAmountSum)
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | +    // let thisAmountSum = 0
 | 
	
		
			
				|  |  | +    this.optionContacts = await this.getColumnData(this.getColumnName(267.1), this.optionContactsBack);
 | 
	
		
			
				|  |  | +    // this.findObject(this.optionContacts.column, "thisAmount").change = ({ value, column }) => {
 | 
	
		
			
				|  |  | +    //   thisAmountSum = 0
 | 
	
		
			
				|  |  | +    //   for (let item of this.form.settlementItemsList) {
 | 
	
		
			
				|  |  | +    //     thisAmountSum += item.thisAmount;
 | 
	
		
			
				|  |  | +    //   }
 | 
	
		
			
				|  |  | +    //   for (let item of this.form.settlementItemsList) {
 | 
	
		
			
				|  |  | +    //     thisAmountSum += item.thisAmount;
 | 
	
		
			
				|  |  | +    //   }
 | 
	
		
			
				|  |  | +    //   this.form.amount = Number(thisAmountSum)
 | 
	
		
			
				|  |  | +    // }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      // 获取客户的数据
 | 
	
		
			
				|  |  | -      skgetKh().then(res=>{
 | 
	
		
			
				|  |  | -        console.log(res,330)
 | 
	
		
			
				|  |  | -          this.corpIdData = res.data.data
 | 
	
		
			
				|  |  | +    skgetKh().then(res => {
 | 
	
		
			
				|  |  | +      console.log(res, 330)
 | 
	
		
			
				|  |  | +      this.corpIdData = res.data.data
 | 
	
		
			
				|  |  |      })
 | 
	
		
			
				|  |  |      // this.corpIdData
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    methods: {
 | 
	
		
			
				|  |  | +    thisAmountChange(row){
 | 
	
		
			
				|  |  | +      let num=Number(row.totalMoney)-Number(row.paymentAmountTl)
 | 
	
		
			
				|  |  | +      if(row.thisAmount>num){
 | 
	
		
			
				|  |  | +        this.$message.error("请正确输入本次金额!");
 | 
	
		
			
				|  |  | +        this.$set(row,'thisAmount',0)
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      let sum1=0
 | 
	
		
			
				|  |  | +      let sum2=0
 | 
	
		
			
				|  |  | +      this.form.settlementItemsList.forEach(e=>{
 | 
	
		
			
				|  |  | +        sum1+=e.thisAmount;
 | 
	
		
			
				|  |  | +        sum2+=e.thisRefundAmount;
 | 
	
		
			
				|  |  | +        this.$set(this.form,'amount',sum1-sum2)
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    thisReAmountChange(row){
 | 
	
		
			
				|  |  | +      let num=Number(row.totalMoney)-Number(row.paymentAmountTl)
 | 
	
		
			
				|  |  | +      if(row.thisRefundAmount>num){
 | 
	
		
			
				|  |  | +        this.$message.error("请正确输入本次金额!");
 | 
	
		
			
				|  |  | +        this.$set(row,'thisRefundAmount',0)
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      let sum1=0
 | 
	
		
			
				|  |  | +      let sum2=0
 | 
	
		
			
				|  |  | +      this.form.settlementItemsList.forEach(e=>{
 | 
	
		
			
				|  |  | +        sum1+=e.thisAmount;
 | 
	
		
			
				|  |  | +        sum2+=e.thisRefundAmount;
 | 
	
		
			
				|  |  | +        this.$set(this.form,'amount',sum1-sum2)
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      rowDelBox(row, index) {
 | 
	
		
			
				|  |  |        this.$confirm("确定将选择数据删除?", {
 | 
	
		
			
				|  |  |          confirmButtonText: "确定",
 | 
	
	
		
			
				|  | @@ -392,7 +436,7 @@ export default {
 | 
	
		
			
				|  |  |        })
 | 
	
		
			
				|  |  |        detail({ id: id }).then(res => {
 | 
	
		
			
				|  |  |          this.form = res.data.data
 | 
	
		
			
				|  |  | -          this.filesList = res.data.data.filesList
 | 
	
		
			
				|  |  | +        this.filesList = res.data.data.filesList
 | 
	
		
			
				|  |  |          // if (res.data.data.financeStatus == '已收款') {
 | 
	
		
			
				|  |  |          //   console.log('已收款');
 | 
	
		
			
				|  |  |          //   this.$set(this.optionForm, 'disabled', true)
 | 
	
	
		
			
				|  | @@ -433,11 +477,17 @@ export default {
 | 
	
		
			
				|  |  |        //     }
 | 
	
		
			
				|  |  |        //   }
 | 
	
		
			
				|  |  |        // }
 | 
	
		
			
				|  |  | +      let sum1=0
 | 
	
		
			
				|  |  | +      let sum2=0
 | 
	
		
			
				|  |  |        list.forEach((item, index) => {
 | 
	
		
			
				|  |  |          item.contractNumber = item.ordNo;
 | 
	
		
			
				|  |  |          item.accountsAmount = item.totalMoney
 | 
	
		
			
				|  |  |          item.settlmentAmount = item.paymentAmountTl
 | 
	
		
			
				|  |  | -        item.thisAmount = (Number(item.totalMoney) - Number(item.paymentAmountTl))
 | 
	
		
			
				|  |  | +        item.businesType=item.bsType
 | 
	
		
			
				|  |  | +        this.$set(item,'thisAmount',item.bsType=="XS"?(Number(item.totalMoney) - Number(item.paymentAmountTl)):0)
 | 
	
		
			
				|  |  | +        this.$set(item,'thisRefundAmount',item.bsType=="TKXS"?(Number(item.totalMoney) - Number(item.paymentAmountTl)):0)
 | 
	
		
			
				|  |  | +        // item.thisAmount =item.bsType=="XS"?(Number(item.totalMoney) - Number(item.paymentAmountTl)):0
 | 
	
		
			
				|  |  | +        // item.thisRefundAmount =item.bsType=="TKXS"? (Number(item.totalMoney) - Number(item.paymentAmountTl)):0
 | 
	
		
			
				|  |  |          item.srcParentId = item.id
 | 
	
		
			
				|  |  |          item.srcBillNo = item.ordNo
 | 
	
		
			
				|  |  |          item.salesCompanyId = item.salesCompanyId
 | 
	
	
		
			
				|  | @@ -445,15 +495,18 @@ export default {
 | 
	
		
			
				|  |  |          item.id = null
 | 
	
		
			
				|  |  |          delete item.ordNo;
 | 
	
		
			
				|  |  |          this.$refs.formContacts.rowCellAdd(item);
 | 
	
		
			
				|  |  | +        //计算主表金额
 | 
	
		
			
				|  |  | +        sum1+=item.bsType=="XS"?(Number(item.totalMoney) - Number(item.paymentAmountTl)):0
 | 
	
		
			
				|  |  | +        sum2+=item.bsType=="TKXS"? (Number(item.totalMoney) - Number(item.paymentAmountTl)):0
 | 
	
		
			
				|  |  | +        this.form.amount=sum1-sum2
 | 
	
		
			
				|  |  |        })
 | 
	
		
			
				|  |  |        //明细列表所有合同号 去重 加, 为主表合同号
 | 
	
		
			
				|  |  |        // this.$set(this.form,'srcOrderno',Array.from(new Set(this.dataList.map(item =>{ return item.srcOrderno}))).join(','))
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |        this.billDetailDialog = false;
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      //保存数据
 | 
	
		
			
				|  |  |      editCustomer() {
 | 
	
		
			
				|  |  | -      console.log(this.form,441)
 | 
	
		
			
				|  |  | +      console.log(this.form, 441)
 | 
	
		
			
				|  |  |        this.$refs["form"].validate((valid, done) => {
 | 
	
		
			
				|  |  |          done()
 | 
	
		
			
				|  |  |          if (valid) {
 | 
	
	
		
			
				|  | @@ -463,7 +516,7 @@ export default {
 | 
	
		
			
				|  |  |              billType: 'SK',
 | 
	
		
			
				|  |  |              corpName: this.form.$corpId,
 | 
	
		
			
				|  |  |              accountName: this.form.$accountId,
 | 
	
		
			
				|  |  | -              filesList:this.filesList
 | 
	
		
			
				|  |  | +            filesList: this.filesList
 | 
	
		
			
				|  |  |            }
 | 
	
		
			
				|  |  |            const loading = this.$loading({
 | 
	
		
			
				|  |  |              lock: true,
 | 
	
	
		
			
				|  | @@ -515,7 +568,7 @@ export default {
 | 
	
		
			
				|  |  |                  corpName: this.form.$corpId
 | 
	
		
			
				|  |  |                }
 | 
	
		
			
				|  |  |                saveSubmit(data).then(res => {
 | 
	
		
			
				|  |  | -                  loading.close()
 | 
	
		
			
				|  |  | +                loading.close()
 | 
	
		
			
				|  |  |                  collectionAndPayment(data).then((res => {
 | 
	
		
			
				|  |  |                    this.refresh(res.data.data.id)
 | 
	
		
			
				|  |  |                    this.$set(this.optionForm, 'disabled', true)
 |