'use strict';
var noticeMixin = function () {// 通知消息
return {
data(){
return{}
},
computed: {
},
mounted() {
var _this = this;
window.handleOrderClick = this.handleOrderClick;
window.handleUsersClick = this.handleUsersClick;
window.handleCouponClick = this.handleCouponClick;
window.handleArticleClick = this.handleArticleClick;
window.handleActivityClick = this.handleActivityClick;
},
methods: {
hanldeNoticeText(cell){ // 根据tab计算返回显示文案
const $EventFunction = {
1:this.noticeOrderText(cell),
2:this.noticeUsersText(cell),
3:this.noticeServeText(cell),
4:this.noticeCouponText(cell),
5: this.noticeArticleText(cell),
6: this.noticeActivityText(cell)
}
return $EventFunction[cell.messageType]
},
noticeOrderText(cell) { // 交易物流通知文案
const linkMap = {
1:`立即支付`,
2:`查看订单`,
3:`查看订单`,
4:`查看订单`,
5:`查看物流`,
6:`查看订单`
}
const map = {
1: `您已成功下单"${cell.productName}"等${cell.productCount}种商品,订单等待支付,点击${linkMap[cell.orderMessageType]}进行付款,支付完成后采美将尽快安排发货。`,
2: `订单(${cell.productName}"等${cell.productCount}种商品)已支付完成,将立即安排发货,点击${linkMap[cell.orderMessageType]}查看订单详情`,
3: `订单(${cell.productName}"等${cell.productCount}种商品)已${cell.refundType === 1 ? '部分退' : '全部退'}款/货成功,退款金额¥${cell.content},金额到账时间可能存在延迟,具体以支付方通知为准。点击${linkMap[cell.orderMessageType]}查看退款详情`,
4: `订单(${cell.productName}"等${cell.productCount}种商品)${cell.content},点击${linkMap[cell.orderMessageType]}查看订单详情`,
5: `订单(${cell.productName}"等${cell.productCount}种商品)已发货,点击${linkMap[cell.orderMessageType]}查看物流详情`,
6: `订单(${cell.productName}"等${cell.productCount}种商品)因超时已被系统自动收货,点击${linkMap[cell.orderMessageType]}查看订单详情`,
}
return map[cell.orderMessageType]
},
noticeUsersText(cell) { // 账户通知文案
const linkMap = {
2:`会员中心`,
3:`会员中心`,
4:`会员中心`,
6:`修改资料`
}
const map = {
1: '欢迎成为采美机构用户,祝您开启愉快的采购之旅。',
2: `您已成功购买${cell.content}采美平台超级会员服务,在服务期内每月可领多张大额优惠券,还有更多超级会员专属权益等您体验,点击${linkMap[cell.accountType]}去体验吧。`,
3: `您的超级会员服务将于${cell.content}到期,到期后将无法享受专属会员权益,赶快去${linkMap[cell.accountType]}续费吧 。`,
4: `您已获得采美平台赠送的${cell.content}超级会员,在服务期内每月可领多张大额优惠券,还有更多超级会员专属权益等您体验,点击${linkMap[cell.accountType]}去体验吧。`,
5: '恭喜您成功升级为资质机构用户!现在可以查看更多商品的信息啦,采美平台也将为您提供更多专业服务。',
6: `您的账号升级资质机构失败!点击${linkMap[cell.accountType]}重新提交吧。`,
7: `恭喜您(微信昵称:${cell.content})成功成为机构运营人员,祝您开启愉快的采购之旅。`
}
return map[cell.accountType]
},
noticeCouponText(cell) { // 优惠促销通知文案
const linkMap = {
1:`领券中心`,
2:`优惠券中心`,
3:`领券中心`,
}
const copunMap = {
0: `采美平台送您${cell.couponFee}元优惠券,众多大牌正品等着您,赶快去${linkMap[cell.couponMessageType]}领取下单吧。`,
1: `采美平台${cell.content}类商品大优惠,特送您${cell.couponFee}元优惠券,赶快去${linkMap[cell.couponMessageType]}领取下单吧。`,
2: `为了答谢您对采美平台的支持,采美送您${cell.couponFee}元优惠券,赶快去${linkMap[cell.couponMessageType]}领取下单吧。`,
3: `【${cell.content}】赠送您${cell.couponFee}元的店铺专属优惠券,众多火爆商品等您来!赶快去${linkMap[cell.couponMessageType]}领取下单吧。`,
4: `恭喜成功注册采美平台,现赠送您${cell.couponFee}元新用户优惠券,赶快去${linkMap[cell.couponMessageType]}领取下单吧。`,
}
const map = {
1: copunMap[cell.couponType],
2: `您有${cell.couponFee}元优惠券将于${cell.content}过期,赶快去${linkMap[cell.couponMessageType]}查看使用吧。`,
3: `您有${cell.couponFee}元优惠券尚未领取,优惠券将于${cell.content}后下架,赶快去${linkMap[cell.couponMessageType]}领取下单吧0`,
}
return map[cell.couponMessageType]
},
noticeServeText(cell){//服务通知文案处理
if (cell.shopTieredType > 4) {
const map = {
5: '采美平台已为您匹配专属客户经理,为您提供专业咨询服务。',
6: '因公司内部人员调整需要,采美平台已为您更换了新客户经理。',
}
return map[cell.shopTieredType]
}
},
noticeArticleText(cell) { // 最新文章
const link = `点击查看`
return `${link}${cell.content}`
},
noticeActivityText(cell) { // 最新活动
const activityLink = isPC ? cell.pcLink : cell.appLink
const link = `点击查看`
return `${link}${cell.content}`
},
handleOrderClick($event){// 订单点击事件
let orderMessageType = Number($event[0].attributes[0].value);
let orderId = Number($event[0].attributes[1].value);
let status = Number($event[0].attributes[2].value);
let onlinePayFlag = Number($event[0].attributes[3].value);
let statusVal = [ { val: [11, 12, 13, 21, 22, 23, 111], status: true }];
let isOnliyPay = false;
statusVal.forEach(el => {
el.val.forEach(value => {
if (status === value) {
isOnliyPay = el.status
}
})
})
if(orderMessageType === 1){
if(!isOnliyPay){
CAIMEI.dialog('订单已完成支付',false);
}else{
let payLinkMap = {
0:'/pay/caimei-paylist.html?orderId='+orderId,
1:'/pay/caimei-payunder.html?orderId='+orderId,
}
let linkJumpMap = {
1:payLinkMap[onlinePayFlag]
}
window.open(linkJumpMap[orderMessageType]);
}
}else{
let linkJumpMap = {
2:'/user/order/detail.html?orderId='+orderId,
3:'/user/order/detail.html?orderId='+orderId,
4:'/user/order/detail.html?orderId='+orderId,
5:'/user/order/logistics.html?orderId='+orderId,
6:'/user/order/detail.html?orderId='+orderId
}
window.open(linkJumpMap[orderMessageType]);
}
},
handleUsersClick($event){
console.log('账户通知跳转');
const accountType = Number($event[0].attributes[0].value);
if(accountType === 1 || accountType === 5 || accountType === 7){
return;
}
const linkJumpMap = {
2:'/user/member.html',
3:'/user/member.html',
4:'/user/member.html',
6:'/user/setting/upgrade.html',
}
window.open(linkJumpMap[accountType]);
},
handleServeClick($event){
console.log('服务通知跳转');
},
handleCouponClick($event){
console.log('优惠促销通知跳转');
const couponMessageType = Number($event[0].attributes[0].value);
const linkJumpMap = {
1:`/user/coupon-collection.html`,
2:`/user/coupon-collection.html`,
3:`/user/coupon.html`,
}
window.open(linkJumpMap[couponMessageType]);
},
handleArticleClick($event) {
const id = Number($event[0].attributes[0].value);
window.open(`/info/detail-${id}-1.html`);
},
handleActivityClick($event) {
const link = $event[0].attributes[0].value
if (link) {
window.open(link);
}
}
}
};
}();