Commit 04e9b836 by 胡悦

提交

1 parent e9aef4fd
import { http } from '@/main'
const path = 'entmicro.api.mass.'
const URL = 'rop-scrm-entmicro/router'
//权益卡
const getCard = params => {
params.method = 'scrm.api.equity.open.card.price.list.by.merchantid'
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
//权益卡
const merchant = params => {
params.method = 'scrm.api.equity.open.card.price.list.by.merchantid'
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
//是否开通权益
const merchantOpen = params => {
params.method = 'scrm.api.equity.service.merchant.config.get'
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
//优惠券
const getCoupon = params => {
params.method = 'scrm.api.boutiquecoupon.coupon.page'
return http({
url: '/rop-scrm-boutiquecoupon/router',
method: 'POST',
data: params,
sign: true
})
}
//套餐
const getPackage = params => {
params.method = 'scrm.api.equity.package.info.list.with.page'
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
const getMerchant = params => {
params.method = 'scrm.api.coupon.list.merchant'
return http({
url: 'rop-scrm-coupon/router',
method: 'POST',
data: params,
sign: true
})
}
//秒杀活动
const getActivity = params => {
params.method = 'scrm.api.shopmall.activity.page'
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true
})
}
// 获取素材组列表
const getGroupListApi = params => {
params.method = 'marketing.api.material.group.list'
return http({
url: 'rop-scrm-marketing/router',
method: 'POST',
data: params,
sign: true
})
}
// 获取素材列表
const getMaterialListApi = params => {
// params.method = 'marketing.api.material.page'
params.method = 'marketing.api.material.sop.page'
return http({
url: 'rop-scrm-marketing/router',
method: 'POST',
data: params,
sign: true
})
}
//模板列表
const templatePage = params => {
params.method = `${path}template.page.search`
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
//模板保存
const templateSave = params => {
params.method = `${path}template.save`
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
//模板更新
const templateUpdate = params => {
params.method = `${path}template.update`
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
//模板创建人
const createdNameList = params => {
params.method = `${path}template.created.name.list`
return http({
url: URL,
method: 'POST',
data: params,
sign: true
})
}
export default {
getCard,
merchant,
getActivity,
getPackage,
getMerchant,
getCoupon,
merchantOpen,
getGroupListApi,
getMaterialListApi,
templatePage,
createdNameList,
templateUpdate,
templateSave
}
...@@ -214,7 +214,12 @@ export default { ...@@ -214,7 +214,12 @@ export default {
name: '图片', name: '图片',
funcName: '', funcName: '',
type: 'img', type: 'img',
limitSize: 10, // togetherItem: [ATT_TYPE.TEXT], //只允许文本和图片
// limitSize: 10, //限制图片大小
// limitNum: 2, //限制图片数量
// limitWidth: 10000, //限制单张图片宽度
// limitHeight: 10000,//限制单张图片高度
// Isdraggable: true, //图片拖拽
uploadApi: this.$apis.common.pictureUpload uploadApi: this.$apis.common.pictureUpload
}, },
{ {
...@@ -226,7 +231,7 @@ export default { ...@@ -226,7 +231,7 @@ export default {
itemName: '权益卡试用', itemName: '权益卡试用',
itemValue: 3, itemValue: 3,
itemType: 'card', itemType: 'card',
getInterfaceApi: this.$apis.customerTransform.getCard, getInterfaceApi: this.$apis.welcomeword.getCard,
params: { params: {
tryAble: 1, tryAble: 1,
merchantId: this.$globalState.session.merchantId merchantId: this.$globalState.session.merchantId
...@@ -236,14 +241,14 @@ export default { ...@@ -236,14 +241,14 @@ export default {
itemName: '权益套餐', itemName: '权益套餐',
itemValue: 4, itemValue: 4,
itemType: 'package', itemType: 'package',
getInterfaceApi: this.$apis.customerTransform.getPackage, getInterfaceApi: this.$apis.welcomeword.getPackage,
params: {} params: {}
}, },
{ {
itemName: '商城券', itemName: '商城券',
itemValue: 2, itemValue: 2,
itemType: 'coupon', itemType: 'coupon',
getInterfaceApi: this.$apis.customerTransform.getMerchant, getInterfaceApi: this.$apis.welcomeword.getMerchant,
params: { params: {
discountTypes: [2, 3, 4], discountTypes: [2, 3, 4],
directionalFlag: 1, // 1所有人可用2定向礼包专用3关联优惠券 directionalFlag: 1, // 1所有人可用2定向礼包专用3关联优惠券
...@@ -254,7 +259,7 @@ export default { ...@@ -254,7 +259,7 @@ export default {
itemName: '秒杀活动', itemName: '秒杀活动',
itemValue: 5, itemValue: 5,
itemType: 'activity', itemType: 'activity',
getInterfaceApi: this.$apis.customerTransform.getActivity, getInterfaceApi: this.$apis.welcomeword.getActivity,
params: { params: {
activityStatus: 2, activityStatus: 2,
currentPage: 1 currentPage: 1
...@@ -264,7 +269,13 @@ export default { ...@@ -264,7 +269,13 @@ export default {
itemName: '无忧服务', itemName: '无忧服务',
itemValue: 6, itemValue: 6,
itemType: 'merchant', itemType: 'merchant',
getInterfaceApi: this.$apis.customerTransform.merchant, getInterfaceApi: this.$apis.welcomeword.merchant,
merchantOpen: {
merchantOpenApi: this.$apis.welcomeword.merchantOpen,
params: {
merchantId: this.$globalState.session.merchantId
}
},
params: { params: {
merchantId: this.$globalState.session.merchantId merchantId: this.$globalState.session.merchantId
} }
...@@ -272,21 +283,23 @@ export default { ...@@ -272,21 +283,23 @@ export default {
] ]
}, },
{ {
name: '模板',
type: 'message',
funName: 'message',
getSearchApi: this.$apis.customerTransform.createdNameList,
templateApi: this.$apis.customerTransform.templatePage,
templateUpdateApi: this.$apis.customerTransform.templateUpdate,
templateSaveApi: this.$apis.customerTransform.templateSave,
templateDetailApi: this.$apis.customerTransform.templateDetail
},
{
name: '素材', name: '素材',
type: 'material', type: 'material',
funName: 'material', funName: 'material',
groupListApi: this.$apis.customerTransform.getGroupListApi, groupListApi: this.$apis.welcomeword.getGroupListApi,
materialListApi: this.$apis.customerTransform.getMaterialListApi materialListApi: this.$apis.welcomeword.getMaterialListApi,
pdfNo: 1,
videoNo: 1
},
{
name: '模板',
type: 'message',
funName: 'message',
getSearchApi: this.$apis.welcomeword.createdNameList,
templateApi: this.$apis.welcomeword.templatePage,
templateUpdateApi: this.$apis.welcomeword.templateUpdate,
templateSaveApi: this.$apis.welcomeword.templateSave,
templateDetailApi: this.$apis.welcomeword.templateDetail
} }
], ],
basicForm: { basicForm: {
...@@ -437,15 +450,15 @@ export default { ...@@ -437,15 +450,15 @@ export default {
} }
if (this.basicForm.attachmentList && this.basicForm.attachmentList.length) { if (this.basicForm.attachmentList && this.basicForm.attachmentList.length) {
if (this.basicForm.attachmentList.length > 9) { if (this.basicForm.attachmentList.length > 9) {
this.attachmentText = '附件不可超过9个' return (this.attachmentText = '附件不可超过9个')
} else { } else {
this.attachmentText = '' this.attachmentText = ''
this.attachmentShow = false this.attachmentShow = false
} }
} else { } else {
this.attachmentText = '请输入群发内容' return (this.attachmentText = '请输入群发内容')
return
} }
console.log(this.basicForm)
if (this.basicForm.selectType == 3 && !this.basicForm.crowdList.length) { if (this.basicForm.selectType == 3 && !this.basicForm.crowdList.length) {
return this.$message({ return this.$message({
type: 'error', type: 'error',
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<el-form :model="basicForm" :rules="basicRules" ref="groupForm" label-width="120px"> <el-form :model="basicForm" :rules="basicRules" ref="groupForm" label-width="120px">
<el-form-item prop="attachmentList"> <el-form-item prop="attachmentList">
<label slot="label" class="required">群发内容</label> <label slot="label" class="required">群发内容</label>
<WelcomeWords ref="welcome" :form="'customerGroup'" :btnList="btnList" :eventBus="eventBus"></WelcomeWords> <GLEditor ref="welcome" :form="'customerGroup'" :btnList="btnList" @previewWord="previewForm"></GLEditor>
<div v-show="attachmentShow" class="el-form-item__error">{{ attachmentText }}</div> <div v-show="attachmentShow" class="el-form-item__error">{{ attachmentText }}</div>
</el-form-item> </el-form-item>
<el-form-item label="发送时间" prop="sendType"> <el-form-item label="发送时间" prop="sendType">
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
</div> </div>
</div> </div>
<div class="preview"> <div class="preview">
<Preview :eventBus="eventBus"></Preview> <Preview :previewVal="previewVal"></Preview>
</div> </div>
</div> </div>
</div> </div>
...@@ -76,13 +76,11 @@ ...@@ -76,13 +76,11 @@
<script> <script>
import Vue from 'vue' import Vue from 'vue'
import emoji from '@/utils/emo' import emoji from '@/utils/emo'
import WelcomeWords from './components/welcomeWords.vue'
import SelectLord from './components/selectLord.vue' import SelectLord from './components/selectLord.vue'
import Preview from './components/preview.vue' import Preview from './components/preview.vue'
import * as dayjs from 'dayjs' import * as dayjs from 'dayjs'
export default { export default {
components: { components: {
WelcomeWords,
SelectLord, SelectLord,
Preview Preview
}, },
...@@ -143,30 +141,101 @@ export default { ...@@ -143,30 +141,101 @@ export default {
eventBus: new Vue(), eventBus: new Vue(),
btnList: [ btnList: [
{ {
id: 1,
name: '表情', name: '表情',
funcName: '', funcName: '',
type: 'expression', type: 'expression',
limitSize: 10 limitSize: 10
}, },
{ {
id: 2,
name: '图片', name: '图片',
funcName: '', funcName: '',
type: 'img', type: 'img',
limitSize: 10 // togetherItem: [ATT_TYPE.TEXT], //只允许文本和图片
// limitSize: 10, //限制图片大小
// limitNum: 2, //限制图片数量
// limitWidth: 10000, //限制单张图片宽度
// limitHeight: 10000,//限制单张图片高度
// Isdraggable: true, //图片拖拽
uploadApi: this.$apis.common.pictureUpload
}, },
{ {
id: 4,
name: '活动', name: '活动',
type: 'acivity', type: 'activity',
funName: 'activity' funName: 'activity',
funParams: [
{
itemName: '权益卡试用',
itemValue: 3,
itemType: 'card',
getInterfaceApi: this.$apis.welcomeword.getCard,
params: {
tryAble: 1,
merchantId: this.$globalState.session.merchantId
}
},
{
itemName: '权益套餐',
itemValue: 4,
itemType: 'package',
getInterfaceApi: this.$apis.welcomeword.getPackage,
params: {}
},
{
itemName: '商城券',
itemValue: 2,
itemType: 'coupon',
getInterfaceApi: this.$apis.welcomeword.getMerchant,
params: {
discountTypes: [2, 3, 4],
directionalFlag: 1, // 1所有人可用2定向礼包专用3关联优惠券
validType: 'valid'
}
},
{
itemName: '秒杀活动',
itemValue: 5,
itemType: 'activity',
getInterfaceApi: this.$apis.welcomeword.getActivity,
params: {
activityStatus: 2,
currentPage: 1
}
},
{
itemName: '无忧服务',
itemValue: 6,
itemType: 'merchant',
getInterfaceApi: this.$apis.welcomeword.merchant,
merchantOpen: {
merchantOpenApi: this.$apis.welcomeword.merchantOpen,
params: {
merchantId: this.$globalState.session.merchantId
}
},
params: {
merchantId: this.$globalState.session.merchantId
}
}
]
},
{
name: '素材',
type: 'material',
funName: 'material',
groupListApi: this.$apis.welcomeword.getGroupListApi,
materialListApi: this.$apis.welcomeword.getMaterialListApi,
pdfNo: 1,
videoNo: 1
}, },
{ {
id: 5,
name: '模板', name: '模板',
type: 'nickname', type: 'message',
funName: 'message' funName: 'message',
getSearchApi: this.$apis.welcomeword.createdNameList,
templateApi: this.$apis.welcomeword.templatePage,
templateUpdateApi: this.$apis.welcomeword.templateUpdate,
templateSaveApi: this.$apis.welcomeword.templateSave,
templateDetailApi: this.$apis.welcomeword.templateDetail
} }
], ],
basicForm: {}, basicForm: {},
...@@ -205,7 +274,8 @@ export default { ...@@ -205,7 +274,8 @@ export default {
footerLeft: 200, footerLeft: 200,
footerWidth: 200, footerWidth: 200,
editStatus: false, editStatus: false,
selectData: [] selectData: [],
previewVal: []
} }
}, },
watch: { watch: {
...@@ -226,6 +296,11 @@ export default { ...@@ -226,6 +296,11 @@ export default {
openMembers() { openMembers() {
this.membersVisible = !this.membersVisible this.membersVisible = !this.membersVisible
}, },
// 预览回显事件
previewForm(val) {
console.log(val)
this.previewVal = val
},
handleCancel() { handleCancel() {
// this.$router.go(-1) // this.$router.go(-1)
if (this.editStatus || this.$refs.welcome.previewList.length > 0) { if (this.editStatus || this.$refs.welcome.previewList.length > 0) {
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
</template> </template>
<script> <script>
import { utils } from 'glsx-common'
import emoji from '@/utils/emo' import emoji from '@/utils/emo'
export default { export default {
name: 'Preview', name: 'Preview',
...@@ -51,25 +52,34 @@ export default { ...@@ -51,25 +52,34 @@ export default {
}, },
watch: { watch: {
previewList(val) { previewList(val) {
if (val.length && val[0].attType == 1) { if (val.length) {
const attContent = val[0].attContent val.forEach(item => {
const htm = attContent.replace(/\[[\u4E00-\u9FA56]{1,4}]/gi, function(res) { if (item.attType == 1) {
let word = res.replace(/\[|\]/gi, '') const attContent = item.attContent
const list = emoji.flat(Infinity) const htm = attContent.replace(/\[[\u4E00-\u9FA56]{1,4}]/gi, function(res) {
let index = parseInt(list.indexOf(word)) + 1 let word = res.replace(/\[|\]/gi, '')
if (index < 10) { const list = emoji.flat(Infinity)
index = '00' + index let index = parseInt(list.indexOf(word)) + 1
} else if (index >= 10 && index < 100) { if (index < 10) {
index = '0' + index index = '00' + index
} else if (index >= 10 && index < 100) {
index = '0' + index
}
return `<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/${index}.png">`
})
item.attContent = htm
} else if (item.attType != 2) {
console.log(item)
item.attContent = JSON.parse(item.attContent)
console.log(item.attContent)
} }
return `<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/${index}.png">`
}) })
val[0].attContent = htm
} }
}, },
previewVal: { previewVal: {
handler(val) { handler(val) {
this.previewList = val console.log(val)
this.previewList = utils.deepClone(val)
}, },
deep: true deep: true
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!