Commit 3c1540d9 by 杨北旺

修复bug

1 parent a1b7d371
import { preReleaseAppId } from '~/config' import { preReleaseAppId } from '~/config'
const target = ['ip', 'dev', 'uat', 'prod', 'preRelease'] const target = ['ip', 'dev', 'uat', 'prod', 'preRelease']
let index = 1 let index = 4
/** /**
* *
......
import { IMG_URL } from '~/config'; import { IMG_URL } from '~/config';
import NP from 'number-precision'
Page({ Page({
data: { data: {
IMGURL:IMG_URL, IMGURL: IMG_URL,
handleStatus:0 handleStatus: 0
}, },
onLoad(options) { onLoad(options) {
if(options.id){ if (options.couponId) {
this.getEquityCouponsDetail(options.id) this.getEquityCouponsDetail(options.couponId)
} }
}, },
// 查询优惠券详情 // 查询优惠券详情
getEquityCouponsDetail(id){ getEquityCouponsDetail(id) {
wx.p.api.couponsApi.getEquityCouponsDetail({couponId:id}).then(res=>{ wx.p.api.couponsApi.getEquityCouponsDetail({ couponId: id }).then(res => {
console.log(res); if (res.denomination) {
res.denomination = NP.divide(res.denomination, 100)
}
this.setData({ this.setData({
detailInfo:res detailInfo: res
}) })
this.couponId = id this.couponId = id
}) })
}, },
// 领取 // 领取
async toGet(){ async toGet() {
const { const {
detailInfo detailInfo
} = this.data } = this.data
const authStatus = await wx.p.router.intercept() // const authStatus = await wx.p.router.intercept()
if (authStatus) return // if (authStatus) return
wx.p.wxApi.showLoading() wx.p.wxApi.showLoading()
wx.p.api.couponsApi.getEquityCoupons({couponId:this.couponId,merchantId:detailInfo.merchantId}).then(res=>{ wx.p.api.couponsApi.getEquityCoupons({ couponId: this.couponId, merchantId: detailInfo.merchantId }).then(res => {
console.log(res);
wx.hideLoading(); wx.hideLoading();
if (res) {
this.setData({
handleStatus: 1
})
}
}) })
}, },
......
...@@ -74,9 +74,9 @@ Page({ ...@@ -74,9 +74,9 @@ Page({
}) })
}, },
// 选择优惠券 // 选择优惠券
toSelectCoupons(){ async toSelectCoupons(){
const isLogin = this.checkLogin() const isLogin = await this.checkLogin()
if (!isLogin) { if (isLogin) {
return return
} }
if(this.data.isGH)return if(this.data.isGH)return
...@@ -184,7 +184,7 @@ Page({ ...@@ -184,7 +184,7 @@ Page({
// url: '/packageShopmall/packageEquity/pages/allEquity/allEquity?showToast=1' // url: '/packageShopmall/packageEquity/pages/allEquity/allEquity?showToast=1'
// }) // })
setTimeout(()=>{ setTimeout(()=>{
wx.$router.back(e =>{ wx.p.router.back(e =>{
e.onLoad({showToast:1}) e.onLoad({showToast:1})
}) })
},500) },500)
...@@ -218,15 +218,17 @@ Page({ ...@@ -218,15 +218,17 @@ Page({
}) })
}, },
// 去购买 // 去购买
toBuyItem() { async toBuyItem() {
const isLogin = this.checkLogin() const isLogin = await this.checkLogin()
if (!isLogin) { if (isLogin) {
return return
} }
const { curentGoodsItem, isHaveInventory,isGameUse } = this.data const { curentGoodsItem, isHaveInventory,isGameUse } = this.data
if (!isHaveInventory) { if (!isHaveInventory) {
return return
} }
if(isGameUse)return this.comfirmBuyItem() if(isGameUse)return this.comfirmBuyItem()
const { noMemberPrice, salesPrice } = curentGoodsItem const { noMemberPrice, salesPrice } = curentGoodsItem
let diffPrice = 0 let diffPrice = 0
...@@ -370,17 +372,9 @@ Page({ ...@@ -370,17 +372,9 @@ Page({
}) })
}, },
// 检测是否已经登录 // 检测是否已经登录
checkLogin() { async checkLogin() {
const sessionId = wx.p.cache.storageApi.getSessionId() const authStatus = await wx.p.router.intercept()
let flag = true return authStatus
if (!sessionId) {
flag = false
this.setData({
showLogin: true,
showComponent:false
})
}
return flag
}, },
// 获取a标签链接 // 获取a标签链接
getALabel(str) { getALabel(str) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!