Browse Source

合并单据

lilei 11 months ago
parent
commit
4d2e8ab7c7

+ 10 - 9
src/views/expenseManagement/expenseReimbursement/baseDataModal.vue

@@ -174,12 +174,12 @@ export default {
         if (this.expenseAccountSn) { //  编辑页
           this.getDetail()
           this.title = '编辑费用报销单'
-        }else{
+        } else {
           this.title = '新增费用报销单'
         }
       })
     },
-    retsetForm(){
+    retsetForm () {
       this.form = {
         applyPersonSn: undefined, // 申请人
         applyDepartmentSn: undefined, //  申请部门
@@ -238,19 +238,19 @@ export default {
       })
     },
     // 设置数据
-    setDetail(data, from){
+    setDetail (data, from) {
       console.log(data)
       this.spinning = false
       this.disabled = false
       this.fromPage = from
       this.form = Object.assign(this.form, data)
       // 获取附件列表
-      if(this.$refs.attachList){
+      if (this.$refs.attachList) {
         this.form.expenseAccountFilesList = ''
         this.attachList = data.expenseAccountFilesList
         this.$refs.attachList.setFileList(this.attachList)
       }
-      setTimeout(()=>{
+      setTimeout(() => {
         this.expenseTypes = data.expenseType ? [this.form.expenseType, this.form.expenseType2, this.form.expenseType3] : []
       }, 500)
     },
@@ -277,13 +277,14 @@ export default {
           const form = JSON.parse(JSON.stringify(_this.form))
           form.expenseDate = form.expenseDate + '-01'
           form.expenseAccountFilesList = this.attachList
-          _this.spinning = true
           console.log(form)
+          _this.spinning = true
           // 从销售单转的费用
-          if(_this.fromPage=='sales'){
-            _this.$emit('expenseSaveOk',form)
+          if (_this.fromPage == 'sales') {
+            _this.$emit('expenseSaveOk', form)
             return false
           }
+          // 手动建的费用单
           expenseAccountSave(form).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
@@ -311,7 +312,7 @@ export default {
       this.opened = newValue
       if (newValue) {
         this.pageInit()
-      }else{
+      } else {
         this.retsetForm()
       }
     },

+ 87 - 28
src/views/salesManagement/waitCostOrder/list.vue

@@ -91,54 +91,65 @@
     <div class="affix-cont" :style="{padding:hideFooter?0:'7px 0 4px'}">
       <a-button
         style="width: 100px;"
-        type="primary"
-        class="button-info"
+        type="info"
         @click="handleView()"
       >
-        查看
+        查看已选
       </a-button>
       <a-button
         type="primary"
+        class="button-info"
         :disabled="spinning"
         style="width: 100px;margin: 0 20px;"
         @click="handleSave()"
       >
         提交
       </a-button>
+      <a-button
+        type="primary"
+        :disabled="spinning"
+        style="width: 100px;"
+        @click="handleMerge()"
+      >
+        合并提交
+      </a-button>
     </div>
     <!-- 新增费用单 -->
     <baseDataModal ref="expenseModal" @expenseSaveOk="expenseSaveOk" :show="openBaseModal" @close="openBaseModal=false"></baseDataModal>
     <!-- 查看已选费用单 -->
-    <viewSelectModal ref="viewModal" :openModal="showViewModal" @close="showViewModal=false"></viewSelectModal>
+    <viewSelectModal ref="viewModal" :openModal="showViewModal" @close="showViewModal=false" @submit="meargeSubmit"></viewSelectModal>
+    <!-- 合并选项弹框 -->
+    <meargeOptionModal ref="meargeModal" :openModal="showMeargeModal" @close="showMeargeModal=false" @meargeOk="meargeOk"/>
   </div>
 </template>
 
 <script>
 import { commonMixin } from '@/utils/mixin'
-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 viewSelectModal from './viewSelectModal.vue'
+import meargeOptionModal from './meargeOptionModal.vue'
 import { salesConvertExpenseList, expenseAccountSave, queryBatchCreateBySalesBillSn } from '@/api/salesNew'
 export default {
   name: 'WaitCostOrder',
   mixins: [commonMixin],
-  components: { STable, VSelect, dealerSubareaScopeList, baseDataModal, viewSelectModal },
+  components: { STable, VSelect, dealerSubareaScopeList, baseDataModal, viewSelectModal, meargeOptionModal },
   data () {
     return {
       spinning: false,
       disabled: false,
-      hideFooter: false,
+      hideFooter: false, // 隐藏页面底部
       openBaseModal: false, // 费用弹框
-      fromRouter: '',
-      authCode: '',
+      showMeargeModal: false, // 合并选项弹框
+      fromRouter: '', // 从那个页面打开
+      authCode: '', // 数据权限码
       queryParam: {
-        promotionDescription: '',
-        convertExpenseAccountType: '',
-        salesBillNo: '',
-        promotionRuleDescription: '',
-        buyerName: ''
+        promotionDescription: '', // 销名称/简称
+        convertExpenseAccountType: '', // 费用类型
+        salesBillNo: '', // 销售单号
+        promotionRuleDescription: '', // 规则简称
+        buyerName: '' // 客户名称
       },
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -146,7 +157,7 @@ export default {
         this.spinning = true
         delete parameter.tableId
         delete parameter.index
-        this.getPageHeight()
+        this.getPageHeight() // 获取表格高度
         return salesConvertExpenseList(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           if (res.status == 200) {
@@ -161,14 +172,15 @@ export default {
           return data
         })
       },
-      rowSelectionInfo: null,
-      curExpenseAccountType: '',
-      pageHeight: 300,
-      showViewModal: false,
-      isSearch: false
+      rowSelectionInfo: null, // 已选行
+      curExpenseAccountType: '', // 当前已选费用类型
+      pageHeight: 300, // 默认页面高度
+      showViewModal: false, // 查看已选费用单
+      isSearch: false // 是否查询中
     }
   },
   computed: {
+    // 已选数据数量
     hasSelect () {
       return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length
     },
@@ -194,22 +206,23 @@ export default {
     handleBack () {
       this.$router.push({ name: 'salesQueryNewList' })
     },
+    // 页面高度计算
     getPageHeight () {
       this.pageHeight = window.innerHeight - 290 - (this.$refs.searchbox ? this.$refs.searchbox.clientHeight : 0)
     },
-    // 表格选中项
+    // 表格选中项,只能选中统一费用类型的
     rowSelectionFun (obj) {
-      console.log(obj)
       this.rowSelectionInfo = obj || null
       if (obj.selectedRows) {
         this.curExpenseAccountType = obj.selectedRows && obj.selectedRows[0] && obj.selectedRows[0]['convertExpenseAccountType'] || ''
+        // 没用勾选任何数据,刷新列表
         if (obj.selectedRows.length <= 1) {
           if (!this.isSearch) {
             this.$refs.table.refresh()
           }
           this.isSearch = false
         } else {
-          // 全选
+          // 全选,盘点是否类型一致,否则不能全选
           const ret = obj.selectedRows.filter(item => item.convertExpenseAccountType == this.curExpenseAccountType)
           if (ret.length != obj.selectedRows.length) {
             this.$message.warning('费用类型不一致,请重新勾选!')
@@ -218,10 +231,49 @@ export default {
         }
       }
     },
+    // 客户选中
     custChange (val) {
       this.queryParam.buyerName = val.name || ''
     },
-    // 提交
+    // 合并提交
+    handleMerge () {
+      const _this = this
+      const salesPromoSnList = []
+      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.showMeargeModal = true
+    },
+    // 确定合并
+    meargeOk (data) {
+      console.log(data)
+      // 打开已合并的待转费用报销单弹框
+      if (!this.hasSelect) {
+        this.$message.warning('请先勾选再合并提交!')
+        return
+      }
+      this.showViewModal = true
+      this.$refs.viewModal.title = '已合并的待转费用报销单'
+      this.$refs.viewModal.submitType = 'mearge'
+      this.$refs.viewModal.setData(this.rowSelectionInfo && this.rowSelectionInfo.selectedRows)
+    },
+    // 合并提交
+    meargeSubmit (data) {
+      const salesPromoSnList = []
+      data.map(item => {
+        salesPromoSnList.push(item.salesPromoSn)
+      })
+      // 打开转费用单弹框
+      this.handleExpense(salesPromoSnList)
+    },
+    // 直接不合并提交
     handleSave (row) {
       const _this = this
       const salesPromoSnList = []
@@ -231,7 +283,7 @@ export default {
       } else {
         const slen = _this.rowSelectionInfo.selectedRowKeys.length
         if (!_this.rowSelectionInfo || (_this.rowSelectionInfo && slen < 1)) {
-          _this.$message.warning('请在列表勾选后再进行批量操作!')
+          _this.$message.warning('请在列表勾选后再进行提交操作!')
           return
         }
         // 批量转
@@ -239,27 +291,34 @@ export default {
           salesPromoSnList.push(item.salesPromoSn)
         })
       }
-
+      // 打开转费用单弹框
       this.handleExpense(salesPromoSnList)
     },
     // 转费用单
     async handleExpense (snList) {
       const _this = this
+      this.spinning = true
       const hasExpense = await queryBatchCreateBySalesBillSn({ salesPromoSnList: snList }).then(res => res.data || [])
+
       let result = null
       for (const key in hasExpense) {
         result = hasExpense[key]
       }
+      // 关闭查看弹框
+      this.$refs.viewModal.spinning = false
+      this.showViewModal = false
+      // 转费用单弹框
       _this.expenseSave(result)
     },
-    // 转费用单
+    // 打开新建转费用单弹框
     expenseSave (data) {
-      console.log(data)
       if (data) {
         this.openBaseModal = true
         this.$refs.expenseModal.setDetail(data, 'sales')
+        this.spinning = false
       }
     },
+    // 转费用单成功
     expenseSaveOk (params) {
       expenseAccountSave(params).then(res => {
         if (res.status == 200) {

+ 69 - 0
src/views/salesManagement/waitCostOrder/meargeOptionModal.vue

@@ -0,0 +1,69 @@
+<template>
+  <a-modal
+    centered
+    :footer="null"
+    :maskClosable="false"
+    title="选择合并方式"
+    v-model="isShow"
+    @cancel="isShow=false"
+    width="500px">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div style="padding:15px;">
+        <a-icon :style="{ fontSize: '16px', color: '#666', marginRight:'6px' }" type="check-square" /> 相同客户名称
+      </div>
+      <div style="padding:5px 0 25px 40px;" v-if="sameCustomeName">
+        <a-checkbox v-model="sameRules1" @change="sameRules2=undefined">相同促销活动</a-checkbox>
+        <a-checkbox v-model="sameRules2" @change="sameRules1=undefined">相同活动规则(同一促销活动)</a-checkbox>
+      </div>
+      <div class="btn-cont" style="padding:20px 20px 0;text-align: center;">
+        <a-button type="info" @click="isShow=false">取消</a-button>
+        <a-button type="primary" style="margin-left: 10px" @click="submit">确定</a-button>
+      </div>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import {
+  commonMixin
+} from '@/utils/mixin'
+export default {
+  name: 'ViewSelectModal',
+  mixins: [commonMixin],
+  props: {
+    openModal: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    return {
+      spinning: false,
+      isShow: this.openModal,
+      sameCustomeName: true, // 是否勾选相同客户名称
+      sameRules1: undefined, // 相同促销活动
+      sameRules2: undefined // 相同活动规则(同一促销活动)
+    }
+  },
+  methods: {
+    submit () {
+      this.$emit('meargeOk', { sameRules1: this.sameRules1, sameRules2: this.sameRules2 })
+      this.isShow = false
+    }
+  },
+  watch: {
+    openModal (nVal, oVal) {
+      this.isShow = nVal
+    },
+    isShow (nVal, oVal) {
+      if (!nVal) {
+        this.$emit('close')
+        this.sameRules = undefined
+      }
+    }
+  }
+}
+</script>
+
+<style>
+</style>

+ 91 - 75
src/views/salesManagement/waitCostOrder/viewSelectModal.vue

@@ -1,99 +1,115 @@
 <template>
-  <a-modal centered :footer="null" :maskClosable="false" title="已选待转费用报销单" v-model="isShow" @cancel="isShow=false"
+  <a-modal
+    centered
+    :footer="null"
+    :maskClosable="false"
+    :title="title"
+    v-model="isShow"
+    @cancel="cancel"
     width="70%">
-    <div style="padding:10px;">共{{dataSource&&dataSource.length}}条</div>
+    <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"
-          />
+          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 type="primary" class="button-info" style="margin-left: 10px" @click="isShow=false">确定</a-button>
+        <a-button type="primary" v-if="submitType=='noMearge'" class="button-info" @click="cancel">关闭</a-button>
+        <a-button type="primary" v-else @click="submit">提交</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
+import {
+  commonMixin
+} from '@/utils/mixin'
+import { Empty } from 'ant-design-vue'
+export default {
+  name: 'ViewSelectModal',
+  mixins: [commonMixin],
+  props: {
+    openModal: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    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: [],
+      title: '已选待转费用报销单',
+      submitType: 'noMearge' // 默认是,直接勾选的数据,不是合并后的数据
+    }
+  },
+  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: 'expense', 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
+      })
     },
-    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: 'expense',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
-      }
+    // 继续提交
+    submit () {
+      this.spinning = true
+      this.$emit('submit', this.dataSource)
     },
-    methods: {
-       setData(list){
-         this.dataSource = JSON.parse(JSON.stringify(list))
-         this.dataSource.map((item,index) => {
-           item.no = index + 1
-         })
-       }
+    cancel () {
+      this.isShow = false
+    }
+  },
+  watch: {
+    openModal (nVal, oVal) {
+      this.isShow = nVal
     },
-    watch: {
-      openModal(nVal, oVal) {
-        this.isShow = nVal
-      },
-      isShow(nVal, oVal) {
-        if (!nVal) {
-          this.$emit('close')
-          this.dataSource = []
-        }
+    isShow (nVal, oVal) {
+      if (!nVal) {
+        this.$emit('close')
+        this.dataSource = []
       }
     }
   }
+}
 </script>
 
 <style>
-</style>
+</style>

+ 2 - 2
vue.config.js

@@ -108,9 +108,9 @@ const vueConfig = {
     // If you want to turn on the proxy, please remosve the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        target: 'http://192.168.2.113:8660/ocs-admin',
+        // target: 'http://192.168.2.113:8660/ocs-admin',
         // target: 'https://t.ocs.360arrow.com/ocs-admin', //  练习
-        // target: 'https://p.ocs.360arrow.com/ocs-admin', //  预发布
+        target: 'https://p.ocs.360arrow.com/ocs-admin', //  预发布
         ws: false,
         changeOrigin: true,
         pathRewrite: {