index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. <template>
  2. <div class="invoice-wrapper">
  3. <div class="mobile-nav">
  4. <div class="mobile-header mobile-center-header">
  5. <a @click="goBack()"><i class="iconfont icon-fanhui"></i></a>
  6. <p>发票管理</p>
  7. <p class="en-name">
  8. <img :src="`/images/mobile/center/${user.data.enterprise && user.data.enterprise.uu ? 'en' : 'self'}.png`" alt="">{{currentEnName}}
  9. </p>
  10. </div>
  11. </div>
  12. <div class="order-nav">
  13. <div class="active" @click="changeTab('')"><span>发票信息</span></div>
  14. <nuxt-link to="/mobile/center/user/invoice/waitinvoice" tag="div"><span>待开票订单</span></nuxt-link>
  15. <nuxt-link to="/mobile/center/user/invoice/invoiceRecord" tag=div><span>开票记录</span></nuxt-link>
  16. </div>
  17. <div class="invoice-wrapper-el">
  18. <div class="invoice-top clearfix">
  19. <div class="pull-left">已设置的开票信息</div>
  20. <div class="pull-right" v-if="invoiceList.length !== 2" @click="addInvoiceNew()"><img src="/images/mobile/center/user/icon-rm-invoice.png"/>新增发票</div>
  21. </div>
  22. <div class="invoice-middle" v-if="invoiceList.length > 0">
  23. <div v-for="(item, index) in invoiceList">
  24. <!-- 普票 -->
  25. <div class="invoice-normal" v-if="item.kind === 1206">
  26. <div class="invoice-list clearfix">
  27. <div class="invoice-list-title pull-left">发票类型:</div>
  28. <div class="pull-right normal-primary">普票</div>
  29. </div>
  30. <div class="invoice-list clearfix">
  31. <div class="invoice-list-title pull-left">开票抬头:</div>
  32. <div class="pull-right overhiden">{{item.head}}</div>
  33. </div>
  34. <div class="invoice-list clearfix">
  35. <div class="invoice-list-title pull-left">收票人:</div>
  36. <div class="pull-right overhiden">{{item.name}}</div>
  37. </div>
  38. <div class="invoice-list clearfix">
  39. <div class="invoice-list-title pull-left">收票人电话:</div>
  40. <div class="pull-right overhiden">{{item.telephone}}</div>
  41. </div>
  42. <div class="invoice-list clearfix">
  43. <div class="invoice-list-title pull-left">收票地址:</div>
  44. <div class="pull-right">
  45. <p>{{item.area}}</p>
  46. <p>{{item.detailAddress}}</p>
  47. </div>
  48. </div>
  49. <div class="invoice-controll clearfix">
  50. <div class="pull-left" @click="updateInvoice(item, index)"><i class="iconfont icon-edit" ></i>修改</div>
  51. <div class="pull-left" @click="deleteInvoice(item, index)"><i class="iconfont icon-lajitong" ></i>删除</div>
  52. </div>
  53. </div>
  54. <!-- 专票 -->
  55. <div :style="!hasnormal ? '': 'margin-top: 0.24rem'" class="invoice-normal invoice-speci" v-else-if="item.kind === 1205">
  56. <div class="invoice-list clearfix">
  57. <div class="invoice-list-title pull-left">发票类型:</div>
  58. <div class="pull-right normal-primary ">专票</div>
  59. </div>
  60. <div class="invoice-list clearfix">
  61. <div class="invoice-list-title pull-left">开票抬头:</div>
  62. <div class="pull-right overhiden">{{item.head}}</div>
  63. </div>
  64. <div class="invoice-list clearfix">
  65. <div class="invoice-list-title pull-left">单位地址:</div>
  66. <div class="pull-right overhiden">{{item.companyAddress}}</div>
  67. </div>
  68. <div class="invoice-list clearfix">
  69. <div class="invoice-list-title pull-left">收票电话:</div>
  70. <div class="pull-right">{{item.companyPhone}}</div>
  71. </div>
  72. <div class="invoice-list clearfix">
  73. <div class="invoice-list-title pull-left">税务登记号:</div>
  74. <div class="pull-right overhiden">{{item.companyTaxNumber}}</div>
  75. </div>
  76. <div class="invoice-list clearfix">
  77. <div class="invoice-list-title pull-left">开户银行:</div>
  78. <div class="pull-right overhiden">{{item.bankName}}</div>
  79. </div>
  80. <div class="invoice-list clearfix">
  81. <div class="invoice-list-title pull-left">开户银行账号:</div>
  82. <div class="pull-right overhiden">{{item.bankAccount}}</div>
  83. </div>
  84. <div class="invoice-list clearfix">
  85. <div class="invoice-list-title pull-left">收票人:</div>
  86. <div class="pull-right">{{item.name}}</div>
  87. </div>
  88. <div class="invoice-list clearfix">
  89. <div class="invoice-list-title pull-left">联系电话:</div>
  90. <div class="pull-right">{{item.telephone}}</div>
  91. </div>
  92. <div class="invoice-list clearfix">
  93. <div class="invoice-list-title pull-left">收票地址:</div>
  94. <div class="pull-right">
  95. <p>{{item.area}}</p>
  96. <p>{{item.detailAddress}}</p>
  97. </div>
  98. </div>
  99. <div class="invoice-controll clearfix">
  100. <div class="pull-left" @click="updateInvoice(item, index)"><i class="iconfont icon-edit" ></i>修改</div>
  101. <div class="pull-left" @click="deleteInvoice(item, index)"><i class="iconfont icon-lajitong" ></i>删除</div>
  102. </div>
  103. </div>
  104. </div>
  105. </div>
  106. <div class="com-none-state" v-if="invoiceList.length === 0">
  107. <img src="/images/mobile/@2x/empty-collect.png">
  108. <p>抱歉,暂无发票消息</p>
  109. </div>
  110. </div>
  111. <div class="deleteKuang" v-if="showDeleteAlert" @touchmove="preventTouchMove($event)">
  112. <div class="kuangContent">
  113. <div class="title">删除信息</div>
  114. <div class="titleinfo">是否删除此发票信息</div>
  115. <!--<div class="info" v-show="isUploadpro">*存在已上架信息</div>-->
  116. <div class="K_btn">
  117. <div class="cancelBtn" @click="showDeleteAlert = false">取消</div>
  118. <div class="answerBtn" @click="deleteFn()">确定</div>
  119. </div>
  120. </div>
  121. </div>
  122. <mobile-footer></mobile-footer>
  123. <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
  124. <addinvoice
  125. :chooseItem="chooseItem"
  126. @addinvoiceBtn="addinvoiceFn"
  127. v-if="showAddinvoice"
  128. :isSaveinvoiceType="$kind"
  129. :joinType="joinType"
  130. ></addinvoice>
  131. </div>
  132. </template>
  133. <script>
  134. import axios from '~plugins/axios'
  135. import { RemindBox } from '~components/mobile/common'
  136. import { addinvoice } from '~components/mobile/center'
  137. import { MobileFooter } from '~components/mobile'
  138. export default {
  139. name: 'invoice-view',
  140. middleware: 'authenticated',
  141. layout: 'mobile',
  142. data() {
  143. return {
  144. activeType: '',
  145. invoiceList: [],
  146. hasnormal: false, // 是否拥有普票
  147. showDeleteAlert: false,
  148. collectResult: '',
  149. timeoutCount: 0,
  150. chooseItem: {},
  151. showAddinvoice: false,
  152. $kind: 0,
  153. joinType: 'add'
  154. }
  155. },
  156. async asyncData() {
  157. let { data } = await axios.get('/trade/bill/list/personal')
  158. let _arr = []
  159. data.forEach(obj => {
  160. if (obj.kind === 1206) {
  161. _arr.splice(0, 0, obj)
  162. } else {
  163. _arr.push(obj)
  164. }
  165. })
  166. let hasnormal = data.find(item => {
  167. return item.kind === 1206
  168. })
  169. return {
  170. invoiceList: _arr,
  171. hasnormal: hasnormal
  172. }
  173. },
  174. methods: {
  175. changeTab(str) {
  176. this.activeType = str
  177. },
  178. deleteInvoice(item, index) {
  179. this.$item = item
  180. this.$index = index
  181. this.showDeleteAlert = true
  182. },
  183. async addinvoiceFn(ty, item) {
  184. this.showAddinvoice = false
  185. let { data } = await axios.get('/trade/bill/list/personal')
  186. let _arr = []
  187. data.forEach(obj => {
  188. if (obj.kind === 1206) {
  189. _arr.splice(0, 0, obj)
  190. } else {
  191. _arr.push(obj)
  192. }
  193. })
  194. let hasnormal = data.find(item => {
  195. return item.kind === 1206
  196. })
  197. this.invoiceList = _arr
  198. this.hasnormal = hasnormal
  199. },
  200. updateInvoice(item, index) {
  201. this.joinType = 'update'
  202. this.chooseItem = item
  203. this.$kind = 0
  204. this.showAddinvoice = true
  205. },
  206. addInvoiceNew() {
  207. this.joinType = 'add'
  208. this.$kind = this.invoiceList.length > 0 ? this.invoiceList[0].kind : 0
  209. this.chooseItem = {}
  210. this.showAddinvoice = true
  211. },
  212. deleteFn() {
  213. this.$http.delete(`/trade/bill/delete/${this.$item.id}`).then(res => {
  214. this.setRemindText('删除成功')
  215. this.showDeleteAlert = false
  216. this.invoiceList.splice(this.$index, 1)
  217. })
  218. },
  219. setRemindText(str) {
  220. this.collectResult = str
  221. this.timeoutCount++
  222. }
  223. },
  224. components: {
  225. RemindBox,
  226. addinvoice,
  227. MobileFooter
  228. }
  229. }
  230. </script>
  231. <style lang="scss" scoped>
  232. @import '~assets/scss/mobileInvoice';
  233. @mixin overFlowHidden {
  234. overflow: hidden;
  235. text-overflow: ellipsis;
  236. white-space: nowrap;
  237. }
  238. @mixin lineHeight($value) {
  239. height: $value;
  240. line-height: $value;
  241. }
  242. .invoice-wrapper {
  243. background: #f1f3f6;
  244. /*margin: 1.26rem 0 0 0;*/
  245. left: 0;
  246. bottom: 0;
  247. top: 0;
  248. right: 0;
  249. z-index: 11;
  250. /*padding: 0.82rem 0 1.04rem;*/
  251. /*height: calc(100vh - 1.26rem);*/
  252. position: absolute;
  253. width: 100%;
  254. .invoice-wrapper-el {
  255. margin: 2.08rem 0 0.98rem;
  256. height: calc(100vh - 1.26rem - 0.98rem);
  257. overflow-y: scroll;
  258. padding-bottom: 0.98rem;
  259. }
  260. /*overflow-y: scroll;*/
  261. .mobile-header{
  262. position: fixed;
  263. top: 0;
  264. z-index: 10;
  265. width:100%;
  266. height: 1.26rem;
  267. line-height: 1.26rem;
  268. /*border-bottom:.01rem solid #ccc;*/
  269. background: #3e82f5;
  270. padding:0 .2rem 0 .1rem;
  271. color:#fff;
  272. }
  273. .mobile-header p{
  274. overflow: hidden;
  275. text-overflow: ellipsis;
  276. white-space: nowrap;
  277. font-size:.36rem;
  278. text-align: center;
  279. width: 6rem;
  280. padding-left: 1rem;
  281. }
  282. .mobile-center-header p.en-name {
  283. font-size: .3rem;
  284. }
  285. .mobile-header a{
  286. font-size:.28rem;
  287. color:#fff;
  288. position: absolute;
  289. }
  290. .mobile-header a i{
  291. font-size: .48rem;
  292. margin-right: -.1rem;
  293. }
  294. .order-nav {
  295. background: #fff;
  296. position: fixed;
  297. top: 1.26rem;
  298. width: 100%;
  299. z-index: 10;
  300. div {
  301. height: 0.82rem;
  302. line-height: 0.82rem;
  303. display: inline-block;
  304. width: 33.3%;
  305. text-align: center;
  306. font-size: .28rem;
  307. color: #666;
  308. &.active span{
  309. color: #3f84f6;
  310. border-bottom: 0.04rem solid #3f84f6;
  311. padding-bottom: 0.2rem;
  312. }
  313. }
  314. }
  315. .invoice-top {
  316. padding: 0 0.3rem;
  317. font-weight: bold;
  318. font-size: 0.28rem;
  319. color: #333;
  320. @include lineHeight(0.78rem);
  321. img {
  322. width: 0.29rem;
  323. vertical-align: top;
  324. height: 0.33rem;
  325. margin-top: 0.22rem;
  326. margin-right: 0.04rem;
  327. }
  328. }
  329. .invoice-middle {
  330. padding-bottom: 0.4rem;
  331. .invoice-normal {
  332. font-size: 0.28rem;
  333. line-height: 0.76rem;
  334. background: #fff;
  335. margin: 0 0.3rem;
  336. color: #333;
  337. .invoice-list {
  338. .pull-right {
  339. max-width: 4.4rem;
  340. text-align: right;
  341. }
  342. .overhiden {
  343. @include overFlowHidden()
  344. }
  345. border-bottom: 1px solid #d9d9d9;
  346. padding: 0 0.24rem;
  347. .invoice-list-title {
  348. color: #666;
  349. width: 2rem;
  350. display: inline-block;
  351. text-align: justify;
  352. vertical-align: top;
  353. height: 0.76rem;
  354. &:after {
  355. content: '';
  356. display: inline-block;
  357. width: 100%;
  358. overflow: hidden;
  359. height: 0;
  360. }
  361. }
  362. p {
  363. line-height: 0.4rem;
  364. }
  365. &:nth-last-of-type(2){
  366. padding: 0.2rem 0.24rem;
  367. }
  368. .normal-primary {
  369. margin-top: 0.24rem;
  370. color: #15b262;
  371. font-size: 0.24rem;
  372. width: 0.7rem;
  373. @include lineHeight(0.32rem);
  374. text-align: center;
  375. border-radius: 0.07rem;
  376. border: 1px solid #15b262;
  377. background: #e7f7ef;
  378. }
  379. }
  380. }
  381. .invoice-speci {
  382. .invoice-list {
  383. .normal-primary {
  384. background: #fff5e5;
  385. color: #fe9d03;
  386. border: 1px solid #fe9d03;
  387. }
  388. }
  389. }
  390. .invoice-controll {
  391. color: #333;
  392. text-align: center;
  393. font-size: 0.26rem;
  394. @include lineHeight(0.8rem);
  395. div {
  396. width: 50%;
  397. &:nth-child(1) {
  398. border-right: 1px solid #d9d9d9;
  399. }
  400. }
  401. .icon-edit {
  402. font-size: 0.34rem;
  403. vertical-align: top;
  404. margin-top: 0.02rem;
  405. }
  406. .icon-lajitong {
  407. font-size: 0.35rem;
  408. vertical-align: top;
  409. margin-top: 0.02rem;
  410. }
  411. }
  412. }
  413. .com-none-state {
  414. background: #fff;
  415. margin: 0 0.3rem;
  416. padding-bottom: 2rem;
  417. width: auto;
  418. }
  419. .deleteKuang {
  420. position: fixed;
  421. background: rgba(0,0,0,0.5);
  422. top: 0;
  423. left: 0;
  424. right: 0;
  425. bottom: 0;
  426. z-index: 9999;
  427. .kuangContent {
  428. border-radius: 5px;
  429. background: #fff;
  430. width: 5rem;
  431. position: absolute;
  432. left: 50%;
  433. top: 50%;
  434. transform: translate3d(-50%, -50%, 0);
  435. overflow: hidden;
  436. .titleinfo {
  437. font-size: .3rem;
  438. color: #666;
  439. text-align: center;
  440. margin-top: 0.5rem;
  441. margin-bottom: 0.1rem;
  442. }
  443. .title {
  444. background: #5078cb;
  445. height: .7rem;
  446. line-height: .7rem;
  447. font-size: .3rem;
  448. color: #fff;
  449. text-align: center;
  450. }
  451. .info {
  452. color: #f00;
  453. text-align: center;
  454. }
  455. .K_btn {
  456. margin-top: 0.4rem;
  457. line-height: 0.7rem;
  458. height: 0.7rem;
  459. &::after{
  460. clear: both;
  461. display: block;
  462. content: ' ';
  463. visibility: hidden;
  464. zoom: 1;
  465. }
  466. div {
  467. float: left;
  468. width: 50%;
  469. font-size: 0.3rem;
  470. text-align: center;
  471. &.cancelBtn {
  472. background: #b4b5b9;
  473. color: #333;
  474. }
  475. &.answerBtn {
  476. background: #5078cb;
  477. color: #fff;
  478. }
  479. }
  480. }
  481. }
  482. }
  483. .mi-remind-area {
  484. background: #fff;
  485. }
  486. }
  487. </style>