invoiceList.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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="tagColor(item)">{{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://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.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. mescrollInit(mescroll) {
  125. this.mescroll = mescroll;
  126. },
  127. /*下拉刷新的回调 */
  128. downCallback() {
  129. this.mescroll.resetUpScroll()
  130. },
  131. /*上拉加载的回调*/
  132. upCallback(page) {
  133. //联网加载数据
  134. var that = this;
  135. var data = {
  136. orderId:this.orderId,
  137. userId: this.userInfo.userId,
  138. pageNum: page.num,
  139. pageSize: page.size
  140. };
  141. billList(data).then(res => {
  142. if(res.code==200){
  143. if (page.num == 1) {
  144. that.dataList = res.data.list;
  145. } else {
  146. that.dataList = that.dataList.concat(res.data.list);
  147. }
  148. that.mescroll.endBySize(res.data.list.length, res.data.total);
  149. }else{
  150. uni.showToast({
  151. icon:'none',
  152. title: res.msg,
  153. });
  154. that.dataList = null;
  155. that.mescroll.endErr();
  156. }
  157. });
  158. },
  159. handleDetail(item) {
  160. uni.navigateTo({
  161. url: '/pages/store/invoice/invoiceDetail?id='+item.id
  162. })
  163. },
  164. handleOrder(item) {
  165. uni.navigateTo({
  166. url: '/pages/store/storeOrderDetail?orderId='+item.orderId
  167. })
  168. },
  169. }
  170. }
  171. </script>
  172. <style lang="scss" scoped>
  173. .tabbox {
  174. font-family: PingFang SC, PingFang SC;
  175. font-weight: 400;
  176. font-size: 24rpx;
  177. background-color: #fff;
  178. }
  179. .tag {
  180. display: inline-flex;
  181. min-height: 20px;
  182. padding: 5rpx 10rpx;
  183. box-sizing: border-box;
  184. font-size: 24rpx;
  185. box-sizing: border-box;
  186. white-space: nowrap;
  187. text-align: center;
  188. justify-content: center;
  189. }
  190. .tag_info {
  191. color: #909399;
  192. }
  193. .tag_success {
  194. color: #67c23a;
  195. }
  196. .tag_error{
  197. color: #f56c6c;
  198. }
  199. .content {
  200. padding: 24rpx;
  201. .listitem {
  202. background: #FFFFFF;
  203. border-radius: 16rpx 16rpx 16rpx 16rpx;
  204. margin-bottom: 24rpx;
  205. font-family: PingFang SC, PingFang SC;
  206. font-weight: 400;
  207. font-size: 24rpx;
  208. word-break: break-all;
  209. &-head {
  210. // border-bottom: 1rpx solid #f7f7f7;
  211. font-family: PingFang SC, PingFang SC;
  212. font-weight: 400;
  213. font-size: 24rpx;
  214. color: #9B9B9B;
  215. }
  216. &-tag {
  217. padding: 4rpx 10rpx;
  218. background: #fff;
  219. border-radius: 4rpx 4rpx 4rpx 4rpx;
  220. border: 1rpx solid #eee;
  221. margin-right: 10rpx;
  222. border-radius: 5rpx;
  223. }
  224. &-con {
  225. font-size: 24rpx;
  226. color: #626468;
  227. }
  228. .label {
  229. flex-shrink: 0;
  230. color: #222222;
  231. }
  232. .price {
  233. font-weight: 500;
  234. font-size: 30rpx;
  235. color: #FF5C03;
  236. }
  237. &-footer {
  238. font-size: 24rpx;
  239. padding: 0 24rpx 24rpx 24rpx;
  240. }
  241. .btn {
  242. width: 150rpx;
  243. height: 56rpx;
  244. border-radius: 66rpx 66rpx 66rpx 66rpx;
  245. border: 1px solid #DDDDDD;
  246. color: #666666;
  247. }
  248. }
  249. }
  250. </style>