Commit aeb2b649 by 周子尧

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

2 parents c4a47239 ab17888b
import { http } from '@/main'
const getFollowerStaffListApi = params => {
params.method = 'entmicro.api.staff.listFollowerStaffByPage'
return http({
url: 'rop-scrm-entmicro/router',
method: 'GET',
data: params,
sign: true
})
}
export default { getFollowerStaffListApi }
......@@ -167,6 +167,10 @@ html {
height: 120px;
}
.marketing .m-t-8 {
margin-top: 8px;
}
.marketing .m-t-10 {
margin-top: 10px;
}
......
......@@ -3,16 +3,31 @@
<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>
<glsx-combi-form class="edit-form-container m-r-20" ref="editFormRef" :isEdit="isEdit" :labelWidth="labelWidth" defaultWidth="415px" :isBlock="true" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="remarkName" class="edit-tips m-t-8">可根据备注名称进行查找,仅作内部查看,不展示给客户</div>
<el-button slot="selectGiftBtn">选择礼包内容</el-button>
<div slot="receiveDetails" class="edit-tips m-t-8">客户需要输入该{{ editForm.receiveWay == '0' ? '手机号' : '车架号后6位' }}才能成功领取</div>
<el-button slot="selectStaffBtn" class="el-icon-plus" @click="handleSelectStaff">选择员工</el-button>
<div slot="staffListBlock" class="sale-select" :style="{ 'margin-left': labelWidth }" v-show="editForm.staffList && editForm.staffList.length != 0">
<div :key="key" class="el-input-tag input-tag-wrapper">
<el-tag effect="plain" type="info" v-for="(tag, idx) in editForm.staffList" :key="idx" closable :disable-transitions="false" @close="handleStaffRemove(tag, idx)">
<i class="el-icon-user-solid"></i>
{{ tag.staffName }}
</el-tag>
</div>
</div>
</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>
<select-staff-dialog v-if="isMutiSelectVisible" :isMutiSelectVisible="isMutiSelectVisible" :searchForm="searchStaffForm" :selectedStaffList="selectedStaffList" @handleMutiSelectConfirm="handleMutiSelectConfirm" @handleMutiSelectClose="handleMutiSelectClose"></select-staff-dialog>
</div>
</template>
<script>
import selectStaffDialog from './selectStaffDialog.vue'
export default {
name: 'editGift',
data() {
......@@ -25,19 +40,48 @@ export default {
},
footerLeft: '0',
footerWidth: '0',
// 选择员工弹窗
isMutiSelectVisible: false,
searchStaffForm: {},
selectedStaffList: [],
editChildRef: 'editChildRef',
routeInfo: {
// add-新增;edit-编辑;look-查看
// add-新增;edit-编辑;detail-详情
addOrEdit: 'add',
id: ''
},
editStatus: false,
labelWidth: '144px',
editForm: {
name: ''
name: '',
remarkName: '',
receiveWay: '0',
receiveDetails: '',
staffList: [],
couponList: []
},
editRule: {
name: [{ required: true, message: '请输入礼包名称', trigger: 'change' }]
name: [{ required: true, message: '请输入礼包名称', trigger: 'change' }],
remarkName: [{ required: true, message: '请输入备注名称', trigger: 'change' }],
receiveWay: [{ required: true, message: '请选择领取条件', trigger: 'change' }],
staffList: [{ required: true, message: '请选择发放员工', trigger: 'change' }],
receiveDetails: [{ required: true, message: '请输入领取条件', trigger: 'change' },
{
required: true,
validator: (rule, value, callback) => {
if (!value) {
return callback()
}
if (this.editForm.receiveWay == '0') {
let phoneReg = /^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/
return phoneReg.test(value) ? callback() : callback(new Error('请输入正确的手机号'))
} else {
let cjhReg = /^[0-9a-zA-Z]{6}$/
return cjhReg.test(value) ? callback() : callback(new Error('请输入正确的车架号后6位'))
}
},
trigger: 'change'
}]
// zoneImg: [{ required: true, message: '请选择专区图片', trigger: 'change' }]
},
isEdit: true,
......@@ -52,7 +96,64 @@ export default {
label: '备注名称',
name: 'remarkName',
type: 'input',
maxlength: 30
maxlength: 30,
suffixSlot: 'remarkName',
placeholder: '可按车主姓名+手机号形式备注'
},
{
label: '礼包设置',
name: '',
addHtml: 'selectGiftBtn'
},
{
label: '领取条件',
name: 'receiveWay',
type: 'radio',
optionId: 'confId',
optionLabel: 'confName',
optionList: [
{
confId: '0',
confName: '指定手机号'
},
{
confId: '1',
confName: '指定车架号后6位'
}
],
handleRadioChange: val => {
this.editForm.receiveDetails = ''
this.receiveWayChange(val)
}
},
{
label: '',
name: 'receiveDetails',
type: 'input',
maxlength: 11,
style: { 'margin-left': '144px' },
placeholder: '请输入领取手机号',
suffixSlot: 'receiveDetails'
},
{
label: '发放员工',
name: 'staffList',
addHtml: 'selectStaffBtn'
},
{
label: '',
name: 'staffListBlock',
isHide: true,
addHtml: 'staffListBlock'
},
{
label: '赠送原因',
name: 'giveReason',
type: 'input',
rows: '3',
inputType: 'textarea',
maxlength: 50,
width: '567px'
}
// {
// label: '专区图片',
......@@ -73,6 +174,10 @@ export default {
}
},
components: {
selectStaffDialog
},
watch: {
editForm: {
handler(val) {
......@@ -86,7 +191,6 @@ export default {
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() : ''
},
......@@ -105,31 +209,72 @@ export default {
// })
// })
},
receiveWayChange(val) {
var receiveDetailsIdx = this.editFormData.findIndex(item => item.name == 'receiveDetails')
this.editFormData[receiveDetailsIdx].placeholder = val == '0' ? '请输入领取手机号' : '请输入领取车架号后6位'
this.editFormData[receiveDetailsIdx].maxlength = val == '0' ? 11 : 6
},
handleStaffRemove(val, idx) {
this.editForm.staffList.splice(idx, 1)
this.hasStaffBlock()
this.key = new Date()
},
hasStaffBlock() {
var idx = this.editFormData.findIndex(item => item.name == 'staffListBlock')
this.editFormData[idx].isHide = !this.editForm.staffList.length
this.$refs.editFormRef.$refs[this.editChildRef].validateField('staffList')
},
handleSelectStaff() {
this.selectedStaffList = JSON.parse(JSON.stringify(this.editForm.staffList))
this.handleMutiSelectClose()
},
handleMutiSelectClose() {
this.isMutiSelectVisible = !this.isMutiSelectVisible
},
handleMutiSelectConfirm(selectedData) {
this.editForm.staffList = []
selectedData.forEach(item => {
this.editForm.staffList.push({
staffId: item.userOneId,
staffName: item.staffName
})
})
this.hasStaffBlock()
this.handleMutiSelectClose()
},
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)
// 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()
}
})
// 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()
// }
// })
}
})
},
......@@ -156,9 +301,71 @@ export default {
}
}
</script>
<style scoped>
<style lang="scss">
.marketing.edit-gift .select-merchant {
/* width: calc(98% - 140px); */
width: 98%;
}
.marketing.edit-gift .staff-block {
width: 567px;
background: #ffffff;
border-radius: 4px;
border: 1px solid #e5e5e5;
}
.marketing.edit-gift {
.sale-select {
display: flex;
align-items: center;
}
.input-tag-wrapper {
max-height: 68px;
overflow: auto;
position: relative;
font-size: 14px;
background-color: #fff;
background-image: none;
border-radius: 4px;
border: 1px solid #dcdfe6;
box-sizing: border-box;
color: #666;
display: inline-block;
outline: none;
padding: 5px 5px 0px 5px;
flex-wrap: wrap;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
width: 567px;
display: flex;
align-items: center;
margin-top: 6px;
font-size: 14px;
i {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
}
.el-tag {
margin-right: 4px;
height: 26px;
line-height: 24px;
margin-bottom: 5px;
// background: #fff !important;
}
.el-tag.el-tag--info .el-tag__close {
color: #e8e8ea;
background-color: rgba(0, 0, 0, 0) !important;
}
.el-tag.el-tag--info .el-tag__close:hover {
background-color: #5f5efb !important;
}
.tag-input {
background: transparent;
border: none !important;
font-size: 14px;
height: 32px;
outline: none;
padding-left: 0;
width: 100px;
}
}
</style>
......@@ -64,13 +64,15 @@ export default {
label: '礼包名称',
name: 'orderCode',
type: 'input',
maxlength: 15,
maxlength: 30,
placeholder: '请输入礼包名称或备注名称',
isClear: true
},
{
label: '发放员工',
name: 'orderCode',
type: 'input',
maxlength: 30,
isClear: true
},
{
......
<!-- 选择员工弹窗 -->
<template>
<glsx-dialog class="muti-pro" title="选择员工" :isVisible.sync="isMutiSelectVisible" width="70%" @confirmDialog="handleMutiSelectConfirm" @closeDialog="handleMutiSelectClose" v-loading="loading">
<div class="noproDiv" v-show="!staffList.length && fnCallBack">
<img src="@/assets/noPro.png" />
<p class="noproP">系统暂无已创建的员工</p>
</div>
<div v-show="staffList.length">
<slot name="search"></slot>
<GLTable v-loading="loading" ref="mutiProRef" :tableData="staffList" :noDataImg="url" :tableParams="tableParams" @refreshTable="getList"></GLTable>
</div>
</glsx-dialog>
</template>
<script>
// import { getGoodsList } from '@/api/modules/common'
import url from '@/assets/empty.png'
import glsxDialog from '@/components/glsx-dialog'
export default {
name: 'selectStaffDialog',
data() {
return {
// 表格组件
// getListApi: this.$apis.common.getGoodsListApi,
userInfo: {},
staffList: [],
fnCallBack: false,
url: url,
loading: true,
// pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
// 表格参数
tableParams: {
listName: 'list',
// 行数据的key
mutiSelectUniqueKey: 'userOneId',
// 多选ref的名称
mutiSelectName: 'list',
tableColumns: [
{
label: '姓名',
prop: 'staffName'
},
{
label: '部门',
prop: 'departmentName'
},
{
label: '跟进员工类型',
prop: 'followerTypeName'
}
]
}
}
},
props: {
isMutiSelectVisible: {
type: Boolean,
default: false
},
searchForm: {
type: Object,
default: () => { }
},
selectedStaffList: {
type: Array,
default: () => []
}
},
components: {
glsxDialog
},
mounted() {
this.userInfo = this.$globalState.session
this.getList(true)
},
methods: {
getList(isReset = false) {
var params = {
...this.searchForm,
pageNum: isReset ? 1 : this.$refs.mutiProRef.page.pageNum,
pageSize: isReset ? 10 : this.$refs.mutiProRef.page.pageSize
}
this.loading = true
this.$apis.giftBag.getFollowerStaffListApi(params).then(res => {
this.staffList = res.data
this.loading = false
this.fnCallBack = true
this.$refs.mutiProRef.tableTotal = res.count
this.recoverySelected()
this.$refs.mutiProRef.tableHeightValues = '50vh'
})
},
recoverySelected() {
if (this.selectedStaffList && this.selectedStaffList.length) {
this.selectedStaffList.forEach(row => {
row.userOneId = row.staffId
this.$refs.mutiProRef.$refs[this.tableParams.mutiSelectName + 'MutiTable'].toggleRowSelection(row)
})
}
},
handleMutiSelectConfirm() {
// if (!this.staffList.length) {
// var params = {
// addOrEdit: 1,
// groupOrStore: this.userInfo.accountLevel == 4 ? 2 : 1,
// $title: '新建员工'
// }
// this.$router.push({
// path: '/productGroup/editProduct',
// query: params
// })
// return true
// }
var selectedData = this.$refs.mutiProRef.mutiSelectArr[this.tableParams.mutiSelectName]
this.$emit('handleMutiSelectConfirm', selectedData)
},
handleMutiSelectClose() {
this.$emit('handleMutiSelectClose')
}
}
}
</script>
<style>
.muti-pro .m-t-10 {
margin-top: 10px;
}
.muti-pro .noproP {
width: 100%;
height: 20px;
font-family: PingFangSC-Medium;
font-size: 16px;
color: #666666;
line-height: 20px;
font-weight: 500;
text-align: center;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!