Quellcode durchsuchen

feat:开票、结算、付款流程

snow vor 1 Jahr
Ursprung
Commit
c3ef2817b9
28 geänderte Dateien mit 1364 neuen und 1142 gelöschten Zeilen
  1. 4 4
      src/apis/service/customerService/paymentApply/index.js
  2. 4 3
      src/apis/service/platformService/invoice/index.js
  3. 8 5
      src/apis/service/platformService/settlement/index.js
  4. 15 2
      src/components/approval-node/src/credentials.vue
  5. 6 3
      src/components/approval-node/src/uploadInvoice/_template.js
  6. 31 6
      src/components/approval-node/src/uploadInvoice/index.vue
  7. 51 13
      src/components/approval-node/src/uploadInvoice/manuallyUploadModal.vue
  8. 31 3
      src/components/approval-node/src/uploadInvoice/xlsxUploadModal.vue
  9. 1 1
      src/components/manage/src/letter/index.vue
  10. 66 12
      src/views/customerService/invoiceApply/columns.js
  11. 1 1
      src/views/customerService/invoiceApply/components/demandModal.vue
  12. 50 20
      src/views/customerService/invoiceApply/detail.vue
  13. 26 0
      src/views/customerService/invoiceApproval/_static.js
  14. 74 48
      src/views/customerService/invoiceApproval/columns.js
  15. 8 3
      src/views/customerService/invoiceApproval/components/invoice-modal.vue
  16. 292 0
      src/views/customerService/invoiceApproval/components/template.js
  17. 167 217
      src/views/customerService/invoiceApproval/index.vue
  18. 17 19
      src/views/customerService/paymentApply/columns.js
  19. 52 104
      src/views/customerService/paymentApply/detail.vue
  20. 21 47
      src/views/customerService/paymentApply/index.vue
  21. 1 1
      src/views/customerService/workbench/letterEditing.vue
  22. 55 39
      src/views/platformService/invoice/columns.js
  23. 64 326
      src/views/platformService/invoice/components/invoice-modal.vue
  24. 98 94
      src/views/platformService/invoice/index.vue
  25. 50 48
      src/views/platformService/settlement/columns.js
  26. 89 47
      src/views/platformService/settlement/components/waitSupplierUpload.vue
  27. 78 67
      src/views/platformService/settlement/detail.vue
  28. 4 9
      src/views/platformService/settlement/index.vue

+ 4 - 4
src/apis/service/customerService/paymentApply/index.js

@@ -1,17 +1,17 @@
 // 物业管理员
 import http from "@/apis/axios";
-const api = "admin/";
+const api = "admin/orderPay/";
 export default {
   // 详情
-  detail: (data, params) => http(api + "bragaininfo", data, "post", params),
+  detail: (data, params) => http(api + "info", data, "post", params),
   // 更新
   update: (data, params) => http(api + "zxedit", data, "post", params),
   // 修改状态
-  status: (data, params) => http(api + "bragainstatus", data, "post", params),
+  status: (data, params) => http(api + "status", data, "post", params),
   // 分页查询 反馈列表
   feedList: (data, params) => http(api + "consultbidlist", data, "post", params),
  // 分页查询
- list: (data, params) => http(api + "bargainlist", data, "post", params),
+ list: (data, params) => http(api + "list", data, "post", params),
 
 
   // 添加

+ 4 - 3
src/apis/service/platformService/invoice/index.js

@@ -1,13 +1,14 @@
 // 物业管理员
 import http from "@/apis/axios";
-const api = "admin/";
+const api = "admin/invoiceInfo/";
 export default {
+  // 分页查询
+  list: (data, params) => http(api + "list", data, "post", params),
+  batch: (data, params) => http(api + "status", data, "post", params),
   // 添加
   add: (data, params) => http(api + "unitcreate", data, "post", params),
   // 更新
   update: (data, params) => http(api + "unitedit", data, "post", params),
-  // 分页查询
-  list: (data, params) => http(api + "unitlist", data, "post", params),
   // 删除
   delete: (data, params) => http(api + "unitdelete", data, "post", params),
   // 修改状态

+ 8 - 5
src/apis/service/platformService/settlement/index.js

@@ -3,15 +3,18 @@ import http from "@/apis/axios";
 const api = "admin/platformSettel/";
 export default {
   // 详情
-  detail: (data, params) => http(api + "bragaininfo", data, "post", params),
+  detail: (data, params) => http(api + "info", data, "post", params),
+  // 修改状态
+  status: (data, params) => http(api + "status", data, "post", params),
+  // 分页查询
+  list: (data, params) => http(api + "list", data, "post", params),
+  //上传发票
+  upload: (data, params) => http(api + "save", data, "post", params),
+
   // 更新
   update: (data, params) => http(api + "zxedit", data, "post", params),
-  // 修改状态
-  status: (data, params) => http(api + "bragainstatus", data, "post", params),
   // 分页查询 反馈列表
   feedList: (data, params) => http(api + "consultbidlist", data, "post", params),
-  // 分页查询
-  list: (data, params) => http(api + "list", data, "post", params),
 
 
   // 添加

+ 15 - 2
src/components/approval-node/src/credentials.vue

@@ -7,7 +7,7 @@
           :values="ruleForm[amountProp]"
           :placeholder="'付款总金额'"
           :min="0"
-          :max="100"
+          :max="1000000"
           :position="'right'"
           :precision="2"
           :controls="false"
@@ -84,6 +84,19 @@ export default {
     }
   },
   data(){
+
+  const validateAmount = (rule, value, callback) => {
+    if (value === "") {
+      callback(new Error("付款金额不能为空!"));
+    } else {
+      if (Number(value) === 0) {
+        callback(new Error("付款金额不能为0!"));
+      } else {
+        callback()
+      }
+    }
+  };
+
     return {
       ruleForm:{
         [this.imageProp]:[],
@@ -101,7 +114,7 @@ export default {
           {
             required:true,
             trigger:'change',
-            message:'请输入总金额'
+            validator:validateAmount
           }
         ]
       }

+ 6 - 3
src/components/approval-node/src/uploadInvoice/_template.js

@@ -123,7 +123,7 @@ export const columns = [
         prop: mapFields["beforeTax"],
         label: '税前金额',
         width: '150px',
-        required: false
+        required: true
     },
     {
         prop: mapFields["checkNumber"],
@@ -151,7 +151,9 @@ export const requsetFields = [
     mapFields.invoiceCode,
     mapFields.invoiceType,
     mapFields.afterTax,
-    mapFields.openTime
+    mapFields.beforeTax,
+    mapFields.openTime,
+    mapFields.checkNumber
 ]
 
 export const requiredFields = [
@@ -159,7 +161,8 @@ export const requiredFields = [
     mapFields.invoiceCode,
     mapFields.invoiceType,
     mapFields.afterTax,
-    mapFields.openTime
+    mapFields.beforeTax,
+    mapFields.openTime,
 ]
 
 export const numberFields = []

+ 31 - 6
src/components/approval-node/src/uploadInvoice/index.vue

@@ -22,12 +22,13 @@
         <template #header>
           <div style="display:flex;justify-content:space-between;">
             <span>操作</span>
-            <el-button size="mini" type="text" @click="manuallyVisible = true">添加</el-button>
+            <el-button size="mini" type="text" @click="onCreateItem">添加</el-button>
           </div>
         </template>
 
         <template slot-scope="scope">
           <el-button @click="deleteItem(scope.$index)" size="mini" type="text">删除</el-button>
+          <el-button @click="onUpdateItem(scope.$index)" size="mini" type="text">编辑</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -36,7 +37,12 @@
       <el-button size="mini" type="primary" @click="onSave">保存</el-button>
     </div>
 
-    <manually-upload-modal :visible.sync="manuallyVisible" @change="handleModalChange" />
+    <manually-upload-modal 
+      :visible.sync="manuallyVisible"
+      :updateItem="updateItem"
+      :updateIndex="updateIndex"
+      @change="handleModalChange" 
+    />
     <excel-upload-modal :visible.sync="xlsxVisible" @change="handleUploadChange" />
   </div>
 </template>
@@ -76,18 +82,37 @@ export default {
       manuallyVisible: false,
       xlsxVisible: false,
       loading: false,
-      list: []
+      list: [],
+      updateIndex: -1,
+      updateItem:null
     }
   },
   methods:{
+    onCreateItem(){
+      this.updateIndex = -1
+      this.updateItem = null
+      this.manuallyVisible = true
+    },
+    onUpdateItem(index){
+      this.updateIndex = index
+      this.updateItem = this.list[index]
+      this.manuallyVisible = true
+    },
     deleteItem(index){
       this.list.splice(index, 1)
     },
     handleUploadChange(list){
-      this.list = [...list]
+      this.list = [...this.list,...list]
     },
-    handleModalChange(item){
-      this.list.push(item)
+    handleModalChange({data,index}){
+      if(index === -1){
+        this.list.push(data)
+        return
+      }
+
+      this.$set(this.list,index,{
+        ...data
+      })
     },
     async onSave(){
       this.loading = true

+ 51 - 13
src/components/approval-node/src/uploadInvoice/manuallyUploadModal.vue

@@ -1,5 +1,5 @@
 <template>
-  <el-dialog :visible="innerVisible" title="上传发票" align="center" @close="handleClose" :close-on-click-modal="false">
+  <el-dialog :visible="innerVisible" :title="title" align="center" @close="handleClose" :close-on-click-modal="false">
     <el-form :rules="rules" :model="ruleForm" ref="ruleForm"  label-width="90px" size="mini">
       <el-form-item label="扫码枪">
         <el-input v-model="scanValue" type="textarea" placeholder="请在扫码完成后手动回车" @keyup.native.enter="handleEnterParse" />
@@ -25,7 +25,12 @@
         <el-input v-model="ruleForm[mapFields.checkNumber]"  placeholder="校验码" />
       </el-form-item>
       <el-form-item label="开票日期" :prop="mapFields.openTime">
-        <el-date-picker v-model="ruleForm[mapFields.openTime]"  value-format="yyyy-MM-dd HH:mm:ss" style="width:100%" placeholder="开票日期" />
+        <el-date-picker 
+          v-model="ruleForm[mapFields.openTime]"  
+          value-format="yyyy-MM-dd" 
+          style="width:100%" 
+          placeholder="开票日期" 
+        />
       </el-form-item>
 
       <el-form-item style="display:flex;justify-content:flex-end">
@@ -55,27 +60,32 @@ import { invoiceTypeList } from '@/assets/js/statusList'
 */
 
 export default {
-  props:['visible'],
+  props:['visible','updateItem','updateIndex'],
   computed:{
     isAllelectric(){
       const invoiceType = this.ruleForm[mapFields.invoiceType]
       const allelectries = ['5','6']
       return allelectries.includes(invoiceType)
     },
-    isSpecialTicket(){
+    isNormalTicket(){
       const invoiceType = this.ruleForm[mapFields.invoiceType]
-      const specialTickets = ['2','4']
+      const specialTickets = ['1','3']
       return specialTickets.includes(invoiceType)
     },
+    title(){
+      const base = '发票'
+      console.log(this.updateItem)
+      const prefix = this.updateItem ? '编辑' : '上传'
+      return `${prefix}${base}`
+    },
     rules(){
-      const isSpecialTicket = this.isSpecialTicket
-
+      const isNormalTicket = this.isNormalTicket
       return {
         ...manuallyUploadRules,
         [mapFields.checkNumber]:[{
           ...manuallyUploadRules[mapFields.checkNumber][0],
-          //非专票必填校验码
-          required:!isSpecialTicket
+          //票必填校验码
+          required:isNormalTicket
         }]
       }
     },
@@ -88,6 +98,15 @@ export default {
       }
     }
   },
+  watch:{
+    visible:{
+      handler(visible){
+        if(!visible) return
+        this.$nextTick(() => this.initData())
+      },
+      immediate:true
+    }
+  },
   data(){
     return {
       scanValue:"",
@@ -106,7 +125,6 @@ export default {
   methods:{
     handleClose(){
       this.innerVisible = false
-
       this.ruleForm = {
         [mapFields.invoiceType]:"",
         [mapFields.invoiceCode]:"",
@@ -139,11 +157,17 @@ export default {
         const day = open_time.slice(6);
         _open_time = dayjs(`${year}-${month}-${day}`).format("YYYY-MM-DD HH:mm:ss");
       }
+
+      // 1,01,3,4,5,6,7,8,9
+
+      const invoice = invoiceTypeList.find(({scanValue}) => scanValue === String(invoiceType))
       
+
+      console.log(invoice)
       this.scanValue = ""
-      const { invoice } = mapPropertys
+      // const { invoice } = mapPropertys
       this.ruleForm = {
-        [mapFields.invoiceType]:invoiceType,
+        [mapFields.invoiceType]:invoice ? invoice.value : "",
         [mapFields.invoiceCode]:invCode,
         [mapFields.beforeTax]:subtotal_amount,
         [mapFields.openTime]: _open_time,
@@ -151,10 +175,24 @@ export default {
         [mapFields.checkNumber]:checkNumber
       }
     },
+    initData(){
+      const data = this.updateItem ? JSON.parse(JSON.stringify(this.updateItem)) :{
+        [mapFields.invoiceType]:"",
+        [mapFields.invoiceCode]:"",
+        [mapFields.beforeTax]:"",
+        [mapFields.openTime]: "",
+        [mapFields.invoiceNumber]:"",
+        [mapFields.checkNumber]:""
+      }
+      this.ruleForm = data
+    },
     async onSubmit(){
       try{
         await this.$refs.ruleForm.validate()
-        this.$emit("change",this.ruleForm)
+        this.$emit("change",{
+          data:this.ruleForm,
+          index:this.updateIndex
+        })
         this.handleClose()
         // thiis
       }catch(err){

+ 31 - 3
src/components/approval-node/src/uploadInvoice/xlsxUploadModal.vue

@@ -26,7 +26,7 @@
 
 <script>
 import companyHelper from '@/mixins/companyHelper'
-import { MessageBox } from 'element-ui'
+// import { MessageBox } from 'element-ui'
 
 import {
   columns,
@@ -37,6 +37,7 @@ import {
   mapFields,
 } from './_template'
 import { invoiceTypeList } from '@/assets/js/statusList'
+import dayjs from 'dayjs'
 
 export default {
   mixins: [companyHelper],
@@ -87,26 +88,52 @@ export default {
         const tableItem = this.tableData[index]
         const properties = Object.keys(tableItem)
         for (const property of properties) {
+          //必填字段非空校验
           if(requiredFields.includes(property) && !this.isValueNotNull(tableItem[property])){
             this.$message.warning(`第 ${line} 行 : ${getColumn(property).label} 不能为空`)
             return false
           }
 
+          //转入的日期格式
+          if(property === mapFields.openTime && !Number.isNaN(Number(tableItem[property]))){
+            this.tableData[index][property] = this.formatDate(tableItem[property])
+          }
+
+          //发票相关校验
           if(property === mapFields.invoiceType){
             const invoiceType = invoiceTypeList.find(({label}) => label === tableItem[property])
-
+            
+            //类型校验
             if(!invoiceType){
               this.$message.warning(`第 ${line} 行 : ${getColumn(property).label} 必须为 ${invoiceTypeList.map(({label}) => label).join('、')}`)
               return false
             }
 
-            // this.tableData[index][property] = invoiceType.value
+            //普通发票校验验证码
+            if(["1","3"].includes(invoiceType.value) && tableItem[mapFields.checkNumber] === ""){
+              this.$message.warning(`第 ${line} 行 : 发票类型为普通发票时必须上传校验码`)
+              return false
+            }
+
+            console.log(invoiceType.value)
           }
         }
       }
 
       return true
     },
+    formatDate (timeNum) {
+      const time = new Date(((Number(timeNum) - 70 * 365 - 19) * 24 * 3600 - 8 * 3600 - 42.5) * 1000)
+      const year = time.getFullYear()
+      const month = time.getMonth() + 1
+      const date = time.getDate() + 1
+      const dateArr = [
+          year,
+          (month < 10 ? '0' + month : month),
+          (date < 10 ? '0' + date : date),
+      ]
+      return `${dateArr.join('-')}`
+    },
     isValueNotNull(value){
       if(!value) return
       const _value = String(value)
@@ -151,6 +178,7 @@ export default {
 
       const list = this.tableData.map(tableItem => requsetFields.reduce((prev, currentKey) => {
         let data = tableItem[currentKey]
+
         if(currentKey === mapFields.invoiceType){
           const invoiceType = invoiceTypeList.find(({label}) => label === tableItem[currentKey])
           data = invoiceType.value

+ 1 - 1
src/components/manage/src/letter/index.vue

@@ -42,7 +42,7 @@
       </template>
 
       <template #action="{ scope }">
-        <!-- type === 'budget' && -->
+        <!-- <el-button size="mini" type="text">发布</el-button> -->
         <el-button 
           v-if="(Number(scope.row.is_check) !== mapCheck[type].ok)" type="text" 
           size="mini" 

+ 66 - 12
src/views/customerService/invoiceApply/columns.js

@@ -7,13 +7,6 @@ const statusList = [
   { id: '5', label: '开票申请完成', type: 'success' }
   // 已选完商品,取消议价
 ]
-const demandColumns = [
-  {
-    prop: 'TODO',
-    label: 'TODO',
-    span: 24
-  },
-]
 
 const listCol = [
   {
@@ -59,16 +52,16 @@ const listCol = [
     prop: 'status',
     label: '状态',
     _slot_:'status',
-    'min-width': '125'
+    'min-width': '160px'
   },
   {
-    prop: 'TODO',
+    prop: 'ainv_fee',
     label: '已开票金额',
     minWidth: '150px'
   },
 
   {
-    prop: 'TODO',
+    prop: 'winv_fee',
     label: '未开票金额',
     'width': '120px'
   },
@@ -82,8 +75,69 @@ const listCol = [
   }
 ]
 
+const invoiceApplyColumns = [
+  {
+    prop: 'invNo',
+    label: '发票申请编号',
+    span: 8
+  },
+  {
+    prop:'companyName',
+    label:'客户公司',
+    _slot_:'company',
+    span: 8
+  },
+  {
+    prop:'invoice_title',
+    label:'发票抬头',
+    span: 8
+  },
+  {
+    prop:'invoice_type',
+    label:'发票类型',
+    span: 8,
+    _slot_:'invoice_type'
+  },
+  {
+    prop:'status',
+    label:'状态',
+    span:8,
+    _slot_:'status'
+  },
+  {
+    prop:'creater',
+    label:'创建人',
+    span: 8
+  },
+  {
+    prop:'winv_fee',
+    label:'未开票金额',
+    span: 6
+  },
+  {
+    prop:'ainv_fee',
+    label:'已开票金额',
+    span: 6
+  },
+  {
+    prop:'wpay_amount',
+    label:'未回款金额',
+    span: 6
+  },
+  {
+    prop:'apay_amount',
+    label:'已回款金额',
+    span: 6
+  },
+  {
+    prop:'remark',
+    label:'备注',
+    span: 24
+  }
+]
+
 export {
   listCol, 
-  demandColumns,
-  statusList,
+  invoiceApplyColumns,
+  statusList
 }

+ 1 - 1
src/views/customerService/invoiceApply/components/demandModal.vue

@@ -52,7 +52,7 @@
 
 <script>
 import pageInfo from "@/mixins/elPaginationHandle"
-import asyncRequest from "@/apis/service/customerService/invoiceApply";
+import asyncRequest from "@/apis/service/customerService/demandOrder";
 import { demandStatusOptions } from '@/assets/js/statusList'
 import { columns } from "./_columns"
 export default {

+ 50 - 20
src/views/customerService/invoiceApply/detail.vue

@@ -9,15 +9,44 @@
             </el-collapse-item>
 
             <template v-else>
-              <el-collapse-item title="需求订单详情" name="3">
-                <demand-detail id="2" />
+              <el-collapse-item title="开票申请详情" name="4">
+                <show-data-table
+                  style="margin-bottom:10px"
+                  :newTime="newTime"
+                  :sitem="sitem"
+                  :columns="invoiceApplyColumns"
+                >
+                  <template #company>
+                    <div style="display:flex">
+                      <p style="margin-right:5px">{{sitem.companyName}}</p>
+
+                      <el-tooltip :content="'客户公司编号 : ' + sitem.companyNo" placement="top">
+                        <i class="el-icon-warning-outline" />
+                      </el-tooltip>
+                    </div>
+                  </template>
+
+                  <template #status>
+                    <el-tag
+                      :size="tablebtnSize"
+                      :type="(statusList.find((item) => item.id == sitem.status) || {}).type || ''"
+                      v-text="(statusList.find((item) => item.id == sitem.status) || {}).label || '--'"
+                    ></el-tag>
+                  </template>
+
+                  <template #invoice_type>
+                    <el-tag size="mini">
+                      {{(invoiceTypeList.find(({value}) => value === String(sitem.invoice_type)) || {}).label || '--'}}
+                    </el-tag>
+                  </template>
+                </show-data-table>
               </el-collapse-item>
 
-              <el-collapse-item title="开票申请详情" name="4">
-                TODO发票详情...
+              <el-collapse-item title="需求订单详情" name="3">
+                <demand-detail id="2" />
               </el-collapse-item>
               
-              <el-collapse-item title="发票申请管理" name="5">
+              <el-collapse-item title="发票申请管理" name="5" v-if="Number(sitem.status) === 2">
                 <upload-invoice-node :requestMethod="handleInvoiceUpload" />
               </el-collapse-item>
             </template>
@@ -33,10 +62,9 @@ import demandRequest from "@/apis/service/customerService/demandOrder";
 import resToken from "@/mixins/resToken";
 import { mapGetters } from "vuex";
 
-import { demandDetailColumns } from '../demandOrder/columns';
 import CreateInvoiceApply from "./components/createInvoiceApply.vue"
-import { demandColumns, statusList,} from "./columns";
-
+import { demandColumns, statusList, invoiceApplyColumns} from "./columns";
+import { invoiceTypeList } from '@/assets/js/statusList';
 
 export default {
   name: "invoiceApplyDetail",
@@ -63,11 +91,13 @@ export default {
 
   data() {
     return {
+      invoiceTypeList,
       size: "small",
       eaxmList: [],
       demandColumns,
       statusList,
       projectTabs: "1",
+      invoiceApplyColumns,
       activeNames: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "20"],
       newTime: "",
       loading: false,
@@ -111,18 +141,11 @@ export default {
         id: this.$route.query.id
       })
 
-      if(invoice.code !== 1) {
-        this.loading = false
-        return
-      }
-
-      this.sitem = invoice.data
-
       this.loading = false
-
-      const demand = await demandRequest.detail({
-        reqCode:invoice.reqCode
-      })
+      if(invoice.code !== 1) return
+      
+      this.sitem = invoice.data
+      this.getNewTime()
     },
 
     getNewTime() {
@@ -134,7 +157,14 @@ export default {
         invoiceList,
         id:this.sitem.id
       }
-      return asyncRequest.upload(params)
+
+      const result = await asyncRequest.upload(params)
+      
+      if(result.code === 1){
+        this.initForm()
+      }
+
+      return result
     },
 
     async statusSubmit(model, title) {

+ 26 - 0
src/views/customerService/invoiceApproval/_static.js

@@ -0,0 +1,26 @@
+const search = {
+    //创建时间开始结束
+    createStart:'create_start',
+    createEnd:'create_end',
+    //供应商企业
+    supplier:'supplier',
+    //需求订单编号
+    demandOrderNo:'demandOrderNo',
+    //发票状态
+    invoiceStatus:'invoiceStatus',
+    //开票日期开始结束
+    openStart:'openStart',
+    openEnd:'openEnd',
+    //发票代码
+    invoiceCode:'invCode',
+    //发票号码
+    invoiceNumber:'invNum',
+    //发票类型
+    invoiceType:'invoiceType',
+    invoiceApplyNo:'invoiceApplyNo'
+}
+
+export const mapPropertys = {
+    //搜索表单
+    search
+}

+ 74 - 48
src/views/customerService/invoiceApproval/columns.js

@@ -1,87 +1,113 @@
 
 const statusList = [
-  { id: '0', label: '待业务主管审核', type: '' },
-  { id: '1', label: '业务主管已通过', type: 'success' },
-  { id: '2', label: '业务主管已驳回', type: 'danger' },
-  { id: '3', label: '业务主管越线通过', type: 'warning' },
-  { id: '4', label: '取消议价', type: 'info' }
-  // 已选完商品,取消议价
+  { id: '0', label: '驳回', type: 'danger' },
+  { id: '1', label: '待确认', type: 'info' },
+  { id: '2', label: '确认', type: 'success' },
 ]
+
 const listCol = [
-  {
+    {
     type:'selection',
+    fixed:'left'
   },
   {
-    prop: 'todo',
+    prop: 'inv_code',
     label: '开票申请编号',
-    width: '155'
+    width: '110px'
   },
 
   {
-    prop: 'todo',
-    label: '开票申请发票类型',
-    width: '155'
-  },
 
-  {
-    prop: 'todo',
-    label: '需求订单编号',
-    width: '120px'
-  },
-  {
-    prop: 'todo',
-    label: '需求公司',
-    width: '155'
+    prop:'status',
+    label:'状态',
+    _slot_:'status',
+    width: '75px'
   },
 
   {
-    prop: 'todo',
-    label: '发票记录编号',
-    width: '155px'
+    prop: 'invoiceType',
+    label: '开票申请发票类型',
+    width: '125px',
+    _slot_:'invoiceType'
+    // reuqired:true
   },
+
   {
-    prop: 'todo',
-    label: '发票状态',
-    width: '155px'
+    prop: 'demandOrder',
+    label: '需求订单编号',
+    width: '180px',
+    _slot_:'demandOrder'
   },
+  // {
+  //   prop: 'todo',
+  //   label: '供应商企业',
+  //   width: '155',
+  //   required:true
+  // },
+
+  // {
+  //   prop: 'todo',
+  //   label: '发票记录编号',
+  //   width: '155px',
+  //   required:true
+  // },
+  // {
+  //   prop: 'todo',
+  //   label: '发票状态',
+  //   width: '155px',
+  //   required:true
+  // },
   {
-    prop: "todo",
-    label: "发票类型",
-    width: '155px'
+    prop: 'invoiceType',
+    label: '发票类型',
+    'width': '125px',
+    _slot_:'invoiceType'
   },
   {
-    prop: 'todo',
+    prop: 'invoiceCode',
     label: '发票代码',
-    'min-width': '180'
+    'min-width': '125'
   },
   {
-    prop: 'todo',
+    prop: 'invoiceNum',
     label: '发票号码',
-    'min-width': '125'
+    minWidth: '150px'
   },
+
   {
-    prop: "todo",
-    label: "开票日期",
-    width: 110,
+    prop: 'open_date',
+    label: '开票日期',
+    minWidth: '110px'
   },
   {
-    prop: 'todo',
-    label: '税前金额',
-    minWidth: '150px'
+    prop: 'subtotal_tax',
+    label: '税前金额'
+  },
+  {
+    prop: 'total_amount',
+    label: '税后金额'
   },
   {
-    prop: 'todo',
-    label: '税后金额',
-    'width': '120px'
+    prop:'check_code',
+    label:'校验码',
+    width:'125px'
   },
   {
-    prop: 'todo',
-    label: '驳回原因',
-    'width': '120px'
+    prop:'todo',
+    label:'驳回原因',
+    required:true
   },
+  // {
+  //   prop: '',
+  //   label: '操作',
+  //   fixed: 'right',
+  //   _noset_: true,
+  //   _slot_: 'operation',
+  //   width: 50
+  // }
 ]
 
 export {
   listCol,
-  statusList,
+  statusList
 }

+ 8 - 3
src/views/customerService/invoiceApproval/components/approvalModal.vue → src/views/customerService/invoiceApproval/components/invoice-modal.vue

@@ -3,7 +3,7 @@
     <el-form ref="form" :model="formData" size="mini" :rules="rules" label-width="80px">
       <el-form-item prop="status" label="审批状态">
         <el-select v-model="formData.status" style="width: 100%" placeholder="审批状态">
-          <el-option label="通过" value="1" />
+          <el-option label="通过" value="2" />
           <el-option label="驳回" value="0" />
         </el-select>
       </el-form-item>
@@ -13,7 +13,7 @@
       </el-form-item>
 
       <ElFormItem class="flex-end">
-        <ElButton type="primary" @click="onSubmit">保存</ElButton>
+        <ElButton type="primary" @click="onSubmit" :loading="loading">保存</ElButton>
       </ElFormItem>
     </el-form>
   </el-dialog>
@@ -65,11 +65,16 @@ export default {
     handleClose(){
       this._visible = false
       this.formData = {...defaultData}
+      this.loading = false
     },
     async onSubmit(){
       try{
         await this.$refs.form.validate()
-        this.$emit("confirm",this.formData)
+        this.loading = true
+        this.$emit("confirm",{
+          ...this.formData,
+          inv_type: '1',
+        })
       }catch (e) {
         console.log(e)
       }

+ 292 - 0
src/views/customerService/invoiceApproval/components/template.js

@@ -0,0 +1,292 @@
+const mapTemplateToTable = {
+  '发票申请编码': 'platform_id',
+  '发票类型': 'supplierNo',
+  '发票代码': 'companyNo',
+  '发票号码': 'customerNo',
+  '价税合计': 'cat_id1',
+  '发票金额': 'cat_id2',
+  '校验码': 'cat_id',
+  '开票日期': 'good_unit'
+}
+
+export const getTableProperty = (key) => mapTemplateToTable[key]
+export const PROPERTYS = {
+  COMPANY_NO: getTableProperty('销售方公司编码'),
+  CUSTOMER_NO: getTableProperty('购买方公司编码'),
+  SUPPLIER_NO: getTableProperty('供应商公司编码'),
+  PLATFORM: getTableProperty('所属平台ID'),
+  CATEGORY: getTableProperty('三级品类ID'),
+  GOOD_NAME: getTableProperty('商品名称'),
+  GOOD_UNIT: getTableProperty('商品单位ID'),
+  GOOD_NUM: getTableProperty('数量'),
+  GOOD_PRICE: getTableProperty('销售单价'),
+  TAX: getTableProperty('税率'),
+  CGD_PRICE: getTableProperty('采购单价'),
+  CGD_TAX: getTableProperty('采购毛利率'),
+  SALE_TOTAL: getTableProperty('销售总额'),
+  CONTACTOR: getTableProperty('收货人'),
+  MOBILE: getTableProperty('联系电话'),
+  ADDR: getTableProperty('联系地址'),
+  SEND_TIME: getTableProperty('发货时间'),
+  PO_CODE: getTableProperty('平台订单号'),
+  CGD_TOTAL: getTableProperty('采购总额'),
+  WORK_CODE: getTableProperty('单据号')
+}
+
+export const template = Array(1).fill(1).map(() => ({
+  '所属平台ID': '58',
+  '供应商公司编码': 'QS2206011407522117',
+  '销售方公司编码': 'GS2302231323386950',
+  '购买方公司编码': 'KH2203271822232121',
+  '一级品类ID': '871',
+  '二级品类ID': '871',
+  '三级品类ID': '871',
+  '商品单位ID': '7',
+  '商品名称': '测试商品名称',
+  '销售单价': '32',
+  '数量': '100',
+  '销售总额': '3200',
+  '税率': '13',
+  '采购单价': '30.00',
+  '采购总额': '3000',
+  '采购毛利率': '6',
+  '平台订单号': 'PO206020230400240002',
+  '收货人': '张三',
+  '联系电话': '19955554444',
+  '联系地址': 'xx市xx区xx街道',
+  '发货时间': '2023-4-9 8:00:00'
+}))
+
+export const columns = [
+  {
+    type: 'index',
+    label: '序号',
+    width: '80px'
+  },
+  {
+    prop: PROPERTYS.PLATFORM,
+    label: '所属平台ID',
+    width: '110px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.SUPPLIER_NO,
+    label: '供应商公司编码',
+    width: '120px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.COMPANY_NO,
+    label: '销售方公司编码',
+    width: '156px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.CUSTOMER_NO,
+    label: '购买方公司编码',
+    width: '180px',
+    required: true
+  },
+
+  {
+    prop: getTableProperty('一级品类ID'),
+    label: '一级品类ID',
+    width: '150px',
+    required: true
+  },
+  {
+    prop: getTableProperty('二级品类ID'),
+    label: '二级品类ID',
+    width: '150px',
+    required: true
+  },
+  {
+    prop: getTableProperty('三级品类ID'),
+    label: '三级品类ID',
+    width: '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.GOOD_UNIT,
+    label: '商品单位ID',
+    width: '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.GOOD_NAME,
+    label: '商品名称',
+    width: '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.GOOD_PRICE,
+    label: '销售单价',
+    'width': '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.GOOD_NUM,
+    label: '数量',
+    width: '140px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.SALE_TOTAL,
+    label: '销售总额',
+    'width': '150px'
+  },
+  {
+    prop: PROPERTYS.TAX,
+    label: '税率',
+    width: '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.CGD_PRICE,
+    label: '采购单价',
+    'width': '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.CGD_TOTAL,
+    label: '采购总额',
+    'width': '150px',
+    required: true
+  },
+  {
+    prop: getTableProperty('采购毛利率'),
+    label: '采购毛利率',
+    'width': '150px'
+  },
+  {
+    prop: PROPERTYS.PO_CODE,
+    label: '平台订单号',
+    'width': '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.CONTACTOR,
+    label: '收货人',
+    'width': '150px',
+    required: true
+  },
+  // {
+  //   prop: PROPERTYS.WORK_CODE,
+  //   label: '单据号',
+  //   'width': '150px'
+  // },
+  {
+    prop: PROPERTYS.MOBILE,
+    label: '联系电话',
+    'width': '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.ADDR,
+    label: '联系地址',
+    'width': '150px',
+    required: true
+  },
+  {
+    prop: PROPERTYS.SEND_TIME,
+    label: '发货时间',
+    'width': '150px',
+    required: true
+  }
+]
+
+export function createErrorMessage(messages) {
+  const rows = Object.keys(messages)
+  return [rows[0]].reduce((prev, row, index) => {
+    console.log(messages[row])
+    const suffix = index === rows.length - 1 ? '</ul>' : ''
+    const content = prev + `
+      <li>
+        <strong style="font-weight:700">第${row}行</strong>,${messages[row][0]}
+      </li>
+    `
+    return content + suffix
+  }, '<ul>')
+}
+
+export const createFieldVerification = (message) => ({
+  notValidRows: [],
+  isValid: true,
+  message
+})
+
+export const requsetFields = [
+  PROPERTYS.TAX,
+  PROPERTYS.ADDR,
+  PROPERTYS.MOBILE,
+  PROPERTYS.PO_CODE,
+  PROPERTYS.PLATFORM,
+  PROPERTYS.CATEGORY,
+  PROPERTYS.GOOD_NAME,
+  PROPERTYS.GOOD_UNIT,
+  PROPERTYS.GOOD_NUM,
+  PROPERTYS.CGD_PRICE,
+  PROPERTYS.CONTACTOR,
+  PROPERTYS.SEND_TIME,
+  PROPERTYS.WORK_CODE,
+  PROPERTYS.GOOD_PRICE,
+  PROPERTYS.COMPANY_NO,
+  PROPERTYS.SUPPLIER_NO,
+  PROPERTYS.CUSTOMER_NO,
+  PROPERTYS.CGD_TAX,
+  PROPERTYS.SALE_TOTAL,
+  PROPERTYS.CGD_TOTAL
+]
+
+// 税率、数量、销售单价、采购单价
+export const requiredFields = [
+  PROPERTYS.TAX,
+  PROPERTYS.ADDR,
+  PROPERTYS.MOBILE,
+  PROPERTYS.PO_CODE,
+  PROPERTYS.PLATFORM,
+  PROPERTYS.CATEGORY,
+  PROPERTYS.GOOD_NAME,
+  PROPERTYS.GOOD_UNIT,
+  PROPERTYS.GOOD_NUM,
+  PROPERTYS.CONTACTOR,
+  PROPERTYS.SEND_TIME,
+  PROPERTYS.COMPANY_NO,
+  PROPERTYS.SUPPLIER_NO,
+  PROPERTYS.CUSTOMER_NO,
+  PROPERTYS.CGD_TOTAL,
+  PROPERTYS.SALE_TOTAL,
+  PROPERTYS.CGD_TAX
+]
+
+export const numberFields = [
+  PROPERTYS.CGD_TOTAL,
+  PROPERTYS.SALE_TOTAL,
+  PROPERTYS.GOOD_PRICE,
+  PROPERTYS.CGD_PRICE,
+  PROPERTYS.CGD_TAX
+]
+
+export const intNumberFields = [
+  PROPERTYS.CATEGORY,
+  PROPERTYS.GOOD_UNIT,
+  PROPERTYS.GOOD_NUM,
+  PROPERTYS.TAX
+]
+
+export const helper = {
+  fields: function(sourceObject) {
+    return Object.keys(sourceObject)
+  },
+  values: function(sourceObject, fields, index = 0) {
+    return fields.map(field => {
+      return sourceObject[field][index]
+    })
+  },
+  write: function(sourceObject, fields) {
+    return fields.reduce((prev, currentKey) => ({
+      ...prev,
+      [currentKey]: sourceObject[currentKey]
+    }), {})
+  }
+}

+ 167 - 217
src/views/customerService/invoiceApproval/index.vue

@@ -10,6 +10,7 @@
         :size="size"
         @page-curr-change="handlePageChange"
         @page-size-change="handleSizeChange"
+        @selection-change="handleSelectionChange"
         @screen-reset="
           pageInfo.curr = 1;
           parmValue.page = 1;
@@ -24,24 +25,39 @@
         <template #table-header="{}">
           <div style="width: 100%">
             <el-row style="padding: 0 0 0 80px">
-              <el-col :span="4" style="width: 301px; padding: 0 0 0px 0px">
+              <el-col :span="4" style="width: 360px; padding: 0 10px 0 0px">
                 <period-date-picker
-                  :start="parmValue[mapFields.createStart]"
-                  :end="parmValue[mapFields.createEnd]"
-                  :width="'134px'"
+                  :start="parmValue.create_start"
+                  :end="parmValue.create_end"
+                  :width="'164px'"
                   :size="searchSize"
+                  @timeReturned="handleTime"
                   placeholder="创建"
-                  @timeReturned="evt => handleTime(evt,'create')"
                 />
               </el-col>
 
+              <!-- <el-col :span="3" style="margin-right:10px">
+                <el-select v-model="parmValue.supplier" size="mini" placeholder="供应商企业" style="width:100%"
+                  @change=" pageInfo.curr = 1;
+                           parmValue.page = 1;
+                          searchList();"
+                  />
+              </el-col> -->
+
               <el-col :span="3" style="margin-right:10px">
+                <el-input v-model="parmValue.reqCode" size="mini" placeholder="需求订单编号" style="width:100%"
+                       @change="pageInfo.curr = 1;
+                                parmValue.page = 1;
+                                searchList();"
+                />
+              </el-col>
+
+              <el-col :span="4" style="width: 150px;margin-right:10px">
                 <el-select
-                  style="width:100%"
                   :size="searchSize"
-                  v-model="parmValue[mapFields.status]"
+                  v-model="parmValue.invoiceStatus"
                   clearable
-                  placeholder="申请状态"
+                  placeholder="开票状态"
                   @change="
                     pageInfo.curr = 1;
                     parmValue.page = 1;
@@ -50,7 +66,7 @@
                 >
                   <el-option
                     v-for="item in statusList"
-                    :key="item.id"
+                    :key="item.ids"
                     :label="item.label"
                     :value="item.id"
                   >
@@ -58,23 +74,6 @@
                 </el-select>
               </el-col>
 
-              <el-col :span="4">
-                <el-select
-                  style="width:100%"
-                  :size="searchSize"
-                  v-model="parmValue[mapFields.demandCompany]"
-                  clearable
-                  placeholder="需求企业"
-                  @change="
-                    pageInfo.curr = 1;
-                    parmValue.page = 1;
-                    searchList();
-                  "
-                >
-                  <el-option />
-                </el-select>
-              </el-col>
-
               <el-col :span="3" style="width: 66px; float: right">
                 <el-button
                   :size="searchSize"
@@ -97,47 +96,34 @@
               </el-col>
             </el-row>
 
-            <el-row  style="margin-top: 10px">
-              <el-col :span="4" style="width: 301px; padding: 0 0 0px 0px">
+            <el-row style="margin-top:10px">
+              <el-col :span="4" style="width: 360px; padding: 0 10px 0 0px">
                 <period-date-picker
-                  :start="parmValue[mapFields.openStart]"
-                  :end="parmValue[mapFields.openEnd]"
-                  :width="'134px'"
+                  :start="parmValue.open_start"
+                  :end="parmValue.open_end"
+                  :width="'164px'"
                   :size="searchSize"
-                  @timeReturned="evt => handleTime(evt,'open')"
+                  @timeReturned="() => handleTime(true)"
                   placeholder="开票"
                 />
               </el-col>
 
               <el-col :span="4" style="margin-right:10px">
-                <el-input
-                  clearable
-                  :size="searchSize"
-                  placeholder="开票申请编号"
-                  v-model="parmValue[mapFields.openInviceNo]"
-                  @change="
-                    pageInfo.curr = 1;
-                    parmValue.page = 1;
-                    searchList();
-                  "
-                />
+                <el-input size="mini" placeholder="发票代码" v-model="parmValue.invoiceCode"
+                  @change=" pageInfo.curr = 1;
+                           parmValue.page = 1;
+                          searchList();"  />
               </el-col>
 
-              <el-col :span="4" style="margin-right:10px">
-                <el-input
-                  clearable
-                  :size="searchSize"
-                  placeholder="需求订单编号"
-                  v-model="parmValue[mapFields.demandOrderNo]"
-                  @change="
-                    pageInfo.curr = 1;
-                    parmValue.page = 1;
-                    searchList();
-                  "
-                />
+              <el-col :span="4">
+                <el-input size="mini" placeholder="发票号码" v-model="parmValue.invoiceNum"
+                  @change=" pageInfo.curr = 1;
+                           parmValue.page = 1;
+                          searchList();"
+                 />
               </el-col>
 
-               <el-col :span="3" style="width: 113px; float: right">
+              <el-col :span="3" style="width:115px;float: right">
                 <el-button
                   :size="searchSize"
                   type="primary"
@@ -152,55 +138,50 @@
                   type="warning"
                   class="fr"
                   :size="searchSize"
-                  @click="visible = true"
+                  @click="onBatchApprovalInvoice"
                 >
-                  批量审发票
+                  批量审发票
                 </el-button>
               </el-col>
             </el-row>
 
             <el-row style="margin-top:10px">
               <el-col :span="4" style="margin-right:10px">
-                <el-input  v-model="parmValue[mapFields.invoiceCode]" size="mini" placeholder="发票代码"  @change="
-                    pageInfo.curr = 1;
-                    parmValue.page = 1;
-                    searchList();
-                  " />
-              </el-col>
-
-              <el-col :span="4"  style="margin-right:10px">
-                <el-input
-                  clearable
-                  :size="searchSize"
-                  placeholder="发票号码"
-                  v-model="parmValue[mapFields.invoiceNumber]"
-                  @change="
-                    pageInfo.curr = 1;
-                    parmValue.page = 1;
-                    searchList();
-                  "
-                />
+                <el-select v-model="parmValue.invoice_type" size="mini" placeholder="发票类型" style="width:100%"
+                  @change=" pageInfo.curr = 1;
+                           parmValue.page = 1;
+                          searchList();"
+                  >
+                    <el-option
+                      v-for="type in invoiceTypeList"
+                      :key="type.value"
+                      :value="type.value"
+                      :label="type.label"
+                     />
+                  </el-select>
               </el-col>
 
               <el-col :span="4">
-                <el-select
-                  style="width:100%"
-                  :size="searchSize"
-                  v-model="parmValue[mapFields.invoiceType]"
-                  clearable
-                  placeholder="发票类型"
-                  @change="
-                    pageInfo.curr = 1;
-                    parmValue.page = 1;
-                    searchList();
-                  "
-                >
-                  <el-option />
-                </el-select>
+                <el-input size="mini" placeholder="发票申请编号" v-model="parmValue.invNo"
+                  @change=" pageInfo.curr = 1;
+                           parmValue.page = 1;
+                          searchList();"
+                 />
               </el-col>
             </el-row>
           </div>
         </template>
+
+        <template #invoiceType="{ scope }">
+          <el-tag size="mini">
+            {{(invoiceTypeList.find(({value}) => value === scope.row.invoiceType) || {}).label || '--'}}
+          </el-tag>
+        </template>
+
+        <template #demandOrder={scope}>{{
+            (scope.row.orderinvoice || {}).reqCode || '--'
+          }}</template>
+
         <template #status="{ scope }">
           <el-tag
             :size="tablebtnSize"
@@ -214,22 +195,7 @@
             "
           ></el-tag>
         </template>
-        <template #good_name="{ scope }">
-          <span>{{ scope.row.good_name }}</span>
-          <span
-            v-for="(si, sii) in scope.row.specinfo"
-            :key="si.spec_value_id + sii"
-          >
-            {{ sii == 0 ? "__" : "--" }}{{ si.spec_name }}[{{
-              si.spec_value_name
-            }}]</span
-          >
-        </template>
-        <template #can="{ scope }">
-          <span v-for="(si, sii) in scope.row.can" :key="si.id + sii">
-            <span v-if="sii !== 0">_</span>{{ si.name }}</span
-          >
-        </template>
+
         <template #operation="{ scope }">
           <el-tooltip
             v-if="powers.some((i) => i == '007')"
@@ -237,79 +203,86 @@
             content="详情"
             placement="top"
           >
-            <i class="el-icon-view tb-icon" @click="getRouter('invoiceApplyDetail', scope.row.bargainNo )" />
+            <i
+              class="el-icon-view tb-icon"
+
+               @click="getRouter('bargainListDetail', scope.row.bargainNo )"
+            ></i>
           </el-tooltip>
         </template>
       </ex-table>
-    </div>
 
-    <ApprovalModal :visible.sync="visible" />
+      <invoice-modal :visible.sync="visible" @confirm="handleBatchApprovalInvoice" />
+    </div>
   </div>
 </template>
 <script>
 import mixinPage from "@/mixins/elPaginationHandle";
 import resToken from "@/mixins/resToken";
-import asyncRequest from "@/apis/service/customerService/invoiceApproval";
+import asyncRequest from "@/apis/service/platformService/invoice";
 import companyHelper from "@/mixins/companyHelper"
 import { listCol, statusList } from "./columns";
-import ApprovalModal from "./components/approvalModal.vue";
-import { createEmptyStringObject } from '@/utils/static';
 import { mapGetters } from "vuex";
+import { invoiceTypeList } from '@/assets/js/statusList';
+import InvoiceModal from "./components/invoice-modal.vue"
 
-const mapFields = {
-  //创建时间开始&结束
-  createStart:'createStart',
-  createEnd:'createEnd',
-  //开票时间开始&结束
-  openStart:'openStart',
-  openEnd:'openEnd',
-  //需求企业
-  demandCompany:'demandCompany',
-  //发票号码
-  invoiceNumber:'invoiceNumber',
-  //发票代码
-  invoiceCode:'invoiceCode',
-  //发票类型
-  invoiceType:'invoiceType',
-  //开票申请编号
-  openInviceNo:'openInviceNo',
-  //需求订单编号
-  demandOrderNo:'demandOrderNo',
-  //申请状态
-  status:'status'
-}
 
-const mapDateFields = {
-  create:'创建',
-  open:'开票'
-}
+/**
+ * @props
+    create_start 创建开始时间
+    create_end 创建结束时间
+    open_start 开票开始时间
+    open_end 开票结束时间
+    supplier 供应商企业
+    reqCode 需求订单编号
+    invoiceStatus 发票状态
+    invoiceCode 发票代码,
+    invoiceNum 发票号码,
+    invoice_type 发票类型
+    invNo 发票申请编号
+*/
+
 
 export default {
   name: "bargainList",
   mixins: [mixinPage, resToken, companyHelper],
-  components:{ApprovalModal},
+  components:{InvoiceModal},
   computed: {
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),
     powers() {
       const tran =
-        this.$store.getters.btnList.find((item) => item.menu_route == "invoiceApproval") || {};
+        this.$store.getters.btnList.find(
+          (item) => item.menu_route == "invoice"
+        ) || {};
       const { action } = tran ?? {};
       return action ?? [];
     },
   },
   data() {
     return {
-      mapFields,
-      visible:false,
+      selected:[],
+      select: "1",
+      s_input: "",
+      invoiceTypeList,
       customerCode: [], //客户公司code
       statusList,
       sitem: null,
       loading: false,
-      showModel: false,
+      visible: false,
       isDetail: false,
       modelId: 0,
       parmValue: {
-        ...createEmptyStringObject(mapFields),
+        create_start:"", // 创建开始时间
+        create_end:"", // 创建结束时间
+        open_start:"", // 开票开始时间
+        open_end:"", // 开票结束时间
+        supplier:"", // 供应商企业
+        reqCode:"", // 需求订单编号
+        invoiceStatus:"", // 发票状态
+        invoiceCode:"", // 发票代码,
+        invoiceNum:"", // 发票号码,
+        invoice_type:"", // 发票类型
+        invNo:"", // 发票申请编号
         page: 1, // 页码
         size: 15, // 每页显示条数
       },
@@ -339,13 +312,6 @@ export default {
       this.parmValue = JSON.parse(back);
       console.log(this.parmValue)
       const {page,size}=this.parmValue;
-      // this.parmValue.start = start || last_start;
-      // this.parmValue.end = end || last_end;
-
-      // if(this.parmValue.customer_code.length>0){
-      //     this.customerCode = [this.parmValue.customer_code] ;
-      // }
-
        this.pageInfo= {
         size: size,
         curr: page,
@@ -362,8 +328,38 @@ export default {
     }
     this.searchList();
   },
-
   methods: {
+    async handleBatchApprovalInvoice(data){
+      const { code } = await asyncRequest.batch({
+        idArr:this.selected.map(({id}) => id),
+        ...data
+      })
+
+      if(code !== 1) return
+      this.visible = false
+      this.searchList()
+    },
+    onBatchApprovalInvoice(){
+      if(this.selected.length === 0){
+        this.$message.warning('至少选择一张状态为 "待确认" 的发票申请')
+        return
+      }
+
+      const isOK = this.selected.every(({status}) => String(status) === "1")
+
+      if(!isOK){
+         this.$message.warning('请选择状态为 "待确认" 的发票申请')
+        return
+      }
+
+
+      this.visible = true
+      // console.log(this.selected)
+    },
+    handleSelectionChange(list) {
+      console.log(list)
+      this.selected = list
+    },
     getRouter(toRouter, queryId){
       if (toRouter && queryId) {
         let model = {
@@ -392,16 +388,20 @@ export default {
       this.select = "1";
       this.s_input = "";
       this.parmValue = {
-        bidsNo: "", // 反馈编号
-        infoNo: "", // 竞价单编号
-        bargainNo: "", //议价编号
-        status: "", // 状态
-        start: "",
-        end: "",
+        create_start:"", // 创建开始时间
+        create_end:"", // 创建结束时间
+        open_start:"", // 开票开始时间
+        open_end:"", // 开票结束时间
+        supplier:"", // 供应商企业
+        reqCode:"", // 需求订单编号
+        invoiceStatus:"", // 发票状态
+        invoiceCode:"", // 发票代码,
+        invoiceNum:"", // 发票号码,
+        invoice_type:"", // 发票类型
+        invNo:"", // 发票申请编号
         page: 1, // 页码
         size: 15, // 每页显示条数
-        company_name:"",
-      };
+      }
       // 表格 - 分页
       this.pageInfo = {
         size: 15,
@@ -417,68 +417,17 @@ export default {
       this.isDetail = isDetail;
       this.sitem = sitem;
     },
-    async deleteById(id, status) {
-      await this.$confirm("确定要删除?", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      }).then(async () => {
-          const model = {
-            id: id,
-            status: status + '' === "1" ? "0" : "1",
-          };
-          const res = await asyncRequest.status(model);
-          if (res && res.code === 0) {
-            this.$notify.success({
-              title: "删除成功",
-              message: "",
-            });
-            this.searchList();
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
-          } else {
-            this.$message.warning(res.message);
-          }
-        })
-        .catch(() => {
-          console.log("取消");
-        });
-    },
     // 列表搜索
     async searchList() {
-      return
-
-      for(const field of Object.keys(mapDateFields)){
-        const startField = `${field}Start`
-        const endField = `${field}End`
-
-        if (
-          (this.parmValue[startField] !== "" && this.parmValue[endField] === "") ||
-          (this.parmValue[startField] === "" && this.parmValue[endField] !== "")
-        ) {
-          this.$message.warning(`${mapDateFields[field]}时间区间不完整!`);
-          return;
-        }
-      }
-
       this.loading = true;
-      this.parmValue.bargainNo = this.select === "1" ? this.s_input : "";
-      this.parmValue.bidsNo = this.select === "2" ? this.s_input : "";
-      this.parmValue.infoNo = this.select === "3" ? this.s_input : "";
-      this.parmValue.company_name = this.select === "4" ? this.s_input : "";
-
       const res = await asyncRequest.list({
         ...this.parmValue,
-        companyNo: this.currentCompany,
-        customer_code: Array.isArray(this.parmValue.customer_code) ? this.parmValue.customer_code[0] : "",
-        noRelation: true
+        inv_type: "1"
       });
 
-      if (res && res.code === 0 && res.data) {
+      if (res && res.code === 1 && res.data) {
         this.tableData = res.data.list;
         this.pageInfo.total = Number(res.data.count);
-      } else if (res && res.code >= 100 && res.code <= 104) {
-        await this.logout();
       } else {
         this.tableData = [];
         this.pageInfo.total = 0;
@@ -518,9 +467,10 @@ export default {
         });
     },
     // 时间选择事件
-    async handleTime(e,prop) {
-      const startProp = `${prop}Start`
-      const endProp = `${prop}End`
+    async handleTime(e,isOpen = false) {
+      const startProp = isOpen ? "open_start" :"create_start"
+      const endProp = isOpen ? "open_end" : "create_end"
+
       if (e.startTime !== "") {
         this.parmValue[startProp] = e.startTime;
       } else {

+ 17 - 19
src/views/customerService/paymentApply/columns.js

@@ -1,32 +1,29 @@
 
 const statusList = [
-  { id: '0', label: '待业务主管审核', type: '' },
-  { id: '1', label: '业务主管已通过', type: 'success' },
-  { id: '2', label: '业务主管已驳回', type: 'danger' },
-  { id: '3', label: '业务主管越线通过', type: 'warning' },
-  { id: '4', label: '取消议价', type: 'info' }
-  // 已选完商品,取消议价
+  { id: '1', label: '待上传凭证', type: '' },
+  { id: '2', label: '待供应商确认', type: '' },
+  { id: '3', label: '完成', type: 'success' }
 ]
 
 const editColumns = [
   {
-    prop: 'todo',
+    prop: 'reqCode',
     label: '平台订单编号',
     span: 8
   },
 
   {
-    prop: 'todo',
+    prop: 'DzNo',
     label: '业务订单编号',
     span: 8
   },
   {
-    prop: 'todo',
+    prop: 'createtime',
     label: '创建时间',
     span: 8
   },
   {
-    prop: 'todo',
+    prop: 'pay_amount',
     label: '总金额',
     span: 8
   },
@@ -61,9 +58,9 @@ const editColumns = [
 
 const listCol = [
   {
-    prop: 'todo',
+    prop: 'DzNo',
     label: '付款申请编号',
-    width: '155'
+    width: '115'
   },
 
   {
@@ -74,33 +71,34 @@ const listCol = [
   },
 
   {
-    prop: 'todo',
+    prop: 'pay_amount',
     label: '付款金额',
     width: '120px'
   },
   {
-    prop: 'todo',
+    prop: 'reqCode',
     label: '需求订单编号',
-    width: '155'
+    width: '185'
   },
 
   {
-    prop: 'todo',
+    prop: 'companyName',
     label: '客户公司',
     minWidth: '155px'
   },
   {
     prop: 'todo',
     label: '店铺名称',
-    minWidth: '155px'
+    minWidth: '155px',
+    required: true
   },
   {
-    prop: "todo",
+    prop: "creater",
     label: "创建人",
     minWidth: '155px'
   },
   {
-    prop: 'todo',
+    prop: 'createtime',
     label: '创建时间',
     'min-width': '180'
   },

+ 52 - 104
src/views/customerService/paymentApply/detail.vue

@@ -1,24 +1,35 @@
 <template>
   <div class="bargainListDetail">
-    <div class="bargainListDetail-main" v-if="powers.some((i) => i == '007')">
+    <div class="bargainListDetail-main">
       <el-tabs v-model="projectTabs" v-loading="loading">
         <el-tab-pane label="付款申请管理" name="1">
           <el-collapse v-model="activeNames" style="margin: -18px 0 0 0">
-            <el-collapse-item :title="'付款申请信息展示'" name="1">
+            <el-collapse-item :title="'付款申请信息'" name="1">
               <show-data-table
                 v-if="newTime !== ''"
                 style="padding: -5px 0 10px 0"
                 :newTime="newTime"
-                :sitem="{}"
+                :sitem="sitem"
                 :columns="editColumns"
-              />
+              >
+                <template #status>
+                  <el-tag size="mini">
+                    {{ (statusList.find(({id}) => id === String(sitem.status)) || {}).label || '--' }}
+                  </el-tag>
+                </template>
+              </show-data-table>
             </el-collapse-item>
 
-            <el-collapse-item title="待客户上传付款凭证" name="2">
-              <credentials-node :is-amount="true" />
+            <el-collapse-item 
+              v-if="sitem && Number(sitem.status) === 1"
+               v-loading="status_loading" 
+              title="待客户上传付款凭证" 
+              name="2"
+              >
+              <credentials-node :is-amount="true" @confirm="handleUpload" />
             </el-collapse-item>
 
-            <el-collapse-item title="待供应商确认付款" name="3">
+            <el-collapse-item title="待供应商确认付款" name="3" v-if="sitem && Number(sitem.status) === 2">
               <div style="width:100%;display:flex;justify-content:flex-end;margin:10px 0px">
                 <el-button size="mini" type="primary">确认已付款</el-button>
               </div>
@@ -27,16 +38,13 @@
         </el-tab-pane>
       </el-tabs>
     </div>
-    <div v-else>
-      <no-auth></no-auth>
-    </div>
   </div>
 </template>
 <script>
 import asyncRequest from "@/apis/service/customerService/paymentApply";
 import privateField from '@/mixins/privateField';
 import resToken from "@/mixins/resToken";
-import { editColumns } from "./columns";
+import { editColumns, statusList } from "./columns";
 import { mapGetters } from "vuex";
 
 export default {
@@ -54,6 +62,7 @@ export default {
 
   data() {
     return {
+      statusList,
       size: "small",
       eaxmList: [],
       editColumns,
@@ -65,6 +74,7 @@ export default {
       queryId: "",
       status: "",
       sitem: null,
+      status_loading:false,
 
       orderItem: {},
       moneyDirItem: {},
@@ -92,110 +102,48 @@ export default {
     async refresh() {
       this.routeReGoto("bargainList", {});
     },
+   async handleUpload(data){
+      const { amount: pay_amount, credentials: pay_proof } = data
+      this.status_loading = true
+      const { code } = await asyncRequest.status({
+        id:this.queryId,
+        pay_amount,
+        pay_proof: pay_proof.join(","),
+        status:2
+      })
+      this.status_loading = false
+
+      if(code !== 1) return
+      this.initForm()
+    },
+    async handleConfirm(){
+      this.status_loading = true
+      const { code } = await asyncRequest.status({
+        id:this.queryId,
+        status:3
+      })
+      this.status_loading = false
+
+      if(code !== 1) return
+      this.initForm()
+    },
     async initData() {
       this.loading = true;
-      const { code, message, data } = await asyncRequest.detail({
-        bargainNo: this.queryId,
+      const { code, data } = await asyncRequest.detail({
+        id: this.queryId,
       });
 
-      this.eaxmList = [];
-      this.loading = false;
-      if (code === 0) {
-        this.sitem = JSON.parse(JSON.stringify(data));
+      this.loading = false
 
-        const { status, exam_info } = this.sitem;
-        this.orderItem = {};
-        this.moneyDirItem = {};
-        this.moneyItem = {};
-        this.BossItem = {};
-        if (exam_info && exam_info.length > 0) {
-          exam_info.forEach((e) => {
-            console.log(e.status);
-            switch (e.info_status + "") {
-              case "0":
-                this.orderItem = JSON.parse(JSON.stringify(e));
-                break;
-              case "2":
-                this.moneyDirItem = JSON.parse(JSON.stringify(e));
-                break;
-              case "4":
-                this.moneyItem = JSON.parse(JSON.stringify(e));
-                break;
-              case "7":
-                this.BossItem = JSON.parse(JSON.stringify(e));
-                break;
-              default:
-                this.orderItem = JSON.parse(JSON.stringify(e));
-            }
-          });
-          this.eaxmList = JSON.parse(JSON.stringify(exam_info));
-        }
+      if(code !== 1) return
+      this.sitem = data
+      this.newTime = this.getNewTime()
 
-        this.status = status;
 
-        this.getNewTime();
-      } else if (code >= 100 && code <= 104) {
-        await this.logout();
-      } else {
-        this.$message.warning(message);
-      }
     },
     getNewTime() {
       this.newTime = new Date().valueOf();
     },
-
-    // 点击业务审核的保存按钮
-    async examFormSubmit(e, title) {
-      if (!this.loading) {
-        const { state, remark, adjunct, adjunct_name } = e;
-        let model = {
-          bargainNo: this.queryId,
-          status: state,
-          adjunct: adjunct,
-          adjunct_name: adjunct_name,
-          remark: remark,
-        };
-        await this.$confirm(`确定要提交${title}审批结果?`, {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning",
-        })
-          .then(async () => {
-            const { after_price, lower_price } = this.sitem;
-            if (after_price * 1 < lower_price * 1 && state + "" + "" === "1") {
-              this.loading = false;
-              await this.$confirm(
-                `当前商品同意议价后,售价已低于系统最低售价${this.sitem.lower_price}元!`,
-                `最终售价已低于系统最低售价!是否继续?`,
-
-                {
-                  confirmButtonText: "确定",
-                  cancelButtonText: "取消",
-                  type: "error",
-                }
-              )
-                .then(async () => {
-                  if (adjunct === "") {
-                    this.$message.warning("越线通过,附件为必填项!");
-                    return;
-                  }
-                  this.loading = true;
-                  await this.statusSubmit(model, title);
-                })
-                .catch(() => {
-                  this.loading = false;
-                  console.log("取消1");
-                });
-            } else {
-              await this.statusSubmit(model, title);
-            }
-          })
-          .catch(() => {
-            this.loading = false;
-            console.log("取消");
-          });
-      }
-    },
     async statusSubmit(model, title) {
       if (model.status === "0") model.status = "2";
       const { code, data, message } = await asyncRequest.status(model);

+ 21 - 47
src/views/customerService/paymentApply/index.vue

@@ -94,15 +94,21 @@
                   searchList();
                 "/>
               </el-col>
-              <el-col :span="4" style="margin-right:10px">
-                <el-select size="mini" v-model="parmValue[mapFields.demandCompany]" placeholder="需求企业"  @change="
+                <!-- <el-select size="mini" v-model="parmValue[mapFields.demandCompany]" placeholder="需求企业"  @change="
                   pageInfo.curr = 1;
                   parmValue.page = 1;
                   searchList();
                 ">
                   <el-option />
-                </el-select>
-              </el-col>
+                </el-select> -->
+                <el-col :span="4" style="margin-left:10px">
+                   <search-customer style="width:100%" size="mini" placeholder="需求公司" :value.sync="parmValue[mapFields.demandCompany]" @change="
+                     pageInfo.curr = 1;
+                     parmValue.page = 1;
+                     searchList();
+                     " 
+                   />
+                 </el-col>
             </el-row>
           </div>
         </template>
@@ -119,30 +125,13 @@
             "
           ></el-tag>
         </template>
-        <template #good_name="{ scope }">
-          <span>{{ scope.row.good_name }}</span>
-          <span
-            v-for="(si, sii) in scope.row.specinfo"
-            :key="si.spec_value_id + sii"
-          >
-            {{ sii == 0 ? "__" : "--" }}{{ si.spec_name }}[{{
-              si.spec_value_name
-            }}]</span
-          >
-        </template>
-        <template #can="{ scope }">
-          <span v-for="(si, sii) in scope.row.can" :key="si.id + sii">
-            <span v-if="sii !== 0">_</span>{{ si.name }}</span
-          >
-        </template>
         <template #operation="{ scope }">
           <el-tooltip
-            v-if="powers.some((i) => i == '007')"
             effect="dark"
             content="详情"
             placement="top"
           >
-            <i class="el-icon-view tb-icon" @click="getRouter('paymentApplyDetail', scope.row.bargainNo )" />
+            <i class="el-icon-view tb-icon" @click="getRouter('paymentApplyDetail', scope.row.id )" />
           </el-tooltip>
         </template>
       </ex-table>
@@ -158,13 +147,13 @@ import { listCol, statusList } from "./columns";
 import { mapGetters } from "vuex";
 
 const mapFields = {
-  createStart:'createnStart', //创建开始时间
-  createEnd:'createEnd',  //创建结束时间
-  demandOrderNo:'demandOrderNo', //需求订单编号
-  status:'status', //付款状
-  supplier:'supplier', //供应商公司
-  paymentApplyNo:'paymentApplyNo', //付款申请编号
-  demandCompany:'demandCompany' //需求企业
+  createStart:'create_start', //创建开始时间
+  createEnd:'create_end',  //创建结束时间
+  demandOrderNo:'reqCode', //需求订单编号
+  status:'status', //付款状
+  // supplier:'customer_id', //供应商公司
+  paymentApplyNo:'DzNo', //付款申请编号
+  demandCompany:'customer_id' //需求企业
 }
 
 export default {
@@ -239,7 +228,7 @@ export default {
       // if(this.parmValue.customer_code.length>0){
       //     this.customerCode = [this.parmValue.customer_code] ;
       // }
-      
+
        this.pageInfo= {
         size: size,
         curr: page,
@@ -265,11 +254,6 @@ export default {
           type: 'view',
         };
 
-        //有多选框的条件
-        this.parmValue.select = this.select ;
-        // this.parmValue.sselect = this.sselect ;
-        this.parmValue.s_input= this.s_input;
-        //
          let routerModel = {
           options: JSON.parse(JSON.stringify(this.parmValue)),
           router: this.$route.path,
@@ -340,8 +324,6 @@ export default {
     },
     // 列表搜索
     async searchList() {
-      return
-
       if (
         (this.parmValue[mapFields.createStart] !== "" && this.parmValue[mapFields.createEnd] === "") ||
         (this.parmValue[mapFields.createStart] === "" && this.parmValue[mapFields.createEnd] !== "")
@@ -351,22 +333,14 @@ export default {
       }
 
       this.loading = true;
-      this.parmValue.bargainNo = this.select === "1" ? this.s_input : "";
-      this.parmValue.bidsNo = this.select === "2" ? this.s_input : "";
-      this.parmValue.infoNo = this.select === "3" ? this.s_input : "";
-      this.parmValue.company_name = this.select === "4" ? this.s_input : "";
       
       const res = await asyncRequest.list({
-        ...this.parmValue,
-        companyNo: this.currentCompany,
-        customer_code: Array.isArray(this.parmValue.customer_code) ? this.parmValue.customer_code[0] : ""
+        ...this.parmValue
       });
 
-      if (res && res.code === 0 && res.data) {
+      if (res && res.code === 1 && res.data) {
         this.tableData = res.data.list;
         this.pageInfo.total = Number(res.data.count);
-      } else if (res && res.code >= 100 && res.code <= 104) {
-        await this.logout();
       } else {
         this.tableData = [];
         this.pageInfo.total = 0;

+ 1 - 1
src/views/customerService/workbench/letterEditing.vue

@@ -158,7 +158,7 @@ export default {
     async onSubmit() {
       this.loading = true
       const param = {
-        plan_info: this.tableData.planinfo.map(({name, service_cat, price,unit,  num, tax,  id,total_fee   }) =>  ({total_fee ,name, service_cat, price, unit, num, tax, id })),
+        plan_info: this.tableData.planinfo.map(({ name, service_cat, price,unit,  num, tax,  id,total_fee   }) =>  ({total_fee ,name, service_cat, price, unit, num, tax, id })),
         plan_id:this.$route.query.id,
         store_id:this.tableData.store_id
       }

+ 55 - 39
src/views/platformService/invoice/columns.js

@@ -1,85 +1,101 @@
 
 const statusList = [
-  { id: '0', label: '待业务主管审核', type: '' },
-  { id: '1', label: '业务主管已通过', type: 'success' },
-  { id: '2', label: '业务主管已驳回', type: 'danger' },
-  { id: '3', label: '业务主管越线通过', type: 'warning' },
-  { id: '4', label: '取消议价', type: 'info' }
-  // 已选完商品,取消议价
+  { id: '0', label: '驳回', type: 'danger' },
+  { id: '1', label: '待确认', type: 'info' },
+  { id: '2', label: '确认', type: 'success' },
 ]
 
 const listCol = [
     {
-    type:'selection'
+    type:'selection',
+    fixed:'left'
   },
   {
-    prop: 'todo',
+    prop: 'inv_code',
     label: '开票申请编号',
-    width: '155'
+    width: '110px'
   },
 
   {
-    prop: 'todo',
-    label: '开票申请发票类型',
-    width: '155'
-  },
 
-  {
-    prop: 'todo',
-    label: '需求订单编号',
-    width: '120px'
-  },
-  {
-    prop: 'todo',
-    label: '供应商企业',
-    width: '155'
+    prop:'status',
+    label:'状态',
+    _slot_:'status',
+    width: '75px'
   },
 
   {
-    prop: 'todo',
-    label: '发票记录编号',
-    width: '155px'
+    prop: 'invoiceType',
+    label: '开票申请发票类型',
+    width: '125px',
+    _slot_:'invoiceType'
+    // reuqired:true
   },
+
   {
-    prop: 'todo',
-    label: '发票状态',
-    width: '155px'
+    prop: 'demandOrder',
+    label: '需求订单编号',
+    width: '180px',
+    _slot_:'demandOrder'
   },
+  // {
+  //   prop: 'todo',
+  //   label: '供应商企业',
+  //   width: '155',
+  //   required:true
+  // },
+
+  // {
+  //   prop: 'todo',
+  //   label: '发票记录编号',
+  //   width: '155px',
+  //   required:true
+  // },
+  // {
+  //   prop: 'todo',
+  //   label: '发票状态',
+  //   width: '155px',
+  //   required:true
+  // },
   {
-    prop: 'todo',
+    prop: 'invoiceType',
     label: '发票类型',
-    'min-width': '180'
+    'width': '125px',
+    _slot_:'invoiceType'
   },
   {
-    prop: 'todo',
+    prop: 'invoiceCode',
     label: '发票代码',
     'min-width': '125'
   },
   {
-    prop: 'todo',
+    prop: 'invoiceNum',
     label: '发票号码',
     minWidth: '150px'
   },
 
   {
-    prop: 'todo',
-    label: '开票日期'
+    prop: 'open_date',
+    label: '开票日期',
+    minWidth: '110px'
   },
   {
-    prop: 'todo',
+    prop: 'subtotal_tax',
     label: '税前金额'
   },
   {
-    prop: 'todo',
+    prop: 'total_amount',
     label: '税后金额'
   },
   {
-    prop:'todo',
-    label:'校验码'
+    prop:'check_code',
+    label:'校验码',
+    width:'125px'
   },
   {
     prop:'todo',
-    label:'驳回原因'
+    label:'驳回原因',
+    required:true
   },
   // {
   //   prop: '',

+ 64 - 326
src/views/platformService/invoice/components/invoice-modal.vue

@@ -1,350 +1,88 @@
 <template>
-  <el-dialog
-    center
-    width="1024px"
-    title="导入采销订单补录"
-    :visible="innerVisible"
-    :close-on-click-modal="false"
-    @close="innerVisible = false; tableData = []"
-  >
-    <div v-if="tableData && tableData.length > 0" class="tr" style="padding: 10px 0 0 0">
-      <el-button :size="'mini'" @click="() => tableData = []">取消</el-button>
-      <el-button type="primary" :size="'mini'" :loading="loading" @click="onSubmit">提交</el-button>
-    </div>
-    <div v-else>
-      <upload-excel :on-success="onSuccess" :before-upload="beforeUpload" />
-    </div>
-
-    <ex-table
-      :columns="columns"
-      :table="table"
-      :data="tableData"
-      style="margin: 15px 0 0 0"
-    />
+  <el-dialog width="400px" :visible="visible" @close="handleClose" title="批量审批发票" center>
+    <el-form ref="form" :model="formData" size="mini" :rules="rules" label-width="80px">
+      <el-form-item prop="status" label="审批状态">
+        <el-select v-model="formData.status" style="width: 100%" placeholder="审批状态">
+          <el-option label="通过" value="2" />
+          <el-option label="驳回" value="0" />
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="备注" prop="remark">
+        <el-input v-model="formData.remark" type="textarea" placeholder="备注" />
+      </el-form-item>
+
+      <ElFormItem class="flex-end">
+        <ElButton type="primary" @click="onSubmit" :loading="loading">保存</ElButton>
+      </ElFormItem>
+    </el-form>
   </el-dialog>
 </template>
 
 <script>
-import asyncRequest from '@/apis/service/platformService/invoice'
-import { isMobile } from '@/utils/validate'
-import companyHelper from '@/mixins/companyHelper'
-import { replaceTextWrapAndSpace } from '@/utils'
-import { MessageBox } from 'element-ui'
-
-import {
-  columns,
-  PROPERTYS,
-  getTableProperty,
-  createFieldVerification,
-  requsetFields,
-  requiredFields,
-  numberFields,
-  intNumberFields
-} from './template'
 
+const defaultData = {
+  status:'',
+  remark:''
+}
 export default {
-  mixins: [companyHelper],
-  props: ['visible'],
-  data() {
+  name: "approvalModal",
+  props:['visible'],
+  data(){
     return {
-      columns,
-      loading: false,
-      tableData: [],
-      table: {
-        stripe: true,
-        border: true,
-        'max-height': '800px'
-      }
+      formData:{...defaultData}
     }
   },
-  computed: {
-    innerVisible: {
-      get() {
+  computed:{
+    rules(){
+      return ({
+        status:[
+          {
+            required:true,
+            trigger:'change',
+            message:'请选择审核状态'
+          }
+        ],
+        remark:[
+          {
+            required: this.formData.status === "0",
+            trigger:'change',
+            message:'请输入备注'
+          }
+        ]
+      })
+    },
+    _visible:{
+      get(){
         return this.visible
       },
-      set(newVal) {
-        this.$emit('update:visible', newVal)
+      set(newVal){
+        this.$emit('update:visible',newVal)
       }
     }
   },
-  methods: {
-    validateTableHeader(header, importHeader) {
-      let isHeaderOk = true
-      if (header.length !== importHeader.length) return false
-      for (const index in header) {
-        const field = header[index]
-        const importField = importHeader[index]
-        if (field !== importField) {
-          isHeaderOk = false
-          break
-        }
-      }
-
-      return isHeaderOk
-    },
-    /* 校验导入的销售方列表编码(与选择的公司必须一致) **/
-    validateCompanyNo(value, row) {
-      const verification = createFieldVerification()
-      const current = this.currentCompany
-      if (value !== current) {
-        verification.isValid = false
-        verification.message = `第 ${row} 行,销售方公司必须与选择的公司一致`
-        return verification
-      }
-      return verification
-    },
-    /* 校验导入的购买方列表编码(开头必须为KH) **/
-    validateKhNo(value, row) {
-      const verification = createFieldVerification()
-      const perfix = String(value || '').slice(0, 2)
-      if (perfix !== 'KH') {
-        verification.isValid = false
-        verification.message = `第 ${row} 行,"购买方公司编码必须以'KH'开头`
-        return verification
-      }
-      return verification
-    },
-    formatDate2(serialNumber, format = '-', mao = ':') {
-      var timestamp = (serialNumber - 25569 - 8 / 24) * 86400 * 1000 // 转换为时间戳
-      var newDate = new Date(timestamp) // 转换为日期时间对象
-      const year = newDate.getFullYear() // 获取年份,例如 2023
-      const month = newDate.getMonth() + 1 // 获取月份,注意需要加上 1,例如 4
-      const day = newDate.getDate() // 获取日期,例如 9
-      let hours = newDate.getHours() // 获取小时,例如 0
-      let minutes = newDate.getMinutes() // 获取分钟,例如 0
-      let seconds = newDate.getSeconds() // 获取秒数,例如 0
-
-      // 判断小时、分钟和秒是否小于 10,如果是,则在前面补一个零
-      if (hours < 10) {
-        hours = '0' + hours
-      }
-      if (minutes < 10) {
-        minutes = '0' + minutes
-      }
-      if (seconds < 10) {
-        seconds = '0' + seconds
-      }
-      return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
-    },
-    /* 校验导入的联系电话是否合法 **/
-    validateMobile(value, row) {
-      const verification = createFieldVerification()
-      if (!isMobile(value)) {
-        verification.isValid = false
-        verification.message = `第${Number(row)}行,联系方式,手机号格式不正确`
-        return verification
-      }
-      return verification
-    },
-    /* 校验导入的购买方列表编码(开头必须为QS) **/
-    validateSupplierNo(value, row) {
-      const verification = createFieldVerification()
-      const perfix = String(value || '').slice(0, 2)
-      if (perfix !== 'QS') {
-        verification.isValid = false
-        verification.message = `第 ${row} 供应商公司编码必须以'QS'开头`
-        return verification
-      }
-      return verification
-    },
-    validateNumberField(field, value, row) {
-      const verification = createFieldVerification()
-      if (!/^\d*\.?\d+$/.test(value)) {
-        verification.isValid = false
-        verification.message = `第${Number(row)}行,${getTableLabel(field)}必须为数字,且不能小于0`
-        return verification
-      }
-      return verification
-    },
-    validateIntNumberField(field, value, row) {
-      const verification = createFieldVerification()
-      if (!/^\d+$/.test(value)) {
-        verification.isValid = false
-        verification.message = `第${Number(row)}行,${getTableLabel(field)}必须为正整数`
-        return verification
-      }
-      return verification
-    },
-    /* 校验导入的税率、数量、采购单价、销售单价是否为数字 **/
-    validateDateField(value) {
-      // const verification = createFieldVerification()
-      // if (!(/^\d{4}-\d{1,2}-\d{1,2}\s\d{1,2}:\d{1,2}:\d{1,2}$/.test(value))) {
-      //   verification.isValid = false
-      //   verification.message = `第${Number(index)}行,发货日期不能为空,且必须为日期格式`
-      //   return verification
-      // }
-      return /^\d{4}-\d{1,2}-\d{1,2}\s\d{1,2}:\d{1,2}:\d{1,2}$/.test(value)
-    },
-    validateRequiredField(field, value, row) {
-      const verification = createFieldVerification()
-      if (replaceTextWrapAndSpace(value) === '') {
-        verification.isValid = false
-        verification.message = `第${row}行,${getTableLabel(field)}不能为空`
-        return verification
-      }
-      return verification
-    },
-    /* 处理不合法的值,提示错误信息,并返回最终的验证状态 **/
-    handleNotValidFields(...validFns) {
-      let isFinalValid = true
-      for (const validFn of validFns) {
-        const { message, isValid } = validFn()
-        if (!isValid) {
-          isFinalValid = false
-          MessageBox({ type: 'warning', title: '数据填写错误', message })
-          break
-        }
-      }
-      return isFinalValid
-    },
-    /* 校验导入的数据 **/
-    validateFields(tableData = []) {
-      let verification = null
-      for (const row in tableData) {
-        if (row === 'remove') {
-          continue
-        }
-
-        const tableItem = tableData[row]
-        const index = Number(row) + 1
-
-        for (const field in tableItem) {
-          if (requiredFields.includes(field)) {
-            verification = this.validateRequiredField(field, tableItem[field], index)
-            if (!verification.isValid) {
-              MessageBox({ type: 'warning', title: '数据填写错误', message: verification.message })
-              return false
-            }
-          }
-
-          if (intNumberFields.includes(field)) {
-            verification = this.validateIntNumberField(field, tableItem[field], index)
-            if (!verification.isValid) {
-              MessageBox({ type: 'warning', title: '数据填写错误', message: verification.message })
-              return false
-            }
-          }
-
-          if (numberFields.includes(field)) {
-            verification = this.validateNumberField(field, tableItem[field], index)
-            if (!verification.isValid) {
-              MessageBox({ type: 'warning', title: '数据填写错误', message: verification.message })
-              return false
-            }
-          }
-
-          if (field === PROPERTYS.MOBILE) {
-            verification = this.validateMobile(tableItem[field], index)
-            if (!verification.isValid) {
-              MessageBox({ type: 'warning', title: '数据填写错误', message: verification.message })
-              return false
-            }
-          }
-
-          if (field === PROPERTYS.CUSTOMER_NO) {
-            verification = this.validateKhNo(tableItem[field], index)
-            if (!verification.isValid) {
-              MessageBox({ type: 'warning', title: '数据填写错误', message: verification.message })
-              return false
-            }
-          }
-
-          if (field === PROPERTYS.COMPANY_NO) {
-            verification = this.validateCompanyNo(tableItem[field], index)
-            if (!verification.isValid) {
-              MessageBox({ type: 'warning', title: '数据填写错误', message: verification.message })
-              return false
-            }
-          }
-
-          if (field === PROPERTYS.SUPPLIER_NO) {
-            verification = this.validateSupplierNo(tableItem[field], index)
-            if (!verification.isValid) {
-              MessageBox({ type: 'warning', title: '数据填写错误', message: verification.message })
-              return false
-            }
-          }
-        }
-      }
-      return true
-    },
-    mapTemplateItemToTableItem(templateItem) {
-      const tableItem = {}
-      const templatePropertys = Object.keys(templateItem)
-      templatePropertys.forEach(templateProperty => {
-        const tableproperty = getTableProperty(templateProperty)
-        tableItem[tableproperty] = templateItem[templateProperty]
-      })
-      return tableItem
+  methods:{
+    handleClose(){
+      this._visible = false
+      this.formData = {...defaultData}
+      this.loading = false
     },
-    onSuccess({ results: templateItems, header: templateHeader }) {
-      if (templateItems.length > 1000) {
-        this.$message.error('导入数据不能超过 1000 条')
-        return
-      }
-
-      const isHeaderValid = this.validateTableHeader(
-        this.columns.map(({ label }) => label).slice(1),
-        templateHeader
-      )
-      if (!isHeaderValid) {
-        this.$message.warning('表格与导入的表头不一致!')
-        return
-      }
-      if (templateItems.length === 0) {
-        this.$message.warning('导入的表格没有数据!')
-        return
-      }
-      templateItems.forEach(templateItem => {
-        const tableItem = this.mapTemplateItemToTableItem(templateItem)
-        Object.keys(tableItem).forEach(field => {
-          let target = ''
-          if (field === PROPERTYS.SEND_TIME) {
-            target = this.validateDateField(tableItem[PROPERTYS.SEND_TIME])
-              ? tableItem[PROPERTYS.SEND_TIME]
-              : this.formatDate2(tableItem[PROPERTYS.SEND_TIME])
-          } else {
-            target = tableItem[field] ? String(tableItem[field]).trim() : ''
-          }
-          tableItem[field] = target
+    async onSubmit(){
+      try{
+        await this.$refs.form.validate()
+        this.loading = true
+        this.$emit("confirm",{
+          ...this.formData,
+          inv_type: '2',
         })
-        this.tableData.push(tableItem)
-      })
-
-      this.validateFields(this.tableData)
-    },
-    async onSubmit() {
-      if (!this.validateFields(this.tableData)) return
-
-      const list = this.tableData.map(tableItem => requsetFields.reduce((prev, currentKey) => ({
-        ...prev,
-        workCode: '',
-        [currentKey]: tableItem[currentKey]
-      }), {}))
-
-      this.loading = true
-      const result = await asyncRequest.importOrder({
-        list
-      })
-      this.loading = false
-
-      switch (String(result.code)) {
-        case '0':
-          this.$message.success('导入成功')
-          this.innerVisible = false
-          this.$emit('refresh')
-          break
-        default:
-          this.$message.warning(result.message)
-          break
+      }catch (e) {
+        console.log(e)
       }
     }
   }
 }
 </script>
 
-<style lang="scss">
-.error-message__wrapper{
-  width: 1024px;
-}
+<style scoped>
+
 </style>

+ 98 - 94
src/views/platformService/invoice/index.vue

@@ -27,8 +27,8 @@
             <el-row style="padding: 0 0 0 80px">
               <el-col :span="4" style="width: 360px; padding: 0 10px 0 0px">
                 <period-date-picker
-                  :start="parmValue.createStart"
-                  :end="parmValue.createEnd"
+                  :start="parmValue.create_start"
+                  :end="parmValue.create_end"
                   :width="'164px'"
                   :size="searchSize"
                   @timeReturned="handleTime"
@@ -36,16 +36,16 @@
                 />
               </el-col>
 
-              <el-col :span="3" style="margin-right:10px">
+              <!-- <el-col :span="3" style="margin-right:10px">
                 <el-select v-model="parmValue.supplier" size="mini" placeholder="供应商企业" style="width:100%"
                   @change=" pageInfo.curr = 1;
                            parmValue.page = 1;
                           searchList();"
                   />
-              </el-col>
+              </el-col> -->
 
               <el-col :span="3" style="margin-right:10px">
-                <el-input v-model="parmValue.demandOrderNo" size="mini" placeholder="需求订单编号" style="width:100%"
+                <el-input v-model="parmValue.reqCode" size="mini" placeholder="需求订单编号" style="width:100%"
                        @change="pageInfo.curr = 1;
                                 parmValue.page = 1;
                                 searchList();"
@@ -99,8 +99,8 @@
             <el-row style="margin-top:10px">
               <el-col :span="4" style="width: 360px; padding: 0 10px 0 0px">
                 <period-date-picker
-                  :start="parmValue.openStart"
-                  :end="parmValue.openEnd"
+                  :start="parmValue.open_start"
+                  :end="parmValue.open_end"
                   :width="'164px'"
                   :size="searchSize"
                   @timeReturned="() => handleTime(true)"
@@ -116,21 +116,21 @@
               </el-col>
 
               <el-col :span="4">
-                <el-input size="mini" placeholder="发票号码" v-model="parmValue.invoiceNumber"
+                <el-input size="mini" placeholder="发票号码" v-model="parmValue.invoiceNum"
                   @change=" pageInfo.curr = 1;
                            parmValue.page = 1;
                           searchList();"
                  />
               </el-col>
 
-              <el-col :span="3" style="width:140px;float: right">
+              <el-col :span="3" style="width:115px;float: right">
                 <el-button
                   :size="searchSize"
                   type="primary"
                   style="float: right; margin-left: 5px"
                   @click="searchList"
                 >
-                  批量上传开票信息
+                  下载发票数据
                 </el-button>
               </el-col>
               <el-col :span="4" class="fr" style="width: 66px">
@@ -138,24 +138,31 @@
                   type="warning"
                   class="fr"
                   :size="searchSize"
-                  @click="onExportOpenResult"
+                  @click="onBatchApprovalInvoice"
                 >
-                  批量导出开票结果
+                  批量审核发票
                 </el-button>
               </el-col>
             </el-row>
 
             <el-row style="margin-top:10px">
               <el-col :span="4" style="margin-right:10px">
-                <el-select v-model="parmValue.invoiceType" size="mini" placeholder="发票类型" style="width:100%"
+                <el-select v-model="parmValue.invoice_type" size="mini" placeholder="发票类型" style="width:100%"
                   @change=" pageInfo.curr = 1;
                            parmValue.page = 1;
                           searchList();"
-                  />
+                  >
+                    <el-option
+                      v-for="type in invoiceTypeList"
+                      :key="type.value"
+                      :value="type.value"
+                      :label="type.label"
+                     />
+                  </el-select>
               </el-col>
 
               <el-col :span="4">
-                <el-input size="mini" placeholder="发票申请编号" v-model="parmValue.invoiceApplyNo"
+                <el-input size="mini" placeholder="发票申请编号" v-model="parmValue.invNo"
                   @change=" pageInfo.curr = 1;
                            parmValue.page = 1;
                           searchList();"
@@ -164,6 +171,17 @@
             </el-row>
           </div>
         </template>
+
+        <template #invoiceType="{ scope }">
+          <el-tag size="mini">
+            {{(invoiceTypeList.find(({value}) => value === scope.row.invoiceType) || {}).label || '--'}}
+          </el-tag>
+        </template>
+
+        <template #demandOrder={scope}>{{
+            scope.row.platformsettle.reqCode
+          }}</template>
+
         <template #status="{ scope }">
           <el-tag
             :size="tablebtnSize"
@@ -177,22 +195,7 @@
             "
           ></el-tag>
         </template>
-        <template #good_name="{ scope }">
-          <span>{{ scope.row.good_name }}</span>
-          <span
-            v-for="(si, sii) in scope.row.specinfo"
-            :key="si.spec_value_id + sii"
-          >
-            {{ sii == 0 ? "__" : "--" }}{{ si.spec_name }}[{{
-              si.spec_value_name
-            }}]</span
-          >
-        </template>
-        <template #can="{ scope }">
-          <span v-for="(si, sii) in scope.row.can" :key="si.id + sii">
-            <span v-if="sii !== 0">_</span>{{ si.name }}</span
-          >
-        </template>
+
         <template #operation="{ scope }">
           <el-tooltip
             v-if="powers.some((i) => i == '007')"
@@ -208,6 +211,8 @@
           </el-tooltip>
         </template>
       </ex-table>
+
+      <invoice-modal :visible.sync="visible" @confirm="handleBatchApprovalInvoice" />
     </div>
   </div>
 </template>
@@ -218,26 +223,30 @@ import asyncRequest from "@/apis/service/platformService/invoice";
 import companyHelper from "@/mixins/companyHelper"
 import { listCol, statusList } from "./columns";
 import { mapGetters } from "vuex";
+import { invoiceTypeList } from '@/assets/js/statusList';
+import InvoiceModal from "./components/invoice-modal.vue"
+
 
 /**
  * @props
-    createStart 创建开始时间
-    createEnd 创建结束时间
-    openStart 开票开始时间
-    openEnd 开票结束时间
+    create_start 创建开始时间
+    create_end 创建结束时间
+    open_start 开票开始时间
+    open_end 开票结束时间
     supplier 供应商企业
-    demandOrderNo 需求订单编号
+    reqCode 需求订单编号
     invoiceStatus 发票状态
     invoiceCode 发票代码,
-    invoiceNumber 发票号码,
-    invoiceType 发票类型
-    invoiceApplyNo 发票申请编号
+    invoiceNum 发票号码,
+    invoice_type 发票类型
+    invNo 发票申请编号
 */
 
 
 export default {
   name: "bargainList",
   mixins: [mixinPage, resToken, companyHelper],
+  components:{InvoiceModal},
   computed: {
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),
     powers() {
@@ -254,25 +263,26 @@ export default {
       selected:[],
       select: "1",
       s_input: "",
+      invoiceTypeList,
       customerCode: [], //客户公司code
       statusList,
       sitem: null,
       loading: false,
-      showModel: false,
+      visible: false,
       isDetail: false,
       modelId: 0,
       parmValue: {
-        createStart:"", // 创建开始时间
-        createEnd:"", // 创建结束时间
-        openStart:"", // 开票开始时间
-        openEnd:"", // 开票结束时间
+        create_start:"", // 创建开始时间
+        create_end:"", // 创建结束时间
+        open_start:"", // 开票开始时间
+        open_end:"", // 开票结束时间
         supplier:"", // 供应商企业
-        demandOrderNo:"", // 需求订单编号
+        reqCode:"", // 需求订单编号
         invoiceStatus:"", // 发票状态
         invoiceCode:"", // 发票代码,
-        invoiceNumber:"", // 发票号码,
-        invoiceType:"", // 发票类型
-        invoiceApplyNo:"", // 发票申请编号
+        invoiceNum:"", // 发票号码,
+        invoice_type:"", // 发票类型
+        invNo:"", // 发票申请编号
         page: 1, // 页码
         size: 15, // 每页显示条数
       },
@@ -319,10 +329,35 @@ export default {
     this.searchList();
   },
   methods: {
-    async onExportOpenResult(){
-      //TODO...
+    async handleBatchApprovalInvoice(data){
+      const { code } = await asyncRequest.batch({
+        idArr:this.selected.map(({id}) => id),
+        ...data
+      })
+
+      if(code !== 1) return
+      this.visible = false
+      this.searchList()
     },
-    handleSelectionChange({list}) {
+    onBatchApprovalInvoice(){
+      if(this.selected.length === 0){
+        this.$message.warning('至少选择一张状态为 "待确认" 的发票申请')
+        return
+      }
+
+      const isOK = this.selected.every(({status}) => String(status) === "1")
+
+      if(!isOK){
+         this.$message.warning('请选择状态为 "待确认" 的发票申请')
+        return
+      }
+
+
+      this.visible = true
+      // console.log(this.selected)
+    },
+    handleSelectionChange(list) {
+      console.log(list)
       this.selected = list
     },
     getRouter(toRouter, queryId){
@@ -353,17 +388,17 @@ export default {
       this.select = "1";
       this.s_input = "";
       this.parmValue = {
-        createStart:"", // 创建开始时间
-        createEnd:"", // 创建结束时间
-        openStart:"", // 开票开始时间
-        openEnd:"", // 开票结束时间
+        create_start:"", // 创建开始时间
+        create_end:"", // 创建结束时间
+        open_start:"", // 开票开始时间
+        open_end:"", // 开票结束时间
         supplier:"", // 供应商企业
-        demandOrderNo:"", // 需求订单编号
+        reqCode:"", // 需求订单编号
         invoiceStatus:"", // 发票状态
         invoiceCode:"", // 发票代码,
-        invoiceNumber:"", // 发票号码,
-        invoiceType:"", // 发票类型
-        invoiceApplyNo:"", // 发票申请编号
+        invoiceNum:"", // 发票号码,
+        invoice_type:"", // 发票类型
+        invNo:"", // 发票申请编号
         page: 1, // 页码
         size: 15, // 每页显示条数
       }
@@ -382,48 +417,17 @@ export default {
       this.isDetail = isDetail;
       this.sitem = sitem;
     },
-    async deleteById(id, status) {
-      await this.$confirm("确定要删除?", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      }).then(async () => {
-          const model = {
-            id: id,
-            status: status + '' === "1" ? "0" : "1",
-          };
-          const res = await asyncRequest.status(model);
-          if (res && res.code === 0) {
-            this.$notify.success({
-              title: "删除成功",
-              message: "",
-            });
-            this.searchList();
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
-          } else {
-            this.$message.warning(res.message);
-          }
-        })
-        .catch(() => {
-          console.log("取消");
-        });
-    },
     // 列表搜索
     async searchList() {
-      return
-      
       this.loading = true;
       const res = await asyncRequest.list({
         ...this.parmValue,
-        noRelation: true
+        inv_type: "2"
       });
 
-      if (res && res.code === 0 && res.data) {
+      if (res && res.code === 1 && res.data) {
         this.tableData = res.data.list;
         this.pageInfo.total = Number(res.data.count);
-      } else if (res && res.code >= 100 && res.code <= 104) {
-        await this.logout();
       } else {
         this.tableData = [];
         this.pageInfo.total = 0;
@@ -464,8 +468,8 @@ export default {
     },
     // 时间选择事件
     async handleTime(e,isOpen = false) {
-      const startProp = isOpen ? "openStart" :"createStart"
-      const endProp = isOpen ? "openEnd" : "createEnd"
+      const startProp = isOpen ? "open_start" :"create_start"
+      const endProp = isOpen ? "open_end" : "create_end"
 
       if (e.startTime !== "") {
         this.parmValue[startProp] = e.startTime;

+ 50 - 48
src/views/platformService/settlement/columns.js

@@ -1,41 +1,43 @@
 const statusList = [
-  { id: '0', label: '待业务主管审核', type: '' },
-  { id: '1', label: '业务主管已通过', type: 'success' },
-  { id: '2', label: '业务主管已驳回', type: 'danger' },
-  { id: '3', label: '业务主管越线通过', type: 'warning' },
-  { id: '4', label: '取消议价', type: 'info' }
+  { id: '1', label: '待供应商上传付款凭证', type: '' },
+  { id: '2', label: '待平台审核', type: '' },
+  { id: '3', label: '平台驳回', type: '' },
+  { id: '4', label: '待供应商上传发票抬头', type: '' },
+  { id: '5', label: '待平台上传发票', type: '' },
+  { id: '6', label: '待供应商确认发票', type: '' },
+  { id: '7', label: '平台结算完成', type: 'success' },
   // 已选完商品,取消议价
 ]
 const editColumns = [
   {
-    prop: 'todo',
+    prop: 'settle_code',
     label: '平台订单编号',
     span: 8
   },
 
   {
-    prop: 'todo',
+    prop: 'reqCode',
     label: '业务订单编号',
     span: 8
   },
   {
-    prop: 'todo',
+    prop: 'createtime',
     label: '创建时间',
     span: 8
   },
   {
-    prop: 'todo',
+    prop: 'service_amount',
     label: '总金额',
     span: 8
   },
 
   {
-    prop: 'todo',
+    prop: 'wpay_amount',
     label: '未回款金额',
     span: 8
   },
   {
-    prop: 'todo',
+    prop: 'apay_amount',
     label: '已回款金额',
     span: 8
   },
@@ -46,12 +48,12 @@ const editColumns = [
     span: 8
   },
   {
-    prop: 'todo',
+    prop: 'ainv_fee',
     label: '已开票金额',
     span: 8
   },
   {
-    prop: 'todo',
+    prop: 'winv_fee',
     label: '未开票金额',
     span: 8
   }
@@ -66,72 +68,72 @@ const demandOrderColumns = [
 ]
 const listCol = [
   {
-    prop: 'todo',
+    prop: 'settle_code',
     label: '平台结算编号',
-    width: '155'
+    minWidth: '155'
   },
 
   {
-    prop: 'todo',
+    prop: 'reqCode',
     label: '需求订单编号',
-    width: '155'
+    minWidth: '155'
   },
 
   {
-    prop: 'todo',
+    prop: 'supplierName',
     label: '供应商',
-    width: '120px'
-  },
-  {
-    prop: 'todo',
-    label: '平台结算编码',
-    width: '155'
+    minWidth: '120px'
   },
+  // {
+  //   prop: 'todo',
+  //   label: '平台结算编码',
+  //   width: '155'
+  // },
 
   {
-    prop: 'todo',
+    prop: 'service_amount',
     label: '平台结算金额',
-    width: '100px'
+    minWidth: '100px'
   },
   {
     prop: 'todo',
-    label: '回款状态',
-    width: '125px',
+    label: '状态',
+    minWidth: '130px',
     _slot_:'status',
   },
   {
-    prop: 'todo',
+    prop: 'apay_amount',
     label: '已回款金额',
     'min-width': '100px'
   },
+  // {
+  //   prop: 'todo',
+  //   label: '回款中金额',
+  //   'min-width': '100px'
+  // },
   {
-    prop: 'todo',
-    label: '回款中金额',
-    'min-width': '100px'
-  },
-  {
-    prop: 'todo',
+    prop: 'wpay_amount',
     label: '未回款金额',
     minWidth: '100px'
   },
+  // {
+  //   prop: 'creater',
+  //   label: '开票状态',
+  //   _slot_:'status',
+  //   minWidth: '120px'
+  // },
   {
-    prop: 'creater',
-    label: '开票状态',
-    _slot_:'status',
-    minWidth: '120px'
-  },
-  {
-    prop: 'todo',
+    prop: 'ainv_fee',
     label: '已开票金额',
     minWidth: '100px'
   },
+  // {
+  //   prop: 'todo',
+  //   label: '开票中金额',
+  //   minWidth: '100px'
+  // },
   {
-    prop: 'todo',
-    label: '开票中金额',
-    minWidth: '100px'
-  },
-  {
-    prop: 'todo',
+    prop: 'winv_fee',
     label: '未开票金额',
     minWidth: '100px'
   },

+ 89 - 47
src/views/platformService/settlement/components/waitSupplierUpload.vue

@@ -1,93 +1,138 @@
 <template>
-  <el-form ref="ruleForm" :rules="rules" :model="ruleForm" label-position="left" label-width="80px" size="mini">
-    <ul style="display:flex">
-      <li style="width:500px;margin-right:10px">
-        <el-form-item label="发票抬头" prop="invoiceTitle">
-          <el-input v-model="ruleForm.invoiceTitle" style="width:400px" />
-        </el-form-item>
+  <el-form ref="ruleForm" :rules="rules" :model="ruleForm" label-position="left" label-width="95px" size="mini" v-loading="loading">
+      <el-row gutter="20">
+        <el-col :span="12">
+          <el-form-item label="发票类型" prop="invoice_type">
+            <el-select v-model="ruleForm.invoice_type" style="width:100%" placeholder="发票类型">
+              <el-option 
+                v-for="invoice in invoiceTypeList" 
+                :key="invoice.value" 
+                :value="invoice.value" 
+                :label="invoice.label"  
+              />
+            </el-select>
+          </el-form-item>
 
-        <show-data-table 
-          :sitem="{}"
-          style="padding: -5px 0 10px 0"
-          :newTime="newTime"
-          :columns="invoiceColumns"
-        />
-      </li>
 
-      <li style="500px">
-        <el-form-item label="发票类型" prop="invoiceType">
-          <el-select v-model="ruleForm.invoiceType" style="width:400px" placeholder="发票类型">
-            <el-option />
-          </el-select>
-        </el-form-item>
+          <el-form-item label="备注" prop="remark">
+            <el-input placeholder="备注" v-model="ruleForm.remark" style="width:100%" type="textarea" />
+          </el-form-item>
+        </el-col>
 
-        <el-form-item label="备注" prop="remark">
-          <el-input placeholder="备注" v-model="ruleForm.remark" style="width:400px" type="textarea" />
-        </el-form-item>
-      </li>
-    </ul>
+        <el-col :span="12">
+          <el-form-item label="发票抬头" prop="invoice_id">
+            <search-invoice-title 
+              :value.sync="ruleForm.invoice_id" 
+              @change="_invoiceInfo => invoiceInfo = _invoiceInfo" 
+              style="width:100%"
+              placeholder="请选择发票抬头" 
+            >
+    
+            </search-invoice-title>
+          </el-form-item>
+
+          <show-data-table 
+            v-if="invoiceInfo"
+            :sitem="invoiceInfo"
+            style="padding: -5px 0 10px 0"
+            :newTime="newTime"
+            :columns="invoiceColumns"
+          />
+        </el-col>
+      </el-row>
 
-    <div style="width:980px;display:flex;justify-content:flex-end;margin-bottom:10px">
+    <div style="display:flex;justify-content:flex-end;margin-bottom:10px">
       <el-button size="mini" type="primary" @click="onSubmit">保存</el-button>
     </div>
-    
   </el-form>
 </template>
 
 <script>
-/**
- * @props
- * 发票抬头 invoiceTitle
- * 发票类型 invoiceType
- * 备注 remark
-*/
+import demandRequest from "@/apis/service/customerService/demandOrder";
+import { demandStatusOptions, invoiceTypeList } from '@/assets/js/statusList'
+import asyncRequest from "@/apis/service/customerService/invoiceApply";
+
+  /** 
+  * @props
+  * req_id 需求订单
+    invoice_id /发票抬头
+    invoice_type 发票类型
+    total_amount 申请总金额
+    remark // 备注
+  */
+
 export default {
-  name:'WaitSupplierUpload',
+  name:'CreateInvoiceNode',
+  props:['isApply'],  //isApply 是否为创建开票申请
   data(){
       return {
+        loading: false,
+        demandStatusOptions,
+        invoiceTypeList,
+        demandInfo : null,
+        invoiceInfo: null,
+        demandVisible:false,
           invoiceColumns:[
             {
-              prop: 'todo',
+              prop: 'title',
               label: '抬头',
               span:24
             },
             {
-              prop: 'todo',
+              prop: 'tax_no',
               label: '纳税人识别号',
               span:24
             },
             {
-              prop: 'todo',
+              prop: 'tel',
               label: '地址、电话',
-              span:24
+              span:24,
+              // _slot_: 'tel'
             },
             {
-              prop: 'todo',
+              prop: 'bank_account',
               label: '开户行及账号',
               span:24
             }
           ],
           newTime:"",
+          demandVisible: false,
           ruleForm:{
-            invoiceType:'',
-            invoiceTitle:"",
-            remark:""
+            req_id:"",
+            invoice_id:"", //发票抬头
+            invoice_type:"", //发票类型
+            total_amount:"", //申请总金额
+            remark:"", // 备注
           },
           rules:{
-            invoiceTitle:[
+            invoice_id:[
               {
                 required:true,
                 trigger:'change',
                 message:'请输入发票抬头'
               }
             ],
-            invoiceType:[
+            req_id:[
+               {
+                required:true,
+                trigger:'change',
+                message:'请选择需求订单'
+              }
+            ],
+            invoice_type:[
               {
                 required:true,
                 trigger:'change',
                 message:'请选择发票类型'
               }
             ],
+            total_amount:[
+              {
+                required:true,
+                trigger:'change',
+                message:'请输入申请总金额'
+              }
+            ],
             remark:[
               {
                 required:true,
@@ -103,13 +148,10 @@ export default {
       try {
         await this.$refs.ruleForm.validate()
         this.$emit('confirm',this.ruleForm)
-      }catch(err){
+        }catch(err){
         console.log(err)
       }
     },
-    number_change(e) {
-      this.ruleForm[mapFields.applyAmount] = e || 0
-    },
   }
 }
 </script>

+ 78 - 67
src/views/platformService/settlement/detail.vue

@@ -1,60 +1,54 @@
 <template>
   <div class="bargainListDetail">
-    <div class="bargainListDetail-main" v-if="powers.some((i) => i == '007')">
+    <div class="bargainListDetail-main">
       <el-tabs v-model="projectTabs" v-loading="loading">
         <el-tab-pane label="平台订单详情" name="1">
           <el-collapse v-model="activeNames" style="margin: -18px 0 0 0">
             <el-collapse-item :title="'平台订单详情'" name="1">
               <show-data-table
                 style="padding: -5px 0 10px 0"
+                :columns="editColumns"
                 :newTime="newTime"
-                v-if="newTime !== ''"
                 :sitem="sitem"
-                :columns="editColumns"
               >
-                <template slot="status">
+                <template #status>
                   <el-tag
                     :size="tablebtnSize"
                     :type="
-                      (statusList.find((item) => item.id == sitem.status) || {}).type ||
-                      ''
+                      (statusList.find((item) => item.id == sitem.status) || {})
+                        .type || ''
                     "
                     v-text="
-                      (statusList.find((item) => item.id == sitem.status) || {}).label ||
-                      '--'
+                      (statusList.find((item) => item.id == sitem.status) || {})
+                        .label || '--'
                     "
                   ></el-tag>
                 </template>
               </show-data-table>
             </el-collapse-item>
             <el-collapse-item title="需求订单详情" name="2">
-              <show-data-table
-                style="padding: -5px 0 10px 0"
-                :newTime="newTime"
-                v-if="newTime !== ''"
-                :sitem="sitem"
-                :columns="demandOrderColumns"
-              />
+              <demand-detail id="2" />
+            </el-collapse-item>
+
+            <el-collapse-item title="待供应商上传凭证" name="3" v-if="Number(sitem.status) === 1" v-loading="Statusloading">
+              <credentials-node @confirm="hanleSupplierUpload" />
             </el-collapse-item>
 
-            <el-collapse-item title="待供应商上传凭证" name="3">
-              <normal-node />
+            <el-collapse-item title="待平台审核付款凭证" name="3" v-if="Number(sitem.status) === 2" v-loading="Statusloading">
+              <normal-node  @confirm="handlePlatformPay" />
             </el-collapse-item>
 
-            <el-collapse-item title="待供应商上传发票要求" name="4">
-              <wait-supplier-upload />
+            <el-collapse-item title="待供应商上传发票要求" name="4" v-if="Number(sitem.status) === 4" v-loading="Statusloading">
+              <wait-supplier-upload @confirm="handleUploadInvoiceReq" />
             </el-collapse-item>
 
-            <el-collapse-item title="发票管理" name="5">
-              <upload-invoice-node />
+            <el-collapse-item title="发票管理" name="5" v-if="Number(sitem.status) === 5">
+              <upload-invoice-node :requestMethod="handleUploadInvoce" />
             </el-collapse-item>
           </el-collapse>
         </el-tab-pane>
       </el-tabs>
     </div>
-    <div v-else>
-      <no-auth></no-auth>
-    </div>
   </div>
 </template>
 <script>
@@ -105,7 +99,8 @@ export default {
       queryType: "",
       queryId: "",
       status: "",
-      sitem: null,
+      sitem: {},
+      Statusloading: false,
 
       orderItem: {},
       moneyDirItem: {},
@@ -126,7 +121,61 @@ export default {
       await this.initData();
       this.loading = false;
     },
+    async handleUploadInvoce(invoiceList){
+      const params = {
+        invoiceList,
+        id:this.queryId
+      }
+
+      const result = await asyncRequest.upload(params)
+
+      if(result.code === 1){
+        this.initForm()
+      }
+
+      return result
+    },
+    async hanleSupplierUpload({credentials}){
+      const pay_proof = credentials.join(',')
+
+      this.Statusloading = true
+      const { code } = await asyncRequest.status({
+        status:2,
+        pay_proof,
+        id:this.queryId
+      })
+
+      this.Statusloading= false
+
+      if(code !== 1) return
+      this.initForm()
+    },
+    async handleUploadInvoiceReq({ invoice_type, invoice_id, remark:invoice_remark }){
+      this.Statusloading = true
+      const { code } = await asyncRequest.status({
+        status:5,
+        id:this.queryId,
+        invoice_id,
+        invoice_type,
+        invoice_remark
+      })
+      this.Statusloading = false
+      if(code !== 1) return
+      this.initForm()
+    },
+    async handlePlatformPay({status,remark}){
+      this.Statusloading = true
+      const { code } = await asyncRequest.status({
+        id: this.queryId,
+        status: String(status) === "1" ? "4" : "3",
+        remark
+      })
 
+      this.Statusloading= false
+
+      if(code !== 1) return
+      this.initForm()
+    },
     handleClick(row) {
       console.log(row);
     },
@@ -136,50 +185,12 @@ export default {
     async initData() {
       this.loading = true;
       const { code, message, data } = await asyncRequest.detail({
-        bargainNo: this.queryId,
+        id: this.queryId,
       });
-
-      this.eaxmList = [];
       this.loading = false;
-      if (code === 0) {
-        this.sitem = JSON.parse(JSON.stringify(data));
-
-        const { status, exam_info } = this.sitem;
-        this.orderItem = {};
-        this.moneyDirItem = {};
-        this.moneyItem = {};
-        this.BossItem = {};
-        if (exam_info && exam_info.length > 0) {
-          exam_info.forEach((e) => {
-            console.log(e.status);
-            switch (e.info_status + "") {
-              case "0":
-                this.orderItem = JSON.parse(JSON.stringify(e));
-                break;
-              case "2":
-                this.moneyDirItem = JSON.parse(JSON.stringify(e));
-                break;
-              case "4":
-                this.moneyItem = JSON.parse(JSON.stringify(e));
-                break;
-              case "7":
-                this.BossItem = JSON.parse(JSON.stringify(e));
-                break;
-              default:
-                this.orderItem = JSON.parse(JSON.stringify(e));
-            }
-          });
-          this.eaxmList = JSON.parse(JSON.stringify(exam_info));
-        }
-
-        this.status = status;
-
-        this.getNewTime();
-      } else if (code >= 100 && code <= 104) {
-        await this.logout();
-      } else {
-        this.$message.warning(message);
-      }
+      if(code !== 1) return
+      this.sitem = data;
+      this.getNewTime()
     },
     getNewTime() {
       this.newTime = new Date().valueOf();

+ 4 - 9
src/views/platformService/settlement/index.vue

@@ -153,16 +153,12 @@
         </template>
         <template #operation="{ scope }">
           <el-tooltip
-            v-if="powers.some((i) => i == '007')"
             effect="dark"
             content="详情"
             placement="top"
           >
-            <i
-              class="el-icon-view tb-icon"
-              
-               @click="getRouter('settlementDetail', scope.row.bargainNo )"
-            ></i>
+            <i class="el-icon-view tb-icon" @click="getRouter('settlementDetail', scope.row.id )"
+            />
           </el-tooltip>
         </template>
       </ex-table>
@@ -266,6 +262,7 @@ export default {
 
   methods: {
     getRouter(toRouter, queryId){
+      console.log(toRouter,queryId)
       if (toRouter && queryId) {
         let model = {
           id: queryId,
@@ -355,11 +352,9 @@ export default {
         ...this.parmValue,
       });
 
-      if (res && res.code === 0 && res.data) {
+      if (res && res.code === 1 && res.data) {
         this.tableData = res.data.list;
         this.pageInfo.total = Number(res.data.count);
-      } else if (res && res.code >= 100 && res.code <= 104) {
-        await this.logout();
       } else {
         this.tableData = [];
         this.pageInfo.total = 0;