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 {
name: '图片',
funcName: '',
type: 'img',
limitSize: 10,
// togetherItem: [ATT_TYPE.TEXT], //只允许文本和图片
// limitSize: 10, //限制图片大小
// limitNum: 2, //限制图片数量
// limitWidth: 10000, //限制单张图片宽度
// limitHeight: 10000,//限制单张图片高度
// Isdraggable: true, //图片拖拽
uploadApi: this.$apis.common.pictureUpload
},
{
......@@ -226,7 +231,7 @@ export default {
itemName: '权益卡试用',
itemValue: 3,
itemType: 'card',
getInterfaceApi: this.$apis.customerTransform.getCard,
getInterfaceApi: this.$apis.welcomeword.getCard,
params: {
tryAble: 1,
merchantId: this.$globalState.session.merchantId
......@@ -236,14 +241,14 @@ export default {
itemName: '权益套餐',
itemValue: 4,
itemType: 'package',
getInterfaceApi: this.$apis.customerTransform.getPackage,
getInterfaceApi: this.$apis.welcomeword.getPackage,
params: {}
},
{
itemName: '商城券',
itemValue: 2,
itemType: 'coupon',
getInterfaceApi: this.$apis.customerTransform.getMerchant,
getInterfaceApi: this.$apis.welcomeword.getMerchant,
params: {
discountTypes: [2, 3, 4],
directionalFlag: 1, // 1所有人可用2定向礼包专用3关联优惠券
......@@ -254,7 +259,7 @@ export default {
itemName: '秒杀活动',
itemValue: 5,
itemType: 'activity',
getInterfaceApi: this.$apis.customerTransform.getActivity,
getInterfaceApi: this.$apis.welcomeword.getActivity,
params: {
activityStatus: 2,
currentPage: 1
......@@ -264,7 +269,13 @@ export default {
itemName: '无忧服务',
itemValue: 6,
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: {
merchantId: this.$globalState.session.merchantId
}
......@@ -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: '素材',
type: 'material',
funName: 'material',
groupListApi: this.$apis.customerTransform.getGroupListApi,
materialListApi: this.$apis.customerTransform.getMaterialListApi
groupListApi: this.$apis.welcomeword.getGroupListApi,
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: {
......@@ -437,15 +450,15 @@ export default {
}
if (this.basicForm.attachmentList && this.basicForm.attachmentList.length) {
if (this.basicForm.attachmentList.length > 9) {
this.attachmentText = '附件不可超过9个'
return (this.attachmentText = '附件不可超过9个')
} else {
this.attachmentText = ''
this.attachmentShow = false
}
} else {
this.attachmentText = '请输入群发内容'
return
return (this.attachmentText = '请输入群发内容')
}
console.log(this.basicForm)
if (this.basicForm.selectType == 3 && !this.basicForm.crowdList.length) {
return this.$message({
type: 'error',
......
......@@ -34,7 +34,7 @@
<el-form :model="basicForm" :rules="basicRules" ref="groupForm" label-width="120px">
<el-form-item prop="attachmentList">
<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>
</el-form-item>
<el-form-item label="发送时间" prop="sendType">
......@@ -52,7 +52,7 @@
</div>
</div>
<div class="preview">
<Preview :eventBus="eventBus"></Preview>
<Preview :previewVal="previewVal"></Preview>
</div>
</div>
</div>
......@@ -76,13 +76,11 @@
<script>
import Vue from 'vue'
import emoji from '@/utils/emo'
import WelcomeWords from './components/welcomeWords.vue'
import SelectLord from './components/selectLord.vue'
import Preview from './components/preview.vue'
import * as dayjs from 'dayjs'
export default {
components: {
WelcomeWords,
SelectLord,
Preview
},
......@@ -143,30 +141,101 @@ export default {
eventBus: new Vue(),
btnList: [
{
id: 1,
name: '表情',
funcName: '',
type: 'expression',
limitSize: 10
},
{
id: 2,
name: '图片',
funcName: '',
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: '活动',
type: 'acivity',
funName: 'activity'
type: '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: '模板',
type: 'nickname',
funName: 'message'
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: {},
......@@ -205,7 +274,8 @@ export default {
footerLeft: 200,
footerWidth: 200,
editStatus: false,
selectData: []
selectData: [],
previewVal: []
}
},
watch: {
......@@ -226,6 +296,11 @@ export default {
openMembers() {
this.membersVisible = !this.membersVisible
},
// 预览回显事件
previewForm(val) {
console.log(val)
this.previewVal = val
},
handleCancel() {
// this.$router.go(-1)
if (this.editStatus || this.$refs.welcome.previewList.length > 0) {
......
......@@ -39,6 +39,7 @@
</template>
<script>
import { utils } from 'glsx-common'
import emoji from '@/utils/emo'
export default {
name: 'Preview',
......@@ -51,25 +52,34 @@ export default {
},
watch: {
previewList(val) {
if (val.length && val[0].attType == 1) {
const attContent = val[0].attContent
const htm = attContent.replace(/\[[\u4E00-\u9FA56]{1,4}]/gi, function(res) {
let word = res.replace(/\[|\]/gi, '')
const list = emoji.flat(Infinity)
let index = parseInt(list.indexOf(word)) + 1
if (index < 10) {
index = '00' + index
} else if (index >= 10 && index < 100) {
index = '0' + index
if (val.length) {
val.forEach(item => {
if (item.attType == 1) {
const attContent = item.attContent
const htm = attContent.replace(/\[[\u4E00-\u9FA56]{1,4}]/gi, function(res) {
let word = res.replace(/\[|\]/gi, '')
const list = emoji.flat(Infinity)
let index = parseInt(list.indexOf(word)) + 1
if (index < 10) {
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: {
handler(val) {
this.previewList = val
console.log(val)
this.previewList = utils.deepClone(val)
},
deep: true
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!