index.vue 19 KB

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