|
|
@@ -13,7 +13,8 @@ Page({ |
|
|
|
imgUrl: 'https://formall.oss-accelerate.aliyuncs.com/ga/payOrder-1.png', |
|
|
|
currentIndex: null, |
|
|
|
currentId: '', |
|
|
|
isShowNumberCheck: false |
|
|
|
isShowNumberCheck: false, |
|
|
|
phone: '' |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
@@ -26,6 +27,7 @@ Page({ |
|
|
|
// **已弃用 |
|
|
|
// this.getProductDetail() |
|
|
|
this.getProductList() |
|
|
|
this.checkUserInfo() |
|
|
|
}, |
|
|
|
|
|
|
|
// 获取产品详情(价格、库存等)**已弃用 |
|
|
@@ -60,7 +62,8 @@ Page({ |
|
|
|
salePrice: firstData[0].salePrice, |
|
|
|
} |
|
|
|
this.setData({ |
|
|
|
firstData: data |
|
|
|
firstData: data, |
|
|
|
currentId: firstData[0].id |
|
|
|
}) |
|
|
|
// 非首冲数据 |
|
|
|
} else { |
|
|
@@ -85,14 +88,23 @@ Page({ |
|
|
|
}, |
|
|
|
|
|
|
|
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({ |
|
|
|
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'); |
|
|
|
}) |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面初次渲染完成 |
|
|
|
*/ |
|
|
|