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 }, {