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 = {
...data
})
},
/** 小程序端根据优惠券id查询可使用商品列表(分页) */
getCouponGoodsPage(data) {
data.pageSize = 8
return api.post({
method: 'scrm.app.shopmall.coupon.goods.page',
...data
})
},
}
\ No newline at end of file
......@@ -9,6 +9,8 @@ import { getUpdateManager } from "./lib/index";
import utils from "./utils/index";
// 埋点 有需要再引入
// import './utils/track/Track'
/**分享 */
import './utils/share'
App({
onLaunch(options) {
getUpdateManager();
......
......@@ -6,8 +6,8 @@
<block wx:if="{{noData}}">
<view class="coupon-wrap" wx:for="{{couponData}}" wx:key="index">
<view class="left_icon_box">
<image webp wx:if="{{true}}" class="left_bg" src="{{IMGURL}}coupons/coupons_active.png?v={{img_version}}" />
<image webp wx:else class="left_bg" src="{{IMGURL}}coupons/coupons.png?v={{img_version}}" />
<glsx-image webp wx:if="{{true}}" class="left_bg" src="coupons/coupons_active.png" />
<glsx-image webp wx:else class="left_bg" src="coupons/coupons.png" />
<view class="left_text_one left_text_two">
<text class="price_icon">¥</text>
<text>{{(item.denomination)/100}}</text>
......@@ -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" bind:tap="toDetail" wx:elif="{{item.couponStatus == 1}}">已领取</view>
<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>
</block>
<block wx:else>
<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 class="noSelect" data-item="{{item}}" data-index="{{index}}" wx:if="{{!item.isChecked}}" bindtap="selectCoupon"></view>
</block>
......@@ -73,7 +73,7 @@
</view>
</view>
<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>
</popup>
\ No newline at end of file
......@@ -263,16 +263,11 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if (this.data.id) {
this.getGoodsDetail(this.data.id)
} else {
/**扫码、分享、直播间 */
if (options && options.id) {
this.setData(options)
this.getGoodsDetail(options.id)
if (!options.isActivity) this.getGoodscouponList(options.id)
}
}
// 推荐人+推荐人埋点
if (options.shareStaffUuid) {
let shareStaff = {
......@@ -313,6 +308,20 @@ Page({
goodsId: data.id
}
// 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
if (data.expressFee != null) data.expressFee = centsToyuan(data.expressFee)
if (isActivity) {
......@@ -507,37 +516,10 @@ Page({
* 页面上拉触底事件的处理函数
*/
onReachBottom: 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
}
},
onShareAppMessage: function () {},
countDown(params) {
let {
activityStatus
......
// packageMall/pages/pay/pay.js
let timer
Page({
/**
* 页面的初始数据
......@@ -322,19 +321,17 @@ Page({
}
}
}
// 添加推荐人
const staff = wx.p.storage.get('shareStaff')
if (staff) {
let tem = JSON.parse(staff)
orderParams.shareStaffUuid = tem.shareStaffUuid
orderParams.shareStaffName = tem.shareStaffName
}
clearTimeout(timer)
timer = setTimeout(() => {
wx.p.api.shopmallApi.createOrder(orderParams).then(data => {
this.pay(data.orderCode)
})
}, 500)
// // 添加推荐人
// const staff = wx.p.storage.get('shareStaff')
// if (staff) {
// let tem = JSON.parse(staff)
// orderParams.shareStaffUuid = tem.shareStaffUuid
// orderParams.shareStaffName = tem.shareStaffName
// }
wx.p.wxApi.showLoading()
wx.p.api.shopmallApi.createOrder(orderParams).then(data => {
this.pay(data.orderCode)
})
}
} catch (error) {
wx.hideLoading()
......
......@@ -103,7 +103,7 @@
<!-- 支付成功 -->
<view wx:if="{{showSuccessModal}}" class="modal-container flex_ccc">
<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="btn flex_ccc" catch:tap="closeSuccessModal">我知道了</view>
</view>
......
......@@ -43,7 +43,7 @@ Component({
xx: 'xx'
}
if (discountType == 2 || discountType == 4) {
wx.$router.go('/packageMall/pages/coupon/coupon', {
wx.p.router.go('/packageMall/pages/coupon/coupon', {
userCouponId: id,
useMemberType,
detailInfo
......@@ -52,12 +52,12 @@ Component({
}
/**线上商品代金券 */
if (discountType == 3 && useChannel == 1) {
wx.$router.go('/packageMine/pages/coupon/recommend/recommend', {
wx.p.router.go('/packageMine/pages/coupon/recommend/recommend', {
couponInfo: coupons
})
return
}
wx.$router.go('/packageMine/pages/coupon/detail/detail', {
wx.p.router.go('/packageMine/pages/coupon/detail/detail', {
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}}">
<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 class="container">
<view class="{{coupons.discountType==4 || coupons.discountType==7 ? '':'left_icon_box'}}">
......
......@@ -121,7 +121,7 @@ Page({
*/
onReachBottom: function () {
let { pageNum, total } = this.data
wx.p.wxApi.onReachBottom(
wx.p.util.onReachBottom(
{
pageNum,
total
......
......@@ -27,7 +27,6 @@ Page({
} = this.data
if (userInfo) {
this.getOrderNumberList()
this.toCheckMember()
this.getMemberCardData()
}
},
......@@ -91,12 +90,19 @@ Page({
let para = {
merchantId
}
wx.p.wxApi.equityApi.memberCard(para).then(res => {
wx.p.api.equityApi.memberCard(para).then(res => {
this.setData({
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({
* 生命周期函数--监听页面显示
*/
onShow() {
this.toCheckMember()
},
/**
......
......@@ -39,31 +39,32 @@
</view>
</view>
<!-- 会员卡 -->
<view class="member-box">
<view class="left-box">
<view class="member-icon">
<glsx-image webp src="mine/member.png"></glsx-image>
</view>
<view class="left-content">
<view class="card">会员权益卡</view>
<!-- <view class="card">{{memberInfo.equityName}}</view> -->
<view class="describe" wx:if="{{!isMember}}">生活权益|专享超百项生活权益</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>
<block wx:if="{{memberInfo}}">
<view class="member-box">
<view class="left-box">
<view class="member-icon">
<glsx-image webp src="mine/member.png"></glsx-image>
</view>
<view class="left-content">
<view class="card">{{memberInfo.equityName}}</view>
<view class="describe" wx:if="{{!isMember}}">生活权益|专享超百项生活权益</view>
<view class="describe" wx:else>{{vipInfo.time}} 到期</view>
</view>
</view>
</block>
</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>
</block>
</view>
</block>
<!-- 我的券包 -->
<view class="coupon-box box flex" bindtap="jump" data-url="/packageMine/pages/coupon/index/index">
我的卡券
......
......@@ -57,5 +57,6 @@
],
"include": []
},
"appid": "wxfe82b8d65d07808f"
"appid": "wx6e40cfb83ce4ffb1",
"projectname": "hmd"
}
\ No newline at end of file
......@@ -10,7 +10,8 @@ export const STORAGE_OBJECTkEY = {
userInfo: 'userInfo',
sessionId: 'sessionId',
bindInfo:'bindInfo',
unauthorized:'unauthorized'
unauthorized:'unauthorized',
wx_user_info:'wx_user_info'
}
export default{
......
......@@ -9,12 +9,11 @@
* @param {*} onViewTrack 开启浏览埋点
* @returns
*/
import { reportData } from '~/api/index.js'
import USERAPI from '~/api/usersApi/index'
// import { reportData } from '~/api/index.js'
class Share {
constructor() {
// console.log('---------------- 分享初始化 ----------------')
console.log('---------------- 分享初始化 ----------------')
this.initPageProxy()
}
/**全局注册事件 */
......@@ -43,9 +42,14 @@ class Share {
path += that.setCommonShareQuery()
if (shareQuery) path += `&${shareQuery}`
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 (shareTrackData) that.reportShareData(shareTrackData)
// if (shareTrackData) that.reportShareData(shareTrackData)
console.table( {
path,
title: shareTitle,
imageUrl: shareImage
})
return {
path,
title: shareTitle,
......@@ -57,7 +61,7 @@ class Share {
page.onShareTimeline = function () {
let { shareTitle, shareImage, shareQuery, shareFun, shareTrackData } = this
if (shareFun) shareFun()
if (shareTrackData) that.reportShareData(shareTrackData)
// if (shareTrackData) that.reportShareData(shareTrackData)
shareQuery = that.setCommonShareQuery(shareQuery)
console.log(shareQuery)
return {
......@@ -70,21 +74,21 @@ class Share {
page.onLoad = async function () {
onLoad && onLoad.apply(this, arguments)
if (this.onViewTrack) {
const WXUSERINFO = await USERAPI.getWXUserInfo(),
{ USERINFO } = that.getCommonData(),
shareInfo = this.options
if (shareInfo.shareOpenId)
reportData(
{
openId: WXUSERINFO.openId || '',
unionId: WXUSERINFO.unionId || '',
nickName: WXUSERINFO.nickName || '',
avatar: WXUSERINFO.avatarUrl || '',
phone: WXUSERINFO.phone || USERINFO.phone || '',
...shareInfo
},
1
)
// const WXUSERINFO = await USERAPI.getWXUserInfo(),
// { USERINFO } = that.getCommonData(),
// shareInfo = this.options
// if (shareInfo.shareOpenId)
// reportData(
// {
// openId: WXUSERINFO.openId || '',
// unionId: WXUSERINFO.unionId || '',
// nickName: WXUSERINFO.nickName || '',
// avatar: WXUSERINFO.avatarUrl || '',
// phone: WXUSERINFO.phone || USERINFO.phone || '',
// ...shareInfo
// },
// 1
// )
}
}
}
......@@ -118,4 +122,4 @@ class Share {
})
}
}
new Share()
export default new Share()
......@@ -22,8 +22,13 @@ Date.prototype.format = function (fmt) {
/**触底加载 */
const onReachBottom = (obj, callBack) => {
let _this = $router.getPageInstance()
let { pageNum, total, pageSize, nothing } = obj
let _this = obj._this || wx.p.router.getPageInstance()
let {
pageNum,
total,
pageSize,
nothing
} = obj
if (!total && !pageNum) {
console.error('total&&pageNum为必传')
return
......@@ -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) => {
......@@ -128,10 +104,9 @@ const parseString = str => {
const Util = {
onReachBottom,
isFullSucreen,
clearObjNull,
throttle,
isEmptyObj,
parseString,
}
export default Util
export default Util
\ 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!