Commit e0b2df5e by 李伟康

commit

1 parent 4d347d78
const url = '/rop-scrm-shopmall/router'
export default {
/** 分页查询活动 */
getActivityList(data) {
data.method = 'scrm.api.shopmall.activity.page'
data.pageSize = 10
getActivityList (currentPage) {
let data = {
method: 'scrm.api.shopmall.activity.page',
pageSize: 10,
currentPage
}
return window.$HTTP({
url,
data
})
},
/** 获取分享链接 */
getShared(data) {
getShared (data) {
data.method = 'scrm.api.shopmall.activity.get.shared'
return window.$HTTP({
url,
......
const url = '/rop-scrm-equity/router'
export default {
/**套餐分页查询 */
getEquityList(data) {
data.method = 'scrm.api.equity.package.info.list.with.page'
data.pageSize = 10
data.state = 1
getEquityList (pageNum) {
let data = {
method: 'scrm.api.equity.package.info.list.with.page',
pageSize: 10,
state: 1,
pageNum
}
return window.$HTTP({
url,
data
})
},
/**套餐详情 */
getEquityDetail(data) {
getEquityDetail (data) {
data.method = 'scrm.api.equity.main.page.package.detail.get'
return window.$HTTP({
url,
......@@ -19,7 +22,7 @@ export default {
})
},
/** 获取套餐分享链接 */
getEquityShared(data) {
getEquityShared (data) {
data.method = 'scrm.api.equity.package.info.share'
return window.$HTTP({
url,
......
const url = '/rop-scrm-live/router'
export default {
/** 分页查询活动 */
getLiveList(data) {
data.method = 'scrm.api.live.live.room.list'
data.pageSize = 10
getLiveList(pageNum) {
let data = {
method: 'scrm.api.live.live.room.list',
pageSize: 10,
pageNum
}
return window.$HTTP({
url,
data,
......
const url = '/rop-scrm-shopmall/router'
export default {
/** 获取门店商品列表 */
getGoodsList(data) {
data.method = 'scrm.api.shopmall.goods.wework.page'
data.pageSize = 10
getGoodsList(currentPage) {
let data = {
method: 'scrm.api.shopmall.goods.wework.page',
pageSize: 10,
currentPage
}
return window.$HTTP({
url,
data
......
......@@ -37,7 +37,7 @@ export default {
value: 0,
option: [
{ text: '优惠券', value: 0 },
// { text: '精品礼券', value: 1 },
{ text: '精品礼券', value: 1 },
{ text: '商品订单', value: 2 },
{ text: '会员服务', value: 3 }
]
......
<template>
<div
class="share-box"
v-show="showShare"
>
<div class="sheet">
<van-share-sheet
v-model="showShare"
title="立即分享给好友"
:options="options"
@select="onSelect"
@cancel="cancel"
@click-overlay="cancel"
/>
</div>
<poster
:value="showPoster"
@close="showPoster = false"
:apiName="apiName"
:currentItem="currentItem"
:activityData="activityData"
/>
</div>
</template>
<script type='text/ecmascript-6'>
import { shopmallApi, activityApi, couponApi, liveApi, boutiquecouponApi, equityApi } from '@/api'
import { Notify } from 'vant'
const staticOptions = [
{ name: '企业微信', icon: require('@/assets/images/icon/wx.png'), type: 1 },
{ name: '分享海报', icon: require('@/assets/images/icon/poster.png'), type: 2 },
{ name: '复制链接', icon: require('@/assets/images/icon/copy.png'), type: 3 }
]
export default {
name: 'Share',
props: ['value', 'apiName', 'currentItem'],
data() {
return {
showPoster: false,
showShare: false,
options: [],
activityData: {},
component_id: '',
component_api_name: ''
}
},
watch: {
value(n) {
console.log(n)
let {
currentItem: { id, userId },
component_id,
apiName,
component_api_name
} = this
if (component_id == id && n && component_api_name == apiName) {
this.showShare = true
return
}
if (n) {
let options = this.tools.deepClone(staticOptions)
if (apiName == 'couponApi' || apiName == 'boutiquecouponApi' || apiName == 'equityApi') {
options[1].className = 'disabled'
this.showShare = true
}
console.log(options)
this.options = options
if (apiName == 'activityApi' || apiName == 'liveApi') {
this.showLoading()
let target = apiName == 'activityApi' ? activityApi : liveApi
target.getShared({ id }).then(({ code, data, message }) => {
if (code == '0') {
this.component_id = id
this.component_api_name = apiName
this.showShare = true
this.activityData = data
this.hideLoading()
} else {
this.hideLoading()
Notify(message)
this.$emit('cancel')
}
})
return
}
if (apiName == 'shopmallApi') {
if (!userId) options[1].className = 'disabled'
this.showLoading()
shopmallApi.getGoodsLink({ id }).then(data => {
console.log('商品链接', data)
shopmallApi.getGoodsPoster({ id }).then(res => {
console.log('商品海报', res)
shopmallApi.getGoodsPosterMediaId({ id }).then(media => {
console.log('商品海报ID')
this.activityData = {
posterUrl: res,
url: data,
posterMediaId: media
}
this.showShare = true
this.hideLoading()
})
})
})
}
}
}
},
mounted() {},
methods: {
closePoster() {
this.showPoster = false
},
onSelect({ type, className }) {
let { currentItem, apiName, activityData } = this
switch (type) {
/**分享微信 */
case 1:
let { userId } = currentItem
if (apiName == 'couponApi' || apiName == 'boutiquecouponApi') {
let { id, couponName } = currentItem
const desc = '您的专属服务顾问为您发来了优惠券,请点击领取~'
if (apiName == 'couponApi') {
this.couponShare(currentItem, 1, res => {
if (userId) this.sendChatMessage(res, desc, couponName)
else this.shareAppMessage(res, desc, couponName)
})
} else {
this.getBoutiqueCoupon(id, res => {
if (userId) this.sendChatMessage(res, desc, couponName)
else this.shareAppMessage(res, desc, couponName)
})
}
}
if (apiName == 'activityApi' || apiName == 'liveApi') {
if (apiName == 'activityApi') {
if (userId) this.sendChatMessage(activityData.linkUrl, '', activityData.activityName, activityData.posterUrl)
else this.shareAppMessage(activityData.linkUrl, '', activityData.activityName, activityData.posterUrl)
} else {
if (userId) this.sendChatMessage(activityData.cdnUrl, '', currentItem.name, currentItem.shareImgUrl)
else this.shareAppMessage(activityData.cdnUrl, '', currentItem.name, currentItem.shareImgUrl)
}
}
if (apiName == 'equityApi' || apiName == 'shopmallApi') {
let { id } = currentItem
if (apiName == 'equityApi') {
equityApi.getEquityShared({ id }).then(res => {
let desc = `您的专属客服顾问为您发来了会员套餐,点击查看哦`
if (userId) this.sendChatMessage(res.url, desc, currentItem.packageName)
else this.shareAppMessage(res.url, desc, currentItem.packageName)
})
} else {
console.log('________________________', activityData.url)
if (userId) this.sendChatMessage(activityData.url, '', currentItem.goodsName, currentItem.goodsImage)
else this.shareAppMessage(activityData.url, '', currentItem.goodsName, currentItem.goodsImage)
}
}
this.cancel()
break
/**分享海报 */
case 2:
if (className) {
this.showToast('无对应内容')
return
}
this.showPoster = true
break
/**复制 */
case 3:
let { id } = currentItem
this.showLoading()
if (apiName == 'shopmallApi') {
let { activityData } = this
this.setClipboardData(activityData.url)
} else if (apiName == 'activityApi') {
this.setClipboardData(activityData.linkUrl)
} else if (apiName == 'liveApi') {
this.setClipboardData(activityData.pagePath)
} else if (apiName == 'couponApi') {
this.couponShare(currentItem, 0, 3)
} else if (apiName == 'boutiquecouponApi') {
this.getBoutiqueCoupon(id, res => {
this.setClipboardData(res)
})
} else {
equityApi.getEquityShared({ id }).then(res => {
this.setClipboardData(res.url)
})
}
break
}
},
cancel() {
this.$emit('cancel')
},
couponShare(item, shareType, callBack) {
let { userId, id } = item
let obj = {
couponId: id,
shareType
}
if (userId)
obj.userList = [
{
userId
}
]
else obj.shareType = 0
couponApi.getCouponShared(obj).then(res => {
if (shareType == 0) this.setClipboardData(res.url)
if (shareType == 1) callBack(res.url)
})
},
getBoutiqueCoupon(id, callBack) {
boutiquecouponApi.getBoutiqueCoupon({ id }).then(res => {
callBack(res)
})
},
sendChatMessage(link, desc, title, imgUrl) {
window.$wx
.sendChatMessage({
msgtype: 'news',
news: {
link, //H5消息页面url 必填
desc,
title,
imgUrl
},
enterChat: false
})
.then(() => {
this.showToast('发送成功')
})
},
shareAppMessage(link, desc, title, imgUrl) {
window.$wx
.shareAppMessage({
title,
desc,
link,
imgUrl
})
.then(() => {
this.showToast('发送成功')
})
}
}
}
</script>
<style lang='scss'>
.van-share-sheet__option.disabled {
opacity: 0.5;
}
.sheet {
position: relative;
z-index: 1;
}
.share-box {
position: fixed;
width: 100%;
height: 100vh;
top: 0;
left: 0;
z-index: 100;
}
</style>
\ No newline at end of file
export default {
data() {
return {
}
},
mounted() {},
methods: {
}
}
\ No newline at end of file
......@@ -22,8 +22,7 @@ export default {
methods: {
init () {
this.showLoading()
let { tabIndex, pageNum } = this
this[`getList_${tabIndex}`](pageNum)
this.getList(this.pageNum)
},
change (index) {
this.tabIndex = index
......
......@@ -46,115 +46,87 @@ export default {
let { userId, id, couponName, activityName, packageName, goodsName, goodsImage, discountType } = i
let shopmall_appId = environment == 'beta' ? 'wx9f91c1ec493eb425' : 'wxe10067a63c1856ac'
this.showLoading()
switch (name) {
/**卡券 */
case 'coupon': {
let desc = '您的专属服务顾问为您发来了优惠券,请点击领取~'
let imgUrl = 'http://img01.glsx.com.cn/upload/biz/dracMini-yh-10004.png'
if (tabIndex == 0) {
if (entry != 'normal')
this.sendChatMessage({
// channelType 1 嘀加 2:广汇
appid: channelType == 1 ? shopmall_appId : 'wxfe82b8d65d07808f',
title: couponName,
imgUrl,
page: `/packageMine/pages/boutique/gift/gift.html?id=${id}&userId=${userId}&employName=${this.toUnicode(i.employeeName)}`
})
else {
boutiquecouponApi.getBoutiqueCoupon({ id }).then(res => {
this.shareAppMessage(res, desc, couponName, imgUrl)
})
}
} else {
this.couponShare(i, res => {
if (entry != 'normal')
this.sendChatMessage({
appid: shopmall_appId,
title: `${couponName}(${window.$discountType[discountType]}券)`,
imgUrl,
page: `/packageMall/pages/coupon/coupon.html?couponId=${id}&merchantId=${merchantId}&issueName=${this.toUnicode(userName)}&issueDate=${new Date().getTime()}`
})
else this.shareAppMessage(res, desc, couponName, imgUrl)
// channelType 1 嘀加 2:广汇
if (name === 'coupon') { /**卡券 */
let desc = '您的专属服务顾问为您发来了优惠券,请点击领取~'
let imgUrl = 'http://img01.glsx.com.cn/upload/biz/dracMini-yh-10004.png'
if (tabIndex == 0) {
if (entry != 'normal') this.sendChatMessage({
appid: channelType == 1 ? shopmall_appId : 'wxfe82b8d65d07808f',
title: couponName,
imgUrl,
page: `/packageMine/pages/boutique/gift/gift.html?id=${id}&userId=${userId}&employName=${this.toUnicode(i.employeeName)}`
})
else boutiquecouponApi.getBoutiqueCoupon({ id }).then(url => {
this.shareAppMessage(url, desc, couponName, imgUrl)
})
} else {
this.couponShare(i, url => {
if (entry != 'normal') this.sendChatMessage({
appid: shopmall_appId,
title: `${couponName}(${window.$discountType[discountType]}券)`,
imgUrl,
page: `/packageMall/pages/coupon/coupon.html?couponId=${id}&merchantId=${merchantId}&issueName=${this.toUnicode(userName)}&issueDate=${new Date().getTime()}`
})
}
break
else this.shareAppMessage(url, desc, couponName, imgUrl)
})
}
/**活动 */
case 'activity': {
if (tabIndex == 0) {
let imgUrl = 'http://img01.glsx.com.cn/upload/biz/dracMini-ms-10004.png'
if (entry != 'normal')
this.sendChatMessage({
appid: shopmall_appId,
title: activityName,
imgUrl,
page: `/packageMall/pages/detail/detail.html?isActivity=true&id=${id}&merchantId=${merchantId}`
})
else {
activityApi.getShared({ id }).then(res => {
this.shareAppMessage(res, '您有一个秒杀活动可参加', activityName, imgUrl)
})
}
} else {
}
break
} else if (name === 'activity') { /**活动 */
if (tabIndex == 0) {
let imgUrl = 'http://img01.glsx.com.cn/upload/biz/dracMini-ms-10004.png'
if (entry != 'normal') this.sendChatMessage({
appid: shopmall_appId,
title: activityName,
imgUrl,
page: `/packageMall/pages/detail/detail.html?isActivity=true&id=${id}&merchantId=${merchantId}`
})
else activityApi.getShared({ id }).then(url => {
this.shareAppMessage(url, '您有一个秒杀活动可参加', activityName, imgUrl)
})
} else {
/**直播 */
}
/**店铺 */
case 'merchant': {
if (tabIndex == 0) {
let path = 'pages/tab/index/index'
let query = `merchantId=${merchantId}`
const imgUrl = 'https://img01.glsx.com.cn/weapp/resource/scrm-mobile/activity/miniprogram-cover.jpg'
if (entry != 'normal')
this.sendChatMessage({
appid: shopmall_appId,
title: merchantName,
imgUrl,
page: `/${path}.html?${query}`
})
else {
console.log('query', query)
wxConfig
.createMiniprogramUrlLink({
path,
query: encodeURIComponent(query),
appId: shopmall_appId
})
.then(res => {
console.log(res)
this.shareAppMessage(res, '', merchantName, imgUrl)
})
}
} else if (tabIndex == 1) {
let imgUrl = 'http://img01.glsx.com.cn/upload/biz/dracMini-qy-10004.png'
if (entry != 'normal')
this.sendChatMessage({
appid: shopmall_appId,
title: packageName,
imgUrl,
page: `/packageEquity/pages/package/package.html?id=${id}&merchantId=${merchantId}`
})
else {
equityApi.getEquityShared({ id }).then(res => {
this.shareAppMessage(res.url, '您的专属客服顾问为您发来了会员套餐,点击查看哦', packageName, imgUrl)
})
}
} else {
if (entry != 'normal')
this.sendChatMessage({
appid: shopmall_appId,
title: goodsName,
imgUrl: goodsImage,
page: `/packageMall/pages/detail/detail.html?id=${id}&merchantId=${merchantId}`
})
else {
shopmallApi.getGoodsLink({ id }).then(res => {
this.shareAppMessage(res, '', goodsName, goodsImage)
})
}
}
break
} else { /**店铺 */
if (tabIndex == 0) {
let path = 'pages/tab/index/index'
let query = `merchantId=${merchantId}`
const imgUrl = 'https://img01.glsx.com.cn/weapp/resource/scrm-mobile/activity/miniprogram-cover.jpg'
if (entry != 'normal') this.sendChatMessage({
appid: shopmall_appId,
title: merchantName,
imgUrl,
page: `/${path}.html?${query}`
})
else wxConfig
.createMiniprogramUrlLink({
path,
query: encodeURIComponent(query),
appId: shopmall_appId
})
.then(url => {
this.shareAppMessage(url, '', merchantName, imgUrl)
})
} else if (tabIndex == 1) {
let imgUrl = 'http://img01.glsx.com.cn/upload/biz/dracMini-qy-10004.png'
if (entry != 'normal') this.sendChatMessage({
appid: shopmall_appId,
title: packageName,
imgUrl,
page: `/packageEquity/pages/package/package.html?id=${id}&merchantId=${merchantId}`
})
else equityApi.getEquityShared({ id }).then(({ url }) => {
this.shareAppMessage(url, '您的专属客服顾问为您发来了会员套餐,点击查看哦', packageName, imgUrl)
})
} else {
if (entry != 'normal') this.sendChatMessage({
appid: shopmall_appId,
title: goodsName,
imgUrl: goodsImage,
page: `/packageMall/pages/detail/detail.html?id=${id}&merchantId=${merchantId}`
})
else shopmallApi.getGoodsLink({ id }).then(url => {
this.shareAppMessage(url, '', goodsName, goodsImage)
})
}
}
},
......@@ -201,12 +173,11 @@ export default {
couponId: id,
shareType: 1
}
if (is_contact)
obj.userList = [
{
userId: is_contact
}
]
if (is_contact) obj.userList = [
{
userId: is_contact
}
]
else obj.shareType = 0
couponApi.getCouponShared(obj).then(res => {
callBack(res.url)
......
......@@ -77,12 +77,6 @@
<van-empty description="暂无内容" />
</template>
</template>
<!-- <share
:value="showShare"
:apiName="tabIndex == 0 ? 'activityApi':'liveApi'"
@cancel="showShare = false"
:currentItem="currentItem"
/> -->
</template>
<template v-else>
<router-view></router-view>
......@@ -96,42 +90,36 @@ import { activityApi, liveApi } from '@/api'
export default {
name: 'activity',
mixins: [shareMixin, pageMixin],
data() {
data () {
return {
tabList: ['秒杀活动']
}
},
methods: {
getList_0(pageNum) {
let { list } = this
activityApi.getActivityList({ currentPage: pageNum }).then(res => {
console.log('活动列表', res)
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日')
e.price1 = this.centsToyuan(e.price1 || 0)
e.price2 = this.centsToyuan(e.price2 || 0)
})
this.flag = true
this.list = list.concat(res.list)
this.total = res.total
this.hideLoading()
})
},
getList_1(pageNum) {
let { list } = this
liveApi.getLiveList({ pageNum }).then(res => {
console.log('直播列表', res)
getList (pageNum) {
let { list, tabIndex } = this
let API = tabIndex == 0 ? activityApi : liveApi
let target = tabIndex == 0 ? 'getActivityList' : 'getLiveList'
API[target](pageNum).then(res => {
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日')
e.price1 = this.centsToyuan(e.price1 || 0)
e.price2 = this.centsToyuan(e.price2 || 0)
})
}
this.flag = true
this.list = list.concat(res.list)
this.total = res.total
this.hideLoading()
})
},
centsToyuan(price) {
centsToyuan (price) {
return Number(price / 100).toFixed(2)
},
iosTimeFormat(time) {
iosTimeFormat (time) {
return time.replace(/\-/g, '/')
}
}
......
......@@ -60,12 +60,6 @@
<van-empty description="暂无内容" />
</template>
</template>
<!-- <share
:value="showShare"
:apiName="tabIndex == 0?'boutiquecouponApi':'couponApi'"
@cancel="showShare = false"
:currentItem="currentItem"
/> -->
</template>
<template v-else>
<router-view></router-view>
......@@ -76,33 +70,23 @@
<script type='text/ecmascript-6'>
import { shareMixin, pageMixin, discountTypeMixin } from '@/mixins'
import { couponApi, boutiquecouponApi } from '@/api'
const tabList = ['新车精品礼券', '商城优惠券']
export default {
name: 'coupon',
mixins: [shareMixin, pageMixin, discountTypeMixin],
data () {
return {
tabList,
updata: new Date().getTime()
tabList: ['新车精品礼券', '商城优惠券']
}
},
mounted () { },
methods: {
getList_0 (pageNum) {
let { list } = this
boutiquecouponApi.getBoutiqueCouponList({ pageNum }).then(res => {
getList (pageNum) {
let { list, tabIndex } = this
let API = tabIndex == 0 ? boutiquecouponApi : couponApi
let target = tabIndex == 0 ? 'getBoutiqueCouponList' : 'getMerchantCouponList'
API[target]({ pageNum }).then(res => {
this.hideLoading()
console.log('精品礼券', res)
this.flag = true
this.list = list.concat(res.list)
this.total = res.total
})
},
getList_1 (pageNum) {
let { list } = this
couponApi.getMerchantCouponList({ pageNum }).then(res => {
this.hideLoading()
console.log('商城礼券', res)
console.log(tabIndex == 0 ? '精品礼券' : '商城礼券', res)
this.flag = true
this.list = list.concat(res.list)
this.total = res.total
......
......@@ -108,22 +108,16 @@ export default {
}
},
methods: {
getList_0 () {
this.flag = true
this.hideLoading()
},
getList_1 (pageNum) {
let { list } = this
equityApi.getEquityList({ pageNum }).then(res => {
getList (pageNum) {
let { list, tabIndex } = this
if (tabIndex == 0) {
this.flag = true
this.list = list.concat(res.list)
this.total = res.total
this.hideLoading()
})
},
getList_2 (pageNum) {
let { list } = this
shopmallApi.getGoodsList({ currentPage: pageNum }).then(res => {
return
}
let API = tabIndex == 1 ? equityApi : shopmallApi
let target = tabIndex == 1 ? 'getEquityList' : 'getGoodsList'
API[target](pageNum).then(res => {
this.flag = true
this.list = list.concat(res.list)
this.total = res.total
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!