index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  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 w50">
  113. <div class="pull-left">收票人:</div>
  114. <div class="pull-left overhidden" style="width:2.1rem">{{inv.receiverName}}</div>
  115. </div>
  116. <div class="clearfix pull-left w50">
  117. <div class="pull-left">收票电话:</div>
  118. <div class="pull-left overhidden">{{inv.recTel}}</div>
  119. </div>
  120. </div>
  121. <div class="list ">
  122. <div class="clearfix">
  123. <div class="pull-left">收票地址:</div>
  124. <div class="pull-left" style="width: 5rem;">
  125. {{inv.invoiceAddress}}
  126. </div>
  127. </div>
  128. </div>
  129. <div class="list ">
  130. <div class="clearfix">
  131. <div class="pull-left">订单号:</div>
  132. <div class="pull-left">
  133. <nuxt-link class="block link" :key="id" :to="`/mobile/order/details?uuid=${baseUtils.enidfilter(id)}&type=buyer`" v-for="id in inv.orderids.split(',')">
  134. {{id}}
  135. </nuxt-link>
  136. </div>
  137. </div>
  138. </div>
  139. </div>
  140. <div class="fixedImg">
  141. <img src="/images/mobile/center/invoice-spec2.png" v-if="inv.invoicetype === 1205"/>
  142. <img src="/images/mobile/center/invoice-nor2.png" v-else/>
  143. </div>
  144. </li>
  145. </ul>
  146. <!--<ul class="mi-list" v-if="invoiceList.length">-->
  147. <!--<li v-for="inv in invoiceList" @click="setActive(inv)" :class="{active: inv.$active && switchType == 'apply'}">-->
  148. <!--<div class="line">-->
  149. <!--<span class="inline-block title">-->
  150. <!--<label class="bottom-modal-check mobile-cart-check" :class="{active: inv.$active}">-->
  151. <!--&lt;!&ndash;<input type="checkbox">&ndash;&gt;-->
  152. <!--</label>-->
  153. <!--类型:-->
  154. <!--</span>-->
  155. <!--<span class="inline-block content">-->
  156. <!--<i class="inv" :class="{'spec-inv' : inv.invoicetype === 1205}">{{inv.invoicetype === 1206 ? '普票' : '专票'}}</i>-->
  157. <!--</span>-->
  158. <!--</div>-->
  159. <!--<div class="line">-->
  160. <!--<span class="inline-block title">-->
  161. <!--申请时间:-->
  162. <!--</span>-->
  163. <!--<span class="inline-block content">{{inv.createTime | date}}</span>-->
  164. <!--</div>-->
  165. <!--<div class="line">-->
  166. <!--<span class="inline-block title">-->
  167. <!--订单号:-->
  168. <!--</span>-->
  169. <!--<span class="inline-block content">-->
  170. <!--<span @click.stop="goOrderDetail(inv, index)" class="block link" :key="id" v-for="(id, index) in inv.orderids.split(',')">-->
  171. <!--{{id}}-->
  172. <!--</span>-->
  173. <!--</span>-->
  174. <!--</div>-->
  175. <!--<div class="line">-->
  176. <!--<span class="inline-block title">-->
  177. <!--可开票金额:-->
  178. <!--</span>-->
  179. <!--<span class="inline-block content price">¥{{inv.price || 0}}</span>-->
  180. <!--</div>-->
  181. <!--<div class="line">-->
  182. <!--<span class="inline-block title">-->
  183. <!--发票抬头:-->
  184. <!--</span>-->
  185. <!--<span class="inline-block content">{{inv.invoicetitle}}</span>-->
  186. <!--</div>-->
  187. <!--<template v-if="inv.invoicetype == 1205">-->
  188. <!--<div class="line">-->
  189. <!--<span class="inline-block title">-->
  190. <!--单位地址:-->
  191. <!--</span>-->
  192. <!--<span class="inline-block content">{{inv.billInfo.companyAddress || '-'}}</span>-->
  193. <!--</div>-->
  194. <!--<div class="line">-->
  195. <!--<span class="inline-block title">-->
  196. <!--单位电话:-->
  197. <!--</span>-->
  198. <!--<span class="inline-block content">{{inv.billInfo.companyPhone || '-'}}</span>-->
  199. <!--</div>-->
  200. <!--<div class="line">-->
  201. <!--<span class="inline-block title">-->
  202. <!--税务登记号:-->
  203. <!--</span>-->
  204. <!--<span class="inline-block content">{{inv.billInfo.companyTaxNumber || '-'}}</span>-->
  205. <!--</div>-->
  206. <!--<div class="line">-->
  207. <!--<span class="inline-block title">-->
  208. <!--开户银行:-->
  209. <!--</span>-->
  210. <!--<span class="inline-block content">{{inv.billInfo.bankName || '-'}}</span>-->
  211. <!--</div>-->
  212. <!--<div class="line">-->
  213. <!--<span class="inline-block title">-->
  214. <!--开户银行账户:-->
  215. <!--</span>-->
  216. <!--<span class="inline-block content">{{inv.billInfo.bankAccount || '-'}}</span>-->
  217. <!--</div>-->
  218. <!--</template>-->
  219. <!--<div class="line">-->
  220. <!--<span class="inline-block title">-->
  221. <!--收票人:-->
  222. <!--</span>-->
  223. <!--<span class="inline-block content">{{inv.receiverName}}</span>-->
  224. <!--</div>-->
  225. <!--<div class="line">-->
  226. <!--<span class="inline-block title">-->
  227. <!--联系电话:-->
  228. <!--</span>-->
  229. <!--<span class="inline-block content">{{inv.recTel}}</span>-->
  230. <!--</div>-->
  231. <!--<div class="line">-->
  232. <!--<span class="inline-block title">-->
  233. <!--收票地址:-->
  234. <!--</span>-->
  235. <!--<span class="inline-block content">{{inv.invoiceAddress}}</span>-->
  236. <!--</div>-->
  237. <!--</li>-->
  238. <!--</ul>-->
  239. <empty-status
  240. :text="'暂无开票信息'"
  241. :showLink="false"
  242. v-else></empty-status>
  243. </div>
  244. <div class="mi-fix-result" v-if="invoiceList.length">
  245. <label class="bottom-modal-check mobile-cart-check" :class="{active: allChecked}">
  246. <input type="checkbox" @change="setActive()">
  247. <span>全选</span>
  248. </label>
  249. <button @click="submit">确认开票</button>
  250. </div>
  251. <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
  252. <pull-up :searchMore="fetching" :allPage="invoices.data.totalPages" :page="page" @pullUpAction="onPullUp"></pull-up>
  253. <remind-ope-modal :text="'点击【确认】系统将通知买家发票已寄出,否则请点击【取消】'"
  254. :show="Boolean(operateIds)"
  255. @closeAction="closeRemindOpe"
  256. ></remind-ope-modal>
  257. </div>
  258. </template>
  259. <script>
  260. import { RemindBox, PullUp, EmptyStatus } from '~components/mobile/common'
  261. import { RemindOpeModal } from '~components/mobile/base'
  262. export default {
  263. layout: 'mobile',
  264. middleware: 'authenticated',
  265. data () {
  266. return {
  267. remindText: '',
  268. timeoutCount: '',
  269. invoiceList: [],
  270. isChange: false,
  271. page: 1,
  272. count: 10,
  273. filterParams: {
  274. invoicetype: '',
  275. keyword: ''
  276. },
  277. showFilterInvoiceType: false,
  278. operateIds: null,
  279. switchType: 'apply',
  280. showMoreRemind: false
  281. }
  282. },
  283. components: {
  284. RemindBox,
  285. PullUp,
  286. RemindOpeModal,
  287. EmptyStatus
  288. },
  289. fetch ({store}) {
  290. return Promise.all([
  291. store.dispatch('invoice/getInvoices', {count: 10, page: 1, role: 'SELLER', sorting: {'createTime': 'DESC'}, status: 101})
  292. ])
  293. },
  294. watch: {
  295. '$store.state.invoice.data.invoices.data': {
  296. handler: function (val) {
  297. if (val && val.content) {
  298. if (this.isChange) {
  299. this.invoiceList = []
  300. this.isChange = false
  301. }
  302. let arr = this.baseUtils.deepCopy(val.content)
  303. arr.forEach(item => {
  304. // item.orderidArr = item.orderids.split(',')
  305. // item.purchaseidArr = item.purchaseids ? item.purchaseids.split(',') : null
  306. item.billInfo = item.billInfo ? JSON.parse(item.billInfo) : {}
  307. item.$active = false
  308. })
  309. this.invoiceList = [...this.invoiceList, ...arr]
  310. }
  311. },
  312. immediate: true
  313. }
  314. },
  315. computed: {
  316. invoices () {
  317. return this.$store.state.invoice.data.invoices
  318. },
  319. fetching () {
  320. return this.invoices.fetching
  321. },
  322. listActiveFlag () {
  323. let allChecked = true
  324. for (let i = 0; i < this.invoiceList.length; i++) {
  325. if (!this.invoiceList[i].$active) {
  326. allChecked = false
  327. break
  328. }
  329. }
  330. return allChecked
  331. },
  332. allChecked () {
  333. return this.invoiceList.length && this.listActiveFlag
  334. }
  335. },
  336. methods: {
  337. setRemindText: function (str) {
  338. this.remindText = str
  339. this.timeoutCount++
  340. },
  341. initParams () {
  342. this.page = 1
  343. this.filterParams.invoicetype = null
  344. this.filterParams.keyword = null
  345. this.operateIds = null
  346. },
  347. setActive (inv) {
  348. if (inv) {
  349. inv.$active = !inv.$active
  350. } else {
  351. // 先存储 否则会重新计算
  352. let flag = !this.allChecked
  353. this.invoiceList.forEach(item => {
  354. item.$active = flag
  355. })
  356. }
  357. },
  358. reloadList () {
  359. 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})
  360. },
  361. onPullUp () {
  362. this.page++
  363. this.reloadList()
  364. },
  365. onFilter () {
  366. this.isChange = true
  367. this.page = 1
  368. return this.reloadList()
  369. },
  370. setInvoiceType (type) {
  371. this.filterParams.invoicetype = type
  372. this.showFilterInvoiceType = false
  373. this.onFilter()
  374. },
  375. submit () {
  376. let arr = []
  377. this.invoiceList.forEach(item => {
  378. if (item.$active) {
  379. arr.push(item.id)
  380. }
  381. })
  382. if (arr.length) {
  383. this.operateIds = arr.join(',')
  384. } else {
  385. this.setRemindText('请先勾选开票申请')
  386. }
  387. },
  388. doSubmit () {
  389. return this.$http.put(`/trade/billSubmit/${this.operateIds}`).then(res => {
  390. if (res.data.length) {
  391. this.setRemindText('开票成功')
  392. this.initParams()
  393. this.onFilter()
  394. } else {
  395. this.setRemindText('开票失败,请重试')
  396. }
  397. }, err => {
  398. this.setRemindText(err.response.data || '开票失败,请重试')
  399. })
  400. },
  401. closeRemindOpe (flag) {
  402. if (flag) {
  403. this.doSubmit()
  404. } else {
  405. this.operateIds = null
  406. }
  407. },
  408. setSwitchType (type) {
  409. this.initParams()
  410. this.switchType = type
  411. this.onFilter()
  412. // .then(() => {
  413. // this.switchType = type
  414. // })
  415. },
  416. goOrderDetail (inv, index) {
  417. if (inv.purchaseids) {
  418. this.$router.push(`/mobile/order/details?uuid=${this.baseUtils.enidfilter(inv.purchaseids.split(',')[index])}&type=saler`)
  419. } else {
  420. this.setRemindText('获取订单号失败')
  421. }
  422. }
  423. }
  424. }
  425. </script>
  426. <style lang="scss" scoped>
  427. @import '~assets/scss/mobileInvoice';
  428. .com-switch-head .com-switch-item.active {
  429. border-bottom: 0.04rem solid #3f84f6;
  430. }
  431. .vendor-invoice {
  432. .mi-list {
  433. padding-bottom: 2rem !important;
  434. }
  435. &.invoice-record {
  436. .mi-list {
  437. padding-bottom: .68rem !important;
  438. }
  439. }
  440. }
  441. @mixin overFlowHidden {
  442. overflow: hidden;
  443. text-overflow: ellipsis;
  444. white-space: nowrap;
  445. }
  446. @mixin lineHeight($value) {
  447. height: $value;
  448. line-height: $value;
  449. }
  450. .mobile-invoice.invoice-record .mi-list li .title label {
  451. display: none;
  452. }
  453. .mobile-invoice.vendor-invoice {
  454. .mi-list {
  455. padding: 0;
  456. li {
  457. background: #fff;
  458. border-radius: 0.05rem;
  459. border: 1px solid #e3e5e8;
  460. margin: 0 0.2rem 0.3rem;
  461. padding: 0 0.24rem;
  462. position: relative;
  463. .fixedImg {
  464. position: absolute;
  465. right: 0;
  466. top: 0;
  467. img {
  468. width: 0.82rem;
  469. height: 0.82rem;
  470. }
  471. }
  472. .mi-list-top {
  473. @include lineHeight(0.55rem);
  474. font-size: 0.28rem;
  475. color: #333;
  476. border-bottom: 1px solid #d3d3d3;
  477. }
  478. .mi-list-bottom {
  479. font-size: 0.28rem;
  480. color: #333;
  481. padding: 0.2rem 0;
  482. .list {
  483. line-height: 0.55rem;
  484. }
  485. .overhidden {
  486. @include overFlowHidden()
  487. }
  488. .w50 {
  489. width: 50%;
  490. }
  491. }
  492. }
  493. }
  494. }
  495. </style>