index.vue 7.0 KB

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