index.vue 7.6 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-asbl',
  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. @include useTheme() {
  138. background: #fff;
  139. .page-top {
  140. height: 360px;
  141. background: fetch('pc-banner-record-device');
  142. background-size: auto 360px;
  143. .logo {
  144. display: block;
  145. width: 120px;
  146. height: 120px;
  147. border-radius: 50%;
  148. background: #fff;
  149. }
  150. .name {
  151. font-size: 30px;
  152. color: #fff;
  153. }
  154. }
  155. .page-content {
  156. width: 700px;
  157. margin: 0 auto;
  158. overflow: hidden;
  159. min-height: calc(100vh - 80px - 80px - 360px);
  160. box-sizing: border-box;
  161. padding-bottom: 40px;
  162. .page-title {
  163. font-size: 24px;
  164. font-weight: bold;
  165. text-align: center;
  166. padding: 40px 0;
  167. }
  168. .device-list {
  169. .device {
  170. position: relative;
  171. padding: 36px 0 12px;
  172. border-bottom: 1px solid #c2c2c2;
  173. cursor: pointer;
  174. .name {
  175. margin-bottom: 8px;
  176. }
  177. .label {
  178. font-size: 18px;
  179. color: #666;
  180. }
  181. .content {
  182. font-size: 18px;
  183. color: #282828;
  184. }
  185. .status {
  186. &.success {
  187. .content {
  188. color: #36bbce;
  189. }
  190. }
  191. &.warning {
  192. .content {
  193. color: #1890ff;
  194. }
  195. }
  196. &.danger {
  197. .content {
  198. color: #f94b4b;
  199. }
  200. }
  201. }
  202. &::after {
  203. content: '';
  204. position: absolute;
  205. right: 0;
  206. top: 50%;
  207. transform: translateY(-50%);
  208. display: block;
  209. width: 20px;
  210. height: 20px;
  211. background: url(~assets/theme-images/common/pc-icon-detail-more.png)
  212. no-repeat center;
  213. background-size: 18px;
  214. }
  215. }
  216. }
  217. }
  218. }
  219. }
  220. }
  221. @media screen and (max-width: 768px) {
  222. .page {
  223. @include useTheme() {
  224. background: #fff;
  225. .page-top {
  226. height: 46vw;
  227. background: fetch('h5-banner-record-device');
  228. background-size: auto 46vw;
  229. .logo {
  230. display: block;
  231. width: 14.8vw;
  232. height: 14.8vw;
  233. border-radius: 50%;
  234. background: #fff;
  235. }
  236. .name {
  237. font-size: 4vw;
  238. color: #fff;
  239. }
  240. }
  241. .page-content {
  242. box-sizing: border-box;
  243. padding: 8vw 7vw;
  244. .page-title {
  245. font-size: 4.2vw;
  246. font-weight: bold;
  247. text-align: center;
  248. color: #282828;
  249. margin-bottom: 4.6vw;
  250. }
  251. .device-list {
  252. .device {
  253. position: relative;
  254. padding: 2.6vw 0;
  255. border-bottom: 0.1vw solid #c2c2c2;
  256. cursor: pointer;
  257. .name {
  258. margin-bottom: 2.2vw;
  259. }
  260. .label {
  261. font-size: 3.4vw;
  262. color: #666;
  263. }
  264. .content {
  265. font-size: 3.4vw;
  266. color: #282828;
  267. }
  268. .status {
  269. &.success {
  270. .content {
  271. color: #36bbce;
  272. }
  273. }
  274. &.warning {
  275. .content {
  276. color: #1890ff;
  277. }
  278. }
  279. &.danger {
  280. .content {
  281. color: #f94b4b;
  282. }
  283. }
  284. }
  285. &::after {
  286. content: '';
  287. position: absolute;
  288. right: 0;
  289. top: 50%;
  290. transform: translateY(-50%);
  291. display: block;
  292. width: 20px;
  293. height: 20px;
  294. background: url(~assets/theme-images/common/h5-icon-detail-more.png)
  295. no-repeat center;
  296. background-size: 18px;
  297. }
  298. }
  299. }
  300. }
  301. }
  302. }
  303. }
  304. </style>