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.
141 lines
2.4 KiB
141 lines
2.4 KiB
// pages/paying/paying.js
|
|
const db = wx.cloud.database({});
|
|
const app=getApp()
|
|
const userid=app.globalData.openid
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
showPayPwdInput: false, //是否展示密码输入层
|
|
pwdVal: '', //输入的密码
|
|
payFocus: true, //文本框焦点
|
|
addresslist:[],
|
|
buylist:[],
|
|
orderlist:{},
|
|
totalprice:0
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options) {
|
|
console.log(options.totalprice)
|
|
console.log(JSON.parse(options.info))
|
|
var buylist=JSON.parse(options.info)
|
|
this.setData({
|
|
buylist:buylist,
|
|
totalprice:options.totalprice
|
|
})
|
|
console.log(buylist)
|
|
|
|
db.collection("user")
|
|
.where({
|
|
"_openid":userid
|
|
})
|
|
.get()
|
|
.then(res => {
|
|
console.log("地址", res.data);
|
|
console.log(res.data[0].address)
|
|
//再次显示数据
|
|
this.setData({
|
|
addresslist:res.data[0].address
|
|
})
|
|
})
|
|
|
|
},
|
|
/**
|
|
* 显示支付密码输入层
|
|
*/
|
|
showInputLayer(){
|
|
this.setData({ showPayPwdInput: true, payFocus: true });
|
|
},
|
|
/**
|
|
* 隐藏支付密码输入层
|
|
*/
|
|
hidePayLayer(){
|
|
/**获取输入的密码**/
|
|
var val = this.data.pwdVal;
|
|
/**在这调用支付接口**/
|
|
this.setData({ showPayPwdInput: false, payFocus: false, pwdVal: '' }, );
|
|
|
|
},
|
|
/**
|
|
* 获取焦点
|
|
*/
|
|
getFocus(){
|
|
this.setData({ payFocus: true });
|
|
},
|
|
/**
|
|
* 输入密码监听
|
|
*/
|
|
inputPwd(e){
|
|
this.setData({ pwdVal: e.detail.value });
|
|
|
|
if (e.detail.value.length >= 6){
|
|
this.hidePayLayer();
|
|
wx.showModal({
|
|
title:'支付成功',
|
|
success: (res) => {
|
|
if (res.confirm) {
|
|
wx.navigateTo({
|
|
url:'/pages/orderdetail/orderdetail'
|
|
})
|
|
}
|
|
}
|
|
})}
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage() {
|
|
|
|
}
|
|
}) |