Merge remote-tracking branch 'git/feature_0521' into feature_05212

feature_0521
root 6 years ago
commit 7a312a2ac2

@ -1,19 +1,20 @@
<template> <template>
<div class="activityManager"> <div class="activityManager">
<Spin v-show="loading" <Spin v-show="loading" fix>加载中...</Spin>
fix>加载中...</Spin>
<Row> <Row>
<i-col class="activityListClass" <i-col
class="activityListClass"
v-for="(item, index) in activityList" v-for="(item, index) in activityList"
:key="index" :key="index"
span="7" span="7"
offset="1"> offset="1"
>
<Card> <Card>
<div class="operateAndThemeItem"> <div class="operateAndThemeItem">
<div class="ThemeItem"> <div class="ThemeItem">
<div class="schedule-image"><img class="img" <div class="schedule-image">
:src="'/kiisoo-ic' + item.logo" <img class="img" :src="'/kiisoo-ic' + item.logo" alt />
alt /></div> </div>
<div class="tipItem"> <div class="tipItem">
<span>{{ item.name }}</span> <span>{{ item.name }}</span>
<span>{{ item.description }}</span> <span>{{ item.description }}</span>
@ -21,30 +22,26 @@
</div> </div>
<div class="operateItem"> <div class="operateItem">
<div @click="disPlayUseTable(item)">使</div> <div @click="disPlayUseTable(item)">使</div>
<div v-show="roleCode === 'GLY-ADMIN'" <div v-show="roleCode === 'GLY-ADMIN'" @click="dispalyAddActivity(item.id)"></div>
@click="dispalyAddActivity(item.id)">配置</div>
</div> </div>
</div> </div>
</Card> </Card>
</i-col> </i-col>
</Row> </Row>
<Row v-show="roleCode === 'GLY-ADMIN'"> <Row v-show="roleCode === 'GLY-ADMIN'">
<i-col span="7" <i-col span="7" offset="1">
offset="1"> <div @click="dispalyAddActivity('')" class="addactivity">
<div @click="dispalyAddActivity('')"
class="addactivity">
<span>+</span> <span>+</span>
<span>添加活动</span> <span>添加活动</span>
</div> </div>
</i-col> </i-col>
</Row> </Row>
<useTable ref="useTable" <useTable ref="useTable" @doShow="doShow" :show="showUse" :schedule="useSchedule"></useTable>
@doShow="doShow" <addActivity
:show="showUse" @dispalyAddActivityModal="dispalyAddActivityModal"
:schedule="useSchedule"></useTable>
<addActivity @dispalyAddActivityModal="dispalyAddActivityModal"
:addActivityModal="addActivityModal" :addActivityModal="addActivityModal"
:id="id"></addActivity> :id="id"
></addActivity>
</div> </div>
</template> </template>
@ -52,13 +49,13 @@
import useTable from "./useTable"; import useTable from "./useTable";
import addActivity from "./addActivity"; import addActivity from "./addActivity";
import ActivityManager from "../../services/ActivityManager/ActivityManager"; import ActivityManager from "../../services/ActivityManager/ActivityManager";
import store from '../../store'; import store from "../../store";
export default { export default {
name: "ActivityManager", name: "ActivityManager",
components: { components: {
useTable, useTable,
addActivity, addActivity
}, },
inject: ["setMenuName"], inject: ["setMenuName"],
data() { data() {
@ -74,7 +71,7 @@ export default {
}; };
}, },
created() { created() {
store.commit("RSET_useData") store.commit("RSET_useData");
}, },
mounted() { mounted() {
this.setMenuName("活动管理", "活动池"); this.setMenuName("活动管理", "活动池");
@ -88,15 +85,15 @@ export default {
getActivityData(id) { getActivityData(id) {
let that = this; let that = this;
let data = { let data = {
instanceId: id, instanceId: id
}; };
that.loading = true; that.loading = true;
ActivityManager.getActivityInfo(data, function(data) { ActivityManager.getActivityInfo(data, function(data) {
that.inputActivityList = []; that.inputActivityList = [];
data.data.results.params.forEach((item) => { data.data.results.params.forEach(item => {
that.inputActivityList.push({ that.inputActivityList.push({
value1: item.name, value1: item.name,
value2: item.description, value2: item.description
}); });
}); });
this.useModal = true; this.useModal = true;
@ -105,21 +102,24 @@ export default {
}, },
getActivityTable() { getActivityTable() {
let that = this; let that = this;
ActivityManager.getActivityList({ categoryCode: "promotion" }, function (data) { ActivityManager.getActivityList({ categoryCode: "promotion" }, function(
data
) {
that.activityList = data.data.results; that.activityList = data.data.results;
}); });
}, },
disPlayUseTable(item) { disPlayUseTable(item) {
console.log("disPlayUseTable");
let that = this; let that = this;
let data = { let data = {
id: item.id, id: item.id
}; };
// let data = new FormData() // let data = new FormData()
// data.append('instanceId', item.id) // data.append('instanceId', item.id)
ActivityManager.getActivityInfo(data, function(data) { ActivityManager.getActivityInfo(data, function(data) {
that.useSchedule = data.data.results; that.useSchedule = data.data.results;
that.showUse = true; that.showUse = true;
that.$forceUpdate() that.$forceUpdate();
}); });
}, },
dispalyAddActivity(id) { dispalyAddActivity(id) {
@ -137,8 +137,8 @@ export default {
if (isCancle === true) { if (isCancle === true) {
this.getActivityTable(); this.getActivityTable();
} }
}, }
}, }
}; };
</script> </script>

@ -1,129 +1,128 @@
<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="6"> <i-col span="6">
<FormItem label="选择日期" <FormItem label="选择日期" prop>
prop=""> <Date-picker
<Date-picker style="width: 100%" style="width: 100%"
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" >
<Option
v-for="(item, index) in companyList"
:key="index" :key="index"
:value="item.value">{{ item.label }}</Option> :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="全部"
clearable>
<Option v-for="(item, index) in shopList"
:key="index" :key="index"
:value="item.value">{{ item.label }}</Option> :value="item.value"
>{{ item.label }}</Option>
</Select> </Select>
</FormItem> </FormItem>
</i-col> </i-col>
<i-col span="3"> <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
v-for="(item, index) in activityStatusList"
:key="index" :key="index"
:value="item.value">{{ item.label }}</Option> :value="item.value"
>{{ item.label }}</Option>
</Select> </Select>
</FormItem> </FormItem>
</i-col> </i-col>
<i-col span="3"> <i-col span="3">
<Button type="primary" <Button type="primary" @click="() => {pageNum = 1;searchTable()}">查询</Button>
@click="() => {pageNum = 1;searchTable()}">查询</Button>
</i-col> </i-col>
</Row> </Row>
<Row style="margin-top:50px"> <Row style="margin-top:50px">
<Table :loading="loading" <Table
:loading="loading"
border border
@on-row-dblclick="showDetail" @on-row-dblclick="showDetail"
:columns="columns1" :columns="columns1"
:data="data"> :data="data"
<template slot-scope="{row}" >
slot="qrCodeAction"> <template slot-scope="{row}" slot="qrCodeAction">
<img :src="require('../../../static/img/qrCode-init.png')" <img
:src="require('../../../static/img/qrCode-init.png')"
@click="navigateCode(row)" @click="navigateCode(row)"
class="table-img-qr-code" /> class="table-img-qr-code"
/>
</template> </template>
<template slot="action" <template slot="action" slot-scope="{row}">
slot-scope="{row}">
<i-col span="12"> <i-col span="12">
<Button ghost <Button
class="router-btn" ghost
@click="() => {stop(row)}">终止</Button> :class="row.status > 2 ? 'router-btn disable' : 'router-btn'"
@click="() => {stop(row)}"
>终止</Button>
</i-col> </i-col>
<i-col span="12"> <i-col span="12">
<Button ghost <Button ghost class="router-btn" @click="() => {modify(row)}">修改</Button>
class="router-btn"
@click="() => {modify(row)}">修改</Button>
</i-col> </i-col>
</template> </template>
</Table> </Table>
<Page :total="totalSize" <Page
:total="totalSize"
:current="pageNum" :current="pageNum"
:page-size="pageSize" :page-size="pageSize"
show-elevator show-elevator
show-total show-total
placement="top" placement="top"
@on-change="handlePage" @on-change="handlePage"
class-name="ks-page"></Page> class-name="ks-page"
></Page>
</Row> </Row>
</Form> </Form>
<useTable ref="useTable" <useTable
ref="useTable"
@doShow="doShow" @doShow="doShow"
:show="showUse" :show="showUse"
:isModify="true" :isModify="true"
:schedule="activityInstance.scheduleVO"></useTable> :schedule="activityInstance.scheduleVO"
<Modal v-model="isShowDetail" ></useTable>
title="活动计划详情" <Modal v-model="isShowDetail" title="活动计划详情" width="70%" :footer-hide="true">
width="70%" <planDetail v-if="isShowDetail" :detail="detail"></planDetail>
:footer-hide="true">
<planDetail v-if="isShowDetail"
:detail="detail"></planDetail>
</Modal> </Modal>
<!-- 预览二维码 --> <!-- 预览二维码 -->
<Modal v-model="isShow" <Modal
v-model="isShow"
:title="showStoreName" :title="showStoreName"
:footer-hide="true" :footer-hide="true"
width="230" width="230"
class-name="vertical-center-modal" class-name="vertical-center-modal"
@on-ok="ok"> @on-ok="ok"
>
<div slot="header"> <div slot="header">
<p></p> <p></p>
</div> </div>
<p>{{this.showStoreName}}</p> <p>{{this.showStoreName}}</p>
<img :src="qrCodeImage" <img :src="qrCodeImage" style="width:200px;height:200px;" />
style="width:200px;height:200px;" />
<div style="text-align: center;"> <div style="text-align: center;">
<Button ghost <Button ghost type="primary" @click="download(rowData)"></Button>
type="primary"
@click="download(rowData)">下载</Button>
</div> </div>
</Modal> </Modal>
</div> </div>
@ -162,14 +161,14 @@ export default {
shopList: [], shopList: [],
showUse: false, showUse: false,
activityInstance: {}, activityInstance: {},
qrCodeImage: '', qrCodeImage: "",
formValidate: { formValidate: {
date: null, date: null,
organizationId: null, organizationId: null,
storeId: null, storeId: null,
status: 2, status: 2,
startDate: null, startDate: null,
endDate: null, endDate: null
}, },
startDateOptions: {}, startDateOptions: {},
endDateOptions: {}, endDateOptions: {},
@ -274,8 +273,8 @@ export default {
}, },
{ {
title: "活动码", title: "活动码",
slot: 'qrCodeAction', slot: "qrCodeAction",
className: 'table-width-80', className: "table-width-80"
// render (h, p) { // render (h, p) {
// return h( // return h(
// "Button", // "Button",
@ -300,8 +299,8 @@ export default {
}, },
{ {
title: "操作", title: "操作",
slot: 'action', slot: "action",
width: 200, width: 200
// render (h, p) { // render (h, p) {
// let r = [ // let r = [
// h( // h(
@ -392,6 +391,9 @@ export default {
this.searchTable(); this.searchTable();
}, },
stop(instance) { stop(instance) {
if (instance.status > 2) {
return;
}
let _this = this; let _this = this;
this.$Modal.confirm({ this.$Modal.confirm({
title: "您确认要终止?", title: "您确认要终止?",
@ -434,6 +436,7 @@ export default {
}); });
}, },
navigateCode(instance) { navigateCode(instance) {
return;
this.$router.push({ this.$router.push({
path: "/activity/plan/code", path: "/activity/plan/code",
query: { instanceId: instance.id } query: { instanceId: instance.id }
@ -463,7 +466,7 @@ export default {
if (params.status == 0) { if (params.status == 0) {
params.status = undefined; params.status = undefined;
} }
params.categoryCode = "promotion" params.categoryCode = "promotion";
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 || {};
@ -476,19 +479,24 @@ export default {
// //
this.endDateOptions = { this.endDateOptions = {
disabledDate: date => { disabledDate: date => {
let startTime = this.formValidate.startDate ? new Date(this.formValidate.startDate).valueOf() : ''; let startTime = this.formValidate.startDate
return date && (date.valueOf() < startTime) ? new Date(this.formValidate.startDate).valueOf()
} : "";
return date && date.valueOf() < startTime;
} }
};
}, },
endDateChange: function(e) { endDateChange: function(e) {
// //
let endTime = this.formValidate.endDate ? new Date(this.formValidate.endDate).valueOf() - 1 * 24 * 60 * 60 * 1000 : ''; let endTime = this.formValidate.endDate
? new Date(this.formValidate.endDate).valueOf() -
1 * 24 * 60 * 60 * 1000
: "";
this.startDateOptions = { this.startDateOptions = {
disabledDate: date => { disabledDate: date => {
return date && (date.valueOf() > endTime); return date && date.valueOf() > endTime;
}
} }
};
}, },
show: function(index) { show: function(index) {
this.isShow = true; this.isShow = true;
@ -501,17 +509,19 @@ export default {
}, },
// //
download: function(index) { download: function(index) {
debugger debugger;
let fileName = index.name + "-门店码"; let fileName = index.name + "-门店码";
http.downloadImg({ http.downloadImg(
{
url: index.qrCodeAction url: index.qrCodeAction
}, fileName, function (/*data*/) { },
fileName,
}) function(/*data*/) {}
);
}, },
ok: function() { ok: function() {
this.isShow = false; this.isShow = false;
}, }
} }
}; };
</script> </script>
@ -528,6 +538,9 @@ export default {
color: #3496eb !important; color: #3496eb !important;
margin-left: -15px; margin-left: -15px;
} }
.router-btn.disable {
color: #999 !important;
}
.table-img-qr-code { .table-img-qr-code {
margin-left: 5px; margin-left: 5px;
margin-top: 5px; margin-top: 5px;

@ -1,5 +1,12 @@
<template> <template>
<Modal v-model="dispalyModal" width="1000" :loading="true" :mask-closable="false"> <Modal
v-model="dispalyModal"
width="1000"
:loading="true"
:mask-closable="false"
@on-visible-change="visibleChange"
@on-cancel="cancel"
>
<p slot="header" style="color:#f60;text-align:left"> <p slot="header" style="color:#f60;text-align:left">
<span>配置活动</span> <span>配置活动</span>
</p> </p>
@ -176,6 +183,11 @@ export default {
this.formValidate.params.splice(index, 1); this.formValidate.params.splice(index, 1);
this.$forceUpdate(); this.$forceUpdate();
}, },
visibleChange(show) {
if (!show) {
this.$emit("dispalyAddActivityModal", false, false);
}
},
cancel() { cancel() {
this.$emit("dispalyAddActivityModal", false, false); this.$emit("dispalyAddActivityModal", false, false);
}, },

@ -2,7 +2,7 @@
<div class="use_box"> <div class="use_box">
<Modal :scrollable="false" <Modal :scrollable="false"
v-model="showUse" v-model="showUse"
title="使用活动" :title="title"
@on-cancel="cancel" @on-cancel="cancel"
:loading="true" :loading="true"
width="70%"> width="70%">
@ -69,6 +69,10 @@ export default {
isModify: { isModify: {
type: Boolean, type: Boolean,
default: false default: false
},
title: {
type: String,
default: "使用活动"
} }
}, },
watch: { watch: {

@ -1,49 +1,46 @@
<template> <template>
<div class="use_box"> <div class="use_box">
<Modal :scrollable="false" <Modal
:scrollable="false"
v-model="showUse" v-model="showUse"
title="使用活动" title="使用活动"
@on-cancel="cancel" @on-cancel="cancel"
:loading="true" :loading="true"
width="70%"> width="70%"
<Steps style="padding: 40px;" @on-visible-change="visibleChange"
:current="currentStep"> >
<Steps style="padding: 40px;" :current="currentStep">
<Step title="基本信息"></Step> <Step title="基本信息"></Step>
<Step :title="isModify ? '修改零售公司' : '选择零售公司'" <Step :title="isModify ? '修改零售公司' : '选择零售公司'" content></Step>
content></Step> <Step :title="isModify ? '修改店铺' : '选择店铺'" content></Step>
<Step :title="isModify ? '修改店铺' : '选择店铺'" <Step title="确认信息" content></Step>
content></Step>
<Step title="确认信息"
content></Step>
</Steps> </Steps>
<useActivityStepOne :schedule="schedule" <useActivityStepOne :schedule="schedule" :isModify="isModify" v-if="currentStep == 0 && show"></useActivityStepOne>
:isModify="isModify" <useActivityStepTwo :schedule="schedule" :isModify="isModify" v-if="currentStep == 1"></useActivityStepTwo>
v-if="currentStep == 0 && show"></useActivityStepOne> <useActivityStepThree :schedule="schedule" :isModify="isModify" v-if="currentStep == 2"></useActivityStepThree>
<useActivityStepTwo :schedule="schedule" <useActivityStepFoure :schedule="schedule" :isModify="isModify" v-if="currentStep == 3"></useActivityStepFoure>
:isModify="isModify"
v-if="currentStep == 1"></useActivityStepTwo>
<useActivityStepThree :schedule="schedule"
:isModify="isModify"
v-if="currentStep == 2"></useActivityStepThree>
<useActivityStepFoure :schedule="schedule"
:isModify="isModify"
v-if="currentStep == 3"></useActivityStepFoure>
<div slot="footer"> <div slot="footer">
<Button v-if="currentStep !== 0" <Button
v-if="currentStep !== 0"
type="primary" type="primary"
shape="circle" shape="circle"
:loading="modal_loading" :loading="modal_loading"
@click="back">上一步</Button> @click="back"
<Button v-if="currentStep !== 3" >上一步</Button>
<Button
v-if="currentStep !== 3"
type="primary" type="primary"
shape="circle" shape="circle"
:loading="modal_loading" :loading="modal_loading"
@click="next">下一步</Button> @click="next"
<Button v-if="currentStep == 3" >下一步</Button>
<Button
v-if="currentStep == 3"
type="primary" type="primary"
shape="circle" shape="circle"
:loading="modal_loading" :loading="modal_loading"
@click="finish">完成</Button> @click="finish"
>完成</Button>
</div> </div>
</Modal> </Modal>
</div> </div>
@ -55,20 +52,21 @@ import useActivityStepThree from "./useActivityStepThree";
import useActivityStepFoure from "./useActivityStepFoure"; import useActivityStepFoure from "./useActivityStepFoure";
import ActivityManager from "../../services/ActivityManager/ActivityManager"; import ActivityManager from "../../services/ActivityManager/ActivityManager";
import store from "../../store/index"; import store from "../../store/index";
import { formatDate } from '../../utils/Common'; import { formatDate } from "../../utils/Common";
export default { export default {
name: "useTable", name: "useTable",
components: { components: {
useActivityStepOne, useActivityStepOne,
useActivityStepTwo, useActivityStepTwo,
useActivityStepThree, useActivityStepThree,
useActivityStepFoure, useActivityStepFoure
}, },
inject: ["setMenuName"],
data() { data() {
return { return {
currentStep: 0, currentStep: 0,
modal_loading: false, modal_loading: false,
showUse: false, showUse: false
}; };
}, },
props: { props: {
@ -90,13 +88,14 @@ export default {
}, },
schedule() { schedule() {
store.getters.useData.scheduleId = this.schedule.id; store.getters.useData.scheduleId = this.schedule.id;
}
}, },
created() {
this.setMenuName("活动管理", "活动计划");
}, },
mounted() {}, mounted() {},
methods: { methods: {
cancel () { visibleChange(show) {},
this.currentStep = 0;
},
cancel() { cancel() {
store.commit("RSET_useData"); store.commit("RSET_useData");
this.$emit("doShow", false); this.$emit("doShow", false);
@ -143,7 +142,7 @@ export default {
if (typeof data.endTime == "object") { if (typeof data.endTime == "object") {
data.endTime = formatDate(data.endTime); data.endTime = formatDate(data.endTime);
} }
console.log("data", data) console.log("data", data);
store.commit("SET_useData", data); store.commit("SET_useData", data);
this.currentStep = this.currentStep + 1; this.currentStep = this.currentStep + 1;
}, },
@ -163,8 +162,8 @@ export default {
that.modal_loading = false; that.modal_loading = false;
that.showUse = false; that.showUse = false;
}); });
}, }
}, }
}; };
</script> </script>

@ -11,7 +11,7 @@
<span class="" style="border: 0px; color: rgb(52, 150, 235); margin-left: 15px; cursor: pointer;" @click="showStores"></span> <span class="" style="border: 0px; color: rgb(52, 150, 235); margin-left: 15px; cursor: pointer;" @click="showStores"></span>
</i-col> </i-col>
<i-col span="8"> <i-col span="8">
<i-switch size="large"> <i-switch size="large" @on-change="witchChange">
<span slot="open">开启</span> <span slot="open">开启</span>
<span slot="close">关闭</span> <span slot="close">关闭</span>
</i-switch> </i-switch>
@ -52,8 +52,9 @@ import selectStoreStep from '../activity/selectStoreStep'
import store from '../../store' import store from '../../store'
import bulletinService from '../../services/recruit/Bulletin' import bulletinService from '../../services/recruit/Bulletin'
import http from '../../services/CommonHttp'; import http from '../../services/CommonHttp';
import axios from "axios";
export default { export default {
inject:['reload'],
components: { components: {
selectStoreStep, selectStoreStep,
}, },
@ -69,7 +70,9 @@ export default {
inidData:{}, inidData:{},
showUpload:false, showUpload:false,
btnStr:'编辑', btnStr:'编辑',
imgUrl:'' imgUrl:'',
onWitch:false,
uploadUrl:""
}; };
}, },
mounted: function() { mounted: function() {
@ -79,15 +82,17 @@ export default {
this.initData(); this.initData();
}, },
methods: { methods: {
witchChange(status) {
this.onWitch = status;
},
initData(){ initData(){
let that = this; let that = this;
bulletinService.getDetail({}, function (data) { bulletinService.getDetail({}, function (data) {
console.log(data); console.log(data);
data.data.results.scheduleVO.params.forEach(item => { if(data.data.results.scheduleVO.params.length>0){
item.defaultVal = http.getBaseUrl() + item.defaultVal; that.imgUrl = http.getBaseUrl() + data.data.results.scheduleVO.params[0].defaultVal;
}); }
that.initData = data.data.results; that.initData = data.data.results;
that.imgUrl = that.initData.scheduleVO.params[0].defaultVal
}, function (err) { }, function (err) {
that.$Message.error("网络异常,请重试"); that.$Message.error("网络异常,请重试");
@ -97,10 +102,7 @@ export default {
doShow () { doShow () {
this.showStoreCheck = false this.showStoreCheck = false
this.welcome = store.getters.useData this.welcome = store.getters.useData
console.log(this.welcome) console.log(this.welcome);
},
change (status) {
this.$Message.info('开关状态:' + status);
}, },
showStores () { showStores () {
console.log({ ...store.getters.useData, ...this.welcome }) console.log({ ...store.getters.useData, ...this.welcome })
@ -108,8 +110,44 @@ export default {
this.showStoreCheck = true this.showStoreCheck = true
}, },
onEdit(){ onEdit(){
if(this.btnStr == '编辑'){
this.showUpload = true; this.showUpload = true;
this.btnStr = '保存' this.btnStr = '保存'
}else{
this.initData.isGetActivityInfo = true;
try{
if(this.welcome.stores.length>0){
this.initData.stores = this.welcome.stores;
}
}catch(e){
console.log(e);
}
if(this.onWitch){
this.initData.status = 1;
this.initData.stores.forEach(item => {
item.status = 1;
})
}else{
this.initData.status = 3;
this.initData.stores.forEach(item => {
item.status = 2;
})
}
if(this.uploadUrl != ""){
this.initData.scheduleVO.params.forEach(item => {
item.defaultVal = item.description = this.uploadUrl;
})
}
let that = this;
bulletinService.dosave(this.initData, function (data) {
console.log(data);
that.reload();
}, function (err) {
that.$Message.error("网络异常,请重试");
that.setNoLoading();
});
}
}, },
onCancel(){ onCancel(){
this.showUpload = false; this.showUpload = false;
@ -119,7 +157,7 @@ export default {
this.imageName = file.name; this.imageName = file.name;
}, },
handleBeforeUpload (res) { handleBeforeUpload (res) {
const me = this; const _this = this;
let data = new FormData(); let data = new FormData();
data.append("file", res); data.append("file", res);
axios({ axios({
@ -131,6 +169,9 @@ export default {
}, },
}).then(function (res) { }).then(function (res) {
if (res.data.success) { if (res.data.success) {
console.log(res);
_this.uploadUrl = res.data.results.localPath;
_this.imgUrl = http.getBaseUrl() + res.data.results.localPath;
} }
}); });
return false; return false;

@ -39,11 +39,11 @@
</div> </div>
<div v-else-if="item.type == 2"> <div v-else-if="item.type == 2">
<i-col style="line-height: 32px" :span="4">标题 {{ index + 1 }}</i-col> <i-col style="line-height: 32px" :span="4">标题 {{ index + 1 }}</i-col>
<i-col :span="8"> <i-col :span="6">
<i-input class="inputClass" type="text" disabled v-model="item.description"></i-input> <i-input class="inputClass" type="text" disabled v-model="item.description"></i-input>
</i-col> </i-col>
<i-col style="line-height: 32px" :span="4">URL {{ index + 1 }}</i-col> <i-col style="line-height: 32px" :span="4">URL {{ index + 1 }}</i-col>
<i-col :span="8"> <i-col :span="6">
<i-input class="inputClass" type="text" disabled v-model="item.defaultVal"></i-input> <i-input class="inputClass" type="text" disabled v-model="item.defaultVal"></i-input>
</i-col> </i-col>
</div> </div>
@ -73,14 +73,19 @@
>全部店铺</Button> >全部店铺</Button>
</FormItem> </FormItem>
<FormItem> <FormItem>
<Button type="primary" long @click="submit"></Button> <Button
type="primary"
:loading="loading"
long
@click="submit"
>{{loading ? "保存中" : "确定"}}</Button>
</FormItem> </FormItem>
</Form> </Form>
</i-col> </i-col>
</Row> </Row>
<Modal v-model="showMessageTypes" title="添加图片/网页/小程序消息" :footer-hide="true"> <Modal v-model="showMessageTypes" title="添加图片/网页/小程序消息" :footer-hide="true">
<Row :gutter="24"> <Row :gutter="24">
<i-col :span="8"> <i-col :span="8" v-if="imageFilter()">
<Upload <Upload
ref="upload" ref="upload"
:show-upload-list="false" :show-upload-list="false"
@ -100,16 +105,16 @@
</Upload> </Upload>
</i-col> </i-col>
<i-col :span="8"> <i-col :span="8">
<Button long @click="doShowWeb" type="primary"></Button> <Button long @click="doShowWeb" v-if="webFilter()" type="primary"></Button>
</i-col> </i-col>
<i-col :span="8"> <i-col :span="8">
<Button long @click="doShowMini" type="primary">小程</Button> <Button long @click="doShowMini" v-if="miniFilter()" type="primary"></Button>
</i-col> </i-col>
</Row> </Row>
</Modal> </Modal>
<Modal v-model="showWeb" title="添加网页消息" :loading="true"> <Modal v-model="showWeb" title="添加网页消息" :loading="true">
<Form ref="webForm" :model="webForm" :rules="webFormRules"> <Form ref="webForm" :model="webForm" :rules="webFormRules">
<FormItem label="标题" prop="url"> <FormItem label="标题" prop="title">
<i-input v-model="webForm.title" type="text" placeholder="请输入网页标题"></i-input> <i-input v-model="webForm.title" type="text" placeholder="请输入网页标题"></i-input>
</FormItem> </FormItem>
<FormItem label="添加网页消息" prop="url"> <FormItem label="添加网页消息" prop="url">
@ -162,7 +167,13 @@
<Button type="primary" @click="okMini"></Button> <Button type="primary" @click="okMini"></Button>
</div> </div>
</Modal> </Modal>
<selectStoreStep :isModify="id>0" @doShow="doShow" :schedule="welcome" :show="showStoreCheck"></selectStoreStep> <selectStoreStep
:title="'配置范围'"
:isModify="id>0"
@doShow="doShow"
:schedule="welcome"
:show="showStoreCheck"
></selectStoreStep>
</div> </div>
</template> </template>
@ -189,6 +200,7 @@ export default {
id: 0, id: 0,
showMessageTypes: false, showMessageTypes: false,
imageUploading: false, imageUploading: false,
loading: false,
welcome: { welcome: {
content: "", content: "",
params: [], params: [],
@ -248,6 +260,21 @@ export default {
selectStoreStep selectStoreStep
}, },
methods: { methods: {
webFilter() {
return (
this._.filter(this.welcome.params, item => item.type == 2).length < 1
);
},
imageFilter() {
return (
this._.filter(this.welcome.params, item => item.type == 1).length < 1
);
},
miniFilter() {
return (
this._.filter(this.welcome.params, item => item.type == 3).length < 1
);
},
doShow() { doShow() {
this.showStoreCheck = false; this.showStoreCheck = false;
this.welcome = store.getters.useData; this.welcome = store.getters.useData;
@ -405,10 +432,45 @@ export default {
}, },
submit() { submit() {
let _this = this; let _this = this;
_this.loading = true;
if (this.welcome.stores.length <= 0) { if (this.welcome.stores.length <= 0) {
_this.$Message.error("请至少选择一个店铺"); _this.$Message.error("请至少选择一个店铺");
_this.loading = false;
return false; return false;
} }
// let params = this.welcome.params;
// let imageCount = 0;
// let webCount = 0;
// let miniCount = 0;
// for (const key in params) {
// if (params.hasOwnProperty(key)) {
// const element = params[key];
// if (element.type == 1) {
// imageCount++;
// }
// if (element.type == 2) {
// webCount++;
// }
// if (element.type == 3) {
// miniCount++;
// }
// }
// }
// if (imageCount > 1) {
// _this.loading = false;
// _this.$Message.error("");
// return false;
// }
// if (webCount > 1) {
// _this.loading = false;
// _this.$Message.error("");
// return false;
// }
// if (miniCount > 1) {
// _this.loading = false;
// _this.$Message.error("");
// return false;
// }
this.$refs["welcomeForm"].validate(valid => { this.$refs["welcomeForm"].validate(valid => {
if (valid) { if (valid) {
let data = _this.welcome; let data = _this.welcome;
@ -421,6 +483,7 @@ export default {
"Content-Type": "applications/json" "Content-Type": "applications/json"
} }
}).then(res => { }).then(res => {
_this.loading = false;
_this.$router.push("/shop/increase/welcome/list"); _this.$router.push("/shop/increase/welcome/list");
}); });
} }

@ -17,12 +17,16 @@
size="small"> size="small">
<template slot-scope="{ row, index }" <template slot-scope="{ row, index }"
slot="action"> slot="action">
<Button type="primary" <i-col span="12">
size="small" <Button ghost
@click="handleEdit(row, index)">修改</Button> class="router-btn"
<Button type="error" @click="() => {handleEdit(row, index)}">修改</Button>
size="small" </i-col>
@click="handleDelete(row, index)">删除</Button> <i-col span="12">
<Button ghost
class="router-btn"
@click="() => {handleDelete(row, index)}">删除</Button>
</i-col>
</template> </template>
</Table> </Table>
<Page :total="total" <Page :total="total"
@ -187,4 +191,19 @@ export default {
}; };
</script> </script>
<style scoped></style> <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;
}
</style>

@ -5,6 +5,11 @@ export function getDetail(params, call) {
return http.get('/fission/detail', params).then(call) return http.get('/fission/detail', params).then(call)
} }
export function dosave(params, call) {
return http.post('/fission/save', params).then(call)
}
export default { export default {
getDetail, getDetail,
dosave
} }

Loading…
Cancel
Save