فهرست منبع

对账单接口

lilei 3 هفته پیش
والد
کامیت
9bc82067e6

+ 158 - 0
src/api/verifyAccount.js

@@ -0,0 +1,158 @@
+import { axios } from '@/utils/request'
+
+//  对账单管理 列表  分页
+export const verifyAcountBillList = (params) => {
+  const url = `/verifyAccountBill/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('列表查询')
+    }
+  })
+}
+// 对账单-待选单据列表
+export const verifyAccountBillQueryWaitSelectList = (params) => {
+  const url = `/verifyAccountBillDetail/queryWaitSelectPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('对账单待选单据列表查询')
+    }
+  })
+}
+
+// 创建对账单
+export const verifyAccountBillCreate = params => {
+  return axios({
+    url: '/verifyAccountBill/create',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('创建对账单')
+    }
+  })
+}
+// 对账单修改
+export const verifyAccountBillModify = params => {
+  return axios({
+    url: '/verifyAccountBill/modify',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('对账单修改')
+    }
+  })
+}
+// 对账单管理  删除
+export const verifyAcountBillDel = params => {
+  return axios({
+    url: `/verifyAccountBill/delete/${params.sn}`,
+    data: {},
+    method: 'get',
+    headers: {
+      'module': encodeURIComponent('删除对账单')
+    }
+  })
+}
+// 对账单管理  详情
+export const verifyAcountBillDetail = params => {
+  return axios({
+    url: `/verifyAccountBill/findBySn/${params.sn}`,
+    data: {},
+    method: 'get',
+    headers: {
+      'module': encodeURIComponent('查看对账单详情')
+    }
+  })
+}
+// 对账单管理  对账
+export const verifyAcountBillCheck = params => {
+  return axios({
+    url: `/verifyAccountBill/check/${params.sn}/${params.state}`,
+    data: {},
+    method: 'get',
+    headers: {
+      'module': encodeURIComponent('对账')
+    }
+  })
+}
+ 
+// 对账单管理  提交
+export const verifyAcountBillSubmit = params => {
+  return axios({
+    url: `/verifyAccountBill/submit`,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('提交')
+    }
+  })
+}
+ 
+//  对账单管理  明细 列表  分页
+export const verifyAcountBillDetailList = (params) => {
+  const url = `/verifyAccountBillDetail/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('明细列表查询')
+    }
+  })
+}
+//  对账单管理  明细 列表  不分页
+export const verifyAcountBillDetailQueryList = (params) => {
+  const url = `/verifyAccountBillDetail/queryList `
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('明细不分页列表查询')
+    }
+  })
+}
+// 对账单管理  详情  统计信息
+export const verifyAcountBillDetailQueryCount = params => {
+  return axios({
+    url: `/verifyAccountBillDetail/queryCount`,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('对账单单据详情统计信息')
+    }
+  })
+} 
+// 对账单管理  详情  批量删除
+export const verifyAcountBillDetailDel = params => {
+  return axios({
+    url: `/verifyAccountBillDetail/deleteBatch`,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('对账单单据详情批量删除')
+    }
+  })
+} 
+// 对账单管理  详情 批量添加
+export const verifyAcountBillDetailSave = params => {
+  return axios({
+    url: '/verifyAccountBillDetail/insertBatch',
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('对账单单据详情批量添加')
+    }
+  })
+} 

+ 106 - 0
src/views/common/dealerByScope.vue

@@ -0,0 +1,106 @@
+<template>
+  <a-select
+    show-search
+    label-in-value
+    :size="size"
+    :value="dealerName"
+    mode="combobox"
+    :placeholder="placeholder"
+    style="width: 100%"
+    :filter-option="false"
+    :not-found-content="fetching ? undefined : null"
+    :dropdownMatchSelectWidth="false"
+    :defaultActiveFirstOption="false"
+    @search="fetchUser"
+    @change="handleChange"
+    allowClear
+    :disabled="disabled"
+  >
+    <a-spin v-if="fetching" slot="notFoundContent" size="small" />
+    <a-select-option v-for="item in data" :key="item.dealerSn" :value="item.dealerName">
+      {{ item.dealerName }}
+    </a-select-option>
+  </a-select>
+</template>
+<script>
+import debounce from 'lodash/debounce'
+import { dealerSubareaScopeList, dealerDetailBySn } from '@/api/dealer'
+export default {
+  props: {
+    size: {
+      type: String,
+      default: 'default'
+    },
+    placeholder: {
+      type: String,
+      default: '请输入名称搜索'
+    },
+    disabled: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    this.lastFetchId = 0
+    this.fetchUser = debounce(this.fetchUser, 800)
+    return {
+      data: [],
+      dealerName: [],
+      fetching: false
+    }
+  },
+  methods: {
+    fetchUser (dealerName) {
+      console.log('fetching user', dealerName)
+      if (dealerName == '') return
+      this.lastFetchId += 1
+      const fetchId = this.lastFetchId
+      this.data = []
+      this.fetching = true
+      dealerSubareaScopeList({ nameLike: dealerName.replace(/\s+/g, ''), pageNo: 1, pageSize: 20 }).then(res => {
+        if (fetchId !== this.lastFetchId) {
+          return
+        }
+        this.data = res.data && res.data.list ? res.data.list : []
+        this.fetching = false
+      })
+    },
+    handleChange (value) {
+      if (value && value.key) {
+        const obj = this.data.find(item => item.dealerName.replace(/\s+/g, '') == value.key)
+        value.name = obj ? obj.dealerName : ''
+        value.row = obj
+      }
+      Object.assign(this, {
+        dealerName: value,
+        data: [],
+        fetching: false
+      })
+      this.$emit('change', value || { key: undefined })
+    },
+    resetForm () {
+      this.dealerName = []
+      Object.assign(this, {
+        dealerName: undefined,
+        data: [],
+        fetching: false
+      })
+    },
+    // 查询详细
+    getDetail (sn) {
+      dealerDetailBySn({ sn: sn }).then(res => {
+        const val = { key: sn }
+        val.label = res.data.dealerName
+        val.row = res.data
+        Object.assign(this, {
+          dealerName: val,
+          data: [res.data],
+          fetching: false
+        })
+        this.$emit('change', val)
+        this.$emit('dealerDetail', res.data || null)
+      })
+    }
+  }
+}
+</script>

+ 13 - 12
src/views/financialManagement/accountStatement/baseModal.vue

@@ -17,7 +17,7 @@
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol">
         <a-form-model-item label="客户名称" prop="dealerSn">
-          <dealerSubareaScopeList :disabled="!!itemSn" ref="settleClientName" @change="custChange" />
+          <dealerByScope :disabled="!!itemSn" ref="dealer" @change="custChange" />
         </a-form-model-item>
         <a-form-model-item label="备注">
           <a-textarea :rows="4" :maxLength="300" placeholder="请输入备注(最多300个字符)" v-model="form.remarks"></a-textarea>
@@ -34,12 +34,12 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { VSelect } from '@/components'
-import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
-import { financeBookSave, financeBookFindBySn } from '@/api/financeBook.js'
+import dealerByScope from '@/views/common/dealerByScope.vue'
+import { verifyAccountBillCreate, verifyAccountBillModify, verifyAcountBillDetail } from '@/api/verifyAccount.js'
 export default {
   name: 'ASBaseModal',
   mixins: [commonMixin],
-  components: { VSelect, dealerSubareaScopeList },
+  components: { VSelect, dealerByScope },
   props: {
     show: [Boolean],
     itemSn: {
@@ -95,8 +95,11 @@ export default {
     salesSaveFun () {
       const _this = this
       const form = JSON.parse(JSON.stringify(_this.form))
+      // 编辑 or 新增
+      const funs = form.verifyAccountBillSn ? verifyAccountBillModify : verifyAccountBillCreate
+
       _this.spinning = true
-      financeBookSave(form).then(res => {
+      funs(form).then(res => {
         if (res.status == 200) {
           _this.$message.success(res.message)
           // 编辑
@@ -107,10 +110,8 @@ export default {
             _this.$router.push({ name: 'accountStatementEdit', params: { sn: res.data.verifyAccountBillSn } })
           }
           _this.cancel()
-          _this.spinning = false
-        } else {
-          _this.spinning = false
         }
+        _this.spinning = false
       })
     },
     //  详情
@@ -118,14 +119,14 @@ export default {
       this.title = '编辑对账单'
       this.spinning = true
       this.confirmLoading = true
-      financeBookFindBySn({ itemSn: this.itemSn }).then(res => {
+      verifyAcountBillDetail({ verifyAccountBillSn: this.itemSn }).then(res => {
         if (res.status == 200) {
           const data = res.data
           this.form = Object.assign(this.form, data)
           // 回显客户
           if (this.form.dealerSn) {
             this.$nextTick(() => {
-              this.$refs.settleClientName.getDetail(this.form.dealerSn)
+              this.$refs.dealer.getDetail(this.form.dealerSn)
             })
           }
         } else {
@@ -143,8 +144,8 @@ export default {
     async pageInit () {
       this.$nextTick(() => {
         this.$refs.ruleForm.resetFields()
-        if (this.$refs.settleClientName) {
-          this.$refs.settleClientName.resetForm()
+        if (this.$refs.dealer) {
+          this.$refs.dealer.resetForm()
         }
       })
       this.form = {

+ 53 - 56
src/views/financialManagement/accountStatement/confrontModal.vue

@@ -20,8 +20,8 @@
                 </a-form-item>
               </a-col>
               <a-col :md="4" :sm="24">
-                <a-form-item label="单号">
-                  <a-input id="conFrontModal-bookNo" v-model.trim="queryParam.bookNo" allowClear placeholder="请输入收款单号"/>
+                <a-form-item label="业务单号">
+                  <a-input id="conFrontModal-bizNo" v-model.trim="queryParam.bizNo" allowClear placeholder="请输入业务单号"/>
                 </a-form-item>
               </a-col>
               <a-col :md="4" :sm="24">
@@ -38,11 +38,11 @@
               <a-col :md="4" :sm="24">
                 <a-form-item label="业务类型">
                   <v-select
-                    v-model="queryParam.status"
-                    ref="status"
-                    id="conFrontModal-status"
+                    v-model="queryParam.bizType"
+                    ref="bizType"
+                    id="conFrontModal-bizType"
                     code="FINANCE_BOOK_STATE"
-                    placeholder="请选择状态"
+                    placeholder="请选择业务类型"
                     allowClear></v-select>
                 </a-form-item>
               </a-col>
@@ -67,9 +67,9 @@
         <div style="margin-bottom: 10px;">
           <div class="conFrontModal-title">箭冠汽配 应收账款明细表</div>
           <div class="conFrontModal-flex">
-            <div class="conFrontModal-subTitle"><span>营业执照名称:</span></div>
+            <div class="conFrontModal-subTitle"><span>营业执照名称:</span>{{ dealear.licenseName }}</div>
             <div class="conFrontModal-subTitle"><span>系统名称:</span></div>
-            <div class="conFrontModal-subTitle"><span>财务编号:</span></div>
+            <div class="conFrontModal-subTitle"><span>财务编号:</span>{{ dealear.kdMidCustomerFnumber }}</div>
           </div>
         </div>
         <!-- 列表 -->
@@ -85,12 +85,12 @@
           bordered>
         </s-table>
         <div class="conFrontModal-info">
-          备注:撒旦解放按时间了撒旦解放拉萨酱豆腐上了飞机萨拉丁积分了,就撒旦发了就撒地方垃圾士大夫六十九分的 三分到手的发;开始疯狂十九大分类;
+          备注:{{ detailData.remarks }}
         </div>
         <div class="conFrontModal-flex">
           <div class="conFrontModal-subTitle">
-            <div><span>公司名称:</span></div>
-            <div><span>签名:</span></div>
+            <div><span>公司名称:</span> 东莞市箭冠汽车配件制造有限公司</div>
+            <div><span>签名:</span>{{ detailData.signName }}</div>
             <div><span>盖章</span></div>
           </div>
           <div class="conFrontModal-subTitle">
@@ -108,7 +108,10 @@
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
-import { financeBookFindBySn, financeBookQueryPage } from '@/api/financeBook.js'
+import {
+  verifyAcountBillDetailQueryList,
+  verifyAcountBillDetail
+} from '@/api/verifyAccount'
 
 export default {
   name: 'ConFrontModal',
@@ -126,12 +129,14 @@ export default {
       opened: this.show,
       spinning: false,
       disabled: false,
-      title: '应收账款明细表',
+      title: '',
       exportLoading: false,
       queryParam: {
-        dealerSn: undefined,
-        dealerName: undefined,
-        remarks: ''
+        beginDate: '',
+        endDate: '',
+        bizNo: '',
+        changeType: undefined,
+        bizType: undefined
       },
       creatDate: [],
       // 加载数据方法 必须为 Promise 对象
@@ -139,13 +144,19 @@ export default {
         this.disabled = true
         this.spinning = true
         const params = Object.assign(parameter, this.queryParam)
-        return financeBookQueryPage(params).then(res => {
+        return verifyAcountBillDetailQueryList(params).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
-            const no = (data.pageNo - 1) * data.pageSize
-            for (var i = 0; i < data.list.length; i++) {
-              data.list[i].no = no + i + 1
+            const no = 0
+            for (var i = 0; i < data.length; i++) {
+              data.no = no + i + 1
+              // 正为借方, 负数为贷方
+              if (data.bizAmount > 0) {
+                data.debitAmount = data.bizAmount
+              } else {
+                data.creditorAmount = data.bizAmount
+              }
             }
             this.total = data.count || 0
             this.disabled = false
@@ -155,24 +166,25 @@ export default {
         })
       },
       total: 0, // 合计
-      detailData: null
+      detailData: null,
+      dealear: null
     }
   },
   computed: {
     columns () {
       const arr = [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '年', dataIndex: 'sparePartsNo', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '月', dataIndex: 'sparePartsNo', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '日', dataIndex: 'sparePartsNo', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '业务单号', dataIndex: 'sparePartsNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '单据类型', dataIndex: 'product.code', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '费用/调拨类型', dataIndex: 'product.unit', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '摘要', dataIndex: 'sparePartsBatchNo', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '客诉索赔编码', dataIndex: 'currentStockQty', width: '8%', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
-        { title: '借方', dataIndex: 'productCost', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? this.toThousands(text, 2) : '--') } },
-        { title: '贷方', dataIndex: 'productCost', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? this.toThousands(text, 2) : '--') } },
-        { title: '余额', dataIndex: 'productCost1', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? this.toThousands(text, 2) : '--') } },
+        { title: '年', dataIndex: 'year', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '月', dataIndex: 'month', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '日', dataIndex: 'day', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '业务单号', dataIndex: 'bizNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '单据类型', dataIndex: 'bizType', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '费用/调拨类型', dataIndex: 'expenseAllocateType', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '摘要', dataIndex: 'digestInfo', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客诉索赔编码', dataIndex: 'productCode', width: '8%', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
+        { title: '借方', dataIndex: 'debitAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? this.toThousands(text, 2) : '--') } },
+        { title: '贷方', dataIndex: 'creditorAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? this.toThousands(text, 2) : '--') } },
+        { title: '余额', dataIndex: 'totalAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? this.toThousands(text, 2) : '--') } },
         { title: '备注', dataIndex: 'remarks', width: '15%', align: 'center', customRender: function (text) { return text || '--' } }
       ]
       return arr
@@ -190,20 +202,16 @@ export default {
       this.$refs.rangeDate.resetDate(this.creatDate)
       this.queryParam.beginDate = ''
       this.queryParam.endDate = ''
-      this.queryParam.dealerName = ''
-      this.queryParam.bookNo = ''
-      this.queryParam.status = undefined
+      this.queryParam.bizNo = ''
+      this.queryParam.changeType = undefined
+      this.queryParam.bizType = undefined
       this.$refs.table.refresh(true)
     },
     //  详情
     getDetail () {
-      this.title = '编辑对账单'
       this.spinning = true
-      financeBookFindBySn({ bookSn: this.bookSn }).then(res => {
-        if (res.status == 200) {
-          const data = res.data
-          this.detailData = Object.assign(this.form, data)
-        }
+      verifyAcountBillDetail({ verifyAccountBillSn: this.verifyAccountBillSn }).then(res => {
+        this.detailData = res.data
         this.spinning = false
       })
     },
@@ -217,21 +225,10 @@ export default {
 
     },
     // 初始化
-    async pageInit () {
-      this.$nextTick(() => {
-        if (this.$refs.settleClientName) {
-          this.$refs.settleClientName.resetForm()
-        }
-      })
-      this.form = {
-        dealerSn: undefined,
-        dealerName: undefined,
-        remarks: ''
-      }
-      //  编辑页
-      if (this.bookSn) {
-        this.getDetail()
-      }
+    async pageInit (row, dealear, type) {
+      this.dealear = dealear
+      this.title = type ? '对单' : '单据详情'
+      this.getDetail()
     }
   },
   watch: {

+ 61 - 110
src/views/financialManagement/accountStatement/edit.vue

@@ -8,8 +8,8 @@
             <a-icon type="left" />
             返回列表
           </a>
-          <span style="margin: 0 15px;color: #666;font-weight: bold;">单号:{{ detailsData&&detailsData.verifyAccountBillNo }}</span>
-          <span style="margin: 0 10px;color: #666;">客户名称:{{ detailsData && detailsData.supplier && detailsData.dealerName }}</span>
+          <span style="margin: 0 15px;color: #666;font-weight: bold;">单号:{{ detailData&&detailData.verifyAccountBillNo }}</span>
+          <span style="margin: 0 10px;color: #666;">客户名称:{{ detailData && detailData.dealerName }}</span>
           <a-button type="link" size="small" class="button-default" @click.stop="handleEditBase" >
             <a-icon type="edit" /> 编辑备注
           </a-button>
@@ -26,10 +26,10 @@
       <a-card size="small" :bordered="false" class="salesReturnEdit-cont">
         <a-alert style="margin-bottom: 10px;" type="info">
           <div slot="message" class="total-bar">
-            <div v-if="detailData">
-              <span>余额:{{ detailData && (detailData.totalAmount || detailData.totalAmount == 0) ? detailData.totalAmount : '--' }};</span>
-              <span>借方:{{ detailData && (detailData.debitAmount || detailData.debitAmount == 0) ? detailData.debitAmount : '--' }};</span>
-              <span>贷方:{{ detailData && (detailData.creditorAmount || detailData.creditorAmount == 0) ? detailData.creditorAmount : '--' }};</span>
+            <div v-if="countData">
+              <span>余额:{{ countData && (countData.bizAmount || countData.bizAmount == 0) ? countData.bizAmount : '--' }};</span>
+              <span>借方:{{ countData && (countData.borrowAmount || countData.borrowAmount == 0) ? countData.borrowAmount : '--' }};</span>
+              <span>贷方:{{ countData && (countData.loanAmount || countData.loanAmount == 0) ? countData.loanAmount : '--' }};</span>
             </div>
           </div>
         </a-alert>
@@ -122,7 +122,7 @@
         id="salesReturn-handleSubmit">提交</a-button>
     </div>
     <!-- 编辑基础信息弹窗 -->
-    <baseModal v-drag :show="openModal" @cancel="openModal=false" @refashData="getBasicsData"></baseModal>
+    <baseModal v-drag :show="openModal" @cancel="openModal=false" :itemSn="verifyAccountBillSn" @refashData="getBasicsData"></baseModal>
   </div>
 </template>
 
@@ -131,16 +131,15 @@ import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import queryPart from './queryPart.vue'
 import baseModal from './baseModal.vue'
-import {
-  sparePartsReturnQueryPage,
-  queryPageCount,
-  sparePartsReturnDetailDelete,
-  sparePartsReturnDetailSave,
-  sparePartsReturnSubmit,
-  sparePartsReturnInfo,
-  sparePartsReturnDetailSaveBatch
-} from '@/api/sparePartsReturn'
 import rangeDate from '@/views/common/rangeDate.vue'
+import {
+  verifyAcountBillDetailList,
+  verifyAcountBillDetailQueryCount,
+  verifyAcountBillDetailDel,
+  verifyAcountBillDetailSave,
+  verifyAcountBillSubmit,
+  verifyAcountBillDetail
+} from '@/api/verifyAccount'
 export default {
   name: 'AccountStatementEdit',
   mixins: [commonMixin],
@@ -164,17 +163,22 @@ export default {
         bizType: undefined
       },
       creatDate: [],
-      verifyAccountBillNo: null,
       chooseList: [],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
-        return sparePartsReturnQueryPage(Object.assign(parameter, this.productForm)).then(res => {
+        return verifyAcountBillDetailList(Object.assign(parameter, this.productForm)).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
             const no = (data.pageNo - 1) * data.pageSize
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
+              // 正为借方, 负数为贷方
+              if (data.list[i].bizAmount > 0) {
+                data.list[i].debitAmount = data.list[i].bizAmount
+              } else {
+                data.list[i].creditorAmount = data.list[i].bizAmount
+              }
             }
           }
           this.chooseList = data.list
@@ -182,10 +186,10 @@ export default {
         })
       },
       openModal: false, // 修改信息弹窗
-      detailData: null, // 统计明细
-      detailsData: null, // 基础信息数据
+      countData: null, // 统计明细
+      detailData: null, // 基础信息数据
       addMoreLoading: false, // 批量添加动画
-      grabFlag: undefined
+      verifyAccountBillSn: undefined // 单据sn
     }
   },
   computed: {
@@ -193,17 +197,17 @@ export default {
       const _this = this
       const arr = [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '年', dataIndex: 'bizNo', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '月', dataIndex: 'bizNo', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '日', dataIndex: 'bizNo', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '年', dataIndex: 'year', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '月', dataIndex: 'month', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '日', dataIndex: 'day', width: '4%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '业务单号', dataIndex: 'bizNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '单据类型', dataIndex: 'product.code', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '业务状态', dataIndex: 'product.name', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '费用/调拨类型', dataIndex: 'product.unit', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '摘要', dataIndex: 'sparePartsBatchNo', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '客诉索赔编码', dataIndex: 'currentStockQty', width: '8%', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
-        { title: '借方', dataIndex: 'productCost', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? toThousands(text, 2) : '--') } },
-        { title: '贷方', dataIndex: 'productCost', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? toThousands(text, 2) : '--') } },
+        { title: '单据类型', dataIndex: 'bizType', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '业务状态', dataIndex: 'bizStatus', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '费用/调拨类型', dataIndex: 'expenseAllocateType', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '摘要', dataIndex: 'digestInfo', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客诉索赔编码', dataIndex: 'productCode', width: '8%', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
+        { title: '借方', dataIndex: 'debitAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
+        { title: '贷方', dataIndex: 'creditorAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } },
         { title: '备注', scopedSlots: { customRender: 'remark' }, width: '15%', align: 'center' },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ]
@@ -235,13 +239,13 @@ export default {
         onOk () {
           _this.delLoading = true
           _this.spinning = true
-          sparePartsReturnDetailDelete({ detailSn: row.sparePartsReturnDetailSn })
+          verifyAcountBillDetailDel({ verifyAccountBillSn: row.verifyAccountBillSn, detailSnList: [row.verifyAccountBillDetailSn] })
             .then(res => {
               if (res.status == 200) {
                 _this.resetTable(false)
                 _this.getStatisticsData()
                 _this.getChooseList()
-                _this.$refs.partQuery.refreshLength()
+                _this.$refs.partQuery.clearSelected()
               }
               _this.$message.info(res.message)
               _this.delLoading = false
@@ -269,7 +273,7 @@ export default {
       this.$refs.rangeDate.resetDate(this.creatDate)
       this.$refs.table.refresh(!!flag)
     },
-    // 添加或修改单据
+    // 单个添加单据
     saveProduct (row) {
       if (this.isInster) {
         // 防止多次添加产品
@@ -277,77 +281,37 @@ export default {
       }
       this.isInster = true
       const paramsData = {
-        bookSn: this.bookSn,
-        verifyAccountBillNo: this.verifyAccountBillNo,
-        sparePartsDetailSn: row.sparePartsDetailSn,
-        productSn: row.productSn,
-        stockDetailSn: row.stockDetailSn,
-        productCode: row.productCode,
-        putQty: row.productQty, // 入库数量
-        returnedQty: row.returnedQty, // 已退数量
-        qty: row.qty, // 申退数量
-        cost: row.productCost, // 成本
-        stockBatchNo: row.sparePartsBatchNo, // 批次号
-        warehouseSn: row.warehouseSn, // 仓库sn
-        warehouseLocationSn: row.warehouseLocationSn, // 仓位sn
-        bizNo: row.bizNo,
-        sparePartsSn: row.sparePartsSn
+        verifyAccountBillSn: this.detailData.verifyAccountBillSn,
+        verifyAccountBillNo: this.detailData.verifyAccountBillNo,
+        verifyAccountBizSn: this.detailData.verifyAccountBizSn,
+        verifyAccountBillDetailList: [row]
       }
-      this.saveEdit(paramsData)
+      this.saveMore(paramsData)
     },
+    // 批量添加
     saveMoreProduct (data) {
       if (this.addMoreLoading) {
         // 防止多次添加产品
         return
       }
       this.addMoreLoading = true
-      var ajax_data = []
-      data.forEach(item => {
-        const obj = {
-          bookSn: this.bookSn,
-          verifyAccountBillNo: this.verifyAccountBillNo,
-          sparePartsDetailSn: item.sparePartsDetailSn,
-          productSn: item.productSn,
-          stockDetailSn: item.stockDetailSn,
-          productCode: item.productCode,
-          putQty: item.productQty, // 入库数量
-          returnedQty: item.returnedQty, // 已退数量
-          qty: item.qty, // 申退数量
-          cost: item.productCost, // 成本
-          stockBatchNo: item.sparePartsBatchNo, // 批次号
-          warehouseSn: item.warehouseSn, // 仓库sn
-          warehouseLocationSn: item.warehouseLocationSn, // 仓位sn
-          bizNo: item.bizNo,
-          sparePartsSn: item.sparePartsSn
-        }
-        ajax_data.push(obj)
-      })
-      this.saveMore(ajax_data)
-    },
-    saveEdit (params) {
-      this.spinning = true
-      sparePartsReturnDetailSave(params).then(res => {
-        if (res.status == 200) {
-          this.getStatisticsData()
-          this.$refs.table.refresh(true)
-          this.getChooseList()
-        }
-        this.isInster = false
-        this.spinning = false
-        this.addMoreLoading = false
-      }).catch(err => {
-        this.isInster = false
+      this.saveMore({
+        verifyAccountBillSn: this.detailData.verifyAccountBillSn,
+        verifyAccountBillNo: this.detailData.verifyAccountBillNo,
+        verifyAccountBizSn: this.detailData.verifyAccountBizSn,
+        verifyAccountBillDetailList: data
       })
     },
+    // 添加
     saveMore (params) {
       this.spinning = true
-      sparePartsReturnDetailSaveBatch(params)
+      verifyAcountBillDetailSave(params)
         .then(res => {
           if (res.status == 200) {
             this.getStatisticsData()
             this.getChooseList()
             this.$refs.table.refresh(true)
-            this.$refs.partQuery.refreshLength()
+            this.$refs.partQuery.clearSelected()
           }
           this.isInster = false
           this.spinning = false
@@ -359,10 +323,10 @@ export default {
           this.spinning = false
         })
     },
-    // 提交采购退货
+    // 提交
     handleSubmit (data) {
       this.spinning = true
-      sparePartsReturnSubmit({ bookSn: this.bookSn, ...data }).then(res => {
+      verifyAcountBillSubmit({ verifyAccountBillSn: this.verifyAccountBillSn, ...data }).then(res => {
         if (res.status == 200) {
           this.handleBack()
           this.$message.success(res.message)
@@ -371,39 +335,26 @@ export default {
       })
     },
     pageInit () {
-      this.bookSn = this.$route.query.sn
+      this.verifyAccountBillSn = this.$route.query.sn
       this.getStatisticsData()
       this.getBasicsData()
       this.resetSearchForm(true)
     },
     getChooseList () {
-      this.$refs.partQuery.pageInit(this.supplierSn, this.bookSn, this.detailsData ? this.detailsData.warehouseSn : undefined, this.detailsData.grabFlag)
+      this.$refs.partQuery.pageInit()
     },
     // 获取页面统计数据
     getStatisticsData () {
       this.getBasicsData(true)
-      queryPageCount({ bookSn: this.bookSn }).then(res => {
-        if (res.status == 200) {
-          if (res.data) {
-            res.data.totalCost = res.data && (res.data.totalCost || res.data.totalCost == 0) ? this.toThousands(res.data.totalCost, 2) : '--'
-            this.detailData = res.data
-          } else {
-            this.detailData = null
-          }
-        } else {
-          this.detailData = null
-        }
+      verifyAcountBillDetailQueryCount({ verifyAccountBillSn: this.verifyAccountBillSn }).then(res => {
+        this.countData = res.data
       })
     },
     // 获取基础信息
     getBasicsData (flag) {
-      sparePartsReturnInfo({ sn: this.bookSn }).then(res => {
-        if (res.status == 200) {
-          this.detailsData = res.data
-        } else {
-          this.detailsData = null
-        }
-        const _this = this
+      const _this = this
+      verifyAcountBillDetail({ sn: this.verifyAccountBillSn }).then(res => {
+        this.detailData = res.data
         if (!flag) {
           this.$nextTick(() => {
             _this.getChooseList()

+ 51 - 23
src/views/financialManagement/accountStatement/list.vue

@@ -12,7 +12,7 @@
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="客户名称">
-                <a-input id="accountStatement-dealerName" v-model.trim="queryParam.dealerName" allowClear placeholder="请输入客户名称"/>
+                <dealerByScope id="accountStatement-dealerName" ref="dealer" @change="custChange" @dealerDetail="getDealerDetail" />
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
@@ -27,7 +27,7 @@
                   ref="status"
                   id="accountStatement-status"
                   code="FINANCE_BOOK_STATE"
-                  placeholder="请选择状态"
+                  placeholder="请选择业务状态"
                   allowClear></v-select>
               </a-form-item>
             </a-col>
@@ -64,7 +64,7 @@
           bordered>
           <!-- 单号 -->
           <template slot="verifyAccountBillNo" slot-scope="text, record">
-            <span v-if="$hasPermissions('B_fc_detail')" class="link-bule" @click="handleDetail(record)">{{ record.verifyAccountBillNo }}</span>
+            <span v-if="$hasPermissions('B_fc_detail')" class="link-bule" @click="handleDetail(record,0)">{{ record.verifyAccountBillNo }}</span>
             <span v-else>{{ record.verifyAccountBillNo }}</span>
           </template>
           <!-- 操作 -->
@@ -92,7 +92,7 @@
               size="small"
               type="link"
               class="button-info"
-              @click="confront(record)"
+              @click="handleDetail(record,1)"
             >
               对单
             </a-button>
@@ -109,9 +109,9 @@
         </s-table>
       </a-spin>
       <!-- 基础信息 -->
-      <baseModal v-drag :show="baseModal" :itemSn="itemSn" @cancel="baseModal=false"></baseModal>
+      <baseModal v-drag :show="baseModal" @cancel="baseModal=false"></baseModal>
       <!-- 对单 -->
-      <confrontModal v-drag :show="openModal" :itemSn="itemSn" @cancel="openModal=false"></confrontModal>
+      <confrontModal v-drag :show="openModal" ref="detailModal" @cancel="openModal=false"></confrontModal>
     </a-card>
   </div>
 </template>
@@ -120,13 +120,14 @@
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
+import dealerByScope from '@/views/common/dealerByScope.vue'
 import baseModal from './baseModal.vue'
 import confrontModal from './confrontModal.vue'
-import { financeBookQueryPage, financeBookDeleteBySn } from '@/api/financeBook.js'
+import { verifyAcountBillList, verifyAcountBillDel, verifyAcountBillCheck } from '@/api/verifyAccount.js'
 export default {
   name: 'AccountStatementList',
   mixins: [commonMixin],
-  components: { STable, VSelect, rangeDate, baseModal, confrontModal },
+  components: { STable, VSelect, rangeDate, baseModal, confrontModal, dealerByScope },
   data () {
     return {
       spinning: false,
@@ -143,13 +144,12 @@ export default {
       },
       disabled: false, //  查询、重置按钮是否可操作
       creatDate: [], //  创建时间
-      itemSn: null,
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
         const params = Object.assign(parameter, this.queryParam)
-        return financeBookQueryPage(params).then(res => {
+        return verifyAcountBillList(params).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -165,7 +165,9 @@ export default {
         })
       },
       total: 0, // 合计
-      countData: null
+      countData: null,
+      detailType: null,
+      editRow: null
     }
   },
   // 根据权限显示列表字段
@@ -191,6 +193,16 @@ export default {
       this.queryParam.beginDate = date[0] ? date[0] : ''
       this.queryParam.endDate = date[1] ? date[1] : ''
     },
+    // 客户
+    custChange (v) {
+      if (v && v.key) {
+        this.queryParam.dealerSn = v.key
+        this.queryParam.dealerName = v.row ? v.row.dealerName : ''
+      } else {
+        this.queryParam.dealerSn = ''
+        this.queryParam.dealerName = ''
+      }
+    },
     //  重置
     resetSearchForm () {
       this.creatDate = []
@@ -201,6 +213,9 @@ export default {
       this.queryParam.dealerSn = undefined
       this.queryParam.verifyAccountBillNo = ''
       this.queryParam.billStatus = undefined
+      if (this.$refs.dealer) {
+        this.$refs.dealer.resetForm()
+      }
       this.$refs.table.refresh(true)
     },
     // 新增
@@ -209,19 +224,19 @@ export default {
     },
     // 编辑
     handleEdit (row) {
-      this.$router.push({ name: 'accountStatementEdit', params: { sn: row.bookSn, type: 0 } })
+      this.$router.push({ name: 'accountStatementEdit', params: { sn: row.verifyAccountBillSn, type: 0 } })
     },
     // 删除
     handleDel (row) {
       const _this = this
       this.$confirm({
-        title: '提示(箭冠汽配西安大兴店)',
-        content: <div style="font-size:14px;"><div>对账单号:2234234342</div><div>余额:15654.00,确定删除吗?</div></div>,
+        title: '提示(' + row.dealerName + ')',
+        content: <div style="font-size:14px;"><div>对账单号:{row.verifyAccountBillNo}</div><div>余额:{row.totalAmount},确定删除吗?</div></div>,
         centered: true,
         closable: true,
         onOk () {
           _this.spinning = true
-          financeBookDeleteBySn({ bookSn: row.bookSn }).then(res => {
+          verifyAcountBillDel({ verifyAccountBillSn: row.verifyAccountBillSn }).then(res => {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$refs.table.refresh()
@@ -233,25 +248,38 @@ export default {
         }
       })
     },
-    // 详情
-    handleDetail (row) {
+    // 0详情,1对单
+    handleDetail (row, type) {
+      this.$refs.dealer.getDetial(row.dealerSn)
+      this.detailType = type
+      this.editRow = row
+    },
+    getDealerDetail (data) {
+      this.$refs.detailModal.pageInit(this.editRow, data, this.detailType)
+      this.openModal = true
     },
     // 对账
     checkAcount (row) {
       const _this = this
       this.$confirm({
-        title: '提示(箭冠汽配西安大兴店)',
-        content: <div style="font-size:14px;"><div>对账单号:2234234342</div><div>余额:15654.00,确定对账吗?</div></div>,
+        title: '提示(' + row.dealerName + ')',
+        content: <div style="font-size:14px;"><div>对账单号:{row.verifyAccountBillNo}</div><div>余额:{row.totalAmount},确定对账吗?</div></div>,
         centered: true,
         closable: true,
         onOk () {
+          _this.spinning = true
+          verifyAcountBillCheck({ verifyAccountBillSn: row.verifyAccountBillSn }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+              _this.spinning = false
+            } else {
+              _this.spinning = false
+            }
+          })
         }
       })
     },
-    // 对单弹框
-    confront (row) {
-      this.openModal = true
-    },
     pageInit () {
       const _this = this
       this.$nextTick(() => { // 页面渲染完成后的回调

+ 12 - 7
src/views/financialManagement/accountStatement/queryPart.vue

@@ -102,8 +102,7 @@
 </template>
 
 <script>
-import { queryDetailStockPage } from '@/api/spareParts'
-import { queryDetailSnListBySn } from '@/api/sparePartsReturn'
+import { verifyAccountBillQueryWaitSelectList } from '@/api/verifyAccount.js'
 import { STable, VSelect } from '@/components'
 import rangeDate from '@/views/common/rangeDate.vue'
 import { toThousands } from '@/libs/tools.js'
@@ -135,13 +134,19 @@ export default {
       warehouseSn: null,
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
-        return queryDetailStockPage(Object.assign(parameter, this.queryParam)).then(res => {
+        return verifyAccountBillQueryWaitSelectList(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
             const no = (data.pageNo - 1) * data.pageSize
             for (var i = 0; i < data.list.length; i++) {
               data.list[i].no = no + i + 1
+              // 正为借方, 负数为贷方
+              if (data.list[i].bizAmount > 0) {
+                data.list[i].debitAmount = data.list[i].bizAmount
+              } else {
+                data.list[i].creditorAmount = data.list[i].bizAmount
+              }
             }
           }
           return data
@@ -159,7 +164,7 @@ export default {
         { title: '业务单号', dataIndex: 'bizNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '业务类型', dataIndex: 'bizType', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '业务状态', dataIndex: 'bizStatus', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '费用/调拨类型', dataIndex: 'product.unit', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '费用/调拨类型', dataIndex: 'expenseAllocateType', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '摘要', dataIndex: 'digestInfo', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '客诉索赔编码', dataIndex: 'productCode', width: '8%', align: 'center', customRender: function (text) { return (text || text == 0) ? text : '--' } },
         { title: '借方', dataIndex: 'debitAmount', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? toThousands(text, 2) : '--') } },
@@ -194,7 +199,7 @@ export default {
     },
     pageInit () {
       this.$refs.chooseTable.refresh()
-      // this.$refs.chooseTable.clearSelected()
+      // this.clearSelected()
     },
     // 添加
     handleAdd (row) {
@@ -210,8 +215,8 @@ export default {
       }
       this.$emit('add', row)
     },
-    // 删除后选中长度恢复
-    refreshLength (row) {
+    // 清空选择
+    clearSelected (row) {
       this.$refs.chooseTable.clearSelected()
     },
     // 表格选中项