btobapCheck.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. <template>
  2. <div>
  3. <div class="btobapCheck-wrapper">
  4. <div class="order-tab">
  5. <div class="order-tab-wrapper clearfix">
  6. <div class="fl active tab">B2B</div>
  7. <nuxt-link class="fl tab" to="/mobile/center/vendor/payCenter" tag="div" >
  8. 商城
  9. </nuxt-link>
  10. </div>
  11. </div>
  12. <div class="order-nav">
  13. <div :class="activeType === 'all' ? 'active': ''" @click="ChangeList('all')"><span>全部</span></div>
  14. <div :class="activeType === 'done' ? 'active': ''" @click="ChangeList('done')"><span>已确认</span></div>
  15. <div :class="activeType === 'todo' ? 'active' : ''" @click="ChangeList('todo')"><span>未对账</span></div>
  16. <div :class="activeType === 'end' ? 'active' : ''" @click="ChangeList('end')"><span>已作废</span></div>
  17. </div>
  18. <div class="search-content mi-search-content">
  19. <input type="text" v-model="filterParams.keyword" @keyup.13="onFilter" placeholder="单据编号/客户名称/物料名称">
  20. <span @click="onFilter"><i class="iconfont icon-sousuo"></i></span>
  21. </div>
  22. <div class="btobapCheck-wrapper-scroll" id="btobapCheck-wrapper-scroll">
  23. <div class="filter-wrapper">
  24. <base-filter
  25. v-for="filterOption in filterOptions"
  26. :key="filterOption.selectOption"
  27. :selectItems="filterOption.selectItems"
  28. :defaultVal="filterOption.defaultVal"
  29. :selectOption="filterOption.selectOption"
  30. @selectAction="onSelectAction"
  31. @valueAction="onValueAction"
  32. :title="filterOption.title">
  33. </base-filter>
  34. </div>
  35. <div v-if="resourceList.content && resourceList.content.length > 0">
  36. <div class="invoice-btob-list" v-for="item in resourceList.content" :key="item.id">
  37. <div class="invoice-btob-wrapper-top">
  38. <span class="read" v-if="!isUnread(item.id)" style="margin-right: 0.3rem">已读</span>
  39. <span class="noread" v-if="isUnread(item.id)" style="margin-right: 0.3rem">未读</span>
  40. <span style="margin-right: 0.3rem">{{item.recordDate | time}}</span>
  41. <span class="isPut" v-if="item.status">已提交</span>
  42. <span class="noPut" v-else>未提交</span>
  43. </div>
  44. <div class="invoice-btob-wrapper-middle">
  45. <div class="invoice-btob-wrapper-middle-title">{{item.custName}}</div>
  46. <div @click="lookDetails(item.id)"><span>单据编号:</span><a>{{item.code}}</a></div>
  47. </div>
  48. <div class="invoice-btob-wrapper-content">
  49. <div><span>对账期间:</span>{{item.beginDate | time}} - {{item.endDate | time}}</div>
  50. <div><span>对账金额:</span>{{isUser ? '-' : item.checkAmount}}</div>
  51. <div><span>明细条目:</span>{{item.items.length}}</div>
  52. <div><span>商品总数:</span>{{item.getTotalProd}}</div>
  53. <div><span>对账结果:</span>{{item.checkStatus}}</div>
  54. </div>
  55. </div>
  56. </div>
  57. <empty-status
  58. v-else
  59. :text="'暂无对账信息'"
  60. :showLink="false"
  61. ></empty-status>
  62. <pull-up :fixId="'btobapCheck-wrapper-scroll'" :allPage="allPage" :page="filterParams.page" @pullUpAction="onPullUpAction"></pull-up>
  63. </div>
  64. </div>
  65. <modal-wrapper :title="'新增对账单'" :showModal="showModal" @closeAction="showModal = false">
  66. <div class="btobapCheck-modal">
  67. <div class="search-content mi-search-content">
  68. <input type="text" placeholder="选择对账客户">
  69. <span @click="toChooseUser"><i class="iconfont icon-sousuo"></i></span>
  70. </div>
  71. <div>
  72. <span class="title inline-block" style="font-size: 0.28rem;color: #666666;line-height: 0.5rem;margin-top:0.18rem">单据时间:</span>
  73. <div class="date-wrap">
  74. <label>
  75. <i class="iconfont icon-ico-date"></i>
  76. <input type="date" v-model="dateObj.fromDate" @change="setDate('fromDate')">
  77. <p v-if="dateObj.fromDate">{{dateObj.fromDate | date}}</p>
  78. </label>
  79. <span></span>
  80. <label>
  81. <i class="iconfont icon-ico-date"></i>
  82. <input type="date" v-model="dateObj.toDate" @change="setDate('toDate')">
  83. <p v-if="dateObj.toDate">{{dateObj.toDate | date}}</p>
  84. </label>
  85. </div>
  86. </div>
  87. </div>
  88. </modal-wrapper>
  89. </div>
  90. </template>
  91. <script>
  92. import { ModalWrapper, BaseFilter } from '~components/mobile/base'
  93. import { PullUp, EmptyStatus } from '~components/mobile/common'
  94. export default {
  95. layout: 'mobile',
  96. middleware: 'authenticated',
  97. data() {
  98. return {
  99. activeType: 'all',
  100. filterParams: {
  101. keyword: '',
  102. page: 1,
  103. count: 10
  104. },
  105. filterOptions: [
  106. {
  107. title: '交易时间',
  108. selectOption: 'date',
  109. selectItems: [{
  110. key: '30天',
  111. val: 1
  112. }, {
  113. key: '90天',
  114. val: 2
  115. }, {
  116. key: '180天',
  117. val: 3
  118. }, {
  119. key: '自定义',
  120. val: 4
  121. }],
  122. defaultVal: 1
  123. }
  124. ],
  125. resourceList: {
  126. content: []
  127. },
  128. isUser: false,
  129. unreadCode: [],
  130. showModal: true,
  131. dateObj: {}
  132. }
  133. },
  134. created() {
  135. this.$http.get('/account/role/isUser').then(res => {
  136. this.isUser = res.data.isUser
  137. })
  138. this.getUnread()
  139. },
  140. methods: {
  141. setDate (type) {
  142. if (this.dateObj[type]) {
  143. // 初始化为00:00:00
  144. this.dateObj[type] = new Date(this.dateObj[type]).getTime() - 8 * 60 * 60 * 1000
  145. if (this.dateObj.fromDate && this.dateObj.toDate && this.dateObj.fromDate > this.dateObj.toDate) {
  146. if (type === 'fromDate') {
  147. this.setRemindText('起始时间不能大于结束时间')
  148. } else {
  149. this.setRemindText('结束时间不能小于起始时间')
  150. }
  151. this.dateObj[type] = null
  152. }
  153. // else {
  154. // if (this.dateObj.fromDate && this.dateObj.toDate && this.dateObj.fromDate === this.dateObj.toDate) {
  155. // // 23:59:59
  156. // this.dateObj.toDate += 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000
  157. // }
  158. // }
  159. // 23:59:59
  160. if (this.dateObj.toDate && type === 'toDate') {
  161. this.dateObj.toDate += (23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000)
  162. }
  163. } else {
  164. this.dateObj[type] = null
  165. }
  166. },
  167. toChooseUser() {
  168. console.log('选择客户')
  169. },
  170. onPullUpAction () {
  171. this.filterParams.page++
  172. this.setSelect(this.$selectObj.key, this.$selectObj.value, false)
  173. },
  174. getUnread() {
  175. this.$http.get('/sale/apCheck/unread').then(res => {
  176. this.unreadCode = res.data.content
  177. })
  178. },
  179. lookDetails(id) {
  180. console.log('前往详情并且设置为已读')
  181. // if (!this.isUnread(id)) { } else {
  182. // let sourceId = []
  183. // sourceId.push(id)
  184. // this.$http.post('/sale/sample/setRead', sourceId).then(res => {
  185. // this.getUnread()
  186. // })
  187. // }
  188. },
  189. isUnread: function (id) {
  190. for (let i in this.unreadCode) {
  191. if (id === this.unreadCode[i]) {
  192. return true
  193. }
  194. }
  195. },
  196. ChangeList(tp) {
  197. this.activeType = tp
  198. this.filterParams.page = 1
  199. this.setSelect(this.$selectObj.key, this.$selectObj.value, true)
  200. },
  201. onFilter() {
  202. this.filterParams.page = 1
  203. this.setSelect(this.$selectObj.key, this.$selectObj.value, true)
  204. },
  205. onSelectAction(selectObj) {
  206. this.$selectObj = selectObj
  207. this.setSelect(selectObj.key, selectObj.value, true)
  208. },
  209. onValueAction(selectObj) {
  210. this.$selectObj = selectObj
  211. this.setSelect(selectObj.key, selectObj.value, true)
  212. },
  213. async setSelect(...val) {
  214. let { data } = await this.$http.get('/sale/apCheck/info/search', {
  215. params: {
  216. count: this.filterParams.count,
  217. page: this.filterParams.page,
  218. searchFilter: {'keyword': this.filterParams.keyword || '', 'fromDate': val[1].fromDate, 'endDate': val[1].toDate},
  219. sorting: {'recordDate': 'desc'},
  220. _state: this.activeType
  221. }})
  222. if (!this.resourceList.content) {
  223. this.resourceList.content = []
  224. }
  225. data.content.forEach(item => {
  226. item.checkAmount = item.checkAmount.toFixed(2)
  227. item.getTotalProd = 0
  228. item.items.forEach(im => {
  229. item.getTotalProd += im.checkQty
  230. })
  231. })
  232. if (!val[2]) {
  233. this.resourceList.content.push(...data.content)
  234. data.content = this.resourceList.content
  235. } else {
  236. this.resourceList.content = []
  237. }
  238. this.resourceList = data
  239. }
  240. },
  241. computed: {
  242. allPage () {
  243. return Math.ceil(this.resourceList.totalElement / 10)
  244. },
  245. isEmpty () {
  246. return this.resourceList.content.length === 0
  247. }
  248. },
  249. components: {
  250. ModalWrapper,
  251. BaseFilter,
  252. PullUp,
  253. EmptyStatus
  254. },
  255. filters: {
  256. time: function (time) {
  257. if (typeof time === 'number') {
  258. if (!time) {
  259. return '无'
  260. } else {
  261. let d = new Date(time)
  262. let year = d.getFullYear()
  263. let month = d.getMonth() + 1
  264. let day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate()
  265. return year + '-' + month + '-' + day
  266. }
  267. }
  268. }
  269. }
  270. }
  271. </script>
  272. <style lang="scss" scoped>
  273. @mixin overFlowHidden {
  274. overflow: hidden;
  275. text-overflow: ellipsis;
  276. white-space: nowrap;
  277. }
  278. .btobapCheck-wrapper {
  279. background: #f1f3f6;
  280. margin: 1.26rem 0 0.98rem 0;
  281. .search-content {
  282. padding: .24rem 0;
  283. text-align: center;
  284. background: #f1f3f6;
  285. input {
  286. width: 6.48rem;
  287. height: .58rem;
  288. line-height: .58rem;
  289. border-radius: .14rem;
  290. margin: 0 0 0 .11rem;
  291. font-size: .26rem;
  292. padding: 0 .71rem 0 .21rem;
  293. border: 1px solid #3f84f6;
  294. }
  295. }
  296. .order-tab {
  297. background: #3f84f6;
  298. padding-bottom: 0.2rem;
  299. .order-tab-wrapper {
  300. border: solid 1px #ffffff;
  301. width: 7.06rem;
  302. margin: 0 auto;
  303. border-radius: 0.04rem;
  304. line-height: 0.72rem;
  305. height: 0.72rem;
  306. overflow: hidden;
  307. div {
  308. color: #ffffff;
  309. font-size: 0.28rem;
  310. text-align: center;
  311. width: 50%;
  312. &.active {
  313. background-color: #ffffff;
  314. color: #3f84f6;
  315. }
  316. }
  317. }
  318. }
  319. .order-nav {
  320. background: #fff;
  321. div {
  322. height: 0.82rem;
  323. line-height: 0.82rem;
  324. display: inline-block;
  325. width: 25%;
  326. text-align: center;
  327. font-size: .28rem;
  328. color: #666;
  329. &.active span{
  330. color: #3f84f6;
  331. border-bottom: 0.04rem solid #3f84f6;
  332. padding-bottom: 0.2rem;
  333. }
  334. }
  335. }
  336. .btobapCheck-wrapper-scroll {
  337. height: calc(100vh - 1.26rem - 0.98rem - 0.82rem - 1.06rem - 0.92rem);
  338. overflow-y: auto;
  339. }
  340. .filter-wrapper{
  341. width: 7.1rem;
  342. margin: 0 auto 0.27rem;
  343. background: #fff;
  344. padding: 0.27rem 0.2rem;
  345. border-radius: 0.05rem;
  346. }
  347. .invoice-btob-list {
  348. width: 7.1rem;
  349. margin: 0 auto 0.2rem;
  350. background: #FFFFFF;
  351. border-radius: 0.05rem;
  352. padding: 0 0.24rem;
  353. }
  354. .invoice-btob-wrapper-top {
  355. height: 0.8rem;
  356. span{
  357. margin-top: 0.24rem;
  358. display: inline-block;
  359. font-size: 0.28rem;
  360. color: #333333;
  361. height:0.25rem;
  362. &.read {
  363. color: #15B262;
  364. }
  365. &.noread {
  366. color: #DE4545;
  367. }
  368. &.isPut {
  369. background: #15B262;
  370. color: #FFFFFF;
  371. font-size: 0.24rem;
  372. border-radius: 0.04rem;
  373. }
  374. &.noPut {
  375. font-size: 0.24rem;
  376. background: #DE4545;
  377. color: #FFFFFF;
  378. border-radius: 0.04rem;
  379. }
  380. }
  381. }
  382. .invoice-btob-wrapper-middle {
  383. border-top: 1px solid #D9D9D9;
  384. @include overFlowHidden();
  385. padding-top: 0.15rem;
  386. font-size: 0.28rem;
  387. color: #151515;
  388. line-height: 0.5rem;
  389. padding-bottom: 0.15rem;
  390. span {
  391. color: #666666;
  392. }
  393. .invoice-btob-wrapper-middle .tilte{
  394. color: #333333;
  395. }
  396. }
  397. .invoice-btob-wrapper-content {
  398. border-top: 1px solid #D9D9D9;
  399. @include overFlowHidden();
  400. padding-top: 0.15rem;
  401. font-size: 0.28rem;
  402. color: #151515;
  403. line-height: 0.5rem;
  404. padding-bottom: 0.15rem;
  405. span {
  406. color: #666666;
  407. }
  408. }
  409. }
  410. .btobapCheck-modal {
  411. .search-content input {border: 1px solid #3f84f6;}
  412. .date-wrap{
  413. text-align: center;
  414. display: inline-block;
  415. label {
  416. width: 2.3rem;
  417. height: .5rem;
  418. line-height: .5rem;
  419. border-radius: .04rem;
  420. border: 1px solid #bfbfbf;
  421. background: url(/images/mobile/select-arrow.png) no-repeat;
  422. background-size: .12rem .06rem;
  423. vertical-align: middle;
  424. background-color: #fff;
  425. background-position: 2.1rem .2rem;
  426. position: relative;
  427. margin: .2rem 0 0 0;
  428. i {
  429. font-size: .28rem;
  430. color: #3f84f6;
  431. margin-left: .1rem;
  432. float: left;
  433. }
  434. input {
  435. opacity: 0;
  436. width: 2.22rem;
  437. height: .5rem;
  438. position: absolute;
  439. left: 0;
  440. z-index: 1;
  441. }
  442. p {
  443. font-weight: normal;
  444. font-size: .22rem;
  445. color: #3E81F6;
  446. text-align: left;
  447. text-indent: 10px;
  448. }
  449. }
  450. span {
  451. color: #a0a0a0;
  452. margin: 0.3rem .1rem 0;
  453. width: .4rem;
  454. display: inline-block;
  455. text-align: center;
  456. vertical-align: top;
  457. }
  458. }
  459. }
  460. </style>