supplier-list.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <div>
  3. <div class="filter-container">
  4. <div class="filter-control">
  5. <span>供应商名称:</span>
  6. <el-input v-model="listQuery.shopName" placeholder="供应商名称" @keyup.enter.native="handleFilter" />
  7. </div>
  8. <div class="filter-control">
  9. <span>供应商类型:</span>
  10. <el-select
  11. v-model="listQuery.shopType"
  12. placeholder="供应商类型"
  13. clearable
  14. style="width: 200px"
  15. class="filter-item"
  16. @change="getList()"
  17. >
  18. <el-option label="所有类型" value="" />
  19. <el-option label="代理商" :value="2" />
  20. <el-option label="品牌方" :value="1" />
  21. </el-select>
  22. </div>
  23. <div class="filter-control">
  24. <span>手机号:</span>
  25. <el-input
  26. v-model="listQuery.mobile"
  27. placeholder="手机号"
  28. style="width: 200px"
  29. class="filter-item"
  30. @keyup.enter.native="handleFilter"
  31. />
  32. </div>
  33. <div class="filter-control">
  34. <span>联系人:</span>
  35. <el-input
  36. v-model="listQuery.linkMan"
  37. placeholder="联系人"
  38. style="width: 200px"
  39. class="filter-item"
  40. @keyup.enter.native="handleFilter"
  41. />
  42. </div>
  43. <div class="filter-control">
  44. <el-button type="primary" @click="getList(listQuery)">查询</el-button>
  45. </div>
  46. </div>
  47. <!-- 表格区域 -->
  48. <el-table
  49. :key="tableKey"
  50. v-loading="listLoading"
  51. :data="list"
  52. border
  53. fit
  54. highlight-current-row
  55. style="width: 100%"
  56. header-row-class-name="tableHeader"
  57. >
  58. <el-table-column label="序号" :index="indexMethod" type="index" sortable="custom" align="center" width="80" />
  59. <el-table-column label="供应商名称" align="center" prop="name" />
  60. <el-table-column label="供应商类型" width="100px" align="center">
  61. <template v-slot="{ row }">
  62. <span v-if="row.shopType === 1">品牌方</span>
  63. <span v-if="row.shopType === 2">代理商</span>
  64. </template>
  65. </el-table-column>
  66. <el-table-column label="手机号" width="120px" align="center" prop="mobile" />
  67. <el-table-column label="联系人" align="center" prop="linkMan" />
  68. <el-table-column label="创建时间" class-name="status-col" width="160px">
  69. <template slot-scope="{ row }">
  70. <span>{{ row.createTime | formatTime }}</span>
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160px">
  74. <template slot-scope="{ row }">
  75. <el-button size="mini" type="primary" @click="$_navigationTo(`/logistics/club-list?id=${row.authUserId}`)">
  76. 机构授权牌
  77. </el-button>
  78. </template>
  79. </el-table-column>
  80. </el-table>
  81. <!-- 页码 -->
  82. <pagination
  83. :total="total"
  84. :page.sync="listQuery.pageNum"
  85. :limit.sync="listQuery.pageSize"
  86. @pagination="getList(listQuery)"
  87. />
  88. </div>
  89. </template>
  90. <script>
  91. import Pagination from '@/components/Pagination' // secondary package based on el-pagination
  92. import { fetchSupplierList } from '@/api/supplier'
  93. export default {
  94. name: 'ComplexTable',
  95. components: { Pagination },
  96. props: {
  97. sendStatus: {
  98. type: Number,
  99. default: 0
  100. }
  101. },
  102. // mixins: [scrollTo],
  103. data() {
  104. return {
  105. slider: 1,
  106. listLoading: true,
  107. tableKey: '',
  108. total: 0, // 条数统计
  109. listQuery: {
  110. brandId: '', // 品牌id
  111. linkMan: '', // 联系人
  112. mobile: '', // 手机号
  113. pageNum: 0, // 页码
  114. pageSize: 10, // 分页大小
  115. shopName: '', // 供应商名称
  116. shopType: '', // 供应商类型
  117. loginAccount: '', // 登录账号
  118. listType: 7,
  119. sendStatus: ''
  120. },
  121. list: [],
  122. prevData: ''
  123. }
  124. },
  125. created() {
  126. this.getList()
  127. },
  128. methods: {
  129. // 获取列表数据
  130. getList() {
  131. this.listQuery.sendStatus = this.sendStatus
  132. this.listLoading = true
  133. fetchSupplierList(this.listQuery)
  134. .then((res) => {
  135. if (res.code !== 0) {
  136. return this.$message.error('获取数据失败~')
  137. }
  138. const { total, list } = res.data
  139. this.total = total
  140. this.formatList(list)
  141. this.list = list
  142. console.log(this.list)
  143. })
  144. .catch((err) => {
  145. console.log(err)
  146. })
  147. .finally(() => {
  148. this.listLoading = false
  149. })
  150. },
  151. // 格式化数组
  152. formatList(list = []) {
  153. list.forEach((i) => {
  154. i.shopStatus = i.shopStatus === 1
  155. })
  156. },
  157. // 过滤列表
  158. handleFilter() {
  159. this.listQuery.page = 1
  160. this.getList()
  161. },
  162. indexMethod(index) {
  163. return index + this.listQuery.pageSize * (this.listQuery.pageNum - 1) + 1
  164. }
  165. }
  166. }
  167. </script>