index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. <template>
  2. <div class="mobile-invoice mobile-content mobile-content-long vendor-invoice" style="background: #f1f3f6" :class="{'invoice-record': switchType == 'record'}" @click="showFilterInvoiceType = false">
  3. <div class="switch-head" style="border:0">
  4. <div class="com-switch-head clearfix" style="line-height: 0.78rem">
  5. <div style="width: 50%" class="pull-left">
  6. <span style="margin: 0" class="com-switch-item inline-block" :class="{active: switchType == 'apply'}" @click="setSwitchType('apply')">待开票</span>
  7. </div>
  8. <div style="width: 50%" class="pull-left">
  9. <span class="com-switch-item inline-block" :class="{active: switchType == 'record'}" @click="setSwitchType('record')">已开票</span>
  10. </div>
  11. </div>
  12. </div>
  13. <div class="search-content mi-search-content">
  14. <input type="text" v-model="filterParams.keyword" @keyup.13="onFilter" placeholder="买家/订单号/收票人/联系电话">
  15. <span @click="onFilter"><i class="iconfont icon-sousuo"></i></span>
  16. </div>
  17. <div class="mi-remind-area" :class="{less: !showMoreRemind}" v-if="switchType == 'apply'">
  18. <p class="title">温馨提示</p>
  19. <p class="content">
  20. <span class="inline-block">1、</span>
  21. <span class="inline-block">买家只能对订单状态为<b>“交易成功”</b>,且已不能再发起售后的人民币交易订单进行补开发票。</span>
  22. </p>
  23. <p class="content">
  24. <span class="inline-block">2、</span>
  25. <span class="inline-block">发票金额为产品总金额且不含运费、积分、优惠券、促销折扣等金额。</span>
  26. </p>
  27. <p class="content">
  28. <span class="inline-block">3、</span>
  29. <span class="inline-block">发票邮寄费用将由卖家承担。</span>
  30. </p>
  31. <p class="more" @click="showMoreRemind = !showMoreRemind">{{showMoreRemind ? '收起' : '查看更多'}}
  32. <i v-show="showMoreRemind" class="iconfont icon-shangshuangjiantou"></i>
  33. <i v-show="!showMoreRemind" class="iconfont icon-xiashuangjiantou"></i>
  34. </p>
  35. </div>
  36. <div class="mi-list-content" style="background: #f1f3f6;" :style="switchType == 'apply' ? 'padding-top: 0.21rem' : ''">
  37. <!--<div class="mi-lc-filters clearfix">-->
  38. <!--<div class="com-select-wrap fr" @click.stop="showFilterInvoiceType = !showFilterInvoiceType">{{filterParams.invoicetype === 1206 ? '普票' : filterParams.invoicetype === 1205 ? '专票' : '全部'}}-->
  39. <!--<ul class="select-list" v-show="showFilterInvoiceType">-->
  40. <!--<li @click.stop="setInvoiceType(null)" v-if="filterParams.invoicetype">全部</li>-->
  41. <!--<li @click.stop="setInvoiceType(1206)" v-if="filterParams.invoicetype != 1206">普票</li>-->
  42. <!--<li @click.stop="setInvoiceType(1205)" v-if="filterParams.invoicetype != 1205">专票</li>-->
  43. <!--</ul>-->
  44. <!--</div>-->
  45. <!--</div>-->
  46. <ul class="mi-list" v-if="invoiceList.length">
  47. <li v-for="inv in invoiceList" @click="setActive(inv)" :class="{active: inv.$active && switchType == 'apply'}">
  48. <div class="mi-list-top clearfix">
  49. <span class="inline-block title">
  50. <label class="bottom-modal-check mobile-cart-check" :class="{active: inv.$active}">
  51. <!--<input type="checkbox">-->
  52. </label>
  53. {{inv.createTime | date}}
  54. </span>
  55. <span class="inline-block content pull-right" style="margin-right: 0.8rem;">{{inv.status == 101 ? '待开票' : '已开票'}}
  56. </span>
  57. <!--<div class="pull-left"></div>-->
  58. <!--<div class="pull-right" style="margin-right: 0.8rem;">{{inv.status == 101 ? '待开票' : '已开票'}}</div>-->
  59. </div>
  60. <div class="mi-list-bottom">
  61. <div class="list clearfix">
  62. <div class="clearfix pull-left w50">
  63. <div class="pull-left">发票抬头:</div>
  64. <div class="pull-left overhidden" style="width: 1.85rem">{{inv.invoicetitle}}</div>
  65. </div>
  66. <div class="clearfix pull-left w50">
  67. <div class="pull-left">发票金额:</div>
  68. <div class="pull-left overhidden" style="width: 1.85rem">¥{{inv.price || 0}}</div>
  69. </div>
  70. </div>
  71. <div class="list" v-if="inv.invoicetype === 1205">
  72. <div class="clearfix">
  73. <div class="pull-left">单位电话:</div>
  74. <div class="pull-left overhidden" style="width: 4.6rem;">
  75. {{inv.billInfo.companyPhone || '-'}}
  76. </div>
  77. </div>
  78. </div>
  79. <div class="list" v-if="inv.invoicetype === 1205">
  80. <div class="clearfix">
  81. <div class="pull-left">单位地址:</div>
  82. <div class="pull-left overhidden" style="width: 4.6rem;">
  83. {{inv.billInfo.companyAddress || '-'}}
  84. </div>
  85. </div>
  86. </div>
  87. <div class="list" v-if="inv.invoicetype === 1205">
  88. <div class="clearfix">
  89. <div class="pull-left">税务登记号:</div>
  90. <div class="pull-left overhidden" style="width: 4.8rem;">
  91. {{inv.billInfo.companyTaxNumber || '-'}}
  92. </div>
  93. </div>
  94. </div>
  95. <div class="list" v-if="inv.invoicetype === 1205">
  96. <div class="clearfix">
  97. <div class="pull-left">开户银行名称:</div>
  98. <div class="pull-left overhidden" style="width: 4.6rem;">
  99. {{inv.billInfo.bankName || '-'}}
  100. </div>
  101. </div>
  102. </div>
  103. <div class="list" v-if="inv.invoicetype === 1205">
  104. <div class="clearfix">
  105. <div class="pull-left">开户银行账户:</div>
  106. <div class="pull-left overhidden" style="width: 4.6rem;">
  107. {{inv.billInfo.bankAccount || '-'}}
  108. </div>
  109. </div>
  110. </div>
  111. <div class="list clearfix">
  112. <div class="clearfix pull-left">
  113. <div class="pull-left">收票人:</div>
  114. <div class="pull-left overhidden" style="width:2.1rem">{{inv.receiverName}}</div>
  115. </div>
  116. </div>
  117. <div class="list clearfix">
  118. <div class="clearfix pull-left">
  119. <div class="pull-left">收票电话:</div>
  120. <div class="pull-left overhidden">{{inv.recTel}}</div>
  121. </div>
  122. </div>
  123. <div class="list ">
  124. <div class="clearfix">
  125. <div class="pull-left">收票地址:</div>
  126. <div class="pull-left" style="width: 5rem;">
  127. {{inv.invoiceAddress}}
  128. </div>
  129. </div>
  130. </div>
  131. <div class="list ">
  132. <div class="clearfix">
  133. <div class="pull-left">买家:</div>
  134. <div class="pull-left" style="width: 5rem;">
  135. {{inv.submiter.userName}}
  136. </div>
  137. </div>
  138. </div>
  139. <div class="list ">
  140. <div class="clearfix">
  141. <div class="pull-left">订单号:</div>
  142. <div class="pull-left">
  143. <nuxt-link class="block link" :key="id" :to="`/mobile/order/details?uuid=${baseUtils.enidfilter(id)}&type=buyer`" v-for="id in inv.orderids.split(',')">
  144. {{id}}
  145. </nuxt-link>
  146. </div>
  147. </div>
  148. </div>
  149. </div>
  150. <div class="fixedImg">
  151. <img src="/images/mobile/center/invoice-spec2.png" v-if="inv.invoicetype === 1205"/>
  152. <img src="/images/mobile/center/invoice-nor2.png" v-else/>
  153. </div>
  154. </li>
  155. </ul>
  156. <!--<ul class="mi-list" v-if="invoiceList.length">-->
  157. <!--<li v-for="inv in invoiceList" @click="setActive(inv)" :class="{active: inv.$active && switchType == 'apply'}">-->
  158. <!--<div class="line">-->
  159. <!--<span class="inline-block title">-->
  160. <!--<label class="bottom-modal-check mobile-cart-check" :class="{active: inv.$active}">-->
  161. <!--&lt;!&ndash;<input type="checkbox">&ndash;&gt;-->
  162. <!--</label>-->
  163. <!--类型:-->
  164. <!--</span>-->
  165. <!--<span class="inline-block content">-->
  166. <!--<i class="inv" :class="{'spec-inv' : inv.invoicetype === 1205}">{{inv.invoicetype === 1206 ? '普票' : '专票'}}</i>-->
  167. <!--</span>-->
  168. <!--</div>-->
  169. <!--<div class="line">-->
  170. <!--<span class="inline-block title">-->
  171. <!--申请时间:-->
  172. <!--</span>-->
  173. <!--<span class="inline-block content">{{inv.createTime | date}}</span>-->
  174. <!--</div>-->
  175. <!--<div class="line">-->
  176. <!--<span class="inline-block title">-->
  177. <!--订单号:-->
  178. <!--</span>-->
  179. <!--<span class="inline-block content">-->
  180. <!--<span @click.stop="goOrderDetail(inv, index)" class="block link" :key="id" v-for="(id, index) in inv.orderids.split(',')">-->
  181. <!--{{id}}-->
  182. <!--</span>-->
  183. <!--</span>-->
  184. <!--</div>-->
  185. <!--<div class="line">-->
  186. <!--<span class="inline-block title">-->
  187. <!--可开票金额:-->
  188. <!--</span>-->
  189. <!--<span class="inline-block content price">¥{{inv.price || 0}}</span>-->
  190. <!--</div>-->
  191. <!--<div class="line">-->
  192. <!--<span class="inline-block title">-->
  193. <!--发票抬头:-->
  194. <!--</span>-->
  195. <!--<span class="inline-block content">{{inv.invoicetitle}}</span>-->
  196. <!--</div>-->
  197. <!--<template v-if="inv.invoicetype == 1205">-->
  198. <!--<div class="line">-->
  199. <!--<span class="inline-block title">-->
  200. <!--单位地址:-->
  201. <!--</span>-->
  202. <!--<span class="inline-block content">{{inv.billInfo.companyAddress || '-'}}</span>-->
  203. <!--</div>-->
  204. <!--<div class="line">-->
  205. <!--<span class="inline-block title">-->
  206. <!--单位电话:-->
  207. <!--</span>-->
  208. <!--<span class="inline-block content">{{inv.billInfo.companyPhone || '-'}}</span>-->
  209. <!--</div>-->
  210. <!--<div class="line">-->
  211. <!--<span class="inline-block title">-->
  212. <!--税务登记号:-->
  213. <!--</span>-->
  214. <!--<span class="inline-block content">{{inv.billInfo.companyTaxNumber || '-'}}</span>-->
  215. <!--</div>-->
  216. <!--<div class="line">-->
  217. <!--<span class="inline-block title">-->
  218. <!--开户银行:-->
  219. <!--</span>-->
  220. <!--<span class="inline-block content">{{inv.billInfo.bankName || '-'}}</span>-->
  221. <!--</div>-->
  222. <!--<div class="line">-->
  223. <!--<span class="inline-block title">-->
  224. <!--开户银行账户:-->
  225. <!--</span>-->
  226. <!--<span class="inline-block content">{{inv.billInfo.bankAccount || '-'}}</span>-->
  227. <!--</div>-->
  228. <!--</template>-->
  229. <!--<div class="line">-->
  230. <!--<span class="inline-block title">-->
  231. <!--收票人:-->
  232. <!--</span>-->
  233. <!--<span class="inline-block content">{{inv.receiverName}}</span>-->
  234. <!--</div>-->
  235. <!--<div class="line">-->
  236. <!--<span class="inline-block title">-->
  237. <!--联系电话:-->
  238. <!--</span>-->
  239. <!--<span class="inline-block content">{{inv.recTel}}</span>-->
  240. <!--</div>-->
  241. <!--<div class="line">-->
  242. <!--<span class="inline-block title">-->
  243. <!--收票地址:-->
  244. <!--</span>-->
  245. <!--<span class="inline-block content">{{inv.invoiceAddress}}</span>-->
  246. <!--</div>-->
  247. <!--</li>-->
  248. <!--</ul>-->
  249. <empty-status
  250. :text="'暂无开票信息'"
  251. :showLink="false"
  252. v-else></empty-status>
  253. </div>
  254. <div class="mi-fix-result" v-if="invoiceList.length">
  255. <label class="bottom-modal-check mobile-cart-check" :class="{active: allChecked}">
  256. <input type="checkbox" @change="setActive()">
  257. <span>全选</span>
  258. </label>
  259. <button @click="submit">确认开票</button>
  260. </div>
  261. <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
  262. <pull-up :searchMore="fetching" :allPage="invoices.data.totalPages" :page="page" @pullUpAction="onPullUp"></pull-up>
  263. <remind-ope-modal :text="'点击【确认】系统将通知买家发票已寄出,否则请点击【取消】'"
  264. :show="Boolean(operateIds)"
  265. @closeAction="closeRemindOpe"
  266. ></remind-ope-modal>
  267. </div>
  268. </template>
  269. <script>
  270. import { RemindBox, PullUp, EmptyStatus } from '~components/mobile/common'
  271. import { RemindOpeModal } from '~components/mobile/base'
  272. export default {
  273. layout: 'mobile',
  274. middleware: 'authenticated',
  275. data () {
  276. return {
  277. remindText: '',
  278. timeoutCount: '',
  279. invoiceList: [],
  280. isChange: false,
  281. page: 1,
  282. count: 10,
  283. filterParams: {
  284. invoicetype: '',
  285. keyword: ''
  286. },
  287. showFilterInvoiceType: false,
  288. operateIds: null,
  289. switchType: 'apply',
  290. showMoreRemind: false
  291. }
  292. },
  293. components: {
  294. RemindBox,
  295. PullUp,
  296. RemindOpeModal,
  297. EmptyStatus
  298. },
  299. fetch ({store}) {
  300. return Promise.all([
  301. store.dispatch('invoice/getInvoices', {count: 10, page: 1, role: 'SELLER', sorting: {'createTime': 'DESC'}, status: 101})
  302. ])
  303. },
  304. watch: {
  305. '$store.state.invoice.data.invoices.data': {
  306. handler: function (val) {
  307. if (val && val.content) {
  308. if (this.isChange) {
  309. this.invoiceList = []
  310. this.isChange = false
  311. }
  312. let arr = this.baseUtils.deepCopy(val.content)
  313. arr.forEach(item => {
  314. // item.orderidArr = item.orderids.split(',')
  315. // item.purchaseidArr = item.purchaseids ? item.purchaseids.split(',') : null
  316. item.billInfo = item.billInfo ? JSON.parse(item.billInfo) : {}
  317. item.$active = false
  318. })
  319. this.invoiceList = [...this.invoiceList, ...arr]
  320. }
  321. },
  322. immediate: true
  323. }
  324. },
  325. computed: {
  326. invoices () {
  327. return this.$store.state.invoice.data.invoices
  328. },
  329. fetching () {
  330. return this.invoices.fetching
  331. },
  332. listActiveFlag () {
  333. let allChecked = true
  334. for (let i = 0; i < this.invoiceList.length; i++) {
  335. if (!this.invoiceList[i].$active) {
  336. allChecked = false
  337. break
  338. }
  339. }
  340. return allChecked
  341. },
  342. allChecked () {
  343. return this.invoiceList.length && this.listActiveFlag
  344. }
  345. },
  346. methods: {
  347. setRemindText: function (str) {
  348. this.remindText = str
  349. this.timeoutCount++
  350. },
  351. initParams () {
  352. this.page = 1
  353. this.filterParams.invoicetype = null
  354. this.filterParams.keyword = null
  355. this.operateIds = null
  356. },
  357. setActive (inv) {
  358. if (inv) {
  359. inv.$active = !inv.$active
  360. } else {
  361. // 先存储 否则会重新计算
  362. let flag = !this.allChecked
  363. this.invoiceList.forEach(item => {
  364. item.$active = flag
  365. })
  366. }
  367. },
  368. reloadList () {
  369. return this.$store.dispatch('invoice/getInvoices', {count: this.count, page: this.page, role: 'SELLER', sorting: {'createTime': 'DESC'}, status: this.switchType === 'record' ? 102 : 101, invoicetype: this.filterParams.invoicetype, keyword: this.filterParams.keyword})
  370. },
  371. onPullUp () {
  372. this.page++
  373. this.reloadList()
  374. },
  375. onFilter () {
  376. this.isChange = true
  377. this.page = 1
  378. return this.reloadList()
  379. },
  380. setInvoiceType (type) {
  381. this.filterParams.invoicetype = type
  382. this.showFilterInvoiceType = false
  383. this.onFilter()
  384. },
  385. submit () {
  386. let arr = []
  387. this.invoiceList.forEach(item => {
  388. if (item.$active) {
  389. arr.push(item.id)
  390. }
  391. })
  392. if (arr.length) {
  393. this.operateIds = arr.join(',')
  394. } else {
  395. this.setRemindText('请先勾选开票申请')
  396. }
  397. },
  398. doSubmit () {
  399. return this.$http.put(`/trade/billSubmit/${this.operateIds}`).then(res => {
  400. if (res.data.length) {
  401. this.setRemindText('开票成功')
  402. this.initParams()
  403. this.onFilter()
  404. } else {
  405. this.setRemindText('开票失败,请重试')
  406. }
  407. }, err => {
  408. this.setRemindText(err.response.data || '开票失败,请重试')
  409. })
  410. },
  411. closeRemindOpe (flag) {
  412. if (flag) {
  413. this.doSubmit()
  414. } else {
  415. this.operateIds = null
  416. }
  417. },
  418. setSwitchType (type) {
  419. this.initParams()
  420. this.switchType = type
  421. this.onFilter()
  422. // .then(() => {
  423. // this.switchType = type
  424. // })
  425. },
  426. goOrderDetail (inv, index) {
  427. if (inv.purchaseids) {
  428. this.$router.push(`/mobile/order/details?uuid=${this.baseUtils.enidfilter(inv.purchaseids.split(',')[index])}&type=saler`)
  429. } else {
  430. this.setRemindText('获取订单号失败')
  431. }
  432. }
  433. }
  434. }
  435. </script>
  436. <style lang="scss" scoped>
  437. @import '~assets/scss/mobileInvoice';
  438. .com-switch-head .com-switch-item.active {
  439. border-bottom: 0.04rem solid #3f84f6;
  440. }
  441. .vendor-invoice {
  442. .mi-list {
  443. padding-bottom: 2rem !important;
  444. }
  445. &.invoice-record {
  446. .mi-list {
  447. padding-bottom: .68rem !important;
  448. }
  449. }
  450. }
  451. @mixin overFlowHidden {
  452. overflow: hidden;
  453. text-overflow: ellipsis;
  454. white-space: nowrap;
  455. }
  456. @mixin lineHeight($value) {
  457. height: $value;
  458. line-height: $value;
  459. }
  460. .mobile-invoice.invoice-record .mi-list li .title label {
  461. display: none;
  462. }
  463. .mobile-invoice.vendor-invoice {
  464. .mi-list {
  465. padding: 0;
  466. li {
  467. background: #fff;
  468. border-radius: 0.05rem;
  469. border: 1px solid #e3e5e8;
  470. margin: 0 0.2rem 0.3rem;
  471. padding: 0 0.24rem;
  472. position: relative;
  473. .fixedImg {
  474. position: absolute;
  475. right: 0;
  476. top: 0;
  477. img {
  478. width: 0.82rem;
  479. height: 0.82rem;
  480. }
  481. }
  482. .mi-list-top {
  483. @include lineHeight(0.55rem);
  484. font-size: 0.28rem;
  485. color: #333;
  486. border-bottom: 1px solid #d3d3d3;
  487. }
  488. .mi-list-bottom {
  489. font-size: 0.28rem;
  490. color: #333;
  491. padding: 0.2rem 0;
  492. .list {
  493. line-height: 0.55rem;
  494. }
  495. .overhidden {
  496. @include overFlowHidden()
  497. }
  498. .w50 {
  499. width: 50%;
  500. }
  501. }
  502. }
  503. }
  504. }
  505. </style>