Commit 7f45c59b by 前端

Merge branch 'dev_2.7.2_0819' into 'master'

Dev 2.7.2 0819

See merge request !14
2 parents aa6e0381 68585a8f
......@@ -3,7 +3,10 @@ export default {
/** 分页查询活动 */
getActivityList (currentPage) {
let data = {
method: 'scrm.api.shopmall.activity.page',
// 秒杀活动
// method: 'scrm.api.shopmall.activity.page',
// 秒杀+众筹
method: 'scrm.api.shopmall.wechat.crowdfunding.activity.page',
pageSize: 10,
currentPage
}
......@@ -20,4 +23,4 @@ export default {
data
})
},
}
\ No newline at end of file
}
import { wxConfig, bigdatautilApi } from '@/api'
export default {
data () {
data() {
return {
entry: 'normal'
}
},
mounted () {
mounted() {
if (this.$route.meta.isTab || this.$route.meta.isIndex) this.wxInit()
// wxConfig
// .createMiniprogramUrlLink({
......@@ -19,7 +19,7 @@ export default {
// })
},
methods: {
wxInit () {
wxInit() {
let _this = this
wxConfig.init(['shareAppMessage', 'sendChatMessage', 'getCurExternalContact', 'getContext']).then(() => {
wxConfig.getContext().then(({ entry }) => {
......@@ -28,7 +28,10 @@ export default {
})
})
},
showShareModel (i = {}) {
iosTimeFormat (time) {
return time.replace(/\-/g, '/')
},
showShareModel(i = {}) {
let {
tabIndex,
$route: { name }
......@@ -48,40 +51,44 @@ export default {
this.sendMessage(i)
})
},
sendMessage (i) {
const { shopmall_appid, request: { baseURL } } = window.$fetchConfig
sendMessage(i) {
const {
shopmall_appid,
request: { baseURL }
} = window.$fetchConfig
let { merchantId, merchantName, userName, sapCode, uuid } = this.getLocalStorage('dj_scrm_userInfo')
let { tabIndex, entry } = this
let { name } = this.$route
let { userId, id, couponName, activityName, packageName, goodsName, goodsImage, discountType, shareType } = i
let { userId, id, couponName, activityName, packageName, goodsName, goodsImage, discountType, shareType, marketingType } = i
let query = `merchantId=${merchantId}&shareTime=${Date.now()}`
if (sapCode) query = `${query}&storeCode=${sapCode}`
const entryType = entry != 'normal'
this.showLoading()
let params = {
'coupon': {
path: 'packageMine/pages/boutique/gift/gift',
desc: '您的专属服务顾问为您发来了优惠券,请点击领取~',
imgUrl: 'http://img01.glsx.com.cn/upload/biz/dracMini-yh-10004.png'
},
'activity': {
path: 'packageMall/pages/detail/detail',
desc: '您有一个秒杀活动可参加',
imgUrl: 'http://img01.glsx.com.cn/upload/biz/dracMini-ms-10004.png'
},
'merchant': {
path: 'pages/tab/index/index',
desc: '',
imgUrl: 'https://img01.glsx.com.cn/weapp/resource/scrm-mobile/activity/miniprogram-cover.jpg'
}
}[name],
coupon: {
path: 'packageMine/pages/boutique/gift/gift',
desc: '您的专属服务顾问为您发来了优惠券,请点击领取~',
imgUrl: 'http://img01.glsx.com.cn/upload/biz/dracMini-yh-10004.png'
},
activity: {
path: 'packageMall/pages/detail/detail',
desc: '您有一个秒杀活动可参加',
imgUrl: 'http://img01.glsx.com.cn/upload/biz/dracMini-ms-10004.png'
},
merchant: {
path: 'pages/tab/index/index',
desc: '',
imgUrl: 'https://img01.glsx.com.cn/weapp/resource/scrm-mobile/activity/miniprogram-cover.jpg'
}
}[name],
title = {
'coupon': couponName,
'activity': activityName,
'merchant': merchantName
coupon: couponName,
activity: activityName,
merchant: merchantName
}[name],
h5Params = {}
if (name === 'coupon') { /**卡券 */
if (name === 'coupon') {
/**卡券 */
if (tabIndex == 0) {
query = `id=${id}&userId=${userId}&employName=${this.toUnicode(i.employeeName)}&${query}`
} else {
......@@ -91,14 +98,39 @@ export default {
this.couponShare(i)
}
}
if (name === 'activity') { /**活动 */
if (tabIndex == 0) {
query = `isActivity=true&id=${id}&${query}&shareStaffName=${this.toUnicode(userName)}&shareStaffUuid=${uuid}`
} else {
/**直播 */
if (name === 'activity') {
/**活动 */
// if (tabIndex == 0) {
// 1-普通秒杀;2-直播间秒杀;3-众筹
switch (marketingType) {
case 1:
query = `isActivity=true&id=${id}&${query}&shareStaffName=${this.toUnicode(userName)}&shareStaffUuid=${uuid}`
break
case 2:
/** 直播 */
break
case 3:
shareType = 'h5'
let { corpId, agentId } = this.getLocalStorage('dj_scrm_corpId')
let link = `${baseURL}/scrm-wx-merchant-activity/#/`
link = `${link}?${query}&id=${i.id}&shareStaffUuid=${uuid}&shareStaffName=${this.toUnicode(userName)}&shareStaffType=2&corpId=${corpId}`
if (agentId) link = `${link}&agentId=${agentId}`
h5Params = {
imgUrl: i.posterImg || i.activityImg,
desc: `限时大型众筹,活动时间${new Date(this.iosTimeFormat(i.startTime)).format('yyyy/M/d')}-${new Date(this.iosTimeFormat(i.endTime)).format('yyyy/M/d')}`,
title: i.forwardTitle || i.activityName,
link
}
break
default:
break
}
// } else {
// /**直播 */
// }
}
if (name === 'merchant') { /**店铺 */
if (name === 'merchant') {
/**店铺 */
switch (+tabIndex) {
case 1:
let isjt = i.packageType == 2
......@@ -110,7 +142,7 @@ export default {
params.desc = '您的专属客服顾问为您发来了会员套餐,点击查看哦'
query = `id=${id}&${query}&shareStaffName=${this.toUnicode(userName)}&shareStaffUuid=${uuid}&packageType=${i.packageType}`
title = packageName
break;
break
case 2:
params.path = 'packageMall/pages/detail/detail'
params.imgUrl = goodsImage
......@@ -125,49 +157,55 @@ export default {
if (agentId) link = `${link}&agentId=${agentId}`
h5Params = {
imgUrl: i.posterImg || i.activityImg,
desc: `限时大型众筹,活动时间${new Date(i.startTime).format('yyyy/M/d')}-${new Date(i.endTime).format('yyyy/M/d')}`,
desc: `限时大型众筹,活动时间${new Date(this.iosTimeFormat(i.startTime)).format('yyyy/M/d')}-${new Date(this.iosTimeFormat(i.endTime)).format('yyyy/M/d')}`,
title: i.forwardTitle || i.activityName,
link
}
break
default:
break;
break
}
}
if (shareType == 'h5') {
console.log(h5Params)
if (entryType) this.sendChatMessage(h5Params, 'news', () => {
bigdatautilApi.reportTrack(i.id)
})
else wxConfig
.shareAppMessage(h5Params)
.then(() => {
this.hideLoading()
if (entryType)
this.sendChatMessage(h5Params, 'news', () => {
bigdatautilApi.reportTrack(i.id)
})
.catch(() => {
this.hideLoading()
})
else
wxConfig
.shareAppMessage(h5Params)
.then(() => {
this.hideLoading()
bigdatautilApi.reportTrack(i.id)
})
.catch(() => {
this.hideLoading()
})
} else {
if (entryType) this.sendChatMessage({
appid: shopmall_appid,
title,
imgUrl: params.imgUrl,
page: `/${params.path}.html?${query}`
})
else this.shareAppMessage({
path: params.path,
query,
appId:i.packageType==2? 'wxfe82b8d65d07808f':shopmall_appid
}, {
desc: params.desc,
title,
imgUrl: params.imgUrl
})
if (entryType)
this.sendChatMessage({
appid: shopmall_appid,
title,
imgUrl: params.imgUrl,
page: `/${params.path}.html?${query}`
})
else
this.shareAppMessage(
{
path: params.path,
query,
appId: i.packageType == 2 ? 'wxfe82b8d65d07808f' : shopmall_appid
},
{
desc: params.desc,
title,
imgUrl: params.imgUrl
}
)
}
},
sendChatMessage (params, msgtype = 'miniprogram', callBack) {
sendChatMessage(params, msgtype = 'miniprogram', callBack) {
wxConfig
.sendChatMessage({
msgtype,
......@@ -183,41 +221,40 @@ export default {
this.hideLoading()
})
},
shareAppMessage (linkParams, messageParams) {
wxConfig
.createMiniprogramUrlLink(linkParams)
.then(link => {
wxConfig
.shareAppMessage({
link,
...messageParams
})
.then(() => {
this.hideLoading()
})
.catch(() => {
this.hideLoading()
})
})
shareAppMessage(linkParams, messageParams) {
wxConfig.createMiniprogramUrlLink(linkParams).then(link => {
wxConfig
.shareAppMessage({
link,
...messageParams
})
.then(() => {
this.hideLoading()
})
.catch(() => {
this.hideLoading()
})
})
},
toUnicode (chineseStr = '') {
toUnicode(chineseStr = '') {
let unicodeStr = ''
for (let i = 0, iLength = chineseStr.length; i < iLength; i++) {
unicodeStr += '@' + chineseStr.charCodeAt(i).toString(16)
}
return unicodeStr
},
couponShare (item) {
couponShare(item) {
let { is_contact, id } = item
let obj = {
couponId: id,
shareType: 1
}
if (is_contact) obj.userList = [
{
userId: is_contact
}
]
if (is_contact)
obj.userList = [
{
userId: is_contact
}
]
else obj.shareType = 0
}
}
......
......@@ -32,7 +32,7 @@
</div>
<div class="info">
<div class="title text-hide">{{i.activityName}}</div>
<div class="time">时间:{{i.startTime}} ~ {{i.endTime}}</div>
<div class="time">时间:{{i.startTimeTxt}} ~ {{i.endTimeTxt}}</div>
<div class="price flex">
<template v-if="i.priceType == 1">
<div class="old">原价:¥{{i.price1}} </div>
......@@ -58,7 +58,7 @@
</div>
<div class="info">
<div class="title text-hide">{{i.name}}</div>
<div class="time">直播时间:{{i.startTime}}</div>
<div class="time">直播时间:{{i.startTimeTxt}}</div>
<div class="zhubo flex">
主播:{{i.anchorName}}
<div
......@@ -92,7 +92,7 @@ export default {
mixins: [shareMixin, pageMixin],
data () {
return {
tabList: ['秒杀活动']
tabList: ['门店活动']
}
},
methods: {
......@@ -104,8 +104,8 @@ export default {
console.log(tabIndex == 0 ? '活动列表' : '直播列表', res)
if (tabIndex == 0) {
res.list.map(e => {
if (e.startTime) e.startTime = new Date(this.iosTimeFormat(e.startTime)).format('yyyy年M月d日')
if (e.endTime) e.endTime = new Date(this.iosTimeFormat(e.endTime)).format('yyyy年M月d日')
if (e.startTime) e.startTimeTxt = new Date(this.iosTimeFormat(e.startTime)).format('yyyy年M月d日')
if (e.endTime) e.endTimeTxt = new Date(this.iosTimeFormat(e.endTime)).format('yyyy年M月d日')
e.price1 = this.centsToyuan(e.price1 || 0)
e.price2 = this.centsToyuan(e.price2 || 0)
})
......@@ -237,4 +237,4 @@ export default {
}
}
}
</style>
\ No newline at end of file
</style>
......@@ -60,7 +60,7 @@
<div class="name">{{i.activityName}}</div>
<div class="time flex">
<div class="sprite-icon icon-activity-time"></div>
{{new Date(i.startTime).format('yyyy/M/d')}}-{{new Date(i.endTime).format('yyyy/M/d')}}
{{new Date(iosTimeFormat(i.startTime)).format('yyyy/M/d')}}-{{new Date(iosTimeFormat(i.endTime)).format('yyyy/M/d')}}
</div>
<div class="price">
¥{{centsToyuan(i.activityPrice)}}
......@@ -161,7 +161,7 @@
<script type="text/ecmascript-6">
import { shareMixin, pageMixin } from '@/mixins'
import { shopmallApi, equityApi } from '@/api'
const tabList = ['我的店铺', '会员套餐', '门店商品', '门店活动']
const tabList = ['我的店铺', '会员套餐', '门店商品', '门店套餐']
const SEARCHTAB = ['全部', '门店', '集团']
export default {
name: 'merchant',
......@@ -203,6 +203,9 @@ export default {
this.hideLoading()
})
},
iosTimeFormat (time) {
return time.replace(/\-/g, '/')
},
showVipDialog (i) {
this.showVip = true
this.equity_id = i.id
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!