index.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  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.productId"
  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. this.authProductList()
  116. },
  117. },
  118. }
  119. </script>
  120. <style lang="scss" scoped>
  121. @media screen and (min-width: 768px) {
  122. .page {
  123. background: #fff;
  124. }
  125. .page-top {
  126. height: 360px;
  127. @include themify($themes) {
  128. background: themed('banner-club-register');
  129. background-size: auto 360px;
  130. }
  131. .logo {
  132. display: block;
  133. width: 120px;
  134. height: 120px;
  135. border-radius: 50%;
  136. background: #fff;
  137. }
  138. .name {
  139. font-size: 30px;
  140. color: #fff;
  141. }
  142. }
  143. .page-content {
  144. width: 700px;
  145. margin: 0 auto;
  146. overflow: hidden;
  147. min-height: calc(100vh - 80px - 80px - 360px);
  148. box-sizing: border-box;
  149. padding-bottom: 40px;
  150. .page-title {
  151. font-size: 24px;
  152. font-weight: bold;
  153. text-align: center;
  154. padding: 40px 0;
  155. }
  156. .device-list {
  157. .device {
  158. position: relative;
  159. padding: 36px 0 12px;
  160. border-bottom: 1px solid #c2c2c2;
  161. cursor: pointer;
  162. .name {
  163. margin-bottom: 8px;
  164. }
  165. .label {
  166. font-size: 18px;
  167. color: #666;
  168. }
  169. .content {
  170. font-size: 18px;
  171. color: #282828;
  172. }
  173. .status {
  174. &.success {
  175. .content {
  176. color: #f3920d;
  177. }
  178. }
  179. &.warning {
  180. .content {
  181. color: #1890ff;
  182. }
  183. }
  184. &.danger {
  185. .content {
  186. color: #f94b4b;
  187. }
  188. }
  189. }
  190. &::after {
  191. content: '';
  192. position: absolute;
  193. right: 0;
  194. top: 50%;
  195. transform: translateY(-50%);
  196. display: block;
  197. width: 20px;
  198. height: 20px;
  199. background: url(https://static.caimei365.com/www/authentic/pc/icon-detail-more.png)
  200. no-repeat center;
  201. background-size: 18px;
  202. }
  203. }
  204. }
  205. }
  206. }
  207. @media screen and (max-width: 768px) {
  208. .page {
  209. background: #fff;
  210. }
  211. .page-top {
  212. height: 46vw;
  213. @include themify($themes) {
  214. background: themed('banner-home-h5');
  215. background-size: auto 46vw;
  216. }
  217. .logo {
  218. display: block;
  219. width: 14.8vw;
  220. height: 14.8vw;
  221. border-radius: 50%;
  222. background: #fff;
  223. }
  224. .name {
  225. font-size: 4vw;
  226. color: #fff;
  227. }
  228. }
  229. .page-content {
  230. box-sizing: border-box;
  231. padding: 8vw 7vw;
  232. .page-title {
  233. font-size: 4.2vw;
  234. font-weight: bold;
  235. text-align: center;
  236. color: #282828;
  237. margin-bottom: 4.6vw;
  238. }
  239. .device-list {
  240. .device {
  241. position: relative;
  242. padding: 2.6vw 0;
  243. border-bottom: 0.1vw solid #c2c2c2;
  244. cursor: pointer;
  245. .name {
  246. margin-bottom: 2.2vw;
  247. }
  248. .label {
  249. font-size: 3.4vw;
  250. color: #666;
  251. }
  252. .content {
  253. font-size: 3.4vw;
  254. color: #282828;
  255. }
  256. .status {
  257. &.success {
  258. .content {
  259. color: #f3920d;
  260. }
  261. }
  262. &.warning {
  263. .content {
  264. color: #1890ff;
  265. }
  266. }
  267. &.danger {
  268. .content {
  269. color: #f94b4b;
  270. }
  271. }
  272. }
  273. &::after {
  274. content: '';
  275. position: absolute;
  276. right: 0;
  277. top: 50%;
  278. transform: translateY(-50%);
  279. display: block;
  280. width: 20px;
  281. height: 20px;
  282. background: url(https://static.caimei365.com/www/authentic/pc/icon-detail-more.png)
  283. no-repeat center;
  284. background-size: 18px;
  285. }
  286. }
  287. }
  288. }
  289. }
  290. </style>