Commit d10d5159 by 周子尧

Merge branch 'v1.2.0' of http://192.168.3.233:8090/saas/scrm-micro-marketing into v1.2.0

2 parents 066d8515 71e8f65b
...@@ -57,7 +57,7 @@ export default { ...@@ -57,7 +57,7 @@ export default {
line-height: 36px; line-height: 36px;
} }
#app { #app {
padding: 0px 20px 20px 40px; padding: 0px 20px 20px 20px;
// overflow-y: auto; // overflow-y: auto;
margin-right: 20px; margin-right: 20px;
height: 100%; height: 100%;
......
...@@ -171,6 +171,10 @@ html { ...@@ -171,6 +171,10 @@ html {
margin-top: 10px; margin-top: 10px;
} }
.marketing .m-b-10 {
margin-bottom: 10px;
}
.marketing .m-b-20 { .marketing .m-b-20 {
margin-bottom: 20px; margin-bottom: 20px;
} }
......
...@@ -207,5 +207,23 @@ const staticRoutes = Object.freeze([{ ...@@ -207,5 +207,23 @@ const staticRoutes = Object.freeze([{
component: resolve => require([`@/views/memberCenter/record.vue`], resolve), component: resolve => require([`@/views/memberCenter/record.vue`], resolve),
meta: {} meta: {}
}, },
{
name: 'giftBag',
path: '/giftBag/index',
component: resolve => require([`@/views/giftBag/index.vue`], resolve),
meta: {}
},
{
name: 'giftDetail',
path: '/giftBag/giftDetail',
component: resolve => require([`@/views/giftBag/giftDetail.vue`], resolve),
meta: {}
},
{
name: 'editGift',
path: '/giftBag/editGift',
component: resolve => require([`@/views/giftBag/editGift.vue`], resolve),
meta: {}
}
]) ])
export default staticRoutes export default staticRoutes
\ No newline at end of file \ No newline at end of file
<!-- 编辑专区 -->
<template>
<div class="edit-gift marketing p-t-20 edit-box">
<div class="container edit-container">
<p class="edit-title">{{ title }}</p>
<glsx-combi-form class="edit-form-container m-r-20" ref="editFormRef" :isEdit="isEdit" :labelWidth="labelWidth" defaultWidth="320px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule"></glsx-combi-form>
</div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="primary" @click="handleConfirm">确定</el-button>
<el-button type="default" @click="handleCancel">取消</el-button>
</div>
</div>
</template>
<script>
export default {
name: 'editGift',
data() {
return {
size: 'small',
title: '新增信息',
titleObj: {
add: '新增信息',
edit: '编辑信息'
},
footerLeft: '0',
footerWidth: '0',
editChildRef: 'editChildRef',
routeInfo: {
// add-新增;edit-编辑;look-查看
addOrEdit: 'add',
id: ''
},
editStatus: false,
labelWidth: '144px',
editForm: {
name: ''
},
editRule: {
name: [{ required: true, message: '请输入礼包名称', trigger: 'change' }]
// zoneImg: [{ required: true, message: '请选择专区图片', trigger: 'change' }]
},
isEdit: true,
editFormData: [
{
label: '礼包名称',
name: 'name',
type: 'input',
maxlength: 15
},
{
label: '备注名称',
name: 'remarkName',
type: 'input',
maxlength: 30
}
// {
// label: '专区图片',
// name: 'zoneImg',
// type: 'upload',
// limitSize: 10,
// maxPhotoNum: 1,
// handleUpload: (e, file, targetItem) => {
// const imgFile = e.target.result
// const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
// this.$apis.common.uploadImgApi({ file: base64, fileType: 'image' }).then(res => {
// this.editForm[targetItem.name] = res
// this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name)
// })
// }
// }
]
}
},
watch: {
editForm: {
handler(val) {
this.editStatus = true
},
deep: true
}
},
mounted() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.routeInfo = this.$route.query
console.log(this.routeInfo.addOrEdit)
this.title = this.titleObj[this.routeInfo.addOrEdit]
this.routeInfo.addOrEdit != 'add' ? this.getInfo() : ''
},
methods: {
getInfo() {
// this.$apis.zoneList.getZoneInfoApi({ id: this.routeInfo.id }).then(res => {
// this.editForm.name = res.name
// this.editForm.zoneImg = res.zoneImg
// this.editForm.merchantList = res.merchantRefList
// this.editForm.merchantList.forEach(item => {
// item.merchantNo = item.merchantId
// })
// this.$nextTick(() => {
// this.editStatus = false
// })
// })
},
handleConfirm() {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
var params = this.$common.utils.deepClone(this.editForm)
if (this.routeInfo.addOrEdit == 'edit') {
params.id = this.routeInfo.id
}
params.merchantList = []
this.editForm.merchantList.forEach(item => {
params.merchantList.push({
merchantId: item.merchantNo,
merchantName: item.merchantName,
merchantAccountLevel: item.merchantAccountLevel
})
})
// console.log(params)
this.$apis.zoneList.insertZoneApi(params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : '操作失败',
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.cancelJump()
}
})
}
})
},
cancelJump() {
this.$router.push({
path: '/giftBag/index'
})
},
handleCancel() {
if (this.editStatus) {
this.$confirm('当前有内容信息未保存,是否继续返回?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.cancelJump()
})
.catch(() => { })
} else {
this.cancelJump()
}
}
}
}
</script>
<style scoped>
.marketing.edit-gift .select-merchant {
/* width: calc(98% - 140px); */
width: 98%;
}
</style>
<template>
<div>
</div>
</template>
<script>
export default {
name: 'giftDetail',
data() {
return {
}
},
mounted() {
},
methods: {
},
};
</script>
<style lang="scss" scoped>
</style>
\ No newline at end of file \ No newline at end of file
<!-- 定向礼包-->
<template>
<div class="marketing p-t-20">
<div class="m-b-10">
<el-button :size="size" type="primary" class="el-icon-plus" @click="handleEdit('add')">新增礼包</el-button>
<!-- <GLButton :size="size" type="primary" fn="新增礼包" class="el-icon-plus" @click="handleEdit('add')">新增礼包</GLButton> -->
</div>
<div class="list-tips m-b-10">
<img class="tips-img" src="@/assets/icon-info.png" />
<span>
定向礼包:将多种券和服务组合成定向礼包,由指定的员工向指定的客户发放,客户需准确输入设定内容才能成功领取。
</span>
</div>
<div class="container">
<div>
<glsx-combi-form ref="showSearch" :formObj="searchForm" :formData="searchFormData">
<span slot="footer">
<el-button :size="size" type="default" @click="handleReset">重置</el-button>
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
</span>
</glsx-combi-form>
<glsx-combi-form ref="showSearch">
<span slot="footer" class="footer-btns">
<el-button :size="size" type="default" @click="handleExport">导出</el-button>
</span>
</glsx-combi-form>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="giftListRef" :getListApi="getListApi" :hasNum="false" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<div slot="giftInfo" slot-scope="scope">
<div>礼包明细</div>
<div>{{ scope.scope }}</div>
</div>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<el-button type="text" @click="handleDelete(scope.scope)">删除</el-button>
<!-- <GLButton type="text" fn="删除" @click="handleDelete(scope.scope)">删除</GLButton> -->
</div>
</GLTable>
<!-- 表格区域 end -->
</div>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
import { exportFn } from '@/common/constant'
export default {
name: 'giftList',
data() {
return {
size: 'small',
url: url,
searchForm: {
orderCode: '',
commentStatus: '',
createDate: []
},
tableSearchForm: {},
// 搜索
searchFormData: [
{
label: '礼包名称',
name: 'orderCode',
type: 'input',
maxlength: 15,
isClear: true
},
{
label: '发放员工',
name: 'orderCode',
type: 'input',
isClear: true
},
{
label: '创建时间',
name: 'createDate',
type: 'datePicker',
isClear: true,
pickerOptions: 'beforeRangePickerOptions'
}
],
// 表格
getListApi: this.$apis.orderComment.getListApi,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '',
prop: '',
columnattrs: {
type: 'expand'
},
addHtml: 'giftInfo'
},
{
label: '序号',
prop: 'idx'
},
{
label: '礼包名称',
prop: 'orderCode'
},
{
label: '备注名称',
prop: 'orderCode',
width: '200'
},
{
label: '预估成本/元',
prop: 'orderCode'
},
{
label: '发放员工',
prop: 'orderCode'
},
{
label: '预估成本/元',
prop: 'orderCode'
},
{
label: '赠送原因',
prop: 'orderCode'
},
{
label: '创建时间',
prop: 'createdDate',
width: '180',
formatter: cellValue => {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
}
},
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
baseData: {
commentStatusList: [
{
confId: '0',
confName: '未发布'
},
{
confId: '1',
confName: '已发布'
}
]
}
}
},
mounted() {
this.getOptionsList('searchFormData')
},
methods: {
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
if (this.searchForm.createDate.length) {
params.createStartDateStr = new Date(this.searchForm.createDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.createEndDateStr = new Date(this.searchForm.createDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
delete params.createDate
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
delete this.tableSearchForm.createDate
resolve()
})
},
secondConfirm(title, txt, apiModule, apiName, apiParams, fn) {
this.$confirm(txt, title, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: action => {
if (action == 'confirm') {
this.$apis[apiModule][apiName](apiParams).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
fn && fn()
this.handleSearch()
}
})
}
}
})
},
// 查看
// handleDetail(row) {
// this.$router.push({
// path: '/orderComment/commentDetail',
// query: {
// id: row.id
// }
// })
// },
handleExport() {
var params = this.getParams()
// this.$apis.couponManage.couponExportApi(params).then(res => {
// exportFn(res)
// })
},
handleDelete(row) {
// this.secondConfirm('删除', '是否确认删除该评论?', 'orderComment', 'deleteCommentApi', { id: row.id })
},
// add-新增;edit-编辑
handleEdit(addOrEdit, row) {
// addOrEdit == 1 ? this.$router.push('/zoneList/editZone/' + addOrEdit) : this.$router.push('/zoneList/editZone/' + addOrEdit + '/' + row.id)
var params = {
addOrEdit: addOrEdit,
$title: encodeURI(addOrEdit == 'add' ? '新增信息' : '编辑信息')
}
addOrEdit != 'add' && (params.id = row.id)
this.$router.push({
path: '/giftBag/editGift',
query: params
})
},
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle)
var index = this[formName].findIndex(k => k.name == refreshSigle)
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
} else {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) {
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
}
},
setTableFinishFun() {
var page = this.$refs.giftListRef.page
// 添加序号
this.$refs.giftListRef.data.forEach((item, index) => {
item.idx = index + (page[this.pageConf.pageNum] - 1) * page[this.pageConf.pageSize] + 1
})
//接收到的数据为空
this.$refs.giftListRef.data.length ? (this.$refs.giftListRef.tableHeightValues = '') : this.$refs.giftListRef.setTableHeightFun()
},
handleSearch() {
this.$refs.giftListRef.refreshTable()
},
handleReset() {
this.searchForm = {
orderCode: '',
commentStatus: '',
createDate: []
}
this.handleSearch()
}
}
}
</script>
<style scoped></style>
<!-- 定向礼包 -->
<template>
<div class="gift-bag">
<el-tabs v-model="activeName" @tab-click="handleTabClick">
<el-tab-pane label="定向礼包" name="giftList">
<gift-list></gift-list>
</el-tab-pane>
<el-tab-pane label="已领取" name="receivedGiftList">
<div class="p-t-20">已领取</div>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import giftList from './giftList.vue'
export default {
name: 'gitfBag',
data() {
return {
activeName: 'giftList'
}
},
components: {
giftList
},
mounted() { },
methods: {
handleTabClick() { }
}
}
</script>
<style>
.gift-bag .el-tabs__nav-wrap:after {
opacity: 0;
}
.gift-bag .el-tabs__item {
height: 20px !important;
line-height: 10px !important;
font-weight: 400;
font-size: 16px;
color: #717171;
height: 36px;
line-height: 36px;
}
.gift-bag .el-tabs__item:hover,
.gift-bag .el-tabs__item.is-active {
color: #5f5efb;
}
</style>
...@@ -163,7 +163,6 @@ export default { ...@@ -163,7 +163,6 @@ export default {
} }
}) })
}, },
// 查看 // 查看
handleDetail(row) { handleDetail(row) {
this.$router.push({ this.$router.push({
...@@ -209,7 +208,6 @@ export default { ...@@ -209,7 +208,6 @@ export default {
}) })
} }
}, },
setTableFinishFun() { setTableFinishFun() {
//接收到的数据为空 //接收到的数据为空
this.$refs.commentRef.data.length ? (this.$refs.commentRef.tableHeightValues = '') : this.$refs.commentRef.setTableHeightFun() this.$refs.commentRef.data.length ? (this.$refs.commentRef.tableHeightValues = '') : this.$refs.commentRef.setTableHeightFun()
......
<!-- 编辑晒单 --> <!-- 编辑专区 -->
<template> <template>
<div class="edit-share marketing"> <div class="edit-gift marketing p-t-20 edit-box">
<div class="container edit-container"> <div class="container edit-container">
<p class="edit-title">{{ title }}</p> <p class="edit-title">{{ title }}</p>
<glsx-combi-form class="edit-form-container" ref="editFormRef" labelWidth="140px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule"></glsx-combi-form> <glsx-combi-form class="edit-form-container m-r-20" ref="editFormRef" :isEdit="isEdit" :labelWidth="labelWidth" defaultWidth="320px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule"></glsx-combi-form>
</div> </div>
<div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }"> <div class="footer" :style="{ left: footerLeft + 'px', width: footerWidth + 'px' }">
<el-button type="primary" @click="handleConfirm">确定</el-button> <el-button type="primary" @click="handleConfirm">确定</el-button>
...@@ -14,23 +14,25 @@ ...@@ -14,23 +14,25 @@
<script> <script>
export default { export default {
name: 'editShare', name: 'editGift',
data() { data() {
return { return {
size: 'small', size: 'small',
title: '新增晒单', title: '新增信息',
titleObj: { titleObj: {
1: '新增晒单', add: '新增信息',
2: '编辑晒单' edit: '编辑信息'
}, },
footerLeft: '0', footerLeft: '0',
footerWidth: '0', footerWidth: '0',
editChildRef: 'editChildRef', editChildRef: 'editChildRef',
routeInfo: { routeInfo: {
// 1-新增;2-编辑;3-查看 // add-新增;edit-编辑;look-查看
addOrEdit: 1, addOrEdit: 'add',
id: '' id: ''
}, },
editStatus: false,
labelWidth: '144px',
editForm: { editForm: {
// 专区类型(1发现频道,2商城专区) // 专区类型(1发现频道,2商城专区)
zoneType: '2', zoneType: '2',
...@@ -43,11 +45,11 @@ export default { ...@@ -43,11 +45,11 @@ export default {
zoneImg: [{ required: true, message: '请选择专区图片', trigger: 'change' }], zoneImg: [{ required: true, message: '请选择专区图片', trigger: 'change' }],
merchantList: [{ required: true, message: '请选择门店', trigger: 'change' }] merchantList: [{ required: true, message: '请选择门店', trigger: 'change' }]
}, },
isEdit: true,
editFormData: [ editFormData: [
{ {
label: '专区名称', label: '专区名称',
name: 'zoneName', name: 'zoneName',
width: '320px',
type: 'input', type: 'input',
maxlength: 20 maxlength: 20
}, },
...@@ -55,7 +57,6 @@ export default { ...@@ -55,7 +57,6 @@ export default {
label: '专区图片', label: '专区图片',
name: 'zoneImg', name: 'zoneImg',
type: 'upload', type: 'upload',
width: '320px',
limitSize: 10, limitSize: 10,
maxPhotoNum: 1, maxPhotoNum: 1,
handleUpload: (e, file, targetItem) => { handleUpload: (e, file, targetItem) => {
...@@ -71,12 +72,22 @@ export default { ...@@ -71,12 +72,22 @@ export default {
} }
}, },
watch: {
editForm: {
handler(val) {
this.editStatus = true
},
deep: true
}
},
mounted() { mounted() {
this.footerLeft = document.querySelector('.base-container-right').offsetLeft this.footerLeft = document.querySelector('.base-container-right').offsetLeft
this.footerWidth = document.documentElement.clientWidth - this.footerLeft this.footerWidth = document.documentElement.clientWidth - this.footerLeft
this.routeInfo = this.$route.params this.routeInfo = this.$route.query
console.log(this.routeInfo.addOrEdit)
this.title = this.titleObj[this.routeInfo.addOrEdit] this.title = this.titleObj[this.routeInfo.addOrEdit]
this.routeInfo.addOrEdit != 1 ? this.getInfo() : '' this.routeInfo.addOrEdit != 'add' ? this.getInfo() : ''
}, },
methods: { methods: {
...@@ -88,33 +99,67 @@ export default { ...@@ -88,33 +99,67 @@ export default {
// this.editForm.merchantList.forEach(item => { // this.editForm.merchantList.forEach(item => {
// item.merchantNo = item.merchantId // item.merchantNo = item.merchantId
// }) // })
// this.$nextTick(() => {
// this.editStatus = false
// })
// }) // })
}, },
handleConfirm() { handleConfirm() {
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => { this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) { if (valid) {
var params = this.$common.utils.deepClone(this.editForm) var params = this.$common.utils.deepClone(this.editForm)
if (this.routeInfo.addOrEdit == 2) { if (this.routeInfo.addOrEdit == 'edit') {
params.id = this.routeInfo.id params.id = this.routeInfo.id
} }
// this.$apis.zoneList.insertZoneApi(params).then(res => { params.merchantList = []
// this.$message({ // 专区类型(1发现频道,2商城专区)
// message: res.code == '0' ? '操作成功' : '操作失败', params.zoneType = '2'
// type: res.code == '0' ? 'success' : 'error' this.editForm.merchantList.forEach(item => {
// }) params.merchantList.push({
// if (res.code == '0') { merchantId: item.merchantNo,
// this.handleCancel() merchantName: item.merchantName,
// } merchantAccountLevel: item.merchantAccountLevel
// }) })
})
// console.log(params)
this.$apis.zoneList.insertZoneApi(params).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : '操作失败',
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
this.cancelJump()
}
})
} }
}) })
}, },
handleCancel() { cancelJump() {
// this.$router.push({ // this.$router.push({
// path: '/orderShare/index' // path: '/giftBag/index'
// }) // })
},
handleCancel() {
if (this.editStatus) {
this.$confirm('当前有内容信息未保存,是否继续返回?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.cancelJump()
})
.catch(() => { })
} else {
this.cancelJump()
}
} }
} }
} }
</script> </script>
<style scoped></style> <style scoped>
.marketing.edit-gift .select-merchant {
/* width: calc(98% - 140px); */
width: 98%;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!