Commit 20c1aaf4 by 杨明

fixed

1 parent 18be4023
......@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-05-19 13:46:20
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-07-10 10:17:54
* @LastEditTime: 2023-07-10 20:44:37
* @FilePath: \scrm-micro-home\src\mixins\gpt.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -15,17 +15,31 @@ export default {
return {}
},
methods: {
//获取图片宽度高度
getImgInfo(src) {
return new Promise(resolve => {
if (!src) {
resolve({ dw: 0, dh: 0, src })
}
const img = new Image()
img.src = src
img.onload = () => {
resolve({ dw: img.width, dh: img.height, src })
}
})
},
//主图、内容图、logo合并图片
async createCanvas() {
async createBig(info, logoInfo) {
console.log(info)
this.loading = true
const { backgroundImage, detailImage, merchantLog, marketingTitle, marketingSubtitle } = this.editForm
const { backgroundImage, detailImage, merchantLog, marketingTitle, marketingSubtitle } = info
if (!backgroundImage) return
try {
const res = await Promise.all([this.getImgWH(backgroundImage), this.getImgWH(detailImage), this.getImgWH(merchantLog)])
const h = (res[0].dh / res[0].dw) * 375 + (res[1].dh / res[1].dw) * 375
this.logoInfo = { url: merchantLog, x: 375 - res[2].dw / 2 - 20, y: 20, width: res[2].dw / 2, height: res[2].dh / 2 }
const res = await Promise.all([this.getImgInfo(backgroundImage), this.getImgInfo(detailImage), this.getImgInfo(merchantLog)])
const h = (res[0].dh / res[0].dw) * WIDTH + (res[1].dh / res[1].dw) * WIDTH
this.logoInfo = { url: merchantLog, ...logoInfo }
const drawfun = new Drawing(document.getElementById('canvasId'), {
width: 375,
width: WIDTH,
height: h
}),
imageList = [
......@@ -33,20 +47,33 @@ export default {
url: backgroundImage,
x: 0,
y: 0,
width: 375,
height: (res[0].dh / res[0].dw) * 375
width: WIDTH,
height: (res[0].dh / res[0].dw) * WIDTH
},
{
url: detailImage,
x: 0,
y: (res[0].dh / res[0].dw) * 375,
width: 375,
height: (res[1].dh / res[1].dw) * 375
y: (res[0].dh / res[0].dw) * WIDTH,
width: WIDTH,
height: (res[1].dh / res[1].dw) * WIDTH
},
{ ...this.logoInfo }
].filter(item => item.url)
let textList = [],
title = this.cavansObj[this.editForm.templateId]
title = {
titleStyle: {
x: 82,
y: 224,
fontSize: 52,
color: '#AD604C'
},
subTitleStyle: {
x: 66,
y: 300,
fontSize: 24,
color: '#AD604C'
}
}
if (title) {
marketingTitle.split(' ').forEach((item, index) => {
textList.push({
......@@ -73,8 +100,9 @@ export default {
imageList,
textList
})
await this.uploadImg(canvasBase64)
this.addOrUpdate()
return new Promise(async resolve => {
resolve(await this.uploadImg(canvasBase64))
})
} catch (e) {
console.log(e)
}
......
......@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-05-16 17:13:33
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-07-10 15:53:51
* @LastEditTime: 2023-07-10 19:18:22
* @FilePath: \scrm-micro-home\src\store\modules\marketing.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -59,6 +59,7 @@ export default {
setKeyWords({ commit, state }, data) {
if (state.keywords == data) return
commit('SET_KET_WORDs', data)
if (!data) return
apis.marketing.getChatGPTList({ 'req.userPrompt': data }).then(res => {
const gptList = JSON.parse(res.message)
commit('SET_KET_WORDs', '')
......@@ -74,6 +75,28 @@ export default {
commit('SET_ACTIVITY_INFO', res)
})
},
getTemplateInfo({ state }, data) {
apis.marketing.calendarDetail({ id: data }).then(res => {
const { title, subTitle, startTime, endTime, backgroundImg, captionImg, codeId, couponItemList = [], id } = res || {}
if (couponItemList && couponItemList.length)
couponItemList.forEach(item => {
item.id = item.couponId
})
state.activityInfo = Object.assign(
{},
{
templateId: id,
codeId,
marketingTitle: title,
marketingSubtitle: subTitle,
backgroundImage: backgroundImg,
detailImage: captionImg,
couponItemList,
activityTime: [startTime + ' 00:00:00', endTime + ' 00:00:00']
}
)
})
},
//活动模板详情
getCalendarDetail({ commit }, data) {
apis.marketing.calendarDetail({ id: data }).then(res => {
......@@ -87,8 +110,8 @@ export default {
commit('SET_PROCESS', data)
},
setSubscribe({ commit, dispatch }, data) {
commit('SET_SUBSCRIBE', data)
dispatch('setKeyWords', subscribeData[data])
commit('SET_SUBSCRIBE', data.subscribe ? data.subscribe : data)
dispatch('setKeyWords', data.subscribe ? data.keywords : subscribeData[data])
}
}
}
......@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-06-29 21:24:27
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-07-10 14:51:57
* @LastEditTime: 2023-07-10 20:49:06
* @FilePath: \scrm-micro-link\src\views\activityLink\components\MarketingContent.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......@@ -219,13 +219,20 @@ export default {
activityInfo: {
handler(info) {
if (Object.keys(info).length == 0) {
return (this.editForm = {})
return (this.editForm = {
marketingTitle: '',
marketingSubtitle: '',
activityTime: [],
backgroundImage: '',
detailImage: '',
merchantLog: ''
})
}
if (info.subTitle) {
this.setDetail(info)
return
}
this.editForm = this.$common.utils.deepClone(info)
this.editForm = Object.assign({ merchantLog: '' }, this.$common.utils.deepClone(info))
if (info.activityName) {
this.$set(this.editForm, 'marketingTitle', info.activityName)
}
......@@ -253,7 +260,7 @@ export default {
...mapState('marketing', ['GPTList', 'subscribe', 'activityInfo', 'isInit'])
},
methods: {
...mapActions('marketing', ['setProcess']),
...mapActions('marketing', ['setProcess', 'getTemplateInfo']),
setDetail(info) {
const { title, subTitle, startTime, endTime, backgroundImg, captionImg, titleStyle, subTitleStyle, codeId } = this.$common.utils.deepClone(info || {})
this.editForm.codeId = codeId
......@@ -269,19 +276,6 @@ export default {
this.modelVisible = false
this.getTemplateInfo(val.id)
},
getTemplateInfo(id) {
this.$apis.marketing.calendarDetail({ id }).then(res => {
console.log(res)
const { title, subTitle, startTime, endTime, backgroundImg, captionImg, codeId } = this.$common.utils.deepClone(res || {})
this.editForm.templateId = id
this.editForm.codeId = id
this.editForm.marketingTitle = title
this.editForm.marketingSubtitle = subTitle
this.editForm.backgroundImage = backgroundImg
this.editForm.detailImage = captionImg
this.editForm.activityTime = [startTime + ' 00:00:00', endTime + ' 00:00:00']
})
},
getCouponInfoParams() {
var param = this.$common.utils.deepClone(this.editForm)
const d = param.activityTime
......
......@@ -227,8 +227,15 @@ export default {
couponAnticipatedCost: item.denomination
}
})
const equityServices = this.selectedCarList.map(i => i.packageCode)
params.equityServices = equityServices.join(',')
if (this.selectedCarList.length) {
const serviceMerchantPackageConfigDTOS = this.selectedCarList.map(i => {
return {
packageCode: i.packageCode,
packageAmount: i.packageAmount
}
})
params.serviceMerchantPackageConfigDTOS = serviceMerchantPackageConfigDTOS
}
params.activityPrice = (this.editForm.activityPrice * 100).toFixed(0)
params.superMarketingCouponRelRequestList = selectedGoodsList || []
console.log(params)
......
......@@ -67,7 +67,7 @@
</el-table-column>
<el-table-column label="操作" width="260">
<div class="config-panel flex" slot-scope="scope">
<div class="config-msg" v-if="item.assignType == 1 && item.registerStatus === 0" @click="showRegister">邀请人员注册</div>
<div class="config-msg" v-if="item.assignType == 1 && scope.row.registerStatus === 0" @click="showRegister">邀请人员注册</div>
<div class="config-msg" @click="handleConfig(item.batchNo, scope)">配置话术 / 短信</div>
</div>
</el-table-column>
......@@ -445,6 +445,7 @@ export default {
border: 1px solid #e5e5e5;
border-radius: 4px;
display: flex;
flex-wrap: wrap;
.flow-emp {
background: #f4f6fc;
border: 1px solid #e8e8ea;
......
......@@ -2,14 +2,14 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2023-05-15 15:08:32
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-07-10 10:16:44
* @LastEditTime: 2023-07-10 21:11:31
* @FilePath: \scrm-micro-home\src\views\home\components\Marketing\MarketingRight.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="review-body">
<canvas id="canvasId"></canvas>
<template v-if="isModel">
<template v-if="isRenewal">
<img src="@/assets/seckillActivity/phone.png" class="review-phone" />
<div class="review-title_top">{{ detail.marketingTitle || detail.activityName }}</div>
<div class="review-content">
......@@ -105,7 +105,7 @@
</div>
</div>
</template>
<template v-else-if="isSuper">
<template v-else-if="isFestival">
<img src="@/assets/seckillActivity/phone.png" class="review-phone" />
<div class="review-title_top">{{ detail.marketingTitle || detail.activityName }}</div>
<div class="review-content">
......@@ -191,7 +191,7 @@
</template>
<script>
const WIDTH = 244
const RATIO = RATIO / 375
const RATIO = WIDTH / 375
import PhoneViewA from './PhoneViewA'
import draw from '@/mixins/draw'
import equityOne from './model/model_1/equity'
......@@ -214,7 +214,9 @@ export default {
data() {
return {
backgroundHeight: 0,
logoHeight: 0,
currentIndex: 0,
isFestival: false,
draggableList: [
{
type: 'text',
......@@ -243,7 +245,7 @@ export default {
font: ''
}
],
isModel: true,
isRenewal: true,
modelNum: 4,
activityInfo: {},
detail: {
......@@ -279,57 +281,12 @@ export default {
...mapState('marketing', ['packageList', 'process'])
},
props: {
// activityInfo: {
// type: Object,
// default: () => {}
// },
isSuper: {
type: Boolean,
default: true
}
},
watch: {
// activityInfo: {
// handler(val) {
// this.detail = val
// const title = this.cavansObj[this.detail.templateId],
// { marketingTitle, marketingSubtitle } = this.detail,
// textList = []
// console.log(this.detail)
// if (title) {
// marketingTitle.split(' ').forEach((item, index) => {
// textList.push({
// x: title.titleStyle.x * 0.7,
// y: (title.titleStyle.y + index * title.titleStyle.fontSize * 1.1) * 0.7,
// fontSize: title.titleStyle.fontSize * 0.7,
// color: title.titleStyle.color,
// text: item,
// bold: title.titleStyle.bold
// })
// })
// new Array(marketingSubtitle).forEach((item, index) => {
// textList.push({
// x: title.subTitleStyle.x * 0.7,
// y: (title.subTitleStyle.y + title.titleStyle.fontSize * 1.1 * (textList.length - 1)) * 0.7,
// fontSize: title.subTitleStyle.fontSize * 0.7,
// color: title.subTitleStyle.color,
// text: item
// })
// })
// }
// this.textList = textList
// if (!this.detail.logoInfo) return
// const { x, y, height, width } = this.detail.logoInfo
// this.logoInfo = {
// x: (x * 262) / 375,
// y: (y * 262) / 375,
// height: (height * 262) / 375,
// width: (width * 262) / 375
// }
// },
// deep: true,
// immediate: true
// },
packageList: {
handler(val) {
console.log(val, 8888)
......@@ -341,23 +298,34 @@ export default {
process: {
async handler(val) {
this.detail = { ...this.detail, ...val[2] }
console.log(this.detail)
this.backgroundHeight = await this.getImgWH(this.detail.backgroundImage)
try {
const style1 = JSON.parse(this.detail.titleStyle)
const style2 = JSON.parse(this.detail.subTitleStyle)
Object.assign(this.draggableList[0], { content: this.detail.marketingTitle, ...style1, color: style1.style.color, font: style1.font })
Object.assign(this.draggableList[1], { content: this.detail.marketingSubtitle, ...style1, color: style2.style.color, font: style2.font })
} catch (e) {
console.log(e)
this.isFestival = false
this.isRenewal = false
console.log(this.detail.codeId, 88)
if (this.detail.codeId) {
this.isRenewal = true
this.backgroundHeight = await this.getImgH(this.detail.backgroundImage)
try {
const style1 = JSON.parse(this.detail.titleStyle)
const style2 = JSON.parse(this.detail.subTitleStyle)
Object.assign(this.draggableList[0], { content: this.detail.marketingTitle, ...style1, color: style1.style.color, font: style1.font })
Object.assign(this.draggableList[1], { content: this.detail.marketingSubtitle, ...style1, color: style2.style.color, font: style2.font })
} catch (e) {
console.log(e)
}
}
if (this.detail.templateId && !this.detail.codeId) {
this.isFestival = true
this.logoInfo = await this.getImgWH(this.detail.merchantLog)
}
console.log(this.detail, this.isRenewal)
},
deep: true
deep: true,
immediate: true
}
},
methods: {
//获取图片宽度高度
getImgWH(src) {
getImgH(src) {
return new Promise(resolve => {
const img = new Image()
img.src = src
......@@ -367,6 +335,16 @@ export default {
}
})
},
//获取图片宽度高度
getImgWH(src) {
return new Promise(resolve => {
const img = new Image()
img.src = src
img.onload = () => {
resolve({ width: Math.floor(RATIO * img.width), height: Math.floor(RATIO * img.height), x: WIDTH - Math.floor(RATIO * img.width) - 20, y: 20 })
}
})
},
onDrag(x, y) {
this.draggableList[this.currentIndex].x = x
this.draggableList[this.currentIndex].y = y
......@@ -444,6 +422,12 @@ export default {
width: 100%;
}
}
.review-main-img {
width: 100%;
img {
width: 100%;
}
}
.main-title {
position: absolute;
width: 100%;
......
......@@ -66,7 +66,13 @@ export default {
detail: { backgroundImage },
draggableList
} = this.$refs.viewForm
const url = await this.createMain(backgroundHeight, backgroundImage, draggableList)
let url
if (params.codeId) {
url = await this.createMain(backgroundHeight, backgroundImage, draggableList)
}
if (params.templateId && !params.codeId) {
url = await this.createBig(this.$refs.viewForm.detail, this.logoInfo, draggableList)
}
params.subscribe = this.subscribe
params.backgroundImage = url
this.$apis.marketing
......
......@@ -4,21 +4,32 @@
<div class="choseRow">
<div class="choseItem" :class="{ active: currentIndex == item.type }" v-for="(item, index) in tabList" :key="index" @click="tabClick(item.type)">{{ item.label }}</div>
</div>
<div class="fes-box" v-if="currentIndex == 6 && isShow">
<div class="fes-box" v-if="currentIndex == 6">
<div :class="{ 'fes-item': true, checked: selectItem.id == item.id }" v-for="item in festivalList" :key="item.id" @click="selectFes(item)">{{ item.title }}</div>
<div class="fes-waiting">不断更新中……</div>
</div>
<div class="scene-content">
<div class="scene-card" v-if="isShowCard">
<div class="scene-card-img">
<img src="" />
</div>
<div class="scene-card-content">
请扫码添加【XXXX】小管家,并组群获得支持
</div>
</div>
<div class="scene-item" v-for="(item, index) in sceneList" :key="index">
<div class="scene-item-box" @click="handleStep(index)" @mouseenter="isShowCard = true" @mouseleave="isShowCard = false">
<div class="scene-item-box" v-if="index == 0">
<el-popover placement="top-start" width="200" trigger="hover">
<div class="scene-card">
<div class="scene-card-img">
<img :src="qrCode" />
</div>
<div class="scene-card-content">
请扫码添加小管家,并组群获得支持
</div>
</div>
<div class="scene-item-box" slot="reference">
<div class="scene-item-title">
<img :src="require(`@/assets/marketing/s${index + 1}.png`)" alt="" />
{{ item.title }}
</div>
<div class="scene-item-content">{{ item.content }}</div>
</div>
</el-popover>
</div>
<div class="scene-item-box" v-else @click="handleStep(index)">
<div class="scene-item-title">
<img :src="require(`@/assets/marketing/s${index + 1}.png`)" alt="" />
{{ item.title }}
......@@ -39,13 +50,13 @@ export default {
data() {
return {
routeInfo: {},
qrCode: '',
tabList: [
{ label: '保险', type: 5 },
{ label: '定保', type: 2 },
{ label: '节日关怀', type: 6 },
{ label: '售后众筹', type: 9 }
],
isShow: false,
isShowCard: false,
selectItem: {},
festivalList: [],
......@@ -97,11 +108,12 @@ export default {
}
},
methods: {
...mapActions('marketing', ['setSubscribe', 'getActivityInfo']),
...mapActions('marketing', ['setSubscribe', 'getActivityInfo', 'getTemplateInfo']),
...mapMutations('marketing', ['SET_INIT', 'SET_STEP']),
selectFes(item) {
this.selectItem = item
this.isShow = false
this.getTemplateInfo(item.id)
this.setSubscribe({ subscribe: 6, keywords: item.keywords })
},
handleStep(index) {
if ([1, 2, 3].includes(index)) this.SET_STEP(index)
......@@ -114,14 +126,13 @@ export default {
},
tabClick(index) {
this.currentIndex = index
if (index == 6) {
this.isShow = true
if (index != 6) {
this.setSubscribe(index)
}
this.setSubscribe(index)
},
EntWechatQrCode() {
this.$apis.marketing.EntWechatQrCode({}).then(res => {
console.log(res)
this.qrCode = res.qrCode
})
},
calendarPage() {
......@@ -134,6 +145,25 @@ export default {
</script>
<style lang="scss" scoped>
.scene-card {
width: 158px;
height: 169px;
&-img {
width: 82px;
height: 82px;
margin: 10px auto;
img {
width: 82px;
height: 82px;
}
}
&-content {
font-size: 12px;
color: #666666;
text-align: center;
line-height: 18px;
}
}
.scene-container {
margin-top: 16px;
.scene-content {
......@@ -141,28 +171,7 @@ export default {
padding: 16px;
display: flex;
position: relative;
.scene-card {
position: absolute;
width: 178px;
height: 169px;
background: #ffffff;
border: 1px solid #e5e5e5;
box-shadow: 0 4px 12px 0 #00000014;
top: -160px;
left: 16px;
padding: 10px;
&-img {
width: 82px;
height: 82px;
margin: 10px auto;
}
&-content {
font-size: 12px;
color: #666666;
text-align: center;
line-height: 18px;
}
}
.scene-item {
width: 16.7%;
display: flex;
......
......@@ -41,22 +41,22 @@
<div class="link-title">{{ item.title }}</div>
<div class="link-save"><el-button :size="size" type="primary" @click="downloadIamge">保存图片</el-button></div>
</div>
<div class="link-item-r"><el-image :src="qrCodeUrl" alt=""></el-image></div>
<div class="link-item-r"><el-image :src="linkInfo[item.name]" alt=""></el-image></div>
</div>
</div>
<div class="link-address-box" v-for="(item, index) in linkValue" :key="index">
<div class="link-address-title">{{ item.title }}</div>
<div class="link-address">{{ item.url }}</div>
<div class="link-address">{{ linkInfo[item.name] }}</div>
<div class="link-clone"><el-button :size="size" type="primary" @click="cloneText(item, url)">复制链接</el-button></div>
</div>
</div>
<div class="qrcode-body" v-else>
<div class="img" v-loading="imgLoading">
<el-image :src="qrCodeUrl" alt=""></el-image>
<el-image :src="linkInfo.qrCodeUrl" alt=""></el-image>
</div>
<div class="qrcode-link m-t-10">
活动链接:{{ linkUrl }}
<span @click="handleSaveTxt(linkUrl)">复制</span>
活动链接:{{ linkInfo.linkUrl }}
<span @click="handleSaveTxt(linkInfo.linkUrl)">复制</span>
</div>
</div>
</GLDialog>
......@@ -73,17 +73,20 @@ export default {
data() {
return {
orderStatus,
isLink: true,
linkInfo: {},
attrToIcon: {
2: 'discount',
3: 'cash',
4: 'exchange',
7: 'service'
},
linkCode: [{ title: '活动二维码' }, { title: '注册二维码' }],
linkCode: [
{ title: '活动二维码', name: 'qrCodeUrl' },
{ title: '注册二维码', name: 'staffLoginQrCodeUrl' }
],
linkValue: [
{ title: '注册链接', url: 'thttp://scrm.test.glsx.com.cn/link/activityLink/index' },
{ title: '活动链接', url: 'thttp://scrm.test.glsx.com.cn/link/activityLink/index' }
{ title: '注册链接', name: 'staffLoginLinkUrl' },
{ title: '活动链接', name: 'linkUrl' }
],
qrCodeUrl: '',
linkUrl: '',
......@@ -258,7 +261,7 @@ export default {
// return row.status == 2 || row.status == 0
// },
listeners: {
click: row => this.shareQrcode(row)
click: row => this.shareQrcode(row, false)
}
},
{
......@@ -293,7 +296,7 @@ export default {
},
listeners: {
click: row => {
this.shareQrcode(row)
this.shareQrcode(row, true)
}
}
}
......@@ -368,13 +371,12 @@ export default {
params.id = row.id
this.secondConfirm('删除', '确定删除此活动?', 'seckillActivity', 'deleteActivityApi', params)
},
shareQrcode(row) {
shareQrcode(row, status) {
this.isQrcodeVisible = true
this.isLink = status
this.$apis.activity.getShared({ id: row.id }).then(res => {
if (res) {
this.isLink = false
this.linkUrl = res.linkUrl
this.qrCodeUrl = res.qrCodeUrl
this.linkInfo = res
}
})
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!