|
@@ -29,7 +29,7 @@
|
|
|
<el-input
|
|
|
v-model="listQuery.mobile"
|
|
|
placeholder="手机号"
|
|
|
- style="width: 200px;"
|
|
|
+ style="width: 200px"
|
|
|
class="filter-item"
|
|
|
@keyup.enter.native="handleFilter"
|
|
|
/>
|
|
@@ -39,7 +39,7 @@
|
|
|
<el-input
|
|
|
v-model="listQuery.linkMan"
|
|
|
placeholder="联系人"
|
|
|
- style="width: 200px;"
|
|
|
+ style="width: 200px"
|
|
|
class="filter-item"
|
|
|
@keyup.enter.native="handleFilter"
|
|
|
/>
|
|
@@ -58,7 +58,7 @@
|
|
|
border
|
|
|
fit
|
|
|
highlight-current-row
|
|
|
- style="width: 100%;"
|
|
|
+ style="width: 100%"
|
|
|
header-row-class-name="tableHeader"
|
|
|
>
|
|
|
<el-table-column label="序号" :index="indexMethod" type="index" sortable="custom" align="center" width="80" />
|
|
@@ -93,15 +93,11 @@
|
|
|
<el-button size="mini" type="primary" @click="navigationTo(`supplier-edit?id=${row.authUserId}&type=edit`)">
|
|
|
编辑
|
|
|
</el-button>
|
|
|
- <el-button size="mini" type="primary" @click="handleProxy(row)">
|
|
|
- 代他操作
|
|
|
- </el-button>
|
|
|
+ <el-button size="mini" type="primary" @click="handleProxy(row)"> 代他操作 </el-button>
|
|
|
<el-button size="mini" type="primary" @click="navigationTo(`club-list?id=${row.authUserId}`)">
|
|
|
查看机构认证
|
|
|
</el-button>
|
|
|
- <el-button size="mini" type="primary" @click="handleResetPwd(row)">
|
|
|
- 重置密码
|
|
|
- </el-button>
|
|
|
+ <el-button size="mini" type="primary" @click="handleResetPwd(row)"> 重置密码 </el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -151,68 +147,50 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
// 获取列表数据
|
|
|
- getList() {
|
|
|
+ async getList() {
|
|
|
this.listLoading = true
|
|
|
- fetchSupplierList(this.listQuery)
|
|
|
- .then(res => {
|
|
|
- if (res.code !== 0) {
|
|
|
- return this.$message.error('获取数据失败~')
|
|
|
- }
|
|
|
- const { total, list } = res.data
|
|
|
- this.total = total
|
|
|
- this.formatList(list)
|
|
|
- this.list = list
|
|
|
- console.log(this.list)
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
- console.log(err)
|
|
|
- })
|
|
|
- .finally(() => {
|
|
|
- this.listLoading = false
|
|
|
- })
|
|
|
+ try {
|
|
|
+ const res = await fetchSupplierList(this.listQuery)
|
|
|
+ const { total, list } = res.data
|
|
|
+ this.total = total
|
|
|
+ this.list = this.formatList(list)
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error)
|
|
|
+ } finally {
|
|
|
+ this.listLoading = false
|
|
|
+ }
|
|
|
},
|
|
|
// 格式化数组
|
|
|
formatList(list = []) {
|
|
|
- list.forEach(i => {
|
|
|
- i.shopStatus = i.shopStatus === 1
|
|
|
+ return list.map((item) => {
|
|
|
+ item.shopStatus = item.shopStatus === 1
|
|
|
+ return item
|
|
|
})
|
|
|
},
|
|
|
// 获取品牌列表
|
|
|
- getBrandList() {
|
|
|
- // 获取品牌列表
|
|
|
- fetchBrandList()
|
|
|
- .then(res => {
|
|
|
- if (res.code === 0) {
|
|
|
- this.brandList = res.data
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(err => console.log(err))
|
|
|
+ async getBrandList() {
|
|
|
+ try {
|
|
|
+ const res = await fetchBrandList()
|
|
|
+ this.brandList = res.data
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error)
|
|
|
+ }
|
|
|
},
|
|
|
// 供应商状态改变
|
|
|
- handleChangeStatus(item) {
|
|
|
- const params = {
|
|
|
- status: item.shopStatus ? 1 : 0,
|
|
|
- authUserId: item.authUserId
|
|
|
- }
|
|
|
- supplierStatusChange(params)
|
|
|
- .then(res => {
|
|
|
- if (res.code === 0) {
|
|
|
- this.getList()
|
|
|
- this.$message({
|
|
|
- message: '操作成功',
|
|
|
- duration: 500,
|
|
|
- type: 'success'
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- this.getList()
|
|
|
- this.$message({
|
|
|
- message: '操作失败',
|
|
|
- duration: 500,
|
|
|
- type: 'danger'
|
|
|
- })
|
|
|
+ async handleChangeStatus(item) {
|
|
|
+ console.log(item.shopStatus)
|
|
|
+ const oldStatus = !item.shopStatus // 保存旧状态
|
|
|
+ try {
|
|
|
+ await supplierStatusChange({
|
|
|
+ status: item.shopStatus ? 1 : 0,
|
|
|
+ authUserId: item.authUserId
|
|
|
})
|
|
|
+ this.$message.success('操作成功')
|
|
|
+ } catch (error) {
|
|
|
+ // eslint-disable-next-line require-atomic-updates
|
|
|
+ item.shopStatus = oldStatus
|
|
|
+ console.log(error)
|
|
|
+ }
|
|
|
},
|
|
|
// 重置密码
|
|
|
async handleResetPwd(item) {
|
|
@@ -225,7 +203,7 @@ export default {
|
|
|
})
|
|
|
if (text !== 'confirm') return
|
|
|
// 要执行的操作
|
|
|
- resetPassword({ authUserId: item.authUserId }).then(res => {
|
|
|
+ resetPassword({ authUserId: item.authUserId }).then((res) => {
|
|
|
if (res.code !== 0) return
|
|
|
const h = this.$createElement
|
|
|
this.$notify.success({
|
|
@@ -263,6 +241,4 @@ export default {
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style lang="scss" scoped>
|
|
|
-
|
|
|
-</style>
|
|
|
+<style lang="scss" scoped></style>
|