fix():删除

master
yangpeng 2024-08-11 10:31:53 +08:00
parent b055287cb2
commit e242f54431
2 changed files with 184 additions and 148 deletions

View File

@ -1,34 +1,66 @@
import request from '@/utils/request' import request from "@/utils/request";
//查看客户列表 //查看客户列表
export function selectList(data) { export function selectList(data) {
return request({ return request({
url:'/pay/customer/list', url: '/pay/customer/list',
method:"POST", method: 'POST',
data:data data: data
}) })
} }
//请求未入住的服务code //请求未入住的服务code
export function customerAll(){ export function customerAll() {
return request({ return request({
url:'/pay/customer/all', url: '/pay/customer/all',
method:'GET' method: 'GET'
}) })
} }
//添加 //添加客户
export function save(data){ export function save(data) {
return request({ return request({
url:'/pay/customer', url: '/pay/customer',
method:'POST' method: 'POST',
data: data
})
}
//修改客户
export function update(data) {
return request({
url: `/pay/customer/${data.id}`,
method: 'PUT',
data: data
}) })
} }
//修改 //获取单条
export function update(data){ export function get(orderCustomerId) {
return request({ return request({
url:'/pay/customer', url: `/pay/customer/${orderCustomerId}`,
method:'PUT' method: 'GET'
})
}
//客户信息删除
export function del(orderCustomerId){
return request({
url: `/pay/customer/${orderCustomerId}`,
method: 'DELETE'
})
}
//通过ID启动客户
export function enable(orderCustomerId){
return request({
url: `/pay/customer/enable/${orderCustomerId}`,
method: 'GET'
})
}
//通过ID禁用客户
export function disable(orderCustomerId){
return request({
url: `/pay/customer/disable/${orderCustomerId}`,
method: 'GET'
}) })
} }

View File

@ -1,7 +1,5 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="68px" size="small"> <el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="68px" size="small">
<el-form-item label="客户名称"> <el-form-item label="客户名称">
<el-input <el-input
@ -31,23 +29,11 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="dateRange"
end-placeholder="结束日期"
range-separator="-"
start-placeholder="开始日期"
style="width: 240px"
type="daterange"
value-format="yyyy-MM-dd"
></el-date-picker>
</el-form-item>
<el-form-item> <el-form-item>
<el-button icon="el-icon-search" size="mini" type="primary" @click="getList"></el-button> <el-button icon="el-icon-search" size="mini" type="primary" @click="getList"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -60,30 +46,6 @@
>新增 >新增
</el-button> </el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button
v-hasPermi="['system:config:edit']"
:disabled="single"
icon="el-icon-edit"
plain
size="mini"
type="success"
@click="handleUpdate"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
v-hasPermi="['system:config:remove']"
:disabled="multiple"
icon="el-icon-delete"
plain
size="mini"
type="danger"
@click="handleDelete"
>删除
</el-button>
</el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
v-hasPermi="['system:config:export']" v-hasPermi="['system:config:export']"
@ -97,32 +59,42 @@
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-row :gutter="10"> <el-row :gutter="10">
<el-empty description="暂无支付客户" v-if="customerList.length === 0"></el-empty> <el-empty description="暂无支付客户" v-if="customerList.length == 0"></el-empty>
<el-col :span="8" v-for="customer in customerList" v-if="customerList.length === 0" > <el-col :span="8" v-for="customer in customerList" v-if="customerList.length != 0">
<el-card class="box-card"> <el-card class="box-card">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span style="font-size: 18px;font-weight: 900;">{{customer.appName}}</span> <span style="font-size: 18px;font-weight: 900">{{ customer.appName }}</span>
<el-switch <el-switch
style="float: right; margin: 4px 5px 0;" style="float: right;margin: 4px 5px 0"
v-model="switchValue" v-model="customer.status"
active-value="Y"
inactive-value="N"
active-color="#13ce66" active-color="#13ce66"
inactive-color="#ff4949"> inactive-color="#ff4949"
@change="handleStatusChange(customer)"
>
</el-switch> </el-switch>
<el-button style="float: right; padding: 5px; margin: 0 5px" type="danger" icon="el-icon-delete" <el-popconfirm
@click="handleDelete" confirm-button-text='好的'
cancel-button-text='不用了'
icon="el-icon-info"
icon-color="red"
title="你确定要删除此支付客户嘛?"
@confirm="handleDelete(customer.id)"
>
<el-button style="float: right;padding: 5px;margin: 0 5px" type="danger" slot="reference" icon="el-icon-delete"
circle></el-button>
</el-popconfirm>
<el-button style="float: right;padding: 5px;margin: 0 5px" type="primary" icon="el-icon-edit"
@click="handleUpdate(customer.id)"
circle></el-button> circle></el-button>
<el-button style="float: right; padding: 5px; margin: 0 5px" type="primary" icon="el-icon-edit"
@click="handleUpdate"
circle></el-button>
</div> </div>
<div> <div>
<el-descriptions class="margin-top" :column="1" :size="size" border> <el-descriptions class="margin-top" :column="1" :size="size" border>
<el-descriptions-item> <el-descriptions-item>
<template slot="label"><i class="el-icon-user"></i>客户名称</template> <template slot="label"><i class="el-icon-user"></i>客户名称</template>
{{ customer.appName }} {{customer.appName}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label"><i class="el-icon-user"></i>客户编码</template> <template slot="label"><i class="el-icon-user"></i>客户编码</template>
@ -130,34 +102,38 @@
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label"><i class="el-icon-user"></i>创建人</template> <template slot="label"><i class="el-icon-user"></i>创建人</template>
{{ customer.createBy }} {{customer.createBy}}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template slot="label"><i class="el-icon-user"></i>创建日期</template> <template slot="label"><i class="el-icon-user"></i>创建时间</template>
{{ customer.createTime }} {{customer.createTime}}
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </el-descriptions>
<el-divider content-position="center">近五笔交易记录</el-divider> <el-divider content-position="center">近五笔交易记录</el-divider>
<el-table <el-table
:data="customer.orderPaySimpleRespList" :data="customer.orderPaySimpleRespList"
style="width: 100%"> style="width: 100%">
<el-table-column prop="cusOrderNumber" label="客户单号"/> <el-table-column prop="cusOrderNumber" label="客户单号"/>
<el-table-column prop="price" label="支付金额"/> <el-table-column prop="price" label="支付金额"/>
<el-table-column prop="channelTypeName" label="渠道商"/> <el-table-column prop="channelTypeName" label="渠道商"/>
</el-table> </el-table>
</div> </div>
</el-card> </el-card>
</el-col> </el-col>
</el-row> </el-row>
<el-dialog <el-dialog
title="title" :title="title"
:visible.sync="open" :visible.sync="open"
width="50%"> width="50%">
<el-form ref="form" :model="form" label-width="120px" :rules="rules"> <el-form ref="form" :model="form" label-width="120px" :rules="rules">
<el-form-item label="客户编码" prop="appCode"> <el-form-item label="客户编码" prop="appCode">
<span v-if="this.form.id!=null" style="font-size: 16px">cloud-1</span> <span v-if="this.form.id != null" style="font-size: 16px">{{form.appCode}}</span>
<el-select v-if="this.form.id==null" v-model="form.appCode" placeholder="请选择未入住的客户" style="width: 100%"> <el-select v-if="this.form.id == null" v-model="form.appCode" placeholder="请选择未入住的客户" style="width: 100%">
<el-option <el-option
v-for="item in appCodeList" v-for="item in appCodeList"
:key="item" :key="item"
@ -170,100 +146,94 @@
<el-input v-model="form.appName"></el-input> <el-input v-model="form.appName"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="激活开通" prop="status"> <el-form-item label="激活开通" prop="status">
<el-radio-group v-model="form.status"> <el-radio-group v-model="form.status">
<el-radio <el-radio
v-for="dict in dict.type.sys_yes_no" v-for="dict in dict.type.sys_yes_no"
:key="dict.value" :key="dict.value"
:label="dict.value" :label="dict.value"
>{{ dict.label }} >{{ dict.label }}
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="客户备注"> <el-form-item label="客户备注">
<el-input v-model="form.remark" type="textarea" rows="6"></el-input> <el-input v-model="form.remark" type="textarea" rows="6"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="详细描述"> <el-form-item label="详细描述">
<!-- <el-input v-model="form.appDesc"></el-input>--> <!-- <el-input v-model="form.appDesc"></el-input>-->
<editor v-model="form.appDesc" :min-height="192"/> <editor v-model="form.appDesc" :min-height="192"/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="open = false"> </el-button>
<el-button type="primary" @click="dialogVisible = false">提交</el-button> <el-button type="primary" @click="submitForm"></el-button>
</span> </span>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import {customerAll, selectList} from "@/api/pay/customer"; import {customerAll, disable, enable, save, selectList, update, del, get} from "@/api/pay/customer";
import {addConfig, updateConfig} from "@/api/system/config";
export default { export default {
name: 'Customer', name: "Customer",
dicts: ['sys_yes_no'], dicts: ['sys_yes_no'],
data() { data() {
return { return {
// //
showSearch: true, showSearch: true,
// //
queryParams: { queryParams:{
"appName": "", "appName":"",
"appCode": "", "appCode":"",
"status": "Y" "status":"Y"
}, },
// //
customerList:[], customerList:[],
switchValue:true, switchValue: true,
/// open:false,
open: false,
// //
title:"", title: "",
// //
form: { form:{
"appName": "", "appName":"",
"appCode": "", "appCode":"",
"appDesc": "", "appDesc":"",
"status": "Y", "status":"Y",
"remark": "", "remark":""
}, },
// //
appCodeList:["cloud-1","cloud-2","cloud-3"], appCodeList:["cloud-1","cloud-2","cloud-3"],
// //
rules: { rules: {
appCode: [ appCode: [
{required: true, message: "请选择客户编码", trigger: "change"} {required: true, message: "参数名称不能为空", trigger: "change"}
], ],
appName: [ appName: [
{required: true, message: "客户名称不能为空", trigger: "blur"} {required: true, message: "参数键名不能为空", trigger: "blur"}
], ],
status: [ status: [
{required: true, message: "请选择客户是否开通", trigger: "blur"} {required: true, message: "参数键值不能为空", trigger: "blur"}
] ]
} }
} };
}, },
created() { created() {
this.getList() this.getList();
}, },
methods: { methods: {
/** 重置按钮操作 */ //
resetQuery() { resetQuery() {
this.queryParams={ this.queryParams = {
"appName": "", "appName": "",
"appCode": "", "appCode": "",
"status": "Y" "status": "Y"
} }
this.getList(); this.getList();
}, },
// //
getList(){ getList() {
selectList(this.queryParams).then(response=>{ selectList(this.queryParams).then(response => {
this.customerList=response.data; this.customerList = response.data;
}) })
}, },
// //
@ -273,40 +243,33 @@ export default {
"appCode": "", "appCode": "",
"appDesc": "", "appDesc": "",
"status": "Y", "status": "Y",
"remark": "", "remark": ""
}; };
this.resetForm("form"); this.resetForm("form");
this.customerList = []; this.customerList = [];
customerAll().then(response=>{ customerAll().then(response => {
this.customerList=response.data; this.appCodeList = response.data;
}) })
}, },
/** 新增按钮操作 */ /** 删除按钮 */
handleAdd() { handleDelete(orderCustomerId) {
this.reset(); del(orderCustomerId).then(response => {
this.open = true; this.$modal.msgSuccess("删除成功");
this.title = "添加支付单客户信息"; this.getList();
}, });
/** 修改按钮操作 */
handleUpdate() {
this.reset();
// TODO
this.form.id = "1";
this.open = true;
this.title = "添加支付单客户信息";
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function () { submitForm: function () {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.id != undefined) { if (this.form.id != undefined) {
updateConfig(this.form).then(response => { update(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
} else { } else {
addConfig(this.form).then(response => { save(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
@ -315,13 +278,54 @@ export default {
} }
}); });
}, },
/** 客户状态更改触发 */
handleStatusChange(row) {
if (row.status == 'Y') {
enable(row.id).then(response => {
this.$modal.msgSuccess("启用成功");
row.status = 'Y'; //
this.getList();
}).catch(error => {
this.$modal.msgError("启用失败");
row.status = 'N'; // 退
console.error(error);
});
} else {
disable(row.id).then(response => {
this.$modal.msgSuccess("禁用成功");
row.status = 'N'; //
this.getList();
}).catch(error => {
this.$modal.msgError("禁用失败");
row.status = 'Y'; // 退
console.error(error);
});
}
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加支付单客户信息";
},
/** 修改按钮操作 */
handleUpdate(orderCustomerId) {
this.reset();
get(orderCustomerId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改支付单客户信息";
}).catch(error => {
this.$modal.msgError("获取客户信息失败");
console.error(error);
});
},
} }
} }
</script> </script>
<style scoped> <style scoped>
.el-card{ .el-card {
margin: 10px 0; margin: 10px 0;
} }
</style> </style>