Commit c025c59c by 杨明

fixed

1 parent a320fbe9
......@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2023-05-15 15:08:32
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-07-13 21:03:19
* @LastEditTime: 2023-07-14 09:40:52
* @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
-->
......@@ -11,7 +11,7 @@
<img src="@/assets/phone.png" class="review-phone" />
<div class="review-title_top">{{ detail.title }}</div>
<div class="review-content" v-if="isRenewal">
<div class="review-main">
<div class="review-main" v-if="backgroundHeight" :style="{ height: backgroundHeight + 'px' }">
<template v-for="item in draggableList">
<vue-draggable-resizable
:customId="item.customId"
......@@ -69,6 +69,24 @@
<img :src="detail.captionImg" v-if="detail.captionImg" />
</div>
</div>
<div class="review-package">
<div class="review-goods" v-if="selectedGoodsList && selectedGoodsList.length">
<div class="goods-item" v-for="(item, index) in selectedGoodsList" :key="index">
<div class="service-logo">
<img :src="item.goodsImage || $vip" />
</div>
<div class="service-desc">
<div class="title">{{ item.brandName }}{{ item.goodsName }}</div>
<div class="content">x{{ item.couponAmount }} 抵扣券</div>
</div>
<div class="service-price">
{{ (item.denomination / 100).toFixed(2) }}
<span>元</span>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
......@@ -93,6 +111,7 @@ export default {
data() {
return {
currentIndex: 0,
backgroundHeight: 0,
modelNum: 4,
isRenewal: false,
discount: {
......@@ -172,52 +191,38 @@ export default {
},
watch: {
editForm: {
handler(val) {
async handler(val) {
this.isRenewal = false
this.backgroundHeight = 0
if (RENEWAL.includes(val.codeId)) {
this.modelNum = val.codeId
this.isRenewal = true
}
this.detail = this.editForm
const mainTitle = this.cavansObj[1],
{ title, subTitle } = val,
textList = []
if (mainTitle) {
title.split(' ').forEach((item, index) => {
textList.push({
x: mainTitle.titleStyle.x * 0.7,
y: (mainTitle.titleStyle.y + index * mainTitle.titleStyle.fontSize * 1.1) * 0.7,
fontSize: mainTitle.titleStyle.fontSize * 0.7,
color: mainTitle.titleStyle.color,
text: item
})
})
new Array(subTitle).forEach((item, index) => {
textList.push({
x: mainTitle.subTitleStyle.x * 0.7,
y: (mainTitle.subTitleStyle.y + mainTitle.titleStyle.fontSize * 1.1 * (textList.length - 1)) * 0.7,
fontSize: mainTitle.subTitleStyle.fontSize * 0.7,
color: mainTitle.subTitleStyle.color,
text: item
})
})
}
this.textList = textList
this.detail = val
},
deep: true,
immediate: true
},
'editForm.titleStyle': {
handler(val) {
console.log(888)
const { title, subTitle, titleStyle, subTitleStyle, marketingType } = this.editForm
if (marketingType == 5) {
const { title, subTitle, titleStyle, subTitleStyle, backgroundImg } = val
try {
const style1 = JSON.parse(titleStyle)
const style2 = JSON.parse(subTitleStyle)
Object.assign(this.draggableList[0], { content: title, ...style1, color: style1.style.color, font: style1.font, height: style1.size })
Object.assign(this.draggableList[1], { content: subTitle, ...style2, color: style2.style.color, font: style2.font, height: style2.size })
if (this.isRenewal) {
Object.assign(this.draggableList[0], { content: title, ...style1, color: style1.style.color, font: style1.font, height: style1.size })
Object.assign(this.draggableList[1], { content: subTitle, ...style2, color: style2.style.color, font: style2.font, height: style2.size })
this.backgroundHeight = await this.getImgH(backgroundImg)
return
}
const textList = []
textList.push({
...style1,
text: title
})
textList.push({
...style2,
text: subTitle
})
this.textList = textList
console.log(this.textList)
} catch (e) {
console.log(e)
}
},
deep: true,
......@@ -225,6 +230,17 @@ export default {
}
},
methods: {
//获取图片宽度高度
getImgH(src) {
return new Promise(resolve => {
const img = new Image()
img.src = src
img.onload = () => {
console.log(WIDTH, img.height, img.width)
resolve(Math.floor((WIDTH * img.height) / img.width))
}
})
},
onDrag(x, y) {
this.draggableList[this.currentIndex].x = x
this.draggableList[this.currentIndex].y = y
......@@ -271,7 +287,6 @@ export default {
left: 13px;
.review-main {
position: relative;
height: 300px;
.main-title {
width: 100%;
position: absolute;
......@@ -282,6 +297,117 @@ export default {
}
}
}
.review-package {
background: #ddd8c0;
padding: 16px;
.review-equity,
.review-service,
.review-goods {
background: #ffffff;
border-radius: 12px;
padding: 10px;
margin-bottom: 10px;
}
.service-item {
height: 48px;
background-image: linear-gradient(117deg, #ffead3 3%, #f0ca90 92%);
border-radius: 4px;
display: flex;
align-items: center;
padding: 4px;
margin-top: 5px;
&:first-child {
margin-top: 0px;
}
.service-title {
width: 74%;
height: 40px;
background: #ffffff;
border-radius: 6px;
font-size: 14px;
color: #333333;
line-height: 40px;
padding-left: 12px;
}
.service-time {
color: #8e5310;
text-align: center;
flex: 1;
font-size: 12px;
line-height: 48px;
}
}
.coupon-item {
height: 48px;
background: #fff5f3;
border-radius: 4px;
display: flex;
align-items: center;
padding: 4px;
margin-top: 5px;
&:first-child {
margin-top: 0px;
}
.service-title {
width: 64%;
height: 40px;
background: #ffffff;
border-radius: 6px;
font-size: 14px;
color: #333333;
line-height: 40px;
padding: 0px 12px;
display: flex;
justify-content: space-between;
span {
font-size: 14px;
color: #333333;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
&:last-child {
font-size: 11px;
color: #9b9b9b;
}
}
}
.service-time {
color: #fc5b32;
text-align: center;
flex: 1;
font-size: 12px;
line-height: 48px;
}
}
.goods-item {
display: flex;
border-bottom: 1px solid #f8f7f2;
padding: 5px;
&:last-child {
border-bottom: none;
}
.service-logo {
width: 32px;
height: 32px;
margin-right: 10px;
img {
width: 32px;
height: 32px;
}
}
.service-desc {
width: 55%;
.title {
font-size: 12px;
color: #111111;
}
.content {
font-size: 11px;
color: #9b9b9b;
}
}
}
}
.main-body {
margin-top: 63px;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!