index.vue 6.8 KB

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