feature_0521
zhenghuang 5 years ago
parent 0aa334b34e
commit cb5ec12b4c

@ -3,47 +3,62 @@
<template> <template>
<Row class="search-row"> <Row class="search-row">
<i-col span="8"> <i-col span="8">
<p class="" style="font-size: 16px;line-height: 22px;margin-top: 10px;margin-left: 20px;margin-right: 20px;">招募令</p> <p class=""
<p class="" style="font-size: 13px;line-height: 32px;margin-left: 20px;margin-right: 20px;">便于门店进行推广员招募</p> style="font-size: 16px;line-height: 22px;margin-top: 10px;margin-left: 20px;margin-right: 20px;">招募令</p>
<p class=""
style="font-size: 13px;line-height: 32px;margin-left: 20px;margin-right: 20px;">便于门店进行推广员招募</p>
</i-col> </i-col>
<i-col span="8"> <i-col span="8">
<span class="">使用范围{{welcome.company.length || 0}}家零售公司{{welcome.stores.length || 0}}家店铺</span> <span class="">使用范围{{welcome.company.length || 0}}家零售公司{{welcome.stores.length || 0}}家店铺</span>
<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" @on-change="witchChange"> <i-switch size="large"
<span slot="open">开启</span> @on-change="witchChange">
<span slot="close">关闭</span> <span slot="open">开启</span>
</i-switch> <span slot="close">关闭</span>
</i-switch>
</i-col> </i-col>
</Row> </Row>
<div> <div>
<p style="margin:10px 0 10px -480px;text-align:center">招募海报</p> <p style="margin:10px 0 10px -480px;text-align:center">招募海报</p>
<div style="text-align: center;"> <div style="text-align: center;">
<img style="width:500px;height:500px" :src="imgUrl" alt=""> <img style="width:500px;height:500px"
:src="imgUrl"
alt="">
</div> </div>
<!-- <div style="margin-top:20px;text-align: center;"><Button ghost type="primary">上传</Button></div> --> <!-- <div style="margin-top:20px;text-align: center;"><Button ghost type="primary">上传</Button></div> -->
<Upload v-show="showUpload" ref="upload" <Upload v-show="showUpload"
: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"
action="" multiple
style="padding-top:10px;text-align: center;"> action=""
<Button ghost type="primary">上传</Button> style="padding-top:10px;text-align: center;">
</Upload> <Button ghost
type="primary">上传</Button>
</Upload>
<div style="margin-top:20px;text-align: center;"> <div style="margin-top:20px;text-align: center;">
<Button type="primary" size="large" @click="onEdit" style="margin-right:10px">{{btnStr}}</Button> <Button type="primary"
<Button v-show="showUpload" type="text" size="large" @click="onCancel"></Button> size="large"
@click="onEdit"
style="margin-right:10px">{{btnStr}}</Button>
<Button v-show="showUpload"
type="text"
size="large"
@click="onCancel">取消</Button>
</div> </div>
</div> </div>
</template> </template>
<selectStoreStep @doShow="doShow" <selectStoreStep @doShow="doShow"
:schedule="welcome" :schedule="welcome"
:show="showStoreCheck"></selectStoreStep> :show="showStoreCheck"></selectStoreStep>
</div> </div>
</template> </template>
@ -57,7 +72,7 @@ export default {
components: { components: {
selectStoreStep, selectStoreStep,
}, },
data() { data () {
return { return {
showStoreCheck: false, showStoreCheck: false,
welcome: { welcome: {
@ -66,78 +81,78 @@ export default {
company: [], company: [],
stores: [], stores: [],
}, },
inidData:{}, inidData: {},
showUpload:false, showUpload: false,
btnStr:'编辑', btnStr: '编辑',
imgUrl:'', imgUrl: '',
onWitch:false, onWitch: false,
uploadUrl:"", uploadUrl: "",
oldImg:"" oldImg: ""
}; };
}, },
mounted: function() { mounted: function () {
}, },
created() { created () {
this.initData(); this.initData();
}, },
inject: ['reload'], inject: ['reload'],
methods: { methods: {
witchChange(status) { witchChange (status) {
this.onWitch = 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);
if(data.data.results.scheduleVO.params.length>0){ if (data.data.results.scheduleVO.params.length > 0) {
that.imgUrl = http.getBaseUrl() + data.data.results.scheduleVO.params[0].defaultVal; that.imgUrl = http.getBaseUrl() + data.data.results.scheduleVO.params[0].defaultVal;
that.oldImg = http.getBaseUrl() + data.data.results.scheduleVO.params[0].defaultVal; that.oldImg = http.getBaseUrl() + data.data.results.scheduleVO.params[0].defaultVal;
} }
that.initData = data.data.results; that.initData = data.data.results;
that.welcome = { ...that.initData, company: [...that.initData.organizations] };
}, function (err) { }, function (err) {
that.$Message.error("网络异常,请重试"); that.$Message.error("网络异常,请重试");
that.setNoLoading(); that.setNoLoading();
}); });
}, },
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);
}, },
showStores () { showStores () {
console.log({ ...store.getters.useData, ...this.welcome }) console.log(this.welcome, { ...store.getters.useData, ...this.welcome, ...this.initData })
store.commit('SET_useData', { ...store.getters.useData, ...this.welcome }) store.commit('SET_useData', { ...store.getters.useData, ...this.welcome, ...this.initData })
this.showStoreCheck = true this.showStoreCheck = true
}, },
onEdit(){ onEdit () {
if(this.btnStr == '编辑'){ if (this.btnStr == '编辑') {
this.showUpload = true; this.showUpload = true;
this.btnStr = '保存' this.btnStr = '保存'
}else{ } else {
let _this = this; let _this = this;
this.initData.stores = this.welcome.stores; this.initData.stores = this.welcome.stores;
this.initData.company = this.welcome.company; this.initData.company = this.welcome.company;
let param = this.initData let param = this.initData
if (param.stores.length <= 0) { if (param.stores.length <= 0) {
_this.$Message.error("请至少选择一个店铺"); _this.$Message.error("请至少选择一个店铺");
_this.loading = false; _this.loading = false;
return false; return false;
} }
param.isGetActivityInfo = true; param.isGetActivityInfo = true;
if(this.onWitch){ if (this.onWitch) {
param.status = 1; param.status = 1;
param.stores.forEach(item => { param.stores.forEach(item => {
item.status = 1; item.status = 1;
}) })
}else{ } else {
param.status = 3; param.status = 3;
param.stores.forEach(item => { param.stores.forEach(item => {
item.status = 2; item.status = 2;
}) })
} }
if(this.uploadUrl != ""){ if (this.uploadUrl != "") {
param.scheduleVO.params.forEach(item => { param.scheduleVO.params.forEach(item => {
item.defaultVal = item.description = this.uploadUrl; item.defaultVal = item.description = this.uploadUrl;
@ -147,15 +162,15 @@ export default {
console.log(data); console.log(data);
_this.$Message.info("保存成功"); _this.$Message.info("保存成功");
_this.btnStr = '编辑' _this.btnStr = '编辑'
_this.showUpload = false; _this.showUpload = false;
}, function (err) { }, function (err) {
_this.$Message.error("网络异常,请重试"); _this.$Message.error("网络异常,请重试");
_this.setNoLoading(); _this.setNoLoading();
}); });
} }
}, },
onCancel(){ onCancel () {
this.showUpload = false; this.showUpload = false;
this.imgUrl = this.oldImg; this.imgUrl = this.oldImg;
this.btnStr = '编辑' this.btnStr = '编辑'
}, },

Loading…
Cancel
Save