master
wbb 3 years ago
parent 56646892c7
commit 3602f7d731

@ -9,7 +9,8 @@
"pages/detail/detail", "pages/detail/detail",
"pages/searchShow/searchShow", "pages/searchShow/searchShow",
"pages/change/change", "pages/change/change",
"pages/answer/answer" "pages/answer/answer",
"pages/orderdoing/orderdoing"
], ],
"tabBar": { "tabBar": {

@ -1,11 +1,18 @@
// pages/cart/cart.js // pages/cart/cart.js
const db = wx.cloud.database({});
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
cartlist:[] cartlistsee:[]
},
async f() {
const res = await db.collection('user').doc('eda7dd506371adb300c89bc66afc4601').get();
console.log(res);
}, },
/** /**
@ -18,7 +25,7 @@ Page({
env: 'cloud1-8g5wmepxce8a3b8a' env: 'cloud1-8g5wmepxce8a3b8a'
}) })
//2、开始查询数据了 news对应的是集合的名称 //2、开始查询数据了 news对应的是集合的名称
db.collection('user').doc('aa9355ef636df7cc004ab37533cb2c96').get({ db.collection('user').doc('eda7dd506371adb300c89bc66afc4601').get({
//如果查询成功的话 //如果查询成功的话
success: res => { success: res => {
console.log(res.data) console.log(res.data)

@ -1,2 +1,2 @@
<!--pages/cart/cart.wxml--> <!--pages/cart/cart.wxml-->
<view>{{cartlist.cartlist}}</view> <view catchtap="f">测试</view>

@ -35,7 +35,7 @@ Page({
// 渲染数据 // 渲染数据
async addCar(event) { async addCar(event) {
var detailObj= event.currentTarget.dataset.item; var detailObj= event.currentTarget.dataset.item;
db.collection('user').doc('aa9355ef636df7cc004ab37533cb2c96').update({ db.collection('user').doc('eda7dd506371adb300c89bc66afc4601').update({
data:{ data:{
cartlist:db.command.push(detailObj) cartlist:db.command.push(detailObj)
} }
@ -46,9 +46,13 @@ async addCar(event) {
duration: 2000 duration: 2000
}) })
}, },
async immeBuy(event){
var index = event.currentTarget.dataset.item;
console.log(index);
wx.navigateTo({
url:'/pages/orderdoing/orderdoing?id='+ index,
})
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */

@ -16,5 +16,5 @@
<view class="separate"></view> <view class="separate"></view>
<view class="detail-nav" > <view class="detail-nav" >
<button class="button-green" catchtap="addCar" formType="submit" data-item="{{detailObj}}">加入购物车</button> <button class="button-green" catchtap="addCar" formType="submit" data-item="{{detailObj}}">加入购物车</button>
<button class="button-red" bindtap="immeBuy" formType="submit">立即购买</button> <button class="button-red" bindtap="immeBuy" data-item="{{detailObj._id}}" formType="submit">立即购买</button>
</view> </view>

@ -0,0 +1,77 @@
// pages/orderdoing/orderdoing.js
const db = wx.cloud.database({});
const cont = db.collection('food');
Page({
/**
* 页面的初始数据
*/
data: {
orderfood:[]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad:function(options) {
let foodid =options.id
cont.doc(foodid).get({
success: res => {
console.log(res.data)
//这一步很重要给ne赋值没有这一步的话前台就不会显示值
this.setData({
orderfood: res.data
})
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

@ -0,0 +1,6 @@
<view>干饭地址:</view>
<image src="{{orderfood.url}}"></image>
<view>{{orderfood.food_name}}</view>
<button bindtap="primary" style="background-color: rgb(253, 228, 84);">立即支付</button>

@ -0,0 +1 @@
/* pages/orderdoing/orderdoing.wxss */

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

@ -0,0 +1,58 @@
<view class="view_contain">
<!-- 第一部分 -->
<view class="view_1">
<view class="view_image_text">
<image class="image_radius" src="../images/timg.png" />
<text>张三</text>
</view>
</view>
<!-- 第二部分 -->
<view class="view_2">
<view class="view_tupianwenzi">
<image class="image_tupian" src="../images/test1.png"></image>
<text class="text_saoyisao">待付款</text>
</view>
<view class="view_tupianwenzi">
<image class="image_tupian" src="../images/test2.png"></image>
<text class="text_saoyisao">待发货</text>
</view>
<view class="view_tupianwenzi">
<image class="image_tupian" src="../images/test3.png"></image>
<text class="text_saoyisao">待收货</text>
</view>
<view class="view_tupianwenzi">
<image class="image_tupian" src="../images/test4.png"></image>
<text class="text_saoyisao">待评价</text>
</view>
</view>
<!-- 第三部分 -->
<view class="view_3">
<view class="list-item">
<image class="item-image" src="../images/test5.png"></image>
<text class="item-text">我的收藏</text>
<image class="image-jiantou" src="../images/jiantou.png"></image>
</view>
<view class="line"></view>
<view class="list-item">
<image class="item-image" src="../images/test6.png"></image>
<text class="item-text">我的评价</text>
<image class="image-jiantou" src="../images/jiantou.png"></image>
</view>
<view class="line"></view>
<view class="line"></view>
<view class="list-item">
<image class="item-image" src="../images/test9.png"></image>
<text class="item-text">售后记录</text>
<image class="image-jiantou" src="../images/jiantou.png"></image>
</view>
<view class="line"></view>
<view class="list-item">
<image class="item-image" src="../images/test12.png"></image>
<text class="item-text">分享邀请</text>
<image class="image-jiantou" src="../images/jiantou.png"></image>
</view>
<view class="line"></view>
</view>
</view>

@ -1,83 +1,110 @@
/* pages/mine/mine.wxss */ page {
.userinfo {
display: flex;
flex-direction: column;
align-items: center;
background: #eb6161;
width: 100%; width: 100%;
height: 300rpx; height: 100%;
} }
.userinfo-avatar { .view_contain {
width: 128rpx; width: 100%;
height: 128rpx; height: 100%;
margin: 20rpx; background: #f0eeed
border-radius: 50%;
} }
.userinfo-nickname { /* 第一部分 */
color: black;
.view_1 {
display: flex;
justify-content: center;
width: 100%;
height: 25%;
background: #a0deee;
} }
.header { .view_image_text {
margin: 90rpx 0 90rpx 50rpx; width: 100%;
border-bottom: 1px solid #ccc; display: flex;
text-align: center; align-items: center;
width: 650rpx; justify-content: center;
height: 300rpx; flex-direction: column;
line-height: 450rpx;
} }
.header image { .image_radius {
width: 200rpx; height: 50px;
height: 200rpx; width: 50px;
border-radius: 30px;
} }
.content { /* 第二部分 */
margin-left: 50rpx;
margin-bottom: 90rpx; .view_2 {
width: 100%;
height: 15%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
background: white;
} }
.content text { .view_tupianwenzi {
display: block; display: flex;
color: #9d9d9d; flex-direction: column;
margin-top: 40rpx; width: 120rpx;
align-items: center;
margin-left: 25rpx;
margin-right: 25rpx;
} }
.bottom { .image_tupian {
border-radius: 80rpx; display: flex;
margin: 70rpx 50rpx; width: 100rpx;
font-size: 35rpx; height: 100rpx;
} }
/* 用户中心 */ /* 第三部分 */
.hr { .view_3 {
width: 100%; width: 100%;
height: 15px; height: 50%;
background-color: #f4f5f6; /* background: #f0eeed; */
} }
.item {
.list-item {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center;
width: 100%;
height: 80rpx;
margin-top: 20rpx;
position: relative; /*父元素位置要设置为相对*/
background: white;
} }
.title {
padding-top: 15px; .item-image {
padding-bottom: 15px; width: 50rpx;
padding-left: 15px; height: 50rpx;
font-size: 15px; margin: 20rpx;
} }
.detail2 { .item-text {
font-size: 15px; color: gray;
position: absolute; font-size: 35rpx;
right: 10px; margin-left: 20rpx;
height: 50px; }
line-height: 50px;
color: #888; .image-jiantou {
width: 20rpx;
height: 35rpx;
position: absolute; /* 要约束所在位置的子元素的位置要设置成绝对 */
right: 0; /* 靠右调节 */
margin-right: 35rpx;
} }
/* 黑线 使得产生阴影效果 */
.line { .line {
border: 1px solid #ccc; width: 100%;
opacity: 0.2; height: 3rpx;
background: lightgray;
margin-left: 90rpx;
} }

Loading…
Cancel
Save