feature_0521
zhenghuang 6 years ago
parent 74435bbc31
commit eff606391a

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

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

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

@ -4,7 +4,7 @@
* @date 2020/4/14
*/
import http from '../CommonHttp'
import axios from "axios";
import axios from 'axios'
/**
* 上传文件
@ -13,29 +13,32 @@ import axios from "axios";
* @returns {Promise<any | never>}
*/
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) {
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) {
return http.post('/user/add', params).then(call);
return http.post('/user/add', params).then(call)
}
export function downloadImg(params,name, call) {
return http.downloadImg('/user/img/download',name, params).then(call);
export function downloadImg(params, name, call) {
return http.downloadImg('/user/img/download', name, params).then(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) {
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>}
*/
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>}
*/
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() {
return axios.defaults.baseURL;
return axios.defaults.baseURL
}
/**
@ -70,18 +80,33 @@ export function getBaseUrl() {
* @returns {Promise<unknown>}
*/
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 {
uploadUser,
getBaseUrl,
storeList,
addStoreWX,
downloadImg,
downCompanyData,
downBigRegionData,
downloadStoreCode,
downloadStoreSellerCode,
downloadDataListToList
uploadUser,
getBaseUrl,
storeList,
addStoreWX,
downloadImg,
downCompanyData,
downBigRegionData,
downloadStoreCode,
downloadStoreSellerCode,
downloadDataListToList,
getWelcomeList,
deleteWelcome,
}

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

Loading…
Cancel
Save