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