@@ -15,24 +15,7 @@ | |||||
"navigationBarTitleText": "Weixin", | "navigationBarTitleText": "Weixin", | ||||
"navigationBarTextStyle": "black" | "navigationBarTextStyle": "black" | ||||
}, | }, | ||||
"tabBar": { | |||||
"color": "#9F9F9F", | |||||
"selectedColor": "#07c160", | |||||
"list": [ | |||||
{ | |||||
"pagePath": "pages/index/index", | |||||
"iconPath": "./asset/icon/Home.png", | |||||
"selectedIconPath": "./asset/icon/HomeSelect.png", | |||||
"text": "首页" | |||||
}, | |||||
{ | |||||
"pagePath": "pages/mine/mine", | |||||
"iconPath": "./asset/icon/User.png", | |||||
"selectedIconPath": "./asset/icon/UserSelect.png", | |||||
"text": "我的" | |||||
} | |||||
] | |||||
}, | |||||
"style": "v2", | "style": "v2", | ||||
"sitemapLocation": "sitemap.json" | "sitemapLocation": "sitemap.json" | ||||
} | } |
@@ -55,6 +55,7 @@ Component({ | |||||
this.setData({ | this.setData({ | ||||
show: false | show: false | ||||
}) | }) | ||||
this.triggerEvent('getUserPhoneSuccess') | |||||
}).catch(err => { | }).catch(err => { | ||||
console.log(err, 'err'); | console.log(err, 'err'); | ||||
}) | }) | ||||
@@ -13,7 +13,8 @@ Page({ | |||||
imgUrl: 'https://formall.oss-accelerate.aliyuncs.com/ga/payOrder-1.png', | imgUrl: 'https://formall.oss-accelerate.aliyuncs.com/ga/payOrder-1.png', | ||||
currentIndex: null, | currentIndex: null, | ||||
currentId: '', | currentId: '', | ||||
isShowNumberCheck: false | |||||
isShowNumberCheck: false, | |||||
phone: '' | |||||
}, | }, | ||||
/** | /** | ||||
@@ -26,6 +27,7 @@ Page({ | |||||
// **已弃用 | // **已弃用 | ||||
// this.getProductDetail() | // this.getProductDetail() | ||||
this.getProductList() | this.getProductList() | ||||
this.checkUserInfo() | |||||
}, | }, | ||||
// 获取产品详情(价格、库存等)**已弃用 | // 获取产品详情(价格、库存等)**已弃用 | ||||
@@ -60,7 +62,8 @@ Page({ | |||||
salePrice: firstData[0].salePrice, | salePrice: firstData[0].salePrice, | ||||
} | } | ||||
this.setData({ | this.setData({ | ||||
firstData: data | |||||
firstData: data, | |||||
currentId: firstData[0].id | |||||
}) | }) | ||||
// 非首冲数据 | // 非首冲数据 | ||||
} else { | } else { | ||||
@@ -85,14 +88,23 @@ Page({ | |||||
}, | }, | ||||
createPayOrder() { | createPayOrder() { | ||||
// this.setData({ | |||||
// isShowNumberCheck: true | |||||
// }) | |||||
const data = { | |||||
appId: request.appId | |||||
if (!this.data.phone) { | |||||
this.setData({ | |||||
isShowNumberCheck: true | |||||
}) | |||||
return | |||||
} | } | ||||
if (this.data.currentId) { | |||||
data.id = this.data.currentId | |||||
if (!this.data.currentId) { | |||||
wx.showToast({ | |||||
title: '请选择一个套餐!', | |||||
icon: 'error' | |||||
}) | |||||
} | |||||
const data = { | |||||
appId: request.appId, | |||||
productId: this.data.currentId | |||||
} | } | ||||
request.post({ | request.post({ | ||||
url: '/api/pay/createPayOrder', | url: '/api/pay/createPayOrder', | ||||
@@ -136,6 +148,23 @@ Page({ | |||||
}); | }); | ||||
}, | }, | ||||
/** | |||||
* @description 检查用户信息 | |||||
* @returns userInfo | |||||
*/ | |||||
checkUserInfo() { | |||||
const that = this | |||||
request.get({ | |||||
url: '/api/user/userinfo' | |||||
}).then(res => { | |||||
console.log(res, 'userinfo'); | |||||
that.setData({ | |||||
phone: res.data.phone || null | |||||
}) | |||||
}).catch(err => { | |||||
console.log(err, 'err'); | |||||
}) | |||||
}, | |||||
/** | /** | ||||
* 生命周期函数--监听页面初次渲染完成 | * 生命周期函数--监听页面初次渲染完成 | ||||
*/ | */ | ||||
@@ -38,4 +38,4 @@ | |||||
</view> | </view> | ||||
</view> | </view> | ||||
<userNumberChkeck show="{{isShowNumberCheck}}"></userNumberChkeck> | |||||
<userNumberChkeck show="{{isShowNumberCheck}}" bind:getUserPhoneSuccess="checkUserInfo"></userNumberChkeck> |
@@ -0,0 +1,18 @@ | |||||
"tabBar": { | |||||
"color": "#9F9F9F", | |||||
"selectedColor": "#07c160", | |||||
"list": [ | |||||
{ | |||||
"pagePath": "pages/index/index", | |||||
"iconPath": "./asset/icon/Home.png", | |||||
"selectedIconPath": "./asset/icon/HomeSelect.png", | |||||
"text": "首页" | |||||
}, | |||||
{ | |||||
"pagePath": "pages/mine/mine", | |||||
"iconPath": "./asset/icon/User.png", | |||||
"selectedIconPath": "./asset/icon/UserSelect.png", | |||||
"text": "我的" | |||||
} | |||||
] | |||||
}, |
@@ -33,7 +33,7 @@ class request { | |||||
/** | /** | ||||
* @description 小程序appId | * @description 小程序appId | ||||
* @returns {string} wxf288a9b8167ff2ca | |||||
* @returns {string} wxf288a9b8167ff2ca | |||||
*/ | */ | ||||
appId = 'wxf288a9b8167ff2ca'; | appId = 'wxf288a9b8167ff2ca'; | ||||