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

148 lines
3.7 KiB
Vue

5 years ago
<template>
<div>
<Row class="search-row">
5 years ago
<i-col span="24" 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"
style="margin-top: 20px;"
size="small"
>
5 years ago
<template slot-scope="{ row, index }" slot="action">
<Button type="primary" size="small" @click="handleEdit(row, index)">修改</Button>
<Button type="error" size="small" @click="handleDelete(row, index)">删除</Button>
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>
5 years ago
</div>
</template>
<script>
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
5 years ago
export default {
5 years ago
name: "IncreaseWelcomeList",
inject: ["setMenuName"],
data() {
let _this = this;
5 years ago
return {
5 years ago
loading: false,
5 years ago
// 分页
total: 0,
pageSize: 10,
5 years ago
data: [],
5 years ago
pageNum: 1,
columns1: [
5 years ago
{
width: 60,
5 years ago
align: "center",
title: "序号",
render(h, params) {
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",
render(h, params) {
return h("span", params.row.content);
}
5 years ago
},
{
5 years ago
title: "配置范围",
key: "shop",
render(h, params) {
5 years ago
if (params.row.storeName == null) {
return h("span", "店铺插入中...");
}
5 years ago
return h(
5 years ago
"span",
params.row.storeName +
"等" +
(params.row.storeCount || 0) +
"家公司"
);
}
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() {
this.setMenuName("门店推广", "欢迎语");
this.handlePaginate();
5 years ago
},
methods: {
// 分页刷新
5 years ago
handlePaginate() {
this.loading = true;
5 years ago
let params = {
pageNum: this.pageNum,
pageSize: this.pageSize,
5 years ago
userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId,
categoryCode: "welcome"
};
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) {
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(_this.handlePaginate);
5 years ago
},
5 years ago
onCancel: () => {}
5 years ago
});
5 years ago
}
}
};
5 years ago
</script>
5 years ago
<style scoped></style>