You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
3.2 KiB

5 years ago
//app.js
5 years ago
import commonApi from "./utils/https/common"
5 years ago
App({
onLaunch: function () {
5 years ago
let rect = wx.getSystemInfoSync();
this.globalData.safeBottom = rect.safeArea?(rect.safeArea.bottom - rect.safeArea.height):0
5 years ago
// 获取uuid
commonApi._post("browse/get_uuid",{}).then(res=>{
// console.log('uuid',res);
this.globalData.uuid = res.data.uuid;
})
5 years ago
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
// 获取用户信息
wx.getSetting({
success: res => {
if (res.authSetting['scope.userInfo']) {
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
wx.getUserInfo({
success: res => {
// 可以将 res 发送给后台解码出 unionId
this.globalData.userInfo = res.userInfo
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
if (this.userInfoReadyCallback) {
this.userInfoReadyCallback(res)
}
}
})
}
}
})
},
globalData: {
5 years ago
from:"",// 是否是从其他小程序跳转过来的 如果是从其他小程序跳转的话 会记录
5 years ago
uuid:null,// 设备唯一uuid
5 years ago
// 苏州市政府的经纬度
latitude:"31.297401",//纬度
longitude:"120.585639",//经度
userInfo: null,
couponInfo:null,
mapKey:"DEUBZ-GG7RR-UZDWR-WXZD3-TARU5-4TB42",
safeBottom:0,
product:null,
postProduct:[],
productState:{
"WAIT_PAYMENT":"待付款",
"WAIT_CONFIRM":"待确认",
"WAIT_POST":"待发货",
"WAIT_USE":"待出行",
'WAIT_DELIVERY':'待收货',
'WAIT_COMMENT':'待评价',
"NEED_REFUND":"退款退货",
"CLOSED": "已取消",
"PAID": "已支付",
"WAIT_REFUND":"待退款",
"REFUND":"已退款",
"COMPLETED":"已完成",
"EXPIRED":"已过期/已失效",
5 years ago
"REFUNDING":"退款中" ,
"TICKET_ERROR":"出票失败",
"REFUND_FAIL":"退订失败"
5 years ago
},
orderState:{
"UNPAID":"待付款",
// "WAIT_PAYMENT":"待付款",
// "WAIT_CONFIRM":"待确认",
// "WAIT_POST":"待发货",
// "WAIT_USE":"待出行",
// 'WAIT_DELIVERY':'待收货',
'WAIT_COMMENT':'待评价',
// "NEED_REFUND":"退款退货",
"CLOSED": "已取消",
"PAID": "已支付",
"WAIT_REFUND":"待退款",
"REFUND":"已退款",
"COMPLETED":"已完成",
// "EXPIRED":"已过期/已失效",
5 years ago
"REFUNDING":"退款中" ,
'REFUND_REFUSE':'退款拒绝',
5 years ago
'REFUND_ERROR':'退款异常',
'OFFLINE_REFUND':'线下退款完成',
'OFFLINE_WAIT':'线下退款处理中'
5 years ago
},
codeState:['未使用','已使用','已失效','已取消'],
weburl:"",
pay_methods:{
NONE:"无需支付",
WEIXIN:"微信支付",
JIANSHEYINHANG:"建行支付",
ZHIFUBAO:"支付宝支付"
5 years ago
},
kjId:null
5 years ago
}
})