@@ -5,140 +5,30 @@ App({ | |||||
onLaunch: function(options) { | onLaunch: function(options) { | ||||
var that = this; | var that = this; | ||||
that.globalData.sceneAddress = options.scene; | that.globalData.sceneAddress = options.scene; | ||||
that.getLocation(); | |||||
that.userLogin(); | |||||
}, | }, | ||||
/** | /** | ||||
* 获取地址位置信息 | * 获取地址位置信息 | ||||
*/ | */ | ||||
getLocation: function() { | getLocation: function() { | ||||
var that = this | |||||
wx.getLocation({ | wx.getLocation({ | ||||
type: "wgs84", | type: "wgs84", | ||||
success: function(res) { | success: function(res) { | ||||
that.globalData.locationInfo = res | |||||
console.log("getLocation", res); | console.log("getLocation", res); | ||||
}, | }, | ||||
fail: error => { | fail: error => { | ||||
console.log(error); | console.log(error); | ||||
} | } | ||||
}); | }); | ||||
}, | |||||
/** | |||||
* 用户登录 | |||||
*/ | |||||
userLogin: function() { | |||||
var that = this; | |||||
// 登录 | |||||
wx.login({ | |||||
success: ({ code }) => { | |||||
Http.post({ | |||||
url: config.api.login, | |||||
data: { | |||||
appId: config.weapp.AppId, | |||||
code: code, | |||||
sceneAddress: that.globalData.sceneAddress | |||||
} | |||||
}) | |||||
.then(res => { | |||||
console.log("userlogin", res); | |||||
that.globalData.token = res.data.token; | |||||
Http.setToken(res.data.token); | |||||
that.checkUserCarStatus(); | |||||
that.getUserInfo(); | |||||
if (that.couponChannelListCallback) { | |||||
that.couponChannelListCallback(that.globalData.token); | |||||
} | |||||
if (that.couponListCallback) { | |||||
that.couponListCallback(that.globalData.token); | |||||
} | |||||
if (that.businessListCallback) { | |||||
that.businessListCallback(that.globalData.token); | |||||
} | |||||
return Http.post({ | |||||
url: config.api.checkUserStatus, | |||||
data: {} | |||||
}); | |||||
}) | |||||
.then(res => { | |||||
console.log("checkUserStatus", res); | |||||
}) | |||||
.catch(err => { | |||||
console.log("checkUserStatus:err", err); | |||||
if (err.code == 11004) { | |||||
// 用户昵称未授权 | |||||
wx.redirectTo({ | |||||
url: "../getuserinfo/index" | |||||
}); | |||||
} | |||||
}); | |||||
} | |||||
}); | |||||
}, | |||||
/** | |||||
* 获取用户信息 | |||||
*/ | |||||
getUserInfo: function() { | |||||
// 获取用户信息 | |||||
wx.getSetting({ | |||||
success: res => { | |||||
console.log("getSetting", res); | |||||
if (res.authSetting["scope.userInfo"]) { | |||||
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框 | |||||
wx.getUserInfo({ | |||||
success: res => { | |||||
// 可以将 res 发送给后台解码出 unionId | |||||
console.log("getUserInfo", res); | |||||
} | |||||
}); | |||||
} | |||||
} | |||||
}); | |||||
}, | |||||
/** | |||||
* 检查用户是否有车 | |||||
*/ | |||||
checkUserCarStatus: function() { | |||||
var that = this; | |||||
Http.get({ | |||||
url: config.api.userCarCount, | |||||
data: {} | |||||
}).then(res => { | |||||
if (res.data > 0) { | |||||
// 用户名下有车 | |||||
that.globalData.phone = res.data.phone; | |||||
that.globalData.supportCar = true; | |||||
// 共同登录 | |||||
that.userCarLogin(); | |||||
} | |||||
}); | |||||
}, | |||||
/** | |||||
* car共同登录 | |||||
*/ | |||||
userCarLogin: function() { | |||||
var that = this; | |||||
if (!that.globalData.carLogin) { | |||||
// 共同登录 | |||||
Http.post({ | |||||
url: config.api.carInit, | |||||
data: { | |||||
phone: that.globalData.phone | |||||
} | |||||
}).then(res => { | |||||
that.globalData.carLogin = true; | |||||
that.globalData.parkVendor = res.data.vendor; | |||||
if (res.data.token != "undefined") { | |||||
that.globalData.etcpToken = res.data.token; | |||||
console.log("etcpToken", that.globalData.etcpToken); | |||||
} | |||||
}); | |||||
} | |||||
}, | |||||
}, | |||||
globalData: { | globalData: { | ||||
// token | // token | ||||
token: null, | token: null, | ||||
// 渠道 | // 渠道 | ||||
sceneAddress: null, | sceneAddress: null, | ||||
// location info | |||||
locationInfo: null, | |||||
// 二维码参数 | // 二维码参数 | ||||
scene: null, | scene: null, | ||||
// 支持智慧停车, 用户名下有车 | // 支持智慧停车, 用户名下有车 | ||||
@@ -15,6 +15,7 @@ | |||||
<view class="coupons-info-manjian" wx:elif="{{data.type == 2||data.type == 3||data.type==4||data.type==5}}"> | <view class="coupons-info-manjian" wx:elif="{{data.type == 2||data.type == 3||data.type==4||data.type==5}}"> | ||||
仅限本店使用 | 仅限本店使用 | ||||
</view> | </view> | ||||
<view class="coupons-info-manjian1">{{data.merchantName}}</view> | |||||
</view> | </view> | ||||
</view> | </view> | ||||
<view class="coupons-btn"> | <view class="coupons-btn"> | ||||
@@ -44,7 +44,7 @@ | |||||
} | } | ||||
.coupons-info-price { | .coupons-info-price { | ||||
padding: 32rpx 0 0; | |||||
padding: 16rpx 0 0; | |||||
} | } | ||||
.i { | .i { | ||||
@@ -56,7 +56,7 @@ | |||||
display: inline-block; | display: inline-block; | ||||
font-size: 36rpx; | font-size: 36rpx; | ||||
color: #f96563; | color: #f96563; | ||||
line-height: 50rpx; | |||||
line-height: 27rpx; | |||||
font-weight: 600; | font-weight: 600; | ||||
} | } | ||||
@@ -115,10 +115,11 @@ | |||||
width: 138rpx !important; | width: 138rpx !important; | ||||
line-height: 50rpx !important; | line-height: 50rpx !important; | ||||
} | } | ||||
.coupons-btn-gms { | .coupons-btn-gms { | ||||
background: #999!important; | |||||
background: #999 !important; | |||||
border-radius: 10rpx !important; | border-radius: 10rpx !important; | ||||
opacity: .6; | |||||
opacity: 0.6; | |||||
margin: 0 !important; | margin: 0 !important; | ||||
padding: 0 !important; | padding: 0 !important; | ||||
font-family: PingFangSC-Semibold; | font-family: PingFangSC-Semibold; | ||||
@@ -129,6 +130,7 @@ | |||||
width: 138rpx !important; | width: 138rpx !important; | ||||
line-height: 50rpx !important; | line-height: 50rpx !important; | ||||
} | } | ||||
.subtitle { | .subtitle { | ||||
font-size: 24rpx; | font-size: 24rpx; | ||||
color: #6f6f6f; | color: #6f6f6f; | ||||
@@ -149,6 +151,18 @@ | |||||
display: inline-block; | display: inline-block; | ||||
} | } | ||||
.coupons-info-manjian1 { | |||||
color: #ccc !important; | |||||
font-weight: normal; | |||||
font-size: 20rpx; | |||||
line-height: 20rpx; | |||||
display: inline-block; | |||||
overflow: hidden; | |||||
white-space: nowrap; | |||||
text-overflow: ellipsis; | |||||
width: 300rpx; | |||||
} | |||||
/**上拉加载更多**/ | /**上拉加载更多**/ | ||||
.userinfo { | .userinfo { | ||||
@@ -123,11 +123,15 @@ var config = { | |||||
* 和login页面 | * 和login页面 | ||||
* 页面的图标 | * 页面的图标 | ||||
*/ | */ | ||||
marketicon:'/mall/getAppIcon' | |||||
marketicon:'/mall/getAppIcon', | |||||
/** | |||||
* 检查核销的状态 | |||||
*/ | |||||
getStatus:"/couponOrder/getStatus" | |||||
}, | }, | ||||
weapp: { | weapp: { | ||||
AppId: "wx8eb8275b78db4ede" | |||||
AppId: "wxb11603577a84a86d" | |||||
}, | }, | ||||
ErrorCode: { | ErrorCode: { | ||||
NICK_NOT_AUTH: 11004, | NICK_NOT_AUTH: 11004, | ||||
@@ -45,6 +45,6 @@ | |||||
<view class="buy-view app-border-top"> | <view class="buy-view app-border-top"> | ||||
<button bindtap='orderFunc' class='buy' wx:if="{{data.salePriceStr!=0&&data.remainInventory!=0}}">立即支付</button> | <button bindtap='orderFunc' class='buy' wx:if="{{data.salePriceStr!=0&&data.remainInventory!=0}}">立即支付</button> | ||||
<button bindtap='orderFunc' class='buy' wx:elif="{{data.salePriceStr==0&&data.remainInventory!=0}}">免费领取</button> | <button bindtap='orderFunc' class='buy' wx:elif="{{data.salePriceStr==0&&data.remainInventory!=0}}">免费领取</button> | ||||
<button class='buy' wx:elif="{{data.remainInventory==0}}" style="background:#999;color: #fff;">免费领取</button> | |||||
<button class='buy' wx:elif="{{data.remainInventory==0}}" style="background:#999;color: #fff;">已售罄</button> | |||||
</view> | </view> | ||||
</view> | </view> |
@@ -9,7 +9,13 @@ Page({ | |||||
data: {}, | data: {}, | ||||
createDate: "", | createDate: "", | ||||
expiredTime: "", | expiredTime: "", | ||||
updateDate:'' | |||||
updateDate: "", | |||||
//存储计时器 | |||||
setInter: "" | |||||
}, | |||||
onUnload: function() { | |||||
let that = this; | |||||
clearInterval(that.data.setInter); | |||||
}, | }, | ||||
onLoad: function(options) { | onLoad: function(options) { | ||||
console.log(options); | console.log(options); | ||||
@@ -23,32 +29,34 @@ Page({ | |||||
options.quancode != null && | options.quancode != null && | ||||
(options.quancode != "" && options.quancode) != undefined | (options.quancode != "" && options.quancode) != undefined | ||||
) { | ) { | ||||
Http.get({ | |||||
url: config.api.couponOrderDetail, | |||||
data: { | |||||
couponOrderId: options.quancode | |||||
} | |||||
}).then(res => { | |||||
console.log(res); | |||||
that.setData({ | |||||
data: res.data | |||||
that.data.setInter = setInterval(function(){ | |||||
Http.get({ | |||||
url: config.api.couponOrderDetail, | |||||
data: { | |||||
couponOrderId: options.quancode | |||||
} | |||||
}).then(res => { | |||||
console.log(res); | |||||
that.setData({ | |||||
data: res.data | |||||
}); | |||||
that.setData({ | |||||
expiredTime: util.fmtDate(that.data.data.expiredTime), | |||||
updateDate: util.fmtDate(that.data.data.updateDate), | |||||
createDate: util.fmtDate(that.data.data.createDate) | |||||
}); | |||||
}); | }); | ||||
that.setData({ | |||||
expiredTime: util.fmtDate(that.data.data.expiredTime), | |||||
updateDate: util.fmtDate(that.data.data.updateDate), | |||||
createDate: util.fmtDate(that.data.data.createDate) | |||||
}); | |||||
}); | |||||
}, 200); | |||||
} | } | ||||
util.barcode("barcode", options.quancode, 510, 100); | util.barcode("barcode", options.quancode, 510, 100); | ||||
util.qrcode("qrcode", options.quancode,350, 350); | |||||
util.qrcode("qrcode", options.quancode, 350, 350); | |||||
}, | }, | ||||
phone: function() { | phone: function() { | ||||
let that = this; | let that = this; | ||||
console.log(that.data); | console.log(that.data); | ||||
if (that.data.data.merchantLinkPhone) { | if (that.data.data.merchantLinkPhone) { | ||||
wx.makePhoneCall({ | wx.makePhoneCall({ | ||||
phoneNumber: that.data.data.merchantLinkPhone | |||||
phoneNumber: that.data.data.merchantLinkPhone | |||||
}); | }); | ||||
} | } | ||||
} | } | ||||
@@ -76,13 +76,13 @@ Component({ | |||||
if (key == 0) { | if (key == 0) { | ||||
var param = { | var param = { | ||||
pageNum: pageNum, | pageNum: pageNum, | ||||
pageSize: 16, | |||||
pageSize: 6, | |||||
targetAd: 1 | targetAd: 1 | ||||
}; | }; | ||||
} else { | } else { | ||||
var param = { | var param = { | ||||
pageNum: pageNum, | pageNum: pageNum, | ||||
pageSize: 16, | |||||
pageSize: 6, | |||||
business: key, | business: key, | ||||
targetAd: 1 | targetAd: 1 | ||||
}; | }; | ||||
@@ -20,54 +20,145 @@ Page({ | |||||
onLoad: function(options) { | onLoad: function(options) { | ||||
var that = this; | var that = this; | ||||
var scene = decodeURIComponent(options.scene); | var scene = decodeURIComponent(options.scene); | ||||
app.getLocation(); | |||||
}, | }, | ||||
onShow:function(){ | |||||
let that = this; | |||||
if (app.globalData.token && app.globalData.token != null) { | |||||
} else { | |||||
wx.login({ | |||||
success: ({ code }) => { | |||||
console.log(code); | |||||
Http.post({ | |||||
onShow: function() { | |||||
this.userLogin() | |||||
}, | |||||
onGetCode: function(e) { | |||||
//子组件传递给父组件的值 | |||||
this.setData({ | |||||
code: e.detail.val, | |||||
page: e.detail.pageNum | |||||
}); | |||||
}, | |||||
/** | |||||
* 用户登录 | |||||
*/ | |||||
userLogin: function() { | |||||
var that = this; | |||||
// 登录 | |||||
wx.login({ | |||||
success: ({ | |||||
code | |||||
}) => { | |||||
var usrdata = { | |||||
appId: config.weapp.AppId, | |||||
code: code, | |||||
sceneAddress: app.globalData.sceneAddress, | |||||
} | |||||
if (app.globalData.locationInfo) { | |||||
usrdata = { | |||||
appId: config.weapp.AppId, | |||||
code: code, | |||||
sceneAddress: app.globalData.sceneAddress, | |||||
latitude: '' + app.globalData.locationInfo.latitude, | |||||
longitude: '' + app.globalData.locationInfo.longitude, | |||||
} | |||||
} | |||||
Http.post({ | |||||
url: config.api.login, | url: config.api.login, | ||||
data: { | |||||
appId: config.weapp.AppId, | |||||
code: code, | |||||
sceneAddress: app.globalData.sceneAddress | |||||
} | |||||
}).then(res => { | |||||
//banner渲染 | |||||
data: usrdata | |||||
}) | |||||
.then(res => { | |||||
console.log("userlogin:app", res); | |||||
app.globalData.token = res.data.token; | app.globalData.token = res.data.token; | ||||
Http.setToken(res.data.token); | Http.setToken(res.data.token); | ||||
if (res.code == 200) { | |||||
Http.get({ | |||||
url: config.api.bannerlist, | |||||
data: { | |||||
pageNum: 1, | |||||
pageSize: 5 | |||||
} | |||||
}).then(res => { | |||||
that.setData({ | |||||
list: res.data.list | |||||
}); | |||||
that.checkUserCarStatus(); | |||||
that.getUserInfo(); | |||||
if (app.couponChannelListCallback) { | |||||
app.couponChannelListCallback(app.globalData.token); | |||||
} | |||||
if (app.couponListCallback) { | |||||
app.couponListCallback(app.globalData.token); | |||||
} | |||||
if (app.businessListCallback) { | |||||
app.businessListCallback(app.globalData.token); | |||||
} | |||||
return Http.post({ | |||||
url: config.api.checkUserStatus, | |||||
data: {} | |||||
}); | |||||
}) | |||||
.then(res => { | |||||
console.log("checkUserStatus:res", res); | |||||
}) | |||||
.catch(err => { | |||||
console.log("checkUserStatus:err", err); | |||||
if (err.code == 11004) { | |||||
// 用户昵称未授权 | |||||
wx.redirectTo({ | |||||
url: "/pages/getuserinfo/index" | |||||
}); | }); | ||||
} | } | ||||
}); | }); | ||||
} | |||||
}); | |||||
}, | |||||
/** | |||||
* 检查用户是否有车 | |||||
*/ | |||||
checkUserCarStatus: function() { | |||||
var that = this; | |||||
Http.get({ | |||||
url: config.api.userCarCount, | |||||
data: {} | |||||
}).then(res => { | |||||
if (res.data > 0) { | |||||
// 用户名下有车 | |||||
app.globalData.phone = res.data.phone; | |||||
app.globalData.supportCar = true; | |||||
// 共同登录 | |||||
that.userCarLogin(); | |||||
} | |||||
}); | |||||
}, | |||||
/** | |||||
* car共同登录 | |||||
*/ | |||||
userCarLogin: function() { | |||||
var that = this; | |||||
if (!app.globalData.carLogin) { | |||||
// 共同登录 | |||||
Http.post({ | |||||
url: config.api.carInit, | |||||
data: { | |||||
phone: app.globalData.phone | |||||
} | |||||
}).then(res => { | |||||
app.globalData.carLogin = true; | |||||
app.globalData.parkVendor = res.data.vendor; | |||||
if (res.data.token != "undefined") { | |||||
app.globalData.etcpToken = res.data.token; | |||||
console.log("etcpToken", app.globalData.etcpToken); | |||||
} | } | ||||
}); | }); | ||||
} | } | ||||
}, | }, | ||||
onGetCode: function(e) { | |||||
//子组件传递给父组件的值 | |||||
this.setData({ | |||||
code: e.detail.val, | |||||
page: e.detail.pageNum | |||||
/** | |||||
* 获取用户信息 | |||||
*/ | |||||
getUserInfo: function() { | |||||
// 获取用户信息 | |||||
wx.getSetting({ | |||||
success: res => { | |||||
console.log("getSetting", res); | |||||
if (res.authSetting["scope.userInfo"]) { | |||||
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框 | |||||
wx.getUserInfo({ | |||||
success: res => { | |||||
// 可以将 res 发送给后台解码出 unionId | |||||
console.log("getUserInfo", res); | |||||
} | |||||
}); | |||||
} | |||||
} | |||||
}); | }); | ||||
}, | }, | ||||
//下拉加载更多 | //下拉加载更多 | ||||
onReachBottom: function() { | onReachBottom: function() { | ||||
let that = this; | let that = this; | ||||
@@ -10,7 +10,10 @@ Page({ | |||||
showModalStatus: false, | showModalStatus: false, | ||||
flag: 0, | flag: 0, | ||||
order: null, | order: null, | ||||
orderId: null | |||||
orderId: null, | |||||
//存储计时器 | |||||
setInter: "", | |||||
mystatus:'' | |||||
}, | }, | ||||
/** | /** | ||||
@@ -19,36 +22,51 @@ Page({ | |||||
*/ | */ | ||||
powerDrawer: function(e) { | powerDrawer: function(e) { | ||||
let that = this; | |||||
// couponOrderStatus | // couponOrderStatus | ||||
// 0 未使用 | // 0 未使用 | ||||
// 1 已使用 | // 1 已使用 | ||||
// 2 已过期 | // 2 已过期 | ||||
// 3 已经退款 | // 3 已经退款 | ||||
console.log(e); | console.log(e); | ||||
wx.navigateTo({ | |||||
url: `/pages/orderquanma/index?quancode=${ | |||||
e.currentTarget.dataset.quancode | |||||
}&title=${e.currentTarget.dataset.title}&subtitle=${ | |||||
e.currentTarget.dataset.subtitle | |||||
}&remark=${e.currentTarget.dataset.remark}&couponorderstatus=${ | |||||
e.currentTarget.dataset.couponorderstatus | |||||
}` | |||||
}); | |||||
console.log(e.currentTarget.dataset.quancode); | |||||
console.log(e.currentTarget.dataset.couponorderstatus); | |||||
if (that.data.mystatus == null || that.data.mystatus == undefined) { | |||||
wx.navigateTo({ | |||||
url: `/pages/orderquanma/index?quancode=${ | |||||
e.currentTarget.dataset.quancode | |||||
}&title=${e.currentTarget.dataset.title}&subtitle=${ | |||||
e.currentTarget.dataset.subtitle | |||||
}&remark=${e.currentTarget.dataset.remark}&couponorderstatus=${ | |||||
e.currentTarget.dataset.couponorderstatus | |||||
}` | |||||
}); | |||||
console.log(e.currentTarget.dataset.couponorderstatus); | |||||
} else { | |||||
wx.navigateTo({ | |||||
url: `/pages/orderquanma/index?quancode=${ | |||||
e.currentTarget.dataset.quancode | |||||
}&title=${e.currentTarget.dataset.title}&subtitle=${ | |||||
e.currentTarget.dataset.subtitle | |||||
}&remark=${e.currentTarget.dataset.remark}&couponorderstatus=${ | |||||
that.data.mystatus | |||||
}` | |||||
}); | |||||
} | |||||
}, | }, | ||||
/** | /** | ||||
* 生命周期函数--监听页面加载 | * 生命周期函数--监听页面加载 | ||||
*/ | */ | ||||
onLoad: function(options) { | onLoad: function(options) { | ||||
let that = this; | let that = this; | ||||
console.log(options.orderId); | |||||
console.log(options.flag + "我是付款的标识"); | |||||
this.setData({ | this.setData({ | ||||
orderId: options.orderId | orderId: options.orderId | ||||
}); | }); | ||||
wx.showLoading({ | |||||
title: "加载中" | |||||
}); | |||||
setTimeout(function() { | |||||
wx.hideLoading(); | |||||
}, 500); | |||||
// that.data.setInter = setInterval(function() { | |||||
Http.get({ | Http.get({ | ||||
url: config.api.orderDetail, | url: config.api.orderDetail, | ||||
@@ -64,12 +82,13 @@ Page({ | |||||
//createDate 创建时间 | //createDate 创建时间 | ||||
var createDate = util.fmtDate(res.data.createDate); | var createDate = util.fmtDate(res.data.createDate); | ||||
console.log(createDate); | console.log(createDate); | ||||
that.setData({ | that.setData({ | ||||
createDate: createDate | createDate: createDate | ||||
}); | }); | ||||
}); | }); | ||||
// }, 100); | |||||
}, | }, | ||||
/** | /** | ||||
@@ -193,23 +212,15 @@ Page({ | |||||
/** | /** | ||||
* 生命周期函数--监听页面初次渲染完成 | * 生命周期函数--监听页面初次渲染完成 | ||||
*/ | */ | ||||
onReady: function() {}, | |||||
/** | |||||
* 生命周期函数--监听页面显示 | |||||
*/ | |||||
onShow: function(options) {}, | |||||
onShow: function() { | |||||
console.log(this.data.mystatus) | |||||
}, | |||||
/** | /** | ||||
* 生命周期函数--监听页面隐藏 | * 生命周期函数--监听页面隐藏 | ||||
*/ | */ | ||||
onHide: function() {}, | onHide: function() {}, | ||||
/** | |||||
* 生命周期函数--监听页面卸载 | |||||
*/ | |||||
onUnload: function() {}, | |||||
/** | /** | ||||
* 页面相关事件处理函数--监听用户下拉动作 | * 页面相关事件处理函数--监听用户下拉动作 | ||||
*/ | */ | ||||
@@ -12,7 +12,8 @@ | |||||
<view> | <view> | ||||
<text>{{item.title}}</text> | <text>{{item.title}}</text> | ||||
<text wx:if="{{item.orderStatus==0}}">待付款</text> | <text wx:if="{{item.orderStatus==0}}">待付款</text> | ||||
<text wx:if="{{item.orderStatus==1}}">已付款</text> | |||||
<text wx:if="{{item.orderStatus==1&&item.salePrice==0}}">免费领取</text> | |||||
<text wx:if="{{item.orderStatus==1&&item.salePrice!=0}}">已付款</text> | |||||
<text wx:if="{{item.orderStatus==2}}">已过期</text> | <text wx:if="{{item.orderStatus==2}}">已过期</text> | ||||
</view> | </view> | ||||
<view>{{item.subTitle}}</view> | <view>{{item.subTitle}}</view> | ||||
@@ -1,78 +1,57 @@ | |||||
let util = require("../../utils/util"); | let util = require("../../utils/util"); | ||||
let Http = require("../../utils/HttpBasics"); | |||||
let config = require("../../config/config.js"); | |||||
Page({ | Page({ | ||||
/** | |||||
* 页面的初始数据 | |||||
*/ | |||||
data: { | data: { | ||||
code:'' | |||||
code: "", | |||||
//存储计时器 | |||||
setInter: "" | |||||
}, | }, | ||||
/** | |||||
* 生命周期函数--监听页面加载 | |||||
*/ | |||||
onLoad: function (options) { | |||||
console.log(options.quancode); | |||||
console.log(options); | |||||
console.log(options.subtitle); | |||||
onLoad: function(options) { | |||||
let that = this; | |||||
util.barcode("barcode", options.quancode, 500, 100); | util.barcode("barcode", options.quancode, 500, 100); | ||||
util.qrcode("qrcode", options.quancode, 350, 350); | util.qrcode("qrcode", options.quancode, 350, 350); | ||||
this.setData({ | |||||
code:options.quancode, | |||||
title:options.title, | |||||
subtitle:options.subtitle, | |||||
remark:options.remark, | |||||
couponorderstatus:options.couponorderstatus | |||||
}) | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面初次渲染完成 | |||||
*/ | |||||
onReady: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面显示 | |||||
*/ | |||||
onShow: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面隐藏 | |||||
*/ | |||||
onHide: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面卸载 | |||||
*/ | |||||
onUnload: function () { | |||||
}, | |||||
/** | |||||
* 页面相关事件处理函数--监听用户下拉动作 | |||||
*/ | |||||
onPullDownRefresh: function () { | |||||
}, | |||||
/** | |||||
* 页面上拉触底事件的处理函数 | |||||
*/ | |||||
onReachBottom: function () { | |||||
}, | |||||
/** | |||||
* 用户点击右上角分享 | |||||
*/ | |||||
onShareAppMessage: function () { | |||||
that.setData({ | |||||
code: options.quancode, | |||||
title: options.title, | |||||
subtitle: options.subtitle, | |||||
remark: options.remark, | |||||
couponorderstatus: options.couponorderstatus | |||||
}); | |||||
that.data.setInter = setInterval(function() { | |||||
if (that.data.couponorderstatus == 0) { | |||||
Http.get({ | |||||
url: config.api.getStatus, | |||||
data: { | |||||
couponOrderId: options.quancode | |||||
} | |||||
}).then(res => { | |||||
console.log(res); | |||||
that.setData({ | |||||
couponorderstatus: res.data.CouponOrderStatus | |||||
}); | |||||
/** | |||||
* 动态改变上一级页面的核销状态 | |||||
*/ | |||||
var pages = getCurrentPages(); | |||||
var currPage = pages[pages.length - 1]; //当前页面 | |||||
var prevPage = pages[pages.length - 2]; //上一个页面 | |||||
//直接调用上一个页面的setData()方法,把数据存到上一个页面中去 | |||||
prevPage.setData({ | |||||
mystatus:res.data.CouponOrderStatus | |||||
}); | |||||
}); | |||||
} | |||||
}, 2000); | |||||
/** | |||||
* couponorderstatus | |||||
* 0 没有核销 | |||||
* 1 已经核销成功 | |||||
*/ | |||||
}, | |||||
onUnload: function() { | |||||
let that = this; | |||||
clearInterval(that.data.setInter); | |||||
} | } | ||||
}) | |||||
}); |
@@ -136,8 +136,8 @@ | |||||
position: absolute; | position: absolute; | ||||
top: 34rpx; | top: 34rpx; | ||||
bottom: 0; | bottom: 0; | ||||
right: 20rpx; | |||||
width: 114rpx; | |||||
right: 0rpx; | |||||
width: 138rpx; | |||||
height: 50rpx; | height: 50rpx; | ||||
line-height: 50rpx; | line-height: 50rpx; | ||||
text-align: center; | text-align: center; | ||||
@@ -12,8 +12,8 @@ | |||||
}, | }, | ||||
"compileType": "miniprogram", | "compileType": "miniprogram", | ||||
"libVersion": "2.2.4", | "libVersion": "2.2.4", | ||||
"appid": "wx8eb8275b78db4ede", | |||||
"projectname": "%E5%AF%8C%E8%8C%82%E6%94%AF%E4%BB%98%E6%B5%8B%E8%AF%95", | |||||
"appid": "wxb11603577a84a86d", | |||||
"projectname": "%E5%AF%8C%E8%8C%82%E9%93%BE%E5%AE%A2%E6%B5%8B%E8%AF%95", | |||||
"isGameTourist": false, | "isGameTourist": false, | ||||
"condition": { | "condition": { | ||||
"search": { | "search": { | ||||