Browse Source

商城版本44期迭代,调整应收对账页面,增加对账功能

shenjunjie 6 years ago
parent
commit
5b59b409b9

+ 13 - 0
assets/scss/mobileCommon.scss

@@ -705,3 +705,16 @@ table.com-price-list {
     }
   }
 }
+
+
+.modal-h {
+  .mobile-base-filter .content {
+    width: 33% !important;
+    position: absolute;
+    right: 0;
+    top: 0;
+    .item  {
+      width: 100% !important;
+    }
+  }
+}

+ 5 - 1
components/mobile/base/BaseFilter.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="mobile-base-filter">
-    <span class="title inline-block">{{title}}:</span>
+    <span class="title inline-block" v-if="ShowTitle">{{title}}:</span>
     <div class="inline-block content">
         <span class="item inline-block" v-for="item in selectItems" @click.stop="setSelect(item)">
           <label class="mobile-cart-check" :class="{active: val === item.val}"></label>
@@ -45,6 +45,10 @@
       selectOption: {
         type: String,
         default: 'defaultKey'
+      },
+      ShowTitle: {
+        type: Boolean,
+        default: true
       }
     },
     data () {

+ 1 - 1
components/mobile/base/ModalWrapper.vue

@@ -63,7 +63,7 @@
       ComputedStyle() {
         if (this.hasFooter) {
           return {
-            height: '80%',
+            height: '68%',
             background: this.bgColor,
             borderBottomLeftRadius: 0,
             borderBottomRightRadius: 0

+ 487 - 75
pages/mobile/center/vendor/btobapCheck.vue

@@ -18,8 +18,8 @@
       </div>
       <div class="order-nav">
         <div :class="activeType === 'all' ? 'active': ''" @click="ChangeList('all')"><span>未对账</span></div>
-        <div :class="activeType === 'todo' ? 'active' : ''" @click="ChangeList('todo')"><span>待确认</span></div>
-        <div :class="activeType === 'done' ? 'active': ''" @click="ChangeList('done')"><span>已确认</span></div>
+        <!--<div :class="activeType === 'todo' ? 'active' : ''" @click="ChangeList('todo')"><span>待确认</span></div>-->
+        <div :class="activeType === 'done' ? 'active': ''" @click="ChangeList('done')"><span>已对账</span></div>
         <div :class="activeType === 'end' ? 'active' : ''" @click="ChangeList('end')"><span>已作废</span></div>
       </div>
       <div v-show="activeType !== 'all'">
@@ -41,7 +41,7 @@
             </base-filter>
           </div>
           <div v-if="resourceList.content && resourceList.content.length > 0">
-            <div class="invoice-btob-list" v-for="item in resourceList.content" :key="item.id">
+            <div class="invoice-btob-list" v-for="item in resourceList.content">
               <div class="invoice-btob-wrapper-top">
                 <span class="read" v-if="!isUnread(item.id)" style="margin-right: 0.3rem">已读</span>
                 <span class="noread" v-if="isUnread(item.id)" style="margin-right: 0.3rem">未读</span>
@@ -76,16 +76,40 @@
           <input type="text" v-model="filterParams.keyword" @keyup.13="onFilter" placeholder="客户名称">
           <span @click="onFilter"><i class="iconfont icon-sousuo"></i></span>
         </div>
-        <div class="btobapCheck-wrapper-scroll" id="btobapCheck-wrapper-scroll2">
+        <div class="timeLine-wrapper">
+          <div class="inline-block left" @click="addMonth('out', 'outTimeMonth', -1)">
+            <i class="iconfont icon-xiangzuo" style="font-size: 0.3rem"></i>
+          </div>
+          <div class="inline-block timeLine" style="text-indent: 0.12rem" @click="ShowMonthChoose('out', 'outTimeMonth')">{{outTimeMonth}}<i class="iconfont icon-arrow-down" style="font-size: 0.3rem"></i></div>
+          <div class="inline-block right" @click="addMonth('out', 'outTimeMonth', 1)">
+            <i class="iconfont icon-xiangyou" style="font-size: 0.3rem"></i>
+          </div>
+        </div>
+        <div class="btobapCheck-wrapper-scroll btobapCheck-wrapper-scroll2" id="btobapCheck-wrapper-scroll2">
           <div v-if="resourceList.content && resourceList.content.length > 0">
-            <div class="invoice-btob-list" v-for="item in resourceList.content" :key="item.id">
+            <div class="invoice-btob-list" v-for="item in resourceList.content">
               <div class="invoice-btob-wrapper-middle" style="border-top: 0">
                 <div class="invoice-btob-wrapper-middle-title">{{item.myEnterprise && item.myEnterprise.enName}}</div>
               </div>
               <div class="invoice-btob-wrapper-middle">
-                <div v-if="item.lastCheckDate"><span>上次对账日期:{{item.lastCheckDate | time}}</span></div>
-                <div v-else><span>上次对账日期:-</span></div>
-                <div><span>未对账总额:{{item.uncheckedCount || '-'}}</span></div>
+                <div v-if="item.thisMonthCount && item.thisMonthCount.length > 0">
+                  <span class="inline-block">本月应收:</span>
+                  <div class="inline-block" style="vertical-align: top" >
+                    <div v-for="count in item.thisMonthCount">
+                      <span>{{count.currency}}:{{count.amount}}{{count.currency === 'RMB' ? '¥': '$'}}</span>
+                    </div>
+                  </div>
+                </div>
+                <div v-else><span>本月应收:-</span></div>
+                <div v-if="item.totalCount && item.totalCount.length > 0">
+                  <span class="inline-block">应收总额:</span>
+                  <div class="inline-block" style="vertical-align: top" >
+                    <div v-for="count in item.totalCount">
+                      <span>{{count.currency}}:{{count.amount}}</span>
+                    </div>
+                  </div>
+                </div>
+                <div v-else><span>应收总额:-</span></div>
               </div>
               <div class="invoice-btob-wrapper-middle" @click="showApcheckList(item)">
                 <div class="middle_btn">立即对账</div>
@@ -102,15 +126,47 @@
       </div>
     </div>
 
-    <modal-wrapper :title="isShowApcheckList.enName" :showModal="isShowApcheckList.show" @closeAction="isShowApcheckList.show = false" :bgColor="'#f1f3f6'" :hasFooter="true">
+    <modal-wrapper :title="isShowApcheckList.enName" :showModal="isShowApcheckList.show" @closeAction="deleteCheck" :bgColor="'#f1f3f6'" :hasFooter="true">
       <div slot="header" class="modal-h">
-         <span class="item inline-block" @click="checkAll()">
-            <label class="mobile-cart-check" :class="{active: !isCheckAll}"></label>
-         </span>
-        <span class="inline-block overflowhidden">
-          当前客户:深圳优软商城科技有限公司大公司哦12314
-        </span>
-        <div @click="isShowMonthChoose=true" style="text-indent: 0.12rem">{{isShowApcheckList.thisMonth}}<i class="iconfont icon-arrow-down" style="font-size: 0.3rem"></i></div>
+        <div class="modal-h-top">
+           <span class="item inline-block" @click="checkAll()"  v-show="!isShowApcheckList.showApcheck">
+              <label class="mobile-cart-check" :class="{active: !isCheckAll}"></label>
+           </span>
+          <span class="inline-block overflowhidden">
+            应收客户:{{isShowApcheckList.enName}}
+          </span>
+        </div>
+        <div class="timeLine-wrapper clearfix">
+          <div v-show="!isShowApcheckList.showApcheck">
+            <div style="margin-left: 0.5rem">
+              <div class="inline-block left" @click="addMonth('inside', '', -1)">
+                <i class="iconfont icon-xiangzuo" style="font-size: 0.3rem"></i>
+              </div>
+              <div class="inline-block timeLine" style="text-indent: 0.12rem" @click="ShowMonthChoose('inside')">{{isShowApcheckList.thisMonth}}<i class="iconfont icon-arrow-down" style="font-size: 0.3rem"></i></div>
+              <div class="inline-block right" @click="addMonth('inside', '', 1)">
+                <i class="iconfont icon-xiangyou" style="font-size: 0.3rem"></i>
+              </div>
+            </div>
+            <div style="clear:both"></div>
+            <base-filter
+              ref="baseFilter"
+              v-for="filterOption in ApcheckfilterOptions"
+              :ShowTitle="ShowTitle"
+              :key="filterOption.selectOption"
+              :selectItems="filterOption.selectItems"
+              :defaultVal="filterOption.defaultVal"
+              :selectOption="filterOption.selectOption"
+              @selectAction="ApcheckonSelectAction"
+              @valueAction="ApcheckonValueAction"
+              :title="filterOption.title">
+            </base-filter>
+          </div>
+          <div v-show="isShowApcheckList.showApcheck" style="line-height: 1.4rem;text-align: center">
+            {{isShowApcheckList.startTime}} ~ {{isShowApcheckList.endTime}}
+          </div>
+        </div>
+        <div style="height: 0.2rem; width: 100%;"></div>
+        <!--<div class="timeLine" @click="ShowMonthChoose('inside')" style="text-indent: 0.12rem">{{isShowApcheckList.thisMonth}}<i class="iconfont icon-arrow-down" style="font-size: 0.3rem"></i></div>-->
         <!--<input type="month" v-model="isShowApcheckList.thisMonth" @change="showApcheckList()"/>-->
       </div>
       <div class="btobapCheck-modal">
@@ -120,35 +176,35 @@
             <div>
               <div class="choosescreen-result-list-content">
                 <div style="border-bottom: 1px solid #D3D3D3;padding-bottom: 0.2rem">
-                  <span class="item inline-block" @click="checkItem(item, index)">
+                  <span class="item inline-block" @click="checkItem(item, index)" v-show="!isShowApcheckList.showApcheck">
                     <label class="mobile-cart-check" :class="{active: item.check}"></label>
                   </span>
                   <div class="inline-block" style="margin-left: 0.15rem">
-                    <div class="OverHidden">序号:<span>{{index + 1}}</span></div>
-                    <!--<div class="OverHidden">本次对账数:<span>{{item.thischeckqty}}</span></div>-->
-                    <div class="OverHidden">单据编号:<span>{{item.inoutno}}</span></div>
-                    <div class="OverHidden">类型:<span>{{item.piclass}}</span></div>
-                    <div class="OverHidden">单据日期:<span>{{item.pidate | time}}</span></div>
+                    <!--<div class="OverHidden">序号:<span>{{index + 1}}</span></div>-->
+                    <div class="OverHidden">验收数量:<span>{{item.thischeckqty}}</span></div>
+                    <div class="OverHidden">验收单:<span>{{item.inoutno}}</span></div>
+                    <!--<div class="OverHidden">类型:<span>{{item.piclass}}</span></div>-->
+                    <!--<div class="OverHidden">单据日期:<span>{{item.pidate | time}}</span></div>-->
                   </div>
                 </div>
                 <div style="padding-top: 0.2rem">
-                  <span class="item inline-block" style="opacity: 0">
+                  <span class="item inline-block" style="opacity: 0"  v-show="!isShowApcheckList.showApcheck">
                     <label class="mobile-cart-check"></label>
                   </span>
                   <div class="inline-block" style="margin-left: 0.15rem">
-                    <div class="OverHidden">客户采购单:<span>{{item.ordercode}}</span></div>
-                    <div class="OverHidden">发货单:<span>{{item.sendcode}}</span></div>
+                    <div class="OverHidden">采购单:<span>{{item.ordercode}}</span></div>
+                    <div class="OverHidden">发货单:<span>{{item.sendcode}}</span></div>
                     <div class="OverHidden">客户料号:<span>{{item.prodcode}}</span></div>
-                    <div class="OverHidden">客户物料名称:<span>{{item.prodtitle}}</span></div>
-                    <div class="OverHidden">客户规格型号:<span>{{item.prodspec}}</span></div>
+                    <div class="OverHidden">物料名称:<span>{{item.prodtitle}}</span></div>
+                    <div class="OverHidden">规格型号:<span>{{item.prodspec}}</span></div>
                     <div class="OverHidden">税率:<span>{{item.taxrate}}%</span></div>
-                    <div class="OverHidden">数量:<span>{{item.qty}}</span></div>
+                    <div class="OverHidden">发货数量:<span>{{item.qty}}</span></div>
                     <div class="OverHidden">单价:<span>{{item.currency}}:{{item.orderprice}}</span></div>
                     <!--<div class="OverHidden">金额:<span>{{}}</span></div>-->
                   </div>
                 </div>
               </div>
-              <div class="clearfix" style="border-top:1px solid #D9D9D9;padding: 0 0.15rem;line-height: 0.8rem">
+              <div class="clearfix" style="border-top:1px solid #D9D9D9;padding: 0 0.15rem;line-height: 0.8rem" >
                 <div class="fl" style="font-size: 0.26rem">小计:</div>
                 <div class="fr" style="color: #FF3208;font-size: 0.26rem">{{(item.qty || 0) * (item.orderprice || 0) | computeNum(2)}}</div>
               </div>
@@ -163,11 +219,14 @@
         </div>
       </div>
       <div slot="footer" class="footerBtn clearfix">
-         <span class="item inline-block" @click="checkAll()">
+         <span class="item inline-block" @click="checkAll()" v-show="!isShowApcheckList.showApcheck">
             <label class="mobile-cart-check" :class="{active: !isCheckAll}"></label>全选
          </span>
-        <!--<div class="fr bbgoresult" @click="goTopayfor">结算</div>-->
-        <div class="fr" style="margin-right: 0.2rem">合计:<a style="color: #001408;">{{allMoney}}</a></div>
+        <div class="fr bbgoresult" @click="goTopayfor" v-show="!isShowApcheckList.showApcheck">对账</div>
+        <div class="fr" style="margin-right: 0.2rem" v-show="!isShowApcheckList.showApcheck">合计:<a style="color: #001408;">{{allMoney}}</a></div>
+        <div class="fl" style="margin-left: 0.2rem" v-show="isShowApcheckList.showApcheck">合计:<a style="color: #001408;">{{allMoney}}</a></div>
+        <div class="fr bbgoresult" v-show="isShowApcheckList.showApcheck" @click="submitCheck">提交</div>
+        <div class="fr bbgoresult cancel" v-show="isShowApcheckList.showApcheck" @click="deleteCheck">取消</div>
       </div>
     </modal-wrapper>
     <modal-wrapper :title="'新增对账单'" :showModal="showModal" @closeAction="showModal = false">
@@ -232,6 +291,7 @@
         </div>
       </div>
     </modal-wrapper>
+    <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
     <div class="fixedPicker" v-show="isShowMonthChoose">
       <picker :slots="slots" @change="onValuesChange" :showToolbar="true" ref="picker">
         <div class="titls">选择当前时间</div>
@@ -245,11 +305,13 @@
 <script>
   import { Picker } from 'mint-ui'
   import { ModalWrapper, BaseFilter } from '~components/mobile/base'
-  import { PullUp, EmptyStatus } from '~components/mobile/common'
+  import { PullUp, EmptyStatus, RemindBox } from '~components/mobile/common'
   function years() {
+    let _d = new Date()
+    let _year = Number(_d.getFullYear())
     let arr = []
-    let num = 1989
-    for (let i = 0; i < 99; i++) {
+    let num = 2000
+    for (let i = 2000; i < _year; i++) {
       num++
       arr.push(num + '年')
     }
@@ -257,11 +319,11 @@
   }
   function getMonth() {
     let sdateTo = new Date()
-    console.log(sdateTo.getMonth() - 1)
+    // console.log(sdateTo.getMonth() - 1)
     return sdateTo.getMonth() - 1
   }
   function getYear() {
-    let num = 1989
+    let num = 2000
     let sdateTo = new Date()
     let _year = sdateTo.getFullYear()
     for (let i = 0; i < 99; i++) {
@@ -278,6 +340,9 @@
     middleware: 'authenticated',
     data() {
       return {
+        ShowTitle: false,
+        collectResult: '',
+        timeoutCount: 0,
         isShowMonthChoose: false,
         slots: [
           {
@@ -332,18 +397,30 @@
         showModal: false,
         dateObj: {},
         screenObj: {},
+        outTimeMonth: '',
         isShowApcheckList: {
           show: false,
-          enName: '深圳市优软科技有限公司',
+          enName: '',
           thisMonth: '',
-          list: [{
-            qty: 1,
-            orderprice: 20
-          }, {
-            qty: 3,
-            orderprice: 20
-          }]
-        }
+          list: [],
+          showApcheck: false,
+          id: '',
+          startTime: '',
+          endTime: '',
+          objTime: {}
+        },
+        ApcheckfilterOptions: [
+          {
+            title: '',
+            selectOption: 'date',
+            selectItems: [{
+              key: '自定义',
+              val: 4
+            }],
+            defaultVal: 1
+          }
+        ],
+        ShowApcheckChooseTime: false
       }
     },
     created() {
@@ -353,6 +430,7 @@
       this.getUnread()
       let sdateTo = new Date()
       this.isShowApcheckList.thisMonth = sdateTo.getFullYear() + '-' + sdateTo.getMonth()
+      this.outTimeMonth = sdateTo.getFullYear() + '-' + sdateTo.getMonth()
     },
     // mounted() {
     //   this.$nextTick(() => {
@@ -365,19 +443,34 @@
         if (!this.$value) {
           picker.setSlotValue(0, '2018年')
           picker.setSlotValue(1, '11月')
+          this.$picker = picker
         }
         let _ns = value[0].replace('年', '')
         let _my = value[1].replace('月', '')
         this.$value = _ns + '-' + _my
       },
+      // 选择月份完毕
       resultMonth() {
         this.isShowMonthChoose = false
-        this.isShowApcheckList.thisMonth = this.$value
+        if (this.$monthType === 'out') {
+          this.outTimeMonth = this.$value
+          this.filterParams.page = 1
+          this.setSelect('', '', true)
+        } else {
+          this.isShowApcheckList.thisMonth = this.$value
+          this.ShowApcheckChooseTime = false
+          this.$refs.baseFilter[0].setSelect(1)
           this.showApcheckList()
+        }
       },
+      // 立即对账
       addApCheck() {
         this.showModal = true
       },
+      setRemindText: function (str) {
+        this.collectResult = str
+        this.timeoutCount++
+      },
       setDate (type) {
         if (this.dateObj[type]) {
           // 初始化为00:00:00
@@ -450,6 +543,16 @@
         this.$selectObj = selectObj
         this.setSelect(selectObj.key, selectObj.value, true)
       },
+      ApcheckonSelectAction(selectObj) {
+        if (this.$monthClick) return
+        this.ShowApcheckChooseTime = true
+        this.isShowApcheckList.objTime = selectObj
+        this.getApcheckDetailsinfo(selectObj.key, selectObj.value)
+      },
+      ApcheckonValueAction(selectObj) {
+        this.isShowApcheckList.objTime = selectObj
+        this.getApcheckDetailsinfo(selectObj.key, selectObj.value)
+      },
       // B2B未对账
       // NotapCheck () {
       //   console.log('未对账')
@@ -458,21 +561,37 @@
       showApcheckList(item) {
         this.isShowApcheckList.show = true
         this.isShowApcheckList.enName = item ? item.myEnterprise.enName : this.isShowApcheckList.enName
-        this.$http.get('/sale/apCheck/getAllByKeywords', {
+        this.getApcheckDetailsinfo()
+      },
+      // 未对账详情获取数据
+      getApcheckDetailsinfo (...objTime) {
+        let _params = {
           params: {
             checkDate: this.isShowApcheckList.thisMonth,
-            suuorname: item ? item.myEnterprise.enName : this.isShowApcheckList.enName
+            suuorname: this.isShowApcheckList.enName
+          }
+        }
+        if (this.ShowApcheckChooseTime && !this.$monthClick) {
+          _params = {
+            params: {
+              fromDate: objTime[1].fromDate,
+              endDate: objTime[1].toDate,
+              suuorname: this.isShowApcheckList.enName
+            }
           }
-        }).then(res => {
+        }
+        this.$http.get('/sale/apCheck/getAllByKeywords', _params).then(res => {
           res.data.forEach(item => {
             item.check = true
           })
+          this.$monthClick = false
           this.isShowApcheckList.list = res.data
           this.$nextTick(() => {
             this._initscroll()
           })
         })
       },
+      // 对账全选
       checkAll() {
         let fl = true
         if (this.isCheckAll === 0) {
@@ -489,31 +608,265 @@
           this.$set(this.isShowApcheckList.list[index], 'check', true)
         }
       },
+      // 对账按钮
       goTopayfor() {
-        console.log('结算')
+        let apCheck = {
+          custUu: '',
+          custName: '',
+          enUu: '',
+          apDate: '',
+          beginDate: '',
+          endDate: '',
+          checkStatus: '未对账',
+          checkAmount: 0,
+          currency: '',
+          rate: '',
+          items: [],
+          taxrate: ''
+        }
+        // 保存来源单据相关信息
+        let sourceInfos = []
+
+        // 所允许的本次对账最大最小数量
+        this.isShowApcheckList.list.maxThisCheckQty = 0
+        this.isShowApcheckList.list.minThisCheckQty = 0
+
+        let sameCust = true
+        let validQty = true
+        let _list = []
+        this.isShowApcheckList.list.forEach((check) => {
+          // 保存应收对账单明细行数据
+          let item = {
+            inoutno: '',
+            inoutnodetno: '',
+            orderCode: '',
+            orderClass: '',
+            orderDetno: '',
+            price: '',
+            checkQty: '',
+            amount: '',
+            sourceId: '',
+            sourceTable: '',
+            oldYCheckQty: '',
+            status: 0,
+            receiveCode: '',
+            receiveName: '',
+            prodCode: '',
+            prodTitle: '',
+            prodUnit: '',
+            prodSpec: '',
+            taxrate: '',
+            sendcode: '',
+            whname: '',
+            custUserUU: ''
+          }
+
+          // 应收对账单明细行来源表信息
+          let sourceInfo = {
+            sourceId: '',
+            sourceTable: '',
+            newYCheckQty: ''
+          }
+
+          // 此次对账后新的已转数
+          if (check.check === true) {
+            _list.push(check)
+            apCheck.custName = check.custname
+            apCheck.enUu = check.enuu
+            apCheck.checkAmount += (check.thischeckqty || 0) * (check.orderprice || 0)
+            apCheck.apDate = check.pidate
+            apCheck.rate = check.rate
+
+            // 必须是同一家客户才能生成对账单,否则提示错误
+            if (apCheck.custUu === '') {
+              apCheck.custUu = check.custuu
+            } else if (apCheck.custUu !== check.custuu) {
+              sameCust = false
+              this.setRemindText('请选择同一家客户')
+            }
+
+            // 必须是相同币别才能生成对账单,否则提示错误
+            if (apCheck.currency === '') {
+              apCheck.currency = check.currency
+            } else if (apCheck.currency !== check.currency) {
+              sameCust = false
+              this.setRemindText('请选择同一种币别')
+            }
+            let re = /^[0-9]+.?[0-9]*$/
+            // 必须是相同税率才能生成对账单,否则提示错误
+            if (!re.test(apCheck.taxrate)) {
+            // if (!angular.isNumber(apCheck.taxrate)) {
+              apCheck.taxrate = check.taxrate
+            } else if (apCheck.taxrate !== check.taxrate) {
+              sameCust = false
+              this.setRemindText('请选择相同的税率')
+            }
+
+            // 本次对账数量必须小于总对账数量
+            if (check.qty > 0) {
+              this.isShowApcheckList.list.maxThisCheckQty = check.qty
+              this.isShowApcheckList.list.minThisCheckQty = 0
+              if (check.qty - (check.ycheckqty || 0) < check.thischeckqty || check.thischeckqty < 0 || check.thischeckqty === 0) {
+                validQty = false
+                this.setRemindText('本次对账数量,填写有误!')
+              }
+            } else if (check.qty < 0) {
+              this.isShowApcheckList.list.maxThisCheckQty = 0
+              this.isShowApcheckList.list.minThisCheckQty = check.qty
+              if (((-check.qty) - (-check.ycheckqty) < (-check.thischeckqty)) || check.thischeckqty > 0 || check.thischeckqty === 0) {
+                validQty = false
+                this.setRemindText('本次对账数量,填写有误!')
+              }
+            }
+
+            // 获取筛选时间的开始时间为对账的开始时间
+            apCheck.beginDate = this.$selectObj.value.fromDate
+
+            // 获取筛选的截止时间为对账的截止时间
+            apCheck.endDate = this.$selectObj.value.toDate
+
+            // 应收对账单明细行数据
+            item.orderCode = check.ordercode
+            item.orderClass = check.piclass
+            item.orderDetno = check.orderdetno
+            item.price = check.orderprice
+            item.checkQty = check.thischeckqty
+            item.amount = (check.thischeckqty || 0) * (check.orderprice || 0)
+            item.sourceId = check.sourceid
+            item.sourceTable = check.sourcetable
+            item.oldYCheckQty = check.ycheckqty
+            item.prodCode = check.prodcode
+            item.prodTitle = check.prodtitle
+            item.prodSpec = check.prodspec
+            item.prodUnit = check.produnit
+            item.inoutno = check.inoutno
+            item.inoutnodetno = check.detno
+            item.taxrate = check.taxrate
+            item.receiveCode = check.receivecode
+            item.receiveName = check.receivename
+            item.sendcode = check.sendcode
+            item.whname = check.whname
+            item.custUserUU = check.custuseruu
+
+            // 来源表相关信息
+            sourceInfo.sourceid = check.sourceid
+            sourceInfo.sourcetable = check.sourcetable
+            sourceInfo.newYCheckQty = ((check.ycheckqty || 0) + check.thischeckqty)
+
+            sourceInfos.push(sourceInfo)
+            apCheck.items.push(item)
+            // haveSelected = true
+            // 如果是同一家客户,生成对账单的同时,关闭模态框
+          }
+        })
+        if (sameCust && validQty) {
+          this.isShowApcheckList.list = _list
+          this.saveApCheck(apCheck)
+        }
+      },
+      // 对账提交
+      saveApCheck(apCheck) {
+        if (apCheck.items.length === 0) {
+          this.setRemindText('请先选择需要对账的数据')
+        } else {
+          this.$http.post('/sale/apCheck/operation/save', apCheck).then(res => {
+            this.setRemindText('生成应收对账成功')
+            this.isShowApcheckList.id = res.data.id
+            this.isShowApcheckList.showApcheck = true
+            if (this.ShowApcheckChooseTime) {
+              let _start = new Date(this.isShowApcheckList.objTime.value.fromDate)
+              let _end = new Date(this.isShowApcheckList.objTime.value.toDate)
+              this.isShowApcheckList.startTime = _start.getFullYear() + '-' + (_start.getMonth() + 1) + '-' + _start.getDate()
+              this.isShowApcheckList.endTime = _end.getFullYear() + '-' + (_end.getMonth() + 1) + '-' + _end.getDate()
+            } else {
+              this.isShowApcheckList.startTime = this.outTimeMonth + '-01'
+              let _d = new Date(this.isShowApcheckList.startTime)
+              _d.setDate(1)
+              _d.setMonth(_d.getMonth() + 1)
+              _d.setDate(_d.getDate() - 1)
+              this.isShowApcheckList.endTime = _d.getFullYear() + '-' + (_d.getMonth() + 1) + '-' + _d.getDate()
+            }
+            this.ShowApcheckChooseTime = false
+          }, err => {
+            this.setRemindText('生成对账单失败')
+          })
+        }
+      },
+      // 提交对账单
+      submitCheck() {
+        this.$http.post('sale/apCheck/operation/updateStatus?id=' + this.isShowApcheckList.id).then(res => {
+          this.setRemindText('新增成功')
+          this.isShowApcheckList.showApcheck = false
+          this.isShowApcheckList.show = false
+          this.isShowApcheckList.id = ''
+        })
+      },
+      // 删除对账单
+      deleteCheck() {
+        if (this.isShowApcheckList.id === '') {
+          this.isShowApcheckList.showApcheck = false
+          this.isShowApcheckList.show = false
+          this.isShowApcheckList.id = ''
+          return
+        }
+        this.$http.post('/sale/apCheck/operation/deleteApCheck?id=' + this.isShowApcheckList.id).then(res => {
+          this.isShowApcheckList.showApcheck = false
+          this.isShowApcheckList.show = false
+          this.isShowApcheckList.id = ''
+        }, err => {
+          this.setRemindText(err.response.data)
+        })
+      },
+      // 月份+1
+      addMonth(tp, key, val) {
+        if (tp === 'inside') {
+          let _time = new Date(this.isShowApcheckList.thisMonth)
+          _time.setMonth(_time.getMonth() + val)
+          this.isShowApcheckList.thisMonth = _time.getFullYear() + '-' + (_time.getMonth() + 1)
+          this.ShowApcheckChooseTime = false
+          this.$monthClick = true
+          this.$refs.baseFilter[0].setSelect(1)
+          this.showApcheckList()
+        } else {
+          let _time = new Date(this[key])
+          _time.setMonth(_time.getMonth() + val)
+          this[key] = _time.getFullYear() + '-' + (_time.getMonth() + 1)
+          this.filterParams.page = 1
+          this.setSelect('', '', true)
+        }
       },
       async setSelect(...val) {
         let _url = '/sale/apCheck/info/search'
-        let itemL = {
-          params: {
-            count: this.filterParams.count,
-            page: this.filterParams.page,
-            searchFilter: {'keyword': this.filterParams.keyword || '', 'fromDate': val[1].fromDate, 'endDate': val[1].toDate},
-            sorting: {'recordDate': 'desc'},
-            _state: this.activeType
-          }
-        }
+        let itemL = {}
         if (this.activeType === 'all') {
+          let _fromDate = this.outTimeMonth + '-01 00:00:00'
+          let _d = new Date(_fromDate)
+          _d.setDate(1)
+          _d.setMonth(_d.getMonth() + 1)
+          _d.setDate(_d.getDate() - 1)
+          let _endDate = _d.getFullYear() + '-' + (_d.getMonth() + 1) + '-' + _d.getDate() + ' 00:00:00'
+          _endDate = new Date(_endDate).getTime()
+          _fromDate = new Date(_fromDate).getTime()
            _url = '/sale/apCheck/customer'
           itemL = {
             params: {
               count: 20,
-              page: 1,
+              page: this.filterParams.page,
               keyword: this.filterParams.keyword,
-              searchFilter: {'fromDate': null, 'endDate': 1543981513949},
+              searchFilter: {'fromDate': _fromDate, 'endDate': _endDate},
               sorting: { 'recordDate': 'desc' }
             }
           }
+        } else {
+          itemL = {
+            params: {
+              count: this.filterParams.count,
+              page: this.filterParams.page,
+              searchFilter: {'keyword': this.filterParams.keyword || '', 'fromDate': val[1].fromDate, 'endDate': val[1].toDate},
+              sorting: {'recordDate': 'desc'},
+              _state: this.activeType
+            }
+          }
         }
         let { data } = await this.$http.get(_url, itemL)
         if (!this.resourceList.content) {
@@ -536,6 +889,18 @@
           this.resourceList.content = []
         }
         this.resourceList = data
+      },
+      // 选择月份
+      ShowMonthChoose(tp, key) {
+        this.$monthType = tp
+        if (tp === 'inside') {
+          this.$picker.setSlotValue(0, this.isShowApcheckList.thisMonth.split('-')[0] + '年')
+          this.$picker.setSlotValue(1, this.isShowApcheckList.thisMonth.split('-')[1] + '月')
+        } else {
+          this.$picker.setSlotValue(0, this[key].split('-')[0] + '年')
+          this.$picker.setSlotValue(1, this[key].split('-')[1] + '月')
+        }
+        this.isShowMonthChoose = true
       }
     },
     computed: {
@@ -568,7 +933,8 @@
       BaseFilter,
       PullUp,
       EmptyStatus,
-      Picker
+      Picker,
+      RemindBox
     },
     filters: {
       time: function (time) {
@@ -720,7 +1086,7 @@
         height: 0.82rem;
         line-height: 0.82rem;
         display: inline-block;
-        width: 25%;
+        width: 33.3%;
         text-align: center;
         font-size: .28rem;
         color: #666;
@@ -734,6 +1100,9 @@
     .btobapCheck-wrapper-scroll {
       height: calc(100vh - 1.26rem - 0.98rem - 0.82rem - 1.06rem - 0.92rem);
       overflow-y: auto;
+      &.btobapCheck-wrapper-scroll2 {
+        height: calc(100vh - 1.26rem - 0.98rem - 0.82rem - 1.06rem - 0.92rem - 1.3rem);
+      }
     }
     .filter-wrapper{
       width: 7.1rem;
@@ -917,26 +1286,64 @@
       }
     }
   }
+
+  .timeLine-wrapper {
+    background: #fff;
+    border-radius: 0.05rem;
+    height: 1.1rem;
+    width: 7.1rem;
+    margin: 0 auto 0.2rem;
+    padding: 0.3rem 0 0 2rem;
+    position: relative;
+    .left {
+      background: #fff;
+      color: #333;
+      padding: 0.05rem 0.1rem;
+      box-shadow: 0 0 2px #a0a0a0;
+      text-align: center;
+      margin-right: 0.2rem;
+    }
+    .right {
+      text-align: center;
+      background: #fff;
+      color: #333;
+      padding: 0.05rem 0.1rem;
+      box-shadow: 0 0 2px #a0a0a0;
+      margin-left: 0.2rem;
+    }
+    .rightBtn {
+      margin: 0.1rem 0.2rem 0 0;
+    }
+  }
   .modal-h {
     background: #F3F3F3;
-    padding: 0.15rem;
+    .modal-h-top {
+      padding: 0.15rem;
+    }
     .overflowhidden {
       @include overFlowHidden();
-      width: 4.1rem;
+      width: 5.9rem;
       font-size: 0.28rem;
       color: #333333;
-      margin: 0 0.1rem;
+      margin-left: 0.1rem;
     }
-    div {
-      background: #FFFFFF;
-      border: 1px solid #BFBFBF;
-      border-radius: 4px;
-      font-size: 0.28rem;
-      color: #3E81F6;
-      width: 1.7rem;
-      display: inline-block;
+    .timeLine-wrapper {
+      width: 100%;
+      padding: 0.1rem 0 0.1rem 0rem;
+      height: 1.4rem;
+      margin: 0
     }
   }
+  div.timeLine {
+    background: #FFFFFF;
+    border: 1px solid #BFBFBF;
+    border-radius: 4px;
+    font-size: 0.28rem;
+    color: #3E81F6;
+    width: 1.7rem;
+    display: inline-block;
+    height: 0.4rem;
+  }
   .footerBtn {
     padding: 0 0 0 0.15rem;
     height: 1rem;
@@ -951,5 +1358,10 @@
       width: 1.3rem;
       text-align: center;
     }
+    .cancel {
+      background: #fff;
+      color: #333;
+      height: 0.98rem;
+    }
   }
 </style>