Commit f7dd6833 by 徐忆琳

Merge branch 'xuyl_dev_sop' into 'v3.5.0'

解决sop旧数据展示问题

See merge request !447
2 parents f5079e2e cf368c2a
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</glsx-combi-form> </glsx-combi-form>
</div> </div>
</div> </div>
<div class="container edit-container"> <div class="container edit-container" v-loading="marketingEventLoading">
<div class="edit-title flex" style="align-items: center"> <div class="edit-title flex" style="align-items: center">
<p>营销事件设置</p> <p>营销事件设置</p>
<el-tooltip :disabled="!(!editForm.customerInfoList.length || !editForm.sopName)" effect="dark" <el-tooltip :disabled="!(!editForm.customerInfoList.length || !editForm.sopName)" effect="dark"
...@@ -81,7 +81,8 @@ ...@@ -81,7 +81,8 @@
<div v-show="editForm.eventList.length" class="event-box"> <div v-show="editForm.eventList.length" class="event-box">
<div class="event-item" v-for="(item, index) in editForm.eventList" :key="index"> <div class="event-item" v-for="(item, index) in editForm.eventList" :key="index">
<div class="flex-default event-title"> <div class="flex-default event-title">
<p :class="{'m-r-10':true,'editFlag':!item.eventStartDate}">{{ item.eventStartDate ? item.eventStartDate : '请点击“编辑”完善事件的营销时间' }}</p> <p :class="{'m-r-10':true,'editFlag':!item.eventStartDate}">
{{ item.eventStartDate ? item.eventStartDate : '请点击“编辑”完善事件的营销时间' }}</p>
<p class="m-r-20">{{ item.eventTime }}</p> <p class="m-r-20">{{ item.eventTime }}</p>
<p class="m-r-20" v-show="item.repeatFlag == 'Y' && item.repeatMode == 1">每天重复循环至</p> <p class="m-r-20" v-show="item.repeatFlag == 'Y' && item.repeatMode == 1">每天重复循环至</p>
<p class="m-r-20" v-show="item.repeatFlag == 'Y' && item.repeatMode == 2">每周{{ <p class="m-r-20" v-show="item.repeatFlag == 'Y' && item.repeatMode == 2">每周{{
...@@ -113,12 +114,13 @@ ...@@ -113,12 +114,13 @@
<div class="welcome-activity-box"> <div class="welcome-activity-box">
<div class="welcome-activity-icon"> <div class="welcome-activity-icon">
<img src="@/assets/welcomeWord/pdf_r.png" <img src="@/assets/welcomeWord/pdf_r.png"
v-if="obj.attContent && !JSON.parse(obj.attContent).isFile"/>
v-if="obj.attContent && !backupContentJson(obj.attContent).isFile"/>
<img src="@/assets/welcomeWord/text.png" <img src="@/assets/welcomeWord/text.png"
v-if="obj.attContent && JSON.parse(obj.attContent).isFile"/> v-if="obj.attContent && backupContentJson(obj.attContent).isFile"/>
</div> </div>
<div class="welcome-activity-desc"> <div class="welcome-activity-desc">
<div class="model-item-title">{{ JSON.parse(obj.attContent).fileName }}</div> <div class="model-item-title">{{ backupContentJson(obj.attContent).fileName }}</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -241,6 +243,7 @@ export default { ...@@ -241,6 +243,7 @@ export default {
size: 'small', size: 'small',
title: '基本信息', title: '基本信息',
url: url, url: url,
marketingEventLoading: false,
editChildRef: 'editChildRef', editChildRef: 'editChildRef',
editStatus: false, editStatus: false,
editDisabled: false, editDisabled: false,
...@@ -390,7 +393,14 @@ export default { ...@@ -390,7 +393,14 @@ export default {
confName: '微信朋友圈' confName: '微信朋友圈'
} }
] ]
} },
// 素材活动集合
materialGroupSet: [],
equityCardCollection: [],
equityPackageCollection: [],
mallCouponCollection: [],
seckillActivitySet: []
} }
}, },
...@@ -423,17 +433,60 @@ export default { ...@@ -423,17 +433,60 @@ export default {
}, },
mounted() { async mounted() {
this.setMinHeight('.sop-base-info') this.setMinHeight('.sop-base-info')
// this.routeInfo.addOrEdit == 'edit' // this.routeInfo.addOrEdit == 'edit'
await this.getTheMaterialActivityCollection()
if (['edit', 'copy', 'look'].includes(this.routeInfo.addOrEdit)) { if (['edit', 'copy', 'look'].includes(this.routeInfo.addOrEdit)) {
this.getInfo() this.getInfo()
} else if (this.routeInfo.info) { } else if (this.routeInfo.info) {
this.setCustomer() this.setCustomer()
} }
}, },
methods: { methods: {
async getTheMaterialActivityCollection() {
await this.$apis.welcomeword.getMaterialListApi({
pageNum: 1,
pageSize: 100000,
merchant: this.$globalState.session.merchantId,
status: 0
}).then(res =>
this.materialGroupSet = res.data
)
},
async getEachActivity(interfaceName) {
let params = {
pageNum: 1,
pageSize: 100000,
}
// 权益卡
if (interfaceName == 'merchant') {
params.tryAble = 1
params.merchantId = this.$globalState.session.merchantId
}
if (interfaceName == 'getActivity') {
params.currentPage = 1
}
await this.$apis.welcomeword[interfaceName](params).then(res => {
switch (interfaceName) {
case 'merchant':
this.equityCardCollection = res
break;
case 'getPackage':
this.equityPackageCollection = res.list
break;
case 'getMerchant':
this.mallCouponCollection = res.list
break;
case 'getActivity':
this.seckillActivitySet = res.list
}
})
},
tramWord(val) { tramWord(val) {
let htm = val.replace( let htm = val.replace(
/\[([\u4E00-\u9FA56]{1,4}|OK|NO|666)]/gi, /\[([\u4E00-\u9FA56]{1,4}|OK|NO|666)]/gi,
...@@ -566,13 +619,147 @@ export default { ...@@ -566,13 +619,147 @@ export default {
} }
}, },
async processOldSOPData(list, index) {
for (let i = 0; i < list['eventList'].length; i++) {
let item = list.eventList[i]
if (!item.backupContent) {
this.marketingEventLoading = true
let backUpContent = []
// 文本
backUpContent.push({attType: 1, attContent: item.eventContent})
// 图片
if (item.additionalType == 5 && item.objectType == 11) {
let imgResourceList = item.object && item.object.result.map(img => img.content)
imgResourceList.forEach(resource => {
backUpContent.push({attType: 2, attContent: resource})
})
}
// 视频
if (item.additionalType == 5 && item.objectType == 12) {
let videoResourceList = item.object && item.object.result.map(img => img.content)
backUpContent.push({attType: 3, attContent: videoResourceList})
}
// 活动-权益卡试用
if (item.additionalType == 2 && item.objectType == 6) {
await this.getEachActivity('merchant')
let activity = this.equityCardCollection && this.equityCardCollection.filter(it => it.equityClassId == item.objectId)
let {effectivedDay, equityClassId, effectiveType, equityName, freeDay} = activity[0]
backUpContent.push({
attType: 7,
attContent: {
marketingId: equityClassId,
marketingType: effectiveType,
marketingName: equityName,
marketingContent: {
equityName,
effectivedDay,
effectiveType,
freeDay,
selectType: 'card',
}
}
})
}
// 活动-权益套餐
if (item.additionalType == 2 && item.objectType == 7) {
await this.getEachActivity('getPackage')
let getPackage = this.equityPackageCollection && this.equityPackageCollection.filter(it => it.id == item.objectId)
let {id, packagePrice, packageName} = getPackage[0]
backUpContent.push({
attType: 7,
attContent: {
marketingId: id,
// marketingType: effectiveType,
marketingName: packageName,
marketingContent: {
packageName,
packagePrice,
selectType: 'package',
}
}
})
}
// 活动-商城券
if (item.additionalType == 3 && item.objectType == 5) {
await this.getEachActivity('getMerchant')
let coupon = this.mallCouponCollection && this.mallCouponCollection.filter(it => it.id == item.objectId)
let {id, couponName, effectiveType, residueAmount} = coupon[0]
backUpContent.push({
attType: 7,
attContent: {
marketingId: id,
marketingType: effectiveType,
marketingName: couponName,
marketingContent: {
couponName,
effectiveType,
residueAmount,
selectType: 'coupon',
}
}
})
}
// 活动-秒杀活动
if (item.additionalType == 2 && item.objectType == 8) {
await this.getEachActivity('getActivity')
let activity = this.seckillActivitySet && this.seckillActivitySet.filter(it => it.id == item.objectId)
let {id, activityName, startTime, endTime} = activity[0]
backUpContent.push({
attType: 7,
attContent: {
marketingId: id,
// marketingType: effectiveType,
marketingName: activityName,
marketingContent: {
activityName,
endTime,
startTime,
selectType: 'activity',
}
}
})
}
// 素材
if (item.additionalType == 1 && item.objectType == 10) {
let material = this.materialGroupSet && this.materialGroupSet.filter(it => it.id == item.objectId)
let {id, materialContentRpcResponse} = material[0]
let detail = {
'fileName': materialContentRpcResponse.materialName,
'objectId': id,
'isFile': decodeURIComponent(materialContentRpcResponse.materialUrl),
}
backUpContent.push({
attType: 6,
attContent: JSON.stringify(detail)
})
}
list.eventList[i].backupContent = backUpContent
}
}
return list
},
getInfo() { getInfo() {
this.$apis.sop.getSopInfoDetailApi({sopId: this.routeInfo.id}).then(res => { this.$apis.sop.getSopInfoDetailApi({sopId: this.routeInfo.id}).then(async res => {
if (this.routeInfo.addOrEdit == 'copy') { if (this.routeInfo.addOrEdit == 'copy') {
res.eventList && res.eventList.map(item => { res.eventList && res.eventList.map(item => {
item.eventStartDate = '' item.eventStartDate = ''
item.eventTime = '' item.eventTime = ''
}) })
// 判断有没有旧数据
await this.processOldSOPData(res).then(res => {
this.marketingEventLoading = false
})
this.editForm.eventList = res.eventList this.editForm.eventList = res.eventList
} else { } else {
this.editForm = res this.editForm = res
...@@ -1416,7 +1603,8 @@ export default { ...@@ -1416,7 +1603,8 @@ export default {
margin-top: 8px; margin-top: 8px;
display: inline-block display: inline-block
} }
.editFlag{
.editFlag {
color: #f56c6c; color: #f56c6c;
font-size: 12px; font-size: 12px;
} }
......
...@@ -126,7 +126,6 @@ export default { ...@@ -126,7 +126,6 @@ export default {
}) })
item.attContent = htm item.attContent = htm
} else if (item.attType != 2 && item.attType != 3 && item.attType != 7) { } else if (item.attType != 2 && item.attType != 3 && item.attType != 7) {
// console.log(item.attContent, JSON.parse(item.attContent).fileName)
item.attContent = JSON.parse(item.attContent) item.attContent = JSON.parse(item.attContent)
} }
}) })
...@@ -134,7 +133,6 @@ export default { ...@@ -134,7 +133,6 @@ export default {
}, },
previewVal: { previewVal: {
handler(val) { handler(val) {
console.log(val)
this.previewList = utils.deepClone(val).filter(item => item.attContent) this.previewList = utils.deepClone(val).filter(item => item.attContent)
}, },
deep: true deep: true
......
...@@ -594,7 +594,6 @@ export default { ...@@ -594,7 +594,6 @@ export default {
setTimeout(() => { setTimeout(() => {
this.previewList = JSON.parse(JSON.stringify(this.previewList)) this.previewList = JSON.parse(JSON.stringify(this.previewList))
}) })
}, },
}, },
...@@ -608,6 +607,7 @@ export default { ...@@ -608,6 +607,7 @@ export default {
}, },
mounted() { mounted() {
Object.assign(this.editForm, this.eventObj.info) Object.assign(this.editForm, this.eventObj.info)
this.getStaffTypeList() this.getStaffTypeList()
this.$nextTick(() => { this.$nextTick(() => {
...@@ -722,13 +722,12 @@ export default { ...@@ -722,13 +722,12 @@ export default {
let backupContent = typeof (this.editForm.backupContent) == 'string' ? JSON.parse(this.editForm.backupContent) : this.editForm.backupContent let backupContent = typeof (this.editForm.backupContent) == 'string' ? JSON.parse(this.editForm.backupContent) : this.editForm.backupContent
if (backupContent) { if (backupContent) {
const previewList = backupContent.map(item => { const previewList = backupContent.map(item => {
// JSON.parse(item.attContent)
if (item.attType == 7) item.attContent = typeof (item.attContent) == 'string' ? JSON.parse(item.attContent) : item.attContent if (item.attType == 7) item.attContent = typeof (item.attContent) == 'string' ? JSON.parse(item.attContent) : item.attContent
return item return item
}) })
this.$refs.welcome.updateList(previewList) this.$refs.welcome.updateList(previewList)
} else if (this.editForm.object && this.editForm.object.length != 0) { } else if (this.editForm.object && this.editForm.object.length != 0) {
const previewList = JSON.parse(this.editForm.backupContent).map(item => { const previewList = JSON.parse(backupContent).map(item => {
if (item.attType == 7) item.attContent = typeof (item.attContent) == 'string' ? JSON.parse(item.attContent) : item.attContent if (item.attType == 7) item.attContent = typeof (item.attContent) == 'string' ? JSON.parse(item.attContent) : item.attContent
return item return item
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!