//导入request请求工具类
import  { getBaseUrl,getWxLogin,getUserProfile,requestUtil}  from '../../utils/requestUtil' ; 
import  regeneratorRuntime from '../../lib/runtime/runtime' ; 
Page( { /*** 页面的初始数据*/data: { address:{ } ,baseUrl:'' ,cart:[ ] ,totalPrice:0,totalNum:0} ,/*** 生命周期函数--监听页面加载*/onLoad( options)  { const baseUrl =  getBaseUrl( ) ; this.setData( { // swiperList:result.message,baseUrl} ) } ,//处理订单支付async handleOrderPay ( ) { // wx.login( { //     timeout:5000,//   success: ( res)  = >  { //     console.log( res.code) //   } ,// } ) // let  res = await getWxLogin( ) ; // console.log( res.code) // wx.getUserProfile( { //     desc:'获取用户信息' ,//     success:( res) = > { //         console.log( res.userInfo.nickName,res.userInfo.avatarUrl) //     } // } ) // let  res2 =  await getUserProfile( ) ; // console.log( res2.userInfo.nickName,res2.userInfo.avatarUrl) Promise.all( [ getWxLogin( ) ,getUserProfile( ) ] ) .then(( res) = > { console.log( res[ 0 ] .code) ; console.log( res[ 1 ] .userInfo.nickName,res[ 1 ] .userInfo.avatarUrl) let  loginParam = { code:res[ 0 ] .code,nickName:res[ 1 ] .userInfo.nickName,avatarUrl:res[ 1 ] .userInfo.avatarUrl} console.log( loginParam) wx.setStorageSync( 'userInfo' , res[ 1 ] .userInfo) ; this.wxlogin( loginParam) } ) } ,/*** 请求后端获取用户token* @param { *}  loginParam */async wxlogin( loginParam) { const result = await requestUtil( { url:"/user/wxlogin" ,data:loginParam,method:"post" } ) ; console.log( result) ; } ,/*** 生命周期函数--监听页面显示*/onShow: function ( )  { console.log( "show" ) ; const address = wx.getStorageSync( 'address' ) ; let  cart = wx.getStorageSync( 'cart' ) || [ ] ; cart = cart.filter( v= > v.checked) ; let  totalPrice = 0 ; let