feature_0521
zhenghuang 5 years ago
parent f1fb32f841
commit 4e3e08705a

@ -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: {

@ -2,167 +2,227 @@
<div class> <div class>
<Row> <Row>
<i-col :span="12"> <i-col :span="12">
<Form ref="welcomeForm" :model="welcome" :rules="welcomeRules"> <Form ref="welcomeForm"
<FormItem label="欢迎语内容" prop="content"> :model="welcome"
<i-input :rules="welcomeRules">
v-model="welcome.content" <FormItem label="欢迎语内容"
type="textarea" prop="content">
style="height: 220px" <i-input v-model="welcome.content"
:autosize="{ minRows: 10, maxRows: 10 }" type="textarea"
placeholder="请输入欢迎语内容,最多100个字" style="height: 220px"
></i-input> :autosize="{ minRows: 10, maxRows: 10 }"
placeholder="请输入欢迎语内容,最多100个字"></i-input>
</FormItem> </FormItem>
<Row <Row style="margin-bottom: 10px"
style="margin-bottom: 10px" :gutter="10"
:gutter="10" class="inputItem"
class="inputItem" v-for="(item, index) in welcome.params"
v-for="(item, index) in welcome.params" :key="index">
:key="index"
>
<div v-if="item.type == 3"> <div v-if="item.type == 3">
<i-col style="line-height: 32px" :span="2">标题 {{ index + 1 }}</i-col> <i-col style="line-height: 32px"
:span="2">标题 {{ index + 1 }}</i-col>
<i-col :span="3"> <i-col :span="3">
<i-input class="inputClass" type="text" disabled v-model="item.key"></i-input> <i-input class="inputClass"
type="text"
disabled
v-model="item.key"></i-input>
</i-col> </i-col>
<i-col style="line-height: 32px" :span="2">APPID {{ index + 1 }}</i-col> <i-col style="line-height: 32px"
:span="2">APPID {{ index + 1 }}</i-col>
<i-col :span="3"> <i-col :span="3">
<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>
<i-col style="line-height: 32px" :span="2">URI {{ index + 1 }}</i-col> <i-col style="line-height: 32px"
:span="2">URI {{ index + 1 }}</i-col>
<i-col :span="3"> <i-col :span="3">
<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="2">MediaId{{ index + 1 }}</i-col> <i-col style="line-height: 32px"
:span="2">MediaId{{ index + 1 }}</i-col>
<i-col :span="3"> <i-col :span="3">
<i-input class="inputClass" type="text" disabled v-model="item.limitLower"></i-input> <i-input class="inputClass"
type="text"
disabled
v-model="item.limitLower"></i-input>
</i-col> </i-col>
</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"
<i-col :span="8"> :span="4">标题 {{ index + 1 }}</i-col>
<i-input class="inputClass" type="text" disabled v-model="item.description"></i-input> <i-col :span="6">
<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"
<i-col :span="8"> :span="4">URL {{ index + 1 }}</i-col>
<i-input class="inputClass" type="text" disabled v-model="item.defaultVal"></i-input> <i-col :span="6">
<i-input class="inputClass"
type="text"
disabled
v-model="item.defaultVal"></i-input>
</i-col> </i-col>
</div> </div>
<div v-else> <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-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> </i-col>
</div> </div>
<i-col :span="4"> <i-col :span="4">
<Button type="error" @click="delActivityInput(index)"></Button> <Button type="error"
@click="delActivityInput(index)">删除</Button>
</i-col> </i-col>
</Row> </Row>
<FormItem> <FormItem>
<Button type="text" @click="() => (showMessageTypes = true)" icon="md-add">添加图片/网页/小程序消息</Button> <Button type="text"
@click="() => (showMessageTypes = true)"
icon="md-add">添加图片/网页/小程序消息</Button>
</FormItem> </FormItem>
<FormItem label="配置范围: "> <FormItem label="配置范围: ">
<span <span @click="showStores"
@click="showStores" v-if="welcome.stores.length > 0">{{ welcome.stores[0].name }}{{ welcome.stores.length }}家店铺</span>
v-if="welcome.stores.length > 0" <Button type="text"
>{{ welcome.stores[0].name }}{{ welcome.stores.length }}家店铺</span> v-if="welcome.stores.length <= 0"
<Button @click="showStores"
type="text" icon="md-add">全部店铺</Button>
v-if="welcome.stores.length <= 0"
@click="showStores"
icon="md-add"
>全部店铺</Button>
</FormItem> </FormItem>
<FormItem> <FormItem>
<Button type="primary" long @click="submit"></Button> <Button type="primary"
long
@click="submit">确定</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">
<Upload <Upload ref="upload"
ref="upload" :show-upload-list="false"
:show-upload-list="false" :on-success="uploadImgSuccess"
:on-success="uploadImgSuccess" :format="['jpg', 'jpeg', 'png']"
:format="['jpg', 'jpeg', 'png']" :max-size="2048"
:max-size="2048" :on-exceeded-size="onExceededSize"
:on-exceeded-size="onExceededSize" :before-upload="handleBeforeUpload"
:before-upload="handleBeforeUpload" multiple
multiple type="drag"
type="drag" action
action style="width: 100%;">
style="width: 100%;"
>
<div style="width: 100%;"> <div style="width: 100%;">
<Button long type="primary">{{imageUploading ? "上传中..." : "图片"}}</Button> <Button long
type="primary">{{imageUploading ? "上传中..." : "图片"}}</Button>
</div> </div>
</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"
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"
type="primary">小程序</Button>
</i-col> </i-col>
</Row> </Row>
</Modal> </Modal>
<Modal v-model="showWeb" title="添加网页消息" :loading="true"> <Modal v-model="showWeb"
<Form ref="webForm" :model="webForm" :rules="webFormRules"> title="添加网页消息"
<FormItem label="标题" prop="url"> :loading="true">
<i-input v-model="webForm.title" type="text" placeholder="请输入网页标题"></i-input> <Form ref="webForm"
:model="webForm"
:rules="webFormRules">
<FormItem label="标题"
prop="title">
<i-input v-model="webForm.title"
type="text"
placeholder="请输入网页标题"></i-input>
</FormItem> </FormItem>
<FormItem label="添加网页消息" prop="url"> <FormItem label="添加网页消息"
<i-input v-model="webForm.url" type="text" placeholder="以http或https开头"></i-input> 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" @click="cancelWeb"></Button> <Button type="primary"
<Button type="primary" @click="okWeb"></Button> @click="cancelWeb">取消</Button>
<Button type="primary"
@click="okWeb">确定</Button>
</div> </div>
</Modal> </Modal>
<Modal v-model="showMini" title="添加小程序消息" :loading="true"> <Modal v-model="showMini"
<Form ref="miniForm" :model="miniForm" :rules="miniFormRules"> title="添加小程序消息"
<FormItem label="标题" prop="key"> :loading="true">
<i-input v-model="miniForm.key" type="text" placeholder="请输入标题"></i-input> <Form ref="miniForm"
:model="miniForm"
:rules="miniFormRules">
<FormItem label="标题"
prop="key">
<i-input v-model="miniForm.key"
type="text"
placeholder="请输入标题"></i-input>
</FormItem> </FormItem>
<FormItem label="APPID" prop="appid"> <FormItem label="APPID"
<i-input v-model="miniForm.appid" type="text" placeholder="请输入appid"></i-input> prop="appid">
<i-input v-model="miniForm.appid"
type="text"
placeholder="请输入appid"></i-input>
</FormItem> </FormItem>
<FormItem label="URI" prop="uri"> <FormItem label="URI"
<i-input v-model="miniForm.uri" type="text" placeholder="请输入URl"></i-input> prop="uri">
<i-input v-model="miniForm.uri"
type="text"
placeholder="请输入URl"></i-input>
</FormItem> </FormItem>
<FormItem label="封面图"> <FormItem label="封面图">
<Upload <Upload ref="upload"
ref="upload" :show-upload-list="false"
:show-upload-list="false" :on-success="miniUploadImgSuccess"
:on-success="miniUploadImgSuccess" :format="['jpg', 'jpeg', 'png']"
:format="['jpg', 'jpeg', 'png']" :max-size="2048"
:max-size="2048" :before-upload="handleBeforeUploadMini"
:before-upload="handleBeforeUploadMini" multiple
multiple type="drag"
type="drag" action
action style="display: inline-block;">
style="display: inline-block;"
>
<div style="width: 200px;height:200px;line-height: 200px;border:1px dashed #dedede"> <div style="width: 200px;height:200px;line-height: 200px;border:1px dashed #dedede">
<span v-if="!miniForm.limitUpper"></span> <span v-if="!miniForm.limitUpper"></span>
<img <img v-if="miniForm.limitUpper"
v-if="miniForm.limitUpper" :src="`/kiisoo-ic` + miniForm.limitUpper"
:src="`/kiisoo-ic` + miniForm.limitUpper" alt
alt style="width: 100%; height: auto" />
style="width: 100%; height: auto"
/>
</div> </div>
</Upload> </Upload>
</FormItem> </FormItem>
</Form> </Form>
<div slot="footer"> <div slot="footer">
<Button type="primary" @click="cancelMini"></Button> <Button type="primary"
<Button type="primary" @click="okMini"></Button> @click="cancelMini">取消</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>
@ -181,7 +241,7 @@ const validateUrl = (rule, value, callback) => {
} }
}; };
export default { export default {
data() { data () {
return { return {
showStoreCheck: false, showStoreCheck: false,
showWeb: false, showWeb: false,
@ -226,7 +286,7 @@ export default {
}, },
watch: { watch: {
welcome: { welcome: {
handler() { handler () {
store.commit("SET_useData", { store.commit("SET_useData", {
...store.getters.useData, ...store.getters.useData,
...this.welcome ...this.welcome
@ -236,7 +296,7 @@ export default {
deep: 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);
@ -248,14 +308,14 @@ export default {
selectStoreStep selectStoreStep
}, },
methods: { methods: {
doShow() { doShow () {
this.showStoreCheck = false; this.showStoreCheck = false;
this.welcome = store.getters.useData; this.welcome = store.getters.useData;
}, },
onExceededSize() { onExceededSize () {
console.log("失败"); console.log("失败");
}, },
getDetail(instanceId) { getDetail (instanceId) {
let _this = this; let _this = this;
ActivityManager.instanceDetail( ActivityManager.instanceDetail(
{ {
@ -270,7 +330,7 @@ export default {
} }
); );
}, },
showStores() { showStores () {
console.log({ ...store.getters.useData, ...this.welcome }); console.log({ ...store.getters.useData, ...this.welcome });
store.commit("SET_useData", { store.commit("SET_useData", {
...this.welcome, ...this.welcome,
@ -278,16 +338,16 @@ export default {
}); });
this.showStoreCheck = true; this.showStoreCheck = true;
}, },
uploadImgSuccess(res, file) {}, uploadImgSuccess (res, file) { },
miniUploadImgSuccess(res, file) {}, miniUploadImgSuccess (res, file) { },
cancelWeb() { cancelWeb () {
this.showWeb = false; this.showWeb = false;
}, },
doShowWeb() { doShowWeb () {
this.showWeb = true; this.showWeb = true;
this.webForm = { url: "", title: "" }; this.webForm = { url: "", title: "" };
}, },
doShowMini() { doShowMini () {
this.showMini = true; this.showMini = true;
this.miniForm = { this.miniForm = {
appid: "", appid: "",
@ -297,10 +357,10 @@ export default {
key: "" key: ""
}; };
}, },
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) {
@ -320,7 +380,7 @@ export default {
} }
}); });
}, },
okMini() { okMini () {
let _this = this; let _this = this;
this.$refs["miniForm"].validate(valid => { this.$refs["miniForm"].validate(valid => {
if (valid) { if (valid) {
@ -340,11 +400,11 @@ export default {
} }
}); });
}, },
delActivityInput(index) { delActivityInput (index) {
this.welcome.params.splice(index, 1); this.welcome.params.splice(index, 1);
this.$forceUpdate(); this.$forceUpdate();
}, },
handleBeforeUploadMini(res) { handleBeforeUploadMini (res) {
const me = this; const me = this;
let data = new FormData(); let data = new FormData();
data.append("file", res); data.append("file", res);
@ -358,7 +418,7 @@ export default {
headers: { headers: {
"Content-Type": "multipart/form-data" "Content-Type": "multipart/form-data"
} }
}).then(function(res) { }).then(function (res) {
me.imageUploading = false; me.imageUploading = false;
if (res.data.success) { if (res.data.success) {
// me.formValidate.logo = res.data.results; // me.formValidate.logo = res.data.results;
@ -369,7 +429,7 @@ export default {
}); });
return false; return false;
}, },
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);
@ -383,7 +443,7 @@ export default {
headers: { headers: {
"Content-Type": "multipart/form-data" "Content-Type": "multipart/form-data"
} }
}).then(function(res) { }).then(function (res) {
me.imageUploading = false; me.imageUploading = false;
if (res.data.success) { if (res.data.success) {
// me.formValidate.logo = res.data.results; // me.formValidate.logo = res.data.results;
@ -403,7 +463,7 @@ export default {
}); });
return false; return false;
}, },
submit() { submit () {
let _this = this; let _this = this;
if (this.welcome.stores.length <= 0) { if (this.welcome.stores.length <= 0) {
_this.$Message.error("请至少选择一个店铺"); _this.$Message.error("请至少选择一个店铺");

@ -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>

Loading…
Cancel
Save