|
|
@@ -2,19 +2,21 @@ |
|
|
|
<div class="boxMain"> |
|
|
|
<inc-search :listInput="listInput" :loadSoBn="tableLoad" :onSearch="filterSearch"></inc-search> |
|
|
|
<a-table class="tablesa" :columns="tableColumns" :data-source="tableData" :rowKey="lists => lists.id" :pagination="pagination" :loading="tableLoad" @change="filterSearch"> |
|
|
|
<router-link slot="code" slot-scope="text,record" :to="'detail?id='+record.id"><a-icon type="file-text" /> {{text}}</router-link> |
|
|
|
<span slot="validDate" slot-scope="text">{{formatDateTime(text)}}</span> |
|
|
|
<span slot="state" slot-scope="text">{{text==1?'启用':'禁用'}}</span> |
|
|
|
<div slot="id" slot-scope="text,record,index"> |
|
|
|
<a-spin :spinning="record.load"> |
|
|
|
<a-space> |
|
|
|
<a-button type="primary" v-if="record.state==2" @click="fnSetState(record,index)">启用</a-button> |
|
|
|
<a-button type="primary" v-else @click="fnSetState(record,index)">禁用</a-button> |
|
|
|
<a-button @click="fnRelease(record,index)">发布</a-button> |
|
|
|
<a-popconfirm title="确定删除吗?" ok-text="Yes" cancel-text="No" @confirm="fnDel(record,index)"><a-button type="danger" >删除</a-button></a-popconfirm> |
|
|
|
</a-space> |
|
|
|
</a-spin> |
|
|
|
</div> |
|
|
|
</a-table> |
|
|
|
<a-modal title="新增商户" :visible="showNA" :confirm-loading="confirmNewAgent" @ok="newAgent" @cancel="showNA=false"> |
|
|
|
<a-modal title="新增平台" :visible="showNA" :confirm-loading="confirmNewAgent" @ok="newAgent" @cancel="showNA=false"> |
|
|
|
<a-form-model v-model="formNA" v-bind="layout"> |
|
|
|
<a-form-model-item label="商户编码"><a-input v-model="formNA.code"/></a-form-model-item> |
|
|
|
<a-form-model-item label="商户简称"><a-input v-model="formNA.shortName"/></a-form-model-item> |
|
|
|
<a-form-model-item label="商户名称"><a-input v-model="formNA.name"/></a-form-model-item> |
|
|
|
<a-form-model-item label="商户邮箱"><a-input v-model="formNA.email"/></a-form-model-item> |
|
|
|
<a-form-model-item label="商户网址"><a-input v-model="formNA.website"/></a-form-model-item> |
|
|
|
<a-form-model-item label="Logo地址"><a-input v-model="formNA.logoUrl"/></a-form-model-item> |
|
|
|
<a-form-model-item label="法人代表"><a-input v-model="formNA.legalRepresent"/></a-form-model-item> |
|
|
|
<a-form-model-item label="截至有效期"><a-date-picker v-model="formNA.validDate" format="yyyy-MM-DD" valueFormat="yyyy-MM-DD 00:00:00"/></a-form-model-item> |
|
|
|
<a-form-model-item label="平台描述"><a-input v-model="formNA.description"/></a-form-model-item> |
|
|
|
</a-form-model> |
|
|
|
</a-modal> |
|
|
|
</div> |
|
|
@@ -22,7 +24,13 @@ |
|
|
|
|
|
|
|
<script> |
|
|
|
import IncSearch from "@/pages/Common/search"; |
|
|
|
import {MerchantsList, NewMerchants} from "@/services/Merchants/Merchants"; |
|
|
|
import { |
|
|
|
delMerchants, |
|
|
|
MerchantsList, |
|
|
|
NewMerchants, |
|
|
|
pubMerchantsAccess, |
|
|
|
setMerchantsState |
|
|
|
} from "@/services/Merchants/Merchants"; |
|
|
|
import {formatDate} from "@/services/Common"; |
|
|
|
export default { |
|
|
|
name: 'agentList', |
|
|
@@ -30,9 +38,9 @@ export default { |
|
|
|
data(){ |
|
|
|
return{ |
|
|
|
listInput:[ |
|
|
|
{type:'input',name:'code',title:'商户编码',value:'',alt:'全匹配'}, |
|
|
|
{type:'input',name:'name',title:'商户名称',value:'',alt:'模糊匹配'}, |
|
|
|
{type:'button',name:'newAgent',title:'新增商户',value:'',alt:'',fn:this.showNewAgent}, |
|
|
|
{type:'input',name:'code',title:'关键词',value:'',alt:'全匹配'}, |
|
|
|
// {type:'input',name:'name',title:'商户名称',value:'',alt:'模糊匹配'}, |
|
|
|
{type:'button',name:'newAgent',title:'新增平台',value:'',alt:'',fn:this.showNewAgent}, |
|
|
|
], |
|
|
|
pagination: { |
|
|
|
pageSize: 10, |
|
|
@@ -42,16 +50,13 @@ export default { |
|
|
|
tableLoad: false, |
|
|
|
tableColumns:[ |
|
|
|
// {title: '商户ID',dataIndex: 'id',key: 'id',}, |
|
|
|
{title: '商户编码',dataIndex: 'code',key: 'code',scopedSlots: { customRender: 'code' },}, |
|
|
|
{title: '名称',dataIndex: 'name',key: 'name',}, |
|
|
|
{title: '简称',dataIndex: 'shortName',key: 'shortName',}, |
|
|
|
{title: '法定代表人',dataIndex: 'legalRepresent',key: 'legalRepresent',}, |
|
|
|
{title: '网址',dataIndex: 'website',key: 'website',}, |
|
|
|
{title: '截止有效期',dataIndex: 'validDate',key: 'validDate',scopedSlots: { customRender: 'validDate' },}, |
|
|
|
{title: '邮箱',dataIndex: 'email',key: 'email'}, |
|
|
|
{title: '平台描述',dataIndex: 'description',key: 'description',scopedSlots: { customRender: 'description' },}, |
|
|
|
{title: '状态',dataIndex: 'state',key: 'state',scopedSlots: { customRender: 'state' },}, |
|
|
|
// {title: '邮箱',dataIndex: 'email',key: 'email'}, |
|
|
|
{title: '操作',width:'300px',dataIndex: 'id',key: 'id',scopedSlots: { customRender: 'id' },}, |
|
|
|
], |
|
|
|
tableData:[],showNA:false,confirmNewAgent:false, |
|
|
|
formNA:{code:'',shortName:'',name:'',email:'',website:'',logoUrl:'',legalRepresent:'',validDate:''}, |
|
|
|
formNA:{description:''}, |
|
|
|
layout: { |
|
|
|
labelCol: { span:7 }, |
|
|
|
wrapperCol: { span:12 }, |
|
|
@@ -62,19 +67,57 @@ export default { |
|
|
|
this.filterSearch(); |
|
|
|
}, |
|
|
|
methods:{ |
|
|
|
fnSetState(arr,index){ |
|
|
|
// console.log('设置状态:',arr,index) |
|
|
|
this.tableData[index].load = true; |
|
|
|
setMerchantsState(arr.id,arr.state).then(res=>{ |
|
|
|
if (res.success) this.$message.success(res.message) |
|
|
|
else this.$message.error(res.message) |
|
|
|
}).finally(()=>{ |
|
|
|
this.tableData[index].load = false; |
|
|
|
this.filterSearch(); |
|
|
|
}) |
|
|
|
}, |
|
|
|
fnRelease(arr,index){ |
|
|
|
// console.log('发布:',arr,index) |
|
|
|
this.tableData[index].load = true; |
|
|
|
pubMerchantsAccess(arr.id).then(res=>{ |
|
|
|
if (res.success) this.$message.success(res.message) |
|
|
|
else this.$message.error(res.message) |
|
|
|
}).finally(()=>{ |
|
|
|
this.tableData[index].load = false; |
|
|
|
this.filterSearch(); |
|
|
|
}) |
|
|
|
}, |
|
|
|
fnDel(arr,index){ |
|
|
|
// console.log('删除',arr,index) |
|
|
|
this.tableData[index].load = true; |
|
|
|
delMerchants(arr.id).then(res=>{ |
|
|
|
if (res.success) this.$message.success(res.message) |
|
|
|
else this.$message.error(res.message) |
|
|
|
}).finally(()=>{ |
|
|
|
this.tableData[index].load = false; |
|
|
|
this.filterSearch(); |
|
|
|
}) |
|
|
|
}, |
|
|
|
showNewAgent(){ |
|
|
|
this.showNA = true; |
|
|
|
}, |
|
|
|
newAgent(){ |
|
|
|
let name = this.formNA.description; |
|
|
|
if (name==''){ |
|
|
|
this.$message.error('请填写平台描述!'); |
|
|
|
return false; |
|
|
|
} |
|
|
|
this.confirmNewAgent = true; |
|
|
|
NewMerchants(this.formNA).then(res=>{ |
|
|
|
if(res.id) { |
|
|
|
this.$message.success('商户添加成功!'); |
|
|
|
NewMerchants(name).then(res=>{ |
|
|
|
if(res.success) { |
|
|
|
this.$message.success(res.message); |
|
|
|
this.showNA = false; |
|
|
|
this.formNA.description = ''; |
|
|
|
this.filterSearch(); |
|
|
|
} |
|
|
|
this.showNA = false; |
|
|
|
this.confirmNewAgent = false; |
|
|
|
}).catch(err=>{ |
|
|
|
}else this.$message.error(res.message) |
|
|
|
}).finally(()=>{ |
|
|
|
this.confirmNewAgent = false; |
|
|
|
}); |
|
|
|
}, |
|
|
@@ -87,9 +130,8 @@ export default { |
|
|
|
let count = (this.pagination.current-1)*this.pagination.pageSize; |
|
|
|
let params={ |
|
|
|
code:this.listInput[0].value, |
|
|
|
name:this.listInput[1].value, |
|
|
|
skipCount:count, |
|
|
|
maxResultCount:this.pagination.pageSize, |
|
|
|
pageIndex: this.pagination.current, |
|
|
|
pageSize: this.pagination.pageSize |
|
|
|
} |
|
|
|
// console.log(params) |
|
|
|
this.fetch(params); |
|
|
@@ -97,12 +139,19 @@ export default { |
|
|
|
fetch(params = {}) { |
|
|
|
this.tableLoad = true; |
|
|
|
MerchantsList(params).then(data=>{ |
|
|
|
const pagination = { ...this.pagination}; |
|
|
|
pagination.total = data.totalCount; |
|
|
|
this.tableLoad = false; |
|
|
|
this.tableData = data.items; |
|
|
|
this.pagination = pagination; |
|
|
|
}).catch(err=>{ |
|
|
|
if (data.success){ |
|
|
|
data = data.data; |
|
|
|
const pagination = { ...this.pagination}; |
|
|
|
pagination.total = data.totalCount; |
|
|
|
for (let i in data.items){ |
|
|
|
data.items[i].load = false; |
|
|
|
} |
|
|
|
this.tableData = data.items; |
|
|
|
this.pagination = pagination; |
|
|
|
}else{ |
|
|
|
this.$message.error('获取失败!'); |
|
|
|
} |
|
|
|
}).finally(()=>{ |
|
|
|
this.tableLoad = false; |
|
|
|
}) |
|
|
|
}, |
|
|
|