supplier-list.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <div>
  3. <div class="filter-container">
  4. <div class="filter-control">
  5. <span>供应商名称:</span>
  6. <el-input
  7. v-model="listQuery.shopName"
  8. size="mini"
  9. placeholder="供应商名称"
  10. clearable
  11. @keyup.enter.native="fetchSupplierList"
  12. />
  13. </div>
  14. <div class="filter-control">
  15. <span>供应商类型:</span>
  16. <el-select
  17. v-model="listQuery.shopType"
  18. placeholder="供应商类型"
  19. size="mini"
  20. clearable
  21. @change="fetchSupplierList"
  22. >
  23. <el-option label="所有类型" value="" />
  24. <el-option label="代理商" :value="2" />
  25. <el-option label="品牌方" :value="1" />
  26. </el-select>
  27. </div>
  28. <div class="filter-control">
  29. <span>手机号:</span>
  30. <el-input
  31. v-model="listQuery.mobile"
  32. clearable
  33. size="mini"
  34. placeholder="手机号"
  35. @keyup.enter.native="fetchSupplierList"
  36. />
  37. </div>
  38. <div class="filter-control">
  39. <el-button type="primary" size="mini" @click="filterSupplierList">查询</el-button>
  40. </div>
  41. </div>
  42. <el-table
  43. v-infinite-scroll="onLoad"
  44. :data="supplierList"
  45. border
  46. class="infinite-list hide-table-check-all"
  47. style="overflow: auto"
  48. :infinite-scroll-delay="300"
  49. :infinite-scroll-immediate="false"
  50. header-row-class-name="tableHeader"
  51. highlight-current-row
  52. @row-click="handleSelectSupplier"
  53. >
  54. >
  55. <el-table-column label="选择" width="55" align="center">
  56. <template slot-scope="{ row }">
  57. <el-radio v-model="selectedAuthUserId" :label="row.authUserId"><span v-show="false">1</span></el-radio>
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="序号" type="index" width="80" align="center" />
  61. <el-table-column property="name" label="供应商名称" />
  62. <el-table-column label="供应商类型" align="center" width="120">
  63. <template slot-scope="{ row }">
  64. <span v-if="row.shopType === 1">品牌方</span>
  65. <span v-else>代理商</span>
  66. </template>
  67. </el-table-column>
  68. <!-- <el-table-column label="登录账号" align="center">
  69. <template slot-scope="{ row }">
  70. <span v-if="row.loginAccount">{{ row.loginAccount }}</span>
  71. <span v-else>未绑定</span>
  72. </template>
  73. </el-table-column> -->
  74. <el-table-column prop="mobile" label="手机号" align="center" width="160" />
  75. <el-table-column prop="linkMan" label="联系人" align="center" />
  76. </el-table>
  77. </div>
  78. </template>
  79. <script>
  80. import { fetchSupplierList } from '@/api/supplier'
  81. export default {
  82. name: 'SupplierList',
  83. data() {
  84. return {
  85. listQuery: {
  86. shopName: '',
  87. shopType: '',
  88. mobile: '',
  89. pageNum: 1,
  90. pageSize: 10
  91. },
  92. supplierList: [],
  93. selectedAuthUserId: ''
  94. }
  95. },
  96. created() {
  97. this.filterSupplierList()
  98. },
  99. methods: {
  100. // 确认选中的供应商
  101. handleSubmitSupplier() {
  102. this.dialogTableVisible = false
  103. this.currentSupplierList = [this.selectedSupplierInfo]
  104. },
  105. // 选择供应商
  106. handleSelectSupplier(e) {
  107. this.selectedAuthUserId = e.authUserId
  108. this.selectedSupplierInfo = e
  109. this.$emit('selected', e)
  110. },
  111. // 选择供应商对话框关闭事件
  112. handleDialogClosed() {
  113. this.listQuery.pageNum = 1
  114. this.listQuery.shopName = ''
  115. this.listQuery.shopType = ''
  116. this.listQuery.mobile = ''
  117. this.listQuery.linkMan = ''
  118. },
  119. // 筛选供应商
  120. filterSupplierList() {
  121. this.pageNum = 1
  122. this.supplierList = []
  123. this.fetchSupplierList()
  124. },
  125. // 获取供应商列表
  126. fetchSupplierList() {
  127. fetchSupplierList(this.listQuery)
  128. .then((res) => {
  129. console.log(res)
  130. this.supplierList = [...this.supplierList, ...res.data.list]
  131. this.hasNextPage = res.data.hasNextPage
  132. this.total = res.data.total
  133. })
  134. .catch((error) => {
  135. console.log(error)
  136. })
  137. },
  138. onLoad() {
  139. if (!this.hasNextPage) return
  140. this.listQuery.pageNum++
  141. this.fetchSupplierList()
  142. }
  143. }
  144. }
  145. </script>
  146. <style lang="scss" scoped></style>