确认订单

master
wbb 2 years ago
parent 7f1a3d870b
commit 326cb959a5

@ -15,8 +15,8 @@ Page({
good_one: [], //单个商品的数据 good_one: [], //单个商品的数据
checked: false, //是否为全选 checked: false, //是否为全选
is_shop: false, //是否有商品 is_shop: false, //是否有商品
shopData: null shopData: null,
Selection:{}
}, },
/**点击单个多选框 */ /**点击单个多选框 */
@ -79,15 +79,27 @@ setChecked: function() {
this.data.good_one = []; //重置数组 this.data.good_one = []; //重置数组
for (var i = 0; i < this.data.cartlistsee.length; i++) { //循环购物车中的商品 for (var i = 0; i < this.data.cartlistsee.length; i++) { //循环购物车中的商品
if (good[i].checks == true) { if (good[i].checks == true) {
var good_one1 = [good[i].cart_id, good[i].num]; var Selection=[]
this.data.good_one.push(good_one1) //将数据添加到数组里边 var good_one1 = {}
good_one1._id=good[i]._id
good_one1.url=good[i].url
good_one1.food_name=good[i].food_name
good_one1.food_shop=good[i].food_shop
good_one1.price=good[i].price
good_one1.num=good[i].num
Selection.push(good_one1)
this.setData({
Selection:Selection
})
//将数据添加到数组里边
wx.navigateTo({
url:'/pages/paying/paying?info='+JSON.stringify(Selection),
})
} }
}}}, }}},
topay: function(){ topay: function(){
wx.navigateTo({
url:'/pages/paying/paying',
})
}, },
// 添加按钮被点击 // 添加按钮被点击

@ -35,7 +35,7 @@
<text class='price'>合计:</text> <text class='price'>合计:</text>
<text class='all_shop_price'>¥{{total_all_price}}</text> <text class='all_shop_price'>¥{{total_all_price}}</text>
</view> </view>
<view class='jiesuan' bindtap="topay"> <view class='jiesuan' bindtap="toBuy">
<text>结算</text> <text>结算</text>
</view> </view>
</view> </view>

@ -1,66 +0,0 @@
// pages/pay/pay.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

@ -1,2 +0,0 @@
<!--pages/pay/pay.wxml-->
<text>pages/pay/pay.wxml</text>

@ -1,4 +1,7 @@
// pages/paying/paying.js // pages/paying/paying.js
const db = wx.cloud.database({});
const app=getApp()
const userid=app.globalData.openid
Page({ Page({
/** /**
@ -8,13 +11,36 @@ Page({
showPayPwdInput: false, //是否展示密码输入层 showPayPwdInput: false, //是否展示密码输入层
pwdVal: '', //输入的密码 pwdVal: '', //输入的密码
payFocus: true, //文本框焦点 payFocus: true, //文本框焦点
addresslist:[],
buylist:[],
orderlist:{}
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
this.showInputLayer(); console.log(JSON.parse(options.info))
var buylist=JSON.parse(options.info)
this.setData({
buylist:buylist
})
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
})
})
}, },
/** /**
* 显示支付密码输入层 * 显示支付密码输入层
@ -29,12 +55,7 @@ Page({
/**获取输入的密码**/ /**获取输入的密码**/
var val = this.data.pwdVal; var val = this.data.pwdVal;
/**在这调用支付接口**/ /**在这调用支付接口**/
this.setData({ showPayPwdInput: false, payFocus: false, pwdVal: '' }, function(){ this.setData({ showPayPwdInput: false, payFocus: false, pwdVal: '' }, );
/**弹框**/
wx.showToast({
title: val,
})
});
}, },
/** /**
@ -51,10 +72,20 @@ Page({
if (e.detail.value.length >= 6){ if (e.detail.value.length >= 6){
this.hidePayLayer(); this.hidePayLayer();
wx.showModal({
title:'支付成功',
success: (res) => {
if (res.confirm) {
wx.navigateTo({
url:'/pages/orderdetail/orderdetail'
})
} }
}
})}
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */

@ -1,5 +1,62 @@
<!--pages/paying/paying.wxml-->
<text>pages/paying/paying.wxml</text> <template is="navigationBar" data="{{...item}}"></template>
<view class="order_address" bindtap="bindaddress">
<view class="select_address"><text class="iconfont icon-map_line-"></text>点击去选择地址</view>
<view><text class="iconfont icon-arrowright"></text></view>
</view>
<view class="Receiving_address" bindtap="bindaddress">
<view wx:for="{{addresslist}}">
<text>{{item.address}}</text>
<text>{{item.detailedAddress}}</text>
</view>
<view><text class="iconfont icon-arrowright"></text></view>
</view>
<view>
<!-- 取餐时间 -->
<view class="top-bar">
<label class="top-left-label">请确认您的订单</label>
</view>
<!-- 订单详情 -->
<view class="order-info">
<view class="order-info-title">订单详情</view>
<view class="cart-list-box" wx:for="{{buylist}}" wx:for-item="item" wx:key="list">
<view class="list-info">
<image src="{{item.url}}"></image>
<view>{{item.food_name}}</view>
</view>
<view style="width:50%;padding:10px;">
<view style="float:right">
<view style="color:#A3A3A3">x {{item.num}}</view>
<view>¥ {{item.price}}</view>
</view>
</view>
</view>
<view class="order-cut" wx:if="{{order.promotion.length > 0}}">
<label class="order-cut-dec">减</label>
<label class="order-cut-note">{{order.promotion.name}}</label>
<label class="order-cut-number activity-color">-¥ {{order.promotion.discount}}</label>
</view>
<view class="order-sum">
<label>总计 </label>
<label class="order-sum-number activity-color">¥ {{sumMonney-cutMonney}}</label>
</view>
</view>
<!-- 备注 -->
<view class="note">
<label style="font-size:13px;color:#A3A3A3">备注</label>
<textarea maxlength="{{max}}" placeholder="如有其他要求,请输入备注" bindinput="listenerTextarea" class="note-text">{{note}}</textarea>
</view>
<!-- 去支付 -->
</view>
<!-- 支付操作 -->
<view catchtap='showInputLayer' class="btn_pay">立即支付</view> <view catchtap='showInputLayer' class="btn_pay">立即支付</view>
<!-- 密码输入框 --> <!-- 密码输入框 -->
<view wx:if='{{showPayPwdInput}}'> <view wx:if='{{showPayPwdInput}}'>

@ -54,3 +54,57 @@
.input_control { .input_control {
position: relative; left: -300rpx; bottom: 0; width: 100rpx; height: 100rpx; position: relative; left: -300rpx; bottom: 0; width: 100rpx; height: 100rpx;
} }
/* 备注 */
.note{
padding:5px 15px;
background:white;
margin-top:10px
}
.note-text{
width:95%;
font-size:12px;
background:#F2F2F2;
padding:10px;
height:80px;
}
/* 取餐时间区域 */
.top-bar {
height: 30px;
line-height: 30px;
font-size: 14px;
background: white;
padding:0 5px;
}
.top-left-label {
float: left;
}
/* 底部操作菜单样式 */
.bottom-operate-menu {
z-index: 1001;
position: fixed;
bottom: 0px;
height: 55px;
width: 100%;
display: flex;
}
.shopping-cart {
width: 75%;
background: #353535;
height: 100%;
}
.submit-btn-label {
color: white;
font-size: 15px;
margin: auto;
}
.submit-btn {
height: 100%;
background: #f7f7f7;
width: 25%;
display: flex;
}
.activity-color-bg {
background: #ff9c35;
}

Loading…
Cancel
Save