diff --git a/e_shop/.keep b/e_shop/.keep deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/e_shop/app.js b/e_shop/app.js index 1ed57c47fc86716c337dee0e196bdbbac27abfe5..cf54770e302a9164ed8547ceb158cf346a6804ac 100644 --- a/e_shop/app.js +++ b/e_shop/app.js @@ -12,6 +12,9 @@ App({ // 发送 res.code 到后台换取 openId, sessionKey, unionId } }) + wx.cloud.init({ + traceUser: true, + }) }, globalData: { userInfo: null diff --git a/e_shop/app.json b/e_shop/app.json index ac2bf5df113067e3f06ed0ea1ae13972e7c6c70d..9cc89d3863048cd048d2fcadf007ed8cab2ab300 100644 --- a/e_shop/app.json +++ b/e_shop/app.json @@ -13,7 +13,12 @@ "pages/login/login", "pages/auth/auth", "pages/pay/pay", - "pages/logs/logs" + "pages/logs/logs", + "pages/act_sk/act_sk", + "pages/act_pt/act_pt", + "pages/act_lj/act_lj", + "pages/act_kj/act_kj", + "pages/act_jf/act_jf" ], "tabBar": { "list": [{ diff --git a/e_shop/images/jf.png b/e_shop/images/jf.png new file mode 100644 index 0000000000000000000000000000000000000000..43d061131845691617e09c21c3a2bd156858feb3 Binary files /dev/null and b/e_shop/images/jf.png differ diff --git a/e_shop/images/kj.png b/e_shop/images/kj.png new file mode 100644 index 0000000000000000000000000000000000000000..db39ffac8292030182ee284e9fc7c14449b9f7bf Binary files /dev/null and b/e_shop/images/kj.png differ diff --git a/e_shop/images/logistics.png b/e_shop/images/logistics.png new file mode 100644 index 0000000000000000000000000000000000000000..024211d2589d86ed4a6ea7d183709d58ff17c108 Binary files /dev/null and b/e_shop/images/logistics.png differ diff --git a/e_shop/images/pt.png b/e_shop/images/pt.png new file mode 100644 index 0000000000000000000000000000000000000000..d7cf57cb4f9ca008a7f7a721d6b643dbb384863e Binary files /dev/null and b/e_shop/images/pt.png differ diff --git a/e_shop/images/sk.png b/e_shop/images/sk.png new file mode 100644 index 0000000000000000000000000000000000000000..4169197584f7df3c76024cb3fb398557f10974fe Binary files /dev/null and b/e_shop/images/sk.png differ diff --git a/e_shop/images/skill_image.jpg b/e_shop/images/skill_image.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a999c3304956e5310875848e4b2a01208638accc Binary files /dev/null and b/e_shop/images/skill_image.jpg differ diff --git a/e_shop/images/yhj.png b/e_shop/images/yhj.png new file mode 100644 index 0000000000000000000000000000000000000000..f7a339acb351e008eacc14fd20d2ad94d7620d99 Binary files /dev/null and b/e_shop/images/yhj.png differ diff --git a/e_shop/pages/act_sk/act_sk.js b/e_shop/pages/act_sk/act_sk.js new file mode 100644 index 0000000000000000000000000000000000000000..59ab8b0cda53f925886e52d6dd48fcd53778e9c7 --- /dev/null +++ b/e_shop/pages/act_sk/act_sk.js @@ -0,0 +1,55 @@ +const db = wx.cloud.database(); +const list = db.collection('eshop_goods'); + +Page({ + + data: { + item: 0, + tab: 0, + goods_list: [], + }, + + // 引用数据库 + conn() { + const db = wx.cloud.database({ + env: 'summer-4go5opc0610e0cc6' + }) + }, + + changeItem: function (e) { + this.setData({ + item: e.target.dataset.item + }) + }, + changeTab: function (e) { + this.setData({ + tab: e.detail.current + }) + }, + + onLoad: function (options) { + var _this = this + _this.conn(); + + // 查询商品列表 + list.get({ + success: res => { + console.log(res.data), + this.setData({ + goods_list: res.data + }) + } + }) + + }, + + + onReady: function () { + + }, + + onShow: function () { + + }, + +}) \ No newline at end of file diff --git a/e_shop/pages/act_sk/act_sk.json b/e_shop/pages/act_sk/act_sk.json new file mode 100644 index 0000000000000000000000000000000000000000..8835af0699ccec004cbe685ef938cd2d63ea7037 --- /dev/null +++ b/e_shop/pages/act_sk/act_sk.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/e_shop/pages/act_sk/act_sk.wxml b/e_shop/pages/act_sk/act_sk.wxml new file mode 100644 index 0000000000000000000000000000000000000000..8963ee4f56a8f86caf7be93b6715ff09fefa2133 --- /dev/null +++ b/e_shop/pages/act_sk/act_sk.wxml @@ -0,0 +1,65 @@ + + + 9.9元 + 99.9元 + 999.9元 + + +123456 + + + + + + + + + + + + + + {{item.title}} + {{item.price}} + + + + + + + + + + + + + + + + {{item.title}} + {{item.price}} + + + + + + + + + + + + + + + + {{item.title}} + {{item.price}} + + + + + + + + \ No newline at end of file diff --git a/e_shop/pages/act_sk/act_sk.wxss b/e_shop/pages/act_sk/act_sk.wxss new file mode 100644 index 0000000000000000000000000000000000000000..6d0c8caa1f50d722fb03799992a61c3c51ee89b2 --- /dev/null +++ b/e_shop/pages/act_sk/act_sk.wxss @@ -0,0 +1,74 @@ +page { + background-color: pink; + display: flex; + flex-direction: column; + height: 100%; +} + +.tab { + display: flex; +} + +.tab .tab-item { + flex: 1; + line-height: 60rpx; + text-align: center; + font-size: 17px; + border-bottom: 10rpx solid #eeeeee; +} + +.tab-item.active { + color: red; + border-bottom-color: red; +} + +/* 秒杀商品列表 */ +.content { + flex: 1; + height: 1290px; +} + +.content>swiper { + height: 100%; +} + +.lt { + background-color: #fff; +} + +.goods_item { + display: flex; + height: 128px; + border-bottom: 1px solid #cccccc; +} + +.goods_item .goods_img { + flex: 2; + display: flex; + justify-content: center; + align-items: center; +} + +.goods_item .goods_img image { + width: 80%; + height: 80%; +} + +.goods_item .goods_info { + flex: 3; + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.goods_item .goods_info .goods_name { + display: -webkit-box; + overflow: hidden; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; +} + +.goods_item .goods_info .goods_price { + color: red; + font-size: 32rpx; +} \ No newline at end of file diff --git a/e_shop/pages/cart/cart.js b/e_shop/pages/cart/cart.js index 41256daa635d230fa62cf953ea8de1c12db2c5c8..3a78dc5359d75828f58a66a78378d6780e4f3326 100644 --- a/e_shop/pages/cart/cart.js +++ b/e_shop/pages/cart/cart.js @@ -1,277 +1,250 @@ -Page({ - - /** - * 页面的初始数据 - */ - data: { - hasList: true, //默认展示列表数据 - //商品列表数据 - list: [{ - id: 1, - title: '园艺大师抗皱精华露', - image: '/images/瑟莉娅.jpg', - pro_name: "30ml", - num: 1, - price: 180, - selected: true - }, - { - id: 2, - title: '伊芙琳玫瑰护手霜', - image: '/images/伊蕾娜.jpg', - pro_name: "25g", - num: 1, - price: 62, - selected: true - }, - { - id: 3, - title: '燕麦山羊乳舒缓护手霜', - image: '/images/瑟莉娅.jpg', - pro_name: "75ml", - num: 1, - price: 175, - selected: true - }, - { - id: 3, - title: '燕麦山羊乳舒缓护手霜', - image: '/images/伊蕾娜.jpg', - pro_name: "75ml", - num: 1, - price: 175, - selected: true - }, - { - id: 3, - title: '燕麦山羊乳舒缓护手霜', - image: '/images/瑟莉娅.jpg', - pro_name: "75ml", - num: 1, - price: 175, - selected: true - } - ], - //金额 - totalPrice: 0, //总价,初始为0 - //全选状态 - selectAllStatus: true, // 全选状态,默认全选 - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - wx.showToast({ - title: '加载中', - icon: "loading", - duration: 1000 - }) - // 价格方法 - this.count_price(); - - }, - - /** 当前商品选中事件 */ - selectList(e) { - var that = this; - //获取选中的 radio索引 - var index = e.currentTarget.dataset.index; - //获取到商品列表数据 - var list = that.data.list; - //默认全选 - that.data.selectAllStatus = true; - //循环数组数据,判断--选中/未选中[selected] - list[index].selected = !list[index].selected; - //如果数组数据全部为selected[true],全选 - for (var i = list.length - 1; i >= 0; i--) { - if (!list[i].selected) { - that.data.selectAllStatus = false; - break; - } - } - // 重新渲染数据 - that.setData({ - list: list, - selectAllStatus: that.data.selectAllStatus - }) - // 调用计算金额方法 - that.count_price(); - }, - - // 删除 - deletes(e) { - var that = this; - // 获取索引 - const index = e.currentTarget.dataset.index; - // 获取商品列表数据 - let list = this.data.list; - wx.showModal({ - title: '提示', - content: '确认删除吗', - success: function (res) { - if (res.confirm) { - // 删除索引从1 - list.splice(index, 1); - // 页面渲染数据 - that.setData({ - list: list - }); - // 如果数据为空 - if (!list.length) { - that.setData({ - hasList: false - }); - } else { - // 调用金额渲染数据 - that.count_price(); - } - } else { - console.log(res); - } - }, - fail: function (res) { - console.log(res); - } - }) - }, - - /** 购物车全选事件 */ - selectAll(e) { - // 全选ICON默认选中 - let selectAllStatus = this.data.selectAllStatus; - // true ----- false - selectAllStatus = !selectAllStatus; - // 获取商品数据 - let list = this.data.list; - // 循环遍历判断列表中的数据是否选中 - for (let i = 0; i < list.length; i++) { - list[i].selected = selectAllStatus; - } - // 页面重新渲染 - this.setData({ - selectAllStatus: selectAllStatus, - list: list - }); - // 计算金额方法 - this.count_price(); - }, - - /** 绑定加数量事件 */ - btn_add(e) { - // 获取点击的索引 - const index = e.currentTarget.dataset.index; - // 获取商品数据 - let list = this.data.list; - // 获取商品数量 - let num = list[index].num; - // 点击递增 - num = num + 1; - list[index].num = num; - // 重新渲染 ---显示新的数量 - this.setData({ - list: list - }); - // 计算金额方法 - this.count_price(); - }, - - /** - * 绑定减数量事件 - */ - btn_minus(e) { - // // 获取点击的索引 - const index = e.currentTarget.dataset.index; - // const obj = e.currentTarget.dataset.obj; - // console.log(obj); - // 获取商品数据 - let list = this.data.list; - // 获取商品数量 - let num = list[index].num; - // 判断num小于等于1 return; 点击无效 - if (num <= 1) { - return false; - } - // else num大于1 点击减按钮 数量-- - num = num - 1; - list[index].num = num; - // 渲染页面 - this.setData({ - list: list - }); - // 调用计算金额方法 - this.count_price(); - }, - - // 提交订单 - btn_submit_order() { - var that = this; - console.log(that.data.totalPrice); - - // 调起支付 - // wx.requestPayment({ - // 'timeStamp': '', - // 'nonceStr': '', - // 'package': '', - // 'signType': 'MD5', - // 'paySign': '', - // 'success': function (res) {}, - // 'fail': function (res) {}, - // 'complete': function (res) {} - // }) - wx.requestOrderPayment({ - orderInfo: {}, - timeStamp: '', - nonceStr: '', - package: '', - signType: 'MD5', - paySign: '', - success(res) {}, - fail(res) {} - }) - wx.showModal({ - title: '提示', - content: '合计金额-' + that.data.totalPrice + "暂未开发", - }) - - // wx.showToast({ - // title: '去结算', - // icon: 'success', - // duration: 3000 - // }); - // this.setData({ - // showDialog: !this.data.showDialog - // }); - }, - - /** - * 计算总价 - */ - count_price() { - // 获取商品列表数据 - let list = this.data.list; - // 声明一个变量接收数组列表price - let total = 0; - // 循环列表得到每个数据 - for (let i = 0; i < list.length; i++) { - // 判断选中计算价格 - if (list[i].selected) { - // 所有价格加起来 count_money - total += list[i].num * list[i].price; - } - } - // 最后赋值到data中渲染到页面 - this.setData({ - list: list, - totalPrice: total.toFixed(2) - }); - }, - +Page({ + /** + * 页面的初始数据 + */ + data: { + address: {}, + //商品列表数据 + list: [], + //金额 + totalPrice: 0, //总价,初始为0 + //全选状态 + selectAllStatus: true, // 全选状态,默认全选 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + const db = wx.cloud.database({ + //这个是环境ID不是环境名称      + env: 'xcx-9gky40z1f47931bb' + }) + //开始查询数据   + db.collection('eshop_cart').get({ + //如果查询成功的话     + success: res => { + console.log(res.data) + this.setData({ + list: res.data, + totalPrice: res.data[0].num * res.data[0].price + }) + } + }) + }, + + // 点击 收货地址 + async handleChooseAddress() { + try { + // 1 获取 权限状态 + const res1 = await getSetting(); + const scopeAddress = res1.authSetting["scope.address"]; + // 2 判断 权限状态 + if (scopeAddress === false) { + await openSetting(); + } + // 4 调用获取收货地址的 api + let address = await chooseAddress(); + address.all = address.provinceName + address.cityName + address.countyName + address.detailInfo; + + // 5 存入到缓存中 + wx.setStorageSync("address", address); + console.log(address) + } catch (error) { + console.log(error); + } + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + wx.showToast({ + title: '加载中', + icon: "loading", + duration: 1000 + }) + const address = wx.getStorageSync("address"); + this.setData({ + address: address + }) + // 价格方法 + this.count_price(); + + }, + + /** 当前商品选中事件 */ + selectList(e) { + var that = this; + //获取选中的 radio索引 + var index = e.currentTarget.dataset.index; + //获取到商品列表数据 + var list = that.data.list; + //默认全选 + that.data.selectAllStatus = true; + //循环数组数据,判断--选中/未选中[selected] + list[index].selected = !list[index].selected; + //如果数组数据全部为selected[true],全选 + for (var i = list.length - 1; i >= 0; i--) { + if (!list[i].selected) { + that.data.selectAllStatus = false; + break; + } + } + // 重新渲染数据 + that.setData({ + list: list, + selectAllStatus: that.data.selectAllStatus + }) + // 调用计算金额方法 + that.count_price(); + }, + + // 删除 + deletes(e) { + var that = this; + // 获取索引 + const index = e.currentTarget.dataset.index; + // 获取商品列表数据 + let list = this.data.list; + wx.showModal({ + title: '提示', + content: '确认删除吗', + success: function (res) { + if (res.confirm) { + // 删除索引从1 + list.splice(index, 1); + // 页面渲染数据 + that.setData({ + list: list + }); + // 如果数据为空 + if (!list.length) { + that.setData({ + hasList: false + }); + } else { + // 调用金额渲染数据 + that.count_price(); + } + } else { + console.log(res); + } + }, + fail: function (res) { + console.log(res); + } + }) + }, + + /** 购物车全选事件 */ + selectAll(e) { + // 全选ICON默认选中 + let selectAllStatus = this.data.selectAllStatus; + // true ----- false + selectAllStatus = !selectAllStatus; + // 获取商品数据 + let list = this.data.list; + // 循环遍历判断列表中的数据是否选中 + for (let i = 0; i < list.length; i++) { + list[i].selected = selectAllStatus; + } + // 页面重新渲染 + this.setData({ + selectAllStatus: selectAllStatus, + list: list + }); + // 计算金额方法 + this.count_price(); + }, + + /** 绑定加数量事件 */ + btn_add(e) { + // 获取点击的索引 + const index = e.currentTarget.dataset.index; + // 获取商品数据 + let list = this.data.list; + // 获取商品数量 + let num = list[index].num; + // 点击递增 + num = num + 1; + list[index].num = num; + // 重新渲染 ---显示新的数量 + this.setData({ + list: list + }); + // 计算金额方法 + this.count_price(); + }, + + /** + * 绑定减数量事件 + */ + btn_minus(e) { + // // 获取点击的索引 + const index = e.currentTarget.dataset.index; + // const obj = e.currentTarget.dataset.obj; + // console.log(obj); + // 获取商品数据 + let list = this.data.list; + // 获取商品数量 + let num = list[index].num; + // 判断num小于等于1 return; 点击无效 + if (num <= 1) { + return false; + } + // else num大于1 点击减按钮 数量-- + num = num - 1; + list[index].num = num; + // 渲染页面 + this.setData({ + list: list + }); + // 调用计算金额方法 + this.count_price(); + }, + + // 提交订单 + btn_submit_order() { + var that = this; + console.log(that.data.totalPrice); + wx.navigateTo({ + url: '/pages/pay/pay', + }) + wx.redirectTo({ + url: '/pages/pay/pay', + }) + + var arr = wx.getStorageSync('cart') || [] + console.log(this.data.list) + arr.push(this.data.list) + wx.setStorageSync('cart', arr) + + + + }, + + /** + * 计算总价 + */ + count_price() { + // 获取商品列表数据 + let list = this.data.list; + // 声明一个变量接收数组列表price + let total = 0; + // 循环列表得到每个数据 + for (let i = 0; i < list.length; i++) { + // 判断选中计算价格 + if (list[i].selected) { + // 所有价格加起来 count_money + total += list[i].num * list[i].price; + } + } + // 最后赋值到data中渲染到页面 + this.setData({ + list: list, + totalPrice: total + }); + }, + }) \ No newline at end of file diff --git a/e_shop/pages/cart/cart.json b/e_shop/pages/cart/cart.json index 8835af0699ccec004cbe685ef938cd2d63ea7037..7f66c95396bac590908265c722b26adcad7a910e 100644 --- a/e_shop/pages/cart/cart.json +++ b/e_shop/pages/cart/cart.json @@ -1,3 +1,4 @@ -{ - "usingComponents": {} +{ + "usingComponents": {}, + "navigationBarTitleText": "购物车" } \ No newline at end of file diff --git a/e_shop/pages/cart/cart.wxml b/e_shop/pages/cart/cart.wxml index a2dfa8a550adf729dd8978e2d46c1824a8d525dc..e5d0a0c7e2c2bdf1702b7881bba6ba73ceae3cbe 100644 --- a/e_shop/pages/cart/cart.wxml +++ b/e_shop/pages/cart/cart.wxml @@ -1,77 +1,102 @@ - - - - - - - - - - - - - - - - - {{item.title}} - - - - - - 规格:{{item.pro_name}} - - - ¥{{item.price}} - - - - - - - - - {{item.num}} - - - - - - - - - - - - - - - - - - - - - - - - - 全选 - - - - - 合计:¥{{totalPrice}} - - - - 立即购买 - - - - - - - 购物车是空的哦~ + + + + + + + + + + + + + 购物车 + + + + + + + + + + + + + + + + + {{item.title}} + + + + + + 规格:{{item.pro_name}} + + + ¥{{item.price}} + + + + + + + + + {{item.num}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 全选 + + + + + 合计:¥{{totalPrice}} + + + + 立即购买 + + + + + \ No newline at end of file diff --git a/e_shop/pages/cart/cart.wxss b/e_shop/pages/cart/cart.wxss index 991c7f886b5beeafc92c36b6aa99f1e10aab35cc..4d4751af3eb8968567be869095ff9e13e8598e62 100644 --- a/e_shop/pages/cart/cart.wxss +++ b/e_shop/pages/cart/cart.wxss @@ -1,210 +1,254 @@ -page { - background-color: #eeeeee; -} - - -.order { - height: 238rpx; - background-color: #fefeff; - margin: 27rpx; - border-radius: 4rpx; - display: flex; - align-items: center; -} - -.xuanze { - width: 40rpx; - height: 40rpx; - /* background-color: darkgoldenrod; */ - border-radius: 50%; - margin: 0 11rpx; -} - -.xuanze image { - width: 100%; - height: 100%; - display: block; - border-radius: 50%; -} - -.order_img { - width: 180rpx; - height: 180rpx; -} - -.order_img image { - width: 100%; - height: 100%; - display: block; -} - -.order_text { - margin-left: 20rpx; - width: 58%; - height: 180rpx; -} - -.text_top { - display: flex; - justify-content: space-between; - align-items: center; -} - -.title { - width: 70%; - font-size: 28rpx; - color: #4b5248; - display: -webkit-box; - -webkit-box-orient: vertical; - -webkit-line-clamp: 1; - overflow: hidden; -} - -.detel { - width: 30rpx; - height: 30rpx; -} - -.detel image { - width: 100%; - height: 100%; - display: block; -} - -.size { - font-size: 24rpx; - color: #a8ada6; -} - -.text_bottom { - display: flex; - margin-top: 50rpx; - align-items: center; - justify-content: space-between; -} - -.money { - font-size: 30rpx; - color: #a5937f; -} - -.number { - display: flex; - justify-content: space-around; - align-items: center; - width: 170rpx; -} - -.reduce { - width: 46rpx; - height: 46rpx; -} - -.reduce image { - width: 100%; - height: 100%; - display: block; -} - -.numb { - font-size: 30rpx; - color: #a5937f; -} - -.add { - width: 46rpx; - height: 46rpx; -} - -.add image { - width: 100%; - height: 100%; - display: block; -} - -.tianchong { - width: 100%; - height: 200rpx; -} - -/*购买按钮*/ - -.buy { - height: 180rpx; - width: 100%; - position: fixed; - /* left: 27rpx; */ - bottom: 10rpx; - background-color: #555555f3; - /* border-radius: 4rpx; */ -} - -.buy_top { - border-bottom: 1px solid #626263; - height: 75rpx; - display: flex; - align-items: center; - justify-content: space-between; -} - -.top_left { - display: flex; - align-items: center; -} - -.left_img { - width: 37rpx; - height: 37rpx; - margin: 11rpx; -} - -.left_img image { - width: 100%; - height: 100%; - display: block; -} - -.left_name { - font-size: 24rpx; - color: #fefeff; - margin-right: 29rpx; -} - -.buy_bottom { - display: flex; - height: 104rpx; - justify-content: space-between; - align-items: center; - padding: 0rpx 30rpx 0rpx 12rpx; -} - -.buy_left { - font-size: 26rpx; - color: #fff; -} - -.buy_right { - display: flex; - align-items: center; -} - -.liji { - width: 180rpx; - height: 70rpx; - border: 2rpx solid #f8f8f8; - box-sizing: border-box; - border-radius: 4rpx; - line-height: 70rpx; - text-align: center; - font-size: 26rpx; - color: #FEFEFF; -} - -.two { - margin-left: 12rpx; -} - -.active { - background-color: #A5937F; - border: none; +page { + padding-bottom: 90rpx; + background-color: #eee; +} + +.revice_address_row .address_btn { + padding: 20rpx; +} + +.revice_address_row .address_btn button { + width: 60%; +} + +.revice_address_row .user_info_row { + display: block; + padding: 20rpx; + font-size: 34rpx; + background-color: #f0a5a3; + width: 96%; + margin: 10rpx auto; + border-radius: 10rpx; +} + +.revice_address_row .user_info_row .user_info { + flex: 5; + font-size: 36rpx; +} + +.revice_address_row .user_info_row .user_info .user_phone { + flex: 3; + width: 65%; + float: right; + text-align: right; +} + +.revice_address_row .user_info_row .user_info .user_name { + flex: 3; + width: 35%; + float: left; +} + +.cart_content .cart_title { + padding: 20rpx; + font-size: 36rpx; + color: var(--themeColor); + border-top: 1rpx solid currentColor; + border-bottom: 1rpx solid currentColor; +} + +.order { + height: 238rpx; + background-color: #fefeff; + margin: 27rpx; + border-radius: 4rpx; + display: flex; + align-items: center; +} + +.xuanze { + width: 40rpx; + height: 40rpx; + /* background-color: darkgoldenrod; */ + border-radius: 50%; + margin: 0 11rpx; +} + +.xuanze image { + width: 100%; + height: 100%; + display: block; + border-radius: 50%; +} + +.order_img { + width: 180rpx; + height: 180rpx; +} + +.order_img image { + width: 100%; + height: 100%; + display: block; +} + +.order_text { + margin-left: 20rpx; + width: 58%; + height: 180rpx; +} + +.text_top { + display: flex; + justify-content: space-between; + align-items: center; +} + +.title { + width: 70%; + font-size: 28rpx; + color: #4b5248; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; + overflow: hidden; +} + +.detel { + width: 30rpx; + height: 30rpx; +} + +.detel image { + width: 100%; + height: 100%; + display: block; +} + +.size { + font-size: 24rpx; + color: #a8ada6; +} + +.text_bottom { + display: flex; + margin-top: 50rpx; + align-items: center; + justify-content: space-between; +} + +.money { + font-size: 30rpx; + color: #a5937f; +} + +.number { + display: flex; + justify-content: space-around; + align-items: center; + width: 170rpx; +} + +.reduce { + width: 46rpx; + height: 46rpx; +} + +.reduce image { + width: 100%; + height: 100%; + display: block; +} + +.numb { + font-size: 30rpx; + color: #a5937f; +} + +.add { + width: 46rpx; + height: 46rpx; +} + +.add image { + width: 100%; + height: 100%; + display: block; +} + +.tianchong { + width: 100%; + height: 200rpx; +} + +/*购买按钮*/ + +.buy { + height: 180rpx; + width: 100%; + position: fixed; + /* left: 27rpx; */ + bottom: 10rpx; + background-color: #555555f3; + /* border-radius: 4rpx; */ +} + +.buy_top { + border-bottom: 1px solid #626263; + height: 75rpx; + display: flex; + align-items: center; + justify-content: space-between; +} + +.top_left { + display: flex; + align-items: center; +} + +.left_img { + width: 37rpx; + height: 37rpx; + margin: 11rpx; +} + +.left_img image { + width: 100%; + height: 100%; + display: block; +} + +.left_name { + font-size: 24rpx; + color: #fefeff; + margin-right: 29rpx; +} + +.buy_bottom { + display: flex; + height: 104rpx; + justify-content: space-between; + align-items: center; + padding: 0rpx 30rpx 0rpx 12rpx; +} + +.buy_left { + font-size: 26rpx; + color: #fff; +} + +.buy_right { + display: flex; + align-items: center; +} + +.liji { + width: 180rpx; + height: 70rpx; + border: 2rpx solid #f8f8f8; + box-sizing: border-box; + border-radius: 4rpx; + line-height: 70rpx; + text-align: center; + font-size: 26rpx; + color: #FEFEFF; +} + +.two { + margin-left: 12rpx; +} + +.active { + background-color: #A5937F; + border: none; } \ No newline at end of file diff --git a/e_shop/pages/index/index.js b/e_shop/pages/index/index.js index 3facff02b2e596ac8b596eaa2b101c15699f49ad..2d9f9dc19eb70e977124b6c151a207dd1553bb21 100644 --- a/e_shop/pages/index/index.js +++ b/e_shop/pages/index/index.js @@ -1,66 +1,53 @@ -// pages/index/index.js -Page({ - - /** - * 页面的初始数据 - */ - data: { - - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - } +const db = wx.cloud.database(); +const count = db.collection('image'); +// const bars = db.collection('bar'); +const list = db.collection('eshop_goods'); +Page({ + data: { + banner: [], + // bar: [], + goods_list: [], + }, + //引用数据库 + conn() { + const db = wx.cloud.database({ + env: 'summer-4go5opc0610e0cc6' + }) + }, + + onLoad: function (options) { + var _this = this + _this.conn(); + + //开始查询轮播图数据 + count.get({ + success: res => { + // console.log(res.data), + this.setData({ + banner: res.data + }) + } + }) + + // 查询导航栏数据 + // bars.get({ + // success: res => { + // // console.log(res.data) + // this.setData({ + // bar: res.data + // }) + // } + // }) + + // 查询商品列表 + list.get({ + success: res => { + // console.log(res.data), + this.setData({ + goods_list: res.data + }) + } + }) + }, + }) \ No newline at end of file diff --git a/e_shop/pages/index/index.wxml b/e_shop/pages/index/index.wxml index a7772aa8a1d53844c59e3abdd029ff70a821c8b3..bd53fe3696da867acf4ed433117bcbbc4a8b3c14 100644 --- a/e_shop/pages/index/index.wxml +++ b/e_shop/pages/index/index.wxml @@ -1,2 +1,48 @@ - -pages/index/index.wxml + + + + + + + + + + + + + + 秒杀 + + + + 拼团 + + + + 领券 + + + + 砍价 + + + + 积分 + + + + + + + + + + + + + + {{item.title}} + {{item.price}} + + + \ No newline at end of file diff --git a/e_shop/pages/index/index.wxss b/e_shop/pages/index/index.wxss index 8e9c81f44fcb0d5df8d2f0b3f049ea01aa9e29ae..40c134f9c6634f97cd26f4080ea56e27aa4ca5e1 100644 --- a/e_shop/pages/index/index.wxss +++ b/e_shop/pages/index/index.wxss @@ -1 +1,75 @@ -/* pages/index/index.wxss */ \ No newline at end of file +page { + background-color: #eeeeee; +} + +/* 轮播图 */ +.sk_image image { + height: 350rpx; + width: 100%; +} + +/* 导航栏 */ +.sk_bar { + display: flex; + margin-top: 10rpx; + background-color: white; + border-radius: 20rpx; +} + +.sk_bar navigator { + width: 33.33%; + text-align: center; + font-size: 16px; + color: #999999; + margin: 15rpx 0; +} + +.sk_bar image { + height: 100rpx; + width: 100rpx; + display: block; + margin: 15rpx auto; +} + +/* 商品列表 */ +.lt { + margin-top: 10rpx; + background-color: #fff; +} + +.goods_item { + display: flex; + height: 128px; + border-bottom: 1px solid #cccccc; +} + +.goods_item .goods_img { + flex: 2; + display: flex; + justify-content: center; + align-items: center; +} + +.goods_item .goods_img image { + width: 80%; + height: 80%; +} + +.goods_item .goods_info { + flex: 3; + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.goods_item .goods_info .goods_name { + display: -webkit-box; + overflow: hidden; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; +} + +.goods_item .goods_info .goods_price { + color: red; + font-size: 32rpx; +} \ No newline at end of file diff --git a/e_shop/pages/pay/pay.js b/e_shop/pages/pay/pay.js index 1ffa189ec0ca07a6fca2fbad3c6af445dda7139b..612c9cfc0b24fe328bee3be8b1faa5d77919dc48 100644 --- a/e_shop/pages/pay/pay.js +++ b/e_shop/pages/pay/pay.js @@ -5,14 +5,72 @@ Page({ * 页面的初始数据 */ data: { - + address: {}, + list: [], + // title: null, + // image: null, + // price: 0, + // num: 0, + // totalPrice: 0 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { + // const db = wx.cloud.database({ + // //这个是环境ID不是环境名称      + // env: 'xcx-9gky40z1f47931bb' + // }) + // //开始查询数据   + // db.collection('eshop_cart').get({ + // //如果查询成功的话     + // success: res => { + // console.log(res.data) + // this.setData({ + // title: res.data[0].title, + // image: res.data[0].image, + // price: res.data[0].price, + // num: res.data[0].num, + // totalPrice: res.data[0].num * res.data[0].price + // }) + // } + // }) + + var list = wx.getStorageSync('cart') || [] + console.log(list[0]) + this.setData({ + list: list[0] + }) + this.num() + }, + handleOrderPay() { + wx.navigateTo({ + url: '/pages/order/order', + }) + wx.redirectTo({ + url: '/pages/order/order', + }) + + var arr = wx.getStorageSync('pay') || [] + console.log(this.data.list) + arr.push(this.data.list) + wx.setStorageSync('pay', arr) + }, + num(e) { + let list = this.data.list + let num = 0 + let totalPrice = 0 + for (let i = 0; i < list.length; i++) { + num += list[i].num + totalPrice += list[i].price + } + + this.setData({ + num: num, + totalPrice: totalPrice + }) }, /** @@ -26,7 +84,10 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - + const address = wx.getStorageSync("address"); + this.setData({ + address: address + }) }, /** diff --git a/e_shop/pages/pay/pay.json b/e_shop/pages/pay/pay.json index 8835af0699ccec004cbe685ef938cd2d63ea7037..19fa411a7cbf2d47a125937214093506935502d5 100644 --- a/e_shop/pages/pay/pay.json +++ b/e_shop/pages/pay/pay.json @@ -1,3 +1,4 @@ { - "usingComponents": {} + "usingComponents": {}, + "navigationBarTitleText": "订单支付" } \ No newline at end of file diff --git a/e_shop/pages/pay/pay.wxml b/e_shop/pages/pay/pay.wxml index 3b03e7d988881966178b398fa20da424ab62878b..3d908b01e1bbb5b870cb5f10d1ac9439d368aed1 100644 --- a/e_shop/pages/pay/pay.wxml +++ b/e_shop/pages/pay/pay.wxml @@ -1,2 +1,48 @@ - -pages/pay/pay.wxml + + + + + + + + + 购物车 + + + + + + {{item.title}} + + ¥{{item.price}} + + X {{item.num}} + + + + + + + + + + + 取消订单 + + + + + 合计: ¥{{totalPrice}} + + 包含运费 + + + 支付({{num}}) + + \ No newline at end of file diff --git a/e_shop/pages/pay/pay.wxss b/e_shop/pages/pay/pay.wxss index ac5f642109bc53c490742b2bb8a21d2b02aa208f..af362c30c0fa60d61c8bed0a18afa3fa1641b77e 100644 --- a/e_shop/pages/pay/pay.wxss +++ b/e_shop/pages/pay/pay.wxss @@ -1 +1,146 @@ -/* pages/pay/pay.wxss */ \ No newline at end of file +page { + padding-bottom: 90rpx; +} + +.revice_address_row .address_btn { + padding: 20rpx; +} + +.revice_address_row .address_btn button { + width: 60%; +} + +.revice_address_row .user_info_row { + display: block; + padding: 20rpx; + font-size: 34rpx; + background-color: #f0a5a3; + width: 96%; + margin: 10rpx auto; + border-radius: 10rpx; +} + +.revice_address_row .user_info_row .user_info { + flex: 5; + font-size: 36rpx; +} + +.revice_address_row .user_info_row .user_info .user_phone { + flex: 3; + width: 65%; + float: right; + text-align: right; +} + +.revice_address_row .user_info_row .user_info .user_name { + flex: 3; + width: 35%; + float: left; +} + +.cart_content .cart_title { + padding: 20rpx; + font-size: 36rpx; + color: var(--themeColor); + border-top: 1rpx solid currentColor; + border-bottom: 1rpx solid currentColor; +} + +.cart_content .cart_item { + display: flex; + padding: 10rpx; + border-bottom: 1rpx solid #ccc; +} + +.cart_content .cart_item .cart_img_wrap { + flex: 2; + display: flex; + justify-content: center; + align-items: center; +} + +.cart_content .cart_item .cart_img_wrap image { + width: 80%; +} + +.cart_content .cart_item .cart_info_wrap { + flex: 4; + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.cart_content .cart_item .cart_info_wrap .goods_name { + display: -webkit-box; + overflow: hidden; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + color: #666; +} + +.cart_content .cart_item .cart_info_wrap .goods_price_wrap { + display: flex; + justify-content: space-between; +} + +.cart_content .cart_item .cart_info_wrap .goods_price_wrap .goods_price { + color: var(--themeColor); + font-size: 34rpx; +} + +.cart_content .cart_item .cart_info_wrap .goods_price_wrap .cart_num_tool { + display: flex; +} + +.cart_content .cart_item .cart_info_wrap .goods_price_wrap .cart_num_tool .goods_num { + width: 55rpx; + height: 55rpx; + display: flex; + justify-content: center; + align-items: center; +} + +.footer_tool { + position: fixed; + bottom: 0; + left: 0; + width: 100%; + height: 90rpx; + background-color: #fff; + display: flex; + border-top: 1rpx solid #ccc; +} + +.footer_tool .total_price_wrap { + flex: 5; + padding-right: 15rpx; + text-align: right; +} + +.footer_tool .total_price_wrap .total_price .total_price_text { + color: var(--themeColor); + font-size: 34rpx; + font-weight: 600; +} + +.footer_tool .order_pay_wrap { + flex: 3; + background-color: var(--themeColor); + color: #fff; + font-size: 32rpx; + font-weight: 600; + display: flex; + justify-content: center; + align-items: center; +} + +.footer_tool .order_pay_cancle { + flex: 3; + background-color: var(--themeColor); + color: #fff; + font-size: 32rpx; + font-weight: 600; + display: flex; + justify-content: center; + align-items: center; +} \ No newline at end of file diff --git a/e_shop/project.private.config.json b/e_shop/project.private.config.json new file mode 100644 index 0000000000000000000000000000000000000000..a1bbda0f347c6b177e82248bf3644dc378a93d9e --- /dev/null +++ b/e_shop/project.private.config.json @@ -0,0 +1,36 @@ +{ + "setting": {}, + "condition": { + "plugin": { + "list": [] + }, + "game": { + "list": [] + }, + "gamePlugin": { + "list": [] + }, + "miniprogram": { + "list": [ + { + "name": "pages/goods_detail/goods_detail", + "pathName": "pages/goods_detail/goods_detail", + "query": "", + "scene": null + }, + { + "name": "pages/cart/cart", + "pathName": "pages/cart/cart", + "query": "", + "scene": null + }, + { + "name": "pages/pay/pay", + "pathName": "pages/pay/pay", + "query": "", + "scene": null + } + ] + } + } +} \ No newline at end of file