lilei 1 năm trước cách đây
mục cha
commit
21a84c2258

+ 24 - 0
src/api/salesNew.js

@@ -22,6 +22,20 @@ export const salesList = (params) => {
         }
     })
 }
+//  销售 待转费用单列表  有分页
+export const salesConvertExpenseList = (params) => {
+    const url = `/salesPromo/queryBatchConvertExpenseAccountPage/${params.pageNo}/${params.pageSize}`
+    delete params.pageNo
+    delete params.pageSize
+    return axios({
+        url: url,
+        data: params,
+        method: 'post',
+        headers:{
+          'module': encodeURIComponent('待转费用报销单列表')
+        }
+    })
+}
 //  销售 新增
 export const salesSave = (params) => {
     return axios({
@@ -214,6 +228,16 @@ export const queryCreateBySalesBillSn = (params) => {
     method: 'post'
   })
 }
+
+// 批量查询可生成的费用报销单
+export const queryBatchCreateBySalesBillSn = (params) => {
+  return axios({
+    url: `/expenseAccount/queryBatchCreateBySalesPromoSnList`,
+    data: params,
+    method: 'post'
+  })
+}
+
 // 保存费用报销单
 export const expenseAccountSave = (params) => {
   return axios({

+ 3 - 2
src/views/expenseManagement/expenseReimbursement/add.vue

@@ -211,8 +211,9 @@ export default {
         { title: '所属省份', dataIndex: 'provinceName', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
         { title: '所属城市', dataIndex: 'cityName', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
         { title: '记账费用', dataIndex: 'expense', align: 'center', width: '10%', customRender: function (text) { return (text == 0 || text) ? _this.toThousands(text) : '--' } },
-        { title: '费用承担方', scopedSlots: { customRender: 'fycdf' }, align: 'center', width: '20%' },
-        { title: '产品信息', scopedSlots: { customRender: 'cpxx' }, align: 'center', width: '15%' },
+        { title: '费用承担方', scopedSlots: { customRender: 'fycdf' }, align: 'center', width: '15%' },
+        { title: '产品信息', scopedSlots: { customRender: 'cpxx' }, align: 'center', width: '12%' },
+        { title: '销售单号', dataIndex: 'salesBillNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '备注', dataIndex: 'remarks', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '100px', align: 'center' }
       ]

+ 5 - 4
src/views/expenseManagement/expenseReimbursement/detail.vue

@@ -146,10 +146,11 @@ export default {
         { title: '所属分区', dataIndex: 'subareaAreaName', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '所属省份', dataIndex: 'provinceName', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
         { title: '所属城市', dataIndex: 'cityName', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
-        { title: '记账费用', dataIndex: 'expense', align: 'right', width: '10%', customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' } },
-        { title: '费用承担方', scopedSlots: { customRender: 'fycdf' }, align: 'center', width: '15%' },
-        { title: '产品信息', scopedSlots: { customRender: 'cpxx' }, align: 'center', width: '15%' },
-        { title: '备注', dataIndex: 'remarks', align: 'center', width: '10%', customRender: function (text) { return text || '--' } }
+        { title: '记账费用', dataIndex: 'expense', align: 'right', width: '8%', customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' } },
+        { title: '费用承担方', scopedSlots: { customRender: 'fycdf' }, align: 'center', width: '14%' },
+        { title: '产品信息', scopedSlots: { customRender: 'cpxx' }, align: 'center', width: '12%' },
+        { title: '销售单号', dataIndex: 'salesBillNo', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '备注', dataIndex: 'remarks', align: 'center', width: '8%', customRender: function (text) { return text || '--' } }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {

+ 86 - 113
src/views/salesManagement/waitCostOrder/list.vue

@@ -8,21 +8,23 @@
       </a-page-header>
       <a-card size="small" :bordered="false" class="pages-wrap">
         <!-- 查询 -->
-        <div class="table-page-search-wrapper">
+        <div class="table-page-search-wrapper" ref="searchbox">
           <div style="display: flex;justify-content: space-between;align-items: center;">
             <div style="flex-grow: 1;width: 60%;">
               <a-form layout="inline" @keyup.enter.native="searchTable">
                 <a-row :gutter="15" type="flex">
                   <a-col flex="300px">
                     <a-form-item label="促销名称/简称">
-                      <a-input v-model.trim="queryParam.queryWord" allowClear placeholder="请输入促销名称/简称"/>
+                      <a-input v-model.trim="queryParam.promotionDescription" allowClear placeholder="请输入促销名称/简称"/>
                     </a-form-item>
                   </a-col>
                   <a-col flex="300px">
                     <a-form-item label="费用类型">
-                      <a-select v-model="queryParam.expenseOption" placeholder="请选择费用类型" allowClear>
-                        <a-select-option v-for="item in expenstype" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
-                      </a-select>
+                      <v-select
+                        v-model="queryParam.convertExpenseAccountType"
+                        code="CONVERT_EXPENSE_ACCOUNT_TYPE"
+                        placeholder="请选择费用类型"
+                        allowClear></v-select>
                     </a-form-item>
                   </a-col>
                   <a-col flex="300px">
@@ -37,11 +39,11 @@
                   </a-col>
                   <a-col flex="300px">
                     <a-form-item label="规则简称">
-                      <a-input v-model.trim="queryParam.description" allowClear placeholder="请输入规则简称"/>
+                      <a-input v-model.trim="queryParam.promotionRuleDescription" allowClear placeholder="请输入规则简称"/>
                     </a-form-item>
                   </a-col>
                   <a-col flex="150px">
-                    <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
+                    <a-button type="primary" :disabled="disabled" @click="searchForm">查询</a-button>
                     <a-button style="margin-left: 10px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
                   </a-col>
                 </a-row>
@@ -50,15 +52,21 @@
           </div>
         </div>
         <!-- 产品列表 -->
+        <div style="padding:0 0 5px;">
+          <span>
+           已选  <template v-if="rowSelectionInfo && rowSelectionInfo.selectedRowKeys.length>0">{{ rowSelectionInfo.selectedRowKeys.length }}</template><template v-else>0</template> 项
+          </span>
+        </div>
         <div>
            <s-table
              class="sTable fixPagination"
              ref="table"
              :style="{ height: pageHeight+67+'px' }"
              size="small"
-             :rowKey="(record) => record.id"
+             :rowKey="(record) => record.no"
+             rowKeyName="no"
              :columns="columns"
-             :row-selection="{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: record.state == 'CANCEL' } }) }"
+             :row-selection="{ columnWidth: 40, getCheckboxProps: record => ({ props: { disabled: curExpenseAccountType ? record.convertExpenseAccountType != curExpenseAccountType : false } }) }"
              @rowSelection="rowSelectionFun"
              :data="loadData"
              :scroll="{ y: pageHeight }"
@@ -71,7 +79,7 @@
                    size="small"
                    type="link"
                    class="button-warning"
-                   @click="handleExpense(record)"
+                   @click="handleSave(record)"
                  >转费用报销单</a-button>
                </div>
              </template>
@@ -82,7 +90,7 @@
     <div class="affix-cont" :style="{padding:hideFooter?0:'7px 0 4px'}">
       <a-button
         style="width: 100px;"
-        :disabled="spinning"
+        :disabled="!hasSelect"
         type="primary"
         class="button-info"
         @click="handleView()"
@@ -100,6 +108,8 @@
     </div>
     <!-- 新增费用单 -->
     <baseDataModal ref="expenseModal" @expenseSaveOk="expenseSaveOk" :show="openBaseModal" @close="openBaseModal=false"></baseDataModal>
+    <!-- 查看已选费用单 -->
+    <viewSelectModal ref="viewModal" :openModal="showViewModal" @close="showViewModal=false"></viewSelectModal>
   </div>
 </template>
 
@@ -109,11 +119,12 @@ import moment from 'moment'
 import { STable, VSelect } from '@/components'
 import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
 import baseDataModal from '@/views/expenseManagement/expenseReimbursement/baseDataModal.vue'
-import { salesList, expenseAccountSave, queryCreateBySalesBillSn } from '@/api/salesNew'
+import viewSelectModal from './viewSelectModal.vue'
+import { salesConvertExpenseList, expenseAccountSave, queryBatchCreateBySalesBillSn } from '@/api/salesNew'
 export default {
   name: 'WaitCostOrder',
   mixins: [commonMixin],
-  components: { STable, VSelect, dealerSubareaScopeList, baseDataModal },
+  components: { STable, VSelect, dealerSubareaScopeList, baseDataModal, viewSelectModal },
   data () {
     return {
       spinning: false,
@@ -122,26 +133,12 @@ export default {
       openBaseModal: false, // 费用弹框
       fromRouter:'',
       authCode:'',
-      expenstype: [
-        {
-          id: 'balance',
-          name: '结余'
-        },
-        {
-          id: 'exceed',
-          name: '超出'
-        },
-        {
-          id: 'giftConvertAmount',
-          name: '转采'
-        }
-      ],
       queryParam: {
-        queryWord: '',
-        expenseOption: '',
+        promotionDescription: '',
+        convertExpenseAccountType: '',
         salesBillNo: '',
-        description: '',
-        buyerSn: ''
+        promotionRuleDescription: '',
+        buyerName: ''
       },
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -149,13 +146,8 @@ export default {
         this.spinning = true
         delete parameter.tableId
         delete parameter.index
-        if (parameter.sortOrder) {
-          parameter['sortAlias'] = 'sales_bill'
-        } else {
-          delete parameter.sortField
-        }
-        this.queryParam.expenseClainFlag = "N"
-        return salesList(Object.assign(parameter, this.queryParam)).then(res => {
+        this.getPageHeight()
+        return salesConvertExpenseList(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -170,24 +162,27 @@ export default {
         })
       },
       rowSelectionInfo: null,
+      curExpenseAccountType:'',
+      pageHeight: 300,
+      showViewModal: false
     }
   },
   computed: {
-    pageHeight () {
-      return window.innerHeight - 315 + (this.hideFooter ? 45 : 0)
+    hasSelect(){
+      return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length
     },
     columns () {
       const _this = this
       const arr = [
         { title: '编号', dataIndex: 'no', width: '5%', align: 'center', customRender: function (text) { return text || '--' }},
         { title: '销售单号', dataIndex: 'salesBillNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '客户名称', dataIndex: 'buyerName', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '费用类型', scopedSlots: { customRender: 'warehouseBox' }, width: '8%', align: 'left', ellipsis: true },
+        { title: '客户名称', dataIndex: 'buyerName', width: '16%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '费用类型', dataIndex: 'convertExpenseAccountTypeDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' }},
         { title: '待转金额', dataIndex: 'totalAmount', width: '8%', align: 'right',customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '促销名称', dataIndex: 'settleStyleSnDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '促销简称', dataIndex: 'auditDate', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
-        { title: '规则简称', dataIndex: 'lastStockUpDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
-        { title: '规则类型', dataIndex: 'billStatusDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '促销名称', dataIndex: 'promotionTitle', width: '17%', align: 'left', customRender: function (text) { return text || '--' } },
+        { title: '促销简称', dataIndex: 'promotionDescription', width: '17%', align: 'left', customRender: function (text) { return text || '--' }, sorter: true },
+        { title: '规则简称', dataIndex: 'promotionRuleDescription', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, sorter: true },
+        { title: '规则类型', dataIndex: 'promotionRuleTypeDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
       ]
       return arr
@@ -198,71 +193,47 @@ export default {
     handleBack () {
       this.$router.push({ name: 'salesQueryNewList' })
     },
+    getPageHeight () {
+      this.pageHeight = window.innerHeight - 290 - ( this.$refs.searchbox ? this.$refs.searchbox.clientHeight : 0 );
+    },
     // 表格选中项
     rowSelectionFun (obj) {
       this.rowSelectionInfo = obj || null
+      this.curExpenseAccountType = obj.selectedRows&&obj.selectedRows[0]&&obj.selectedRows[0]['convertExpenseAccountType'] || ''
     },
     custChange (val) {
-      this.queryParam.buyerSn = val.key
+      this.queryParam.buyerName = val.name || ''
     },
-    // 转费用单
-    async handleExpense (row) {
+    // 提交
+    handleSave(row){
       const _this = this
-      const hasExpense = await queryCreateBySalesBillSn({ salesBillSn: row.salesBillSn }).then(res => res.data || [])
-      const showModalFlag = []
-      const optionsKey = [
-        {
-          id: 'balance',
-          name: '采购额结余'
-        },
-        {
-          id: 'exceed',
-          name: '采购额超出'
-        },
-        {
-          id: 'giftConvertAmount',
-          name: '促销产品转采购额'
-        }
-      ]
-      optionsKey.map(key => {
-        if (hasExpense[key.id]) {
-          showModalFlag.push(key)
-        }
-      })
-    
-      if (showModalFlag.length) {
-        // 直接转费用单
-        if (showModalFlag.length == 1) {
-          _this.expenseSave(hasExpense[showModalFlag[0].id])
-        }
-        // 有2个以上采购额时
-        if (showModalFlag.length > 1) {
-          _this.$confirm({
-            title: '转费用报销单?',
-            centered: true,
-            class: 'confirm-center',
-            content: <div>
-              <div style="padding:10px 0;text-align:center;">请选择费用报销单类型</div>
-              <div style="padding:0 0 10px 0;text-align:center;">
-                <aRadioGroup onChange={_this.changeDaOpt}>
-                  {showModalFlag.map(item => <aRadio key={item.id} style="height: '30px';lineHeight: '30px';padding:5px 0;" value={item.id}>{item.name}</aRadio>)}
-                </aRadioGroup>
-              </div>
-            </div>,
-            onOk () {
-              if (_this.expenseOption) {
-                _this.expenseSave(hasExpense[_this.expenseOption])
-              } else {
-                _this.$message.info('请选择费用报销单类型!')
-                return true
-              }
-            },
-            onCancel () {
-              _this.expenseOption = null
-            }
-          })
+      const salesPromoSnList = []
+      // 单个转
+      if(row){
+        salesPromoSnList.push(row.salesPromoSn)
+      }else{
+        const slen = _this.rowSelectionInfo.selectedRowKeys.length
+        if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && slen < 1)) {
+          _this.$message.warning('请在列表勾选后再进行批量操作!')
+          return
         }
+        // 批量转
+        this.rowSelectionInfo.selectedRows.map(item => {
+          salesPromoSnList.push(item.salesPromoSn)
+        })
       }
+      
+      this.handleExpense(salesPromoSnList)
+    },
+    // 转费用单
+    async handleExpense (snList) {
+      const _this = this
+      const hasExpense = await queryBatchCreateBySalesBillSn({ salesPromoSnList: snList }).then(res => res.data || [])
+      let result = null
+      for(let key in hasExpense){
+        result = hasExpense[key]
+      }
+      _this.expenseSave(result)
     },
     // 转费用单
     expenseSave (data) {
@@ -276,29 +247,31 @@ export default {
       expenseAccountSave(params).then(res => {
         if (res.status == 200) {
           this.$message.info(res.message)
-          this.$refs.table.refresh()
           this.openBaseModal = false
-          this.expenseOption = null
-          this.$router.push({ name: 'expenseReimbursementEdit', params: { sn: res.data.expenseAccountSn } })
+          this.searchForm()
         }
       })
     },
     // 查看
     handleView () {
-    },
-    // 提交
-    handleSave(){
-      
+      this.showViewModal = true
+      this.$refs.viewModal.setData(this.rowSelectionInfo&&this.rowSelectionInfo.selectedRows)
     },
     //  重置
     resetSearchForm () {
-       this.queryParam.buyerSn = undefined
-       this.queryParam.expenseOption = undefined
+       this.queryParam.buyerName = undefined
+       this.queryParam.convertExpenseAccountType = undefined
        this.queryParam.salesBillNo = ''
-       this.queryParam.queryWord = ''
-       this.queryParam.description = ''
+       this.queryParam.promotionDescription = ''
+       this.queryParam.promotionRuleDescription  = ''
+       this.$refs.dealerSubareaScopeList.resetForm()
        this.$refs.table.refresh(true)
+       this.$refs.table.clearSelected()
     },
+    searchForm(){
+      this.$refs.table.refresh(true) 
+      this.$refs.table.clearSelected()
+    }
   },
   mounted () {
     if (!this.$store.state.app.isNewTab || this.bizSn) { // 页签刷新时调用

+ 99 - 0
src/views/salesManagement/waitCostOrder/viewSelectModal.vue

@@ -0,0 +1,99 @@
+<template>
+  <a-modal centered :footer="null" :maskClosable="false" title="已选待转费用报销单" v-model="isShow" @cancel="isShow=false"
+    width="70%">
+    <div style="padding:10px;">共{{dataSource&&dataSource.length}}条</div>
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div>
+        <ve-table
+            border-y
+            v-show="!showEmpty"
+            :scroll-width="0"
+            :max-height="tableHeight"
+            :row-style-option="{clickHighlight: true}"
+            :cellSelectionOption="{enable: false}"
+            :virtual-scroll-option="{enable: true}"
+            :columns="columns"
+            :table-data="dataSource"
+            row-key-field-name="no"
+            :column-width-resize-option="columnWidthResizeOption"
+          />
+        <div v-show="showEmpty" class="empty-data"><a-empty description="暂无数据" :image="simpleImage"/></div>
+      </div>
+      <div class="btn-cont" style="padding:20px 20px 0;text-align: center;">
+        <a-button style="margin-left: 10px" @click="isShow=false">关闭</a-button>
+      </div>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+  import {
+    commonMixin
+  } from '@/utils/mixin'
+  import { Empty } from 'ant-design-vue';
+  export default {
+    name: 'ViewSelectModal',
+    mixins: [commonMixin],
+    props: {
+      openModal: {
+        type: Boolean,
+        default: false
+      },
+    },
+    data() {
+      const _this = this
+      return {
+        spinning: false,
+        isShow: this.openModal,
+        simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
+        columnWidthResizeOption: {
+            // default false
+            enable: true,
+            // column resize min width
+            minWidth: 50
+        },
+        showEmpty: false,
+        tableHeight: 450,
+        dataSource: []
+      }
+    },
+    computed: {
+      columns() {
+        const arr =  [
+                { title: '序号', field: 'no',key: "a", width: 50, align: 'center',operationColumn: false, renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--' } },
+                { title: '销售单号', field: 'salesBillNo',key: "b", width: 100, align: 'left',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'} },
+                { title: '客户名称', field: 'buyerName',key: "c", width: 150, align: 'left',operationColumn: false , ellipsis: { showTitle: true },renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}},
+                { title: '费用类型', field: 'convertExpenseAccountTypeDictValue',key: "d", width: 100, align: 'center',operationColumn: false,ellipsis: { showTitle: true },renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'} },
+                { title: '待转金额', field: 'totalAmount',key: "e", width: 80, align: 'right',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}},
+                { title: '促销名称', field: 'promotionTitle',key: "f", width: 150, align: 'left',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}},
+                { title: '促销简称', field: 'promotionDescription',key: "g", width: 150, align: 'left',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}},
+                { title: '规则简称', field: 'promotionRuleDescription',key: "h", width: 150, align: 'center',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}},
+                { title: '规则类型', field: 'promotionRuleTypeDictValue',key: "l", width: 100, align: 'center',operationColumn: false,renderBodyCell: ({ row, column, rowIndex }, h) => { return row[column.field] || '--'}}
+            ]
+        return arr
+      }
+    },
+    methods: {
+       setData(list){
+         this.dataSource = JSON.parse(JSON.stringify(list))
+         this.dataSource.map((item,index) => {
+           item.no = index + 1
+         })
+       }
+    },
+    watch: {
+      openModal(nVal, oVal) {
+        this.isShow = nVal
+      },
+      isShow(nVal, oVal) {
+        if (!nVal) {
+          this.$emit('close')
+          this.dataSource = []
+        }
+      }
+    }
+  }
+</script>
+
+<style>
+</style>