Merge branch 'feature_0521' of http://git.51jingcheng.com/zhenghuang/bsdgy-front into feature_0521

feature_0521
liuyang 5 years ago
commit b0c6a78678

@ -1,40 +1,41 @@
<template> <template>
<div class="use_box"> <div class="use_box">
<Modal :scrollable="false" <Modal
v-model="showUse" :scrollable="false"
title="使用活动" v-model="showUse"
@on-cancel="cancel" title="使用活动"
:loading="true" @on-cancel="cancel"
width="70%"> :loading="true"
<Steps style="padding: 40px;" width="70%"
:current="currentStep"> >
<Step :title="isModify ? '修改零售公司' : '选择零售公司'" <Steps style="padding: 40px;" :current="currentStep">
content></Step> <Step :title="isModify ? '修改零售公司' : '选择零售公司'" content></Step>
<Step :title="isModify ? '修改店铺' : '选择店铺'" <Step :title="isModify ? '修改店铺' : '选择店铺'" content></Step>
content></Step>
</Steps> </Steps>
<useActivityStepTwo :schedule="schedule" <useActivityStepTwo :schedule="schedule" :isModify="isModify" v-if="currentStep == 0"></useActivityStepTwo>
:isModify="isModify" <useActivityStepThree :schedule="schedule" :isModify="isModify" v-if="currentStep == 1"></useActivityStepThree>
v-if="currentStep == 0"></useActivityStepTwo>
<useActivityStepThree :schedule="schedule"
:isModify="isModify"
v-if="currentStep == 1"></useActivityStepThree>
<div slot="footer"> <div slot="footer">
<Button v-if="currentStep !== 0" <Button
type="primary" v-if="currentStep !== 0"
shape="circle" type="primary"
:loading="modal_loading" shape="circle"
@click="back">上一步</Button> :loading="modal_loading"
<Button v-if="currentStep !== 1" @click="back"
type="primary" >上一步</Button>
shape="circle" <Button
:loading="modal_loading" v-if="currentStep !== 1"
@click="next">下一步</Button> type="primary"
<Button v-if="currentStep == 1" shape="circle"
type="primary" :loading="modal_loading"
shape="circle" @click="next"
:loading="modal_loading" >下一步</Button>
@click="finish">完成</Button> <Button
v-if="currentStep == 1"
type="primary"
shape="circle"
:loading="modal_loading"
@click="finish"
>完成</Button>
</div> </div>
</Modal> </Modal>
</div> </div>
@ -46,20 +47,20 @@ 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
}, },
data () { data() {
return { return {
currentStep: 0, currentStep: -1,
modal_loading: false, modal_loading: false,
showUse: false, showUse: false
}; };
}, },
props: { props: {
@ -72,27 +73,29 @@ export default {
} }
}, },
watch: { watch: {
show () { show() {
this.showUse = this.show; this.showUse = this.show;
this.currentStep = 0;
}, },
schedule () { schedule() {
store.getters.useData.scheduleId = this.schedule.id; store.getters.useData.scheduleId = this.schedule.id;
}, }
}, },
mounted () { }, mounted() {},
methods: { methods: {
cancel () { cancel() {
this.currentStep = 0; this.currentStep = 0;
}, if (!this.isModify) {
cancel () { store.commit("RSET_useData");
store.commit("RSET_useData"); }
this.$emit("doShow", false); this.$emit("doShow", false);
this.modal_loading = false; this.modal_loading = false;
this.showUse = false; this.showUse = false;
this.currentStep = 0; this.currentStep = 0;
}, },
next () { next() {
let data = store.getters.useData; let data = store.getters.useData;
console.log("data1", data);
if (this.currentStep === 0) { if (this.currentStep === 0) {
if (!data.company || data.company.length === 0) { if (!data.company || data.company.length === 0) {
this.$Message.error("请至少选择1家公司"); this.$Message.error("请至少选择1家公司");
@ -111,19 +114,19 @@ 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;
}, },
back () { back() {
this.currentStep = this.currentStep - 1; this.currentStep = this.currentStep - 1;
}, },
finish () { finish() {
let that = this; let that = this;
this.modal_loading = true; this.modal_loading = true;
that.$emit("doShow", false); that.$emit("doShow", false);
}, }
}, }
}; };
</script> </script>

@ -1,41 +1,29 @@
<template> <template>
<div style="padding: 0 40px;"> <div style="padding: 0 40px;">
<div class="selectClass"> <div class="selectClass">
<Checkbox :indeterminate="indeterminate" <Checkbox
:value="allSelect" :indeterminate="indeterminate"
@click.prevent.native="handleCheckAll">&nbsp;&nbsp;&nbsp;全选</Checkbox> :value="allSelect"
<i-input icon="search" @click.prevent.native="handleCheckAll"
@on-change="doSearch" >&nbsp;&nbsp;&nbsp;全选</Checkbox>
placeholder="请输入零售公司名称" <i-input icon="search" @on-change="doSearch" placeholder="请输入零售公司名称" style="width: 250px"></i-input>
style="width: 250px"></i-input>
</div> </div>
<div class="companyTable"> <div class="companyTable">
<div class="companyListClass"> <div class="companyListClass">
<Row :gutter="10"> <Row :gutter="10">
<div v-show="loading" <div v-show="loading" style="padding: 50px 0" class="loading">
style="padding: 50px 0"
class="loading">
<Spin fix>加载中...</Spin> <Spin fix>加载中...</Spin>
</div> </div>
<CheckboxGroup size="large" <CheckboxGroup size="large" @on-change="onChange" v-model="checkCompanys">
@on-change="onChange" <i-col span="8" v-if="!item.hide" :key="index" v-for="(item, index) in companyList">
v-model="checkCompanys"> <Checkbox size="large" :label="item.value" border>
<i-col span="8"
v-if="!item.hide"
:key="index"
v-for="(item, index) in companyList">
<Checkbox size="large"
:label="item.value"
border>
<span>{{ item.label }}</span> <span>{{ item.label }}</span>
</Checkbox> </Checkbox>
</i-col> </i-col>
</CheckboxGroup> </CheckboxGroup>
</Row> </Row>
</div> </div>
<Spin size="large" <Spin size="large" fix v-if="loading"></Spin>
fix
v-if="loading"></Spin>
</div> </div>
</div> </div>
</template> </template>
@ -44,7 +32,7 @@ import ActivityManager from "../../services/ActivityManager/ActivityManager";
import store from "../../store/index"; import store from "../../store/index";
export default { export default {
name: "useActivityStepTwo", name: "useActivityStepTwo",
data () { data() {
return { return {
indeterminate: false, indeterminate: false,
allSelect: false, allSelect: false,
@ -52,29 +40,36 @@ export default {
companyListdata: [], companyListdata: [],
checkCompanys: [], checkCompanys: [],
orginCompanyList: [], orginCompanyList: [],
loading: false, loading: false
}; };
}, },
mounted () { mounted() {
let _this = this; let _this = this;
console.log(111, store.getters.useData); console.log(1, store.getters.useData);
if (store.getters.useData.company) { if (
store.getters.useData.company.forEach((item) => { store.getters.useData.company &&
store.getters.useData.company.length > 0
) {
store.getters.useData.company.forEach(item => {
if (_this.checkCompanys.indexOf(item.id) == -1) { if (_this.checkCompanys.indexOf(item.id) == -1) {
_this.checkCompanys.push(item.id); _this.checkCompanys.push(item.id);
} }
}); });
} else if (store.getters.useData.stores) { } else if (
store.getters.useData.stores.forEach((item) => { store.getters.useData.stores &&
store.getters.useData.stores.length > 0
) {
store.getters.useData.stores.forEach(item => {
if (item.parentId && _this.checkCompanys.indexOf(item.parentId) == -1) { if (item.parentId && _this.checkCompanys.indexOf(item.parentId) == -1) {
_this.checkCompanys.push(item.parentId); _this.checkCompanys.push(item.parentId);
} }
}); });
} }
this.getCompanyInfo() this.getCompanyInfo();
}, },
methods: { methods: {
onChange (data) { onChange(data) {
console.log(2, store.getters.useData);
let _this = this; let _this = this;
if (data.length === this.companyList.length) { if (data.length === this.companyList.length) {
this.indeterminate = false; this.indeterminate = false;
@ -87,58 +82,58 @@ export default {
this.allSelect = false; this.allSelect = false;
} }
store.getters.useData.company = []; store.getters.useData.company = [];
data.forEach((item) => { data.forEach(item => {
const c = _this._.find( const c = _this._.find(_this.companyListdata, shop => shop.id == item);
_this.companyListdata,
(shop) => shop.id == item
);
if (c) { if (c) {
store.getters.useData.company.push(c); store.getters.useData.company.push(c);
} }
}); });
console.log(3, store.getters.useData);
}, },
doSearch (e) { doSearch(e) {
const keyword = e.target.value; const keyword = e.target.value;
let that = this; let that = this;
if (keyword.length > 0) { if (keyword.length > 0) {
that.companyList.forEach((item) => { that.companyList.forEach(item => {
if (item.label.indexOf(keyword) == -1) { if (item.label.indexOf(keyword) == -1) {
item.hide = true; item.hide = true;
} }
}); });
} else { } else {
that.companyList.forEach((item) => { that.companyList.forEach(item => {
item.hide = false item.hide = false;
}); });
} }
this.$forceUpdate(); this.$forceUpdate();
console.log(1, that.companyList) console.log(1, that.companyList);
}, },
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
}; };
this.loading = true; this.loading = true;
ActivityManager.getCompany(data, function (data) { ActivityManager.getCompany(data, function(data) {
that.companyList = []; that.companyList = [];
that.companyListdata = data.data.results; that.companyListdata = data.data.results;
if (store.getters.useData.company && store.getters.useData.company.length == that.companyListdata.length) { if (
store.getters.useData.company &&
store.getters.useData.company.length == that.companyListdata.length
) {
that.allSelect = true; that.allSelect = true;
} }
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
}); });
that.orginCompanyList = that.companyList; that.orginCompanyList = that.companyList;
}); });
store.getters.useData.company = []; store.getters.useData.company = [];
console.log(123, that.checkCompanys, that.companyListdata) that.checkCompanys.forEach(item => {
that.checkCompanys.forEach((item) => {
const c = that._.find( const c = that._.find(
that.companyListdata, that.companyListdata,
(company) => company.id == item company => company.id == item
); );
if (c) { if (c) {
store.getters.useData.company.push(c); store.getters.useData.company.push(c);
@ -147,7 +142,7 @@ export default {
that.loading = false; that.loading = false;
}); });
}, },
handleCheckAll () { handleCheckAll() {
let _this = this; let _this = this;
if (this.indeterminate) { if (this.indeterminate) {
this.allSelect = false; this.allSelect = false;
@ -158,24 +153,24 @@ export default {
if (this.allSelect) { if (this.allSelect) {
this.checkCompanys = []; this.checkCompanys = [];
this.companyList.forEach((item) => { this.companyList.forEach(item => {
this.checkCompanys.push(item.value); this.checkCompanys.push(item.value);
}); });
} else { } else {
this.checkCompanys = []; this.checkCompanys = [];
} }
store.getters.useData.company = []; store.getters.useData.company = [];
this.checkCompanys.forEach((item) => { this.checkCompanys.forEach(item => {
const c = _this._.find( const c = _this._.find(
_this.companyListdata, _this.companyListdata,
(company) => company.id == item company => company.id == item
); );
if (c) { if (c) {
store.getters.useData.company.push(c); store.getters.useData.company.push(c);
} }
}); });
}, }
}, }
}; };
</script> </script>

@ -1,182 +1,132 @@
<template> <template>
<div class=""> <div class>
<Row> <Row>
<i-col :span="12"> <i-col :span="12">
<Form ref="welcomeForm" <Form ref="welcomeForm" :model="welcome" :rules="welcomeRules">
:model="welcome" <FormItem label="欢迎语内容" prop="content">
:rules="welcomeRules"> <i-input
<FormItem label="欢迎语内容" v-model="welcome.content"
prop="content"> type="textarea"
<i-input v-model="welcome.content" style="height: 220px"
type="textarea" :autosize="{ minRows: 10, maxRows: 10 }"
style="height: 220px" placeholder="请输入欢迎语内容,最多100个字"
:autosize="{ minRows: 10, maxRows: 10 }" ></i-input>
placeholder="请输入欢迎语内容,最多100个字"></i-input>
</FormItem> </FormItem>
<Row style="margin-bottom: 10px" <Row
:gutter="10" style="margin-bottom: 10px"
class="inputItem" :gutter="10"
v-for="(item, index) in welcome.params" class="inputItem"
:key="index"> v-for="(item, index) in welcome.params"
:key="index"
>
<div v-if="item.type == 3"> <div v-if="item.type == 3">
<i-col style="line-height: 32px" <i-col style="line-height: 32px" :span="4">APPID {{ index + 1 }}</i-col>
:span="4">
APPID {{ index + 1 }}
</i-col>
<i-col :span="6"> <i-col :span="6">
<i-input class="inputClass" <i-input class="inputClass" type="text" disabled v-model="item.defaultVal"></i-input>
type="text"
disabled
v-model="item.defaultVal"></i-input>
</i-col>
<i-col style="line-height: 32px"
:span="4">
URI {{ index + 1 }}
</i-col> </i-col>
<i-col style="line-height: 32px" :span="4">URI {{ index + 1 }}</i-col>
<i-col :span="6"> <i-col :span="6">
<i-input class="inputClass" <i-input class="inputClass" type="text" disabled v-model="item.description"></i-input>
type="text"
disabled
v-model="item.description"></i-input>
</i-col> </i-col>
</div> </div>
<div v-else> <div v-else>
<i-col style="line-height: 32px" <i-col style="line-height: 32px" :span="4">{{ item.name }}{{ index + 1 }}</i-col>
:span="4">
{{ item.name }}{{ index + 1 }}
</i-col>
<i-col :span="16"> <i-col :span="16">
<i-input class="inputClass" <i-input class="inputClass" type="text" disabled v-model="item.defaultVal"></i-input>
type="text"
disabled
v-model="item.defaultVal"></i-input>
</i-col> </i-col>
</div> </div>
<i-col :span="4"> <i-col :span="4">
<Button type="error" <Button type="error" @click="delActivityInput(index)"></Button>
@click="delActivityInput(index)">删除</Button>
</i-col> </i-col>
</Row> </Row>
<FormItem> <FormItem>
<Button type="text" <Button type="text" @click="() => (showMessageTypes = true)" icon="md-add">添加图片/网页/小程序消息</Button>
@click="() => (showMessageTypes = true)"
icon="md-add">添加图片/网页/小程序消息</Button>
</FormItem> </FormItem>
<FormItem label="配置范围: "> <FormItem label="配置范围: ">
<span v-if="welcome.stores.length > 0"> <span
{{ welcome.stores[0].name }}{{ welcome.stores.length }}家店铺 v-if="welcome.stores.length > 0"
</span> >{{ welcome.stores[0].name }}{{ welcome.stores.length }}家店铺</span>
<Button type="text" <Button type="text" @click="showStores" icon="md-add">全部店铺</Button>
@click="showStores"
icon="md-add">全部店铺</Button>
</FormItem> </FormItem>
<FormItem> <FormItem>
<Button type="primary" <Button type="primary" long @click="submit"></Button>
long
@click="submit">确定</Button>
</FormItem> </FormItem>
</Form> </Form>
</i-col> </i-col>
</Row> </Row>
<Modal v-model="showMessageTypes" <Modal v-model="showMessageTypes" title="添加图片/网页/小程序消息" :footer-hide="true">
title="添加图片/网页/小程序消息"
:footer-hide="true">
<Row :gutter="24"> <Row :gutter="24">
<i-col :span="8"> <i-col :span="8">
<Upload ref="upload" <Upload
:show-upload-list="false" ref="upload"
:on-success="uploadImgSuccess" :show-upload-list="false"
:format="['jpg', 'jpeg', 'png']" :on-success="uploadImgSuccess"
:max-size="2048" :format="['jpg', 'jpeg', 'png']"
:before-upload="handleBeforeUpload" :max-size="2048"
multiple :before-upload="handleBeforeUpload"
type="drag" multiple
action="" type="drag"
style="width: 100%;"> action
style="width: 100%;"
>
<div style="width: 100%;"> <div style="width: 100%;">
<Button long <Button long type="primary">图片</Button>
type="primary">图片</Button>
</div> </div>
</Upload> </Upload>
</i-col> </i-col>
<i-col :span="8"> <i-col :span="8">
<Button long <Button long @click="doShowWeb" type="primary">网页</Button>
@click="doShowWeb" </i-col>
type="primary">网页</Button></i-col>
<i-col :span="8"> <i-col :span="8">
<Button long <Button long @click="doShowMini" type="primary">小程序</Button>
@click="doShowMini" </i-col>
type="primary">小程序</Button></i-col>
</Row> </Row>
</Modal> </Modal>
<Modal v-model="showWeb" <Modal v-model="showWeb" title="添加网页消息" :loading="true">
title="添加网页消息" <Form ref="webForm" :model="webForm" :rules="webFormRules">
:loading="true"> <FormItem label="添加网页消息" prop="url">
<Form ref="webForm" <i-input v-model="webForm.url" type="text" placeholder="以http或https开头"></i-input>
:model="webForm"
:rules="webFormRules">
<FormItem label="添加网页消息"
prop="url">
<i-input v-model="webForm.url"
type="text"
placeholder="以http或https开头"></i-input>
</FormItem> </FormItem>
</Form> </Form>
<div slot="footer"> <div slot="footer">
<Button type="primary" <Button type="primary" @click="cancelWeb"></Button>
@click="cancelWeb">取消</Button> <Button type="primary" @click="okWeb"></Button>
<Button type="primary"
@click="okWeb">确定</Button>
</div> </div>
</Modal> </Modal>
<Modal v-model="showMini" <Modal v-model="showMini" title="添加小程序消息" :loading="true">
title="添加小程序消息" <Form ref="miniForm" :model="miniForm" :rules="miniFormRules">
:loading="true"> <FormItem label="APPID" prop="appid">
<Form ref="miniForm" <i-input v-model="miniForm.appid" type="text" placeholder="请输入appid"></i-input>
:model="miniForm"
:rules="miniFormRules">
<FormItem label="APPID"
prop="appid">
<i-input v-model="miniForm.appid"
type="text"
placeholder="请输入appid"></i-input>
</FormItem> </FormItem>
<FormItem label="APPID" <FormItem label="URI" prop="uri">
prop="uri"> <i-input v-model="miniForm.uri" type="text" placeholder="请输入URl"></i-input>
<i-input v-model="miniForm.uri"
type="text"
placeholder="请输入URl"></i-input>
</FormItem> </FormItem>
</Form> </Form>
<div slot="footer"> <div slot="footer">
<Button type="primary" <Button type="primary" @click="cancelMini"></Button>
@click="cancelMini">取消</Button> <Button type="primary" @click="okMini"></Button>
<Button type="primary"
@click="okMini">确定</Button>
</div> </div>
</Modal> </Modal>
<selectStoreStep @doShow="doShow" <selectStoreStep :isModify="id>0" @doShow="doShow" :schedule="welcome" :show="showStoreCheck"></selectStoreStep>
:schedule="welcome"
:show="showStoreCheck"></selectStoreStep>
</div> </div>
</template> </template>
<script type="text/javascript"> <script type="text/javascript">
import axios from 'axios' import axios from "axios";
import { isURL } from '../../utils/Common' import { isURL } from "../../utils/Common";
import store from '../../store' import store from "../../store";
import selectStoreStep from '../activity/selectStoreStep' import selectStoreStep from "../activity/selectStoreStep";
import ActivityManager from "../../services/ActivityManager/ActivityManager"; import ActivityManager from "../../services/ActivityManager/ActivityManager";
const validateUrl = (rule, value, callback) => { const validateUrl = (rule, value, callback) => {
const is = isURL(value) const is = isURL(value);
if (is) { if (is) {
callback() callback();
} else { } else {
callback(new Error('URL非法,请以http或https开头')) callback(new Error("URL非法,请以http或https开头"));
} }
} };
export default { export default {
data () { data() {
return { return {
showStoreCheck: false, showStoreCheck: false,
showWeb: false, showWeb: false,
@ -184,54 +134,67 @@ export default {
id: 0, id: 0,
showMessageTypes: false, showMessageTypes: false,
welcome: { welcome: {
content: '', content: "",
params: [], params: [],
company: [], company: [],
stores: [], stores: [],
categoryCode: "welcome",
id: null
}, },
welcomeRules: { welcomeRules: {
content: [ content: [
{ required: true, message: '请输入欢迎语内容', trigger: 'blur' }, { required: true, message: "请输入欢迎语内容", trigger: "blur" },
{ {
type: 'string', type: "string",
max: 100, max: 100,
message: '欢迎语最长100个字符', message: "欢迎语最长100个字符",
trigger: 'blur', trigger: "blur"
}, }
], ]
}, },
webFormRules: { webFormRules: {
url: [ url: [
{ required: true, message: '请输入url', trigger: 'blur' }, { required: true, message: "请输入url", trigger: "blur" },
{ validator: validateUrl, trigger: 'blur' }, { validator: validateUrl, trigger: "blur" }
], ]
}, },
webForm: { url: '' }, webForm: { url: "" },
miniFormRules: { miniFormRules: {
appid: [{ required: true, message: '请输入url', trigger: 'blur' }], appid: [{ required: true, message: "请输入url", trigger: "blur" }],
uri: [{ required: true, message: '请输入url', trigger: 'blur' }], uri: [{ required: true, message: "请输入url", trigger: "blur" }]
},
miniForm: { appid: "", uri: "" }
};
},
watch: {
welcome: {
handler() {
store.commit("SET_useData", {
...store.getters.useData,
...this.welcome
});
}, },
miniForm: { appid: '', uri: '' }, immediate: true,
deep: true
} }
}, },
created () { created() {
this.id = this.$route.query.id this.id = this.$route.query.id;
store.commit('SET_useData', { ...store.getters.useData, ...this.welcome }) // store.commit("SET_useData", { ...store.getters.useData, ...this.welcome });
console.log(this.$route) console.log(this.$route);
if (this.id) { if (this.id) {
this.getDetail(this.id) this.getDetail(this.id);
} }
}, },
components: { components: {
selectStoreStep, selectStoreStep
}, },
methods: { methods: {
doShow () { doShow() {
this.showStoreCheck = false this.showStoreCheck = false;
this.welcome = store.getters.useData this.welcome = store.getters.useData;
console.log(this.welcome)
}, },
getDetail (instanceId) { getDetail(instanceId) {
let _this = this; let _this = this;
ActivityManager.instanceDetail( ActivityManager.instanceDetail(
{ {
@ -239,88 +202,95 @@ export default {
}, },
res => { res => {
_this.welcome = res.data.results; _this.welcome = res.data.results;
store.commit("SET_useData", {
...store.getters.useData,
...this.welcome
});
} }
); );
}, },
showStores () { showStores() {
console.log({ ...store.getters.useData, ...this.welcome }) console.log({ ...store.getters.useData, ...this.welcome });
store.commit('SET_useData', { ...store.getters.useData, ...this.welcome }) store.commit("SET_useData", {
this.showStoreCheck = true ...this.welcome,
...store.getters.useData
});
this.showStoreCheck = true;
}, },
uploadImgSuccess (res, file) { }, uploadImgSuccess(res, file) {},
cancelWeb () { cancelWeb() {
this.showWeb = false this.showWeb = false;
}, },
doShowWeb () { doShowWeb() {
this.showWeb = true this.showWeb = true;
this.webForm = { url: '' } this.webForm = { url: "" };
}, },
doShowMini () { doShowMini() {
this.showMini = true this.showMini = true;
this.miniForm = { this.miniForm = {
appid: '', appid: "",
uri: '', uri: ""
} };
}, },
cancelMini () { cancelMini() {
this.showMini = false this.showMini = false;
}, },
okWeb () { okWeb() {
let _this = this let _this = this;
this.$refs['webForm'].validate((valid) => { this.$refs["webForm"].validate(valid => {
if (valid) { if (valid) {
_this.welcome.params.push({ _this.welcome.params.push({
attr: 2, attr: 2,
defaultVal: this.webForm.url, defaultVal: this.webForm.url,
description: this.webForm.url, description: this.webForm.url,
isRequired: 1, isRequired: 1,
key: 'url', key: "url",
limitLower: null, limitLower: null,
limitUpper: null, limitUpper: null,
name: '网页', name: "网页",
type: 2, type: 2
}) });
this.showWeb = false this.showWeb = false;
this.showMessageTypes = false this.showMessageTypes = false;
} }
}) });
}, },
okMini () { okMini() {
let _this = this let _this = this;
this.$refs['miniForm'].validate((valid) => { this.$refs["miniForm"].validate(valid => {
if (valid) { if (valid) {
_this.welcome.params.push({ _this.welcome.params.push({
attr: 2, attr: 2,
defaultVal: this.miniForm.appid, defaultVal: this.miniForm.appid,
description: this.miniForm.uri, description: this.miniForm.uri,
isRequired: 1, isRequired: 1,
key: 'mini', key: "mini",
limitLower: null, limitLower: null,
limitUpper: null, limitUpper: null,
name: '小程序消息', name: "小程序消息",
type: 3, type: 3
}) });
this.showMini = false this.showMini = false;
this.showMessageTypes = false this.showMessageTypes = false;
} }
}) });
}, },
delActivityInput (index) { delActivityInput(index) {
this.welcome.params.splice(index, 1) this.welcome.params.splice(index, 1);
this.$forceUpdate() this.$forceUpdate();
}, },
handleBeforeUpload (res) { handleBeforeUpload(res) {
const me = this const me = this;
let data = new FormData() let data = new FormData();
data.append('file', res) data.append("file", res);
axios({ axios({
method: 'post', method: "post",
url: '/upload', url: "/upload",
data: data, data: data,
headers: { headers: {
'Content-Type': 'multipart/form-data', "Content-Type": "multipart/form-data"
}, }
}).then(function (res) { }).then(function(res) {
if (res.data.success) { if (res.data.success) {
// me.formValidate.logo = res.data.results; // me.formValidate.logo = res.data.results;
me.welcome.params.push({ me.welcome.params.push({
@ -328,44 +298,44 @@ export default {
defaultVal: res.data.results, defaultVal: res.data.results,
description: res.data.results, description: res.data.results,
isRequired: 1, isRequired: 1,
key: 'image', key: "image",
limitLower: null, limitLower: null,
limitUpper: null, limitUpper: null,
name: '图片', name: "图片",
type: 1, type: 1
}) });
me.showMessageTypes = false me.showMessageTypes = false;
} }
}) });
return false return false;
}, },
submit () { submit() {
let _this = this let _this = this;
if (this.welcome.params.length <= 0) { if (this.welcome.params.length <= 0) {
_this.$Message.error('请添加图片/网页/小程序消息') _this.$Message.error("请添加图片/网页/小程序消息");
} }
if (this.welcome.stores.length <= 0) { if (this.welcome.stores.length <= 0) {
_this.$Message.error('请至少选择一个店铺') _this.$Message.error("请至少选择一个店铺");
} }
this.$refs['welcomeForm'].validate((valid) => { this.$refs["welcomeForm"].validate(valid => {
if (valid) { if (valid) {
let data = _this.welcome let data = _this.welcome;
data.isGetActivityInfo = true data.isGetActivityInfo = true;
axios({ axios({
method: 'post', method: "post",
url: '/activity/instance/saveWelcome', url: "/activity/instance/saveWelcome",
data: data, data: data,
headers: { headers: {
'Content-Type': 'applications/json', "Content-Type": "applications/json"
}, }
}).then((res) => { }).then(res => {
console.log(res) _this.$router.push("/shop/increase/welcome/list");
}) });
} }
}) });
}, }
}, }
} };
</script> </script>
<style scope> <style scope>

@ -1,52 +1,50 @@
<template> <template>
<div> <div>
<Row class="search-row"> <Row class="search-row">
<i-col span="24" <i-col span="24" class="search-col">
class="search-col">
<Row class="row-style"> <Row class="row-style">
<Button @click="handleEdit" <Button @click="handleEdit" type="primary">配置欢迎语</Button>
type="primary">配置欢迎语</Button>
</Row> </Row>
</i-col> </i-col>
</Row> </Row>
<Table :columns="columns1" <Table
:data="data" :columns="columns1"
style="margin-top: 20px;" :data="data"
size="small"> :loading="loading"
<template slot-scope="{ row, index }" style="margin-top: 20px;"
slot="action"> size="small"
<Button type="primary" >
size="small" <template slot-scope="{ row, index }" slot="action">
@click="handleEdit(row, index)">修改</Button> <Button type="primary" size="small" @click="handleEdit(row, index)">修改</Button>
<Button type="error" <Button type="error" size="small" @click="handleDelete(row, index)">删除</Button>
size="small"
@click="handleDelete(row, index)">删除</Button>
</template> </template>
</Table> </Table>
<Page :total="total" <Page
:current="pageNum" :total="total"
:page-size="pageSize" :current="pageNum"
show-elevator :page-size="pageSize"
show-total show-elevator
placement="top" show-total
@on-change="handlePage" placement="top"
class="ks-page"></Page> @on-change="handlePage"
class="ks-page"
></Page>
</div> </div>
</template> </template>
<script> <script>
import data from '../../utils/PhoneRegionData' import data from "../../utils/PhoneRegionData";
import http from '../../services/store/IncreaseStoreManager' import http from "../../services/store/IncreaseStoreManager";
import staff from '../../services/staff/staff' import staff from "../../services/staff/staff";
export default { export default {
name: 'IncreaseWelcomeList', name: "IncreaseWelcomeList",
inject: ['setMenuName'], inject: ["setMenuName"],
data () { data() {
let _this = this let _this = this;
return { return {
loading: true, loading: false,
// //
total: 0, total: 0,
pageSize: 10, pageSize: 10,
@ -55,92 +53,95 @@ export default {
columns1: [ columns1: [
{ {
width: 60, width: 60,
align: 'center', align: "center",
title: '序号', title: "序号",
render (h, params) { render(h, params) {
console.log(params) console.log(params);
let num = parseInt(params.index) + 1 let num = parseInt(params.index) + 1;
console.log(_this.pageSize) console.log(_this.pageSize);
if (_this.pageSize > 1) { if (_this.pageSize > 1) {
num += (_this.pageNum - 1) * _this.pageSize num += (_this.pageNum - 1) * _this.pageSize;
} }
return h('span', num) return h("span", num);
}, }
}, },
{ {
title: '欢迎语', title: "欢迎语",
key: 'scheduleVO.description', key: "scheduleVO.description",
render (h, params) { render(h, params) {
return h('span', params.row.scheduleVO.description) return h("span", params.row.content);
}, }
}, },
{ {
title: '配置范围', title: "配置范围",
key: 'shop', key: "shop",
render (h, params) { render(h, params) {
if (params.row.storeName == null) {
return h("span", "店铺插入中...");
}
return h( return h(
'span', "span",
params.row.companyName + params.row.storeName +
'等' + "等" +
(params.row.companyCount || 0) + (params.row.storeCount || 0) +
'家公司' "家公司"
) );
}, }
}, },
{ title: '配置时间', key: 'createTime' }, { title: "配置时间", key: "createTime" },
{ title: '修改时间', key: 'updateTime' }, { title: "修改时间", key: "updateTime" },
{ title: '操作', slot: 'action' }, { title: "操作", slot: "action" }
], ],
formValidate: {}, formValidate: {}
} };
}, },
mounted () { mounted() {
this.setMenuName('门店推广', '欢迎语') this.setMenuName("门店推广", "欢迎语");
this.handlePaginate() this.handlePaginate();
}, },
methods: { methods: {
// //
handlePaginate () { handlePaginate() {
this.loading = true this.loading = true;
let params = { let params = {
pageNum: this.pageNum, pageNum: this.pageNum,
pageSize: this.pageSize, pageSize: this.pageSize,
userId: JSON.parse(sessionStorage.getItem('loginInfo')).userId, userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId,
categoryCode: 'welcome', categoryCode: "welcome"
} };
http.getWelcomeList(params, (res) => { http.getWelcomeList(params, 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.total = data.total || 0;
this.loading = false this.loading = false;
}) });
}, },
// //
handlePage: function (value) { handlePage: function(value) {
this.pageNum = value this.pageNum = value;
this.handlePaginate();
}, },
// //
handleEdit (row) { handleEdit(row) {
this.$router.push({ this.$router.push({
path: '/shop/increase/welcome/edit', path: "/shop/increase/welcome/edit",
query: { id: row.id }, query: { id: row.id }
}) });
}, },
// //
handleDelete (row) { handleDelete(row) {
let _this = this; let _this = this;
this.$Modal.confirm({ this.$Modal.confirm({
title: '删除欢迎语', title: "删除欢迎语",
content: '您确定要删除该欢迎语?', content: "您确定要删除该欢迎语?",
onOk: () => { onOk: () => {
http.deleteWelcome({ id: row.scheduleId }).then(_this.handlePaginate) http.deleteWelcome({ id: row.scheduleId }).then(_this.handlePaginate);
}, },
onCancel: () => { onCancel: () => {}
}
}); });
}, }
}, }
} };
</script> </script>
<style scoped></style> <style scoped></style>

Loading…
Cancel
Save