index.vue 7.0 KB

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