feature_0521
zhenghuang 6 years ago
parent 74435bbc31
commit eff606391a

@ -6,11 +6,11 @@
:model="welcome" :model="welcome"
:rules="welcomeRules"> :rules="welcomeRules">
<FormItem label="欢迎语内容" <FormItem label="欢迎语内容"
prop="description"> prop="content">
<i-input v-model="welcome.description" <i-input v-model="welcome.content"
type="textarea" type="textarea"
style="height: 220px" style="height: 220px"
:autosize="{minRows: 10,maxRows: 10}" :autosize="{ minRows: 10, maxRows: 10 }"
placeholder="请输入欢迎语内容,最多100个字"></i-input> placeholder="请输入欢迎语内容,最多100个字"></i-input>
</FormItem> </FormItem>
<Row style="margin-bottom: 10px" <Row style="margin-bottom: 10px"
@ -20,7 +20,9 @@
:key="index"> :key="index">
<div v-if="item.type == 3"> <div v-if="item.type == 3">
<i-col style="line-height: 32px" <i-col style="line-height: 32px"
:span="4"> APPID {{ index + 1 }} </i-col> :span="4">
APPID {{ index + 1 }}
</i-col>
<i-col :span="6"> <i-col :span="6">
<i-input class="inputClass" <i-input class="inputClass"
type="text" type="text"
@ -28,7 +30,9 @@
v-model="item.defaultVal"></i-input> v-model="item.defaultVal"></i-input>
</i-col> </i-col>
<i-col style="line-height: 32px" <i-col style="line-height: 32px"
:span="4"> URI {{ index + 1 }} </i-col> :span="4">
URI {{ index + 1 }}
</i-col>
<i-col :span="6"> <i-col :span="6">
<i-input class="inputClass" <i-input class="inputClass"
type="text" type="text"
@ -38,7 +42,9 @@
</div> </div>
<div v-else> <div v-else>
<i-col style="line-height: 32px" <i-col style="line-height: 32px"
:span="4"> {{item.name}}{{ index + 1 }} </i-col> :span="4">
{{ item.name }}{{ index + 1 }}
</i-col>
<i-col :span="16"> <i-col :span="16">
<i-input class="inputClass" <i-input class="inputClass"
type="text" type="text"
@ -53,12 +59,12 @@
</Row> </Row>
<FormItem> <FormItem>
<Button type="text" <Button type="text"
@click="() => showMessageTypes = true" @click="() => (showMessageTypes = true)"
icon="md-add">添加图片/网页/小程序消息</Button> icon="md-add">添加图片/网页/小程序消息</Button>
</FormItem> </FormItem>
<FormItem label="配置范围: "> <FormItem label="配置范围: ">
<span v-if="welcome.stores.length > 0"> <span v-if="welcome.stores.length > 0">
{{welcome.stores[0].name}}{{welcome.stores.length}}家店铺 {{ welcome.stores[0].name }}{{ welcome.stores.length }}家店铺
</span> </span>
<Button type="text" <Button type="text"
@click="showStores" @click="showStores"
@ -156,18 +162,19 @@
</template> </template>
<script type="text/javascript"> <script type="text/javascript">
import axios from "axios"; import axios from 'axios'
import { isURL } from '../../utils/Common'; import { isURL } from '../../utils/Common'
import store from "../../store" import store from '../../store'
import selectStoreStep from '../activity/selectStoreStep'; import selectStoreStep from '../activity/selectStoreStep'
import ActivityManager from "../../services/ActivityManager/ActivityManager";
const validateUrl = (rule, value, callback) => { const validateUrl = (rule, value, callback) => {
const is = isURL(value) const is = isURL(value)
if (is) { if (is) {
callback(); callback()
} else { } else {
callback(new Error('URL非法,请以http或https开头')); callback(new Error('URL非法,请以http或https开头'))
} }
}; }
export default { export default {
data () { data () {
return { return {
@ -177,154 +184,186 @@ export default {
id: 0, id: 0,
showMessageTypes: false, showMessageTypes: false,
welcome: { welcome: {
description: "", content: '',
params: [], params: [],
companys: [], company: [],
name: "欢迎语", stores: [],
stores: []
}, },
welcomeRules: { welcomeRules: {
description: [ content: [
{ required: true, message: "请输入欢迎语内容", trigger: "blur" }, { required: true, message: '请输入欢迎语内容', trigger: 'blur' },
{ type: 'string', max: 100, message: '欢迎语最长100个字符', trigger: 'blur' },] {
type: 'string',
max: 100,
message: '欢迎语最长100个字符',
trigger: 'blur',
},
],
}, },
webFormRules: { webFormRules: {
url: [ url: [
{ required: true, message: "请输入url", trigger: "blur" }, { required: true, message: '请输入url', trigger: 'blur' },
{ validator: validateUrl, trigger: 'blur' }] { validator: validateUrl, trigger: 'blur' },
],
}, },
webForm: { url: "" }, webForm: { url: '' },
miniFormRules: { miniFormRules: {
appid: [ appid: [{ required: true, message: '请输入url', trigger: 'blur' }],
{ required: true, message: "请输入url", trigger: "blur" },], uri: [{ required: true, message: '请输入url', trigger: 'blur' }],
uri: [
{ required: true, message: "请输入url", trigger: "blur" },]
}, },
miniForm: { appid: "", uri: "" } miniForm: { appid: '', uri: '' },
} }
}, },
created () { created () {
this.id = this.$route.query.id 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)
}
}, },
components: { components: {
selectStoreStep selectStoreStep,
}, },
methods: { methods: {
doShow () { doShow () {
this.showStoreCheck = false this.showStoreCheck = false
this.welcome = store.getters.useData this.welcome = store.getters.useData
console.log(this.welcome)
}, },
showStores () { getDetail (instanceId) {
store.commit("SET_useData", { ...store.getters.useData, ...this.welcome }) let _this = this;
this.showStoreCheck = true; ActivityManager.instanceDetail(
{
instanceId
}, },
uploadImgSuccess (res, file) { res => {
_this.welcome = res.data.results;
}
);
}, },
showStores () {
console.log({ ...store.getters.useData, ...this.welcome })
store.commit('SET_useData', { ...store.getters.useData, ...this.welcome })
this.showStoreCheck = true
},
uploadImgSuccess (res, file) { },
cancelWeb () { cancelWeb () {
this.showWeb = false; this.showWeb = false
}, },
doShowWeb () { doShowWeb () {
this.showWeb = true; this.showWeb = true
this.webForm = { url: "" }; this.webForm = { url: '' }
}, },
doShowMini () { doShowMini () {
this.showMini = true; this.showMini = true
this.miniForm = { this.miniForm = {
appid: "", uri: "" appid: '',
}; uri: '',
}
}, },
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) {
_this.welcome.params.push({ _this.welcome.params.push({
attr: "url", attr: 2,
defaultVal: this.webForm.url, defaultVal: this.webForm.url,
description: this.webForm.url, description: this.webForm.url,
isRequired: 1, isRequired: 1,
key: "url", key: 'url',
limitLower: null, limitLower: null,
limitUpper: null, limitUpper: null,
name: "网页", name: '网页',
type: 2 type: 2,
}); })
this.showWeb = false; this.showWeb = false
this.showMessageTypes = false; this.showMessageTypes = false
} }
}) })
}, },
okMini () { okMini () {
let _this = this; let _this = this
this.$refs["miniForm"].validate((valid) => { this.$refs['miniForm'].validate((valid) => {
if (valid) { if (valid) {
_this.welcome.params.push({ _this.welcome.params.push({
attr: "mini", attr: 2,
defaultVal: this.miniForm.appid, defaultVal: this.miniForm.appid,
description: this.miniForm.uri, description: this.miniForm.uri,
isRequired: 1, isRequired: 1,
key: "mini", key: 'mini',
limitLower: null, limitLower: null,
limitUpper: null, limitUpper: null,
name: "小程序消息", name: '小程序消息',
type: 3 type: 3,
}); })
this.showMini = false; this.showMini = false
this.showMessageTypes = false; this.showMessageTypes = false
} }
}) })
}, },
delActivityInput (index) { delActivityInput (index) {
this.welcome.params.splice(index, 1); this.welcome.params.splice(index, 1)
this.$forceUpdate(); this.$forceUpdate()
}, },
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)
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) {
// me.formValidate.logo = res.data.results; // me.formValidate.logo = res.data.results;
me.welcome.params.push({ me.welcome.params.push({
attr: "image", attr: 2,
defaultVal: res.data.results, defaultVal: res.data.results,
description: res.data.results, description: res.data.results,
isRequired: 1, isRequired: 1,
key: "image", key: 'image',
limitLower: null, limitLower: null,
limitUpper: null, limitUpper: null,
name: "图片", name: '图片',
type: 1 type: 1,
}); })
me.showMessageTypes = false; me.showMessageTypes = false
} }
}); })
return false; return false
}, },
submit () { submit () {
let _this = this; let _this = this
if (this.welcome.params.length <= 0) { if (this.welcome.params.length <= 0) {
_this.$Message.error("请添加图片/网页/小程序消息"); _this.$Message.error('请添加图片/网页/小程序消息')
} }
if (this.welcome.stores.length <= 0) { if (this.welcome.stores.length <= 0) {
_this.$Message.error("请至少选择一个店铺"); _this.$Message.error('请至少选择一个店铺')
} }
this.$refs["welcomeForm"].validate((valid) => { this.$refs['welcomeForm'].validate((valid) => {
if (valid) { if (valid) {
console.log(_this.welcome) let data = _this.welcome
} data.isGetActivityInfo = true
axios({
method: 'post',
url: '/activity/instance/saveWelcome',
data: data,
headers: {
'Content-Type': 'applications/json',
},
}).then((res) => {
console.log(res)
}) })
} }
})
},
}, },
} }
</script> </script>

@ -10,16 +10,17 @@
</i-col> </i-col>
</Row> </Row>
<Table :columns="columns1" <Table :columns="columns1"
:data="data"
style="margin-top: 20px;" style="margin-top: 20px;"
size="small"> size="small">
<template slot-scope="{s}" <template slot-scope="{ row, index }"
slot="action"> slot="action">
<Button type="primary" <Button type="primary"
size="small" size="small"
@click="handleEdit(s)">修改</Button> @click="handleEdit(row, index)">修改</Button>
<Button type="error" <Button type="error"
size="small" size="small"
@click="handleDelete(s)">删除</Button> @click="handleDelete(row, index)">删除</Button>
</template> </template>
</Table> </Table>
<Page :total="total" <Page :total="total"
@ -34,81 +35,112 @@
</template> </template>
<script> <script>
import data from "../../utils/PhoneRegionData"; import data from '../../utils/PhoneRegionData'
import http from "../../services/store/IncreaseStoreManager"; import http from '../../services/store/IncreaseStoreManager'
import staff from "../../services/staff/staff"; import staff from '../../services/staff/staff'
export default { export default {
name: "IncreaseWelcomeList", name: 'IncreaseWelcomeList',
inject: ["setMenuName"], inject: ['setMenuName'],
data () { data () {
let _this = this
return { return {
loading: true, loading: true,
// //
total: 0, total: 0,
pageSize: 10, pageSize: 10,
data: [],
pageNum: 1, pageNum: 1,
columns1: [ columns1: [
{ title: "序号", key: "id" }, {
{ title: "欢迎语", key: "content" }, width: 60,
{ title: "配置范围", key: "range" }, align: 'center',
{ title: "配置时间", key: "createdate" }, title: '序号',
{ title: "修改时间", key: "updatedate" }, render (h, params) {
{ title: "操作", slot: "action" }, console.log(params)
], let num = parseInt(params.index) + 1
formValidate: { console.log(_this.pageSize)
if (_this.pageSize > 1) {
num += (_this.pageNum - 1) * _this.pageSize
}
return h('span', num)
},
},
{
title: '欢迎语',
key: 'scheduleVO.description',
render (h, params) {
return h('span', params.row.scheduleVO.description)
}, },
}; },
{
title: '配置范围',
key: 'shop',
render (h, params) {
return h(
'span',
params.row.companyName +
'等' +
(params.row.companyCount || 0) +
'家公司'
)
},
},
{ title: '配置时间', key: 'createTime' },
{ title: '修改时间', key: 'updateTime' },
{ title: '操作', slot: 'action' },
],
formValidate: {},
}
}, },
mounted () { mounted () {
this.setMenuName("门店推广", "欢迎语"); this.setMenuName('门店推广', '欢迎语')
this.handlePaginate(); this.handlePaginate()
}, },
methods: { methods: {
// //
handlePaginate () { handlePaginate () {
this.loading = true; this.loading = true
if (this.formValidate.startDate) { let params = {
this.formValidate.startDate = formatDate(this.formValidate.startDate); pageNum: this.pageNum,
} else { pageSize: this.pageSize,
this.formValidate.startDate = undefined; userId: JSON.parse(sessionStorage.getItem('loginInfo')).userId,
} categoryCode: 'welcome',
if (this.formValidate.endDate) {
this.formValidate.endDate = formatDate(this.formValidate.endDate);
} else {
this.formValidate.endDate = undefined;
} }
params.pageNum = this.pageNum; http.getWelcomeList(params, (res) => {
params.pageSize = this.pageSize; const data = res.data.results.this || {}
params = { ...params, ...this.formValidate }; this.data = data.list || []
params.userId = JSON.parse(sessionStorage.getItem("loginInfo")).userId; this.totalSize = data.total || 0
if (params.status == 0) { this.loading = false
params.status = undefined; })
}
params.date = undefined;
http.get("/activity/instance/list", params).then(res => {
const data = res.data.results.this || {};
this.data = data.list || [];
this.totalSize = data.total || 0;
this.loading = false;
});
}, },
// //
handlePage: function (value) { handlePage: function (value) {
this.pageNum = value; this.pageNum = value
}, },
// //
handleEdit (row) { handleEdit (row) {
this.$router.push({ path: "/shop/increase/welcome/edit", params: { id: row.id } }) this.$router.push({
path: '/shop/increase/welcome/edit',
query: { id: row.id },
})
}, },
// //
handleDelete (row) { handleDelete (row) {
let _this = this;
this.$Modal.confirm({
title: '删除欢迎语',
content: '您确定要删除该欢迎语?',
onOk: () => {
http.deleteWelcome({ id: row.scheduleId }).then(_this.handlePaginate)
},
onCancel: () => {
}
});
}, },
}, },
}; }
</script> </script>
<style scoped> <style scoped></style>
</style>

@ -30,6 +30,7 @@ axios.interceptors.request.use(
//在发送请求之前做某件事 //在发送请求之前做某件事
if (config.method === 'post') { if (config.method === 'post') {
console.log(config)
if (config.data.isGetActivityInfo === true) { if (config.data.isGetActivityInfo === true) {
config.headers['Content-Type'] = 'application/json;charset=UTF-8;' config.headers['Content-Type'] = 'application/json;charset=UTF-8;'
} else if ( } else if (

@ -4,7 +4,7 @@
* @date 2020/4/14 * @date 2020/4/14
*/ */
import http from '../CommonHttp' import http from '../CommonHttp'
import axios from "axios"; import axios from 'axios'
/** /**
* 上传文件 * 上传文件
@ -13,29 +13,32 @@ import axios from "axios";
* @returns {Promise<any | never>} * @returns {Promise<any | never>}
*/ */
export function uploadUser(params, call) { export function uploadUser(params, call) {
return http.post('/store/emp/import', params).then(call); return http.post('/store/emp/import', params).then(call)
} }
export function storeList(params, call, errorCallBack) { export function storeList(params, call, errorCallBack) {
return http.post('/store/emp/list', params).then(call).catch(errorCallBack); return http
.post('/store/emp/list', params)
.then(call)
.catch(errorCallBack)
} }
export function addStoreWX(params, call) { export function addStoreWX(params, call) {
return http.post('/user/add', params).then(call); return http.post('/user/add', params).then(call)
} }
export function downloadImg(params,name, call) { export function downloadImg(params, name, call) {
return http.downloadImg('/user/img/download',name, params).then(call); return http.downloadImg('/user/img/download', name, params).then(call)
} }
/** /**
* 下拉框数据品牌公司 * 下拉框数据品牌公司
*/ */
export function downCompanyData(params, call) { export function downCompanyData(params, call) {
return http.get('/retail/company',params).then(call) return http.get('/retail/company', params).then(call)
} }
/** /**
* 下拉框数据品牌公司 * 下拉框数据品牌公司
*/ */
export function downBigRegionData(params, call) { export function downBigRegionData(params, call) {
return http.get('/retail/big/region',params).then(call) return http.get('/retail/big/region', params).then(call)
} }
/** /**
@ -45,7 +48,9 @@ export function downBigRegionData(params, call) {
* @returns {Promise<any | never>} * @returns {Promise<any | never>}
*/ */
export function downloadStoreCode(params, call) { export function downloadStoreCode(params, call) {
return http.downloadZip('/store/emp/download/store/code/bsd','门店码', params).then(call); return http
.downloadZip('/store/emp/download/store/code/bsd', '门店码', params)
.then(call)
} }
/** /**
* 下载门店导购码 * 下载门店导购码
@ -54,12 +59,17 @@ export function downloadStoreCode(params, call) {
* @returns {Promise<any | never>} * @returns {Promise<any | never>}
*/ */
export function downloadStoreSellerCode(params, call) { export function downloadStoreSellerCode(params, call) {
return http.downloadZip('/store/emp/download/store/seller/code/bsd','门店导购码', params).then(call); return http
.downloadZip(
'/store/emp/download/store/seller/code/bsd',
'门店导购码',
params
)
.then(call)
} }
export function getBaseUrl() { export function getBaseUrl() {
return axios.defaults.baseURL; return axios.defaults.baseURL
} }
/** /**
@ -70,9 +80,22 @@ export function getBaseUrl() {
* @returns {Promise<unknown>} * @returns {Promise<unknown>}
*/ */
export function downloadDataListToList(params, call, errorCallBack) { export function downloadDataListToList(params, call, errorCallBack) {
return http.downloadFileToExcel('/store/emp/download/store/excel/bsd', '推广管理-店铺列表', params).then(call).catch(errorCallBack); return http
.downloadFileToExcel(
'/store/emp/download/store/excel/bsd',
'推广管理-店铺列表',
params
)
.then(call)
.catch(errorCallBack)
} }
export function getWelcomeList(params, call) {
return http.get('/activity/instance/list', params).then(call)
}
export function deleteWelcome(params, call) {
return http.get('/activity/instance/deleteWelcome', params).then(call)
}
export default { export default {
uploadUser, uploadUser,
getBaseUrl, getBaseUrl,
@ -83,5 +106,7 @@ export default {
downBigRegionData, downBigRegionData,
downloadStoreCode, downloadStoreCode,
downloadStoreSellerCode, downloadStoreSellerCode,
downloadDataListToList downloadDataListToList,
getWelcomeList,
deleteWelcome,
} }

@ -7,6 +7,7 @@ const activity = {
id: null, id: null,
name: '', name: '',
params: [], params: [],
content: '',
scheduleId: null, scheduleId: null,
categoryId: 0, categoryId: 0,
categoryCode: 'promotion', categoryCode: 'promotion',

Loading…
Cancel
Save