index.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <div class="page">
  3. <van-list
  4. v-model="isLoadingMore"
  5. :finished="finished"
  6. :immediate-check="false"
  7. :finished-text="total ? '没有更多了' : ''"
  8. @load="onLoadMore"
  9. >
  10. <div class="page-top flex flex-col justify-center items-center">
  11. <img class="logo" :src="supplierInfo.logo" />
  12. <div class="name mt-2" v-text="supplierInfo.shopName + '认证记录'"></div>
  13. </div>
  14. <div class="page-content">
  15. <template v-if="list.length>0">
  16. <div class="page-title">设备认证</div>
  17. <div class="device-list"
  18. v-for="item in list"
  19. :key="item.authId"
  20. @click="toEdit(item)"
  21. >
  22. <div class="device">
  23. <div class="name">
  24. <span class="label">设备名称:</span>
  25. <span class="content">{{ item.productName ? item.productName : '' }}</span>
  26. </div>
  27. <div class="status" :class="auditStatusColor(item.auditStatus)">
  28. <span class="label">状态:</span>
  29. <span class="content">{{ item.auditStatus | auditStatusFilter }}</span>
  30. </div>
  31. </div>
  32. </div>
  33. </template>
  34. <template v-else>
  35. <SimpleEmpty name="icon-device-empty.png" description="暂无设备~" />
  36. </template>
  37. </div>
  38. </van-list>
  39. </div>
  40. </template>
  41. <script>
  42. import SimpleEmpty from '@/components/SimpleEmpty'
  43. import { mapGetters } from 'vuex'
  44. export default {
  45. layout: 'app',
  46. components: {
  47. SimpleEmpty,
  48. },
  49. data() {
  50. return {
  51. isLoadingMore: true,
  52. finished: false,
  53. isRequest: true,
  54. list: [],
  55. listQuery: {
  56. authId: 0,
  57. listType:2,
  58. pageNum: 1,
  59. pageSize: 10,
  60. },
  61. total: 0,
  62. }
  63. },
  64. filters: {
  65. auditStatusFilter(value) {// 认证状态:0审核未通过,1审核通过,2待审核
  66. const map = {
  67. 0: '审核未通过',
  68. 1: '审核通过',
  69. 2: '待审核',
  70. }
  71. return map[value]
  72. }
  73. },
  74. created() {
  75. this.initData()
  76. },
  77. computed: {
  78. ...mapGetters(['supplierInfo', 'authUserId', 'routePrefix','authId']),
  79. },
  80. methods: {
  81. toEdit(item) {
  82. this.$router.push(`${this.routePrefix}/record/device/detail?id=${item.productId}`)
  83. },
  84. initData() {
  85. this.listQuery.authId = this.authId
  86. this.authProductList()
  87. },
  88. // 获取机构列表
  89. async authProductList () {
  90. try {
  91. this.isLoadingMore = true
  92. const res = await this.$http.api.getClubAuthProductList(this.listQuery)
  93. this.total = res.data.total
  94. this.list = [...this.list, ...res.data.list]
  95. this.finished = !res.data.hasNextPage
  96. this.isLoadingMore = false
  97. this.listQuery.pageNum += 1
  98. } catch (error) {
  99. console.log(error)
  100. } finally {
  101. this.$toast.clear()
  102. this.isRequest = false
  103. }
  104. },
  105. auditStatusColor(value) {// 认证状态:0 danger,1 success,2 warning
  106. const map = {
  107. 0: 'danger',
  108. 1: 'success',
  109. 2: 'warning',
  110. }
  111. return map[value]
  112. },
  113. // 加载更多
  114. onLoadMore() {
  115. console.log('111111111')
  116. this.authProductList()
  117. },
  118. },
  119. }
  120. </script>
  121. <style lang="scss" scoped>
  122. @media screen and (min-width: 768px) {
  123. .page {
  124. background: #fff;
  125. }
  126. .page-top {
  127. height: 360px;
  128. @include themify($themes) {
  129. background: themed('banner-club-register');
  130. background-size: auto 360px;
  131. }
  132. .logo {
  133. display: block;
  134. width: 120px;
  135. height: 120px;
  136. border-radius: 50%;
  137. background: #fff;
  138. }
  139. .name {
  140. font-size: 30px;
  141. color: #fff;
  142. }
  143. }
  144. .page-content {
  145. width: 700px;
  146. margin: 0 auto;
  147. overflow: hidden;
  148. min-height: calc(100vh - 80px - 80px - 360px);
  149. box-sizing: border-box;
  150. padding-bottom: 40px;
  151. .page-title {
  152. font-size: 24px;
  153. font-weight: bold;
  154. text-align: center;
  155. padding: 40px 0;
  156. }
  157. .device-list {
  158. .device {
  159. position: relative;
  160. padding: 36px 0 12px;
  161. border-bottom: 1px solid #c2c2c2;
  162. cursor: pointer;
  163. .name {
  164. margin-bottom: 8px;
  165. }
  166. .label {
  167. font-size: 18px;
  168. color: #666;
  169. }
  170. .content {
  171. font-size: 18px;
  172. color: #282828;
  173. }
  174. .status {
  175. &.success {
  176. .content {
  177. color: #f3920d;
  178. }
  179. }
  180. &.warning {
  181. .content {
  182. color: #1890ff;
  183. }
  184. }
  185. &.danger {
  186. .content {
  187. color: #f94b4b;
  188. }
  189. }
  190. }
  191. &::after {
  192. content: '';
  193. position: absolute;
  194. right: 0;
  195. top: 50%;
  196. transform: translateY(-50%);
  197. display: block;
  198. width: 20px;
  199. height: 20px;
  200. background: url(https://static.caimei365.com/www/authentic/pc/icon-detail-more.png)
  201. no-repeat center;
  202. background-size: 18px;
  203. }
  204. }
  205. }
  206. }
  207. }
  208. @media screen and (max-width: 768px) {
  209. .page {
  210. background: #fff;
  211. }
  212. .page-top {
  213. height: 46vw;
  214. @include themify($themes) {
  215. background: themed('banner-home-h5');
  216. background-size: auto 46vw;
  217. }
  218. .logo {
  219. display: block;
  220. width: 14.8vw;
  221. height: 14.8vw;
  222. border-radius: 50%;
  223. background: #fff;
  224. }
  225. .name {
  226. font-size: 4vw;
  227. color: #fff;
  228. }
  229. }
  230. .page-content {
  231. box-sizing: border-box;
  232. padding: 8vw 7vw;
  233. .page-title {
  234. font-size: 4.2vw;
  235. font-weight: bold;
  236. text-align: center;
  237. color: #282828;
  238. margin-bottom: 4.6vw;
  239. }
  240. .device-list {
  241. .device {
  242. position: relative;
  243. padding: 2.6vw 0;
  244. border-bottom: 0.1vw solid #c2c2c2;
  245. cursor: pointer;
  246. .name {
  247. margin-bottom: 2.2vw;
  248. }
  249. .label {
  250. font-size: 3.4vw;
  251. color: #666;
  252. }
  253. .content {
  254. font-size: 3.4vw;
  255. color: #282828;
  256. }
  257. .status {
  258. &.success {
  259. .content {
  260. color: #f3920d;
  261. }
  262. }
  263. &.warning {
  264. .content {
  265. color: #1890ff;
  266. }
  267. }
  268. &.danger {
  269. .content {
  270. color: #f94b4b;
  271. }
  272. }
  273. }
  274. &::after {
  275. content: '';
  276. position: absolute;
  277. right: 0;
  278. top: 50%;
  279. transform: translateY(-50%);
  280. display: block;
  281. width: 20px;
  282. height: 20px;
  283. background: url(https://static.caimei365.com/www/authentic/pc/icon-detail-more.png)
  284. no-repeat center;
  285. background-size: 18px;
  286. }
  287. }
  288. }
  289. }
  290. }
  291. </style>