index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <div class="app-container">
  3. <div class="filter-container">
  4. <div class="filter-control">
  5. <span>设备名称:</span>
  6. <el-input
  7. v-model="listQuery.productName"
  8. placeholder="商品名称"
  9. style="width: 200px"
  10. class="filter-item"
  11. @keyup.enter.native="handleFilter"
  12. />
  13. </div>
  14. <div class="filter-control">
  15. <span>设备SN码:</span>
  16. <el-input
  17. v-model="listQuery.snCode"
  18. placeholder="商品SN码"
  19. style="width: 200px"
  20. class="filter-item"
  21. @keyup.enter.native="handleFilter"
  22. />
  23. </div>
  24. <div class="filter-control">
  25. <span>审核状态:</span>
  26. <el-select
  27. v-model="listQuery.auditStatus"
  28. placeholder="审核状态"
  29. clearable
  30. style="width: 200px"
  31. class="filter-item"
  32. @change="getList"
  33. >
  34. <el-option label="全部" value="" />
  35. <el-option label="待审核" :value="2" />
  36. <el-option label="审核通过" :value="1" />
  37. <el-option label="审核未通过" :value="0" />
  38. </el-select>
  39. </div>
  40. <div class="filter-control">
  41. <span>上线状态:</span>
  42. <el-select
  43. v-model="listQuery.status"
  44. placeholder="上线状态"
  45. clearable
  46. style="width: 200px"
  47. class="filter-item"
  48. @change="getList"
  49. >
  50. <el-option label="全部" value="" />
  51. <el-option label="已上线" :value="1" />
  52. <el-option label="待上线" :value="2" />
  53. <el-option label="未上线" :value="0" />
  54. </el-select>
  55. </div>
  56. <div class="filter-control">
  57. <el-button type="primary" @click="handleFilter">查询</el-button>
  58. </div>
  59. </div>
  60. <!-- 表格区域 -->
  61. <el-table
  62. :key="tableKey"
  63. v-loading="listLoading"
  64. :data="list"
  65. border
  66. fit
  67. highlight-current-row
  68. style="width: 100%"
  69. header-row-class-name="tableHeader"
  70. >
  71. <el-table-column label="序号" :index="indexMethod" type="index" align="center" width="80" />
  72. <el-table-column label="设备名称" align="center" prop="productName" />
  73. <el-table-column label="设备SN码" align="center" prop="snCode" />
  74. <el-table-column label="审核状态" width="120px" align="center">
  75. <template slot-scope="{ row }">
  76. <audit-status :status="row.auditStatus" :reason="row.invalidReason" />
  77. </template>
  78. </el-table-column>
  79. <el-table-column label="上线状态" width="120px" align="center">
  80. <template slot-scope="{ row }">
  81. <!-- 只有审核通过了才能操作上下线 auditStatus :审核状态 -->
  82. <template v-if="row.auditStatus === 1">
  83. <template v-if="row.status === 0">
  84. <span style="margin-right: 10px" class="status danger">已下线</span>
  85. <el-button
  86. v-if="userIdentity === 2 || proxyInfo !== null"
  87. type="primary"
  88. size="mini"
  89. @click="handleChangeStatus(row)"
  90. >上线</el-button>
  91. </template>
  92. <template v-else>
  93. <span style="margin-right: 10px" class="status success">已上线</span>
  94. <el-button
  95. v-if="userIdentity === 2 || proxyInfo !== null"
  96. type="info"
  97. size="mini"
  98. plain
  99. @click="handleChangeStatus(row)"
  100. >下线</el-button>
  101. </template>
  102. </template>
  103. <template v-else>
  104. <!-- <el-tag type="warning">待上线</el-tag> -->
  105. <span style="margin-right: 10px" class="status warning">待上线</span>
  106. </template>
  107. </template>
  108. </el-table-column>
  109. <el-table-column label="创建时间" class-name="status-col" width="160px" align="center">
  110. <template slot-scope="{ row }">
  111. <span>{{ row.createTime | formatTime }}</span>
  112. </template>
  113. </el-table-column>
  114. <el-table-column label="操作" align="center" width="240px" class-name="small-padding fixed-width">
  115. <template slot-scope="{ row }">
  116. <el-button
  117. type="primary"
  118. size="mini"
  119. @click="navigationTo(`club-device-detail?productId=${row.productId}`)"
  120. >查看</el-button>
  121. <el-button type="primary" size="mini" :disabled="row.auditStatus !== 1" @click="handleShowQRcode(row)">
  122. 二维码
  123. </el-button>
  124. </template>
  125. </el-table-column>
  126. </el-table>
  127. <!-- 页码 -->
  128. <pagination :total="total" :page.sync="listQuery.pageNum" :limit.sync="listQuery.pageSize" @pagination="getList" />
  129. <!-- 二维码 -->
  130. <transition name="fade">
  131. <qrcode-device v-if="showQRcode" :product-info="productInfo" @close="showQRcode = false" />
  132. </transition>
  133. </div>
  134. </template>
  135. <script>
  136. import { getProdList } from '@/api/product'
  137. import QrcodeDevice from '@/components/QrcodeDevice'
  138. import { mapGetters } from 'vuex'
  139. export default {
  140. name: 'SupplierClubDeviceList',
  141. components: { QrcodeDevice },
  142. data() {
  143. return {
  144. tableKey: 0,
  145. list: null,
  146. total: 0,
  147. listLoading: true,
  148. listQuery: {
  149. status: '',
  150. auditStatus: '',
  151. authId: '',
  152. productName: '',
  153. snCode: '',
  154. pageNum: 1,
  155. pageSize: 10
  156. },
  157. showQRcode: false,
  158. productInfo: {}
  159. }
  160. },
  161. computed: {
  162. ...mapGetters(['userIdentity', 'proxyInfo'])
  163. },
  164. created() {
  165. this.listQuery.authId = this.$route.query.authId
  166. this.getList()
  167. },
  168. methods: {
  169. // 获取列表信息
  170. getList() {
  171. getProdList(this.listQuery)
  172. .then((res) => {
  173. const { total, list } = res.data
  174. this.total = total
  175. this.list = list
  176. // this.checkAuditFailedList(list)
  177. })
  178. .finally(() => {
  179. this.listLoading = false
  180. })
  181. },
  182. // 过滤列表
  183. handleFilter() {
  184. this.listQuery.page = 1
  185. this.getList()
  186. },
  187. // 显示二维码
  188. handleShowQRcode(item) {
  189. this.productInfo = item
  190. this.productInfo.authParty = item.authParty
  191. this.showQRcode = true
  192. },
  193. indexMethod(index) {
  194. return index + this.listQuery.pageSize * (this.listQuery.pageNum - 1) + 1
  195. }
  196. }
  197. }
  198. </script>
  199. <style lang="scss" scoped>
  200. .filter-container {
  201. span {
  202. display: inline-block;
  203. margin-bottom: 10px;
  204. vertical-align: middle;
  205. font-size: 14px;
  206. }
  207. .el-button {
  208. display: inline-block;
  209. margin-bottom: 10px;
  210. vertical-align: middle;
  211. }
  212. .el-input,
  213. .el-select {
  214. margin-right: 10px;
  215. margin-left: 10px;
  216. }
  217. }
  218. </style>