invoiceList.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <view class="content">
  3. <mescroll-body top="0" bottom="0" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback" @up="upCallback">
  4. <view class="list">
  5. <view class="listitem" v-for="(item,index) in dataList" :key="index">
  6. <view class="listitem-head es-pt-24 es-pr-24 es-pb-24 es-pl-24 x-bc">
  7. <view class="listitem-tag" :style="{visibility:item.invoiceKind ? 'visible':'hidden'}">{{item.invoiceKind}}</view>
  8. <!-- 开票状态0未开始2 :开票完成( 最终状 态),
  9. 其他状态分别为: 20:开票中; 21:开票成功签章中;22:开票失败;24: 开票成功签章失败;3:发票已作废 31: 发票作废中
  10. 备注:22、24状态时,无需再查询,请确认开票失败原因以及签章失败原因; 注:请以该状态码区分发票状态 -->
  11. <view class="tag tag_error" v-if="item.redStatus == '01'">作废</view>
  12. <template v-else>
  13. <view class="tag" :class="item.tagColor">{{statusOption(item)}}</view>
  14. </template>
  15. </view>
  16. <view class="listitem-con es-pr-24 es-pb-24 es-pl-24">
  17. <view class="x-f">
  18. <view class="label">开票类型:</view><text>{{item.billType==1 ? "个人/非企业单位" : "企业单位"}}</text>
  19. </view>
  20. <view class="x-f">
  21. <view class="label">发票抬头:</view><text>{{item.payerName}}</text>
  22. </view>
  23. <view class="x-f" v-show="item.payerTaxNo">
  24. <view class="label">发票税号:</view><text>{{item.payerTaxNo}}</text>
  25. </view>
  26. <view class="x-start" v-show="item.invoiceTime">
  27. <view class="label">开票时间:</view><text>{{item.invoiceTime}}</text>
  28. </view>
  29. </view>
  30. <view class="listitem-footer x-bc">
  31. <view class="priceinfo" :style="{visibility:item.orderAmount ? 'visible':'hidden'}">开票金额:<text class="price" style="font-size: 24rpx;">¥</text><text class="price">{{item.orderAmount}}</text></view>
  32. <view class="x-bc">
  33. <view class="btn x-c es-mr-20" v-if="!orderId" @click="handleOrder(item)">相关订单</view>
  34. <view class="btn x-c" @click="handleDetail(item)">查看详情</view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </mescroll-body>
  40. </view>
  41. </template>
  42. <script>
  43. import {billList} from "@/api/store.js"
  44. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  45. export default {
  46. mixins: [MescrollMixin],
  47. data() {
  48. return {
  49. userInfo: {},
  50. mescroll:null,
  51. downOption: { //下拉刷新
  52. use:true,
  53. auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
  54. },
  55. upOption: {
  56. use: true, // 是否启用上拉加载; 默认true
  57. page: {
  58. pae: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  59. size: 10 // 每页数据的数量,默认10
  60. },
  61. noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
  62. textNoMore:"已经到底了",
  63. empty: {
  64. icon:'https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/empty_icon.png',
  65. tip: '暂无数据'
  66. }
  67. },
  68. dataList: [],
  69. orderId: ''
  70. }
  71. },
  72. computed: {
  73. // // 开票状态0未开始2 :开票完成( 最终状 态),
  74. // // 其他状态分别为: 20:开票中; 21:开票成功签章中;22:开票失败;24: 开票成功签章失败;3:发票已作废 31: 发票作废中
  75. // // 备注:22、24状态时,无需再查询,请确认开票失败原因以及签章失败原因; 注:请以该状态码区分发票状态
  76. // tagColor() {
  77. // return (item)=> {
  78. // const tagColor = {
  79. // 0: 'tag_info',
  80. // 2: 'tag_success',
  81. // 20: 'tag_info',
  82. // 21: 'tag_info',
  83. // 22: 'tag_error',
  84. // 24: 'tag_error',
  85. // 3: 'tag_error',
  86. // 31: 'tag_error',
  87. // }
  88. // return item ? tagColor[item.status] || 'tag_info' : 'tag_info'
  89. // }
  90. // },
  91. statusOption() {
  92. return (item)=> {
  93. const status = {
  94. 0: '未开始',
  95. 2: '开票完成',
  96. 20: '开票中',
  97. 21: '开票成功签章中',
  98. 22: '开票失败',
  99. 24: '开票成功签章失败',
  100. 3: '发票已作废',
  101. 31: '发票作废中',
  102. }
  103. return item&&item.statusMsg ? item.status == 2 ? status[item.status] : item.statusMsg : status[item.status]
  104. }
  105. },
  106. },
  107. onLoad(option) {
  108. this.orderId = option.orderId || ''
  109. if(this.orderId) {
  110. uni.setNavigationBarTitle({
  111. title: "开票记录"
  112. })
  113. } else {
  114. uni.setNavigationBarTitle({
  115. title: "开票历史"
  116. })
  117. }
  118. this.userInfo = uni.getStorageSync("userInfo") ? JSON.parse(uni.getStorageSync("userInfo")) : {}
  119. },
  120. onShow() {
  121. if(this.mescroll) this.mescroll.resetUpScroll()
  122. },
  123. methods: {
  124. tagColor(item) {
  125. const map = {
  126. 0: 'tag_info',
  127. 2: 'tag_success',
  128. 20: 'tag_info',
  129. 21: 'tag_info',
  130. 22: 'tag_error',
  131. 24: 'tag_error',
  132. 3: 'tag_error',
  133. 31: 'tag_error',
  134. };
  135. return item ? map[item.status] || 'tag_info' : 'tag_info';
  136. },
  137. mescrollInit(mescroll) {
  138. this.mescroll = mescroll;
  139. },
  140. /*下拉刷新的回调 */
  141. downCallback() {
  142. this.mescroll.resetUpScroll()
  143. },
  144. /*上拉加载的回调*/
  145. upCallback(page) {
  146. //联网加载数据
  147. var that = this;
  148. var data = {
  149. orderId:this.orderId,
  150. userId: this.userInfo.userId,
  151. pageNum: page.num,
  152. pageSize: page.size
  153. };
  154. billList(data).then(res => {
  155. if(res.code==200){
  156. if (page.num == 1) {
  157. that.dataList = res.data.list.map(item=>({
  158. ...item,
  159. tagColor:this.tagColor(item)
  160. }));
  161. } else {
  162. that.dataList = that.dataList.concat(res.data.list);
  163. that.dataList = that.dataList.map(item=>({
  164. ...item,
  165. tagColor:this.tagColor(item)
  166. }));
  167. }
  168. that.mescroll.endBySize(res.data.list.length, res.data.total);
  169. }else{
  170. uni.showToast({
  171. icon:'none',
  172. title: res.msg,
  173. });
  174. that.dataList = null;
  175. that.mescroll.endErr();
  176. }
  177. });
  178. },
  179. handleDetail(item) {
  180. uni.navigateTo({
  181. url: '/pages/store/invoice/invoiceDetail?id='+item.id
  182. })
  183. },
  184. handleOrder(item) {
  185. uni.navigateTo({
  186. url: '/pages/store/storeOrderDetail?orderId='+item.orderId
  187. })
  188. },
  189. }
  190. }
  191. </script>
  192. <style lang="scss" scoped>
  193. .tabbox {
  194. font-family: PingFang SC, PingFang SC;
  195. font-weight: 400;
  196. font-size: 24rpx;
  197. background-color: #fff;
  198. }
  199. .tag {
  200. display: inline-flex;
  201. min-height: 20px;
  202. padding: 5rpx 10rpx;
  203. box-sizing: border-box;
  204. font-size: 24rpx;
  205. box-sizing: border-box;
  206. white-space: nowrap;
  207. text-align: center;
  208. justify-content: center;
  209. }
  210. .tag_info {
  211. color: #909399;
  212. }
  213. .tag_success {
  214. color: #67c23a;
  215. }
  216. .tag_error{
  217. color: #f56c6c;
  218. }
  219. .content {
  220. padding: 24rpx;
  221. .listitem {
  222. background: #FFFFFF;
  223. border-radius: 16rpx 16rpx 16rpx 16rpx;
  224. margin-bottom: 24rpx;
  225. font-family: PingFang SC, PingFang SC;
  226. font-weight: 400;
  227. font-size: 24rpx;
  228. word-break: break-all;
  229. &-head {
  230. // border-bottom: 1rpx solid #f7f7f7;
  231. font-family: PingFang SC, PingFang SC;
  232. font-weight: 400;
  233. font-size: 24rpx;
  234. color: #9B9B9B;
  235. }
  236. &-tag {
  237. padding: 4rpx 10rpx;
  238. background: #fff;
  239. border-radius: 4rpx 4rpx 4rpx 4rpx;
  240. border: 1rpx solid #eee;
  241. margin-right: 10rpx;
  242. border-radius: 5rpx;
  243. }
  244. &-con {
  245. font-size: 24rpx;
  246. color: #626468;
  247. }
  248. .label {
  249. flex-shrink: 0;
  250. color: #222222;
  251. }
  252. .price {
  253. font-weight: 500;
  254. font-size: 30rpx;
  255. color: #FF5C03;
  256. }
  257. &-footer {
  258. font-size: 24rpx;
  259. padding: 0 24rpx 24rpx 24rpx;
  260. }
  261. .btn {
  262. width: 150rpx;
  263. height: 56rpx;
  264. border-radius: 66rpx 66rpx 66rpx 66rpx;
  265. border: 1px solid #DDDDDD;
  266. color: #666666;
  267. }
  268. }
  269. }
  270. </style>