|
@@ -1,30 +1,8 @@
|
|
|
<template>
|
|
|
<div class="adminShop-wrap">
|
|
|
- <div class="addShopBtn"><i class="el-icon-plus"></i><span>添加商家</span></div>
|
|
|
+ <div class="addShopBtn" @click="toShowAdd"><i class="el-icon-plus"></i><span>添加商家</span></div>
|
|
|
<div class="shopList-wrap">
|
|
|
<h5>商家信息</h5>
|
|
|
- <!-- <table class="shopList-content">
|
|
|
- <thead>
|
|
|
- <tr class="shopList-thead">
|
|
|
- <th>编号</th>
|
|
|
- <th>店铺名称</th>
|
|
|
- <th>登陆账号</th>
|
|
|
- <th>登陆密码</th>
|
|
|
- <th>店铺标签</th>
|
|
|
- <th>操作</th>
|
|
|
- </tr>
|
|
|
- </thead>
|
|
|
- <tbody>
|
|
|
- <tr v-for="item in shopInfo">
|
|
|
- <td>{{item.id}}</td>
|
|
|
- <td>{{item.userName}}</td>
|
|
|
- <td>{{item.loginId}}</td>
|
|
|
- <td>{{item.password}}</td>
|
|
|
- <td>{{item.label}}</td>
|
|
|
- <td>删除,编辑,查看</td>
|
|
|
- </tr>
|
|
|
- </tbody>
|
|
|
- </table> -->
|
|
|
<el-table
|
|
|
:data="shopInfo"
|
|
|
border
|
|
@@ -52,11 +30,6 @@
|
|
|
<el-table-column
|
|
|
prop="label"
|
|
|
label="店铺标签"
|
|
|
- min-width="3">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="label"
|
|
|
- label="标签"
|
|
|
:filters="shopTagList"
|
|
|
:filter-method="filterTag"
|
|
|
filter-placement="bottom-end"
|
|
@@ -71,17 +44,50 @@
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
- @click="">编辑</el-button>
|
|
|
+ @click="toShowEdit(scope.row)">编辑</el-button>
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
- @click="">删除</el-button>
|
|
|
+ @click="toDelete(scope.row.id)">删除</el-button>
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
- @click="">查看</el-button>
|
|
|
+ @click="toShowCheck(scope.row)">查看</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
+ <el-dialog :title="dialogTitle" :visible.sync="dialogTableVisible" :show-close="false">
|
|
|
+ <div class="dialogheader">
|
|
|
+ <el-form label-position="right" label-width="80px">
|
|
|
+ <el-form-item label="编号" v-show="dialogTitle=='查看商家'">
|
|
|
+ <el-input v-model="showItem.id" :disabled="dialogTitle=='查看商家'"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="店铺名称">
|
|
|
+ <el-input v-model="showItem.userName" :disabled="dialogTitle=='查看商家'"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="登陆账号">
|
|
|
+ <el-input v-model="showItem.name" :disabled="dialogTitle=='查看商家'"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="登陆密码">
|
|
|
+ <el-input v-model="showItem.password" :disabled="dialogTitle=='查看商家'"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="店铺标签">
|
|
|
+ <el-select v-model="showItem.label" placeholder="请选择" :disabled="dialogTitle=='查看商家'">
|
|
|
+ <el-option
|
|
|
+ v-for="item in shopTagList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.text"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="toAdd" v-show="dialogTitle=='添加商家'">提交</el-button>
|
|
|
+ <el-button type="primary" @click="toEdit" v-show="dialogTitle=='编辑商家'">提交</el-button>
|
|
|
+ <el-button @click="toCancel">取消</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -91,6 +97,15 @@
|
|
|
return{
|
|
|
shopInfo:[],
|
|
|
shopTagList:[],
|
|
|
+ dialogTableVisible:false,
|
|
|
+ dialogTitle:"",
|
|
|
+ showItem:{
|
|
|
+ id:"",
|
|
|
+ userName:"",
|
|
|
+ name:"",
|
|
|
+ password:"",
|
|
|
+ label:""
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
mounted(){
|
|
@@ -111,11 +126,141 @@
|
|
|
this.axios.post(this.Api.getTagtList,{}).then((res)=>{
|
|
|
this.shopTagList=res.data;
|
|
|
}).catch((err)=>{
|
|
|
- console.log("getShopList:"+err);
|
|
|
+ console.log("getShopTagList:"+err);
|
|
|
});
|
|
|
},
|
|
|
filterTag(value, row) {
|
|
|
return row.label === value;
|
|
|
+ },
|
|
|
+ toShowAdd(){
|
|
|
+ this.dialogTableVisible=true;
|
|
|
+ this.dialogTitle="添加商家";
|
|
|
+ },
|
|
|
+ toShowEdit(obj){
|
|
|
+ this.dialogTableVisible=true;
|
|
|
+ this.dialogTitle="编辑商家";
|
|
|
+ this.showItem.id=obj.id;
|
|
|
+ this.showItem.userName=obj.userName;
|
|
|
+ this.showItem.name=obj.loginId;
|
|
|
+ this.showItem.password=obj.password;
|
|
|
+ this.showItem.label=obj.label;
|
|
|
+ },
|
|
|
+ toShowCheck(obj){
|
|
|
+ this.dialogTableVisible=true;
|
|
|
+ this.dialogTitle="查看商家";
|
|
|
+ this.showItem.id=obj.id;
|
|
|
+ this.showItem.userName=obj.userName;
|
|
|
+ this.showItem.name=obj.loginId;
|
|
|
+ this.showItem.password=obj.password;
|
|
|
+ this.showItem.label=obj.label;
|
|
|
+ },
|
|
|
+ toCancel(){
|
|
|
+ this.dialogTableVisible=false;
|
|
|
+ this.dialogTitle="";
|
|
|
+ this.showItem={
|
|
|
+ id:"",
|
|
|
+ userName:"",
|
|
|
+ name:"",
|
|
|
+ password:"",
|
|
|
+ label:""
|
|
|
+ }
|
|
|
+ },
|
|
|
+ toAdd(){
|
|
|
+ if(this.showItem.name==""||this.showItem.password==""||this.showItem.userName==""||this.showItem.label==""){
|
|
|
+ this.$message.error('请填写完整信息');
|
|
|
+ console.log(this.showItem)
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let param={
|
|
|
+ type:1,
|
|
|
+ handle:"1",
|
|
|
+ mess:{
|
|
|
+ name:this.showItem.name,
|
|
|
+ password:this.showItem.password,
|
|
|
+ userName:this.showItem.userName,
|
|
|
+ label:this.showItem.label,
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.axios.post(this.Api.adminHandle,param).then((res)=>{
|
|
|
+ console.log(res);
|
|
|
+ if(res.data.code==200){
|
|
|
+ this.$message({
|
|
|
+ message: '添加成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ this.toCancel();
|
|
|
+ this.getShopList();
|
|
|
+ }
|
|
|
+ }).catch((err)=>{
|
|
|
+ console.log("toAdd:"+err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ toEdit(){
|
|
|
+ if(this.showItem.name==""||this.showItem.password==""||this.showItem.userName==""||this.showItem.label==""){
|
|
|
+ this.$message.error('请填写完整信息');
|
|
|
+ console.log(this.showItem)
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let param={
|
|
|
+ type:1,
|
|
|
+ handle:"2",
|
|
|
+ mess:{
|
|
|
+ id:this.showItem.id,
|
|
|
+ name:this.showItem.name,
|
|
|
+ password:this.showItem.password,
|
|
|
+ userName:this.showItem.userName,
|
|
|
+ label:this.showItem.label,
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.axios.post(this.Api.adminHandle,param).then((res)=>{
|
|
|
+ console.log(res);
|
|
|
+ if(res.data.code==200){
|
|
|
+ this.$message({
|
|
|
+ message: '编辑成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ this.toCancel();
|
|
|
+ this.getShopList();
|
|
|
+ }
|
|
|
+ }).catch((err)=>{
|
|
|
+ console.log("toEdit:"+err);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ toDelete(id){
|
|
|
+ this.$confirm("确定将该商家删除吗?", '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ let param={
|
|
|
+ type:1,
|
|
|
+ handle:"3",
|
|
|
+ mess:{
|
|
|
+ id:id,
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.axios.post(this.Api.adminHandle,param).then((res)=>{
|
|
|
+ console.log(res);
|
|
|
+ if(res.data.code==200){
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '删除成功!'
|
|
|
+ });
|
|
|
+ this.getShopList();
|
|
|
+ }else{
|
|
|
+ this.$notify({
|
|
|
+ title:'提示',
|
|
|
+ message:'删除失败',
|
|
|
+ type:'error',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消操作'
|
|
|
+ });
|
|
|
+ })
|
|
|
},
|
|
|
}
|
|
|
}
|
|
@@ -191,4 +336,101 @@
|
|
|
background-color: #bcf2db;
|
|
|
text-align: center;
|
|
|
}
|
|
|
+
|
|
|
+ .el-dialog{
|
|
|
+ width: 500px;
|
|
|
+ /*height: 280px;*/
|
|
|
+ border-radius: 6px;
|
|
|
+ text-align: left;
|
|
|
+ }
|
|
|
+ .el-dialog__header{
|
|
|
+ padding: 20px 30px 0 40px;
|
|
|
+ }
|
|
|
+ .el-dialog__body{
|
|
|
+ padding: 20px 30px;
|
|
|
+ }
|
|
|
+ .dialogheader{
|
|
|
+ width: 100%;
|
|
|
+ /*height: 60px;*/
|
|
|
+
|
|
|
+ }
|
|
|
+ .dialogheader p{
|
|
|
+ width: 360px;
|
|
|
+ height: 30px;
|
|
|
+ line-height: 30px;
|
|
|
+ margin-top: 10px;
|
|
|
+ border:1px solid #3eb983;
|
|
|
+ border-radius: 6px;
|
|
|
+ text-align: left;
|
|
|
+ padding-left: 10px;
|
|
|
+ margin-left: 60px;
|
|
|
+ }
|
|
|
+ .dialogheader p input{
|
|
|
+ height: 24px;
|
|
|
+ line-height: 24px;
|
|
|
+ border:0;
|
|
|
+ margin-left: 20px;
|
|
|
+ }
|
|
|
+ .dialogheader .button{
|
|
|
+ background: #3eb983;
|
|
|
+ color: #fff;
|
|
|
+ text-align: center;
|
|
|
+ margin-top: 40px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ .dialogheader .el-button{
|
|
|
+ width: 173px;
|
|
|
+ padding: 10px 0;
|
|
|
+ }
|
|
|
+ .dialogheader .el-form-item{
|
|
|
+ margin-bottom: 15px;
|
|
|
+ }
|
|
|
+ .dialogheader .el-button+.el-button{
|
|
|
+ margin-left: 0;
|
|
|
+ }
|
|
|
+ .dialogheader .el-button--primary{
|
|
|
+ background-color: #3eb983;
|
|
|
+ border-color: #3eb983;
|
|
|
+ }
|
|
|
+ .dialogheader .el-button--primary:hover{
|
|
|
+ background-color: #3eb983;
|
|
|
+ border-color: #3eb983;
|
|
|
+ }
|
|
|
+ .dialogheader .el-button--default{
|
|
|
+ background-color: #bfcbd9;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+ .dialogheader .el-button--default:hover{
|
|
|
+ background-color: #bfcbd9;
|
|
|
+ border-color: #bfcbd9;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-message-box button{
|
|
|
+ display: inline-block;
|
|
|
+ float: right;
|
|
|
+ }
|
|
|
+ .el-message-box .el-message-box__btns{
|
|
|
+ height: 61px;
|
|
|
+ }
|
|
|
+ .el-message-box .el-message-box__btns button:nth-child(1){
|
|
|
+ margin-left: 10px;
|
|
|
+ }
|
|
|
+ .el-message-box .el-message-box__btns .el-button--default{
|
|
|
+ background-color: #bfcbd9;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+ .el-message-box .el-message-box__btns .el-button--default:hover{
|
|
|
+ background-color: #bfcbd9;
|
|
|
+ border-color: #bfcbd9;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+ .el-message-box .el-message-box__btns .el-button--primary{
|
|
|
+ background-color: #3eb983;
|
|
|
+ border-color: #3eb983;
|
|
|
+ }
|
|
|
+ .el-message-box .el-message-box__btns .el-button--primary:hover{
|
|
|
+ background-color: #3eb983;
|
|
|
+ border-color: #3eb983;
|
|
|
+ }
|
|
|
</style>
|