feature_0521
郑皇 6 years ago
parent ba02ce7252
commit c432ef5d34

@ -1,25 +1,24 @@
<template>
<div class="activity_code">
<Table :loading="loading"
border
:columns="columns"
:data="data"></Table>
<Page :total="totalSize"
<Table :loading="loading" border :columns="columns" :data="data"></Table>
<Page
:total="totalSize"
:current="pageNum"
:page-size="pageSize"
show-elevator
show-total
placement="top"
@on-change="handlePage"
class-name="ks-page"></Page>
class-name="ks-page"
></Page>
</div>
</template>
<script>
import { activityCodeList } from '../../services/ActivityManager/ActivityManager';
import { activityCodeList } from "../../services/ActivityManager/ActivityManager";
export default {
name: "ActivityCode",
data () {
data() {
let _this = this;
return {
loading: false,
@ -38,43 +37,49 @@ export default {
{
title: "所属零售公司",
key: "organizational.name",
render (h, params) {
render(h, params) {
return h("span", params.row["organizational"]["name"]);
},
},
{
title: "零售公司编号",
key: "organizational.code",
render (h, params) {
render(h, params) {
return h("span", params.row["organizational"]["code"]);
},
},
{
title: "店铺名称",
key: "store.name",
render (h, params) {
render(h, params) {
return h("span", params.row["store"]["name"]);
},
},
{
title: "店铺编号",
key: "store.code",
render (h, params) {
render(h, params) {
return h("span", params.row["store"]["code"]);
},
},
{
title: "推广码",
key: "qrCode",
render (h, params) {
return h("div", {
class: "qrcode" }, [
render(h, params) {
return h(
"div",
{
class: "qrcode",
},
[
h(
"Button",
{
props: { type: "primary", size: "small" },
style: { marginRight: "8px" },
on: { "mouseover.native": () => _this.showQrcode(params.row) }
on: {
"mouseover.native": () => _this.showQrcode(params.row),
},
},
"二维码"
),
@ -82,21 +87,19 @@ export default {
"div",
{
class: "qrcodeBox",
style: { display: "none" }
}, [
h(
"img",
{ attrs: { src: params.row.qrCode } }
)]
)
]);
style: { display: "none" },
},
[h("img", { attrs: { src: params.row.qrCode } })]
),
]
);
},
},
{
title: "操作",
key: "action",
width: 200,
render (h, p) {
render(h, p) {
return h("div", [
h(
"Button",
@ -108,40 +111,39 @@ export default {
},
},
"查看导购码"
)
),
]);
},
},
]
],
};
},
created () {
created() {
this.instanceId = this.$route.query.instanceId;
this.load();
},
methods: {
handlePage (value) {
handlePage(value) {
this.pageNum = value;
this.load();
},
showQrcode (row) {
console.log(row)
showQrcode(row) {
console.log(row);
},
load (params = {}) {
load(params = {}) {
let _this = this;
this.loading = true;
params.pageSize = this.pageSize;
params.pageNum = this.pageNum;
params.instanceId = this.instanceId;
activityCodeList(params, res => {
_this.data = res.data.results.this.records
_this.totalSize = res.data.results.this.total
activityCodeList(params, (res) => {
_this.data = res.data.results.this.records;
_this.totalSize = res.data.results.this.total;
_this.loading = false;
})
}
}
});
},
},
};
</script>
<style>
</style>
<style></style>

@ -1,92 +1,103 @@
<template>
<div>
<Spin v-if="saving"
fix>加载中...</Spin>
<Form ref="formValidate"
:model="formValidate"
:label-width="80">
<Spin v-if="saving" fix>加载中...</Spin>
<Form ref="formValidate" :model="formValidate" :label-width="80">
<Row :gutter="10">
<i-col span="4">
<FormItem label="选择日期"
prop="">
<Date-picker v-model="formValidate.date"
<FormItem label="选择日期" prop="">
<Date-picker
v-model="formValidate.date"
type="daterange"
placement="bottom-end"
placeholder="选择日期区间"></Date-picker>
placeholder="选择日期区间"
></Date-picker>
</FormItem>
</i-col>
<i-col span="6">
<FormItem label="零售公司"
prop="">
<Select v-model="formValidate.organizationId"
<FormItem label="零售公司" prop="">
<Select
v-model="formValidate.organizationId"
filterable
@on-change="selectCompany"
placeholder="全部"
clearable>
<Option v-for="(item, index) in companyList"
clearable
>
<Option
v-for="(item, index) in companyList"
:key="index"
:value="item.value">{{ item.label }}
:value="item.value"
>{{ item.label }}
</Option>
</Select>
</FormItem>
</i-col>
<i-col span="6">
<FormItem label="店铺"
prop="">
<Select v-model="formValidate.storeId"
<FormItem label="店铺" prop="">
<Select
v-model="formValidate.storeId"
filterable
placeholder="全部"
clearable>
<Option v-for="(item, index) in shopList"
clearable
>
<Option
v-for="(item, index) in shopList"
:key="index"
:value="item.value">{{ item.label }}
:value="item.value"
>{{ item.label }}
</Option>
</Select>
</FormItem>
</i-col>
<i-col span="4">
<FormItem label="活动状态"
prop="">
<FormItem label="活动状态" prop="">
<Select v-model="formValidate.status">
<Option v-for="(item, index) in activityStatusList"
<Option
v-for="(item, index) in activityStatusList"
:key="index"
:value="item.value">{{ item.label }}
:value="item.value"
>{{ item.label }}
</Option>
</Select>
</FormItem>
</i-col>
<i-col span="4">
<Button type="primary"
@click="searchTable">查询</Button>
<Button type="primary" @click="searchTable"></Button>
</i-col>
</Row>
<Row style="margin-top:50px">
<Table :loading="loading"
<Table
:loading="loading"
border
@on-row-dblclick="showDetail"
:columns="columns1"
:data="data"></Table>
<Page :total="totalSize"
:data="data"
></Table>
<Page
:total="totalSize"
:current="pageNum"
:page-size="pageSize"
show-elevator
show-total
placement="top"
@on-change="handlePage"
class-name="ks-page"></Page>
class-name="ks-page"
></Page>
</Row>
</Form>
<useTable ref="useTable"
<useTable
ref="useTable"
@doShow="doShow"
:show="showUse"
:isModify="true"
:schedule="activityInstance.scheduleVO"></useTable>
<Modal v-model="isShowDetail"
:schedule="activityInstance.scheduleVO"
></useTable>
<Modal
v-model="isShowDetail"
title="活动计划详情"
width="70%"
:footer-hide="true">
<planDetail v-if="isShowDetail"
:detail="detail"></planDetail>
:footer-hide="true"
>
<planDetail v-if="isShowDetail" :detail="detail"></planDetail>
</Modal>
</div>
</template>
@ -97,14 +108,15 @@ import useTable from "./useTable";
import http from "../../services/CommonHttp";
import { formatDate } from "../../utils/Common";
import store from "../../store";
import planDetail from './PlanDetail';
import planDetail from "./PlanDetail";
export default {
name: "ActivityPlan",
inject: ["setMenuName"],
components: {
useTable, planDetail
useTable,
planDetail,
},
data () {
data() {
const _this = this;
return {
loading: false,
@ -150,13 +162,14 @@ export default {
{
label: "已结束",
value: 3,
}
},
],
columns1: [
{
type: "index",
width: 60,
align: "center",
title: "序号",
},
{
title: "活动名称",
@ -165,7 +178,7 @@ export default {
{
title: "活动类型",
key: "scheduleVO.name",
render (h, params) {
render(h, params) {
return h("span", params.row["params"][0]["defaultVal"]);
},
},
@ -173,42 +186,54 @@ export default {
title: "活动时间",
key: "beginTime",
width: 230,
render (h, params) {
return h("span", (params.row.beginTime) + " - " + (params.row.endTime));
render(h, params) {
return h("span", params.row.beginTime + " - " + params.row.endTime);
},
},
{
title: "零售公司",
key: "shop",
render (h, params) {
return h("span", (params.row.companyName) + "等" + (params.row.companyCount || 0) + "家公司");
render(h, params) {
return h(
"span",
params.row.companyName +
"等" +
(params.row.companyCount || 0) +
"家公司"
);
},
},
{
title: "店铺",
key: "shop",
render (h, params) {
return h("span", (params.row.storeName) + "等" + (params.row.storeCount || 0) + "家店铺");
render(h, params) {
return h(
"span",
params.row.storeName +
"等" +
(params.row.storeCount || 0) +
"家店铺"
);
},
},
{
title: "添加好友数",
key: "addFriendNum",
render (h, params) {
render(h, params) {
return h("span", (params.row.friends || 0) + "人");
},
},
{
title: "参与活动客户数",
key: "joinActivityClientNum",
render (h, params) {
render(h, params) {
return h("span", (params.row.friends || 0) + "人");
},
},
{
title: "活动码",
key: "activityCode",
render (h, p) {
render(h, p) {
return h(
"Button",
{
@ -222,7 +247,7 @@ export default {
{
title: "活动状态",
key: "status",
render (h, p) {
render(h, p) {
const status = p.row.status;
if (status === 1) return h("span", "未开始");
if (status === 2) return h("span", "进行中");
@ -234,7 +259,7 @@ export default {
title: "操作",
key: "action",
width: 200,
render (h, p) {
render(h, p) {
return h("div", [
h(
"Button",
@ -261,29 +286,29 @@ export default {
],
};
},
mounted () {
mounted() {
this.setMenuName("活动管理", "活动计划");
this.getCompanyInfo();
this.getShopInfo();
this.searchTable();
},
methods: {
doShow (show) {
doShow(show) {
this.showUse = show;
},
showDetail (detail) {
showDetail(detail) {
let _this = this;
this.getDetail(detail.id).then(res => {
this.getDetail(detail.id).then((res) => {
_this.detail = res;
_this.isShowDetail = true;
})
});
},
getCompanyInfo () {
getCompanyInfo() {
let that = this;
let data = {
userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId,
};
ActivityManager.getCompany(data, function (data) {
ActivityManager.getCompany(data, function(data) {
that.companyList = [];
data.data.results.forEach((element) => {
that.companyList.push({
@ -293,17 +318,17 @@ export default {
});
});
},
selectCompany (value) {
selectCompany(value) {
this.customerId = value;
this.getShopInfo();
},
getShopInfo () {
getShopInfo() {
let that = this;
let data = {
userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId,
customerIds: this.customerId
customerIds: this.customerId,
};
ActivityManager.getShop(data, function (data) {
ActivityManager.getShop(data, function(data) {
that.shopList = [];
data.data.results.forEach((element) => {
that.shopList.push({
@ -313,55 +338,59 @@ export default {
});
});
},
handlePage: function (value) {
handlePage: function(value) {
this.pageNum = value;
this.searchTable();
},
stop (instance) {
stop(instance) {
let _this = this;
this.$Modal.confirm({
title: '您确认要终止?',
content: '终止之后不可恢复',
title: "您确认要终止?",
content: "终止之后不可恢复",
onOk: () => {
this.saving = true;
ActivityManager.instanceTerminate({ instanceId: instance.id }, (res) => {
ActivityManager.instanceTerminate(
{ instanceId: instance.id },
(res) => {
_this.saving = false;
if (res.data.success == undefined || !res.data.success) {
_this.$Message.error("终止失败!");
} else {
_this.searchTable();
}
});
},
onCancel: () => {
}
);
},
onCancel: () => {},
});
},
getDetail (instanceId) {
getDetail(instanceId) {
return new Promise((resolve, reject) => {
ActivityManager.instanceDetail({
instanceId
}, res => {
resolve(res.data.results)
ActivityManager.instanceDetail(
{
instanceId,
},
(res) => {
resolve(res.data.results);
}
);
});
})
},
modify (instance) {
modify(instance) {
let _this = this;
this.getDetail(instance.id).then(res => {
this.getDetail(instance.id).then((res) => {
store.commit("SET_useData", res);
_this.activityInstance = res;
_this.showUse = true;
})
});
},
navigateCode (instance) {
navigateCode(instance) {
this.$router.push({
path: "/activity/plan/code",
query: { instanceId: instance.id },
});
},
searchTable (params = {}) {
searchTable(params = {}) {
this.loading = true;
if (
this.formValidate.date !== null &&
@ -398,6 +427,6 @@ export default {
<style>
.ivu-date-picker .ivu-select-dropdown {
left: 0 !important
left: 0 !important;
}
</style>

@ -1,25 +1,27 @@
<template>
<Modal v-model="dispalyModal"
<Modal
v-model="dispalyModal"
width="1000"
:loading="loading"
:mask-closable="false"
@on-cancel="cancel"
@on-ok="save">
<p slot="header"
style="color:#f60;text-align:left">
@on-ok="save"
>
<p slot="header" style="color:#f60;text-align:left">
<span>配置活动</span>
</p>
<div>基本配置</div>
<Form ref="formValidate"
<Form
ref="formValidate"
:model="formValidate"
:rules="ruleValidate"
:label-width="80">
:label-width="80"
>
<Row>
<i-col style="text-align: left;"
span="8">
<FormItem label=""
prop="logo">
<Upload ref="upload"
<i-col style="text-align: left;" span="8">
<FormItem label="" prop="logo">
<Upload
ref="upload"
:show-upload-list="false"
:on-success="uploadImgSuccess"
:format="['jpg', 'jpeg', 'png']"
@ -28,75 +30,90 @@
multiple
type="drag"
action=""
style="display: inline-block;">
style="display: inline-block;"
>
<div style="width: 200px;height:200px;line-height: 200px;">
<span v-if="!formValidate.logo"></span>
<img v-if="formValidate.logo"
<img
v-if="formValidate.logo"
:src="`/kiisoo-ic` + formValidate.logo"
alt=""
style="width: 100%; height: auto" />
style="width: 100%; height: auto"
/>
</div>
</Upload>
</FormItem>
</i-col>
<i-col span="15"
offset="1">
<FormItem label="活动名称"
prop="name">
<i-input type="text"
<i-col span="15" offset="1">
<FormItem label="活动名称" prop="name">
<i-input
type="text"
v-model="formValidate.name"
placeholder="请输入活动名称"></i-input>
placeholder="请输入活动名称"
></i-input>
</FormItem>
<Form-item label="活动描述"
prop="description">
<i-input v-model="formValidate.description"
<Form-item label="活动描述" prop="description">
<i-input
v-model="formValidate.description"
type="textarea"
:autosize="{ minRows: 3 }"
placeholder="请输入活动描述"></i-input>
placeholder="请输入活动描述"
></i-input>
</Form-item>
<FormItem label="APPID"
prop="appId">
<i-input type="text"
<FormItem label="APPID" prop="appId">
<i-input
type="text"
v-model="formValidate.appId"
placeholder="请输入appid"></i-input>
placeholder="请输入appid"
></i-input>
</FormItem>
<FormItem label="URI"
prop="uri">
<i-input type="text"
<FormItem label="URI" prop="uri">
<i-input
type="text"
v-model="formValidate.uri"
placeholder="请输入URI"></i-input>
placeholder="请输入URI"
></i-input>
</FormItem>
</i-col>
</Row>
</Form>
<div class="topic">活动类型</div>
<Row :gutter="10"
<Row
:gutter="10"
class="inputItem"
v-for="(item, index) in formValidate.params"
:key="index">
:key="index"
>
<i-col :span="2"> 类型{{ index + 1 }} </i-col>
<i-col :span="9">
<i-input class="inputClass"
<i-input
class="inputClass"
type="text"
v-model="item.name"
placeholder="请输入活动类型名称"></i-input>
placeholder="请输入活动类型名称"
></i-input>
</i-col>
<i-col :span="9">
<i-input class="inputClass"
<i-input
class="inputClass"
type="text"
style="margin-left: 20px"
v-model="item.defaultVal"
placeholder="请输入参数"></i-input>
placeholder="请输入参数"
></i-input>
</i-col>
<i-col :span="4">
<Button style="margin-left: 20px"
<Button
style="margin-left: 20px"
type="error"
@click="delActivityInput(index)">删除</Button>
@click="delActivityInput(index)"
>删除</Button
>
</i-col>
</Row>
<Button style="margin-top: 10px"
type="primary"
@click="addActivityInput">+添加活动类型</Button>
<Button style="margin-top: 10px" type="primary" @click="addActivityInput"
>+添加活动类型</Button
>
</Modal>
</template>
<script>
@ -104,7 +121,7 @@ import ActivityManager from "../../services/ActivityManager/ActivityManager";
import axios from "axios";
export default {
name: "addActivity",
data () {
data() {
return {
dispalyModal: false,
currentStep: 0,
@ -132,7 +149,7 @@ export default {
id: String,
},
watch: {
addActivityModal (val) {
addActivityModal(val) {
console.log(111, val);
this.dispalyModal = val;
if (val === true && this.id) {
@ -161,9 +178,9 @@ export default {
}
},
},
mounted () { },
mounted() {},
methods: {
addActivityInput () {
addActivityInput() {
let params = [...this.formValidate.params];
params.push({
defaultVal: "",
@ -179,7 +196,7 @@ export default {
this.$set(this.formValidate, "params", params);
this.$forceUpdate();
},
delActivityInput (index) {
delActivityInput(index) {
if (this.formValidate.params.length <= 1) {
this.$Message.error("至少需要填写一个活动类型!");
return;
@ -187,22 +204,22 @@ export default {
this.formValidate.params.splice(index, 1);
this.$forceUpdate();
},
cancel () {
cancel() {
this.$emit("dispalyAddActivityModal", false, false);
},
getActivityData () {
getActivityData() {
let that = this;
let data = {
id: that.id,
};
ActivityManager.getActivityInfo(data, function (data) {
ActivityManager.getActivityInfo(data, function(data) {
that.formValidate = data.data.results;
});
},
uploadImgSuccess (res, file) {
uploadImgSuccess(res, file) {
this.imageName = file.name;
},
handleBeforeUpload (res) {
handleBeforeUpload(res) {
const me = this;
let data = new FormData();
data.append("file", res);
@ -213,7 +230,7 @@ export default {
headers: {
"Content-Type": "multipart/form-data",
},
}).then(function (res) {
}).then(function(res) {
if (res.data.success) {
// me.formValidate.logo = res.data.results;
me.$set(me.formValidate, "logo", res.data.results);
@ -222,14 +239,23 @@ export default {
});
return false;
},
save () {
save() {
let that = this;
let i = 0;
if (
typeof that.formValidate.logo == "undefined" ||
that.formValidate.logo == "" ||
that.formValidate.logo.length <= 0
) {
that.$Message.error("请上传活动封面!");
that.loading = false;
return false;
}
if (that.formValidate.params.length <= 0) {
that.$Message.error("至少需要填写一个活动类型!");
that.loading = false;
return false;
}
let i = 0;
for (const key in that.formValidate.params) {
i++;
if (that.formValidate.params.hasOwnProperty(key)) {
@ -246,21 +272,12 @@ export default {
}
}
}
if (
typeof that.formValidate.logo == "undefined" ||
that.formValidate.logo == "" ||
that.formValidate.logo.length <= 0
) {
that.$Message.error("请上传活动封面!");
that.loading = false;
return false;
}
this.loading = true;
this.$refs["formValidate"].validate((valid) => {
if (valid) {
// param = JSON.stringify(param)
let data = { ...that.formValidate, isGetActivityInfo: true };
ActivityManager.addOreditActivity(data, function (data) {
ActivityManager.addOreditActivity(data, function(data) {
that.addActivityModal = false;
that.formValidate = {};
that.$emit("dispalyAddActivityModal", false, true);

Loading…
Cancel
Save