feature_0521
zhenghuang 5 years ago
parent 41fa3848cc
commit 6d58d0f638

@ -4,18 +4,25 @@
<Row class="search-row"> <Row class="search-row">
<i-col span="8"> <i-col span="8">
<p class="" <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="" <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>
<i-col span="8"> <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="" <span class=""
style="border: 0px; color: rgb(52, 150, 235); margin-left: 15px; cursor: pointer;" style="border: 0px; color: rgb(52, 150, 235); margin-left: 15px; cursor: pointer;"
@click="showStores">修改</span> @click="showStores">修改</span>
</i-col> </i-col>
<i-col span="8"> <i-col span="8">
<i-switch size="large" <i-switch size="large"
v-model="recruit.status !== undefined && recruit.status == 2"
@on-change="witchChange"> @on-change="witchChange">
<span slot="open">开启</span> <span slot="open">开启</span>
<span slot="close">关闭</span> <span slot="close">关闭</span>
@ -26,9 +33,8 @@
<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" <img style="width:500px;height:500px"
:src="imgUrl" :src="recruit.logo"
alt=""> 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" <Upload v-show="showUpload"
@ -57,7 +63,7 @@
</div> </div>
</template> </template>
<selectStoreStep @doShow="doShow" <selectStoreStep @doShow="doShow"
:schedule="welcome" :schedule="recruit"
:show="showStoreCheck"></selectStoreStep> :show="showStoreCheck"></selectStoreStep>
</div> </div>
</template> </template>
@ -66,8 +72,8 @@
import selectStoreStep from '../activity/selectStoreStep' import selectStoreStep from '../activity/selectStoreStep'
import store from '../../store' import store from '../../store'
import bulletinService from '../../services/recruit/Bulletin' import bulletinService from '../../services/recruit/Bulletin'
import http from '../../services/CommonHttp'; import http from '../../services/CommonHttp'
import axios from "axios"; import axios from 'axios'
export default { export default {
components: { components: {
selectStoreStep, selectStoreStep,
@ -75,131 +81,180 @@ export default {
data () { data () {
return { return {
showStoreCheck: false, 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: '', content: '',
params: [], params: [],
company: [], organizations: [],
stores: [], stores: [],
}, },
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; 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 () { initData () {
let that = this; let that = this
bulletinService.getDetail({}, function (data) { bulletinService.getDetail(
console.log(data); {},
function (data) {
if (data.data.results !== null) {
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 = data.data.results.scheduleVO.params[0].defaultVal
that.oldImg = http.getBaseUrl() + data.data.results.scheduleVO.params[0].defaultVal; that.oldImg = data.data.results.scheduleVO.params[0].defaultVal
} }
that.initData = data.data.results; that.initData = { ...that.initData, ...data.data.results }
that.welcome = { ...that.initData, company: [...that.initData.organizations] }; }
}, function (err) { },
that.$Message.error("网络异常,请重试"); function (err) {
that.setNoLoading(); that.$Message.error('网络异常,请重试')
}); that.setNoLoading()
}
)
}, },
doShow () { doShow () {
this.showStoreCheck = false this.showStoreCheck = false
this.welcome = store.getters.useData this.recruit = { ...this.recruit, ...store.getters.useData }
console.log('@', this.welcome);
}, },
showStores () { showStores () {
console.log(this.welcome, { ...store.getters.useData, ...this.welcome, ...this.initData }) store.commit('SET_useData', {
store.commit('SET_useData', { ...store.getters.useData, ...this.welcome, ...this.initData }) ...store.getters.useData,
...this.recruit,
})
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; let param = { ...this.recruit }
this.initData.company = this.welcome.company;
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.uploadUrl != '') {
param.status = 1; param.scheduleVO.params.forEach((item) => {
param.stores.forEach(item => { item.defaultVal = item.description = this.uploadUrl
item.status = 1;
})
} else {
param.status = 3;
param.stores.forEach(item => {
item.status = 2;
}) })
} }
if (this.uploadUrl != "") { bulletinService.dosave(
param.scheduleVO.params.forEach(item => { param,
item.defaultVal = item.description = this.uploadUrl; function (data) {
console.log(data)
}) _this.$Message.info('保存成功')
}
bulletinService.dosave(param, function (data) {
console.log(data);
_this.$Message.info("保存成功");
_this.btnStr = '编辑' _this.btnStr = '编辑'
_this.showUpload = false; _this.showUpload = false
}, function (err) { },
_this.$Message.error("网络异常,请重试"); function (err) {
_this.setNoLoading(); _this.$Message.error('网络异常,请重试')
}); _this.setNoLoading()
}
)
} }
}, },
onCancel () { onCancel () {
this.showUpload = false; this.showUpload = false
this.imgUrl = this.oldImg; this.imgUrl = this.oldImg
this.btnStr = '编辑' this.btnStr = '编辑'
}, },
uploadImgSuccess (res, file) { uploadImgSuccess (res, file) {
this.imageName = file.name; this.imageName = file.name
}, },
handleBeforeUpload (res) { handleBeforeUpload (res) {
const _this = this; const _this = 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) {
console.log(res); console.log(res)
_this.uploadUrl = res.data.results.localPath; _this.uploadUrl = res.data.results.localPath
_this.imgUrl = 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> </script>
<style scoped> <style scoped></style>
</style>

Loading…
Cancel
Save