Commit a637768c by 杨明

fixed

1 parent cbaf032f
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn * @Author: yangming yangming@didihu.com.cn
* @Date: 2023-05-19 13:46:20 * @Date: 2023-05-19 13:46:20
* @LastEditors: yangming yangming@didihu.com.cn * @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-07-14 21:38:37 * @LastEditTime: 2023-07-20 10:46:23
* @FilePath: \scrm-micro-home\src\mixins\gpt.js * @FilePath: \scrm-micro-home\src\mixins\gpt.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -32,12 +32,12 @@ export default { ...@@ -32,12 +32,12 @@ export default {
async createBig(info, logoInfo, titleStyle, subTitleStyle) { async createBig(info, logoInfo, titleStyle, subTitleStyle) {
console.log(info) console.log(info)
this.loading = true this.loading = true
const { backgroundImage, detailImage, merchantLog, marketingTitle, marketingSubtitle } = info const { backgroundImage, detailImage, merchantLogo, marketingTitle, marketingSubtitle } = info
if (!backgroundImage) return if (!backgroundImage) return
try { try {
const res = await Promise.all([this.getImgInfo(backgroundImage), this.getImgInfo(detailImage), this.getImgInfo(merchantLog)]) const res = await Promise.all([this.getImgInfo(backgroundImage), this.getImgInfo(detailImage), this.getImgInfo(merchantLogo)])
const h = (res[0].dh / res[0].dw) * WIDTH + (res[1].dh / res[1].dw) * WIDTH const h = (res[0].dh / res[0].dw) * WIDTH + (res[1].dh / res[1].dw) * WIDTH
this.logoInfo = { url: merchantLog, ...logoInfo } this.logoInfo = { url: merchantLogo, ...logoInfo }
const drawfun = new Drawing(document.getElementById('canvasId'), { const drawfun = new Drawing(document.getElementById('canvasId'), {
width: WIDTH, width: WIDTH,
height: h height: h
...@@ -104,22 +104,34 @@ export default { ...@@ -104,22 +104,34 @@ export default {
console.log(e) console.log(e)
} }
}, },
async createMain(h, url, draggableList) { async createMain(info, draggableList) {
const style1 = draggableList[0] const style1 = draggableList[0]
const style2 = draggableList[1] const style2 = draggableList[1]
const drawfun = new Drawing(document.getElementById('canvasId'), { const drawfun = new Drawing(document.getElementById('canvasId'), {
width: WIDTH, width: WIDTH,
height: h height: info.backgroundHeight + info.detailHeight
}) })
const imageList = [ const imageList = [
{ {
url, url: info.backgroundImage,
x: 0, x: 0,
y: 0, y: 0,
width: WIDTH, width: WIDTH,
height: h height: info.backgroundHeight
} }
] ]
if (info.detailImage) {
imageList.push({
url: info.detailImage,
x: 0,
y: info.backgroundHeight,
width: WIDTH,
height: info.detailHeight
})
}
if (info.merchantLogo) {
imageList.push({ ...info.logoInfo, url: info.merchantLogo })
}
const textList = [ const textList = [
{ x: style1.x, y: style1.y, fontSize: style1.size, width: style1.width, text: style1.content, color: style1.color, font: style1.font }, { x: style1.x, y: style1.y, fontSize: style1.size, width: style1.width, text: style1.content, color: style1.color, font: style1.font },
{ x: style2.x, y: style2.y, fontSize: style2.size, width: style2.width, text: style2.content, color: style2.color, font: style2.font } { x: style2.x, y: style2.y, fontSize: style2.size, width: style2.width, text: style2.content, color: style2.color, font: style2.font }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2022-12-13 09:23:57 * @Date: 2022-12-13 09:23:57
* @LastEditors: yangming yangming@didihu.com.cn * @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-07-13 20:56:07 * @LastEditTime: 2023-07-19 17:32:17
* @FilePath: \scrm-micro-link\src\setup\qiankun.js * @FilePath: \scrm-micro-link\src\setup\qiankun.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -20,13 +20,14 @@ let instance = null ...@@ -20,13 +20,14 @@ let instance = null
Vue.use(ElementUI) Vue.use(ElementUI)
Vue.use(GLTable) Vue.use(GLTable)
export async function bootstrap({ history, common, messenger, globalState }) { export async function bootstrap({ history, common, messenger, globalState }) {
const { response, request, sign, secret, sign_common, request_common, request_gpt, request_merchant } = await fetchConfig(common) const { response, request, sign, secret, sign_common, request_common, request_gpt, request_merchant, messageModel } = await fetchConfig(common)
Vue.prototype.$history = history Vue.prototype.$history = history
Vue.prototype.$messenger = messenger Vue.prototype.$messenger = messenger
Vue.prototype.$globalState = globalState Vue.prototype.$globalState = globalState
Vue.prototype.$common = common Vue.prototype.$common = common
Vue.prototype.$message = message Vue.prototype.$message = message
Vue.prototype.$messageBox = messageBox Vue.prototype.$messageBox = messageBox
Vue.prototype.$messageModel = messageModel
Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: globalState.session.token } }) Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
Vue.prototype.$http_merchant = new common.Http({ response, request: request_merchant, sign, secret, alert: ElementUI.Message.error, headers: { token: globalState.session.token } }) Vue.prototype.$http_merchant = new common.Http({ response, request: request_merchant, sign, secret, alert: ElementUI.Message.error, headers: { token: globalState.session.token } })
Vue.prototype.$http_common = new common.Http({ response, signWay: 'md5', request: request_common, sign: sign_common, secret, alert: ElementUI.Message.error, headers: { TGT: globalState.session.token } }) Vue.prototype.$http_common = new common.Http({ response, signWay: 'md5', request: request_common, sign: sign_common, secret, alert: ElementUI.Message.error, headers: { TGT: globalState.session.token } })
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn * @Author: yangming yangming@didihu.com.cn
* @Date: 2023-05-16 17:13:33 * @Date: 2023-05-16 17:13:33
* @LastEditors: yangming yangming@didihu.com.cn * @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-07-18 15:17:25 * @LastEditTime: 2023-07-20 10:07:34
* @FilePath: \scrm-micro-home\src\store\modules\marketing.js * @FilePath: \scrm-micro-home\src\store\modules\marketing.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
...@@ -46,10 +46,6 @@ export default { ...@@ -46,10 +46,6 @@ export default {
}, },
// 设置活动信息 // 设置活动信息
SET_ACTIVITY_INFO(state, data) { SET_ACTIVITY_INFO(state, data) {
if (data.activityBigImg) {
data.backgroundImage = data.activityBigImg
data.merchantAddress = data.activityAddressDetailName
}
state.activityInfo = Object.assign({}, data) state.activityInfo = Object.assign({}, data)
}, },
SET_KET_WORDs(state, data) { SET_KET_WORDs(state, data) {
......
<!--
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-05-16 10:23:52
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-06-29 14:58:15
* @FilePath: \scrm-micro-home\src\views\home\components\Marketing\GPTAnalysis.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div>
<div class="main-box" v-loading="loading">
<div class="main-title">本次营销模型解析</div>
<div class="inport-result" v-if="importNum">
本次导入客户解析:客户数:
<span>{{ importNum }}人</span>
正在匹配中…
<span>
重新导入
<input type="file" style="opacity: 0" ref="file" accept="*" @change="uploadFile" />
</span>
</div>
<div class="inport-result" v-else>
待导入客户数据后解析
<span>
导入
<input type="file" style="opacity: 0" ref="file" accept="*" @change="uploadFile" />
</span>
</div>
<glsx-combi-form class="edit-form-container" :isBlock="true" ref="editFormRef" formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<div slot="marketingTitle" class="input-slot">
<el-input placeholder="请输入营销主题" v-model="editForm.marketingTitle" style="width:400px" maxlength="12" show-word-limit></el-input>
<label @click="getGPTitle(1)" v-if="GPTList">ChatGPT重新生成</label>
<label v-else class="disabled-label">ChatGPT重新生成</label>
</div>
<div slot="marketingSubtitle" class="input-slot">
<el-input placeholder="请输入副主题" v-model="editForm.marketingSubtitle" style="width:400px" maxlength="20" show-word-limit></el-input>
<label @click="getGPTitle(2)" v-if="GPTList">ChatGPT重新生成</label>
<label v-else class="disabled-label">ChatGPT重新生成</label>
</div>
<template slot="activityTimeHtml">
<div class="activity-time-container">
<el-date-picker v-model="editForm.activityTime" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy/MM/dd HH:mm:ss" :default-time="['00:00:00', '23:59:59']" @change="e => handleTimeChange(e, scope.scope)"></el-date-picker>
</div>
</template>
<div slot="selectGiftBtn">
<el-button type="default" class="el-icon-plus" @click="handleGiftAdd">选择服务</el-button>
</div>
<div class="gift-panel" slot="superMarketingCouponRelRequestListBlock" style="width: 700px" :style="{ 'margin-left': defaultLabelWidth }" v-show="editForm.superMarketingCouponRelRequestList && editForm.superMarketingCouponRelRequestList.length != 0">
<div class="gift-block">
<div v-for="(item, index) in orderShow" :key="index">
<div class="gift-box" v-show="couponObj[item].list.length">
<!-- <div class="gift-label">{{ couponObj[item].label }}:</div> -->
<img class="server-type" :src="require(`@/assets/coupon/icon-${item}.png`)" />
<div class="gift-content">
<div class="gift-item" v-for="(subItem, subIndex) in couponObj[item].list" :key="subIndex">
<span :class="['circle', subItem.status == '3' ? ' grey' : '']"></span>
<p :class="['gift-coupon-name', subItem.status == '3' ? ' txt-grey' : '']">{{ subItem.couponName }} × {{ subItem.couponAmount }}</p>
<p v-show="subItem.status == '3'" class="gift-tips">已失效</p>
<i class="el-icon-delete" style="color: #c6c6c6" @click="handleGiftDelete(item, subIndex)"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<div slot="selectGoodsBtn">
<div class="play-panel">
<div class="card-panel">
<el-tabs type="card" v-model="editForm.couponTemplateId" @tab-click="changeCouponTemplate">
<el-tab-pane :label="item.name" :name="item.id" v-for="item in couponTemplateList" :key="item.id"></el-tab-pane>
</el-tabs>
<div class="chose-panel" v-loading="goodsLoading">
<el-button type="default" class="el-icon-plus select-btn" @click="handleGoodsAdd">选择福利券</el-button>
<div style="width: 40vw" v-if="selectedGoodsList && selectedGoodsList.length">
<div class="goods-panel">
<el-table :data="selectedGoodsList" border style="width: 100%;overflow:auto">
<el-table-column type="index" label="序号" width="70"></el-table-column>
<el-table-column prop="brandName" label="品牌"></el-table-column>
<el-table-column prop="goodsName" label="商户名称"></el-table-column>
<el-table-column prop="couponAmount" label="数量"></el-table-column>
<el-table-column prop="denomination" label="劵面额">
<template slot-scope="scope">{{ (scope.row.denomination / 100).toFixed(2) }}元</template>
</el-table-column>
<el-table-column prop="effectiveDays" label="有效期">
<template slot-scope="scope">{{ scope.row.effectiveDays }}天</template>
</el-table-column>
<el-table-column prop="status" label="状态">
<template slot-scope="scope">{{ scope.row.status == 1 ? '未生效' : scope.row.status == 2 ? '生效中' : scope.row.status == 3 ? '已失效' : '' }}</template>
</el-table-column>
<el-table-column label="操作" width="100">
<template slot-scope="scope">
<el-button @click="handleDeleteGoods(scope.row)" type="text" size="small">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
</div>
</div>
</div>
<div slot="selectEquityBtn">
<el-button type="default" class="el-icon-plus" @click="handleEquityAdd">选择服务</el-button>
</div>
<div class="gift-panel" slot="equityListBlock" style="width: 700px" :style="{ 'margin-left': defaultLabelWidth }" v-show="selectedEquityList.length">
<div class="gift-block">
<div class="gift-title">
本次权益服务选择共
<span class="price">{{ selectedEquityList.length }}</span>
项
</div>
<div class="gift-box" v-show="selectedEquityList.length">
<!-- <div class="gift-label">{{ couponObj[item].label }}:</div> -->
<img class="server-type" :src="require(`@/assets/coupon/equity.png`)" />
<div class="gift-content">
<div class="gift-item" v-for="(subItem, subIndex) in selectedEquityList" :key="subIndex">
<span class="circle"></span>
<p :class="['gift-coupon-name']">{{ subitem.packageName }}</p>
<i class="el-icon-delete" style="color: #c6c6c6" @click="handleEquityDelete(subIndex)"></i>
</div>
</div>
</div>
</div>
</div>
</glsx-combi-form>
</div>
<GLFooter>
<el-button @click="handleCancel" size="medium">取消</el-button>
<el-button type="primary" @click="handleConfirm" size="medium">保存方案</el-button>
</GLFooter>
<select-emp-dialog v-if="isSelectEmpVisible" :isSelectEmpVisible="isSelectEmpVisible" :importNum="importNum" @handleEmpConfirm="handleEmpConfirm"></select-emp-dialog>
<select-gift-dialog v-if="isSelectGiftVisible" :isSelectGiftVisible="isSelectGiftVisible" :selectedGiftList="selectedMealList" @handleGiftConfirm="handleGiftConfirm" @handleGiftClose="handleGiftClose"></select-gift-dialog>
<select-goods-dialog v-if="isSelectGoodsVisible" :isSelectGoodsVisible="isSelectGoodsVisible" :selectedGoodsLists="selectedGoodsList" @handleGoodsConfirm="handleGoodsConfirm" @handleGoodsClose="handleGoodsClose"></select-goods-dialog>
<select-equity-dialog v-if="isSelectEquityVisible" :isSelectEquityVisible="isSelectEquityVisible" :selectedEquityLists="selectedEquityList" @handleEquityConfirm="handleEquityConfirm" @handleEquityClose="handleEquityClose"></select-equity-dialog>
</div>
</template>
<script>
const couponObj = {
// 折扣券
discount: {
label: '折扣券',
discountType: 2,
list: [],
logo: require('@/assets/coupon/icon-discount.png')
},
// 代金券
cash: {
label: '代金券',
discountType: 3,
list: [],
logo: require('@/assets/coupon/icon-cash.png')
},
// 兑换券
exchange: {
label: '兑换券',
discountType: 4,
list: [],
logo: require('@/assets/coupon/icon-exchange.png')
},
// 会员服务
service: {
label: '会员服务',
discountType: 7,
list: [],
logo: require('@/assets/coupon/icon-service.png')
}
}
const goodsObj = {
// 卡券
card: {
label: '卡券',
appearance: 1,
list: []
},
// 直充
recharge: {
label: '直充',
appearance: 2,
list: []
}
}
const numToCoupon = {
2: 'discount',
3: 'cash',
4: 'exchange',
7: 'service'
}
const numToGoods = {
1: 'card',
2: 'recharge'
}
const orderShow = ['service', 'cash', 'discount', 'exchange']
import selectGiftDialog from './selectGiftDialog'
import selectGoodsDialog from './selectGoodsDialog'
import selectEquityDialog from './selectEquityDialog'
import selectEmpDialog from './selectEquityDialog'
import getUploadImgColor from '@/utils/color'
import { mapState, mapActions, mapMutations } from 'vuex'
import gpt from '@/mixins/gpt'
import draw from '@/mixins/draw'
import util from '@/utils/index'
export default {
mixins: [gpt, draw],
name: 'analysis',
data() {
return {
editChildRef: 'editChildRef',
logoInfo: '',
importNum: 0,
couponTemplateList: [],
orderShow,
choseItemList: [],
selectedMealList: [],
selectedGoodsList: [],
selectedEquityList: [],
goodsLoading: false,
loading: false,
couponObj: JSON.parse(JSON.stringify(couponObj)),
goodsObj: JSON.parse(JSON.stringify(goodsObj)),
numToCoupon,
numToGoods,
isSelectGiftVisible: false,
isSelectGoodsVisible: false,
isSelectEquityVisible: false,
isSelectEmpVisible: false,
editForm: {
marketingTitle: '',
marketingSubtitle: '',
activityTime: [],
superMarketingCouponRelRequestList: [],
backgroundImage: '',
detailImage: '',
merchantLog: ''
},
editFormData: [
{
label: '营销标题',
name: 'marketingTitle',
addHtml: 'marketingTitle',
type: 'input',
maxlength: 12
},
{
label: '营销副标题',
name: 'marketingSubtitle',
addHtml: 'marketingSubtitle',
type: 'input',
maxlength: 20
},
{
label: '活动时间',
name: 'activityTime',
addHtml: 'activityTimeHtml',
isHide: false
},
{
label: '主题背景图',
name: 'backgroundImage',
type: 'upload',
width: '320px',
mark: '建议尺寸:最大5M,宽度750px,长度≤600px',
style: 'color: #999999;',
limitSize: 5,
maxPhotoNum: 1,
suffixSlot: 'backgroundImage',
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.loading = true
this.$apis.common
.pictureUpload({ file: base64, fileType: 'image' })
.then(res => {
this.editForm[targetItem.name] = res
this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name)
})
.finally(() => {
this.loading = false
})
}
},
{
label: '内容图',
name: 'detailImage',
type: 'upload',
width: '320px',
mark: '建议尺寸:最大10M,宽度750px,长度不限',
style: 'color: #999999;',
limitSize: 5,
maxPhotoNum: 1,
suffixSlot: 'detailImage',
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.loading = true
this.$apis.common
.pictureUpload({ file: base64, fileType: 'image' })
.then(res => {
this.editForm[targetItem.name] = res
this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name)
})
.finally(() => {
this.loading = false
})
}
},
{
label: '权益服务',
name: 'equityList',
addHtml: 'selectEquityBtn',
isHide: true
},
{
label: '',
name: 'equityListBlock',
addHtml: 'equityListBlock',
isHide: true
},
{
label: '平台优惠',
name: 'goodsList',
addHtml: 'selectGoodsBtn'
},
{
label: '门店优惠券',
name: 'superMarketingCouponRelRequestList',
addHtml: 'selectGiftBtn'
},
{
label: '',
name: 'superMarketingCouponRelRequestListBlock',
addHtml: 'superMarketingCouponRelRequestListBlock'
},
{
label: '活动参与价格/元',
name: 'activityPrice',
type: 'input'
},
{
label: '库存',
name: 'goodsStock',
type: 'InputNumber',
min: 0
},
{
label: '门店名称',
name: 'merchantname',
type: 'input'
},
{
label: '门店地址',
name: 'merchantAddress',
type: 'map',
isReadonly: false,
provinceView: false,
attrObj: {
provinceName: 'activityAddressProvinceName',
provinceCode: 'activityAddressProvinceCode',
cityName: 'activityAddressCityName',
cityCode: 'activityAddressCityCode',
lat: 'activityAddressLat',
lng: 'activityAddressLng',
fullAddress: 'merchantAddress'
}
},
{
label: '服务热线',
name: 'serviceHotline',
type: 'input'
},
{
label: '门店Logo',
name: 'merchantLog',
type: 'upload',
width: '320px',
mark: '建议尺寸:最大1M,尺寸216*60',
style: 'color: #999999;',
limitSize: 5,
maxPhotoNum: 1,
suffixSlot: 'merchantLog',
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.loading = true
this.$apis.common
.pictureUpload({ file: base64, fileType: 'image' })
.then(res => {
this.editForm[targetItem.name] = res
this.$refs.editFormRef.$refs[this.editChildRef].validateField(targetItem.name)
})
.finally(() => {
this.loading = false
})
}
}
],
editRule: {
marketingTitle: [{ required: true, message: '请输入营销标题', trigger: 'input' }],
marketingSubtitle: [{ required: true, message: '请输入营销副标题', trigger: 'input' }],
activityTime: [{ required: true, message: '请选择活动时间', trigger: 'input' }],
backgroundImage: [{ required: true, message: '请选择主题背景图', trigger: 'change' }],
detailImage: [{ required: true, message: '请选择内容图', trigger: 'change' }],
activityPrice: [{ required: true, message: '请输入活动参与价格/元:', trigger: 'input' }],
goodsStock: [{ required: true, message: '请输入库存', trigger: 'input' }],
merchantname: [{ required: true, message: '请输入门店名称', trigger: 'input' }],
merchantAddress: [{ required: true, message: '请选择门店地址', trigger: 'input' }],
serviceHotline: [{ required: true, message: '请输入服务热线', trigger: 'input' }]
}
}
},
componentsName: 'analysis',
computed: {
...mapState('marketing', ['activityInfo', 'GPTList', 'merchantInfo', 'keywords']),
mergeStr() {
const { backgroundImage, detailImage, merchantLog, mainColor, logoInfo, marketingTitle, marketingSubtitle, templateId } = this.editForm
return [backgroundImage, detailImage, merchantLog, mainColor, logoInfo, marketingTitle, marketingSubtitle, templateId]
}
},
watch: {
activityInfo(val) {
val && this.confirmMsg(val)
},
mergeStr(val) {
console.log(val, 999999999999)
this.setMergeImg(val)
},
merchantInfo() {
Object.assign(this.editForm, { merchantname: this.merchantInfo.merchantName, merchantAddress: this.merchantInfo.merchantAddress, merchantId: this.merchantInfo.merchantNo })
},
'editForm.activityPrice'(newValue, oldValue) {
this.editForm.activityPrice = util.limitPrice(newValue, oldValue, 6, 2, 0)
},
'editForm.detailImage'(newValue, oldValue) {
getUploadImgColor(newValue, color => {
this.editForm.mainColor = color
})
}
},
components: {
selectGiftDialog,
selectGoodsDialog,
selectEquityDialog,
selectEmpDialog
},
methods: {
...mapActions('marketing', ['setActivityInfo', 'setSchemeListData', 'setMergeImg']),
...mapMutations('marketing', ['SET_GPT_LIST', 'SET_COVER']),
//获取优惠券模板
couponTemplate() {
this.$apis.giftBag.couponTemplate({ pageSize: 10000, pageNum: 1 }).then(res => {
this.couponTemplateList = res.list || []
})
},
uploadFile(e) {
const file = e.srcElement.files[0]
let AllImgExt = '.xls|.xlsx' //文件格式判断
let extName = file.name.substring(file.name.lastIndexOf('.')).toLowerCase()
if (AllImgExt.indexOf(extName) === -1) {
this.$message.error('上传格式不正确')
return false
}
const reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = event => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(',')
const fileName = file.name.split('.')
//fileUrl: 文件名 + @ + base64拼接
const fileUrl = fileName.pop() + '@' + arrBase64[1]
//this.$apis.common.pictureUpload 调用接口api
this.$apis.common.pictureUpload({ file: fileUrl }).then(res => {
this.exportUrl = res
this.$refs.file.value = ''
this.handleSaveImport()
})
}
},
handleSaveImport() {
const { exportUrl } = this
this.$apis.activity.exportCustomer({ exportUrl }).then(res => {
this.importNum = res || 0
})
},
changeCouponTemplate(tab, event) {
this.$refs.editFormRef.$refs[this.editChildRef].clearValidate('goodsList')
const templateId = tab.name
this.editForm.couponTemplateId = templateId
this.editForm.couponTemplateName = tab.label
this.couponTemplateDetails(templateId)
},
//获取优惠券模板详情
couponTemplateDetails(templateId) {
this.goodsLoading = true
this.$apis.giftBag.couponTemplateDetails({ templateId, pageSize: 10000, pageNum: 1 }).then(res => {
this.selectedGoodsList = res.list || []
this.selectedGoodsList.forEach(item => (item.id = item.couponId))
this.goodsLoading = false
})
},
//获取图片宽度高度
getImgWH(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 })
}
})
},
uploadImg(imgFile) {
return new Promise((resolve, reject) => {
const base64 = 'png' + '@' + imgFile.split(',')[1]
this.$apis.common.pictureUpload({ file: base64, fileType: 'image' }).then(res => {
this.editForm.bigImage = res
resolve()
})
})
},
//选择门店优惠券
handleGiftAdd() {
this.selectedMealList = JSON.parse(JSON.stringify(this.couponObj))
this.handleGiftClose()
},
//选择商品优惠券
handleGoodsAdd() {
this.handleGoodsClose()
},
//选择权益
handleEquityAdd() {
this.handleEquityClose()
},
handleGiftClose() {
this.isSelectGiftVisible = !this.isSelectGiftVisible
},
handleGoodsClose() {
this.isSelectGoodsVisible = !this.isSelectGoodsVisible
console.log(this.isSelectGoodsVisible)
},
handleEquityClose() {
this.isSelectEquityVisible = !this.isSelectEquityVisible
},
handleEmpClose() {
this.isSelectEmpVisible = !this.isSelectEmpVisible
},
handleEmpConfirm(selectedData) {
this.editForm.followStaff = selectedData.staffId
this.handleEmpClose()
this.createCanvas()
},
handleEquityConfirm(selectedData) {
this.selectedEquityList = selectedData
this.handleEquityClose()
},
handleGiftConfirm(selectedData) {
this.$refs.editFormRef.$refs[this.editChildRef].clearValidate('superMarketingCouponRelRequestList')
this.handleGiftClose()
this.couponObj = selectedData
this.recoveryTotalPrice()
this.recoveryGiftList()
},
setNameHide(formName, name, status) {
name.forEach(i => {
var idx = this[formName].findIndex(item => item.name == i)
this[formName][idx].isHide = status
})
},
handleGoodsConfirm(selectedData) {
this.$refs.editFormRef.$refs[this.editChildRef].clearValidate('goodsList')
this.selectedGoodsList = selectedData || []
// this.setNameHide('goodsListBlock')
this.handleGoodsClose()
},
handleDeleteGoods(row) {
const index = this.selectedGoodsList.findIndex(k => k.id == row.id)
this.selectedGoodsList.splice(index, 1)
// this.setNameHide('goodsListBlock')
},
handleEquityDelete(idx) {
this.selectedEquityList.splice(idx, 1)
},
// 礼包
recoveryGiftList() {
this.editForm.superMarketingCouponRelRequestList = []
this.orderShow.forEach(item => {
this.couponObj[item].list.forEach(k => {
this.editForm.superMarketingCouponRelRequestList.push(k)
})
})
},
handleGiftDelete(attr, idx) {
this.couponObj[attr].list.splice(idx, 1)
this.recoveryTotalPrice()
this.recoveryGiftList()
},
recoveryCoupon() {
this.orderShow.forEach(item => {
this.couponObj[item].list = []
})
this.editForm.superMarketingCouponRelRequestList.forEach(item => {
console.log(this.numToCoupon[item.discountType])
if (this.numToCoupon[item.discountType]) {
this.couponObj[this.numToCoupon[item.discountType]].list.push(item)
}
})
},
// 计算预估成本
recoveryTotalPrice() {
this.totalEstimatedCost = 0
this.maxStock = 9999
this.orderShow.forEach(item => {
this.couponObj[item].list.forEach(subItem => {
let mult
if (!subItem.residueAmount) {
mult = 9999
} else {
mult = Math.floor(subItem.residueAmount / subItem.couponAmount)
}
this.maxStock = this.maxStock < mult ? this.maxStock : mult
// 失效券不加入预估成本
if (subItem.status != '3') {
this.totalEstimatedCost = this.totalEstimatedCost + parseInt(subItem.couponAnticipatedCost || 0) * parseInt(subItem.couponAmount)
}
})
})
this.totalEstimatedCost = (this.totalEstimatedCost / 100).toFixed(2)
if (this.editForm.goodsStock > this.maxStock) this.editForm.goodsStock = this.maxStock
},
changeFormAttr(formName, attrName, labelList, attrValue) {
labelList.forEach(item => {
let idx = this[formName].findIndex(k => k.label == item)
if (this[formName][idx]) {
this[formName][idx][attrName] = attrValue
}
})
},
getViewParams() {
const prams = this.getCouponInfoParams()
console.log(prams)
return { ...prams, selectedEquityList: this.selectedEquityList, couponList: this.editForm.superMarketingCouponRelRequestList, selectedGoodsList: this.selectedGoodsList }
},
getCouponInfoParams() {
var param = this.$common.utils.deepClone(this.editForm)
param.activityPrice = (param.activityPrice * 100).toFixed(0) //存的分,需乘100
const d = param.activityTime
if (d && d.length > 0) {
param.starttime = d[0]
param.endtime = d[1]
}
const couponList = this.$common.utils.deepClone(param.superMarketingCouponRelRequestList) || []
const couponLists = couponList.map(item => {
return {
couponId: item.couponId ? item.couponId : item.id,
couponAmount: item.couponAmount,
couponAnticipatedCost: item.couponAnticipatedCost
}
})
const selectedGoodsList = this.selectedGoodsList.map(item => {
return {
couponId: item.id,
couponAmount: item.couponAmount,
couponAnticipatedCost: item.denomination
}
})
const equityServices = this.selectedEquityList.map(i => i.packageCode)
param.equityServices = equityServices.join(',')
param.importCustomersUrl = this.exportUrl
param.superMarketingCouponRelRequestList = couponLists.concat(selectedGoodsList) || []
delete param.createdTime
delete param.activityCouponBaseInfoDTOS
return param
},
handleCancel() {
this.$router.push('/home/index')
},
handleConfirm() {
if (this.selectedGoodsList.length + this.editForm.superMarketingCouponRelRequestList.length + this.selectedGoodsList.length == 0) {
this.$message.error('权益服务、平台优惠、门店优惠券至少选一项')
return
}
this.$refs.editFormRef.$refs[this.editChildRef].validate(valid => {
if (valid) {
if (this.importNum) {
this.isSelectEmpVisible = true
} else {
this.createCanvas()
}
}
})
},
addOrUpdate() {
this.loading = true
var params = this.getCouponInfoParams()
this.$apis.activity
.createSuperMarketing(params)
.then(res => {
if (res) {
this.init()
this.$message.success('操作成功')
}
})
.finally(() => {
this.loading = false
})
},
getTemplateInfo(type) {
if (type != 'chatgpt') {
this.SET_GPT_LIST()
}
const { id } = this.activityInfo
this.$apis.activity.getCalendarDatail({ id }).then(res => {
const { title, subTitle, startTime, endTime, couponItemList, backgroundImg, captionImg } = this.$common.utils.deepClone(res.data || {})
this.editForm.templateId = 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']
this.selectedGoodsList = couponItemList
this.selectedGoodsList.forEach(item => {
item.id = item.couponId
})
})
},
// isGetList =true 创建成功初始化
init(isGetList = true) {
this.SET_GPT_LIST()
isGetList && this.setSchemeListData({ merchantId: this.editForm.merchantId, pageSize: 5, currentPage: 1 })
this.editForm = this.initValue()
this.selectedGoodsList = []
this.selectedEquityList = []
this.exportUrl = ''
this.importNum = 0
},
initValue() {
return { mainColor: '', activityPrice: '', marketingTitle: '', bigImage: '', marketingSubtitle: '', activityTime: [], superMarketingCouponRelRequestList: [], backgroundImage: '', detailImage: '', merchantLog: '', merchantname: this.merchantInfo.merchantName, merchantAddress: this.merchantInfo.merchantAddress, merchantId: this.merchantInfo.merchantNo }
},
getInfo() {
this.loading = true
this.SET_GPT_LIST()
let { id, subscribe } = this.activityInfo,
param = {
activityId: id
},
activityAPi = 'findActivityInfo'
if (subscribe != 8) {
param = {
id
}
activityAPi = 'activityDetail'
}
this.$apis.activity[activityAPi](param)
.then(res => {
var info = res
this.editForm = this.$common.utils.deepClone(res)
this.activityInfo = info
if (info.activityName) {
this.$set(this.editForm, 'marketingTitle', info.activityName)
}
if (info.starttime) {
this.$set(this.editForm, 'activityTime', [info.starttime.replace(/-/g, '/'), info.endtime.replace(/-/g, '/')])
}
if (info.startTime) {
this.$set(this.editForm, 'activityTime', [info.startTime.replace(/-/g, '/'), info.endTime.replace(/-/g, '/')])
}
if (info.merchantName) {
this.$set(this.editForm, 'merchantname', info.merchantName)
this.editForm = Object.assign(this.initValue(), this.editForm)
}
// 地图
if (info.activityAddressProvinceName || info.activityAddressCityName) {
this.$refs.editFormRef.$refs.provinceForm[0].init(info.activityAddressProvinceName, info.activityAddressCityName)
}
if (info.activityPrice) {
this.$set(this.editForm, 'activityPrice', info.activityPrice / 100)
}
if (info.serviceMerchantPackageConfigDTOList && info.serviceMerchantPackageConfigDTOList.length) {
this.selectedEquityList = info.serviceMerchantPackageConfigDTOList.map(item => {
return {
packageCode: item.packageCode,
packageName: item.packageName
}
})
}
let activityCoupon = this.editForm.activityCouponBaseInfoDTOS || this.editForm.couponList
if (activityCoupon && activityCoupon.length) {
activityCoupon.forEach(item => {
item.id = item.couponId
item.denomination = item.couponAnticipatedCost
})
this.selectedGoodsList = activityCoupon.filter(i => i.discountType == 8)
this.editForm.superMarketingCouponRelRequestList = activityCoupon.filter(i => i.discountType != 8)
this.recoveryCoupon()
this.recoveryTotalPrice()
} else {
this.editForm.superMarketingCouponRelRequestList = []
}
})
.finally(() => {
this.loading = false
})
},
confirmMsg(val) {
this.$confirm('新建营销方案,将放弃保存当前正在创建中的方案,是否新建营销方案?', '提示', {
// distinguishCancelAndClose: true,
confirmButtonText: '是',
cancelButtonText: '否',
type: 'warning'
})
.then(() => {
if (!val.id) {
return this.init(false)
}
val.type == 'programme' ? this.getInfo() : this.getTemplateInfo(val.type)
this.setActivityInfo()
})
.catch(() => {
this.setActivityInfo()
})
},
// 未开通不显示
equityMerchant() {
var params = {
merchantId: this.$globalState.session.merchantId
}
this.$apis.giftBag.equityMerchant(params).then(res => {
if (res.packageConfigs && res.packageConfigs) {
this.setNameHide('editFormData', ['equityList', 'equityListBlock'], false)
}
})
}
},
mounted() {
this.couponTemplate()
this.init(false)
this.equityMerchant()
}
}
</script>
<style lang="scss">
.container {
overflow: auto;
height: calc(100vh - 80px);
margin-top: 10px;
}
.main-head {
background: #fff;
}
.main-box {
background: #fff;
margin: 10px 0px 20px;
.main-title {
font-weight: 600;
font-size: 16px;
color: #333333;
padding: 15px 30px;
line-height: 28px;
border-bottom: 1px solid #f0f1f7;
}
.inport-result {
margin: 10px;
line-height: 22px;
background: #ffefda;
border-radius: 4px;
padding: 9px 16px;
font-size: 14px;
color: #333333;
span {
color: #5850ff;
margin-right: 20px;
&:last-child {
cursor: pointer;
position: relative;
input {
cursor: pointer;
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
font-size: 0px;
}
}
}
}
.edit-form-container {
padding: 8px 50px;
.input-slot {
label {
color: #5850ff;
font-size: 14px;
margin-left: 10px;
cursor: pointer;
&.disabled-label {
color: #999999;
cursor: no-drop;
}
}
}
}
.gift-panel {
.gift-block {
width: 602px;
border-radius: 4px;
border: 1px solid #e5e5e5;
.gift-title {
padding: 10px;
background-color: #f4f6fc;
border-bottom: 1px solid #e5e5e5;
.price {
font-size: 18px;
}
}
.gift-box {
display: flex;
padding: 10px 0 10px 10px;
img {
width: 58px;
height: 22px;
}
.gift-logo {
width: 58px;
height: 22px;
margin-right: 12px;
}
.gift-label {
width: 70px;
color: #999999;
text-align: right;
}
.gift-content {
width: calc(100% - 70px);
border-bottom: 1px solid #e5e5e5;
line-height: 22px;
padding-left: 10px;
.gift-item {
display: inline-block;
width: 50%;
.gift-coupon-name {
display: inline-block;
margin: 0 5px 0 7px;
}
.gift-tips {
display: inline-block;
font-size: 12px;
height: 18px;
line-height: 18px;
color: #999999;
background-color: #eeeded;
margin-right: 7px;
}
}
}
.gift-content:last-child {
border-bottom: 0px;
}
}
}
.gift-input {
font-size: 14px;
color: #333333;
margin: 10px 0px;
.el-input {
width: 136px;
}
}
.gift-tips {
font-size: 14px;
color: #999999;
}
}
.play-panel {
.card-panel {
width: 36vw;
.el-tabs__nav {
border: none;
}
.el-tabs__header {
margin: 0;
}
.el-tabs__item {
background: #fafafa;
border: 1px solid #e5e5e5;
border-radius: 4px 4px 0 0;
border-right: 1px solid #e5e5e5;
border-top: 1px solid #e5e5e5;
border-left: 1px solid #e5e5e5 !important;
border-bottom: none;
margin-right: 1px;
width: auto;
&.is-active {
color: #5850ff;
background: #fff;
font-weight: 600;
}
}
}
.choseRow {
display: flex;
height: auto;
.choseItem {
display: inline-block;
cursor: pointer;
line-height: 40px;
height: 40px;
background: #fafafa;
border-radius: 4px 4px 0 0;
border: 1px solid #e5e5e5;
border-bottom: none;
margin-right: 1px;
padding: 0 20px;
&.active {
color: #5850ff;
background: #fff;
font-weight: 600;
}
}
}
.chose-panel {
.select-btn {
margin-bottom: 10px;
}
.waiting-box {
width: 278px;
height: 278px;
margin: 15px auto 0;
}
padding: 20px;
width: 40vw;
min-height: 296px;
background: #ffffff;
border: 1px solid #e5e5e5;
border-radius: 0 4px 4px 4px;
}
}
}
</style>
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yangming yangming@didihu.com.cn * @Author: yangming yangming@didihu.com.cn
* @Date: 2023-06-29 21:24:27 * @Date: 2023-06-29 21:24:27
* @LastEditors: yangming yangming@didihu.com.cn * @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-07-18 23:51:09 * @LastEditTime: 2023-07-20 13:35:26
* @FilePath: \scrm-micro-link\src\views\activityLink\components\MarketingContent.vue * @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 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--> -->
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<el-button :size="size" icon="el-icon-plus" @click="modelVisible = true">选择模板</el-button> <el-button :size="size" icon="el-icon-plus" @click="modelVisible = true">选择模板</el-button>
</div> </div>
<div slot="marketingTitle" class="input-slot"> <div slot="marketingTitle" class="input-slot">
<el-input placeholder="请输入营销主题" v-model="editForm.marketingTitle" style="width:400px" maxlength="12" show-word-limit></el-input> <el-input placeholder="请输入营销主题" v-model="editForm.marketingTitle" style="width:400px" maxlength="10" show-word-limit></el-input>
<label @click="getGPTitle(1)" v-if="GPTList">ChatGPT重新生成</label> <label @click="getGPTitle(1)" v-if="GPTList">ChatGPT重新生成</label>
<label v-else class="disabled-label">ChatGPT重新生成</label> <label v-else class="disabled-label">ChatGPT重新生成</label>
</div> </div>
...@@ -58,7 +58,7 @@ export default { ...@@ -58,7 +58,7 @@ export default {
activityTime: [], activityTime: [],
backgroundImage: '', backgroundImage: '',
detailImage: '', detailImage: '',
merchantLog: '' merchantLogo: ''
}, },
editFormData: [ editFormData: [
{ {
...@@ -71,7 +71,7 @@ export default { ...@@ -71,7 +71,7 @@ export default {
name: 'marketingTitle', name: 'marketingTitle',
addHtml: 'marketingTitle', addHtml: 'marketingTitle',
type: 'input', type: 'input',
maxlength: 12 maxlength: 10
}, },
{ {
label: '营销副标题', label: '营销副标题',
...@@ -165,14 +165,14 @@ export default { ...@@ -165,14 +165,14 @@ export default {
}, },
{ {
label: '门店Logo', label: '门店Logo',
name: 'merchantLog', name: 'merchantLogo',
type: 'upload', type: 'upload',
width: '320px', width: '320px',
mark: '建议尺寸:最大1M,尺寸216*60', mark: '建议尺寸:最大1M,尺寸216*60',
style: 'color: #999999;', style: 'color: #999999;',
limitSize: 5, limitSize: 5,
maxPhotoNum: 1, maxPhotoNum: 1,
suffixSlot: 'merchantLog', suffixSlot: 'merchantLogo',
handleUpload: (e, file, targetItem) => { handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result const imgFile = e.target.result
const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1] const base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
...@@ -278,7 +278,7 @@ export default { ...@@ -278,7 +278,7 @@ export default {
activityTime: [], activityTime: [],
backgroundImage: '', backgroundImage: '',
detailImage: '', detailImage: '',
merchantLog: '', merchantLogo: '',
merchantname: this.merchantInfo.merchantName, merchantname: this.merchantInfo.merchantName,
merchantAddress: this.merchantInfo.merchantAddress merchantAddress: this.merchantInfo.merchantAddress
} }
...@@ -300,13 +300,16 @@ export default { ...@@ -300,13 +300,16 @@ export default {
return return
} }
console.log(888) console.log(888)
this.editForm = Object.assign({ merchantLog: '' }, info) this.editForm = Object.assign({ merchantLogo: '' }, info)
if (info.activityName) { if (info.activityName) {
this.$set(this.editForm, 'marketingTitle', info.activityName) this.$set(this.editForm, 'marketingTitle', info.activityName)
} }
if (info.subTitle) { if (info.subTitle) {
this.$set(this.editForm, 'marketingSubtitle', info.subTitle) this.$set(this.editForm, 'marketingSubtitle', info.subTitle)
} }
this.editForm.backgroundImage = info.mainImage || info.activityBigImg
this.editForm.merchantAddress = info.activityAddressDetailName
if (info.starttime) { if (info.starttime) {
this.$set(this.editForm, 'activityTime', [info.starttime.replace(/-/g, '/'), info.endtime.replace(/-/g, '/')]) this.$set(this.editForm, 'activityTime', [info.starttime.replace(/-/g, '/'), info.endtime.replace(/-/g, '/')])
} }
...@@ -326,7 +329,7 @@ export default { ...@@ -326,7 +329,7 @@ export default {
...info, ...info,
merchantname: this.merchantInfo.merchantName, merchantname: this.merchantInfo.merchantName,
merchantAddress: this.merchantInfo.merchantAddress, merchantAddress: this.merchantInfo.merchantAddress,
merchantLog: '', merchantLogo: '',
mainColor: '' mainColor: ''
} }
console.log(this.editForm, 9) console.log(this.editForm, 9)
...@@ -343,6 +346,7 @@ export default { ...@@ -343,6 +346,7 @@ export default {
param.starttime = d[0] param.starttime = d[0]
param.endtime = d[1] param.endtime = d[1]
} }
param.mainImage = param.backgroundImage
delete param.createdTime delete param.createdTime
delete param.activityPrice delete param.activityPrice
delete param.giftId delete param.giftId
......
...@@ -117,7 +117,7 @@ ...@@ -117,7 +117,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="营销短信:" :size="size"> <el-form-item label="营销短信:" :size="size">
<el-input v-model="configForm.messageContent" type="textarea" :disabled="true"></el-input> <el-input v-model="configForm.messageContent" type="textarea" :disabled="true" rows="3"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
...@@ -126,10 +126,6 @@ ...@@ -126,10 +126,6 @@
</template> </template>
<script> <script>
const config = Object.freeze({
talkId: '',
messageContent: '【广汇汽车】诚邀您参与{0},请尽快点击链接参与,谨防错过哦! {1} 谨防错过退订回T。'
})
const taskData = { tableData: [], expand: true, assignType: 0, customerNumTotal: 0, lastFollowStaffList: [], staffList: [], excelUrl: '', isFinish: false } const taskData = { tableData: [], expand: true, assignType: 0, customerNumTotal: 0, lastFollowStaffList: [], staffList: [], excelUrl: '', isFinish: false }
import { mapActions, mapState, mapMutations } from 'vuex' import { mapActions, mapState, mapMutations } from 'vuex'
export default { export default {
...@@ -146,7 +142,14 @@ export default { ...@@ -146,7 +142,14 @@ export default {
}, },
isQrcodeVisible: false, isQrcodeVisible: false,
configVisible: false, configVisible: false,
configForm: config, config: {
talkId: '',
messageContent: this.$messageModel
},
configForm: {
talkId: '',
messageContent: this.$messageModel
},
tableData: [], tableData: [],
roobList: [] roobList: []
} }
...@@ -295,8 +298,8 @@ export default { ...@@ -295,8 +298,8 @@ export default {
this.roobList = res.list || [] this.roobList = res.list || []
this.$nextTick(() => { this.$nextTick(() => {
this.configForm = { this.configForm = {
talkId: row.row.talkId ? row.row.talkId : config.talkId, talkId: row.row.talkId ? row.row.talkId : this.config.talkId,
messageContent: row.row.messageContent ? row.row.messageContent : config.messageContent messageContent: row.row.messageContent ? row.row.messageContent : this.config.messageContent
} }
}) })
}) })
...@@ -356,7 +359,7 @@ export default { ...@@ -356,7 +359,7 @@ export default {
merchantId: i.merchantNo, merchantId: i.merchantNo,
staffPhone: i.staffPhone, staffPhone: i.staffPhone,
staffName: i.staffName, staffName: i.staffName,
messageContent: i.messageContent ? i.messageContent.replace(/广汇汽车/, this.$globalState.session.merchantName) : '', messageContent: i.messageContent ? i.messageContent.replace(/^【\S+?】/, `【${this.$globalState.session.merchantName}】`) : '',
registerStatus: i.registerStatus, registerStatus: i.registerStatus,
talkId: i.talkId, talkId: i.talkId,
createdBy: i.createdBy createdBy: i.createdBy
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn * @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2023-05-15 15:08:32 * @Date: 2023-05-15 15:08:32
* @LastEditors: yangming yangming@didihu.com.cn * @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-07-17 17:47:36 * @LastEditTime: 2023-07-20 11:46:14
* @FilePath: \scrm-micro-home\src\views\home\components\Marketing\MarketingRight.vue * @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 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--> -->
...@@ -13,34 +13,42 @@ ...@@ -13,34 +13,42 @@
<img src="@/assets/seckillActivity/phone.png" class="review-phone" /> <img src="@/assets/seckillActivity/phone.png" class="review-phone" />
<div class="review-title_top">{{ detail.marketingTitle || detail.activityName }}</div> <div class="review-title_top">{{ detail.marketingTitle || detail.activityName }}</div>
<div class="review-content"> <div class="review-content">
<div class="review-main" v-if="backgroundHeight" :style="{ height: backgroundHeight + 'px' }"> <template v-if="backgroundHeight">
<template v-for="item in draggableList"> <div class="review-main" :style="{ height: backgroundHeight + 'px' }">
<vue-draggable-resizable <template v-for="item in draggableList">
:customId="item.customId" <vue-draggable-resizable
:key="item.customId" :customId="item.customId"
v-if="item.type == 'text'" :key="item.customId"
:w="item.width" v-if="item.type == 'text'"
:h="item.height" :w="item.width"
:x="item.x" :h="item.height"
:y="item.y" :x="item.x"
:style="{ :y="item.y"
'font-size': item.size + 'px', :style="{
'font-family': item.font, 'font-size': item.size + 'px',
color: item.color 'font-family': item.font,
}" color: item.color
class="img_cl" }"
parent=".review-main" class="img_cl"
@dragging="onDrag" parent=".review-main"
@resizing="onResize" @dragging="onDrag"
@activated="onActivated" @resizing="onResize"
> @activated="onActivated"
{{ item.content }} >
</vue-draggable-resizable> {{ item.content }}
</template> </vue-draggable-resizable>
<div class="review-bg-img"> </template>
<img :src="detail.backgroundImage" v-if="detail.backgroundImage" /> <div class="review-bg-img">
<img :src="detail.backgroundImage || detail.mainImage" v-if="detail.backgroundImage || detail.mainImage" />
</div>
<div class="review-logo-img" :style="{ height: logoInfo.height + 'px', width: logoInfo.width + 'px', top: logoInfo.y + 'px', left: logoInfo.x + 'px' }">
<img :src="detail.merchantLogo" v-if="detail.merchantLogo" />
</div>
</div> </div>
</div> <div class="review-main-img">
<img :src="detail.detailImage" v-if="detail.detailImage" />
</div>
</template>
<div class="review-main" v-else> <div class="review-main" v-else>
<div class="review-bg-img"> <div class="review-bg-img">
<img :src="detail.activityBigImg" v-if="detail.activityBigImg" /> <img :src="detail.activityBigImg" v-if="detail.activityBigImg" />
...@@ -128,7 +136,7 @@ ...@@ -128,7 +136,7 @@
<img :src="detail.detailImage" v-if="detail.detailImage" /> <img :src="detail.detailImage" v-if="detail.detailImage" />
</div> </div>
<div class="review-logo-img" :style="{ height: logoInfo.height + 'px', width: logoInfo.width + 'px', top: logoInfo.y + 'px', left: logoInfo.x + 'px' }"> <div class="review-logo-img" :style="{ height: logoInfo.height + 'px', width: logoInfo.width + 'px', top: logoInfo.y + 'px', left: logoInfo.x + 'px' }">
<img :src="detail.merchantLog" v-if="detail.merchantLog" /> <img :src="detail.merchantLogo" v-if="detail.merchantLogo" />
</div> </div>
</template> </template>
</div> </div>
...@@ -306,6 +314,7 @@ export default { ...@@ -306,6 +314,7 @@ export default {
data() { data() {
return { return {
backgroundHeight: 0, backgroundHeight: 0,
detailHeight: 0,
logoHeight: 0, logoHeight: 0,
currentIndex: 0, currentIndex: 0,
isFestival: false, isFestival: false,
...@@ -404,7 +413,9 @@ export default { ...@@ -404,7 +413,9 @@ export default {
handler(val) { handler(val) {
const info = this.$common.utils.deepClone(val) const info = this.$common.utils.deepClone(val)
if (this.routerInfo.addOrEdit == 'edit') { if (this.routerInfo.addOrEdit == 'edit') {
this.showActivity(info) info.marketingTitle = info.activityName
info.marketingSubtitle = info.subTitle
this.validActivity(info)
} }
}, },
deep: true, deep: true,
...@@ -412,6 +423,7 @@ export default { ...@@ -412,6 +423,7 @@ export default {
}, },
process: { process: {
handler(val) { handler(val) {
this.detailHeight = 0
const detail = { ...this.detail, ...val[2] } const detail = { ...this.detail, ...val[2] }
detail.activityPrice = val[1].activityPrice detail.activityPrice = val[1].activityPrice
if (this.routerInfo.addOrEdit == 'edit') { if (this.routerInfo.addOrEdit == 'edit') {
...@@ -449,7 +461,8 @@ export default { ...@@ -449,7 +461,8 @@ export default {
if (RENEWAL.includes(this.detail.codeId)) { if (RENEWAL.includes(this.detail.codeId)) {
this.modelNum = this.detail.codeId this.modelNum = this.detail.codeId
this.isRenewal = true this.isRenewal = true
this.backgroundHeight = await this.getImgH(this.detail.backgroundImage) this.backgroundHeight = await this.getImgH(this.detail.backgroundImage || this.detail.mainImage)
if (this.detail.detailImage) this.detailHeight = await this.getImgH(this.detail.detailImage)
const style1 = JSON.parse(this.detail.titleStyle) const style1 = JSON.parse(this.detail.titleStyle)
const style2 = JSON.parse(this.detail.subTitleStyle) const style2 = JSON.parse(this.detail.subTitleStyle)
const styles = [style1, style2] const styles = [style1, style2]
...@@ -459,8 +472,8 @@ export default { ...@@ -459,8 +472,8 @@ export default {
style.size = parseInt(style.size * RATIO) style.size = parseInt(style.size * RATIO)
style.width = parseInt(style.width * RATIO) style.width = parseInt(style.width * RATIO)
} }
Object.assign(this.draggableList[0], { content: this.detail.marketingTitle, ...style1, color: style1.style.color, font: style1.font }) Object.assign(this.draggableList[0], { content: this.detail.marketingTitle, ...style1, color: style1.style.color, font: style1.font, height: 'auto' })
Object.assign(this.draggableList[1], { content: this.detail.marketingSubtitle, ...style2, color: style2.style.color, font: style2.font }) Object.assign(this.draggableList[1], { content: this.detail.marketingSubtitle, ...style2, color: style2.style.color, font: style2.font, height: 'auto' })
} }
if (FESTIVAL.includes(this.detail.codeId)) { if (FESTIVAL.includes(this.detail.codeId)) {
const style1 = JSON.parse(this.detail.titleStyle) const style1 = JSON.parse(this.detail.titleStyle)
...@@ -497,8 +510,8 @@ export default { ...@@ -497,8 +510,8 @@ export default {
}) })
}) })
this.isFestival = true this.isFestival = true
this.logoInfo = await this.getImgWH(this.detail.merchantLog)
} }
if (this.detail.merchantLogo) this.logoInfo = await this.getImgWH(this.detail.merchantLogo)
}) })
}, },
formatPrice(val) { formatPrice(val) {
......
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
<script> <script>
const RENEWAL = [1, 2, 3, 4, 5, 6, 7, 8] const RENEWAL = [1, 2, 3, 4, 5, 6, 7, 8]
const FESTIVAL = [9, 10] const FESTIVAL = [9, 10]
const WIDTH = 244
const RATIO = 375 / WIDTH
import { mapState, mapMutations } from 'vuex' import { mapState, mapMutations } from 'vuex'
import phoneView from './PhoneView' import phoneView from './PhoneView'
import draw from '@/mixins/draw' import draw from '@/mixins/draw'
...@@ -133,12 +135,27 @@ export default { ...@@ -133,12 +135,27 @@ export default {
this.loading = true this.loading = true
const { const {
backgroundHeight, backgroundHeight,
detail: { backgroundImage, titleStyle, subTitleStyle }, detailHeight,
logoInfo,
detail: { backgroundImage, detailImage, merchantLogo, titleStyle, subTitleStyle },
draggableList draggableList
} = this.$refs.viewForm } = this.$refs.viewForm
let url = backgroundImage let url = backgroundImage
if (RENEWAL.includes(params.codeId) && this.routerInfo.addOrEdit != 'edit') { if (RENEWAL.includes(params.codeId)) {
url = await this.createMain(backgroundHeight, backgroundImage, draggableList) //合并主图、文字 url = await this.createMain({ backgroundHeight, detailHeight, logoInfo, backgroundImage, detailImage, merchantLogo }, draggableList) //合并主图、文字
const style1 = draggableList[0]
const style2 = draggableList[1]
const titleStyle = JSON.parse(params.titleStyle)
const subTitleStyle = JSON.parse(params.subTitleStyle)
const styles = [style1, style2]
for (const style of styles) {
style.x = parseInt(style.x * RATIO)
style.y = parseInt(style.y * RATIO)
style.size = parseInt(style.size * RATIO)
style.width = parseInt(style.width * RATIO)
}
params.titleStyle = JSON.stringify(Object.assign(titleStyle, { x: style1.x, y: style1.y, size: style1.size, width: style1.width }))
params.subTitleStyle = JSON.stringify(Object.assign(subTitleStyle, { x: style2.x, y: style2.y, size: style2.size, width: style2.width }))
} }
if (FESTIVAL.includes(params.codeId) && this.routerInfo.addOrEdit != 'edit') { if (FESTIVAL.includes(params.codeId) && this.routerInfo.addOrEdit != 'edit') {
url = await this.createBig(this.$refs.viewForm.detail, this.logoInfo, JSON.parse(titleStyle), JSON.parse(subTitleStyle)) //合并主图、背景图、logo、文字 url = await this.createBig(this.$refs.viewForm.detail, this.logoInfo, JSON.parse(titleStyle), JSON.parse(subTitleStyle)) //合并主图、背景图、logo、文字
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!