Commit b6f52280 by 杨明

fixed

1 parent cf9bdfb7
......@@ -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-16 16:27:09
* @LastEditTime: 2023-07-17 15:39:18
* @FilePath: \scrm-micro-home\src\store\modules\marketing.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -47,7 +47,6 @@ export default {
// 设置活动信息
SET_ACTIVITY_INFO(state, data) {
if (data.activityBigImg) {
data.codeId = null
data.backgroundImage = data.activityBigImg
data.merchantAddress = data.activityAddressDetailName
}
......
......@@ -28,7 +28,7 @@
</GLTable>
</GLDialog>
<el-dialog title="预览" :append-to-body="true" :before-close="handleClose" :visible.sync="dialogVisible" width="30%">
<phone-view v-if="dialogVisible" :activityInfo="activityInfo"></phone-view>
<phone-view v-if="dialogVisible" :activityDetail="activityInfo"></phone-view>
</el-dialog>
</div>
</template>
......
......@@ -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-16 16:47:44
* @LastEditTime: 2023-07-17 15:40:36
* @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
-->
......@@ -295,7 +295,7 @@ export default {
}
return
}
if (info.codeId) {
if (info.codeId && this.routerInfo.addOrEdit == 'add') {
this.setDetail(info)
return
}
......
......@@ -85,10 +85,11 @@
<script>
// import addGift from './AddGift'
import gift from '@/mixins/gift'
import marketing from '@/mixins/marketing'
import { openTab } from '@/utils/index'
import { mapActions, mapState } from 'vuex'
import { mapActions, mapMutations, mapState } from 'vuex'
export default {
mixins: [gift],
mixins: [gift, marketing],
// components: {
// addGift
// },
......@@ -164,6 +165,11 @@ export default {
if (info.activityPrice) {
this.editForm.activityPrice = info.activityPrice / 100
}
setTimeout(() => {
if (this.routerInfo.addOrEdit == 'edit') {
this.handleSaveGift()
}
}, 100)
this.getList()
})
......@@ -176,6 +182,7 @@ export default {
},
methods: {
...mapActions('marketing', ['setPackage', 'setProcess']),
...mapMutations('marketing', ['SET_STEP']),
init() {
this.currentIndex = '1'
this.goodsIndex = 1
......@@ -249,7 +256,8 @@ export default {
params.equityServices = equityServices.join(',')
params.activityPrice = (this.editForm.activityPrice * 100).toFixed(0)
params.superMarketingCouponRelRequestList = selectedGoodsList || []
console.log(params)
console.log(888)
this.SET_STEP(3)
this.setProcess({
1: {
...params
......
......@@ -76,6 +76,10 @@
</el-table-column>
</el-table>
</div>
<div class="footer-box">
<el-button @click="handleCancelTask(item)">取消</el-button>
<el-button type="primary" @click="handleConfirmTask()">确定</el-button>
</div>
</div>
</template>
</div>
......@@ -124,7 +128,7 @@ const config = Object.freeze({
messageContent: '【广汇汽车】诚邀您参与{0},请尽快点击链接参与,谨防错过哦! {1} 谨防错过退订回T。'
})
const taskData = { tableData: [], expand: true, assignType: 0, customerNumTotal: 0, lastFollowStaffList: [], staffList: [], excelUrl: '', isFinish: false }
import { mapActions, mapState } from 'vuex'
import { mapActions, mapState, mapMutations } from 'vuex'
export default {
data() {
return {
......@@ -173,6 +177,7 @@ export default {
},
methods: {
...mapActions('marketing', ['setProcess']),
...mapMutations('marketing', ['SET_STEP']),
uploadFile(e, item) {
const file = e.srcElement.files[0]
let AllImgExt = '.xls|.xlsx'
......@@ -237,11 +242,10 @@ export default {
},
//营销任务-导入客户
importCustomer(url, item) {
console.log(this.customerKeys)
let param = {
merchantId: this.$globalState.session.merchantId,
excelUrl: url,
customerKeys: this.customerKey
customerKeys: this.customerKey.filter(item => item)
}
this.$apis.marketing.importCustomer(param).then(res => {
if (res.customerNumTotal == 0) {
......@@ -298,6 +302,18 @@ export default {
this.configVisible = false
this.configForm = {}
},
handleCancelTask(item) {
item.isFinish = false
item.excelUrl = ''
item.key = ''
item.lastFollowStaffList = ''
item.customerNumTotal = ''
this.customerKey[item.batchNo - 1] = ''
console.log(this.customerKey)
},
handleConfirmTask() {
this.vaildTask()
},
handleCancelConfirm() {
this.configVisible = false
console.log(this.taskList[this.batchNo].tableData)
......@@ -311,43 +327,47 @@ export default {
this.customerKey = []
this.findMerchantStaffList()
this.setProcess({ 0: true })
this.SET_STEP(2)
},
handleConfirm() {
if (this.vaildTask()) {
const customerRequestList = this.$common.utils.deepClone(this.taskList).map(item => {
return {
batchNo: item.batchNo,
excelUrl: item.excelUrl,
staffList: item.staffList,
assignType: item.assignType,
key: item.key
}
})
customerRequestList.forEach(item => {
item.staffList = item.staffList.reduce((result, i) => {
if (i.customerNum) {
result.push({
lastStaffFlag: i.lastCustomerNum ? 1 : 0,
lastCustomerNum: i.lastCustomerNum,
merchantId: i.merchantNo,
staffPhone: i.staffPhone,
staffName: i.staffName,
messageContent: i.messageContent ? i.messageContent.replace(/广汇汽车/, this.$globalState.session.merchantName) : '',
registerStatus: i.registerStatus,
talkId: i.talkId,
createdBy: i.createdBy
})
}
return result
}, [])
})
console.log(customerRequestList)
this.setProcess({
0: {
customerRequestList
}
})
const task = this.getFinisTask()
if (task.length == 0) {
this.$message.error('请配置营销任务')
return
}
const customerRequestList = this.$common.utils.deepClone(task).map(item => {
return {
batchNo: item.batchNo,
excelUrl: item.excelUrl,
staffList: item.staffList,
assignType: item.assignType,
key: item.key
}
})
customerRequestList.forEach(item => {
item.staffList = item.staffList.reduce((result, i) => {
if (i.customerNum) {
result.push({
lastStaffFlag: i.lastCustomerNum ? 1 : 0,
lastCustomerNum: i.lastCustomerNum,
merchantId: i.merchantNo,
staffPhone: i.staffPhone,
staffName: i.staffName,
messageContent: i.messageContent ? i.messageContent.replace(/广汇汽车/, this.$globalState.session.merchantName) : '',
registerStatus: i.registerStatus,
talkId: i.talkId,
createdBy: i.createdBy
})
}
return result
}, [])
})
this.SET_STEP(3)
this.setProcess({
0: {
customerRequestList
}
})
},
//验证配置任务,及分配人员
vaildTask() {
......@@ -372,6 +392,28 @@ export default {
return false
}
},
getFinisTask() {
const len = this.taskList.length
const task = this.taskList[len - 1]
const staffListLength = task.staffList.length
//获取上次跟进人总数
const lastCustomerNum = task.assignType == 0 ? 0 : task.staffList.reduce((total, { lastCustomerNum }) => total + (lastCustomerNum || 0), 0)
if (task.excelUrl && staffListLength) {
task.isFinish = true
let residue = task.customerNumTotal - lastCustomerNum || 0
let avag = Math.ceil(residue / staffListLength)
task.staffList.forEach((item, i) => {
const lastNum = task.assignType == 0 ? 0 : item.lastCustomerNum || 0
this.$set(item, 'customerNum', residue > avag ? lastNum + avag : lastNum + residue)
residue -= avag
avag = Math.ceil(residue / (staffListLength - i - 1))
})
return this.taskList
} else {
return this.taskList.slice(0, len - 1)
}
},
addTask() {
let len = this.taskList.length
if (len == 10) {
......@@ -500,6 +542,11 @@ export default {
margin-right: 10px;
}
}
.footer-box {
text-align: center;
margin-top: 30px;
padding-bottom: 20px;
}
}
}
}
......
......@@ -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-16 14:01:44
* @LastEditTime: 2023-07-17 16:29:54
* @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
-->
......@@ -107,6 +107,12 @@
</div>
</div>
</div>
<div class="wechat-footer">
<div class="footer-panel">
<div class="wechat-footer-price">¥{{ ((detail.activityPrice || 0) / 100).toFixed(2) }}元</div>
<img src="@/assets/seckillActivity/crowd-footer.png" />
</div>
</div>
</template>
<template v-else-if="isFestival">
<img src="@/assets/seckillActivity/phone.png" class="review-phone" />
......@@ -185,13 +191,18 @@
</div>
</div>
</div>
<div class="review-footer" v-if="!isNaN(detail.activityPrice)">
<label>¥</label>
{{ (detail.activityPrice / 100).toFixed(2) }}
<div class="wechat-footer">
<div class="footer-panel">
<div class="wechat-footer-price">¥{{ ((detail.activityPrice || 0) / 100).toFixed(2) }}元</div>
<img src="@/assets/seckillActivity/crowd-footer.png" />
</div>
</div>
</template>
<template v-else-if="activityDetail">
<phone-view-a :editForm="activityDetail"></phone-view-a>
</template>
<template v-else>
<phone-view-a :editForm="activityInfo" v-if="activityInfo"></phone-view-a>
<img src="@/assets/seckillActivity/phone.png" class="review-phone" />
</template>
</div>
</template>
......@@ -202,6 +213,7 @@ const RENEWAL = [1, 2, 3, 4, 5, 6, 7, 8]
const FESTIVAL = [9, 10]
import PhoneViewA from './PhoneViewA'
import draw from '@/mixins/draw'
import marketing from '@/mixins/marketing'
import equityOne from './model/model_1/equity'
import goodsOne from './model/model_1/goods'
import couponOne from './model/model_1/coupon'
......@@ -218,7 +230,7 @@ import { mapState } from 'vuex'
import VueDraggableResizable from '@/components/draggable/vue-draggable-resizable'
import '@/components/draggable/vue-draggable-resizable.css'
export default {
mixins: [draw],
mixins: [draw, marketing],
data() {
return {
backgroundHeight: 0,
......@@ -286,14 +298,14 @@ export default {
couponFour
},
computed: {
...mapState('marketing', ['packageList', 'process'])
...mapState('marketing', ['packageList', 'process', 'activityInfo'])
},
props: {
isSuper: {
type: Boolean,
default: true
},
activityInfo: {
activityDetail: {
type: Object,
default: () => {}
}
......@@ -316,83 +328,104 @@ export default {
})
},
watch: {
// packageList: {
// handler(val) {
// console.log(val, 8888)
// this.detail = { ...this.detail, ...val }
// },
// deep: true,
// immediate: true
// },
activityInfo: {
handler(val) {
const info = this.$common.utils.deepClone(val)
if (this.routerInfo.addOrEdit == 'edit') {
this.showActivity(info)
}
},
deep: true,
immediate: true
},
process: {
handler(val) {
this.detail = { ...this.detail, ...val[2] }
this.detailCoupon = this.$common.utils.deepClone(this.packageList)
console.log(this.detailCoupon)
this.$nextTick(async () => {
this.isFestival = false
this.isRenewal = false
if (!this.detail) return
if (RENEWAL.includes(this.detail.codeId)) {
this.modelNum = this.detail.codeId
this.isRenewal = true
this.backgroundHeight = await this.getImgH(this.detail.backgroundImage)
const style1 = JSON.parse(this.detail.titleStyle)
const style2 = JSON.parse(this.detail.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)
}
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, ...style2, color: style2.style.color, font: style2.font })
}
if (FESTIVAL.includes(this.detail.codeId)) {
const style1 = JSON.parse(this.detail.titleStyle)
const style2 = JSON.parse(this.detail.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)
}
this.textList = []
const title = {
titleStyle: style1,
subTitleStyle: style2
}
this.detail.marketingTitle.split(' ').forEach((item, index) => {
this.textList.push({
x: title.titleStyle.x,
y: title.titleStyle.y + index * title.titleStyle.fontSize * 1.14,
fontSize: title.titleStyle.fontSize,
color: title.titleStyle.color,
text: item,
bold: title.titleStyle.bold
})
})
new Array(this.detail.marketingSubtitle).forEach((item, index) => {
this.textList.push({
x: title.subTitleStyle.x,
y: title.subTitleStyle.y + title.titleStyle.fontSize * 1.14 * (this.textList.length - 1),
fontSize: title.subTitleStyle.fontSize,
color: title.subTitleStyle.color,
text: item
})
})
this.isFestival = true
this.logoInfo = await this.getImgWH(this.detail.merchantLog)
}
})
const detail = { ...this.detail, ...val[2] }
detail.activityPrice = val[1].activityPrice
if (this.routerInfo.addOrEdit == 'edit') {
this.showActivity(detail)
} else {
this.validActivity(detail)
}
},
deep: true,
immediate: true
}
},
methods: {
showActivity(detail) {
this.detail = detail
this.detailCoupon = this.$common.utils.deepClone(this.packageList)
if (RENEWAL.includes(this.detail.codeId)) {
this.modelNum = this.detail.codeId
this.isRenewal = true
}
if (FESTIVAL.includes(this.detail.codeId)) {
this.isFestival = true
}
},
validActivity(detail) {
this.detail = detail
this.detailCoupon = this.$common.utils.deepClone(this.packageList)
this.$nextTick(async () => {
this.isFestival = false
this.isRenewal = false
if (!this.detail) return
if (RENEWAL.includes(this.detail.codeId)) {
this.modelNum = this.detail.codeId
this.isRenewal = true
this.backgroundHeight = await this.getImgH(this.detail.backgroundImage)
const style1 = JSON.parse(this.detail.titleStyle)
const style2 = JSON.parse(this.detail.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)
}
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, ...style2, color: style2.style.color, font: style2.font })
}
if (FESTIVAL.includes(this.detail.codeId)) {
const style1 = JSON.parse(this.detail.titleStyle)
const style2 = JSON.parse(this.detail.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)
}
this.textList = []
const title = {
titleStyle: style1,
subTitleStyle: style2
}
this.detail.marketingTitle.split(' ').forEach((item, index) => {
this.textList.push({
x: title.titleStyle.x,
y: title.titleStyle.y + index * title.titleStyle.fontSize * 1.14,
fontSize: title.titleStyle.fontSize,
color: title.titleStyle.color,
text: item,
bold: title.titleStyle.bold
})
})
new Array(this.detail.marketingSubtitle).forEach((item, index) => {
this.textList.push({
x: title.subTitleStyle.x,
y: title.subTitleStyle.y + title.titleStyle.fontSize * 1.14 * (this.textList.length - 1),
fontSize: title.subTitleStyle.fontSize,
color: title.subTitleStyle.color,
text: item
})
})
this.isFestival = true
this.logoInfo = await this.getImgWH(this.detail.merchantLog)
}
})
},
formatPrice(val) {
return (val / 100).toFixed(2).replace(/\.[0]+$/, '')
},
......@@ -446,6 +479,24 @@ export default {
}
</style>
<style lang="scss" scoped>
.wechat-footer {
width: 284px;
position: absolute;
top: 538px;
height: 38px;
img {
width: 100%;
}
.footer-panel {
position: relative;
.wechat-footer-price {
position: absolute;
line-height: 38px;
left: 50px;
color: #eb4e4e;
}
}
}
.review-body {
margin: 10px auto;
width: 288px;
......@@ -480,7 +531,7 @@ export default {
.review-content {
position: absolute;
width: calc(100% - 36px);
height: 504px;
height: 475px;
overflow-y: auto;
overflow-x: hidden;
top: 47px;
......
......@@ -8,7 +8,7 @@
</div>
<div class="case-result" @click="handleSave">执行营销方案</div>
</div>
<div class="case-container" v-show="showPhone">
<div class="case-container">
<div class="case-container-title">预览营销方案</div>
<phoneView ref="viewForm"></phoneView>
</div>
......@@ -21,8 +21,10 @@ const FESTIVAL = [9, 10]
import { mapState, mapMutations } from 'vuex'
import phoneView from './PhoneView'
import draw from '@/mixins/draw'
import marketing from '@/mixins/marketing'
export default {
mixins: [draw],
mixins: [draw, marketing],
components: {
phoneView
},
......@@ -40,12 +42,19 @@ export default {
watch: {
process: {
handler(val) {
this.showPhone = false
for (let k in val) {
this.caseList[k].isFinish = val[k] ? true : false
}
if (val[2].codeId) {
this.showPhone = true
},
deep: true,
immediate: true
},
activityInfo: {
handler(val) {
if (this.routerInfo.addOrEdit == 'edit') {
for (let k in this.caseList) {
this.caseList[k].isFinish = true
}
}
},
deep: true,
......@@ -74,10 +83,10 @@ export default {
draggableList
} = this.$refs.viewForm
let url = backgroundImage
if (RENEWAL.includes(params.codeId)) {
if (RENEWAL.includes(params.codeId) && !params.id) {
url = await this.createMain(backgroundHeight, backgroundImage, draggableList) //合并主图、文字
}
if (FESTIVAL.includes(params.codeId)) {
if (FESTIVAL.includes(params.codeId) && !params.id) {
url = await this.createBig(this.$refs.viewForm.detail, this.logoInfo, JSON.parse(titleStyle), JSON.parse(subTitleStyle)) //合并主图、背景图、logo、文字
}
let origin = 'createSuperMarketing'
......@@ -118,7 +127,7 @@ export default {
}
},
computed: {
...mapState('marketing', ['process', 'subscribe'])
...mapState('marketing', ['process', 'subscribe', 'activityInfo'])
}
}
</script>
......
......@@ -124,6 +124,7 @@ export default {
},
beforeDestroy() {
this.setSubscribe(null)
this.SET_STEP(1)
this.handleAdd()
},
methods: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!