Commit b954d408 by 杨北旺

Merge branch 'v1.0.0' of 192.168.3.233:saas/mini-program/hmd into v1.0.0

2 parents 540165b8 e2af65e1
...@@ -114,4 +114,13 @@ module.exports = { ...@@ -114,4 +114,13 @@ module.exports = {
...data ...data
}) })
}, },
/** 小程序端根据优惠券id查询可使用商品列表(分页) */
getCouponGoodsPage(data) {
data.pageSize = 8
return api.post({
method: 'scrm.app.shopmall.coupon.goods.page',
...data
})
},
} }
\ No newline at end of file \ No newline at end of file
...@@ -9,6 +9,8 @@ import { getUpdateManager } from "./lib/index"; ...@@ -9,6 +9,8 @@ import { getUpdateManager } from "./lib/index";
import utils from "./utils/index"; import utils from "./utils/index";
// 埋点 有需要再引入 // 埋点 有需要再引入
// import './utils/track/Track' // import './utils/track/Track'
/**分享 */
import './utils/share'
App({ App({
onLaunch(options) { onLaunch(options) {
getUpdateManager(); getUpdateManager();
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<block wx:if="{{noData}}"> <block wx:if="{{noData}}">
<view class="coupon-wrap" wx:for="{{couponData}}" wx:key="index"> <view class="coupon-wrap" wx:for="{{couponData}}" wx:key="index">
<view class="left_icon_box"> <view class="left_icon_box">
<image webp wx:if="{{true}}" class="left_bg" src="{{IMGURL}}coupons/coupons_active.png?v={{img_version}}" /> <glsx-image webp wx:if="{{true}}" class="left_bg" src="coupons/coupons_active.png" />
<image webp wx:else class="left_bg" src="{{IMGURL}}coupons/coupons.png?v={{img_version}}" /> <glsx-image webp wx:else class="left_bg" src="coupons/coupons.png" />
<view class="left_text_one left_text_two"> <view class="left_text_one left_text_two">
<text class="price_icon">¥</text> <text class="price_icon">¥</text>
<text>{{(item.denomination)/100}}</text> <text>{{(item.denomination)/100}}</text>
...@@ -33,12 +33,12 @@ ...@@ -33,12 +33,12 @@
<view class="box_btn_color_been_gray " bind:tap="toDetail" wx:elif="{{item.couponStatus != 1&&item.residueAmount ==0}}">已抢光</view> <view class="box_btn_color_been_gray " bind:tap="toDetail" wx:elif="{{item.couponStatus != 1&&item.residueAmount ==0}}">已抢光</view>
<view class="box_btn_color_been" bind:tap="toDetail" wx:elif="{{item.couponStatus == 1}}">已领取</view> <view class="box_btn_color_been" bind:tap="toDetail" wx:elif="{{item.couponStatus == 1}}">已领取</view>
<view class="already" wx:if="{{item.couponStatus == 1}}"> <view class="already" wx:if="{{item.couponStatus == 1}}">
<image webp src="{{IMGURL}}coupons/been.png?v={{img_version}}" /> <glsx-image webp src="coupons/been.png" />
</view> </view>
</block> </block>
<block wx:else> <block wx:else>
<view class="circle-selected" data-item="{{item}}" data-index="{{index}}" wx:if="{{item.isChecked}}" bindtap="selectCoupon"> <view class="circle-selected" data-item="{{item}}" data-index="{{index}}" wx:if="{{item.isChecked}}" bindtap="selectCoupon">
<image webp src="{{IMGURL}}coupons/select.png?v={{img_version}}" /> <glsx-image webp src="coupons/select.png" />
</view> </view>
<view class="noSelect" data-item="{{item}}" data-index="{{index}}" wx:if="{{!item.isChecked}}" bindtap="selectCoupon"></view> <view class="noSelect" data-item="{{item}}" data-index="{{index}}" wx:if="{{!item.isChecked}}" bindtap="selectCoupon"></view>
</block> </block>
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
</view> </view>
</view> </view>
<view wx:if="{{!noData}}" class="no_data"> <view wx:if="{{!noData}}" class="no_data">
<image webp class="nodata_bg" src="{{IMGURL}}coupons/no_card_bg.png?v={{img_version}}" /> <glsx-image webp class="nodata_bg" src="coupons/no_card_bg.png" />
<view class="nodata_text">暂无优惠券</view> <view class="nodata_text">暂无优惠券</view>
</view> </view>
</popup> </popup>
\ No newline at end of file \ No newline at end of file
...@@ -263,16 +263,11 @@ Page({ ...@@ -263,16 +263,11 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
if (this.data.id) {
this.getGoodsDetail(this.data.id)
} else {
/**扫码、分享、直播间 */
if (options && options.id) { if (options && options.id) {
this.setData(options) this.setData(options)
this.getGoodsDetail(options.id) this.getGoodsDetail(options.id)
if (!options.isActivity) this.getGoodscouponList(options.id) if (!options.isActivity) this.getGoodscouponList(options.id)
} }
}
// 推荐人+推荐人埋点 // 推荐人+推荐人埋点
if (options.shareStaffUuid) { if (options.shareStaffUuid) {
let shareStaff = { let shareStaff = {
...@@ -313,6 +308,20 @@ Page({ ...@@ -313,6 +308,20 @@ Page({
goodsId: data.id goodsId: data.id
} }
// wx.$Track.setTrack(trackobj, 6) // wx.$Track.setTrack(trackobj, 6)
//设置分享
let shareQuery = `id=${data.id}`,
shareTitle = data.goodsName,
shareImage = ''
data.goodsDetailImageList.map(e => {
if (e.resType == 1) shareImage = e.content
})
if (isActivity) {
shareTitle = data.activityName
shareQuery += '&isActivity=true'
}
this.shareQuery = shareQuery
this.shareTitle = shareTitle
this.shareImage = shareImage
let activeSku = null let activeSku = null
if (data.expressFee != null) data.expressFee = centsToyuan(data.expressFee) if (data.expressFee != null) data.expressFee = centsToyuan(data.expressFee)
if (isActivity) { if (isActivity) {
...@@ -507,37 +516,10 @@ Page({ ...@@ -507,37 +516,10 @@ Page({
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () {}, onReachBottom: function () {},
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () { onShareAppMessage: function () {},
const {
merchantId
} = wx.p.storage.get('merchant_info')
let {
isActivity,
isLive,
goodsInfo
} = this.data
let title = goodsInfo.goodsName
let path = `${this.route}?id=${goodsInfo.id}`
let imageUrl = ''
goodsInfo.goodsDetailImageList.map(e => {
if (e.resType == 1 && !imageUrl) imageUrl = e.content
})
if (isActivity) {
title = goodsInfo.activityName
path = `${path}&isActivity=true`
}
if (isLive) path = `${path}&isLive=true`
if (merchantId) path = `${path}&merchantId=${merchantId}`
return {
imageUrl,
title,
path
}
},
countDown(params) { countDown(params) {
let { let {
activityStatus activityStatus
......
// packageMall/pages/pay/pay.js // packageMall/pages/pay/pay.js
let timer
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
...@@ -322,19 +321,17 @@ Page({ ...@@ -322,19 +321,17 @@ Page({
} }
} }
} }
// 添加推荐人 // // 添加推荐人
const staff = wx.p.storage.get('shareStaff') // const staff = wx.p.storage.get('shareStaff')
if (staff) { // if (staff) {
let tem = JSON.parse(staff) // let tem = JSON.parse(staff)
orderParams.shareStaffUuid = tem.shareStaffUuid // orderParams.shareStaffUuid = tem.shareStaffUuid
orderParams.shareStaffName = tem.shareStaffName // orderParams.shareStaffName = tem.shareStaffName
} // }
clearTimeout(timer) wx.p.wxApi.showLoading()
timer = setTimeout(() => { wx.p.api.shopmallApi.createOrder(orderParams).then(data => {
wx.p.api.shopmallApi.createOrder(orderParams).then(data => { this.pay(data.orderCode)
this.pay(data.orderCode) })
})
}, 500)
} }
} catch (error) { } catch (error) {
wx.hideLoading() wx.hideLoading()
......
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
<!-- 支付成功 --> <!-- 支付成功 -->
<view wx:if="{{showSuccessModal}}" class="modal-container flex_ccc"> <view wx:if="{{showSuccessModal}}" class="modal-container flex_ccc">
<view class="modal-body"> <view class="modal-body">
<image webp src="{{IMGURL}}equity/return_success.png?v={{img_version}}" class="icon"></image> <glsx-image webp src="equity/return_success.png" class="icon"></glsx-image>
<view class="text">支付成功</view> <view class="text">支付成功</view>
<view class="btn flex_ccc" catch:tap="closeSuccessModal">我知道了</view> <view class="btn flex_ccc" catch:tap="closeSuccessModal">我知道了</view>
</view> </view>
......
...@@ -43,7 +43,7 @@ Component({ ...@@ -43,7 +43,7 @@ Component({
xx: 'xx' xx: 'xx'
} }
if (discountType == 2 || discountType == 4) { if (discountType == 2 || discountType == 4) {
wx.$router.go('/packageMall/pages/coupon/coupon', { wx.p.router.go('/packageMall/pages/coupon/coupon', {
userCouponId: id, userCouponId: id,
useMemberType, useMemberType,
detailInfo detailInfo
...@@ -52,12 +52,12 @@ Component({ ...@@ -52,12 +52,12 @@ Component({
} }
/**线上商品代金券 */ /**线上商品代金券 */
if (discountType == 3 && useChannel == 1) { if (discountType == 3 && useChannel == 1) {
wx.$router.go('/packageMine/pages/coupon/recommend/recommend', { wx.p.router.go('/packageMine/pages/coupon/recommend/recommend', {
couponInfo: coupons couponInfo: coupons
}) })
return return
} }
wx.$router.go('/packageMine/pages/coupon/detail/detail', { wx.p.router.go('/packageMine/pages/coupon/detail/detail', {
item: coupons item: coupons
}) })
} }
......
<!-- <view class="box_wrapper" style="{{couponStyle}}; background-image: url({{btnStatus == 0 ? couponBaseList[coupons.discountType]:unCouponBaseList[coupons.discountType]}});"> --> <!-- <view class="box_wrapper" style="{{couponStyle}}; background-image: url({{btnStatus == 0 ? couponBaseList[coupons.discountType]:unCouponBaseList[coupons.discountType]}});"> -->
<view class="box_wrapper" style="{{couponStyle}}"> <view class="box_wrapper" style="{{couponStyle}}">
<view class="bg"> <view class="bg">
<image webp src="{{IMGURL}}mine/coupon/{{btnStatus == 0 ? '' :'un-'}}coupon-{{coupons.discountType}}.png?v={{img_version}}"></image> <glsx-image webp src="mine/coupon/{{btnStatus == 0 ? '' :'un-'}}coupon-{{coupons.discountType}}.png"></glsx-image>
</view> </view>
<view class="container"> <view class="container">
<view class="{{coupons.discountType==4 || coupons.discountType==7 ? '':'left_icon_box'}}"> <view class="{{coupons.discountType==4 || coupons.discountType==7 ? '':'left_icon_box'}}">
......
...@@ -121,7 +121,7 @@ Page({ ...@@ -121,7 +121,7 @@ Page({
*/ */
onReachBottom: function () { onReachBottom: function () {
let { pageNum, total } = this.data let { pageNum, total } = this.data
wx.p.wxApi.onReachBottom( wx.p.util.onReachBottom(
{ {
pageNum, pageNum,
total total
......
...@@ -27,7 +27,6 @@ Page({ ...@@ -27,7 +27,6 @@ Page({
} = this.data } = this.data
if (userInfo) { if (userInfo) {
this.getOrderNumberList() this.getOrderNumberList()
this.toCheckMember()
this.getMemberCardData() this.getMemberCardData()
} }
}, },
...@@ -91,12 +90,19 @@ Page({ ...@@ -91,12 +90,19 @@ Page({
let para = { let para = {
merchantId merchantId
} }
wx.p.wxApi.equityApi.memberCard(para).then(res => { wx.p.api.equityApi.memberCard(para).then(res => {
this.setData({ this.setData({
memberInfo: res memberInfo: res
}) })
}) })
}, },
goInterests(){
wx.p.router.switchTab('/pages/tab/equity/index')
},
// 开通会员页面
toBuyMember() {
wx.p.router.go('/packageEquity/pages/open/open')
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
...@@ -108,7 +114,7 @@ Page({ ...@@ -108,7 +114,7 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow() {
this.toCheckMember()
}, },
/** /**
......
...@@ -39,31 +39,32 @@ ...@@ -39,31 +39,32 @@
</view> </view>
</view> </view>
<!-- 会员卡 --> <!-- 会员卡 -->
<view class="member-box"> <block wx:if="{{memberInfo}}">
<view class="left-box"> <view class="member-box">
<view class="member-icon"> <view class="left-box">
<glsx-image webp src="mine/member.png"></glsx-image> <view class="member-icon">
</view> <glsx-image webp src="mine/member.png"></glsx-image>
<view class="left-content"> </view>
<view class="card">会员权益卡</view> <view class="left-content">
<!-- <view class="card">{{memberInfo.equityName}}</view> --> <view class="card">{{memberInfo.equityName}}</view>
<view class="describe" wx:if="{{!isMember}}">生活权益|专享超百项生活权益</view> <view class="describe" wx:if="{{!isMember}}">生活权益|专享超百项生活权益</view>
<view class="describe" wx:else>{{vipInfo.time}} 到期</view> <view class="describe" wx:else>{{vipInfo.time}} 到期</view>
</view>
</view>
<block wx:if="{{!isMember}}">
<view class="member-button" bindtap="toBuyMember">开通会员</view>
<view class="member-price" bindtap="toBuyMember" wx:if="{{memberInfo.goodPrice}}">特惠¥{{memberInfo.goodPrice}}起</view>
</block>
<block wx:else>
<view class="goUseBox" bindtap="goInterests">
去使用
<view class="goUseBox-icon">
<glsx-image webp src="mine/goUse.png"></glsx-image>
</view> </view>
</view> </view>
</block> <block wx:if="{{!isMember}}">
</view> <view class="member-button" bindtap="toBuyMember">开通会员</view>
<view class="member-price" bindtap="toBuyMember" wx:if="{{memberInfo.goodPrice}}">特惠¥{{memberInfo.goodPrice}}起</view>
</block>
<block wx:else>
<view class="goUseBox" bindtap="goInterests">
去使用
<view class="goUseBox-icon">
<glsx-image webp src="mine/goUse.png"></glsx-image>
</view>
</view>
</block>
</view>
</block>
<!-- 我的券包 --> <!-- 我的券包 -->
<view class="coupon-box box flex" bindtap="jump" data-url="/packageMine/pages/coupon/index/index"> <view class="coupon-box box flex" bindtap="jump" data-url="/packageMine/pages/coupon/index/index">
我的卡券 我的卡券
......
...@@ -57,5 +57,6 @@ ...@@ -57,5 +57,6 @@
], ],
"include": [] "include": []
}, },
"appid": "wxfe82b8d65d07808f" "appid": "wx6e40cfb83ce4ffb1",
"projectname": "hmd"
} }
\ No newline at end of file \ No newline at end of file
...@@ -10,7 +10,8 @@ export const STORAGE_OBJECTkEY = { ...@@ -10,7 +10,8 @@ export const STORAGE_OBJECTkEY = {
userInfo: 'userInfo', userInfo: 'userInfo',
sessionId: 'sessionId', sessionId: 'sessionId',
bindInfo:'bindInfo', bindInfo:'bindInfo',
unauthorized:'unauthorized' unauthorized:'unauthorized',
wx_user_info:'wx_user_info'
} }
export default{ export default{
......
...@@ -9,12 +9,11 @@ ...@@ -9,12 +9,11 @@
* @param {*} onViewTrack 开启浏览埋点 * @param {*} onViewTrack 开启浏览埋点
* @returns * @returns
*/ */
import { reportData } from '~/api/index.js' // import { reportData } from '~/api/index.js'
import USERAPI from '~/api/usersApi/index'
class Share { class Share {
constructor() { constructor() {
// console.log('---------------- 分享初始化 ----------------') console.log('---------------- 分享初始化 ----------------')
this.initPageProxy() this.initPageProxy()
} }
/**全局注册事件 */ /**全局注册事件 */
...@@ -43,9 +42,14 @@ class Share { ...@@ -43,9 +42,14 @@ class Share {
path += that.setCommonShareQuery() path += that.setCommonShareQuery()
if (shareQuery) path += `&${shareQuery}` if (shareQuery) path += `&${shareQuery}`
console.log('===============', path) console.log('===============', path)
if (!noPageAuth) path = `/login/loading/loading?url=${encodeURIComponent(path)}` if (!noPageAuth) path = `/pages/loading/loading?url=${encodeURIComponent(path)}`
if (shareFun) shareFun() if (shareFun) shareFun()
if (shareTrackData) that.reportShareData(shareTrackData) // if (shareTrackData) that.reportShareData(shareTrackData)
console.table( {
path,
title: shareTitle,
imageUrl: shareImage
})
return { return {
path, path,
title: shareTitle, title: shareTitle,
...@@ -57,7 +61,7 @@ class Share { ...@@ -57,7 +61,7 @@ class Share {
page.onShareTimeline = function () { page.onShareTimeline = function () {
let { shareTitle, shareImage, shareQuery, shareFun, shareTrackData } = this let { shareTitle, shareImage, shareQuery, shareFun, shareTrackData } = this
if (shareFun) shareFun() if (shareFun) shareFun()
if (shareTrackData) that.reportShareData(shareTrackData) // if (shareTrackData) that.reportShareData(shareTrackData)
shareQuery = that.setCommonShareQuery(shareQuery) shareQuery = that.setCommonShareQuery(shareQuery)
console.log(shareQuery) console.log(shareQuery)
return { return {
...@@ -70,21 +74,21 @@ class Share { ...@@ -70,21 +74,21 @@ class Share {
page.onLoad = async function () { page.onLoad = async function () {
onLoad && onLoad.apply(this, arguments) onLoad && onLoad.apply(this, arguments)
if (this.onViewTrack) { if (this.onViewTrack) {
const WXUSERINFO = await USERAPI.getWXUserInfo(), // const WXUSERINFO = await USERAPI.getWXUserInfo(),
{ USERINFO } = that.getCommonData(), // { USERINFO } = that.getCommonData(),
shareInfo = this.options // shareInfo = this.options
if (shareInfo.shareOpenId) // if (shareInfo.shareOpenId)
reportData( // reportData(
{ // {
openId: WXUSERINFO.openId || '', // openId: WXUSERINFO.openId || '',
unionId: WXUSERINFO.unionId || '', // unionId: WXUSERINFO.unionId || '',
nickName: WXUSERINFO.nickName || '', // nickName: WXUSERINFO.nickName || '',
avatar: WXUSERINFO.avatarUrl || '', // avatar: WXUSERINFO.avatarUrl || '',
phone: WXUSERINFO.phone || USERINFO.phone || '', // phone: WXUSERINFO.phone || USERINFO.phone || '',
...shareInfo // ...shareInfo
}, // },
1 // 1
) // )
} }
} }
} }
...@@ -118,4 +122,4 @@ class Share { ...@@ -118,4 +122,4 @@ class Share {
}) })
} }
} }
new Share() export default new Share()
...@@ -22,8 +22,13 @@ Date.prototype.format = function (fmt) { ...@@ -22,8 +22,13 @@ Date.prototype.format = function (fmt) {
/**触底加载 */ /**触底加载 */
const onReachBottom = (obj, callBack) => { const onReachBottom = (obj, callBack) => {
let _this = $router.getPageInstance() let _this = obj._this || wx.p.router.getPageInstance()
let { pageNum, total, pageSize, nothing } = obj let {
pageNum,
total,
pageSize,
nothing
} = obj
if (!total && !pageNum) { if (!total && !pageNum) {
console.error('total&&pageNum为必传') console.error('total&&pageNum为必传')
return return
...@@ -42,35 +47,6 @@ const onReachBottom = (obj, callBack) => { ...@@ -42,35 +47,6 @@ const onReachBottom = (obj, callBack) => {
} }
} }
/**是否全面屏 */
const isFullSucreen = isComponents => {
const thisPage = $router.getPageInstance()
const routerList = $router.getRouterList()
const router = routerList.find(item => item.url === `/${thisPage.route}`)
let key = `${router.url.replace('/', '')}.html`
let val = false
if (__wxConfig && __wxConfig.page && __wxConfig.page[key]) {
let { navigationStyle } = __wxConfig.page[key].window
wx.getSystemInfo({
success(res) {
if (res.platform != 'android') {
let { statusBarHeight, screenHeight, windowHeight } = res
if (navigationStyle && navigationStyle == 'custom') {
windowHeight = windowHeight - thisPage.data.navHeight || 0
}
//兼容自定义标题
val = router.isTab ? screenHeight - windowHeight - statusBarHeight - 32 > 72 : screenHeight - windowHeight > 72
if (isComponents) val = screenHeight - windowHeight > 72
}
},
fail(err) {
return false
}
})
}
return val
}
/**节流 */ /**节流 */
const throttle = (fn, gapTime) => { const throttle = (fn, gapTime) => {
...@@ -128,10 +104,9 @@ const parseString = str => { ...@@ -128,10 +104,9 @@ const parseString = str => {
const Util = { const Util = {
onReachBottom, onReachBottom,
isFullSucreen,
clearObjNull, clearObjNull,
throttle, throttle,
isEmptyObj, isEmptyObj,
parseString, parseString,
} }
export default Util export default Util
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!