123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- <template>
- <div class="supplier-list">
- <div class="filter-container">
- <div class="filter-control">
- <span>供应商名称:</span>
- <el-input
- v-model="listQuery.shopName"
- size="mini"
- placeholder="供应商名称"
- @keyup.enter.native="filterSupplierList"
- />
- </div>
- <div class="filter-control">
- <span>供应商类型:</span>
- <el-select
- v-model="listQuery.shopType"
- placeholder="供应商类型"
- size="mini"
- clearable
- @change="filterSupplierList"
- >
- <el-option label="所有类型" value="" />
- <el-option label="代理商" :value="2" />
- <el-option label="品牌方" :value="1" />
- </el-select>
- </div>
- <div class="filter-control">
- <span>手机号:</span>
- <el-input
- v-model="listQuery.mobile"
- size="mini"
- placeholder="手机号"
- @keyup.enter.native="filterSupplierList"
- />
- </div>
- <div class="filter-control">
- <el-button type="primary" size="mini" @click="filterSupplierList">查询</el-button>
- </div>
- </div>
- <el-table
- v-infinite-scroll="onLoad"
- :data="supplierList"
- border
- class="infinite-list hide-table-check-all"
- style="overflow: auto"
- :infinite-scroll-delay="300"
- :infinite-scroll-immediate="false"
- header-row-class-name="tableHeader"
- highlight-current-row
- @row-click="handleSelectSupplier"
- >
- >
- <el-table-column label="选择" width="55" align="center">
- <template slot-scope="{ row }">
- <el-radio v-model="selectedAuthUserId" :label="row.authUserId"><span v-show="false">1</span></el-radio>
- </template>
- </el-table-column>
- <el-table-column label="序号" type="index" width="80" align="center" />
- <el-table-column property="name" label="供应商名称" />
- <el-table-column label="供应商类型" align="center" width="120">
- <template slot-scope="{ row }">
- <span v-if="row.shopType === 1">品牌方</span>
- <span v-else>代理商</span>
- </template>
- </el-table-column>
- <!-- <el-table-column label="登录账号" align="center">
- <template slot-scope="{ row }">
- <span v-if="row.loginAccount">{{ row.loginAccount }}</span>
- <span v-else>未绑定</span>
- </template>
- </el-table-column> -->
- <el-table-column prop="mobile" label="手机号" align="center" width="160" />
- <el-table-column prop="linkMan" label="联系人" align="center" />
- </el-table>
- <div class="control">
- <el-button @click="onCancel">取 消</el-button>
- <el-button type="primary" @click="onConfirm">确定</el-button>
- </div>
- </div>
- </template>
- <script>
- import { fetchSupplierList } from '@/api/supplier'
- import { deepClone } from '@/utils'
- export default {
- name: 'SupplierList',
- data() {
- return {
- listQuery: {
- shopName: '',
- shopType: '',
- mobile: '',
- pageNum: 1,
- pageSize: 10
- },
- supplierList: [],
- selectedAuthUserId: '',
- selectedSupplierInfo: null
- }
- },
- created() {
- this.filterSupplierList()
- },
- methods: {
- // 取消
- onCancel() {
- this.selectedAuthUserId = ''
- this.selectedSupplierInfo = null
- this.$emit('cancel', this.selectedSupplierInfo)
- },
- // 确认
- onConfirm() {
- this.$emit('confirm', deepClone(this.selectedSupplierInfo))
- this.selectedAuthUserId = ''
- this.selectedSupplierInfo = null
- },
- // 确认选中的供应商
- handleSubmitSupplier() {
- this.dialogTableVisible = false
- this.currentSupplierList = [this.selectedSupplierInfo]
- },
- // 选择供应商
- handleSelectSupplier(e) {
- this.selectedAuthUserId = e.authUserId
- this.selectedSupplierInfo = e
- },
- // 选择供应商对话框关闭事件
- handleDialogClosed() {
- this.listQuery.pageNum = 1
- this.listQuery.shopName = ''
- this.listQuery.shopType = ''
- this.listQuery.mobile = ''
- this.listQuery.linkMan = ''
- },
- // 筛选供应商
- filterSupplierList() {
- this.listQuery.pageNum = 1
- this.supplierList = []
- this.fetchSupplierList()
- },
- // 获取供应商列表
- fetchSupplierList() {
- fetchSupplierList(this.listQuery).then((res) => {
- console.log(res)
- this.supplierList = [...this.supplierList, ...res.data.list]
- this.hasNextPage = res.data.hasNextPage
- this.total = res.data.total
- })
- },
- onLoad() {
- if (!this.hasNextPage) return
- this.listQuery.pageNum++
- this.fetchSupplierList()
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .supplier-list {
- .control {
- text-align: right;
- margin-top: 12px;
- }
- .infinite-list {
- height: 400px;
- }
- }
- </style>
|