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

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

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

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

Loading…
Cancel
Save