feature_0521
郑皇 6 years ago
parent c1532fc48e
commit e37ee2f05c

@ -1,92 +1,90 @@
<template> <template>
<div> <div>
<Spin v-if="saving" <Spin v-if="saving" fix>加载中...</Spin>
fix>加载中...</Spin> <Form ref="formValidate" :model="formValidate" :label-width="80">
<Form ref="formValidate"
:model="formValidate"
:label-width="80">
<Row :gutter="10"> <Row :gutter="10">
<i-col span="4"> <i-col span="6">
<FormItem label="选择日期" <FormItem label="选择日期" prop>
prop=""> <Date-picker
<Date-picker v-model="formValidate.date" v-model="formValidate.date"
type="daterange" type="daterange"
placement="bottom-end" placement="bottom-end"
placeholder="选择日期区间"></Date-picker> placeholder="选择日期区间"
></Date-picker>
</FormItem> </FormItem>
</i-col> </i-col>
<i-col span="6"> <i-col span="6">
<FormItem label="零售公司" <FormItem label="零售公司" prop>
prop=""> <Select
<Select v-model="formValidate.organizationId" v-model="formValidate.organizationId"
filterable filterable
@on-change="selectCompany" @on-change="selectCompany"
placeholder="全部" placeholder="全部"
clearable> clearable
<Option v-for="(item, index) in companyList" >
:key="index" <Option
:value="item.value">{{ item.label }} v-for="(item, index) in companyList"
</Option> :key="index"
:value="item.value"
>{{ item.label }}</Option>
</Select> </Select>
</FormItem> </FormItem>
</i-col> </i-col>
<i-col span="6"> <i-col span="6">
<FormItem label="店铺" <FormItem label="店铺" prop>
prop=""> <Select v-model="formValidate.storeId" filterable placeholder="全部" clearable>
<Select v-model="formValidate.storeId" <Option
filterable v-for="(item, index) in shopList"
placeholder="全部" :key="index"
clearable> :value="item.value"
<Option v-for="(item, index) in shopList" >{{ item.label }}</Option>
:key="index"
:value="item.value">{{ item.label }}
</Option>
</Select> </Select>
</FormItem> </FormItem>
</i-col> </i-col>
<i-col span="4"> <i-col span="3">
<FormItem label="活动状态" <FormItem label="活动状态" prop>
prop="">
<Select v-model="formValidate.status"> <Select v-model="formValidate.status">
<Option v-for="(item, index) in activityStatusList" <Option
:key="index" v-for="(item, index) in activityStatusList"
:value="item.value">{{ item.label }} :key="index"
</Option> :value="item.value"
>{{ item.label }}</Option>
</Select> </Select>
</FormItem> </FormItem>
</i-col> </i-col>
<i-col span="4"> <i-col span="3">
<Button type="primary" <Button type="primary" @click="() => {pageNum = 1;searchTable()}">查询</Button>
@click="searchTable">查询</Button>
</i-col> </i-col>
</Row> </Row>
<Row style="margin-top:50px"> <Row style="margin-top:50px">
<Table :loading="loading" <Table
border :loading="loading"
@on-row-dblclick="showDetail" border
:columns="columns1" @on-row-dblclick="showDetail"
:data="data"></Table> :columns="columns1"
<Page :total="totalSize" :data="data"
:current="pageNum" ></Table>
:page-size="pageSize" <Page
show-elevator :total="totalSize"
show-total :current="pageNum"
placement="top" :page-size="pageSize"
@on-change="handlePage" show-elevator
class-name="ks-page"></Page> show-total
placement="top"
@on-change="handlePage"
class-name="ks-page"
></Page>
</Row> </Row>
</Form> </Form>
<useTable ref="useTable" <useTable
@doShow="doShow" ref="useTable"
:show="showUse" @doShow="doShow"
:isModify="true" :show="showUse"
:schedule="activityInstance.scheduleVO"></useTable> :isModify="true"
<Modal v-model="isShowDetail" :schedule="activityInstance.scheduleVO"
title="活动计划详情" ></useTable>
width="70%" <Modal v-model="isShowDetail" title="活动计划详情" width="70%" :footer-hide="true">
:footer-hide="true"> <planDetail v-if="isShowDetail" :detail="detail"></planDetail>
<planDetail v-if="isShowDetail"
:detail="detail"></planDetail>
</Modal> </Modal>
</div> </div>
</template> </template>
@ -103,9 +101,9 @@ export default {
inject: ["setMenuName"], inject: ["setMenuName"],
components: { components: {
useTable, useTable,
planDetail, planDetail
}, },
data () { data() {
const _this = this; const _this = this;
return { return {
loading: false, loading: false,
@ -125,139 +123,146 @@ export default {
date: null, date: null,
organizationId: null, organizationId: null,
storeId: null, storeId: null,
status: 2, status: 2
}, },
activityData: [ activityData: [
{ {
activityStatus: "进行中", activityStatus: "进行中"
}, },
{ {
activityStatus: "已结束", activityStatus: "已结束"
}, }
], ],
activityStatusList: [ activityStatusList: [
{ {
label: "全部", label: "全部",
value: 0, value: 0
}, },
{ {
label: "进行中", label: "进行中",
value: 2, value: 2
}, },
{ {
label: "未开始", label: "未开始",
value: 1, value: 1
}, },
{ {
label: "已结束", label: "已结束",
value: 3, value: 3
}, }
], ],
columns1: [ columns1: [
{ {
type: "index",
width: 60, width: 60,
align: "center", align: "center",
title: "序号", title: "序号",
render(h, params) {
let num = parseInt(params.index) + 1;
console.log(_this.pageSize);
if (_this.pageSize > 1) {
num += (_this.pageNum - 1) * _this.pageSize;
}
return h("span", num);
}
}, },
{ {
title: "活动名称", title: "活动名称",
key: "name", key: "name"
}, },
{ {
title: "活动类型", title: "活动类型",
key: "scheduleVO.name", key: "scheduleVO.name",
render (h, params) { render(h, params) {
return h("span", params.row["params"][0]["defaultVal"]); return h("span", params.row["params"][0]["name"]);
}, }
}, },
{ {
title: "活动时间", title: "活动时间",
key: "beginTime", key: "beginTime",
width: 230, width: 230,
render (h, params) { render(h, params) {
return h("span", params.row.beginTime + " - " + params.row.endTime); return h("span", params.row.beginTime + " - " + params.row.endTime);
}, }
}, },
{ {
title: "零售公司", title: "零售公司",
key: "shop", key: "shop",
render (h, params) { render(h, params) {
return h( return h(
"span", "span",
params.row.companyName + params.row.companyName +
"等" + "等" +
(params.row.companyCount || 0) + (params.row.companyCount || 0) +
"家公司" "家公司"
); );
}, }
}, },
{ {
title: "店铺", title: "店铺",
key: "shop", key: "shop",
render (h, params) { render(h, params) {
return h( return h(
"span", "span",
params.row.storeName + params.row.storeName +
"等" + "等" +
(params.row.storeCount || 0) + (params.row.storeCount || 0) +
"家店铺" "家店铺"
); );
}, }
}, },
{ {
title: "添加好友数", title: "添加好友数",
key: "addFriendNum", key: "addFriendNum",
render (h, params) { render(h, params) {
return h("span", (params.row.friends || 0) + "人"); return h("span", (params.row.friends || 0) + "人");
}, }
}, },
{ {
title: "参与活动客户数", title: "参与活动客户数",
key: "joinActivityClientNum", key: "joinActivityClientNum",
render (h, params) { render(h, params) {
return h("span", (params.row.friends || 0) + "人"); return h("span", (params.row.friends || 0) + "人");
}, }
}, },
{ {
title: "活动码", title: "活动码",
key: "activityCode", key: "activityCode",
render (h, p) { render(h, p) {
return h( return h(
"Button", "Button",
{ {
props: { type: "primary", size: "small" }, props: { type: "primary", size: "small" },
on: { click: () => _this.navigateCode(p.row) }, on: { click: () => _this.navigateCode(p.row) }
}, },
"查看详情" "查看详情"
); );
}, }
}, },
{ {
title: "活动状态", title: "活动状态",
key: "status", key: "status",
render (h, p) { render(h, p) {
const status = p.row.status; const status = p.row.status;
if (status === 1) return h("span", "未开始"); if (status === 1) return h("span", "未开始");
if (status === 2) return h("span", "进行中"); if (status === 2) return h("span", "进行中");
if (status === 3) return h("span", "已结束"); if (status === 3) return h("span", "已结束");
if (status === 4) return h("span", "取消"); if (status === 4) return h("span", "取消");
}, }
}, },
{ {
title: "操作", title: "操作",
key: "action", key: "action",
width: 200, width: 200,
render (h, p) { render(h, p) {
return h("div", [ let r = [
h( h(
"Button", "Button",
{ {
props: { type: "primary", size: "small" }, props: { type: "primary", size: "small" },
style: { marginRight: "8px" }, style: { marginRight: "8px" },
on: { on: {
click: () => _this.stop(p.row), click: () => _this.stop(p.row)
}, }
}, },
"终止" "终止"
), ),
@ -265,74 +270,79 @@ export default {
"Button", "Button",
{ {
props: { type: "primary", size: "small" }, props: { type: "primary", size: "small" },
on: { click: () => _this.modify(p.row) }, on: { click: () => _this.modify(p.row) }
}, },
"修改" "修改"
), )
]); ];
}, if (p.row.status > 2) {
}, delete r[0];
], }
return h("div", r);
}
}
]
}; };
}, },
mounted () { mounted() {
this.setMenuName("活动管理", "活动计划"); this.setMenuName("活动管理", "活动计划");
this.getCompanyInfo(); this.getCompanyInfo();
this.getShopInfo(); this.getShopInfo();
this.searchTable(); this.searchTable();
}, },
methods: { methods: {
doShow (show) { doShow(show) {
this.showUse = show; this.showUse = show;
this.searchTable(); this.searchTable();
}, },
showDetail (detail) { showDetail(detail) {
let _this = this; let _this = this;
this.getDetail(detail.id).then((res) => { this.getDetail(detail.id).then(res => {
_this.detail = res; _this.detail = res;
_this.isShowDetail = true; _this.isShowDetail = true;
}); });
}, },
getCompanyInfo () { getCompanyInfo() {
let that = this; let that = this;
let data = { let data = {
userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId, userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId
}; };
ActivityManager.getCompany(data, function (data) { ActivityManager.getCompany(data, function(data) {
that.companyList = []; that.companyList = [];
data.data.results.forEach((element) => { data.data.results.forEach(element => {
that.companyList.push({ that.companyList.push({
label: element.name, label: element.name,
value: element.id, value: element.id
}); });
}); });
}); });
}, },
selectCompany (value) { selectCompany(value) {
this.customerId = value; this.customerId = value;
this.getShopInfo(); this.getShopInfo();
}, },
getShopInfo () { getShopInfo() {
let that = this; let that = this;
let data = { let data = {
userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId, userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId,
customerIds: this.customerId, customerIds: this.customerId,
scheduleId: null
}; };
ActivityManager.getShop(data, function (data) { ActivityManager.getShop(data, function(data) {
that.shopList = []; that.shopList = [];
data.data.results.forEach((element) => { data.data.results.forEach(element => {
that.shopList.push({ that.shopList.push({
label: element.name, label: element.name,
value: element.id, value: element.id
}); });
}); });
}); });
}, },
handlePage: function (value) { handlePage: function(value) {
this.pageNum = value; this.pageNum = value;
this.searchTable(); this.searchTable();
}, },
stop (instance) { stop(instance) {
let _this = this; let _this = this;
this.$Modal.confirm({ this.$Modal.confirm({
title: "您确认要终止?", title: "您确认要终止?",
@ -341,7 +351,7 @@ export default {
this.saving = true; this.saving = true;
ActivityManager.instanceTerminate( ActivityManager.instanceTerminate(
{ instanceId: instance.id }, { instanceId: instance.id },
(res) => { res => {
_this.saving = false; _this.saving = false;
if (res.data.success == undefined || !res.data.success) { if (res.data.success == undefined || !res.data.success) {
_this.$Message.error("终止失败!"); _this.$Message.error("终止失败!");
@ -351,36 +361,36 @@ export default {
} }
); );
}, },
onCancel: () => { }, onCancel: () => {}
}); });
}, },
getDetail (instanceId) { getDetail(instanceId) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
ActivityManager.instanceDetail( ActivityManager.instanceDetail(
{ {
instanceId, instanceId
}, },
(res) => { res => {
resolve(res.data.results); resolve(res.data.results);
} }
); );
}); });
}, },
modify (instance) { modify(instance) {
let _this = this; let _this = this;
this.getDetail(instance.id).then((res) => { this.getDetail(instance.id).then(res => {
store.commit("SET_useData", res); store.commit("SET_useData", res);
_this.activityInstance = res; _this.activityInstance = res;
_this.showUse = true; _this.showUse = true;
}); });
}, },
navigateCode (instance) { navigateCode(instance) {
this.$router.push({ this.$router.push({
path: "/activity/plan/code", path: "/activity/plan/code",
query: { instanceId: instance.id }, query: { instanceId: instance.id }
}); });
}, },
searchTable (params = {}) { searchTable(params = {}) {
this.loading = true; this.loading = true;
if ( if (
this.formValidate.date !== null && this.formValidate.date !== null &&
@ -405,14 +415,14 @@ export default {
params.status = undefined; params.status = undefined;
} }
params.date = undefined; params.date = undefined;
http.get("/activity/instance/list", params).then((res) => { http.get("/activity/instance/list", params).then(res => {
const data = res.data.results.this || {}; const data = res.data.results.this || {};
this.data = data.list || []; this.data = data.list || [];
this.totalSize = data.total || 0; this.totalSize = data.total || 0;
this.loading = false; this.loading = false;
}); });
}, }
}, }
}; };
</script> </script>

Loading…
Cancel
Save