qinbai il y a 3 ans
Parent
commit
f6063dc967

+ 21 - 0
src/components/costBreakdown/costBreakdown.vue

@@ -147,6 +147,19 @@
     methods: {
       changeName(){
         this.$emit('returnBack', this.value)
+        let optionList = this.configuration.dicData.length !== 0?this.dicData.length !== 0?this.dicData:this.configuration.dicData:this.dicData;
+        let selectValue ;
+        optionList.map(item =>{
+          if(item.id === this.value){
+            selectValue = {
+              id : item.id,
+              cname:item.cname,
+              unitno : item.unitno,
+              fcyno:item.fcyno
+            }
+          }
+        })
+        this.$emit('selectValue',selectValue)
       },
       //刷新触发
       refreshChange() {
@@ -170,6 +183,14 @@
           this.dicData.push({id: this.selection[0].id, cname: this.selection[0].cname})
           this.value = this.selection[0].id
         }
+        let selectValue = {
+          id : this.selection[0].id,
+          cname : this.selection[0].cname,
+          unitno :  this.selection[0].unitno,
+          fcyno: this.selection[0].fcyno,
+
+        } ;
+        this.$emit('selectValue',selectValue)
         this.selection = []
         this.$emit('returnBack', this.value)
         this.dialogVisible = false

+ 14 - 9
src/components/fee-info/config/feeInfo.json

@@ -1,4 +1,5 @@
 {
+  "tip": false,
   "addBtn": false,
   "editBtn": false,
   "addRowBtn": false,
@@ -7,22 +8,24 @@
   "delBtn":false,
   "border": true,
   "index": true,
+  "selection": true,
   "refreshBtn": false,
   "menuWidth": 130,
   "align":"center",
   "showSummary": true,
-  "column": [{
+  "column": [
+    {
       "label": "结算单位",
       "prop": "corpId",
       "index": 1,
       "overHidden": true,
-      "width": 150
+      "width": 220
     },
     {
       "label": "费用名称",
       "prop": "feeName",
       "index": 2,
-      "width": 150,
+      "width": 220,
       "overHidden": true
     },
     {
@@ -34,23 +37,25 @@
       "width": 150
     },
     {
-      "label": "计价单位",
-      "prop": "unit",
+      "label": "数量",
+      "prop": "quantity",
       "index": 4,
       "overHidden": true,
       "width": 150
     },
     {
-      "label": "数量",
-      "prop": "quantity",
+      "label": "金额",
+      "prop": "amount",
       "index": 5,
+      "cell": true,
       "overHidden": true,
       "width": 150
     },
     {
-      "label": "金额",
-      "prop": "amount",
+      "label": "计价单位",
+      "prop": "unit",
       "index": 6,
+      "cell": true,
       "overHidden": true,
       "width": 150
     },

+ 216 - 60
src/components/fee-info/main.vue

@@ -12,6 +12,12 @@
         :cell-style="cellStyle"
       >
         <template slot="menuLeft">
+          <el-tabs v-model="activeName" @tab-click="handleClick">
+            <el-tab-pane label="应收" name="first" :key="'first'">
+            </el-tab-pane>
+            <el-tab-pane label="应付" name="second" :key="'second'">
+            </el-tab-pane>
+          </el-tabs>
           <el-button
             type="primary"
             icon="el-icon-plus"
@@ -20,20 +26,34 @@
             :disabled="disabled"
             >新增</el-button
           >
-          <el-button-group>
-            <el-button
-              type="receivableButton"
-              :disabled="selectionList.length == 0"
-              @click="receivable"
-              >应收</el-button
-            >
-            <el-button
-              type="copeWithButton"
-              :disabled="selectionList.length == 0"
-              @click="copeWith"
-              >应付</el-button
-            >
-          </el-button-group>
+          <el-button
+            type="warning"
+            size="small"
+            @click.stop="billingDetails('收费')"
+            :disabled="disabled || selectionList.length == 0"
+            v-if="selectTab === 1"
+          >生成账单</el-button>
+          <el-button
+            type="info"
+            size="small"
+            @click.stop="rowAdd"
+            :disabled="disabled || selectionList.length == 0"
+            v-if="selectTab === 1"
+          >查看生成记录</el-button>
+          <el-button
+            type="warning"
+            size="small"
+            @click.stop="billingDetails('申请')"
+            :disabled="disabled || selectionList.length == 0"
+            v-if="selectTab === 2"
+          >申请货款</el-button>
+          <el-button
+            type="info"
+            size="small"
+            @click.stop="rowAdd"
+            :disabled="disabled || selectionList.length == 0"
+            v-if="selectTab === 2"
+          >查看申请记录</el-button>
         </template>
         <template slot="menu" slot-scope="{ row, index }">
           <el-button
@@ -54,26 +74,28 @@
           >
         </template>
         <template slot="corpId" slot-scope="{ row, index }">
+          <span v-if="row.$cellEdit" class="required_fields">*</span>
           <crop-select
-            v-show="row.$cellEdit"
+            style="width: 90% !important;display: inline-block"
+            v-if="row.$cellEdit"
             v-model="row.corpId"
             :cropIndex="index"
             @getCorpData="getCorpData"
             corpType="KH"
           ></crop-select>
-          <span v-show="!row.$cellEdit">{{ row.corpName }}</span>
+          <span v-else>{{ row.corpName }}</span>
         </template>
         <template slot="feeName" slot-scope="{ row, index }">
-          <el-button
-            size="small"
-            type="text"
-            @click="rePick(row, index)"
-            :disabled="disabled || !row.$cellEdit"
-            class="picker"
-            style="padding:4px 10px;float:left"
-            >选择</el-button
+          <span v-if="row.$cellEdit" class="required_fields">*</span>
+          <breakdown-select
+            style="width: 90% !important;"
+            v-if="row.$cellEdit"
+            v-model="row.itemId"
+            @selectValue="(value) => selectValue(value,row)"
+            :configuration="breakConfiguration"
           >
-          <span> {{ row.feeName }}</span>
+          </breakdown-select>
+          <span v-else>{{ row.feeName }}</span>
         </template>
         <template slot="price" slot-scope="{ row }">
           <el-input
@@ -81,7 +103,7 @@
             v-model="row.price"
             size="small"
             oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
-            @change="priceChange(row)"
+            @change="countChange(row)"
           ></el-input>
           <span v-else>{{ row.price | micrometerFormat }}</span>
         </template>
@@ -91,7 +113,7 @@
             v-model="row.quantity"
             size="small"
             oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
-            @change="quantityChange(row)"
+            @change="countChange(row)"
           ></el-input>
           <span v-else>{{ row.quantity }}</span>
         </template>
@@ -106,9 +128,8 @@
             oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
             @change="rateChange(row)"
             placeholder="请输入"
-            disabled
           ></el-input>
-          <span v-else>{{ row.exchangeRate | isPercentage }}</span>
+          <span v-else>{{ row.exchangeRate }}</span>
         </template>
         <template slot="currency" slot-scope="{ row }">
           <el-select
@@ -187,6 +208,25 @@
       </span>
     </el-dialog>
     <crop-dialog ref="cropDialog" @importCorp="importCorp"></crop-dialog>
+    <el-dialog
+      append-to-body
+      title="账单"
+      class="el-dialogDeep"
+      :visible.sync="applyPaymentDialog"
+      width="70%"
+      :close-on-click-modal="false"
+      :destroy-on-close="true"
+      :close-on-press-escape="false"
+      v-dialog-drag
+    >
+      <apply-payment
+        :billType="billType"
+        :billData="billData"
+        :arrList="arrList"
+        @choceFun="choceFun"
+      >
+      </apply-payment>
+    </el-dialog>
   </div>
 </template>
 
@@ -199,6 +239,8 @@ import { isPercentage, micrometerFormat } from "@/util/validate";
 // import customerDialog from "@/components/customer-dialog/main";
 import cropDialog from "@/components/crop-dialog/main";
 import _ from "lodash";
+import ApplyPayment from "../finance/applyPayment";
+
 export default {
   name: "feeInfo",
   data() {
@@ -245,7 +287,30 @@ export default {
       feeData: [],
       selectionList: [],
       reData: null,
-      currencyList: []
+      billData:{
+        optionType:'JK'
+      },
+      currencyList: [],
+      breakConfiguration:{
+        multipleChoices:false,
+        multiple:false,
+        disabled:false,
+        searchShow:true,
+        collapseTags:false,
+        clearable:true,
+        placeholder:'请点击右边按钮选择',
+        dicData:[]
+      },
+      allData:[],
+      data_one:[],
+      data_two:[],
+      selectTab:1,
+      activeName:"first",
+      tab1:true,
+      tab2:false,
+      applyPaymentDialog:false,
+      billType:'',
+      arrList:[],
     };
   },
   props: {
@@ -277,9 +342,43 @@ export default {
     });
   },
   components: {
-    cropDialog
+    cropDialog,
+    ApplyPayment
   },
   methods: {
+    //选择费用
+    selectValue(value,row){
+      this.$set(row,"feeName",value.cname)
+      this.$set(row,"unit",value.unitno)
+      this.$set(row,"currency",value.fcyno)
+      this.currencyChange(row)
+    },
+    //选择应收应付
+    handleClick(tab){
+      if(tab.name == "first") {
+        this.tab1 = true;
+        this.tab2 = false;
+
+        //将上一个tab页数据放到 对应data上
+        this.data_two = this.feeData
+
+        this.selectTab = 1
+        this.feeData = this.data_one  //切换数据
+        this.selectionList = [];
+        this.arrList = [];
+
+      } else if(tab.name == "second") {
+        this.tab1 = false;
+        this.tab2 = true;
+        if(this.selectTab === 1){
+          this.data_one = this.feeData
+        }
+        this.selectTab = 2
+        this.feeData = this.data_two
+        this.selectionList = [];
+        this.arrList = [];
+      }
+    },
     cellStyle() {
       return "padding:0;height:40px;";
     },
@@ -296,7 +395,8 @@ export default {
         currency: null,
         exchangeRate: null,
         remarks: null,
-        $cellEdit: true
+        $cellEdit: true,
+        feesType:this.selectTab
       });
     },
     currencyChange(row) {
@@ -308,7 +408,6 @@ export default {
       }
     },
     rowDel(row, index) {
-      console.log(row, index);
       this.$confirm("确定删除数据?", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
@@ -335,18 +434,9 @@ export default {
     getCorpData(row) {
       this.feeData[row.index].corpName = row.cname;
     },
-    priceChange(row) {
-      if (!row.price) {
-        row.price = 0;
-      } else {
-        row.amount = _.multiply(row.price, row.quantity).toFixed(2);
-      }
-    },
-    quantityChange(row) {
-      if (!row.quantity) {
-        row.quantity = 0;
-      } else {
-        row.amount = _.multiply(row.price, row.quantity).toFixed(2);
+    countChange(row) {
+      if (row.price && row.quantity) {
+        row.amount = _.multiply(row.quantity, row.price).toFixed(2);
       }
     },
     rateChange(row) {
@@ -466,30 +556,81 @@ export default {
             currency: e.fcyno,
             exchangeRate: null,
             remarks: null,
-            $cellEdit: true
+            $cellEdit: true,
           });
         });
       }
       this.feeDialog = false;
     },
     submitData() {
-      return this.feeData;
-    },
+      this.allData = []
+      //保存时  将所出的tab页数据赋值到相应 data上
+      if(this.selectTab == 1){
+        this.data_one = this.feeData
+      }else{
+        this.data_two = this.feeData
+      }
+
+      this.allData.push(...this.data_one,...this.data_two)
 
-    //应收
-    receivable() {
-      //切换
-      this.receivableButton = "primary";
-      this.copeWithButton = "";
+      return this.allData;
+    },
 
-      this.selectionList;
+    billingDetails(type){
+      //查看是否改动过数据
+      this.$emit("beforeFinance",this.submitData(),(params)=>{
+        if(params.valid){
+          for(let i=0;i<this.selectionList.length;i++){
+            if(this.selectionList[i].corpId != this.selectionList[0].corpId){
+              return this.$message.error('批量操作结算单位必须一致')
+            }
+          }
+          this.billType = type
+          if(type === '申请'){
+             this.selectionList.map(item =>{
+              delete item.id
+              item.corpsName = item.corpName
+              item.srcFeesId = item.id
+              item.costType = item.itemId
+              item.itemType = '采购'
+              item.optionType = 'JK'
+              item.srcType = 2   //费用明细申请
+              let form = {
+                form:{
+                  ...item,
+                }
+              }
+              this.arrList.push(form)
+            })
+          }else{
+            this.selectionList.map(item =>{
+              delete item.id
+              item.corpsName = item.corpName
+              item.srcFeesId = item.id
+              item.costType = item.itemId
+              item.itemType = '采购'
+              item.optionType = 'JK'
+              item.srcType = 2   //费用明细申请
+              let form = {
+                form:{
+                  ...item,
+                }
+              }
+              this.arrList.push(form)
+            })
+          }
+          this.openApplyPayment()
+        }
+      })
     },
-    //应付
-    copeWith() {
-      this.receivableButton = "";
-      this.copeWithButton = "primary";
+    //打开账单
+    openApplyPayment(){
+      this.applyPaymentDialog = true;
     },
+    //关闭账单
+    choceFun(){
 
+    },
     summaryMethod({ columns, data }) {
       const sums = [];
       if (columns.length > 0) {
@@ -529,10 +670,25 @@ export default {
   },
   watch: {
     orderFeesList: function(rows) {
-      this.feeData = rows ? rows : [];
+      this.allData = rows ? rows : [];
+      if(this.allData.length !=0){
+        this.data_one=this.allData.filter(item=>item.feesType === 1)  //应收
+        this.data_two=this.allData.filter(item=>item.feesType === 2)  //应付
+
+        if( this.feeData.length != 0){
+          this.feeData = this.data_one
+        }
+
+      }
     }
   }
 };
 </script>
 
-<style lang="scss" scoped></style>
+<style lang="scss" scoped>
+  .required_fields{
+    color: #F56C6C;
+    display:inline-block;
+    width: 7%
+  }
+</style>

+ 1 - 0
src/views/businessManagement/purchaseOrder/index.vue

@@ -389,6 +389,7 @@ export default {
           form: {
             srcOrderno:item.orderNo,
             itemType:"采购",
+            optionType:"GN",
             corpsName:item.strCorpName,
             corpId:item.corpId,
             srcParentId: item.id,

+ 30 - 7
src/views/purchase/contract/detailsPage.vue

@@ -261,6 +261,7 @@
         <fee-info
           ref="feeInfo"
           :orderFeesList="orderFeesList"
+          @beforeFinance="beforeFinance"
           feeUrl=""
         />
         <upload-file
@@ -810,20 +811,42 @@ export default {
     //     row.amount =_.multiply(row.orderQuantity,row.price).toFixed(2);
     //   }
     // },
+
+    //费用明细回调
+    beforeFinance(feesData,callback){
+      this.orderFeesList = feesData;
+      let params = {}
+      if(contrastObj(this.form,this.oldForm) || contrastList(this.contactsData,this.oldContactsData)
+        || contrastList(this.orderFeesList,this.oldFeesList) || contrastList(this.orderFilesList,this.oldFilesList)
+      ){
+        this.$confirm("数据发生变化,请先提交保存?", {
+          confirmButtonText: "保存",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.editCustomer();
+        }).finally(()=>{
+          params.valid = false
+          callback(params)
+        })
+      }else{
+        params.valid = true
+        params.parentId = this.form.id
+        callback(params)
+      }
+    },
     //修改提交触发
     editCustomer(status) {
       this.$refs["form"].validate((valid) => {
         if (valid) {
           let orderFeesList = this.$refs.feeInfo.submitData();
+          console.log(orderFeesList)
           for (let i = 0; i < orderFeesList.length; i++) {
-            if (orderFeesList[i].corpId == null) {
-              return this.$message.error(`请输入第${i + 1}行的结算中心`);
-            }
-            if (orderFeesList[i].price == 0) {
-              return this.$message.error(`请正确输入第${i + 1}行的价格`);
+            if (orderFeesList[i].corpId === (null || "")) {
+              return this.$message.error(`请输入费用明细第${i + 1}行的结算中心`);
             }
-            if (orderFeesList[i].orderQuantity == 0) {
-              return this.$message.error(`请正确输入第${i + 1}行的数量`);
+            if (orderFeesList[i].itemId === (null || "")) {
+              return this.$message.error(`请输入费用明细第${i + 1}行的费用名称`);
             }
           }
           const orderFilesList = this.$refs.uploadFile.submitData();