success.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <view class="success">
  3. <view class="item flex" v-for="(item,ind) in navList[tabCurrentIndex].orderList">
  4. <image class="avatar" :src="item.photo" mode="scaleToFill"></image>
  5. <view class="item-content">
  6. <view class="item-name">
  7. {{item.name}}({{item.gender_name}})
  8. </view>
  9. <view class="item-tip">
  10. <text class="type">证件:</text>{{item.idcard}}
  11. </view>
  12. <view class="item-tip">
  13. <text class="type">时间:</text>{{item.date}}
  14. </view>
  15. <view class="item-tip">
  16. <text class="type">编码:</text>{{item.code}}
  17. </view>
  18. </view>
  19. <view class="item-status position-relative">
  20. <view class="level" v-if="item.status==0">
  21. 待审核
  22. </view>
  23. <view class="level" v-if="item.status==1">
  24. 已通过
  25. </view>
  26. <view class="level" v-if="item.status==2">
  27. 未通过
  28. </view>
  29. <view class="level">
  30. {{item.level_name}}
  31. </view>
  32. <navigator :url="'./showCertificate?id='+item.id">
  33. <view class="buttom">
  34. 查看证书
  35. </view>
  36. </navigator>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. import {
  43. getUserInfo
  44. } from '@/api/login.js'
  45. import {
  46. getCertList
  47. } from '@/api/certificate.js'
  48. export default {
  49. data() {
  50. return {
  51. tabCurrentIndex: 0,
  52. navList: [{
  53. state: 2,
  54. text: '已使用',
  55. loadingType: 'more',
  56. orderList: [],
  57. page: 1, //当前页数
  58. limit: 10 //每次信息条数
  59. }]
  60. }
  61. },
  62. onLoad(options) {
  63. getUserInfo().then(() => {
  64. this.loadData();
  65. });
  66. },
  67. onReachBottom() {
  68. this.loadData();
  69. },
  70. methods: {
  71. loadData(source) {
  72. //这里是将订单挂载到tab列表下
  73. let index = this.tabCurrentIndex;
  74. let navItem = this.navList[index];
  75. let state = navItem.state;
  76. if (source === 'tabChange' && navItem.loaded === true) {
  77. //tab切换只有第一次需要加载数据
  78. return;
  79. }
  80. if (navItem.loadingType === 'loading') {
  81. //防止重复加载
  82. return;
  83. }
  84. // 修改当前对象状态为加载中
  85. navItem.loadingType = 'loading';
  86. getCertList({
  87. page: navItem.page,
  88. limit: navItem.limit
  89. })
  90. .then(({
  91. data
  92. }) => {
  93. let list = data.list.data;
  94. navItem.orderList = navItem.orderList.concat(list);
  95. console.log(navItem.orderList);
  96. navItem.page++;
  97. if (navItem.limit == list.length) {
  98. //判断是否还有数据, 有改为 more, 没有改为noMore
  99. navItem.loadingType = 'more';
  100. return;
  101. } else {
  102. //判断是否还有数据, 有改为 more, 没有改为noMore
  103. navItem.loadingType = 'noMore';
  104. if(navItem.orderList.length==0){
  105. uni.showModal({
  106. title: '提示',
  107. content: '您未申请证书是否立即申请',
  108. success: res => {
  109. if(res.confirm){
  110. uni.navigateTo({
  111. url:'/pages/certificate/apply'
  112. })
  113. }
  114. },
  115. fail: () => {},
  116. complete: () => {}
  117. });
  118. }
  119. }
  120. uni.hideLoading();
  121. this.$set(navItem, 'loaded', true);
  122. })
  123. .catch(e => {
  124. console.log(e);
  125. });
  126. },
  127. }
  128. }
  129. </script>
  130. <style lang="scss" scoped>
  131. page {
  132. height: 100%;
  133. }
  134. .success {
  135. padding: 30rpx;
  136. }
  137. .item {
  138. background-color: #FFF;
  139. padding: 30rpx;
  140. border-radius: 20rpx;
  141. .avatar {
  142. width: 160rpx;
  143. height: 215rpx;
  144. background-color: red;
  145. border-radius: 20rpx;
  146. }
  147. .item-content {
  148. padding-left: 30rpx;
  149. flex-grow: 1;
  150. font-size: $font-lg;
  151. .item-tip {
  152. font-size: $font-sm;
  153. margin-top: 20rpx;
  154. color: #99999999;
  155. .type{
  156. font-size: $font-base;
  157. }
  158. }
  159. }
  160. .item-status{
  161. text-align: right;
  162. align-self:stretch ;
  163. flex-shrink: 0;
  164. .level{
  165. font-size: $font-lg;
  166. color: $color-red;
  167. }
  168. .buttom{
  169. position: absolute;
  170. bottom: 0;
  171. right: 0;
  172. flex-shrink: 0;
  173. color: #FFF;
  174. background-color: $uni-color-primary;
  175. line-height: 1;
  176. padding:.5em ;
  177. border-radius: 10rpx;
  178. width: 3em;
  179. height: 3em;
  180. }
  181. }
  182. }
  183. </style>