feature_0521
zhenghuang 5 years ago
parent 41fa3848cc
commit 6d58d0f638

@ -4,18 +4,25 @@
<Row class="search-row">
<i-col span="8">
<p class=""
style="font-size: 16px;line-height: 22px;margin-top: 10px;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>
style="font-size: 13px;line-height: 32px;margin-left: 20px;margin-right: 20px;">
便于门店进行推广员招募
</p>
</i-col>
<i-col span="8">
<span class="">使用范围{{welcome.company.length || 0}}家零售公司{{welcome.stores.length || 0}}家店铺</span>
<span class="">使用范围{{ recruit.organizations.length || 0 }}家零售公司{{
recruit.stores.length || 0
}}家店铺</span>
<span class=""
style="border: 0px; color: rgb(52, 150, 235); margin-left: 15px; cursor: pointer;"
@click="showStores">修改</span>
</i-col>
<i-col span="8">
<i-switch size="large"
v-model="recruit.status !== undefined && recruit.status == 2"
@on-change="witchChange">
<span slot="open">开启</span>
<span slot="close">关闭</span>
@ -26,9 +33,8 @@
<p style="margin:10px 0 10px -480px;text-align:center">招募海报</p>
<div style="text-align: center;">
<img style="width:500px;height:500px"
:src="imgUrl"
alt="">
:src="recruit.logo"
alt="" />
</div>
<!-- <div style="margin-top:20px;text-align: center;"><Button ghost type="primary">上传</Button></div> -->
<Upload v-show="showUpload"
@ -48,7 +54,7 @@
<Button type="primary"
size="large"
@click="onEdit"
style="margin-right:10px">{{btnStr}}</Button>
style="margin-right:10px">{{ btnStr }}</Button>
<Button v-show="showUpload"
type="text"
size="large"
@ -57,7 +63,7 @@
</div>
</template>
<selectStoreStep @doShow="doShow"
:schedule="welcome"
:schedule="recruit"
:show="showStoreCheck"></selectStoreStep>
</div>
</template>
@ -66,8 +72,8 @@
import selectStoreStep from '../activity/selectStoreStep'
import store from '../../store'
import bulletinService from '../../services/recruit/Bulletin'
import http from '../../services/CommonHttp';
import axios from "axios";
import http from '../../services/CommonHttp'
import axios from 'axios'
export default {
components: {
selectStoreStep,
@ -75,131 +81,180 @@ export default {
data () {
return {
showStoreCheck: false,
welcome: {
recruit: {
id: null,
status: 0,
scheduleId: null,
scheduleVO: {
id: null,
name: "招募令",
categoryId: 0,
categoryCode: 'recruit',
logo: "",
description: "",
appId: "",
welcome: "",
title: "招募令",
mediaId: "",
uri: "",
params: [],
},
categoryCode: 'recruit',
name: null,
beginTime: '2020-06-03',
endTime: '2020-06-22',
content: '',
params: [],
company: [],
organizations: [],
stores: [],
},
inidData: {},
showUpload: false,
btnStr: '编辑',
imgUrl: '',
onWitch: false,
uploadUrl: "",
oldImg: ""
};
},
mounted: function () {
uploadUrl: '',
oldImg: '',
}
},
mounted: function () { },
created () {
this.initData();
this.initData()
},
inject: ['reload'],
methods: {
witchChange (status) {
this.onWitch = status;
if (status) {
this.recruit.status = 2
this.recruit.scheduleVO.status = 1;
this.recruit.scheduleVO.params.forEach((item) => {
item.status = 1
})
this.recruit.params.forEach((item) => {
item.status = 1
})
this.recruit.stores.forEach((item) => {
item.status = 1
})
} else {
this.recruit.status = 3
this.recruit.scheduleVO.status = 2;
this.recruit.scheduleVO.params.forEach((item) => {
item.status = 2
})
this.recruit.params.forEach((item) => {
item.status = 2
})
this.recruit.stores.forEach((item) => {
item.status = 2
})
}
},
initData () {
let that = this;
bulletinService.getDetail({}, function (data) {
console.log(data);
if (data.data.results.scheduleVO.params.length > 0) {
that.imgUrl = http.getBaseUrl() + data.data.results.scheduleVO.params[0].defaultVal;
that.oldImg = http.getBaseUrl() + data.data.results.scheduleVO.params[0].defaultVal;
let that = this
bulletinService.getDetail(
{},
function (data) {
if (data.data.results !== null) {
if (data.data.results.scheduleVO.params.length > 0) {
that.imgUrl = data.data.results.scheduleVO.params[0].defaultVal
that.oldImg = data.data.results.scheduleVO.params[0].defaultVal
}
that.initData = { ...that.initData, ...data.data.results }
}
},
function (err) {
that.$Message.error('网络异常,请重试')
that.setNoLoading()
}
that.initData = data.data.results;
that.welcome = { ...that.initData, company: [...that.initData.organizations] };
}, function (err) {
that.$Message.error("网络异常,请重试");
that.setNoLoading();
});
)
},
doShow () {
this.showStoreCheck = false
this.welcome = store.getters.useData
console.log('@', this.welcome);
this.recruit = { ...this.recruit, ...store.getters.useData }
},
showStores () {
console.log(this.welcome, { ...store.getters.useData, ...this.welcome, ...this.initData })
store.commit('SET_useData', { ...store.getters.useData, ...this.welcome, ...this.initData })
store.commit('SET_useData', {
...store.getters.useData,
...this.recruit,
})
this.showStoreCheck = true
},
onEdit () {
if (this.btnStr == '编辑') {
this.showUpload = true;
this.showUpload = true
this.btnStr = '保存'
} else {
let _this = this;
this.initData.stores = this.welcome.stores;
this.initData.company = this.welcome.company;
let param = this.initData
let _this = this
let param = { ...this.recruit }
if (param.stores.length <= 0) {
_this.$Message.error("请至少选择一个店铺");
_this.loading = false;
return false;
_this.$Message.error('请至少选择一个店铺')
_this.loading = false
return false
}
param.isGetActivityInfo = true;
if (this.onWitch) {
param.status = 1;
param.stores.forEach(item => {
item.status = 1;
})
} else {
param.status = 3;
param.stores.forEach(item => {
item.status = 2;
})
}
if (this.uploadUrl != "") {
param.scheduleVO.params.forEach(item => {
item.defaultVal = item.description = this.uploadUrl;
param.isGetActivityInfo = true
if (this.uploadUrl != '') {
param.scheduleVO.params.forEach((item) => {
item.defaultVal = item.description = this.uploadUrl
})
}
bulletinService.dosave(param, function (data) {
console.log(data);
_this.$Message.info("保存成功");
_this.btnStr = '编辑'
_this.showUpload = false;
}, function (err) {
_this.$Message.error("网络异常,请重试");
_this.setNoLoading();
});
bulletinService.dosave(
param,
function (data) {
console.log(data)
_this.$Message.info('保存成功')
_this.btnStr = '编辑'
_this.showUpload = false
},
function (err) {
_this.$Message.error('网络异常,请重试')
_this.setNoLoading()
}
)
}
},
onCancel () {
this.showUpload = false;
this.imgUrl = this.oldImg;
this.showUpload = false
this.imgUrl = this.oldImg
this.btnStr = '编辑'
},
uploadImgSuccess (res, file) {
this.imageName = file.name;
this.imageName = file.name
},
handleBeforeUpload (res) {
const _this = this;
let data = new FormData();
data.append("file", res);
const _this = 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",
'Content-Type': 'multipart/form-data',
},
}).then(function (res) {
if (res.data.success) {
console.log(res);
_this.uploadUrl = res.data.results.localPath;
_this.imgUrl = res.data.results.localPath;
console.log(res)
_this.uploadUrl = res.data.results.localPath
_this.imgUrl = res.data.results.localPath
_this.recruit.params = [{
attr: 2,
defaultVal: res.data.results.localPath,
description: "",
isRequired: 1,
key: "recruitImage",
limitLower: "",
limitUpper: "",
name: "recruitImage",
type: 1
}]
_this.recruit.scheduleVO = _this.recruit.params
_this.recruit.scheduleVO.logo = res.data.results.localPath
}
});
return false;
})
return false
},
},
};
}
</script>
<style scoped>
</style>
<style scoped></style>

Loading…
Cancel
Save