You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bsdgy-front/src/pages/shop/IncreaseWelcomeList.vue

225 lines
5.7 KiB
Vue

5 years ago
<template>
<div>
5 years ago
<Row :gutter="10"
class="search-row">
<i-col span="8">
<i-input placeholder="请输入店铺名称或编码"
v-model="store" />
</i-col>
<i-col span="3">
<Button type="primary"
@click="search"
class="search-btn">查询</Button></i-col>
<i-col span="13"
5 years ago
class="search-col">
5 years ago
<Row class="row-style">
5 years ago
<Button @click="handleEdit"
type="primary">配置欢迎语</Button>
5 years ago
</Row>
5 years ago
</i-col>
</Row>
5 years ago
<Table :columns="columns1"
:data="data"
:loading="loading"
@on-cell-click="clickCell"
style="margin-top: 20px;"
size="small">
<template slot-scope="{ row, index }"
slot="action">
5 years ago
<i-col span="12">
<Button ghost
class="router-btn"
@click="() => {handleEdit(row, index)}">修改</Button>
</i-col>
<i-col span="12">
<Button ghost
class="router-btn"
@click="() => {handleDelete(row, index)}">删除</Button>
</i-col>
5 years ago
</template>
</Table>
5 years ago
<Page :total="total"
:current="pageNum"
:page-size="pageSize"
show-elevator
show-total
placement="top"
@on-change="handlePage"
class="ks-page"></Page>
<Modal v-model="showDetail"
title="配置范围"
width="70%"
:footer-hide="true">
<welcomeDetail v-if="showDetail"
:detail="detail"></welcomeDetail>
</Modal>
5 years ago
</div>
</template>
<script>
5 years ago
import ActivityManager from "../../services/ActivityManager/ActivityManager";
5 years ago
import data from "../../utils/PhoneRegionData";
import http from "../../services/store/IncreaseStoreManager";
5 years ago
5 years ago
import staff from "../../services/staff/staff";
5 years ago
import welcomeDetail from "./WelcomeDetail";
5 years ago
5 years ago
export default {
5 years ago
name: "IncreaseWelcomeList",
inject: ["setMenuName"],
5 years ago
components: { welcomeDetail },
data () {
5 years ago
let _this = this;
5 years ago
return {
5 years ago
loading: false,
5 years ago
store: null,
5 years ago
// 分页
total: 0,
pageSize: 10,
5 years ago
showDetail: false,
5 years ago
data: [],
5 years ago
pageNum: 1,
5 years ago
detail: {},
5 years ago
columns1: [
5 years ago
{
width: 60,
5 years ago
align: "center",
title: "序号",
5 years ago
render (h, params) {
5 years ago
console.log(params);
let num = parseInt(params.index) + 1;
console.log(_this.pageSize);
5 years ago
if (_this.pageSize > 1) {
5 years ago
num += (_this.pageNum - 1) * _this.pageSize;
5 years ago
}
5 years ago
return h("span", num);
}
5 years ago
},
{
5 years ago
title: "欢迎语",
key: "scheduleVO.description",
5 years ago
render (h, params) {
5 years ago
return h("span", params.row.content);
}
5 years ago
},
{
5 years ago
title: "配置范围",
key: "shop",
5 years ago
render (h, params) {
5 years ago
return h(
5 years ago
"span",
5 years ago
(params.row.companyCount || 0) +
5 years ago
"家零售公司, " +
(params.row.storeCount || 0) +
"家店铺"
5 years ago
);
}
5 years ago
},
5 years ago
{ title: "配置时间", key: "createTime" },
{ title: "修改时间", key: "updateTime" },
{ title: "操作", slot: "action" }
5 years ago
],
5 years ago
formValidate: {}
};
5 years ago
},
5 years ago
mounted () {
5 years ago
this.setMenuName("门店推广", "欢迎语");
this.handlePaginate();
5 years ago
},
methods: {
5 years ago
clickCell (row, column, data, event) {
if (column.key === "shop") {
let _this = this;
this.getDetail(row.id).then(res => {
_this.detail = res;
_this.showDetail = true;
});
}
},
getDetail (instanceId) {
return new Promise((resolve, reject) => {
ActivityManager.instanceDetail(
{
instanceId
},
res => {
resolve(res.data.results);
}
);
});
},
5 years ago
search () {
this.pageNum = 1;
this.handlePaginate();
},
5 years ago
// 分页刷新
5 years ago
handlePaginate () {
5 years ago
this.loading = true;
5 years ago
let params = {
pageNum: this.pageNum,
pageSize: this.pageSize,
5 years ago
userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId,
5 years ago
categoryCode: "welcome",
store: this.store
5 years ago
};
http.getWelcomeList(params, res => {
const data = res.data.results.this || {};
this.data = data.list || [];
5 years ago
this.total = data.total || 0;
5 years ago
this.loading = false;
});
5 years ago
},
5 years ago
//切页处理
5 years ago
handlePage: function (value) {
5 years ago
this.pageNum = value;
5 years ago
this.handlePaginate();
5 years ago
},
5 years ago
// 新增或修改
5 years ago
handleEdit (row) {
5 years ago
this.$router.push({
5 years ago
path: "/shop/increase/welcome/edit",
query: { id: row.id }
});
5 years ago
},
// 删除
5 years ago
handleDelete (row) {
5 years ago
let _this = this;
this.$Modal.confirm({
5 years ago
title: "删除欢迎语",
content: "您确定要删除该欢迎语?",
5 years ago
onOk: () => {
5 years ago
http.deleteWelcome({ id: row.scheduleId }).then(res => {
5 years ago
if (_this.data.length <= 1) {
if (_this.pageNum > 1) {
_this.pageNum = _this.pageNum - 1;
} else {
_this.pageNum = 1;
}
}
5 years ago
_this.handlePaginate()
});
5 years ago
},
5 years ago
onCancel: () => { }
5 years ago
});
5 years ago
}
}
};
5 years ago
</script>
5 years ago
<style scoped>
.router-btn {
border: none;
color: #3496eb !important;
margin-left: -15px;
}
.table-img-qr-code {
margin-left: 5px;
margin-top: 5px;
width: 30px;
height: 30px;
}
button:hover {
/*background: inherit !important;*/
5 years ago
}
</style>