From 800e343dd0e6255d53b84d3cd980ab680cb669e9 Mon Sep 17 00:00:00 2001 From: chenkainan Date: Fri, 29 Jul 2022 10:32:04 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 2 +- app.wxss | 2 +- pages/index/index.js | 1 + pages/info/museumInfo/index.wxss | 1 + pages/info/postProductInfo/index.js | 1 + pages/info/postProductInfo/index.wxml | 2 +- pages/info/sceneProductInfo/index.js | 167 ++++++++++++++-- pages/info/sceneProductInfo/index.wxml | 59 +++++- pages/info/sceneProductInfo/index.wxss | 265 ++++++++++++++++++++++++- pages/user/cartlist/list.js | 7 +- pages/user/cartlist/list.wxml | 2 +- 11 files changed, 482 insertions(+), 27 deletions(-) diff --git a/app.js b/app.js index 6ddb996..c5cd544 100644 --- a/app.js +++ b/app.js @@ -22,7 +22,7 @@ App({ unique_key: "wechatxcx" }).then(res => { let data = JSON.parse(res.data); - data.isTest = data.isTest29?true:false; + data.isTest = data.isTest30?true:false; this.globalData.configJson = data }) diff --git a/app.wxss b/app.wxss index 960acbe..6469318 100644 --- a/app.wxss +++ b/app.wxss @@ -31,7 +31,7 @@ page{ position: relative; z-index: 1; width: 80%; - max-height: 100%; + max-height: 1000rpx; background: white; border-radius: 12rpx; overflow-y: auto; diff --git a/pages/index/index.js b/pages/index/index.js index 9e70108..bfadf57 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -248,6 +248,7 @@ Page({ util.gotoDetail(item) }, gotoPath: function (e) { + console.log(e) if (e.currentTarget.dataset.event) { this.pagePoint({ event: e.currentTarget.dataset.event }, 1) } diff --git a/pages/info/museumInfo/index.wxss b/pages/info/museumInfo/index.wxss index b1f467c..5b7184c 100644 --- a/pages/info/museumInfo/index.wxss +++ b/pages/info/museumInfo/index.wxss @@ -70,6 +70,7 @@ display: flex; align-items: center; justify-content: space-around; + z-index: 3; } .fixed-btn .btn { diff --git a/pages/info/postProductInfo/index.js b/pages/info/postProductInfo/index.js index f5a2632..8aed12b 100644 --- a/pages/info/postProductInfo/index.js +++ b/pages/info/postProductInfo/index.js @@ -45,6 +45,7 @@ Page({ }) // 获取购物车按钮的位置 wx.createSelectorQuery().select('#cart').boundingClientRect(function (res) { + console.log(res) that.setData({ cartTop: res.top }) diff --git a/pages/info/postProductInfo/index.wxml b/pages/info/postProductInfo/index.wxml index 595326b..7166da8 100644 --- a/pages/info/postProductInfo/index.wxml +++ b/pages/info/postProductInfo/index.wxml @@ -3,7 +3,7 @@ + class="headimg{{aniSkuIndex==index?' active':''}}" src="{{info.headimg}}" mode="aspectFill"> diff --git a/pages/info/sceneProductInfo/index.js b/pages/info/sceneProductInfo/index.js index 0e12985..1cd11a6 100644 --- a/pages/info/sceneProductInfo/index.js +++ b/pages/info/sceneProductInfo/index.js @@ -24,6 +24,14 @@ Page({ showShareFlag: false, showAllowance: false, allowance_data:null, + //购物车数量 + producNum: 1, + skuIndex: 0, + aniSkuIndex: -1, + cartCount: 0, + cartImgInfo: null, + cartTop: 0, + top: 0 }, /** @@ -155,7 +163,6 @@ Page({ scene_id: id }).then(res => { if (res.code == 1) { - console.log(isLike) wx.showToast({ title: '操作成功', }) @@ -197,24 +204,83 @@ Page({ }) }, order: function (e) { - if (e.currentTarget.dataset.disable == 1) return; - util.pagePoint({ - event: 'scene_order', - param: { - type: this.data.info.type, - id: this.data.info.id - } - }, 1) - wx.setStorageSync('login_from', 'scene_order_login') - wx.setStorageSync('order_from', 'scene_order_submit') - app.globalData.couponInfo = null; - app.globalData.retailId = this.data.retailId; - // let sku = e.currentTarget.dataset.sku,product = e.currentTarget.dataset.product; - app.globalData.product = e.currentTarget.dataset; - wx.navigateTo({ - url: '/pages/order/scene/index', - }) + console.log(this.data.info,this.data.skuFlag) + if (e.currentTarget.dataset.disable == 1) return; + util.pagePoint({ + event: 'scene_order', + param: { + type: this.data.info.type, + id: this.data.info.id + } + }, 1) + wx.setStorageSync('login_from', 'scene_order_login') + wx.setStorageSync('order_from', 'scene_order_submit') + app.globalData.couponInfo = null; + app.globalData.retailId = this.data.retailId; + // let sku = e.currentTarget.dataset.sku,product = e.currentTarget.dataset.product; + app.globalData.product = e.currentTarget.dataset; + wx.navigateTo({ + url: '/pages/order/scene/index', + }) }, + // order: function (e) { + // console.log(this.data.info,this.data.skuFlag) + // if (this.data.skuFlag == 'order'){ + // if (e.currentTarget.dataset.disable == 1) return; + // util.pagePoint({ + // event: 'scene_order', + // param: { + // type: this.data.info.type, + // id: this.data.info.id + // } + // }, 1) + // wx.setStorageSync('login_from', 'scene_order_login') + // wx.setStorageSync('order_from', 'scene_order_submit') + // app.globalData.couponInfo = null; + // app.globalData.retailId = this.data.retailId; + // // let sku = e.currentTarget.dataset.sku,product = e.currentTarget.dataset.product; + // app.globalData.product = e.currentTarget.dataset; + // wx.navigateTo({ + // url: '/pages/order/scene/index', + // }) + // }else { + // commonApi.user_post("cart/add_sku", { + // sku_id: this.data.info.product[0].sku[this.data.skuIndex].id, + // num: this.data.producNum + // }).then(res => { + // if (res.code == 1) { + // commonApi.user_post('cart/get_list', {}).then(res => { + // this.setData({ + // cartCount: res.data.length + // }) + // }) + // // 加动效 + // console.log(this.data.skuIndex) + // this.setData({ + // skuFlag: null, + // aniSkuIndex: this.data.skuIndex, + // cartImgInfo: null + // }) + // setTimeout(() => { + // this.setData({ + // aniSkuIndex: -1 + // }) + // wx.showModal({ + // title: "提示", + // content: "去购物车结算?", + // success: function (res) { + // if (res.confirm) { + // wx.navigateTo({ + // url: '/pages/user/cartlist/list', + // }) + // } + // } + // }) + // }, 650) + // } + // }) + // } + // }, pagePoint: function (e) { util.pagePoint({ event: e.currentTarget.dataset.event, @@ -480,6 +546,65 @@ Page({ ctx.fillText(row[b], x, y + b * 40 * ratio, canvasWidth); } }, + //加入购物车 + showCart: function () { + console.log(this.data) + if (this.data.info.product[0].sku.length == 0) { + wx.showToast({ + title: '该产品未设置规格,不能加购', + icon: 'none' + }) + return; + } + this.setData({ + skuFlag: "cart" + }) + let that = this + wx.createSelectorQuery().select('#skuImg').boundingClientRect(function (res) { + console.log(res) + that.setData({ + cartImgInfo: 'top:' + res.top + 'px;left:' + res.left + 'px;' + }) + }).exec() + + }, + hideSku: function () { + this.setData({ + skuFlag: null, + cartImgInfo: null + }) + }, + //加减数量 + minus: function () { + if (this.data.producNum == 1) return; + this.setData({ + producNum: this.data.producNum - 1 + }) + }, + add: function () { + this.setData({ + producNum: this.data.producNum + 1 + }) + }, + //立即预定 + showOrder: function () { + if (this.data.info.product[0].sku.length == 0) { + wx.showToast({ + title: '该产品未设置规格,不能购买', + icon: 'none' + }) + return; + } + this.setData({ + skuFlag: 'order' + }) + }, + selectSku: function (e) { + let index = e.currentTarget.dataset.index; + this.setData({ + skuIndex: index + }) + }, /** * 生命周期函数--监听页面初次渲染完成 @@ -539,6 +664,12 @@ Page({ } }) } + commonApi.user_post('cart/get_list', {}).then(res => { + console.log(res,res.data) + this.setData({ + cartCount: res.data.length + }) + }) } else { setTimeout(() => { diff --git a/pages/info/sceneProductInfo/index.wxml b/pages/info/sceneProductInfo/index.wxml index 678e2ba..2279ba9 100644 --- a/pages/info/sceneProductInfo/index.wxml +++ b/pages/info/sceneProductInfo/index.wxml @@ -1,7 +1,10 @@ + - + + + + + {{cartCount}} + + + + + + + + + {{info.product[0].sku[skuIndex].price/100}} + + 补贴价:¥{{ (1 - allowance_data.discount_rate / 100) * info.sku[skuIndex].price / 100 }} + + 已选择:{{info.product[0].sku[skuIndex].sku_name}} + + + + {{item.sku_name}} + + + 数量 + + {{producNum}} + + + + + {{skuFlag=='cart'?'确认':'立即购买'}} + + 该商品已下架 + + + From a4aed582a7f2118e576f954087081dca342c2505 Mon Sep 17 00:00:00 2001 From: chenkainan Date: Thu, 4 Aug 2022 09:32:30 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E9=97=A8=E7=A5=A8=E7=B1=BB=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E6=94=AF=E6=8C=81=E8=B4=AD=E7=89=A9=E8=BD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 6 ++ app.json | 3 +- pages/component/TitleHeader.js | 16 ++++++ pages/info/postProductInfo/index.js | 2 + pages/info/sceneProductInfo/index.js | 42 +++++++++++--- pages/order/orderList/index.js | 86 ++++++++++++++++++++++++++++ pages/order/orderList/index.json | 5 ++ pages/order/orderList/index.wxml | 57 ++++++++++++++++++ pages/order/orderList/index.wxss | 53 +++++++++++++++++ pages/order/postOrder/index.js | 44 ++++++++------ pages/order/postOrder/index.wxml | 2 +- pages/order/scene/index.js | 83 ++++++++++++++++++++------- pages/order/scene/index.wxml | 2 +- pages/user/cartlist/list.js | 51 +++++++++++++---- project.private.config.json | 14 +++-- 15 files changed, 398 insertions(+), 68 deletions(-) create mode 100644 pages/order/orderList/index.js create mode 100644 pages/order/orderList/index.json create mode 100644 pages/order/orderList/index.wxml create mode 100644 pages/order/orderList/index.wxss diff --git a/app.js b/app.js index c5cd544..aff7f56 100644 --- a/app.js +++ b/app.js @@ -143,6 +143,12 @@ App({ safeBottom:0, product:null, postProduct:[], + ticketProduct:[], + index: 0, + createDate: null, + list: [], + productPrice: 0, + ticketPrice: 0, productState:{ "WAIT_PAYMENT":"待付款", "WAIT_CONFIRM":"待确认", diff --git a/app.json b/app.json index 9dbe4a2..df92b38 100644 --- a/app.json +++ b/app.json @@ -175,7 +175,8 @@ "pages/group/info/index", "pages/culture/index", "pages/culture/info/index", - "pages/user/logout/index" + "pages/user/logout/index", + "pages/order/orderList/index" ], "requiredPrivateInfos": [ "getLocation", diff --git a/pages/component/TitleHeader.js b/pages/component/TitleHeader.js index eba9f53..971a913 100644 --- a/pages/component/TitleHeader.js +++ b/pages/component/TitleHeader.js @@ -49,6 +49,7 @@ Component({ */ methods: { back:function(){ + app.globalData.index = app.globalData.index -1 // if(this.properties.clickid){ // wx.uma.trackEvent(this.properties.clickid) // } @@ -66,6 +67,21 @@ Component({ }) } } + else if (pages[pages.length-1].route.indexOf('cartlist') != -1){ + wx.switchTab({ + url: '/pages/user/user' + }) + } + else if (pages[pages.length-1].route.indexOf('orderList') != -1){ + wx.navigateTo({ + url: '/pages/user/cartlist/list' + }) + } + else if (pages[pages.length-1].route.indexOf('scene') != -1){ + wx.reLaunch({ + url: "/pages/user/cartlist/list" + }) + } else if (pages.length>1){ wx.navigateBack({ delta: 1 diff --git a/pages/info/postProductInfo/index.js b/pages/info/postProductInfo/index.js index 8aed12b..303fc76 100644 --- a/pages/info/postProductInfo/index.js +++ b/pages/info/postProductInfo/index.js @@ -243,6 +243,8 @@ Page({ }) }, order: function () { + app.globalData.postProduct = [] + app.globalData.list = [] if (this.data.skuFlag == 'order') { util.pagePoint({ event: 'product_order', diff --git a/pages/info/sceneProductInfo/index.js b/pages/info/sceneProductInfo/index.js index 241bde8..c3c5a2d 100644 --- a/pages/info/sceneProductInfo/index.js +++ b/pages/info/sceneProductInfo/index.js @@ -203,8 +203,38 @@ Page({ bookingInfo: null }) }, + // order: function(e){ + // console.log(e) + // if (e.currentTarget.dataset.disable == 1) return; + // util.pagePoint({ + // event: 'scene_order', + // param: { + // type: this.data.info.type, + // id: this.data.info.id + // } + // }, 1) + // wx.setStorageSync('login_from', 'scene_order_login') + // wx.setStorageSync('order_from', 'scene_order_submit') + // app.globalData.couponInfo = null; + // app.globalData.retailId = this.data.retailId; + // // let sku = e.currentTarget.dataset.sku,product = e.currentTarget.dataset.product; + // app.globalData.product = e.currentTarget.dataset; + // wx.navigateTo({ + // url: '/pages/order/scene/index', + // }) + // }, + selectSku: function (e) { + console.log(e) + let index = e.currentTarget.dataset.index; + this.setData({ + skuIndex: index + }) + }, order: function (e) { - console.log(this.data.info,this.data.skuFlag) + console.log(e,e.currentTarget.dataset.product.sku[this.data.skuIndex]) + // console.log(this.data.info,this.data.skuFlag) + app.globalData.postProduct = [] + app.globalData.list = [] if (this.data.skuFlag == 'order'){ if (e.currentTarget.dataset.disable == 1) return; util.pagePoint({ @@ -219,7 +249,9 @@ Page({ app.globalData.couponInfo = null; app.globalData.retailId = this.data.retailId; // let sku = e.currentTarget.dataset.sku,product = e.currentTarget.dataset.product; - app.globalData.product = e.currentTarget.dataset; + let sku = {sku:e.currentTarget.dataset.product.sku[this.data.skuIndex]},product = {product: e.currentTarget.dataset.product} + app.globalData.product = {...sku,...product} + // app.globalData.product = e.currentTarget.dataset; wx.navigateTo({ url: '/pages/order/scene/index', }) @@ -579,12 +611,6 @@ Page({ skuFlag: 'order' }) }, - selectSku: function (e) { - let index = e.currentTarget.dataset.index; - this.setData({ - skuIndex: index - }) - }, /** * 生命周期函数--监听页面初次渲染完成 diff --git a/pages/order/orderList/index.js b/pages/order/orderList/index.js new file mode 100644 index 0000000..7aadf7f --- /dev/null +++ b/pages/order/orderList/index.js @@ -0,0 +1,86 @@ +// pages/order/comment/index.js +let app = getApp() +import commonApi from "../../../utils/https/common" +Page({ + + /** + * 页面的初始数据 + */ + data: { + goodsList: [], + ticketList: [], + productPrice: 0, + ticketPrice: 0 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log(app.globalData.kjId) + this.setData({ + goodsList: app.globalData.postProduct, + ticketList: app.globalData.list + }) + console.log(this.data.goodsList,this.data.ticketList) + }, + order: function (){ + let service = "order/create", postData = {data: JSON.stringify(app.globalData.createDate)} + commonApi.user_post(service, postData).then(res => { + + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.setData({ + productPrice: app.globalData.productPrice, + ticketPrice: app.globalData.ticketPrice + }) + console.log(app.globalData.productPrice,app.globalData.ticketPrice) + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/order/orderList/index.json b/pages/order/orderList/index.json new file mode 100644 index 0000000..35cf02f --- /dev/null +++ b/pages/order/orderList/index.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "title":"/pages/component/TitleHeader" + } +} \ No newline at end of file diff --git a/pages/order/orderList/index.wxml b/pages/order/orderList/index.wxml new file mode 100644 index 0000000..2838721 --- /dev/null +++ b/pages/order/orderList/index.wxml @@ -0,0 +1,57 @@ + + + + + + {{item.product.title}} + + + ¥{{item.product.price/100}} + + + + + {{item.sku.sku_name}} + + + X{{item.productNum}} + + + + + 运费 + + + ¥{{item.postFee/100 || 0}} + + + + + + + + + {{item.product.title}} + + + ¥{{item.sku.price/100}} + + + + + {{item.sku.sku_name}} + + + X{{item.num}} + + + + + + + + 合计: + ¥{{productPrice + ticketPrice}} + + 下一步 + \ No newline at end of file diff --git a/pages/order/orderList/index.wxss b/pages/order/orderList/index.wxss new file mode 100644 index 0000000..e3fe5ab --- /dev/null +++ b/pages/order/orderList/index.wxss @@ -0,0 +1,53 @@ +page{ + background: #f5f5f5; +} +.box{ + width: 700rpx; + margin: 30rpx auto; + background: white; + padding: 20rpx; +} +.item-box{ + display: flex; + justify-content: space-between; + padding: 10rpx; +} +.price{ + color: #D62828; +} +.fixed-bottom { + position: fixed; + left: 0; + right: 0; + bottom: 0; + height: 113rpx; + display: flex; + align-items: center; + justify-content: space-between; + background: white; + z-index: 1; + box-shadow: 0px 0px 16rpx 0px rgba(6, 0, 1, 0.1); +} +.fixed-btn { + width: 320rpx; + line-height: 113rpx; + background: #D62828; + color: #fff; + text-align: center; + font-size: 36rpx; + font-weight: 500; +} + +.fixed-price-box { + margin-left: 25rpx; + flex-shrink: 0; + font-size: 29rpx; + color: #333; + font-weight: 500; +} + +.fixed-price-box .price { + color: #D62828; + font-size: 36rpx; + margin-left: 10rpx; +} \ No newline at end of file diff --git a/pages/order/postOrder/index.js b/pages/order/postOrder/index.js index 3ed318c..9130250 100644 --- a/pages/order/postOrder/index.js +++ b/pages/order/postOrder/index.js @@ -51,6 +51,7 @@ Page({ if (!this.data.kjId && !this.data.gp_id) { this.couponCom = this.selectAllComponents("#coupon")[0]; } + console.log(this.data.showPrice) }, changeAllowance: function () { this.setData({ @@ -161,23 +162,32 @@ Page({ if (app.globalData.category_id) { data.category_id = app.globalData.category_id; } - commonApi.user_post("order/create", { - data: JSON.stringify(data) - }).then(res => { - if (app.globalData.kjId) { - app.globalData.kjId = null; - this.setData({ - kjId: null - }) - this.onLoad({}) - } - app.globalData.gp_id = null; - app.globalData.team_id = null; - this.setData({ - gp_id: null - }) - this.onLoad({}); - }) + if(!app.globalData.list){ + commonApi.user_post("order/create", { + data: JSON.stringify(data) + }).then(res => { + if (app.globalData.kjId) { + app.globalData.kjId = null; + this.setData({ + kjId: null + }) + this.onLoad({}) + } + app.globalData.gp_id = null; + app.globalData.team_id = null; + this.setData({ + gp_id: null + }) + this.onLoad({}); + }) + }else{ + app.globalData.productPrice = (this.data.showPrice + this.data.postFee - (this.data.coupon?this.data.coupon.activity.money:0))/100; + app.globalData.createDate = data + console.log(app.globalData.createDate) + wx.navigateTo({ + url: '/pages/order/scene/index', + }) + } }, getPostFee: function () { if (!this.data.address) return; diff --git a/pages/order/postOrder/index.wxml b/pages/order/postOrder/index.wxml index ee1f9f6..a9106db 100644 --- a/pages/order/postOrder/index.wxml +++ b/pages/order/postOrder/index.wxml @@ -54,7 +54,7 @@ class="price">¥{{((showPrice + postFee - (coupon?coupon.activity.money:0))>0?(showPrice + postFee - (coupon?coupon.activity.money:0)):0)/100}} 合计:¥{{postFee?(0+postFee)/100:0}} - 提交订单 + 下一步 diff --git a/pages/order/scene/index.js b/pages/order/scene/index.js index 2c1a7ff..b0d693c 100644 --- a/pages/order/scene/index.js +++ b/pages/order/scene/index.js @@ -26,12 +26,14 @@ Page({ showAllowance: false, allowance_data: null, allowance_price: 0, + pIndex: 0 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { + console.log(app.globalData.product) this.setData({ type: options.type, kjId: app.globalData.kjId, @@ -46,7 +48,11 @@ Page({ this.setData({ productNum: app.globalData.product.productNum < 1 ? 1 : app.globalData.product.productNum }) - } + }else{ + this.setData({ + productNum: app.globalData.product.num < 1 ? 1 : app.globalData.product.num + }) + } this.setData({ product: app.globalData.product, singlePrice: this.data.gp_id ? app.globalData.product.sku.event_price : app.globalData.product.sku.price @@ -96,6 +102,7 @@ Page({ this.setData({ productNum: this.data.productNum + 1 }) + this.data.product.num = this.data.productNum this.changePrice() }, minus: function () { @@ -114,6 +121,7 @@ Page({ productNum: (this.data.productNum - 1), coupon: null }) + this.data.product.num = this.data.productNum this.changePrice() }, changeDate: function (e) { @@ -163,6 +171,7 @@ Page({ this.setData({ singlePrice: app.globalData.kjId ? 0 : price }) + }, order: function () { let linkmanList = this.data.linkmanList, productNum = this.data.productNum, date = this.data.date, time = this.data.time, remark = this.data.remark, product = this.data.product; @@ -238,27 +247,52 @@ Page({ postData.team_name = this.data.groupName postData.type = 1; } - - commonApi.user_post(service, postData).then(res => { - if (app.globalData.kjId) { - this.setData({ - kjId: null - }); - app.globalData.kjId = null; - } - if (app.globalData.gp_id) { - this.setData({ - gp_id: null - }); - app.globalData.gp_id = null; - } - if (res.code == 1 && app.globalData.product.isGroup == 1) { - // 团购跳转到团购详情 - wx.navigateTo({ - url: '/pages/info/groupOrderInfo/index?id=' + res.data.order_id + '&from=order' - }) - } - }) + app.globalData.list[app.globalData.index] = this.data.product + app.globalData.ticketPrice += (this.data.singlePrice * this.data.productNum - (this.data.coupon?this.data.coupon.activity.money:0))/100; + if(app.globalData.list.length > app.globalData.index + 1){ + if(app.globalData.createDate){ + app.globalData.createDate.product_list.push(data.product_list[0]) + }else{ + app.globalData.createDate = data + } + app.globalData.index = app.globalData.index + 1 + app.globalData.product = app.globalData.list[app.globalData.index] + wx.navigateTo({ + url: '/pages/order/scene/index', + }) + return + }else{ + console.log(app.globalData.list.length,app.globalData.postProduct) + if(app.globalData.list.length > 1 || app.globalData.postProduct.length>0){ + if(app.globalData.createDate){ + app.globalData.createDate.product_list.push(data.product_list[0]) + } + wx.redirectTo({ + url: '/pages/order/orderList/index' + }) + }else{ + commonApi.user_post(service, postData).then(res => { + if (app.globalData.kjId) { + this.setData({ + kjId: null + }); + app.globalData.kjId = null; + } + if (app.globalData.gp_id) { + this.setData({ + gp_id: null + }); + app.globalData.gp_id = null; + } + if (res.code == 1 && app.globalData.product.isGroup == 1) { + // 团购跳转到团购详情 + wx.navigateTo({ + url: '/pages/info/groupOrderInfo/index?id=' + res.data.order_id + '&from=order' + }) + } + }) + } + } }, // 活动预约 activityOrder: function () { @@ -311,6 +345,11 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { + console.log(app.globalData.list,app.globalData.product,app.globalData.list.length) + if(app.globalData.list.length != 0){ + app.globalData.product = app.globalData.list[app.globalData.index] + } + console.log(app.globalData.product) if (!this.data.isLogin) { commonApi.user_post("token/check").then(res => { if (res.code == 1) { diff --git a/pages/order/scene/index.wxml b/pages/order/scene/index.wxml index 393ea3d..3ad03f0 100644 --- a/pages/order/scene/index.wxml +++ b/pages/order/scene/index.wxml @@ -50,7 +50,7 @@ 合计:¥{{((singlePrice * productNum - (coupon?coupon.activity.money:0))>0?(singlePrice * productNum - (coupon?coupon.activity.money:0)):0)/ 100}} - 提交订单 + 下一步 立即预约 diff --git a/pages/user/cartlist/list.js b/pages/user/cartlist/list.js index 4a0f33b..caf910a 100644 --- a/pages/user/cartlist/list.js +++ b/pages/user/cartlist/list.js @@ -16,7 +16,8 @@ Page({ menuWidth:width - rect.right + rect.width + 6, list:[], allChecked:false, - allPrice:0 + allPrice:0, + productType:'' }, /** @@ -108,22 +109,33 @@ Page({ }) }, order:function(){ + console.log(this.data.productType) app.globalData.couponInfo = null; util.pagePoint({ event:'cart_order' },1) - let list = this.data.list,price=0,product=[]; + let list = this.data.list,price=0,product=[],product1=[] list.map(item=>{ if(item.checked){ - item.product.type="post"; - product.push({ - product:item.product, - sku:item.sku, - productNum:item.num - }) + console.log(item) + // item.product.type="post"; + if(item.product.type == 'post'){ + product.push({ + product:item.product, + sku:item.sku, + productNum:item.num + }) + }else{ + product1.push(item) + app.globalData.list = product1 + } + if(item.product.type.includes('post')){ + this.data.productType = 'post' + } + console.log(this.data.productType) } }) - if(product.length==0) { + if(product.length==0 && product1.length==0) { wx.showToast({ title: '请先选择产品', icon: 'none' @@ -131,9 +143,18 @@ Page({ return; } app.globalData.postProduct = product; - wx.navigateTo({ - url: '/pages/order/postOrder/index?from=cart', - }) + if(app.globalData.list){ + app.globalData.product = app.globalData.list[app.globalData.index] + } + if(this.data.productType == 'post'){ + wx.navigateTo({ + url: '/pages/order/postOrder/index?from=cart', + }) + }else{ + wx.navigateTo({ + url: '/pages/order/scene/index', + }) + } }, touchStart(e){//移动前点击的位置 console.log(e) @@ -217,6 +238,12 @@ Page({ util.pagePoint({ event:'cart_view' },1) + app.globalData.list = null + app.globalData.createDate = null + app.globalData.index = 0 + app.globalData.productPrice = 0 + app.globalData.ticketPrice = 0 + this.data.productType = '' }, /** diff --git a/project.private.config.json b/project.private.config.json index 684d82c..d03db11 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -6,9 +6,10 @@ "miniprogram": { "list": [ { - "name": "精彩回顾", - "pathName": "pages/pbService/activity/index", - "query": "id=4407", + "name": "首页", + "pathName": "pages/index/index", + "query": "", + "launchMode": "default", "scene": null }, { @@ -48,9 +49,10 @@ "scene": null }, { - "name": "pages/pbService/web/index", - "pathName": "pages/pbService/web/index", - "query": "id=10973", + "name": "pages/order/orderList/index", + "pathName": "pages/order/orderList/index", + "query": "", + "launchMode": "default", "scene": null }, { From 5c805f1bddb51731d958c68b57b40a96e83c7f89 Mon Sep 17 00:00:00 2001 From: chenkainan Date: Thu, 4 Aug 2022 13:32:03 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E9=97=A8=E7=A5=A8=E7=B1=BB=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E6=94=AF=E6=8C=81=E8=B4=AD=E7=89=A9=E8=BD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/component/TitleHeader.js | 4 +++- pages/order/components/contact/index.js | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pages/component/TitleHeader.js b/pages/component/TitleHeader.js index 971a913..06a72a9 100644 --- a/pages/component/TitleHeader.js +++ b/pages/component/TitleHeader.js @@ -49,11 +49,13 @@ Component({ */ methods: { back:function(){ - app.globalData.index = app.globalData.index -1 // if(this.properties.clickid){ // wx.uma.trackEvent(this.properties.clickid) // } const pages = getCurrentPages(); + if(pages[pages.length-1].route.indexOf('linkman/add')==-1){ + app.globalData.index = app.globalData.index -1 + } if(pages[pages.length-1].route.indexOf('login')!=-1 || pages[pages.length-1].route.indexOf('bindTel')!=-1){ // 如果是登录页面的返回需要返回两层 if(pages.length>2){ diff --git a/pages/order/components/contact/index.js b/pages/order/components/contact/index.js index 709e918..57ad8ab 100644 --- a/pages/order/components/contact/index.js +++ b/pages/order/components/contact/index.js @@ -219,8 +219,10 @@ Component({ wx.hideLoading() }, selectIt:function(e){ + console.log(e,app.globalData.product) let item = e.currentTarget.dataset.item,linkmanList = this.data.linkmanList,num = 0,traveller_limit_num = this.properties.maxNum!=-1?this.properties.maxNum:(app.globalData.product.sku.sku_model && app.globalData.product.sku.sku_model.limit_type!=0?app.globalData.product.sku.sku_model.traveller_limit_num:-1); // 先计算出全部选中的出行人 + console.log(111) linkmanList.map(linkman=>{ if(linkman.selected==1){ num++; From cf41d0393d14760d35a58c7c52f9da7225001376 Mon Sep 17 00:00:00 2001 From: chenkainan Date: Thu, 4 Aug 2022 13:48:56 +0800 Subject: [PATCH 5/7] =?UTF-8?q?app.json=E5=BC=95=E5=85=A5=E7=9B=B4?= =?UTF-8?q?=E6=92=AD=E7=BB=84=E4=BB=B6=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app.json b/app.json index a4f5bf2..b4201fa 100644 --- a/app.json +++ b/app.json @@ -181,6 +181,12 @@ "pages/user/address/add/index", "pages/user/linkman/index" ], + "plugins": { + "live-player-plugin": { + "version": "1.3.0", + "provider": "wx2b03c6e691cd7370" + } + }, "requiredPrivateInfos": [ "getLocation", "choosePoi", From 7cae5f4a04f267d7ee2bf73547fcec7c6b301d6e Mon Sep 17 00:00:00 2001 From: caichunsheng Date: Fri, 5 Aug 2022 16:06:49 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/order/orderList/index.js | 90 +++++++++++++++++++++++++++----- pages/order/orderList/index.wxml | 10 +++- pages/order/orderList/index.wxss | 17 ++++-- pages/order/postOrder/index.js | 8 +-- pages/order/postOrder/index.wxml | 6 +-- pages/order/scene/index.js | 6 ++- pages/order/scene/index.wxml | 4 +- pages/user/cartlist/list.js | 18 ++++--- 8 files changed, 124 insertions(+), 35 deletions(-) diff --git a/pages/order/orderList/index.js b/pages/order/orderList/index.js index 7aadf7f..30cc91c 100644 --- a/pages/order/orderList/index.js +++ b/pages/order/orderList/index.js @@ -7,46 +7,110 @@ Page({ * 页面的初始数据 */ data: { - goodsList: [], - ticketList: [], + goodsList: [], + ticketList: [], productPrice: 0, - ticketPrice: 0 + ticketPrice: 0, + product:"", + sku_id: '', + kjId: null, + gp_id: null, + showPrice: 0, + postFee: 0, + coupon:null, + select_allowance: false, + allowance_data: null, + allowance_price: 0, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - console.log(app.globalData.kjId) this.setData({ goodsList: app.globalData.postProduct, - ticketList: app.globalData.list + ticketList: app.globalData.list, + kjId: app.globalData.kjId, + gp_id: app.globalData.gp_id || app.globalData.team_id, }) - console.log(this.data.goodsList,this.data.ticketList) + console.log(app.globalData); + let price = 0, sku_id = []; + app.globalData.postProduct.map(item => { + if (!app.globalData.kjId && !this.data.gp_id) { + price = price + item.sku.price * item.productNum; + } + else if (this.data.gp_id) { + price = price + item.sku.event_price * item.productNum; + } + sku_id.push(item.sku.id) + }) + app.globalData.list.map(item => { + price = price + item.sku.price * item.num; + sku_id.push(item.sku.id) + }) + this.setData({ + showPrice: app.globalData.kjId ? 0 : price, + sku_id: sku_id.join(",") + }) + if (!this.data.kjId && !this.data.gp_id) { + this.couponCom = this.selectAllComponents("#coupon")[0]; + } + console.log(this.data.showPrice) }, order: function (){ + console.log(app.globalData.createDate); + app.globalData.createDate.coupon_id= this.data.coupon ? this.data.coupon.id : null; let service = "order/create", postData = {data: JSON.stringify(app.globalData.createDate)} commonApi.user_post(service, postData).then(res => { }) }, - + changePrice: function () { + let product = this.data.product, price = 0; + product.map(item => { + price = price + item.sku.price * item.productNum; + if (this.data.allowance_data && this.data.select_allowance && this.data.allowance_price) { + let spread_price = Number(this.data.allowance_data.discount_limit_price - this.data.allowance_data.user_used_price); + price -= this.data.allowance_price * item.productNum < spread_price ? this.data.allowance_price * item.productNum : spread_price + } + }) + if (this.data.coupon && this.data.showPrice != price) { + wx.showToast({ + title: '订单价格发生变化,请重新选择优惠券', + icon: 'none' + }) + app.globalData.couponInfo = null; + if (!this.data.kjId && !this.data.gp_id) { + this.couponCom.setNullCoupon() + } + this.setData({ + coupon: null + }) + } + this.setData({ + showPrice: app.globalData.kjId ? 0 : price + }) + }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, - + inputRemark: function (e) { + app.globalData.createDate.product_list.map((item)=>{ + if (item.type.includes('post')) { + item.remark = e.detail.value; + } + }) + }, /** * 生命周期函数--监听页面显示 */ onShow: function () { - this.setData({ - productPrice: app.globalData.productPrice, - ticketPrice: app.globalData.ticketPrice - }) - console.log(app.globalData.productPrice,app.globalData.ticketPrice) + this.setData({ + coupon: app.globalData.couponInfo + }) }, /** diff --git a/pages/order/orderList/index.wxml b/pages/order/orderList/index.wxml index 2838721..fe628a0 100644 --- a/pages/order/orderList/index.wxml +++ b/pages/order/orderList/index.wxml @@ -6,7 +6,7 @@ {{item.product.title}} - ¥{{item.product.price/100}} + ¥{{item.sku.price/100}} @@ -48,10 +48,16 @@ + + 订单备注: + + + + 合计: - ¥{{productPrice + ticketPrice}} + ¥{{((showPrice + postFee - (coupon?coupon.activity.money:0))>0?(showPrice + postFee - (coupon?coupon.activity.money:0)):0)/100}} 下一步 \ No newline at end of file diff --git a/pages/order/orderList/index.wxss b/pages/order/orderList/index.wxss index e3fe5ab..42bac92 100644 --- a/pages/order/orderList/index.wxss +++ b/pages/order/orderList/index.wxss @@ -1,9 +1,8 @@ page{ - background: #f5f5f5; + background: #f5f5f5; } .box{ - width: 700rpx; - margin: 30rpx auto; + margin: 30rpx 25rpx; background: white; padding: 20rpx; } @@ -50,4 +49,16 @@ page{ color: #D62828; font-size: 36rpx; margin-left: 10rpx; +} +.box-title { + height: 113rpx; + padding: 0 20rpx; + font-size: 31rpx; + color: #000; + font-weight: 500; + display: flex; + align-items: center; + background-color: #fff; + margin: 30rpx 25rpx; + } \ No newline at end of file diff --git a/pages/order/postOrder/index.js b/pages/order/postOrder/index.js index 9130250..cb20054 100644 --- a/pages/order/postOrder/index.js +++ b/pages/order/postOrder/index.js @@ -21,6 +21,7 @@ Page({ allowance_data: null, allowance_price: 0, showAllowance: false, + flag:null, }, /** @@ -31,7 +32,8 @@ Page({ from: options.from, kjId: app.globalData.kjId, gp_id: app.globalData.gp_id || app.globalData.team_id, - prizeId: wx.getStorageSync('prizeId') + prizeId: wx.getStorageSync('prizeId'), + flag:options.flag }) let price = 0, sku_id = []; app.globalData.postProduct.map(item => { @@ -143,7 +145,7 @@ Page({ let data = { source: "WECHATXCX", product_list: product_list, - coupon: this.data.coupon ? this.data.coupon.id : null, + coupon_id: this.data.coupon ? this.data.coupon.id : null, originate_order_id: this.data.kjId, gp_id: app.globalData.gp_id, team_id: app.globalData.team_id @@ -185,7 +187,7 @@ Page({ app.globalData.createDate = data console.log(app.globalData.createDate) wx.navigateTo({ - url: '/pages/order/scene/index', + url: '/pages/order/scene/index?flag='+this.data.flag, }) } }, diff --git a/pages/order/postOrder/index.wxml b/pages/order/postOrder/index.wxml index a9106db..6c3ab93 100644 --- a/pages/order/postOrder/index.wxml +++ b/pages/order/postOrder/index.wxml @@ -29,8 +29,8 @@ 运费 {{item.postFee?(item.postFee==0?'包邮':(item.postFee/100)):item.sku.sku_model.post_template_name}} - - 订单备注: + + 订单备注: @@ -47,7 +47,7 @@ - + 合计: - - + 订单备注 diff --git a/pages/user/cartlist/list.js b/pages/user/cartlist/list.js index caf910a..d6a16bb 100644 --- a/pages/user/cartlist/list.js +++ b/pages/user/cartlist/list.js @@ -17,7 +17,8 @@ Page({ list:[], allChecked:false, allPrice:0, - productType:'' + productType:'', + flag:false,//判断订单是否同时有商品和票 }, /** @@ -109,7 +110,6 @@ Page({ }) }, order:function(){ - console.log(this.data.productType) app.globalData.couponInfo = null; util.pagePoint({ event:'cart_order' @@ -117,7 +117,6 @@ Page({ let list = this.data.list,price=0,product=[],product1=[] list.map(item=>{ if(item.checked){ - console.log(item) // item.product.type="post"; if(item.product.type == 'post'){ product.push({ @@ -128,11 +127,10 @@ Page({ }else{ product1.push(item) app.globalData.list = product1 - } + } if(item.product.type.includes('post')){ this.data.productType = 'post' } - console.log(this.data.productType) } }) if(product.length==0 && product1.length==0) { @@ -142,13 +140,19 @@ Page({ }) return; } + if (product.length>0 && product1.length>0) { + this.setData({ + flag: 'mix' + }) + } app.globalData.postProduct = product; if(app.globalData.list){ app.globalData.product = app.globalData.list[app.globalData.index] - } + } if(this.data.productType == 'post'){ + console.log(this.data.flag); wx.navigateTo({ - url: '/pages/order/postOrder/index?from=cart', + url: '/pages/order/postOrder/index?from=cart&flag='+this.data.flag, }) }else{ wx.navigateTo({ From 01308fb39bae016b6cbe48b9ecbf0c3f69d8f563 Mon Sep 17 00:00:00 2001 From: caichunsheng Date: Sat, 6 Aug 2022 09:53:04 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B4=AD=E7=89=A9?= =?UTF-8?q?=E8=BD=A6bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/order/orderList/index.json | 3 ++- pages/order/scene/index.js | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pages/order/orderList/index.json b/pages/order/orderList/index.json index 35cf02f..e7c6ece 100644 --- a/pages/order/orderList/index.json +++ b/pages/order/orderList/index.json @@ -1,5 +1,6 @@ { "usingComponents": { - "title":"/pages/component/TitleHeader" + "title":"/pages/component/TitleHeader", + "coupon":"../components/coupon/index" } } \ No newline at end of file diff --git a/pages/order/scene/index.js b/pages/order/scene/index.js index bc8da0f..34f21b9 100644 --- a/pages/order/scene/index.js +++ b/pages/order/scene/index.js @@ -259,8 +259,8 @@ Page({ } app.globalData.index = app.globalData.index + 1 app.globalData.product = app.globalData.list[app.globalData.index] - wx.navigateTo({ - url: '/pages/order/scene/index', + wx.redirectTo({ + url: '/pages/order/scene/index?flag='+ this.data.flag, }) return }else{ @@ -347,7 +347,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - console.log(app.globalData.list,app.globalData.product,app.globalData.list.length) + console.log(this.data.flag); if(app.globalData.list.length != 0){ app.globalData.product = app.globalData.list[app.globalData.index] }