Commit 66ead8b5 authored by rencs's avatar rencs

Merge branch 'dev_ren' into 'dev'

12.25 交易保障

See merge request !14
parents a10f7321 c3f4c8e1
...@@ -71,6 +71,26 @@ ...@@ -71,6 +71,26 @@
</div> </div>
</el-col> </el-col>
</el-form-item> </el-form-item>
<el-form-item label="图片">
<el-upload
class="avatar-uploader"
:action="BASE_API + '/api/universal/file/app/unauth/admin/upload'"
:show-file-list="false"
:on-success="handleIconSuccess"
>
<img
v-if="form.icon"
:src="form.icon"
style="width: 100px; height: 100px"
class="avatar"
/>
<i
v-else
class="el-icon-plus avatar-uploader-icon"
style="width: 100px; height: 100px; line-height: 100px"
></i>
</el-upload>
</el-form-item>
<el-form-item label="内容" prop="content"> <el-form-item label="内容" prop="content">
<el-col :span="24"> <el-col :span="24">
<div <div
...@@ -128,7 +148,7 @@ ...@@ -128,7 +148,7 @@
<el-table-column label="保障内容" align="center"> <el-table-column label="保障内容" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-html="scope.row.content"> <div v-html="scope.row.content">
{{scope.row.content}} {{ scope.row.content }}
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
...@@ -151,7 +171,9 @@ ...@@ -151,7 +171,9 @@
<template slot-scope="scope"> <template slot-scope="scope">
<span> <span>
<div class="operators"> <div class="operators">
<div class="edit" @click.stop="editProtection(scope.row)">编辑</div> <div class="edit" @click.stop="editProtection(scope.row)">
编辑
</div>
<div <div
class="offshelf" class="offshelf"
v-if="scope.row.status == 1" v-if="scope.row.status == 1"
...@@ -159,7 +181,13 @@ ...@@ -159,7 +181,13 @@
> >
下架 下架
</div> </div>
<div class="upshelf" v-else @click.stop="changeStatus(scope.row)">上架</div> <div
class="upshelf"
v-else
@click.stop="changeStatus(scope.row)"
>
上架
</div>
<div class="delete" @click.stop="delInfo(scope.row)">删除</div> <div class="delete" @click.stop="delInfo(scope.row)">删除</div>
</div> </div>
</span> </span>
...@@ -187,12 +215,13 @@ import { ...@@ -187,12 +215,13 @@ import {
addUpdateProtection, addUpdateProtection,
getListProtections, getListProtections,
} from "api/website/industryApplication/index"; } from "api/website/industryApplication/index";
import elementVue from '../../../admin/menu/components/element.vue'; import elementVue from "../../../admin/menu/components/element.vue";
export default { export default {
name: "TransactionProtection", name: "TransactionProtection",
components: {}, components: {},
data() { data() {
return { return {
BASE_API: process.env.BASE_API,
currentTheme: "", currentTheme: "",
// 功能按钮 // 功能按钮
operatorControls: [ operatorControls: [
...@@ -213,6 +242,7 @@ export default { ...@@ -213,6 +242,7 @@ export default {
currentEidtInfo: "", currentEidtInfo: "",
form: { form: {
rank: "", rank: "",
icon: undefined,
title: "", title: "",
detail: [ detail: [
{ {
...@@ -235,47 +265,53 @@ export default { ...@@ -235,47 +265,53 @@ export default {
pagination: { pagination: {
total: 0, total: 0,
pageSize: 10, pageSize: 10,
currentPage: 0 currentPage: 0,
}, },
}; };
}, },
watch: { watch: {
managerVisible(newVal){ managerVisible(newVal) {
if(!newVal){ if (!newVal) {
this.form.rank = "" this.form.rank = "";
this.form.title = "" this.form.title = "";
this.form.detail = [{content:""}] this.form.detail = [{ content: "" }];
this.form.color = "" this.form.color = "";
this.form.icon = undefined;
} }
}, },
}, },
mounted() { mounted() {
this.pullListProtections() this.pullListProtections();
}, },
methods: { methods: {
pullListProtections(){ handleIconSuccess(res) {
this.form.icon = res.data;
},
pullListProtections() {
getListProtections({ getListProtections({
page: this.pagination.currentPage, page: this.pagination.currentPage,
limit: this.pagination.pageSize limit: this.pagination.pageSize,
}).then(res => { }).then((res) => {
if(res.status == 200){ if (res.status == 200) {
console.log("获取的保障分页数据为=>",res) console.log("获取的保障分页数据为=>", res);
this.tableDataCache = [] this.tableDataCache = [];
this.pagination.total = res.data.totalCount this.pagination.total = res.data.totalCount;
res.data.data.forEach(element => { res.data.data.forEach((element) => {
this.tableDataCache.push(element) this.tableDataCache.push(element);
}) });
this.screenListProtections() this.screenListProtections();
} }
}) });
}, },
screenListProtections(){ screenListProtections() {
this.tableData = [] this.tableData = [];
let index = 0 let index = 0;
this.tableDataCache.forEach(element => { this.tableDataCache.forEach((element) => {
this.tableData.push({ this.tableData.push({
content: this.transDetailToContent(element.detail), content: this.transDetailToContent(element.detail),
index: ((this.pagination.currentPage-1)*this.pagination.pageSize)+(++index), index:
(this.pagination.currentPage - 1) * this.pagination.pageSize +
++index,
id: element.id, id: element.id,
title: element.title, title: element.title,
crtTime: element.crtTime, crtTime: element.crtTime,
...@@ -285,25 +321,26 @@ export default { ...@@ -285,25 +321,26 @@ export default {
rank: element.rank, rank: element.rank,
status: element.status, status: element.status,
type: element.type, type: element.type,
color: !!element.color ? element.color : "#000000" icon: element.icon,
}) color: !!element.color ? element.color : "#000000",
}) });
if(this.currentTheme!=""){ });
this.tableData = this.tableData.filter(element => { if (this.currentTheme != "") {
this.tableData = this.tableData.filter((element) => {
//正则表达式 //正则表达式
let reg = new RegExp(this.currentTheme); let reg = new RegExp(this.currentTheme);
return element.title.match(reg) return element.title.match(reg);
}) });
} }
}, },
changeStatus(info){ changeStatus(info) {
let message = "" let message = "";
if(info.status == 1){ if (info.status == 1) {
info.status = 2 info.status = 2;
message = "下架成功!!!" message = "下架成功!!!";
}else{ } else {
info.status = 1 info.status = 1;
message = "上架成功!!!" message = "上架成功!!!";
} }
addUpdateProtection({ addUpdateProtection({
type: info.type, type: info.type,
...@@ -312,6 +349,7 @@ export default { ...@@ -312,6 +349,7 @@ export default {
status: info.status, status: info.status,
isDel: info.isDel, isDel: info.isDel,
color: info.color, color: info.color,
icon: info.icon,
rank: info.rank, rank: info.rank,
id: info.id, id: info.id,
}).then((res) => { }).then((res) => {
...@@ -320,17 +358,17 @@ export default { ...@@ -320,17 +358,17 @@ export default {
message: message, message: message,
type: "success", type: "success",
}); });
this.pullListProtections() this.pullListProtections();
}else{ } else {
this.$message.error('操作失败,请稍后重试!!!'); this.$message.error("操作失败,请稍后重试!!!");
} }
}); });
}, },
delInfo(info){ delInfo(info) {
this.$confirm('确定继续执行该操作吗?', '提示', { this.$confirm("确定继续执行该操作吗?", "提示", {
confirmButtonText: '确定', confirmButtonText: "确定",
cancelButtonText: '取消', cancelButtonText: "取消",
type: 'warning' type: "warning",
}).then(() => { }).then(() => {
addUpdateProtection({ addUpdateProtection({
type: info.type, type: info.type,
...@@ -338,6 +376,7 @@ export default { ...@@ -338,6 +376,7 @@ export default {
detail: info.detail, detail: info.detail,
status: info.status, status: info.status,
isDel: 1, isDel: 1,
icon: info.icon,
color: info.color, color: info.color,
rank: info.rank, rank: info.rank,
id: info.id, id: info.id,
...@@ -347,43 +386,44 @@ export default { ...@@ -347,43 +386,44 @@ export default {
message: "删除成功!!!", message: "删除成功!!!",
type: "success", type: "success",
}); });
this.pullListProtections() this.pullListProtections();
}else{ } else {
this.$message.error('操作失败,请稍后重试!!!'); this.$message.error("操作失败,请稍后重试!!!");
} }
}); });
}) });
}, },
changeHandleSize(val) { changeHandleSize(val) {
// console.log(`每页 ${val} 条`); // console.log(`每页 ${val} 条`);
this.pagination.pageSize = val this.pagination.pageSize = val;
this.pullListApplicationType() this.pullListApplicationType();
}, },
changeHandleCurrent(val) { changeHandleCurrent(val) {
// console.log(`当前页: ${val}`); // console.log(`当前页: ${val}`);
this.pagination.currentPage = val this.pagination.currentPage = val;
this.pullListProtections() this.pullListProtections();
}, },
clickOperator(index) { clickOperator(index) {
console.log("index=>", index); console.log("index=>", index);
if (index == 1) { if (index == 1) {
this.currentTheme = "" this.currentTheme = "";
} }
this.screenListProtections() this.screenListProtections();
}, },
addProtect() { addProtect() {
this.managerTitle = "交易保障" this.managerTitle = "交易保障";
this.managerVisible = true; this.managerVisible = true;
}, },
editProtection(info){ editProtection(info) {
this.managerTitle = "修改交易保障" this.managerTitle = "修改交易保障";
let detail = JSON.parse(info.detail) let detail = JSON.parse(info.detail);
this.managerVisible = true; this.managerVisible = true;
this.form.rank = info.rank this.form.rank = info.rank;
this.form.title = info.title this.form.icon = info.icon;
this.form.detail = Array.isArray(detail) ? detail : [{content:""}] this.form.title = info.title;
this.form.color = !!info.color ? info.color : "" this.form.detail = Array.isArray(detail) ? detail : [{ content: "" }];
this.currentEidtInfo = info this.form.color = !!info.color ? info.color : "";
this.currentEidtInfo = info;
}, },
closeManager() { closeManager() {
this.managerVisible = false; this.managerVisible = false;
...@@ -396,8 +436,8 @@ export default { ...@@ -396,8 +436,8 @@ export default {
} else if (this.detailHasNull()) { } else if (this.detailHasNull()) {
this.$message.error("保障内容有缺值,请输入!!!"); this.$message.error("保障内容有缺值,请输入!!!");
} else { } else {
let data,message let data, message;
if(this.managerTitle=="交易保障"){ if (this.managerTitle == "交易保障") {
data = { data = {
rank: this.form.rank, rank: this.form.rank,
type: 1, // 类型,1、交易保障,暂时默认值为1 type: 1, // 类型,1、交易保障,暂时默认值为1
...@@ -405,9 +445,10 @@ export default { ...@@ -405,9 +445,10 @@ export default {
detail: JSON.stringify(this.form.detail), detail: JSON.stringify(this.form.detail),
status: 1, // 默认为启用 status: 1, // 默认为启用
color: this.form.color, color: this.form.color,
} icon: this.form.icon,
message = "添加成功!!!" };
}else{ message = "添加成功!!!";
} else {
data = { data = {
type: this.currentEidtInfo.type, type: this.currentEidtInfo.type,
title: this.form.title, title: this.form.title,
...@@ -417,8 +458,9 @@ export default { ...@@ -417,8 +458,9 @@ export default {
color: this.form.color, color: this.form.color,
rank: this.form.rank, rank: this.form.rank,
id: this.currentEidtInfo.id, id: this.currentEidtInfo.id,
} icon: this.form.icon,
message = "修改成功!!!" };
message = "修改成功!!!";
} }
addUpdateProtection(data).then((res) => { addUpdateProtection(data).then((res) => {
if (res.status == 200) { if (res.status == 200) {
...@@ -426,7 +468,7 @@ export default { ...@@ -426,7 +468,7 @@ export default {
message: message, message: message,
type: "success", type: "success",
}); });
this.pullListProtections() this.pullListProtections();
this.managerVisible = false; this.managerVisible = false;
} }
}); });
...@@ -441,23 +483,23 @@ export default { ...@@ -441,23 +483,23 @@ export default {
}); });
return bool; return bool;
}, },
transDetailToContent(detail){ transDetailToContent(detail) {
let contents = JSON.parse(detail) let contents = JSON.parse(detail);
let content = "" let content = "";
if(contents.constructor==Array){ if (contents.constructor == Array) {
if(contents.length>1){ if (contents.length > 1) {
contents.forEach((element,index) => { contents.forEach((element, index) => {
content += (index+1) + "." + element.content + "<br/>" content += index + 1 + "." + element.content + "<br/>";
}) });
}else{ } else {
contents.forEach((element,index) => { contents.forEach((element, index) => {
content += element.content content += element.content;
}) });
} }
}else{ } else {
content = detail content = detail;
} }
return content return content;
}, },
handleChangeColor(val) { handleChangeColor(val) {
console.log("输出颜色值", val); // 颜色 #6c8198 console.log("输出颜色值", val); // 颜色 #6c8198
...@@ -651,7 +693,7 @@ export default { ...@@ -651,7 +693,7 @@ export default {
} }
} }
} }
.pagination{ .pagination {
margin: 1% 1% 0 1%; margin: 1% 1% 0 1%;
width: 98%; width: 98%;
height: auto; height: auto;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment