提交 f9c02078 authored 作者: pengxiaohui's avatar pengxiaohui

feat: 提交代码

上级 5f863494
......@@ -8,6 +8,10 @@ export function getCustomerList(params) {
export function createCustomer(data) {
return httpRequest.post('/api/customer/admin/v1/customer', data)
}
// 删除客户
export function deleteCustomer(id) {
return httpRequest.delete(`/api/customer/admin/v1/customer/${id}`)
}
// 新建联系人
export function createContact(data) {
return httpRequest.post('/api/customer/admin/v1/{customer_id}/contact', data)
......
......@@ -35,7 +35,6 @@ export default {
}
}
},
mounted() {
this.getBaseInfo()
},
......
......@@ -47,6 +47,10 @@ export default {
value: {
type: Boolean,
default: false
},
id: {
type: String,
default: ''
}
},
data() {
......
......@@ -37,20 +37,20 @@
<template v-slot:table-operate="{ row }">
<template>
<el-button type="text" @click="handleDetails(row)" size="mini">查看</el-button>
<el-button type="text" @click="handleDelete(row)" size="mini">删除</el-button>
<el-button type="text" @click="handleRemove(row)" size="mini">删除</el-button>
</template>
</template>
</app-list>
<create-customer v-model="dialogVisable" @change="$refs.list.refetch()" />
<customer-form-dialog v-model="dialogVisable" @change="refetchList" />
</app-card>
</template>
<script>
import AppUserSearch from '@/components/base/AppUserSearch.vue'
import AppArea from '@/components/base/AppArea.vue'
import CreateCustomer from '../components/CreateCustomer.vue'
import CustomerFormDialog from '../components/CustomerFormDialog.vue'
// 接口
import { getCustomerList } from '../api'
import { getCustomerList, deleteCustomer } from '../api'
const sourceList = [
{ name: '公司资源', id: 1 },
......@@ -62,7 +62,7 @@ const typeList = [
{ name: '重点客户', id: 2 }
]
export default {
components: { AppUserSearch, AppArea, CreateCustomer },
components: { AppUserSearch, AppArea, CustomerFormDialog },
data() {
return {
staffList: [
......@@ -267,7 +267,7 @@ export default {
handleDetails(row) {
console.log(row)
this.$router.push({
name: 'details',
path: '/customer-manage/details',
query: {
id: row.id
}
......@@ -275,15 +275,30 @@ export default {
},
// 删除弹窗确认
handleRemove(data) {
this.$confirm('角色删除请谨慎操作,确定删除?', '删除角色', {
this.$confirm('删除客户请谨慎操作,确定删除?', '删除客户', {
confirmButtonText: '删除',
cancelButtonText: '取消',
type: 'warning'
}).then(this.handleRemove(data))
}).then(() => {
this.fetchRemove(data)
}).catch(() => {})
},
// 删除请求
fetchRemove(data) {
console.log(data)
deleteCustomer(data.id).then(res => {
if (res.code === 0 && res.data && res.data.status) {
this.$message.success('删除用户成功')
this.refetchList()
} else {
this.$message.error('删除用户失败')
}
}).catch(err => {
this.$message.error('删除用户失败')
})
},
refetchList() {
this.$refs.list.refetch()
}
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论