Commit 3c1540d9 by 杨北旺

修复bug

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