Commit 5888dab9 by liwk

commit

1 parent c8c50add
const url = '/rop-scrm-shopmall/router'
export default {
/** 分页查询活动 */
getActivityList(data) {
data.method = 'scrm.api.shopmall.activity.page'
data.pageSize = 10
return window.$HTTP({
url,
data
})
},
/** 获取分享链接 */
getShared(data) {
data.method = 'scrm.api.shopmall.activity.get.shared'
return window.$HTTP({
url,
data,
returnAll: true
})
},
}
\ No newline at end of file \ No newline at end of file
const url = '/rop-scrm-boutiquecoupon/router'
export default {
/**精品礼券分页查询 */
getBoutiqueCouponList(data) {
data.method = 'scrm.api.boutiquecoupon.wework.coupon.page'
data.pageSize = 10
return window.$HTTP({
// url: 'http://192.168.3.222:8489/rop-scrm-boutiquecoupon/router',
url,
data
})
},
/**精品礼券领取链接 */
getBoutiqueCoupon(data) {
data.method = 'scrm.api.boutiquecoupon.wework.coupon.receiveUrl'
return window.$HTTP({
// url: 'http://192.168.3.222:8489/rop-scrm-boutiquecoupon/router',
url,
data
})
},
}
\ No newline at end of file \ No newline at end of file
const url = 'http://192.168.3.222:8489/rop-scrm-boutiquecoupon/router' const url = '/rop-scrm-coupon/router'
const pageSize = 10
export default { export default {
/** 获取门店商品列表 */ /**商城优惠券列表 */
getGoodsList(data) { getMerchantCouponList(data) {
data.method = 'scrm.api.shopmall.goods.wework.page' data.method = 'scrm.api.coupon.list.merchant'
data.pageSize = 10 data.pageSize = pageSize
data.validType = 'valid'
return window.$HTTP({ return window.$HTTP({
url, url,
data data
}) })
}, },
/**精品礼券分页查询 */ /** 获取优惠卷分享链接 */
getBoutiqueCouponList(data) { getCouponShared(data) {
data.method = 'scrm.api.boutiquecoupon.wework.coupon.page' data.method = 'scrm.api.coupon.share'
data.pageSize = 10
return window.$HTTP({ return window.$HTTP({
url, url,
data data
}) })
}, },
/** 已经核销列表 */
getVerificationList(data) {
data.method = 'scrm.api.coupon.verification.code.verification.list'
data.pageSize = pageSize
return window.$HTTP({
url,
data
})
},
/** 查询已领取 未核销 */
getUserCouponList(data) {
data.method = 'scrm.api.coupon.user.list.merchant'
data.pageSize = pageSize
return window.$HTTP({
url,
data
})
},
/** 根据核销码查询卷信息 */
scan(data) {
data.method = 'scrm.api.coupon.verification.code.scan'
return window.$HTTP({
url,
data
})
},
/** 核销核销码 */
verificationCode(data) {
data.method = 'scrm.api.coupon.verification.code.verification'
return window.$HTTP({
url,
data
})
}
} }
\ No newline at end of file \ No newline at end of file
const url = '/rop-scrm-equity/router'
export default {
/**套餐分页查询 */
getEquityList(data) {
data.method = 'scrm.api.equity.package.info.list.with.page'
data.pageSize = 10
return window.$HTTP({
url,
data
})
},
/**套餐详情 */
getEquityDetail(data) {
data.method = 'scrm.api.equity.main.page.package.detail.get'
return window.$HTTP({
url,
data
})
},
/** 获取套餐分享链接 */
getEquityShared(data) {
data.method = 'scrm.api.equity.package.info.share'
return window.$HTTP({
url,
data
})
},
}
\ No newline at end of file \ No newline at end of file
...@@ -7,12 +7,21 @@ ...@@ -7,12 +7,21 @@
* @LastEditTime: 2021-06-17 18:23:27 * @LastEditTime: 2021-06-17 18:23:27
*/ */
import ssoApi from './ssoApi' import ssoApi from './ssoApi'
import liveApi from './liveApi'
import couponApi from './couponApi' import couponApi from './couponApi'
import wx_config from './wxConfig' import activityApi from './activityApi'
import wxConfig from './wxConfig'
import shopmallApi from './shopmallApi' import shopmallApi from './shopmallApi'
import boutiquecouponApi from './boutiquecouponApi'
import equityApi from './equityApi'
export { export {
ssoApi, ssoApi,
couponApi, couponApi,
wx_config, wxConfig,
shopmallApi shopmallApi,
activityApi,
liveApi,
boutiquecouponApi,
equityApi
} }
\ No newline at end of file \ No newline at end of file
const url = '/rop-scrm-live/router'
export default {
/** 分页查询活动 */
getLiveList(data) {
data.method = 'scrm.api.live.live.room.list'
data.pageSize = 10
return window.$HTTP({
url,
data,
})
},
getShared(data) {
data.method = 'scrm.api.live.get.shared.code'
return window.$HTTP({
url,
data,
returnAll: true
})
},
}
\ No newline at end of file \ No newline at end of file
import util from '@/utils/util' import util from '@/utils/util'
import { Notify } from 'vant' import { Notify } from 'vant'
class WxConfig { const WxConfig = {
constructor(jsApiList) { init(jsApiList) {
jsApiList.map(e => { return new Promise((resolve, reject) => {
if (e == 'chooseImage') jsApiList.push('getLocalImgData') jsApiList.map(e => {
}) if (e == 'chooseImage') jsApiList.push('getLocalImgData')
let [redirectUrl] = window.location.href.split('#') })
const { corpId } = util.getLocalStorage('dj_scrm_corpId') let [redirectUrl] = window.location.href.split('#')
/** 获取企微应用AgentConfig */ const { corpId } = util.getLocalStorage('dj_scrm_corpId')
let data = { /** 获取企微应用AgentConfig */
corpId, let data = {
method: 'scrm.api.work.wechat.get.agent.config', corpId,
url: redirectUrl, method: 'scrm.api.work.wechat.get.agent.config',
appCode: 'DJQWGJ' url: redirectUrl,
} appCode: 'DJQWGJ'
window.$HTTP({
url: '/rop-scrm-wechat/router',
data
}).then(obj => {
if (obj) {
console.log(obj)
wx.agentConfig({
corpid: obj.corpId, // 必填,企业微信的corpid,必须与当前登录的企业一致
agentid: obj.agentId, // 必填,企业微信的应用id (e.g. 1000247)
timestamp: obj.timestamp, // 必填,生成签名的时间戳
nonceStr: obj.nonceStr, // 必填,生成签名的随机串
signature: obj.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法,
jsApiList,
success(res) {
console.log(res)
},
fail(err) {
console.log(err)
}
})
} else {
Notify('网络异常')
} }
window.$HTTP({
url: '/rop-scrm-wechat/router',
data
}).then(obj => {
if (obj) {
wx.agentConfig({
corpid: obj.corpId, // 必填,企业微信的corpid,必须与当前登录的企业一致
agentid: obj.agentId, // 必填,企业微信的应用id (e.g. 1000247)
timestamp: obj.timestamp, // 必填,生成签名的时间戳
nonceStr: obj.nonceStr, // 必填,生成签名的随机串
signature: obj.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法,
jsApiList,
success(res) {
console.log(res, 'wx_config')
resolve()
},
fail(err) {
console.log(err, 'wx_config')
reject(err)
}
})
} else {
Notify('网络异常')
}
})
}) })
} },
getContext(callBack) { getContext(callBack) {
/** /**
* entry String 场景值 * entry String 场景值
* shareTicket String 仅当转发时设置了withShareTicket转发到会话的消息进入才返回该字段,详见私密消息 * shareTicket String 仅当转发时设置了withShareTicket转发到会话的消息进入才返回该字段,详见私密消息
**/ **/
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
wx.invoke('getContext', {}, ({ err_msg, entry, shareTicket }) => { wx.invoke('getContext', {}, (res) => {
console.log(res)
let { err_msg, entry, shareTicket } = res
/** entry 说明 /** entry 说明
*contact_profile 从联系人详情进入 3.0.24 *contact_profile 从联系人详情进入 3.0.24
*single_chat_tools 从单聊会话的工具栏进入 3.0.24 *single_chat_tools 从单聊会话的工具栏进入 3.0.24
...@@ -65,87 +70,85 @@ class WxConfig { ...@@ -65,87 +70,85 @@ class WxConfig {
} }
}) })
}) })
} },
/**获取当前外部联系人userid */ /**获取当前外部联系人userid */
getCurExternalContact() { getCurExternalContact() {
return this.getContext((resolve, { return new Promise((resolve, reject) => {
entry,
}) => {
wx.invoke('getCurExternalContact', {}, res => { wx.invoke('getCurExternalContact', {}, res => {
if (entry == 'contact_profile' || entry == 'single_chat_tools') { if (res.err_msg == 'getCurExternalContact:ok') {
if (res.err_msg == 'getCurExternalContact:ok') { resolve(res.userId)
resolve(res.userId)
}
} else { } else {
Notify('需有配置客户联系功能权限') reject(res)
} }
})
})
},
/** 外部联系人选人接口 */
selectExternalContact() {
return new Promise((resolve) => {
wx.invoke('selectExternalContact', {
filterType: 0, //0表示展示全部外部联系人列表,1表示仅展示未曾选择过的外部联系人。默认值为0;除了0与1,其他值非法。在企业微信2.4.22及以后版本支持该参数
}, res => {
if (res.err_msg == "selectExternalContact:ok") {
resolve(res)
}
}) })
}) })
}
},
/**分享消息到当前会话 */ /**分享消息到当前会话 */
sendChatMessage(params) { sendChatMessage(params) {
return this.getContext((resolve, { console.log(params)
entry, return new Promise((resolve) => {
shareTicket
}) => {
wx.invoke('sendChatMessage', params, res => { wx.invoke('sendChatMessage', params, res => {
if (entry == 'chat_attachment') { console.log(res)
if (res.err_msg == 'sendChatMessage:ok') { if (res.err_msg == 'sendChatMessage:ok') {
resolve() resolve()
}
} else {
Notify('需有配置客户联系功能权限')
} }
}) })
}) })
} },
/**群发消息给客户 */ /**群发消息给客户 */
shareToExternalContact(params) { shareToExternalContact(params) {
return this.getContext(resolve => { return new Promise((resolve) => {
wx.invoke('shareToExternalContact', params, res => { wx.invoke('shareToExternalContact', params, res => {
if (res.err_msg == 'shareToExternalContact:ok') { if (res.err_msg == 'shareToExternalContact:ok') {
resolve() resolve()
} else {
Notify('需有配置客户联系功能权限')
} }
}) })
}) })
} },
/**群发消息到客户群 */ /**群发消息到客户群 */
shareToExternalChat(params) { shareToExternalChat(params) {
return this.getContext(resolve => { return new Promise((resolve) => {
wx.invoke('shareToExternalChat', params, res => { wx.invoke('shareToExternalChat', params, res => {
if (res.err_msg == 'shareToExternalChat:ok') { if (res.err_msg == 'shareToExternalChat:ok') {
resolve() resolve()
} else {
Notify('需有配置客户联系功能权限')
} }
}) })
}) })
} },
/**进入添加客户界面 */ /**进入添加客户界面 */
navigateToAddCustomer() { navigateToAddCustomer() {
wx.invoke('navigateToAddCustomer') wx.invoke('navigateToAddCustomer')
} },
/**发表内容到客户朋友圈 */ /**发表内容到客户朋友圈 */
shareToExternalMoments(params) { shareToExternalMoments(params) {
return this.getContext(resolve => { return new Promise((resolve) => {
wx.invoke('shareToExternalMoments', params, res => { wx.invoke('shareToExternalMoments', params, res => {
if (res.err_msg == 'shareToExternalMoments:ok') { if (res.err_msg == 'shareToExternalMoments:ok') {
resolve() resolve()
} else {
Notify('需有配置客户联系功能权限')
} }
}) })
}) })
} },
/**打开会话 */ /**打开会话 */
openEnterpriseChat({ openEnterpriseChat({
...@@ -173,7 +176,7 @@ class WxConfig { ...@@ -173,7 +176,7 @@ class WxConfig {
} }
}) })
}) })
} },
/**企业微信扫一扫 */ /**企业微信扫一扫 */
scanQRCode(needResult) { scanQRCode(needResult) {
...@@ -192,7 +195,7 @@ class WxConfig { ...@@ -192,7 +195,7 @@ class WxConfig {
} }
}) })
}) })
} },
/**获取本地图片接口 */ /**获取本地图片接口 */
getLocalImgData(localId) { getLocalImgData(localId) {
...@@ -207,7 +210,7 @@ class WxConfig { ...@@ -207,7 +210,7 @@ class WxConfig {
} }
}) })
}) })
} },
/**拍照或从手机相册中选图接口 */ /**拍照或从手机相册中选图接口 */
chooseImage(count = 1) { chooseImage(count = 1) {
...@@ -231,7 +234,7 @@ class WxConfig { ...@@ -231,7 +234,7 @@ class WxConfig {
} }
}) })
}) })
} },
/**预览图片接口 */ /**预览图片接口 */
previewImage(obj) { previewImage(obj) {
...@@ -239,7 +242,7 @@ class WxConfig { ...@@ -239,7 +242,7 @@ class WxConfig {
* urls 需要预览的图片http链接列表 * urls 需要预览的图片http链接列表
*/ */
wx.previewImage(obj) wx.previewImage(obj)
} },
/**上传图片接口 */ /**上传图片接口 */
uploadImage(localId) { uploadImage(localId) {
...@@ -253,7 +256,7 @@ class WxConfig { ...@@ -253,7 +256,7 @@ class WxConfig {
} }
}) })
}) })
} },
/**下载图片接口 */ /**下载图片接口 */
downloadImage(serverId) { downloadImage(serverId) {
...@@ -267,7 +270,7 @@ class WxConfig { ...@@ -267,7 +270,7 @@ class WxConfig {
}) })
}) })
} },
/**使用企业微信内置地图查看位置接口 */ /**使用企业微信内置地图查看位置接口 */
openLocation(obj) { openLocation(obj) {
...@@ -279,7 +282,7 @@ class WxConfig { ...@@ -279,7 +282,7 @@ class WxConfig {
scale, // 地图缩放级别,整形值,范围从1~28。默认为16 scale, // 地图缩放级别,整形值,范围从1~28。默认为16
*/ */
wx.openLocation(obj) wx.openLocation(obj)
} },
/**获取地理位置接口 */ /**获取地理位置接口 */
getLocation(type = 'wgs84') { getLocation(type = 'wgs84') {
...@@ -291,7 +294,7 @@ class WxConfig { ...@@ -291,7 +294,7 @@ class WxConfig {
} }
}) })
}) })
} },
/**自定义转发到会话 */ /**自定义转发到会话 */
shareAppMessage(obj) { shareAppMessage(obj) {
......
.sprite-icon { background-image: url(../images/sprite.png);background-size: 200px 170px;} .sprite-icon { background-image: url(../images/sprite.png);background-size: 250px 212px;}
.icon-coupon { width: 80px; height: 80px; background-position: 0px 0px;} .icon-coupon { width: 80px; height: 80px; background-position: 0px 0px;}
.icon-discount { width: 80px; height: 80px; background-position: -90px 0px;} .icon-discount { width: 80px; height: 80px; background-position: -90px 0px;}
.icon-down { width: 12px; height: 12px; background-position: -180px -60px;} .icon-down { width: 12px; height: 12px; background-position: -170px -180px;}
.icon-exchange { width: 80px; height: 80px; background-position: 0px -90px;} .icon-exchange { width: 80px; height: 80px; background-position: 0px -90px;}
.icon-poster-close { width: 20px; height: 20px; background-position: -180px 0px;}
.icon-share { width: 20px; height: 20px; background-position: -180px -30px;}
.icon-vip { width: 80px; height: 80px; background-position: -90px -90px;}
\ No newline at end of file \ No newline at end of file
.icon-poster-close { width: 20px; height: 20px; background-position: -84px -180px;}
.icon-share { width: 20px; height: 20px; background-position: -114px -180px;}
.icon-vip { width: 80px; height: 80px; background-position: -90px -90px;}
.icon-scan { width: 16px; height: 16px; background-position: -144px -180px;}
.icon-coupon-0 { width: 32px; height: 32px; background-position: 0px -180px;}
.icon-coupon-1 { width: 32px; height: 32px; background-position: -42px -180px;}
.icon-coupon-lose { width: 70px; height: 70px; background-position: -180px 0px;}
.icon-coupon-success { width: 70px; height: 70px; background-position: -180px -80px;}
\ No newline at end of file \ No newline at end of file

45.2 KB | W: | H:

80.8 KB | W: | H:

src/assets/images/sprite.png
src/assets/images/sprite.png
src/assets/images/sprite.png
src/assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin

358 Bytes | W: | H:

383 Bytes | W: | H:

src/assets/spritesmith/down.png
src/assets/spritesmith/down.png
src/assets/spritesmith/down.png
src/assets/spritesmith/down.png
  • 2-up
  • Swipe
  • Onion skin
<template> <template>
<van-overlay <van-overlay
:show="show" :show="show"
z-index="2003" z-index="2007"
> >
<div <div
class="wrapper" class="wrapper"
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
@click.prevent="close" @click.prevent="close"
></div> ></div>
<van-image <van-image
:src="img" :src="img || activityData.posterUrl"
width="100%" width="100%"
height="100%" height="100%"
> >
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
import { shopmallApi } from '@/api' import { shopmallApi } from '@/api'
export default { export default {
name: 'Poster', name: 'Poster',
props: ['value', 'apiName', 'currentItem'], props: ['value', 'apiName', 'currentItem', 'activityData'],
data () { data () {
return { return {
show: false, show: false,
...@@ -69,11 +69,17 @@ export default { ...@@ -69,11 +69,17 @@ export default {
this.showToast('请长按海报保存') this.showToast('请长按海报保存')
}, },
share () { share () {
console.log(this)
let { currentItem, apiName, activityData } = this
let flag = apiName != 'shopmallApi'
window.$wx.shareAppMessage({ window.$wx.shareAppMessage({
imgUrl: this.img imgUrl: flag ? currentItem.shareImgUrl : currentItem.goodsImage,
title: flag ? currentItem.name : currentItem.goodsName,
link: flag ? activityData.pagePath : activityData.url,
}).then(res => { }).then(res => {
console.log(res) this.showToast('发送成功')
}) })
}, },
getGoodsPoster (id) { getGoodsPoster (id) {
this.img = '' this.img = ''
......
...@@ -27,10 +27,7 @@ export default { ...@@ -27,10 +27,7 @@ export default {
}, },
methods: { methods: {
onLoad () { onLoad () {
console.log('触底') this.$emit('ReachBottom')
this.loading = false
this.finished = true
this.$emit('ReachBottom', null)
}, },
} }
} }
......
...@@ -3,17 +3,18 @@ ...@@ -3,17 +3,18 @@
<van-search <van-search
v-model="keyword" v-model="keyword"
placeholder="输入客户姓名搜索" placeholder="输入客户姓名搜索"
@search="onSearch"
/> />
<van-dropdown-menu active-color="#5850ff"> <van-dropdown-menu active-color="#5850ff">
<van-dropdown-item <van-dropdown-item
v-model="value" v-model="value"
:options="option" :options="option"
@change="change"
/> />
<div class="arrow y-center"> <div class="arrow y-center">
<div class="sprite-icon icon-down"></div> <div class="sprite-icon icon-down"></div>
</div> </div>
</van-dropdown-menu> </van-dropdown-menu>
</div> </div>
</template> </template>
...@@ -33,6 +34,12 @@ export default { ...@@ -33,6 +34,12 @@ export default {
mounted () { mounted () {
}, },
methods: { methods: {
change (e) {
this.$emit('change', e)
},
onSearch (e) {
this.$emit('search', e)
}
} }
} }
</script> </script>
...@@ -40,7 +47,7 @@ export default { ...@@ -40,7 +47,7 @@ export default {
<style lang='scss'> <style lang='scss'>
.search-box { .search-box {
height: 50px; height: 50px;
background: #5850ff; background: #fff;
box-shadow: 0px 1px 0px 0px #e9e9e9; box-shadow: 0px 1px 0px 0px #e9e9e9;
padding-right: 16px; padding-right: 16px;
position: relative; position: relative;
...@@ -49,9 +56,11 @@ export default { ...@@ -49,9 +56,11 @@ export default {
width: 263px; width: 263px;
padding: 4.5px 8px; padding: 4.5px 8px;
height: 100%; height: 100%;
background: #5850ff; background: #fff;
.van-search__content { .van-search__content {
background-color: #fff; background-color: #fff;
border: 1px solid #cdd1d4;
border-radius: 16px;
} }
} }
.van-dropdown-menu { .van-dropdown-menu {
...@@ -65,10 +74,12 @@ export default { ...@@ -65,10 +74,12 @@ export default {
transition: all 0.25s; transition: all 0.25s;
} }
.van-dropdown-menu__bar { .van-dropdown-menu__bar {
background-color: #5850ff; background-color: #fff;
box-shadow: none;
.van-dropdown-menu__title { .van-dropdown-menu__title {
color: #fff !important; color: #545454 !important;
font-size: 16px; font-size: 16px;
&::after { &::after {
display: none; display: none;
} }
......
...@@ -13,12 +13,14 @@ ...@@ -13,12 +13,14 @@
@close="showPoster = false" @close="showPoster = false"
:apiName="apiName" :apiName="apiName"
:currentItem="currentItem" :currentItem="currentItem"
:activityData="activityData"
/> />
</div> </div>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import { shopmallApi } from '@/api' import { shopmallApi, activityApi, couponApi, liveApi, boutiquecouponApi, equityApi } from '@/api'
import { Notify } from 'vant'
const staticOptions = [ const staticOptions = [
{ name: '企业微信', icon: require('@/assets/images/icon/wx.png'), type: 1 }, { 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/poster.png'), type: 2 },
...@@ -32,19 +34,53 @@ export default { ...@@ -32,19 +34,53 @@ export default {
showPoster: false, showPoster: false,
showShare: false, showShare: false,
options: [], options: [],
activityData: {},
component_id: '',
component_api_name: ''
} }
}, },
watch: { watch: {
value (n) { value (n) {
this.showShare = n console.log(n)
let { currentItem: { id }, component_id, apiName, component_api_name } = this
if (component_id == id && n && component_api_name == apiName) {
this.showShare = true
return
}
if (n) { if (n) {
let options = this.tools.deepClone(staticOptions) let options = this.tools.deepClone(staticOptions)
if (this.apiName == 'couponApi') { if (apiName == 'couponApi' || apiName == 'boutiquecouponApi' || apiName == 'equityApi') {
options[1].className = 'disabled' options[1].className = 'disabled'
} }
this.options = 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') {
shopmallApi.getGoodsLink({ id }).then(data => {
console.log(data)
this.activityData = {
url: data
}
})
}
this.showShare = true
} }
} }
}, },
mounted () { mounted () {
...@@ -54,19 +90,70 @@ export default { ...@@ -54,19 +90,70 @@ export default {
this.showPoster = false this.showPoster = false
}, },
onSelect ({ type, className }) { onSelect ({ type, className }) {
let { currentItem, apiName, activityData } = this
switch (type) { switch (type) {
case 1: 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.url, desc, couponName)
else this.shareAppMessage(res.url, 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') {
let { activityData } = this
if (apiName == 'activityApi') {
if (userId) this.sendChatMessage(activityData.linkUrl, '', activityData.activityName)
else this.shareAppMessage(activityData.linkUrl, '', activityData.activityName)
} else {
if (userId) this.sendChatMessage(activityData.cdnUrl, '', currentItem.name, currentItem.imgUrl)
else this.shareAppMessage(activityData.cdnUrl, '', currentItem.name, currentItem.imgUrl)
}
}
if (apiName == 'equityApi' || apiName == 'shopmallApi') {
let { id } = currentItem
if (apiName == 'equityApi') {
equityApi.getEquityShared({ id }).then(res => {
let desc = `价值${currentItem.packagePrice}元的${currentItem.list.length || 0}项权益`
if (userId) this.sendChatMessage(res.url, desc, currentItem.packageName)
else this.shareAppMessage(res.url, desc, currentItem.packageName)
})
} else {
let { activityData } = this
if (userId) this.sendChatMessage(activityData.url, '', currentItem.goodsName, currentItem.goodsImage)
else this.shareAppMessage(activityData.url, '', currentItem.goodsName, currentItem.goodsImage)
}
}
this.cancel()
break; break;
case 2: case 2:
if (className) return if (className) return
this.showPoster = true this.showPoster = true
break; break;
case 3: case 3:
let { currentItem, apiName } = this this.showLoading()
if (apiName == 'shopmallApi') { if (apiName == 'shopmallApi') {
shopmallApi.getGoodsLink({ id: currentItem.id }).then(data => { let { activityData } = this
if (data) this.setClipboardData(data) 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.id, 0, 3)
} else if (apiName == 'boutiquecouponApi') {
this.getBoutiqueCoupon(currentItem.id, res => {
this.setClipboardData(res)
}) })
} }
break; break;
...@@ -74,6 +161,49 @@ export default { ...@@ -74,6 +161,49 @@ export default {
}, },
cancel () { cancel () {
this.$emit('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
},
enterChat: false
}).then(() => {
this.showToast('发送成功')
})
},
shareAppMessage (link, desc, title, imgUrl) {
window.$wx.shareAppMessage({
title,
desc,
link,
imgUrl
})
} }
} }
} }
...@@ -83,4 +213,8 @@ export default { ...@@ -83,4 +213,8 @@ export default {
.van-share-sheet__option.disabled { .van-share-sheet__option.disabled {
opacity: 0.5; opacity: 0.5;
} }
.share {
position: relative;
z-index: 2003;
}
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
title-inactive-color="#BBB" title-inactive-color="#BBB"
title-active-color="#2c2c2c" title-active-color="#2c2c2c"
@click="click" @click="click"
:key="updata"
> >
<template v-for="(i,index) in data"> <template v-for="(i,index) in data">
<van-tab <van-tab
...@@ -21,7 +22,7 @@ ...@@ -21,7 +22,7 @@
export default { export default {
name: 'Tab', name: 'Tab',
props: { props: {
data: { list: {
type: Array, type: Array,
default: () => { default: () => {
return [] return []
...@@ -31,11 +32,18 @@ export default { ...@@ -31,11 +32,18 @@ export default {
index: { index: {
type: Number, type: Number,
default: 0 default: 0
} },
updata: null
}, },
data () { data () {
return { return {
tabIndex: this.index tabIndex: this.index,
data: this.list
}
},
watch: {
'updata' (n) {
this.data = this.list
} }
}, },
mounted () { mounted () {
......
<template> <template>
<van-action-sheet <van-action-sheet
v-model="showBox" v-model="showBox"
:actions="data"
cancel-text="取消" cancel-text="取消"
close-on-click-action close-on-click-action
@cancel="onCancel" @cancel="onCancel"
...@@ -10,28 +9,49 @@ ...@@ -10,28 +9,49 @@
> >
<div class="box"> <div class="box">
<div class="title flex"> <div class="title flex">
会员套餐名称 {{data.packageName}}
<div class="subtitle">内含xxx项权益项目</div> <div class="subtitle">内含{{data.couponsDetailList&&data.couponsDetailList.length}}项权益项目</div>
</div> </div>
<div class="items"> <div class="items">
<template v-for="(i,index) in 10"> <template v-for="(i,index) in data.couponsDetailList">
<div <div
:key="index" :key="index"
class="item" class="item"
> >
<div class="name flex"> <div class="name flex">
{{index + 1}}、精洗轿车-五座轿车 {{index + 1}}、{{i.couponName}}
<div class="num">数量:x3</div> <div class="num">数量:x{{i.serviceQuantity}}</div>
</div> </div>
<div class="decoration flex"> <div class="decoration flex">
有效期:365天 <template v-if="i.effectiveType == 1">
<span>有效期内可用1次</span> 有效期:{{i.effectiveDays}}天
</template>
<template v-if="i.effectiveType == 2">
有效期:{{new Date(i.effectiveStartTime).format('yyyy-MM-dd')}} ~ {{new Date(i.effectiveEndTime).format('yyyy-MM-dd')}}
</template>
<template v-else>
无有效期
</template>
<span>
<template v-if="i.useType == '0'">
不限制次数
</template>
<template v-if="i.useType == 1">
有效期内可用{{i.useAmount}}次
</template>
<template v-if="i.useType == 2">
{{i.useLimitDays}}天内使用{{i.useAmount}}次
</template>
</span>
</div> </div>
</div> </div>
</template> </template>
</div> </div>
<div class="tips"> <div class="tips">
附:购买套餐后到店赠送餐具一套 <template v-if="data.notes">
附:{{data.notes}}
</template>
</div> </div>
</div> </div>
...@@ -39,25 +59,37 @@ ...@@ -39,25 +59,37 @@
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import { equityApi } from '@/api'
export default { export default {
name: 'VipDialog', name: 'VipDialog',
props: { props: ['value', 'id'],
value: Boolean,
data: {
type: Array,
default: () => {
return []
}
},
},
watch: { watch: {
value (n) { value (n) {
this.showBox = n let { id, component_id } = this
if (component_id == id && n) {
this.showBox = true
return
}
if (n) {
this.showLoading()
this.component_id = id
equityApi.getEquityDetail({ id }).then(res => {
console.log(res)
this.data = res
this.hideLoading()
this.showBox = true
}).catch(() => {
this.hideLoading()
})
}
} }
}, },
data () { data () {
return { return {
showBox: false, showBox: false,
data: {},
component_id: ''
} }
}, },
mounted () { mounted () {
...@@ -113,9 +145,11 @@ export default { ...@@ -113,9 +145,11 @@ export default {
} }
} }
.decoration { .decoration {
justify-content: space-between;
font-size: 12px; font-size: 12px;
color: #cfcfd1; color: #cfcfd1;
span {
margin-left: auto;
}
} }
} }
} }
......
...@@ -17,7 +17,7 @@ import store from './store' ...@@ -17,7 +17,7 @@ import store from './store'
import api from './api' import api from './api'
import { fetchConfig, cfg } from '@/config' import { fetchConfig, cfg } from '@/config'
import '@/assets/css/index.scss' import '@/assets/css/index.scss'
import { bus, tools, store as local } from './utils' import { bus, tools, store as local, util } from './utils'
import './utils/util' import './utils/util'
import 'components' import 'components'
import { components } from '@/plugins/vant' import { components } from '@/plugins/vant'
...@@ -48,7 +48,11 @@ fetchConfig(!isMock).then(res => { ...@@ -48,7 +48,11 @@ fetchConfig(!isMock).then(res => {
Vue.use(cfg) Vue.use(cfg)
window.$fetchConfig = res window.$fetchConfig = res
/**登录过期 重新登录 */ /**登录过期 重新登录 */
window.reLogin = () => {} window.reLogin = () => {
console.log('重新登录')
util.clearSessionId()
store.dispatch('navigation')
}
window.vm = new Vue({ window.vm = new Vue({
el: '#app', el: '#app',
router, router,
......
export default {
data() {
return {
}
},
mounted() {},
methods: {
}
}
\ No newline at end of file \ No newline at end of file
const discountType = {
1: '满减',
2: '折扣',
3: '代金',
4: '实物',
5: '购车代金',
6: '商品折扣',
7: '会员服务'
}
export default {
data() {
return {}
},
mounted() {
window.$discountType = discountType
},
methods: {
}
}
\ No newline at end of file \ No newline at end of file
import shareMixin from './shareMixin'
import pageMixin from './pageMixin'
import discountTypeMixin from './discountTypeMixin'
export {
shareMixin,
pageMixin,
discountTypeMixin
}
\ No newline at end of file \ No newline at end of file
export default {
data() {
return {
tabIndex: 0,
pageNum: 1,
list: [],
total: 0,
flag: false
}
},
mounted() {
if (this.$route.meta.isTab) this.init()
},
methods: {
init() {
this.showLoading()
let { tabIndex, pageNum } = this
this[`getList_${tabIndex}`](pageNum)
},
change(index) {
this.tabIndex = index
this.clearData()
},
clearData() {
this.flag = false
this.pageNum = 1
this.list = []
if (this.$refs.scrollView) this.$refs.scrollView.finished = false
this.init()
},
onReachBottom() {
let { total, pageNum, list } = this
this.$refs.scrollView.loading = false
if (list.length == total) {
this.$refs.scrollView.finished = true
return
}
if (Math.ceil(total / 10) > pageNum) {
this.pageNum = pageNum + 1
this.init()
} else {
this.$refs.scrollView.finished = true
}
}
}
}
\ No newline at end of file \ No newline at end of file
import { wxConfig } from '@/api'
export default {
data() {
return {
showShare: false,
currentItem: null
}
},
mounted() {
if (this.$route.meta.isTab) this.wxInit()
},
methods: {
wxInit() {
window.$wx = wxConfig
window.$wx.init(['shareAppMessage', 'sendChatMessage', 'getCurExternalContact'])
},
showShareModel(i) {
let { tabIndex } = this
if (tabIndex == 0 && i.remainAmount < 1) return
if (tabIndex == 1 && i.residueAmount < 1) return
window.$wx.getCurExternalContact().then(res => {
console.log('当前外部联系人', res)
i.userId = res
this.currentItem = i
this.showShare = true
}).catch(err => {
console.log(i)
this.currentItem = i
this.showShare = true
})
}
}
}
\ No newline at end of file \ No newline at end of file
...@@ -10,7 +10,6 @@ import Vue from 'vue' ...@@ -10,7 +10,6 @@ import Vue from 'vue'
import Router from 'vue-router' import Router from 'vue-router'
import routes from './routes' import routes from './routes'
import store from '@/store' import store from '@/store'
import util from '@/utils/util'
// hack router push callback // hack router push callback
const originalPush = Router.prototype.push const originalPush = Router.prototype.push
Router.prototype.push = function push(location, onResolve, onReject) { Router.prototype.push = function push(location, onResolve, onReject) {
...@@ -40,7 +39,8 @@ router.beforeEach((to, from, next) => { ...@@ -40,7 +39,8 @@ router.beforeEach((to, from, next) => {
} else { } else {
store.dispatch('setPageMeta', { title: '活动中心' }) store.dispatch('setPageMeta', { title: '活动中心' })
} }
/* 路由发生变化修改页面背景色 */ store.commit('SET_LAST_PATH', to.name)
/* 路由发生变化修改页面背景色 */
document.documentElement.style.backgroundColor = to.meta.backgroundColor || '#fff' document.documentElement.style.backgroundColor = to.meta.backgroundColor || '#fff'
if (to.matched.some(recode => recode.meta.noAuth)) { if (to.matched.some(recode => recode.meta.noAuth)) {
store.state.app.showWindow = true store.state.app.showWindow = true
......
...@@ -2,19 +2,27 @@ const pages = [{ ...@@ -2,19 +2,27 @@ const pages = [{
name: 'coupon', name: 'coupon',
meta: { meta: {
isTab: true, isTab: true,
keepAlive: true keepAlive: true,
backgroundColor: '#F7F7F7'
}, },
children: [{ children: [{
name: 'verificationList' name: 'verificationList',
meta: {
backgroundColor: '#F7F7F7'
}
}, { }, {
name: 'verificationDetail' name: 'verificationDetail',
meta: {
backgroundColor: '#F7F7F7'
}
}] }]
}, },
{ {
name: 'activity', name: 'activity',
meta: { meta: {
isTab: true, isTab: true,
keepAlive: true keepAlive: true,
backgroundColor: '#F7F7F7'
}, },
children: [ children: [
...@@ -24,7 +32,8 @@ const pages = [{ ...@@ -24,7 +32,8 @@ const pages = [{
name: 'merchant', name: 'merchant',
meta: { meta: {
isTab: true, isTab: true,
keepAlive: true keepAlive: true,
backgroundColor: '#F7F7F7'
}, },
children: [ children: [
......
...@@ -13,6 +13,7 @@ import { Notify } from 'vant' ...@@ -13,6 +13,7 @@ import { Notify } from 'vant'
const state = { const state = {
pageMeta: '', pageMeta: '',
keepAlives: [], keepAlives: [],
lastPath: ''
} }
const mutations = { const mutations = {
SET_PAGE_META(state, meta) { SET_PAGE_META(state, meta) {
...@@ -31,6 +32,9 @@ const mutations = { ...@@ -31,6 +32,9 @@ const mutations = {
return arr return arr
}, []) }, [])
}, },
SET_LAST_PATH(state, path) {
state.lastPath = path
}
} }
const actions = { const actions = {
...@@ -70,7 +74,8 @@ const actions = { ...@@ -70,7 +74,8 @@ const actions = {
// const { baseURL } = window.$fetchConfig.request // const { baseURL } = window.$fetchConfig.request
const [baseURL] = redirectUrl.split('/dj-scrm-wx-work-main/') const [baseURL] = redirectUrl.split('/dj-scrm-wx-work-main/')
let url = `${baseURL}/dj-scrm-wx-work-main/#/` let url = `${baseURL}/dj-scrm-wx-work-main/#/`
let route = state.lastPath == 'home' ? '' : state.lastPath || '' let route = state.lastPath == 'coupon' ? '' : state.lastPath || ''
route = route.replace('.', '/')
state.showWindow = true state.showWindow = true
if (code == '0') { if (code == '0') {
if (data.loginList.length) { if (data.loginList.length) {
...@@ -96,7 +101,7 @@ const actions = { ...@@ -96,7 +101,7 @@ const actions = {
util.setLocalStorage('dj_scrm_userInfo', res.data) util.setLocalStorage('dj_scrm_userInfo', res.data)
util.setSessionId(res.data.sessionId) util.setSessionId(res.data.sessionId)
dispatch('registerHttp', res.data.sessionId) dispatch('registerHttp', res.data.sessionId)
window.location.replace(`${redirectUrl}${route}`) window.location.replace(`${url}${route}`)
}) })
} else { } else {
let [userInfo] = data.loginList let [userInfo] = data.loginList
...@@ -130,7 +135,6 @@ const actions = { ...@@ -130,7 +135,6 @@ const actions = {
} }
}, },
navigation({ dispatch }) { navigation({ dispatch }) {
util.showLoading()
const sessionId = getParams('sessionId') const sessionId = getParams('sessionId')
const storage_sessionId = util.getSessionId() const storage_sessionId = util.getSessionId()
if (sessionId || storage_sessionId) { if (sessionId || storage_sessionId) {
...@@ -138,6 +142,7 @@ const actions = { ...@@ -138,6 +142,7 @@ const actions = {
util.setSessionId(sessionId || storage_sessionId) util.setSessionId(sessionId || storage_sessionId)
dispatch('registerHttp', sessionId || storage_sessionId) dispatch('registerHttp', sessionId || storage_sessionId)
} else { } else {
util.showLoading()
dispatch('registerHttp') dispatch('registerHttp')
dispatch('login') dispatch('login')
return return
......
...@@ -85,6 +85,9 @@ const setSessionId = val => { ...@@ -85,6 +85,9 @@ const setSessionId = val => {
const getSessionId = () => { const getSessionId = () => {
return window.localStorage.getItem('dj_scrm_session_id') return window.localStorage.getItem('dj_scrm_session_id')
} }
const clearSessionId = () => {
window.localStorage.removeItem('dj_scrm_session_id')
}
const setLocalStorage = (key, item) => { const setLocalStorage = (key, item) => {
window.localStorage.setItem(key, JSON.stringify(item)) window.localStorage.setItem(key, JSON.stringify(item))
} }
...@@ -124,6 +127,7 @@ const setClipboardData = data => { ...@@ -124,6 +127,7 @@ const setClipboardData = data => {
transfer.focus() transfer.focus()
transfer.select() transfer.select()
if (document.execCommand('copy')) document.execCommand('copy') if (document.execCommand('copy')) document.execCommand('copy')
hideLoading()
transfer.blur() transfer.blur()
Toast('内容已复制') Toast('内容已复制')
document.body.removeChild(transfer) document.body.removeChild(transfer)
...@@ -167,6 +171,7 @@ const utils = { ...@@ -167,6 +171,7 @@ const utils = {
jumpChildrenPage, jumpChildrenPage,
setLocalStorage, setLocalStorage,
getLocalStorage, getLocalStorage,
clearSessionId,
makePhoneCall, makePhoneCall,
isFullSucreen, isFullSucreen,
watchPageBack, watchPageBack,
......
...@@ -2,63 +2,79 @@ ...@@ -2,63 +2,79 @@
<div> <div>
<template v-if="$route.meta.isTab"> <template v-if="$route.meta.isTab">
<tab <tab
:data="['秒杀活动','直播活动']" :list="['秒杀活动','直播活动']"
@change="change" @change="change"
sticky sticky
></tab> ></tab>
<scroll-view :class="['list-box']"> <template v-if="flag">
<template v-for="(i,index) in activityList"> <template v-if="list.length">
<div <scroll-view
:key="index" class="list-box"
:class="['item',`type-${tabIndex}`]" @ReachBottom="onReachBottom"
ref="scrollView"
> >
<template v-if="tabIndex == 0"> <template v-for="(i,index) in list">
<div class="top flex"> <div
<div class="icon"> :key="index"
<img src="@/assets/images/test.jpg"> :class="['item',`type-${tabIndex}`]"
</div> >
<div class="info"> <template v-if="tabIndex == 0">
<div class="title text-hide">正在进行的秒杀活动的标题</div> <div class="top flex">
<div class="time">时间:2021年9月17日 ~ 2021年9月17日</div> <div class="icon">
<div class="price flex"> <img :src="i.activityImg">
<div class="old">原价:¥899 </div> </div>
<div class="now">¥399</div> <div class="info">
<div class="title text-hide">{{i.activityName}}</div>
<div class="time">时间:{{i.startTime}} ~ {{i.endTime}}</div>
<div class="price flex">
<template v-if="i.priceType == 1">
<div class="old">原价:¥{{i.price1}} </div>
<div class="now">¥{{i.price2}}</div>
</template>
<template v-else>
<div class="now">¥{{i.price1}} ~ {{i.price2}}</div>
</template>
</div>
</div>
</div>
<div class="bottom flex">
库存:{{i.goodsStock}}件
<div
class="btn text-center"
@click="showShareModel(i)"
>分享活动链接</div>
</div>
</template>
<template v-else>
<div class="icon">
<img :src="i.shareImgUrl">
</div>
<div class="info">
<div class="title text-hide">{{i.name}}</div>
<div class="time">直播时间:{{i.startTime}}</div>
<div class="zhubo flex">
主播:{{i.anchorName}}
<div
class="btn text-center"
@click="showShareModel(i)"
>分享直播间</div>
</div>
</div> </div>
</div>
</div>
<div class="bottom flex">
库存:666件
<div
class="btn text-center"
@click="showShare = true"
>分享活动链接</div>
</div>
</template>
<template v-else>
<div class="icon">
<img src="@/assets/images/test.jpg">
</div>
<div class="info">
<div class="title text-hide">!!这是直播间标题</div>
<div class="time">直播时间:2021/9/17 18:56:50</div>
<div class="zhubo flex">
主播:万人迷⭐
<div
class="btn text-center"
@click="showShare = true"
>分享直播间</div>
</div>
</div>
</template>
</div>
</template> </template>
</div> </scroll-view>
</template>
<template v-else>
<van-empty description="暂无内容" />
</template> </template>
</scroll-view> </template>
<van-share-sheet <share
v-model="showShare" :value="showShare"
title="立即分享给好友" :apiName="tabIndex == 0 ? 'activityApi':'liveApi'"
:options="options" @cancel="showShare = false"
@select="onSelect" :currentItem="currentItem"
/> />
</template> </template>
<template v-else> <template v-else>
...@@ -68,22 +84,16 @@ ...@@ -68,22 +84,16 @@
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import { shareMixin, pageMixin } from '@/mixins'
import { activityApi, liveApi } from '@/api'
export default { export default {
name: '', name: '',
mixins: [shareMixin, pageMixin],
data () { data () {
return { return {
tabIndex: 0,
activityList: new Array(11),
showShare: false,
options: [
{ name: '企业微信', icon: 'wechat', type: 1 },
{ name: '分享海报', icon: 'wechat', type: 2 },
{ name: '复制链接', icon: 'weibo', type: 3 },
]
} }
}, },
mounted () { mounted () {
}, },
activated () { activated () {
console.log('活动') console.log('活动')
...@@ -92,12 +102,37 @@ export default { ...@@ -92,12 +102,37 @@ export default {
console.log('离开活动页') console.log('离开活动页')
}, },
methods: { methods: {
change (index) { getList_0 (pageNum) {
console.log(index) let { list } = this
this.tabIndex = index activityApi.getActivityList({ currentPage: pageNum }).then(res => {
console.log('活动列表', res)
res.list.map(e => {
e.startTime = new Date(this.iosTimeFormat(e.startTime)).format('yyyy年M月d日')
e.endTime = new Date(this.iosTimeFormat(e.endTime)).format('yyyy年M月d日')
e.price1 = this.centsToyuan(e.price1)
e.price2 = this.centsToyuan(e.price2)
})
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)
this.flag = true
this.list = list.concat(res.list)
this.total = res.total
this.hideLoading()
})
},
centsToyuan (price) {
return Number(price / 100).toFixed(2)
}, },
onSelect (e) { iosTimeFormat (time) {
console.log(e) return time.replace(/\-/g, '/')
} }
} }
} }
......
...@@ -2,44 +2,55 @@ ...@@ -2,44 +2,55 @@
<div class="index"> <div class="index">
<template v-if="$route.meta.isTab"> <template v-if="$route.meta.isTab">
<tab <tab
:data="['新车精品礼券','商城优惠券']" :list="['新车精品礼券','商城优惠券']"
@change="change" @change="change"
sticky sticky
></tab> ></tab>
<scroll-view :class="['list-box']"> <template v-if="flag">
<template v-for="(i,index) in couponList"> <template v-if="list.length">
<div <scroll-view
:key="index" class="list-box"
class="item" @ReachBottom="onReachBottom"
ref="scrollView"
> >
<div :class="['sprite-icon', 'text-center',tabIndex == 0?'icon-coupon':'icon-discount']"> <template v-for="(i,index) in list">
贴膜抵用 <div
</div> :key="index"
<div class="info"> class="item"
<div class="top"> >
<div class="title">新车豪华礼券</div> <div :class="['sprite-icon', 'text-center',tabIndex == 0?'icon-coupon':'icon-discount']">
<div class="num">剩余:9999张</div> {{i.couponTypeName|| '代金券'}}
<div </div>
class="btn y-center text-center" <div class="info">
@click="showShare = true" <div class="top">
>发送</div> <div class="title">{{i.couponName}}</div>
<div class="num">剩余:{{i.remainAmount || i.residueAmount}}张</div>
<div
:class="['btn', 'y-center', 'text-center', {'disabled-btn':tabIndex == 0?i.remainAmount<1:i.residueAmount<1}]"
@click="showShareModel(i)"
>发送</div>
</div>
<div class="bottom">
<template v-if="tabIndex == 0">
<div>永久有效</div>
<div class="right">适用于新车购买用户</div>
</template>
<template v-else>
<div class="right">活动商品,满足条件可使用</div>
</template>
</div>
</div>
</div> </div>
<div class="bottom"> </template>
<template v-if="tabIndex == 0"> </scroll-view>
<div>永久有效</div> </template>
<div class="right">适用于新车购买用户</div> <template v-else>
</template> <van-empty description="暂无内容" />
<template v-else>
<div class="right">活动商品,满足条件可使用</div>
</template>
</div>
</div>
</div>
</template> </template>
</scroll-view> </template>
<share <share
:value="showShare" :value="showShare"
apiName="couponApi" :apiName="tabIndex == 0?'boutiquecouponApi':'couponApi'"
@cancel="showShare = false" @cancel="showShare = false"
:currentItem="currentItem" :currentItem="currentItem"
/> />
...@@ -51,16 +62,14 @@ ...@@ -51,16 +62,14 @@
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import { wx_config, couponApi } from '@/api' import { shareMixin, pageMixin, discountTypeMixin } from '@/mixins'
import { couponApi, boutiquecouponApi } from '@/api'
export default { export default {
name: '', name: '',
mixins: [shareMixin, pageMixin, discountTypeMixin],
data () { data () {
return { return {
isBack: false,
couponList: new Array(10),
tabIndex: 0,
showShare: false,
currentItem: null
} }
}, },
activated () { activated () {
...@@ -73,26 +82,28 @@ export default { ...@@ -73,26 +82,28 @@ export default {
console.log('离开卡券页') console.log('离开卡券页')
}, },
mounted () { mounted () {
// window.$wx = new wx_config(['shareToExternalContact', 'sendChatMessage'])
this.getBoutiqueCouponList()
}, },
methods: { methods: {
getBoutiqueCouponList () { getList_0 (pageNum) {
couponApi.getBoutiqueCouponList({ currentPage: 1 }).then(res => { let { list } = this
console.log(res) boutiquecouponApi.getBoutiqueCouponList({ currentPage: pageNum }).then(res => {
console.log('精品礼券', res)
this.flag = true
this.list = list.concat(res.list)
this.total = res.total
this.hideLoading()
}) })
}, },
jump () { getList_1 (pageNum) {
window.$back = true let { list } = this
}, couponApi.getMerchantCouponList({ pageNum }).then(res => {
change (index) { console.log('商城礼券', res)
this.tabIndex = index this.flag = true
this.WX.shareToExternalContact().then(res => { this.list = list.concat(res.list)
console.log(res) this.total = res.total
this.hideLoading()
}) })
},
onSelect ({ type }) {
console.log(type)
} }
} }
} }
...@@ -111,14 +122,16 @@ export default { ...@@ -111,14 +122,16 @@ export default {
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
align-items: center; align-items: center;
.sprite-icon { .sprite-icon {
font-size: 18px; font-size: 18px;
line-height: 25px; line-height: 25px;
font-weight: 600; font-weight: 600;
color: #ffffff; color: #ffffff;
box-sizing: border-box; box-sizing: border-box;
padding: 0 22px; padding: 0 0.14rem;
flex-shrink: 0; flex-shrink: 0;
text-align: center;
} }
.info { .info {
margin-left: 8px; margin-left: 8px;
...@@ -159,6 +172,9 @@ export default { ...@@ -159,6 +172,9 @@ export default {
font-size: 10px; font-size: 10px;
box-sizing: border-box; box-sizing: border-box;
} }
.disabled-btn {
background: #999 !important;
}
} }
.bottom { .bottom {
display: flex; display: flex;
......
<template> <template>
<div class="layout"> <div
核销详情 class="layout"
v-if="detail"
>
<div class="title">客户信息</div>
<div class="box">
<template v-for="(i,index) in customerObj">
<div
:key="index"
class="item flex"
>
<div class="label">{{i.label}}</div>
<div class="value">
<template v-if="i.format">
{{ i.format(detail)}}
</template>
<template v-else>
{{detail[i.key] || ''}}
</template>
</div>
</div>
</template>
</div>
<div class="title">优惠券信息</div>
<div class="box">
<template v-for="(i,index) in couponObj">
<div
:key="index"
class="item flex"
>
<div class="label">{{i.label}}</div>
<div class="value">
<template v-if="i.format">
{{ i.format(detail)}}
</template>
<template v-else>
{{detail[i.key] || ''}}
</template>
</div>
</div>
</template>
</div>
<div
class="btn text-center"
@click="submit"
>确认核销</div>
</div> </div>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import { discountTypeMixin } from '@/mixins'
import { couponApi } from '@/api'
export default { export default {
name: '', name: '',
mixins: [discountTypeMixin],
data () { data () {
return { return {
detail: {},
customerObj: [
{
label: '客户姓名',
key: 'userName'
},
{
label: '客户手机号',
key: 'phone'
},
{
label: '领取时间',
format (item) {
return new Date(item.receiveTime).format('yyyy年MM月dd日')
}
}
],
couponObj: [
{
label: '优惠券名称',
key: 'couponName'
},
{
label: '券编号',
key: 'verificationCode'
},
{
label: '类型',
format (item) {
return window.$discountType[item.discountType]
}
},
{
label: '发放人',
key: 'issueName'
},
{
label: '发放时间',
format (item) {
return new Date(item.issueDate).format('yyyy年MM月dd日')
}
}
]
} }
}, },
mounted () { mounted () {
let { verficationCode } = this.getParams()
couponApi.scan({ verficationCode }).then(res => {
this.detail = res
})
}, },
methods: { methods: {
submit () {
let { verficationCode } = this.detail
couponApi.verificationCode({ verficationCode }).then(res => {
if (res) this.showToast('已核销', () => {
this.$router.back()
})
})
}
} }
} }
</script> </script>
<style scoped lang='scss'> <style scoped lang='scss'>
.layout {
padding: 0 16px 60px;
.title {
padding: 16px 0 10px;
font-weight: 500;
font-size: 16px;
color: #393939;
}
.box {
background: #ffffff;
box-shadow: 0px 4px 8px 0px rgba(224, 224, 224, 0.5);
border-radius: 4px;
.item {
height: 66px;
font-size: 14px;
color: #3a3a3a;
padding: 0 16px;
border-bottom: 1px solid rgba(195, 195, 195, 0.3);
&:last-of-type {
border-bottom: none;
}
.value {
margin-left: auto;
color: #d0d0d0;
}
}
}
.btn {
position: fixed;
width: 343px;
left: 50%;
bottom: 16px;
transform: translateX(-50%);
height: 42px;
font-size: 14px;
border-radius: 21px;
box-sizing: border-box;
}
}
</style> </style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<div class="layout"> <div class="layout">
<search-box></search-box> <search-box
<tab @change="changeType"
:data="tab" @search="search"
@change="change" ></search-box>
/> <template v-if="type == 0">
<scroll-view class="list-box"> <tab
<template v-for="(i,index) in 10"> :list="tab"
<div @change="change"
:key="index" :updata="updata"
class="item" />
</template>
<template v-if="flag">
<template v-if="list.length">
<scroll-view
:class="['list-box',{'type':type == 1}]"
@ReachBottom="onReachBottom"
ref="scrollView"
> >
{{i}} <template v-for="(item,index) in list">
</div> <div
:key="index"
class="item"
>
<div class="title flex">
{{item.userName}}
<div class="time">
<template v-if="tabIndex == 0">
核销时间: {{new Date(item.verificationTime).format('yyyy/MM/dd')}}
</template>
<template v-else-if="tabIndex == 1">
领取时间:{{new Date(item.receiveTime).format('yyyy/MM/dd')}}
</template>
<template v-else>
发放时间:{{new Date(item.issueDate).format('yyyy/MM/dd')}}
</template>
</div>
</div>
<div class="info">
<template v-for="(i,ind) in itemObj">
<div
:key="ind"
class="li flex"
>
<div class="label">{{i.label}}</div>
<div
class="value flex"
v-html="i.format?i.format(item):item[i.key]"
>
</div>
</div>
</template>
<template v-if="type == 0">
<div :class="['sprite-icon','coupon-icon',`icon-coupon-${item.discountType== 4?1:0}`]"></div>
</template>
<template v-else>
<div :class="['sprite-icon','coupon-icon',`icon-coupon-success`]"></div>
</template>
</div>
</div>
</template>
</scroll-view>
</template> </template>
</scroll-view> <template v-else>
<van-empty description="暂无内容" />
</template>
</template>
<div
class="scan flex"
v-if="type == 0"
@click="scan"
>
<div class="sprite-icon icon-scan"></div>
扫码核销
</div>
</div> </div>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import Tab from '../../components/Tab.vue' import { couponApi, wxConfig } from '@/api'
const itemObj = [
{
label: '券名',
key: 'couponName'
},
{
label: '发放人',
key: 'issueName',
// format () {
// return '<span class=\"text-hide w84\">好借好还好借好还好借好还</span><b class=\"line\"></b><span class=\"text-hide w66\">恒河猴</span>'
// }
},
{
label: '核销人',
key: 'verificationOperator',
}
]
export default { export default {
components: { Tab },
name: '', name: '',
data () { data () {
return { return {
tab: ['已核销(0)', '待核销(0)', '未领取(0)'] tab: ['', '', ''],
list: [],
updata: new Date().getTime(),
tabIndex: 0,
type: 0,
pageNum: 1,
itemObj,
total: 0,
flag: false,
userName: ''
} }
}, },
mounted () { mounted () {
console.log('list') this.getTabNum()
window.$wx = wxConfig
window.$wx.init(['scanQRCode'])
}, },
methods: { methods: {
change () { getTabNum () {
this.showLoading()
this.getVerificationList()
this.getUserCouponList(0, false)
this.getUserCouponList(1, false)
},
search (e) {
this.userName = e
this.clearData()
},
change (e) {
this.showLoading()
this.tabIndex = e
this.clearData()
},
changeType (e) {
this.showLoading()
this.type = e
this.clearData()
},
clearData () {
this.list = []
this.flag = false
this.pageNum = 1
if (this.$refs.scrollView) this.$refs.scrollView.finished = false
this.getList()
},
getList () {
let { tabIndex, type } = this
if (type == 0) {
if (tabIndex == 0) this.getVerificationList()
else this.getUserCouponList(tabIndex == 1 ? 1 : 0)
} else {
}
},
getVerificationList () {
let { list, userName, pageNum } = this
couponApi.getVerificationList({ pageNum, userName }).then(res => {
this.list = list.concat(res.list)
this.tab[0] = `已核销(${res.total})`
this.updata = new Date().getTime()
this.itemObj = this.tools.deepClone(itemObj)
this.total = res.total
this.flag = true
this.hideLoading()
})
},
getUserCouponList (userStatus, setData = true) {
let { list, userName, pageNum } = this
couponApi.getUserCouponList({ pageNum, userName, userStatus }).then(res => {
console.log(userStatus, res)
if (setData) {
this.list = list.concat(res.list)
this.itemObj = this.tools.deepClone(itemObj).splice(0, 2)
this.flag = true
this.hideLoading()
}
if (userStatus == 0) {
this.tab[2] = `未领取(${res.total})`
} else {
this.tab[1] = `待核销(${res.total})`
}
this.total = res.total
this.updata = new Date().getTime()
})
},
onReachBottom () {
let { total, pageNum, list } = this
this.$refs.scrollView.loading = false
if (list.length == total) {
this.$refs.scrollView.finished = true
return
}
if (Math.ceil(total / 10) > pageNum) {
this.pageNum = pageNum + 1
this.getList()
} else {
this.$refs.scrollView.finished = true
}
},
scan () {
window.$wx.scanQRCode(1).then(({ resultStr }) => {
this.$router.push({
name: 'coupon.verificationDetail', params: {
verficationCode: resultStr
}
})
})
} }
} }
} }
...@@ -42,8 +218,80 @@ export default { ...@@ -42,8 +218,80 @@ export default {
<style scoped lang='scss'> <style scoped lang='scss'>
.list-box { .list-box {
height: calc(100vh - 100px); height: calc(100vh - 100px);
.item {
background: #ffffff;
box-shadow: 0px 4px 8px 0px rgba(224, 224, 224, 0.5);
border-radius: 4px;
margin-bottom: 10px;
.title {
padding: 0 16px;
font-size: 16px;
font-weight: 600;
color: #333333;
height: 47px;
border-bottom: 1px solid rgba(195, 195, 195, 0.3);
.time {
font-weight: 500;
font-size: 12px;
color: #999999;
margin-left: auto;
}
}
.info {
position: relative;
padding: 10px 16px 6px;
.li {
font-size: 12px;
margin-bottom: 10px;
color: #999999;
line-height: 17px;
.label {
width: 68px;
}
.value {
width: 159px;
/deep/ .line {
width: 1px;
height: 18px;
opacity: 0.3;
background-color: #c3c3c3;
margin: 0 4px;
}
/deep/ .w84 {
width: 84px;
}
/deep/ .w66 {
width: 66px;
}
}
}
.coupon-icon {
position: absolute;
top: 10px;
right: 16px;
}
}
}
} }
.item {
height: 100px; .type {
height: calc(100vh - 50px);
}
.scan {
position: fixed;
bottom: 40px;
left: 50%;
transform: translateX(-50%);
width: 175px;
height: 36px;
background: #5850ff;
box-shadow: 0px 2px 4px 0px rgba(88, 80, 255, 0.3);
border-radius: 21px;
color: #fff;
font-size: 14px;
justify-content: center;
.sprite-icon {
margin-right: 8px;
}
} }
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -2,67 +2,77 @@ ...@@ -2,67 +2,77 @@
<div> <div>
<template v-if="$route.meta.isTab"> <template v-if="$route.meta.isTab">
<tab <tab
:data="['会员套餐','门店商品']" :list="['会员套餐','门店商品']"
@change="change" @change="change"
sticky sticky
:index="tabIndex" :index="tabIndex"
></tab> ></tab>
<scroll-view :class="['list-box']"> <template v-if="flag">
<div :class="[`type-${tabIndex}`]"> <template v-if="list.length">
<template v-if="flag"> <scroll-view
<template v-for="(i,index) in list"> class="list-box"
<div @ReachBottom="onReachBottom"
:key="index" ref="scrollView"
class="item" >
> <div :class="[`type-${tabIndex}`]">
<template v-if="tabIndex == 0"> <template v-for="(i,index) in list">
<div class="sprite-icon icon-vip"> <div
:key="index"
</div> class="item"
<div class="info"> >
<div> <template v-if="tabIndex == 0">
<div class="title text-hide">高级会员套餐</div> <div class="sprite-icon icon-vip"></div>
<div class="decoration">价值99,999元的100项权益</div> <div class="info">
<div>
<div class="title text-hide">{{i.packageName}}</div>
<div class="decoration">价值{{i.packagePrice}}元的{{i.list.length || 0}}项权益</div>
</div>
<div
class="btn text-center"
@click="showVipDialog(i)"
>
查看套餐
</div>
</div> </div>
<div <div
class="btn text-center" class="btn text-center y-center"
@click="showVip = true" @click="showShareModel(i)"
> >分享给客户</div>
查看套餐 </template>
<template v-else>
<div class="icon">
<img :src="i.goodsImage || ''">
</div>
<div class="info">
<div class="name text-two-line">{{i.goodsName}}</div>
<template v-if="i.price">
<div class="price">¥{{i.price.toFixed(2)}}</div>
</template>
</div> </div>
</div> <div
<div class="sprite-icon icon-share"
class="btn text-center y-center" @click="showShareModel(i)"
@click="showShare = true" ></div>
>分享给客户</div> </template>
</template> </div>
<template v-else> </template>
<div class="icon"> </div>
<img :src="i.goodsImage || ''"> </scroll-view>
</div> </template>
<div class="info"> <template v-else>
<div class="name text-two-line">{{i.goodsName}}</div> <van-empty description="暂无内容" />
<div class="price">¥{{i.price.toFixed(2)}}</div> </template>
</div> </template>
<div
class="sprite-icon icon-share"
@click="showShareModel(i)"
></div>
</template>
</div>
</template>
</template>
</div>
</scroll-view>
<share <share
:value="showShare" :value="showShare"
:apiName="tabIndex == 0 ?'':'shopmallApi'" :apiName="tabIndex == 0 ?'equityApi':'shopmallApi'"
@cancel="showShare = false" @cancel="showShare = false"
:currentItem="currentItem" :currentItem="currentItem"
/> />
<vip-dialog <vip-dialog
v-model="showVip" v-model="showVip"
@cancel="showVip = false" @cancel="showVip = false"
:id="equity_id"
></vip-dialog> ></vip-dialog>
</template> </template>
<template v-else> <template v-else>
...@@ -72,46 +82,46 @@ ...@@ -72,46 +82,46 @@
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import { shopmallApi, wx_config } from '@/api' import { shareMixin, pageMixin } from '@/mixins'
import { shopmallApi, equityApi } from '@/api'
export default { export default {
name: '', name: '',
mixins: [shareMixin, pageMixin],
data () { data () {
return { return {
tabIndex: 1,
list: new Array(11),
showVip: false, showVip: false,
flag: false, equity_id: null
showShare: false,
currentItem: {}
} }
}, },
mounted () { mounted () {
window.$wx = new wx_config(['shareToExternalContact', 'sendChatMessage', 'shareAppMessage'])
this.getGoodsList()
}, },
activated () { activated () {
console.log('店铺')
}, },
deactivated () { deactivated () {
console.log('离开店铺页')
}, },
methods: { methods: {
getGoodsList () { getList_0 (pageNum) {
shopmallApi.getGoodsList({ currentPage: 1 }).then(({ total, list }) => { let { list } = this
this.list = list equityApi.getEquityList({ pageNum }).then(res => {
this.flag = true this.flag = true
this.list = list.concat(res.list)
this.total = res.total
this.hideLoading()
}) })
}, },
change (index) { getList_1 (pageNum) {
this.tabIndex = index let { list } = this
this.list = [] shopmallApi.getGoodsList({ currentPage: pageNum }).then(res => {
index == 1 ? this.getGoodsList() : '' this.flag = true
this.list = list.concat(res.list)
this.total = res.total
this.hideLoading()
})
}, },
showShareModel (i) { showVipDialog (i) {
this.showShare = true this.showVip = true
this.currentItem = i this.equity_id = i.id
} }
} }
} }
</script> </script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!