|
@@ -23,21 +23,21 @@ Page({
|
|
orderTime: "",
|
|
orderTime: "",
|
|
orderTimeHeight: 0,
|
|
orderTimeHeight: 0,
|
|
days: [],
|
|
days: [],
|
|
- hasMobile: false
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ hasMobile: false,
|
|
|
|
+ mobile: ''
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
*/
|
|
onLoad: async function (options) {
|
|
onLoad: async function (options) {
|
|
- var shopId = options.shopId;
|
|
|
|
- var productId = options.productId
|
|
|
|
- var productImg = options.productImg;
|
|
|
|
- var productName = options.productName;
|
|
|
|
- var price = options.price;
|
|
|
|
-
|
|
|
|
|
|
+ console.log(options)
|
|
|
|
+ let shopId = options.shopId;
|
|
|
|
+ let productId = options.productId
|
|
|
|
+ let product = await productApi.getProductById(productId);
|
|
|
|
+ let productImg = product.info.productImg;
|
|
|
|
+ let productName = product.info.productName;
|
|
|
|
+ let price = product.info.currentPrice;
|
|
this.setData({
|
|
this.setData({
|
|
shopId,
|
|
shopId,
|
|
productId,
|
|
productId,
|
|
@@ -45,8 +45,16 @@ Page({
|
|
productName,
|
|
productName,
|
|
price
|
|
price
|
|
})
|
|
})
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ let userInfo = await app.getWxUserInfo()
|
|
|
|
+ if (userInfo) {
|
|
|
|
+ this.setData({
|
|
|
|
+ userInfo: userInfo,
|
|
|
|
+ hasUserInfo: true,
|
|
|
|
+ hasMobile: userInfo.mobile ? true : false,
|
|
|
|
+ mobile: userInfo.mobile
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ await this.createTimeList();
|
|
},
|
|
},
|
|
checkAuth: async function () {
|
|
checkAuth: async function () {
|
|
const self = this
|
|
const self = this
|
|
@@ -55,24 +63,61 @@ Page({
|
|
wx.redirectTo({
|
|
wx.redirectTo({
|
|
url: '/pages/prompt/prompt?page=' + this.route,
|
|
url: '/pages/prompt/prompt?page=' + this.route,
|
|
})
|
|
})
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if (!self.data.orderTime){
|
|
|
|
+ wx.showModal({
|
|
|
|
+ title: '提示',
|
|
|
|
+ content: '请选择预约时间',
|
|
|
|
+ showCancel:false,
|
|
|
|
+ })
|
|
|
|
+ return
|
|
}
|
|
}
|
|
let data = {
|
|
let data = {
|
|
productId: self.data.productId,
|
|
productId: self.data.productId,
|
|
storeId: self.data.shopId,
|
|
storeId: self.data.shopId,
|
|
appointmentTime: self.data.orderTime,
|
|
appointmentTime: self.data.orderTime,
|
|
num: self.data.peopleNum,
|
|
num: self.data.peopleNum,
|
|
- mobile: 15656942279
|
|
|
|
|
|
+ mobile: self.data.mobile
|
|
}
|
|
}
|
|
const rs = await orderApi.createOrder(data)
|
|
const rs = await orderApi.createOrder(data)
|
|
- console.log(rs)
|
|
|
|
let orderId = rs.orderId;
|
|
let orderId = rs.orderId;
|
|
-
|
|
|
|
- wx.navigateTo({
|
|
|
|
- url: '../order/order?status=2&id=' + orderId,
|
|
|
|
|
|
+ wx.requestPayment({
|
|
|
|
+ timeStamp: rs.timeStamp,
|
|
|
|
+ nonceStr: rs.nonceStr,
|
|
|
|
+ package: rs.package,
|
|
|
|
+ signType: rs.signType,
|
|
|
|
+ paySign: rs.paySign,
|
|
|
|
+ success (res) {
|
|
|
|
+ console.log(res)
|
|
|
|
+ wx.navigateTo({
|
|
|
|
+ url: '../order/order?id=' + orderId,
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ fail (res) {
|
|
|
|
+ wx.navigateTo({
|
|
|
|
+ url: '../order/order?id=' + orderId,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- getMobile: function (params) {
|
|
|
|
-
|
|
|
|
|
|
+ getMobile: async function (params) {
|
|
|
|
+ console.log(params);
|
|
|
|
+ let _self = this
|
|
|
|
+ const data = {
|
|
|
|
+ encryptedData:params.detail.encryptedData,
|
|
|
|
+ iv: params.detail.iv
|
|
|
|
+ }
|
|
|
|
+ const userInfo = await app.getPhoneNumber(data)
|
|
|
|
+ console.log(userInfo)
|
|
|
|
+ let hasMobile = false
|
|
|
|
+ if (userInfo.mobile > 1) {
|
|
|
|
+ hasMobile:true
|
|
|
|
+ }
|
|
|
|
+ _self.setData({
|
|
|
|
+ hasMobile: hasMobile,
|
|
|
|
+ mobile: userInfo.mobile
|
|
|
|
+ })
|
|
},
|
|
},
|
|
|
|
|
|
onSlideChangeEnd: function (e) {
|
|
onSlideChangeEnd: function (e) {
|
|
@@ -92,6 +137,7 @@ Page({
|
|
var date = await storeApi.getStoreAppointTime(storeId);
|
|
var date = await storeApi.getStoreAppointTime(storeId);
|
|
var days = date.date;
|
|
var days = date.date;
|
|
console.log(days)
|
|
console.log(days)
|
|
|
|
+ console.log(price)
|
|
const tabs = createTimeApi.createTimeList(openTime, closeTime, days, price);
|
|
const tabs = createTimeApi.createTimeList(openTime, closeTime, days, price);
|
|
console.log(tabs)
|
|
console.log(tabs)
|
|
this.setData({
|
|
this.setData({
|
|
@@ -169,8 +215,6 @@ Page({
|
|
* 生命周期函数--监听页面显示
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
*/
|
|
onShow: async function () {
|
|
onShow: async function () {
|
|
-
|
|
|
|
- this.createTimeList();
|
|
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|