diff --git a/app.json b/app.json index 11743e3..e6ce114 100644 --- a/app.json +++ b/app.json @@ -177,31 +177,34 @@ "pages/culture/index", "pages/culture/info/index", "pages/user/logout/index", - "pages/order/orderList/index", - "pages/user/linkman/add/index", - "pages/user/address/add/index", - "pages/user/linkman/index", - "pages/user/userPrivacy/index", - "pages/user/personalInfo/index", - "pages/info/luggageInfo/index" + "pages/order/orderList/index", + "pages/user/linkman/add/index", + "pages/user/address/add/index", + "pages/user/linkman/index", + "pages/user/userPrivacy/index", + "pages/user/personalInfo/index", + "pages/info/luggageInfo/index", + "pages/order/WineSceneOrder/index" + ], + "subpackages": [ + { + "root": "subPackages", + "pages": [ + "indexs/index", + "index/index", + "techanNew/index", + "techanCart/index", + "feiyiNew/index", + "postSearch/index", + "gwcOrder/index" + ] + } ], - "subpackages": [{ - "root": "subPackages", - "pages": [ - "indexs/index", - "index/index", - "techanNew/index", - "techanCart/index", - "feiyiNew/index", - "postSearch/index", - "gwcOrder/index" - ] - }], "plugins": { - "live-player-plugin": { - "version": "1.3.5", - "provider": "wx2b03c6e691cd7370" - } + "live-player-plugin": { + "version": "1.3.5", + "provider": "wx2b03c6e691cd7370" + } }, "requiredPrivateInfos": [ "getLocation", diff --git a/pages/info/postProductInfo/index.js b/pages/info/postProductInfo/index.js index da9458e..da0b4d3 100644 --- a/pages/info/postProductInfo/index.js +++ b/pages/info/postProductInfo/index.js @@ -337,9 +337,21 @@ Page({ app.globalData.postProduct = product; app.globalData.retailId = this.data.retailId; app.globalData.listName = null - wx.navigateTo({ - url: '/pages/order/postOrder/index', - }) + + if (this.data.info.is_package) { + app.globalData.product = product[0]; + wx.navigateTo({ + url: '/pages/order/WineSceneOrder/index', + }) + + } else { + wx.navigateTo({ + url: '/pages/order/postOrder/index', + }) + } + + + } else { let tag_id = this.data.info.tag_id,type = '' if (tag_id.includes(20) || tag_id.includes(19)) { //文创 diff --git a/pages/info/postProductInfo/index.wxml b/pages/info/postProductInfo/index.wxml index fb79d30..48812d8 100644 --- a/pages/info/postProductInfo/index.wxml +++ b/pages/info/postProductInfo/index.wxml @@ -126,14 +126,18 @@ - + + 立即购买 + 该商品已下架 + + 加入购物车 立即购买 该商品已下架 - + {{cartCount}} diff --git a/pages/order/WineSceneOrder/index.js b/pages/order/WineSceneOrder/index.js new file mode 100644 index 0000000..a8df32e --- /dev/null +++ b/pages/order/WineSceneOrder/index.js @@ -0,0 +1,438 @@ +// pages/order/scene/index.js +let app = getApp() +import util from "../../../utils/util" +import commonApi from "../../../utils/https/common" +Page({ + + /** + * 页面的初始数据 + */ + data: { + product:null, + productNum: 1, + linkmanList: [], + date: "", + time: "", + remark: "", + singlePrice: 0, + type: null, + coupon:null, + isLogin: false, + kjId: null, + gp_id: null, + groupName: "", + prizeId: null, + select_allowance: false, + showAllowance: false, + allowance_data: null, + allowance_price: 0, + pIndex: 0, + flag:null, + ticket_type:1, + isCar:'single', + showMask: false, + price:0, + + status:false, + date: "", + time: "", + ydxz:false, //预定须知弹框 + bookingInfo: null, + bookingInfoTitle: "", + showDate:false, + showDate2:false, + showYhq:null, + couponFlag:false + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + product: app.globalData.product, + type: options.type, + kjId: app.globalData.kjId, + gp_id: app.globalData.gp_id || app.globalData.team_id, + prizeId: wx.getStorageSync('prizeId'), + flag:options.flag, + date:null, + isCar:options.isCar, + showYhq:app.globalData.listName?false:true + }) + console.log('-------',this.data.showYhq,this.data.time); + // debugger + + + if (!this.data.product) { + util.back(); + return; + } + if (this.data.product.productNum) { + this.setData({ + productNum: this.data.product.productNum < 1 ? 1 : this.data.product.productNum + }) + }else{ + this.setData({productNum: 1}) + } + + this.setData({singlePrice: this.data.product.sku.price}) + this.showAllPrice() + + console.log(this.data); + this.getNewCoupon() + this.couponCom = this.selectAllComponents("#coupon")[0]; + + }, + + + showBookingInfo: function (e) { + this.setData({ + bookingInfo: this.data.product.sku.sku_model, + bookingInfoTitle: this.data.product.sku.sku_name + }) + util.pagePoint({ + event: "scene_notice", + param: { + type: this.data.product.type, + id: this.data.product.id + } + }, 1) + }, + closeMask: function () { + this.setData({ + bookingInfo: null + }) + }, + showAllPrice:function () { + + console.log('couponInfo',app.globalData.couponInfo); + + let price = 0 + if (this.data.coupon) { + console.log(app.globalData.couponInfo,this.data.coupon); + if (this.data.coupon.activity.discount_type == 'pricebreak') { + price = this.data.singlePrice * this.data.productNum - this.data.coupon.activity.money + } else { + price =(this.data.singlePrice * this.data.productNum * this.data.coupon.activity.fold)/ 10 + } + } else { + price = this.data.singlePrice * this.data.productNum + } + + if (price >0) { + this.setData({ + price:price/100 + }) + }else { + this.setData({ + price:0 + }) + } + // console.log(this.data.singlePrice); + if (price >0) { + this.setData({ + price:price/100 + }) + }else { + this.setData({ + price:0 + }) + } + + }, + cancel: function () { + this.setData({ + showMask:false + }) + }, + changeGroupName: function (e) { + this.setData({ + groupName: e.detail.value + }) + }, + setLinkman: function (e) { + if (e.detail.phone || e.detail.phone=='') { + this.setData({ + phone:e.detail.phone + }) + }else { + console.log(e); + let linkmanList = e.detail; + if (this.data.productNum != linkmanList.length && this.data.coupon) { + // wx.showToast({ + // title: '订单价格发生变化,请重新选择优惠券', + // icon: 'none' + // }) + } + + this.setData({ + // productNum: productNum, + linkmanList: linkmanList + }) + console.log(this.data.linkmanList); + this.totalPrice(this.data.singlePrice) + } + }, + add: function () { + if (this.data.productNum==undefined) { + wx.showToast({ + title: '请先添加出行人', + icon: 'none' + }) + return + } + if (this.data.product.sku.sku_model.traveller_limit_num != 0 && this.data.productNum == this.data.product.sku.sku_model.traveller_limit_num) { + wx.showToast({ + title: '本产品单笔限购' + this.data.product.sku.sku_model.traveller_limit_num + "份", + icon: 'none' + }) + return; + } + this.setData({ + productNum: this.data.productNum + 1 + }) + this.data.product.num = this.data.productNum + // this.changePrice() + // this.showAllPrice() + this.totalPrice(this.data.singlePrice) + }, + minus: function () { + if (this.data.productNum==undefined) { + wx.showToast({ + title: '请先添加出行人', + icon: 'none' + }) + return + } + if (this.data.productNum == 1) return; + if (this.data.coupon) { + wx.showToast({ + title: '订单价格发生变化,请重新选择优惠券', + icon: 'none' + }) + } + if (!this.data.kjId && !this.data.gp_id && this.data.product.isGroup != 1 && !this.data.flag && this.data.type!='museum') { + // this.couponCom.setNullCoupon() + + } + app.globalData.couponInfo = null; + console.log(this.data.couponFlag); + this.setData({ + productNum: (this.data.productNum - 1), + coupon: null, + couponFlag:true + }) + this.data.product.num = this.data.productNum + // this.changePrice() + // this.showAllPrice() + this.totalPrice(this.data.singlePrice) + }, + totalPrice(price) { + let allPrice + if (this.data.coupon) { + if (this.data.coupon.activity.discount_type == 'pricebreak') { + allPrice = this.data.singlePrice * this.data.productNum - this.data.coupon.activity.money + } else { + allPrice =(this.data.singlePrice * this.data.productNum * this.data.coupon.activity.fold)/ 10 + } + } else { + allPrice = this.data.singlePrice * this.data.productNum + } + + // allPrice = price * this.data.productNum - (this.data.coupon?this.data.coupon.activity.money:0) + if (allPrice >0) { + this.setData({ + price:allPrice/100, + singlePrice:price + }) + }else { + this.setData({ + price:0, + singlePrice:price + }) + } + console.log('singlePrice',this.data.singlePrice); + }, + + + 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; + let linkmanIds = []; + + let data = { + coupon_id: this.data.coupon ? this.data.coupon.id : null, + source: "WECHATXCX", + product_list: [{ + type: product.product.type, + product_id: product.product.id, + sku_id: product.sku.id, + start_time: '', + end_time: '', + use_date: '', + visitors: linkmanIds.join(","), + remark: remark, + product_num: productNum, + phone:this.data.phone,// 不实名的时候传的手机号参数 + }], + originate_order_id: this.data.kjId, + gp_id: app.globalData.gp_id, + team_id: app.globalData.team_id, + + } + if (app.globalData.from) { + data.system_name = app.globalData.from; + } + if (app.globalData.retailId) { + data.commission_code = app.globalData.retailId; + app.globalData.retailId = null; + } + if (app.globalData.category_id) { + data.category_id = app.globalData.category_id; + } + if (this.data.prizeId) { + data.lottery_id = this.data.prizeId + } + let service = 'order/create', postData = { + data: JSON.stringify(data) + } + // if (app.globalData.product.isGroup == 1) { + // service = "team_order/appoint" + // postData.member_num = this.data.productNum + // postData.team_name = this.data.groupName + // postData.type = 1; + // } + if(app.globalData.list){ + app.globalData.list[app.globalData.index] = this.data.product + } + // app.globalData.linkmanList = this.data.linkmanList + app.globalData.ticketPrice += (this.data.singlePrice * this.data.productNum - (this.data.coupon?this.data.coupon.activity.money:0))/100; + console.log(app.globalData); + if(app.globalData.list && app.globalData.list.length > app.globalData.index + 1 &&this.data.type!='museum'){ + if(app.globalData.createDate){ + app.globalData.createDate.product_list.push(data.product_list[0]) + }else{ + app.globalData.createDate = data + } + console.log(app.globalData.createDate); + app.globalData.index = app.globalData.index + 1 + app.globalData.product = app.globalData.list[app.globalData.index] + wx.redirectTo({ + url: '/pages/order/scene/index?flag='+ this.data.flag+'&isCar='+this.data.isCar, + }) + return + }else{ + // if(app.globalData.list && app.globalData.list.length > 1 || app.globalData.postProduct.length>0){ + if (false) { + if(app.globalData.createDate){ + app.globalData.createDate.product_list.push(data.product_list[0]) + } + wx.redirectTo({ + url: '/pages/order/orderList/index?flag='+ this.data.flag + }) + }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' + }) + } + }) + } + } + }, + next: function () { + console.log(this.data) + if (!util.isTel(this.data.phone)) { + wx.showToast({ + title: '请输入正确的手机号', + icon: 'none' + }) + return + } + this.setData({ + showMask:true + }) + + }, + + + //获取最高优惠券 + getNewCoupon(e){ + this.setData({ + coupon:e.detail + }) + this.showAllPrice() + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + if (!this.data.isLogin) { + commonApi.user_post("token/check").then(res => { + if (res.code == 1) { + this.setData({ + isLogin: true + }) + } + }) + } + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + this.setData({ + couponFlag:false + }) + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + this.setData({ + kjId: null, + gp_id: null + }); + app.globalData.kjId = null; + app.globalData.gp_id = null; + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + } +}) \ No newline at end of file diff --git a/pages/order/WineSceneOrder/index.json b/pages/order/WineSceneOrder/index.json new file mode 100644 index 0000000..17ea59b --- /dev/null +++ b/pages/order/WineSceneOrder/index.json @@ -0,0 +1,10 @@ +{ + "usingComponents": { + "title":"/pages/component/TitleHeader", + "date1":"../components/date/index", + "contact":"../components/contact/index", + "coupon":"../components/coupon/index", + "notice":"/pages/component/notice/notice", + "date":"/pages/order/components/date" + } +} \ No newline at end of file diff --git a/pages/order/WineSceneOrder/index.wxml b/pages/order/WineSceneOrder/index.wxml new file mode 100644 index 0000000..e5971bf --- /dev/null +++ b/pages/order/WineSceneOrder/index.wxml @@ -0,0 +1,54 @@ + + + + + + + + {{product.product.title}} + + + + + + + + {{product.sku.sku_name}} + + {{product.sku.price/100}} + + + + {{productNum}} + + + + + + {{item}}| + + 预订须知 > + + + + + + + + + + + + + 合计: + ¥{{price}} + + 提交订单 + + + + + \ No newline at end of file diff --git a/pages/order/WineSceneOrder/index.wxss b/pages/order/WineSceneOrder/index.wxss new file mode 100644 index 0000000..3e49fea --- /dev/null +++ b/pages/order/WineSceneOrder/index.wxss @@ -0,0 +1,453 @@ +/* pages/.wxss */ +page { + background: #f6f6f6; + } + + .group-order { + background: #fff; + } + + .product-info { + padding: 20rpx 47rpx; + border-bottom: 1rpx solid #ccc; + } + + .product-title { + font-size: 33rpx; + color: #000; + font-weight: 500; + } + + .product-price { + color: #D62828; + font-size: 27rpx; + } + + .group-order .box-title { + margin: 0; + } + + .group-order .box, + .group-order .date-box { + border-bottom: 1rpx solid #D8D8D8; + border-radius: 0; + margin: 0 25rpx; + } + + .group-order .dates-boxes { + border-top: none; + padding-top: 0; + } + + .group-order .date-time.disable { + background: #CCCCCC; + color: #fff; + } + + .box { + margin: 30rpx 25rpx; + background: white; + border-radius: 9rpx; + } + + .box-title { + height: 113rpx; + margin: 0 20rpx; + font-size: 31rpx; + color: #000; + font-weight: 500; + display: flex; + align-items: center; + } + + .dates-boxes { + display: flex; + align-items: center; + padding: 31rpx 21rpx; + /* border-top: 1rpx solid #ccc; */ + } + + .date-item { + width: 120rpx; + height: 133rpx; + border-radius: 10rpx; + /* border: 1rpx solid #333; */ + text-align: center; + font-size: 27rpx; + color: #000; + margin-right: 20rpx; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + background: #F5F5F5; + flex-shrink: 0; + } + + .date-item.active { + border-color: #0B898E; + color: #fff; + background: #0B898E; + } + + .date-item.disable { + border-color: #CCCCCC; + color: #999; + } + + .date-item .price { + font-size: 25rpx; + color: #D62828; + } + + .date-item.active .price { + color: #fff; + } + .date-item.active view { + color: #fff; + } + + .date-item.disable .price { + color: #999; + } + .date-item.disable .short-date { + color: #999; + } + + .more-item { + /* width: 99rpx; + margin-right: 0; */ + position: absolute; + right: 0; + text-align: center; + padding: 0 26rpx 0 24rpx; + display: flex; + font-weight: 400; + font-size: 27rpx; + color: #0B898E; + align-items: center; + } + + .date-times { + display: flex; + justify-content: space-between; + align-items: center; + margin: 0 21rpx; + padding-top: 34rpx; + padding-bottom: 10rpx; + /* border-top: 1rpx dashed #ccc; */ + flex-wrap: wrap; + } + + .date-time { + width: 315rpx; + line-height: 58rpx; + /* border: 1px solid #333; */ + border-radius: 10rpx; + text-align: center; + font-size: 25rpx; + flex-shrink: 0; + margin-bottom: 24rpx; + color: #000; + background-color: #F5F5F5; + } + + .date-time.disable { + /* border-color: #ccc; + color: #666666; */ + background: #F5F5F5; + font-weight: 400; + font-size: 25rpx; + color: #999999; + } + .short-date { + font-weight: 500; + font-size: 27rpx; + color: #000000; + } + + .date-time.active { + border-color: #0B898E; + background: #0B898E; + color: #fff; + } + + .box-title .iconfont { + font-size: 28rpx; + flex-shrink: 0; + } + + .number-box { + font-size: 29rpx; + font-weight: 500; + color: #000; + flex-shrink: 0; + /* width: 67rpx; */ + line-height: 49rpx; + /* background: #F0F0F0; */ + border-radius: 7rpx; + text-align: center; + margin: 0 20rpx; + } + + .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); + } + + .yuyue-box { + height: 138rpx; + justify-content: center; + } + + .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; + } + + .allowance { + justify-content: space-between; + } + + .allowance>view:nth-child(2) { + display: flex; + align-items: center; + } + + .allowance image { + width: 40rpx; + height: 40rpx; + margin-left: 10rpx; + } + + .allowance .border { + width: 30rpx; + height: 30rpx; + border-radius: 50%; + border: 4rpx solid #0B98BE; + margin-left: 10rpx; + } + + .coupon-btn { + width: 138rpx; + line-height: 56rpx; + border: 1px solid #333333; + border-radius: 29rpx; + text-align: center; + font-size: 28rpx; + color: #000; + } + + .box-title input { + flex: 1; + display: block; + font-size: 31rpx; + color: #666; + margin-left: 15rpx; + font-weight: 400; + text-align: right; + } + + .yuyue-btn { + width: 657rpx; + line-height: 78rpx; + border-radius: 39rpx; + } + + .group-order .yuyue-box { + height: 100rpx; + } + + .group-order .yuyue-btn { + width: 100%; + /* height: 100%; */ + line-height: 100rpx; + border-radius: 0; + } + + .mask-allowance .mask-content { + margin: auto; + top: initial; + bottom: initial; + padding: 20rpx; + } + + .mask-allowance .mask-content .rule-title { + text-align: center; + margin-bottom: 20rpx; + } + + .dialog-top { + color: #999; + font-weight: 500; + padding: 40rpx 33.33rpx 0; + } + + .scene-title { + font-size: 35rpx; + font-weight: bold; + color: #333; + margin-bottom: 32.67rpx; + } + + .people-message { + margin-bottom: 26.67rpx; + /* padding-bottom: 26.67rpx; */ + /* border-bottom: 1px solid #F0F0F0; */ + font-weight: bold; + font-size: 32rpx; + } + + .people { + border-top: 1rpx solid #F0F0F0; + padding: 26.67rpx 0 24rpx; + } + + .flex { + display: flex; + } + + .bottom-btn { + display: flex; + border-top: 1rpx solid #F0F0F0; + height: 96rpx; + /* padding: 32.67rpx 0; */ + } + + .cancle { + width: 50%; + color: #999; + text-align: center; + line-height: 96rpx; + } + + .confirm { + width: 50%; + text-align: center; + color: #D62828; + line-height: 96rpx; + border-left: 1rpx solid #F0F0F0; + } + + .mask-content1 { + max-height: 710rpx; + position: relative; + z-index: 1; + width: 80%; + background: white; + border-radius: 12rpx; + /* margin-bottom: 45%; */ + overflow-y: auto; + margin: auto; + } + .change-date { + font-weight: 500; + font-size: 27rpx; + color: #0B898E; + } + .text1 { + margin-left: 21rpx; + font-weight: 400; + font-size: 23rpx; + color: #0B898E; + margin-bottom: 21rpx; + display: flex; + align-items: flex-end; + padding-bottom: 40rpx; + } + .text2 { + margin-left: 22rpx; + font-weight: 400; + font-size: 23rpx; + color: #666666; + padding-bottom: 41rpx; + } + .mask-content2 { + position: absolute; + left: 0; + right: 0; + bottom: 0; + width: 100%; + background: white; + border-radius: 12rpx; + overflow-y: auto; + height: 1100rpx; + } + .bottom-box { + height: 133rpx; + background: #FFFFFF; + box-shadow: 0rpx -3rpx 8rpx 0rpx rgba(71,71,71,0.1); + padding: 0 50rpx; + display: flex; + justify-content: space-between; + align-items: center; + position: absolute; + left: 0; + right: 0; + bottom: 0; + } + .totalPrice { + font-family: PingFang SC; + font-weight: 500; + font-size: 48rpx; + color: #D62828; + } + .totalPrice::before { + content: "¥"; + font-size: 24rpx; + } + .next { + width: 250rpx; + height: 80rpx; + background: #D62828; + border-radius: 40rpx; + font-family: PingFang; + font-weight: bold; + font-size: 32rpx; + color: #FFFFFF; + text-align: center; + line-height: 80rpx; + } + .icon-close { + position: absolute; + top: 30rpx; + right: 30rpx; + } + .s-price { + font-weight: 500; + font-size: 36rpx; + color: #D62828; + margin-right: 17rpx; + } + .s-price::before { + content: "¥"; + font-size: 24rpx; + } \ No newline at end of file diff --git a/project.private.config.json b/project.private.config.json index 3ee68f4..0ddceb1 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -6,6 +6,13 @@ "condition": { "miniprogram": { "list": [ + { + "name": "pages/info/postProductInfo/index", + "pathName": "pages/info/postProductInfo/index", + "query": "id=428628", + "launchMode": "default", + "scene": null + }, { "name": "首页", "pathName": "pages/index/index", diff --git a/utils/util.js b/utils/util.js index 8ccbf50..04f6e9c 100644 --- a/utils/util.js +++ b/utils/util.js @@ -179,6 +179,14 @@ const gotoDetail = (item,isPagePoint) =>{ }, type: item.type } + + if (item.is_package === 1) { + wx.navigateTo({ + url: '/pages/info/postProductInfo/index?id='+item.id, + }) + return + } + switch(item.type){ case "tenscenic": @@ -320,7 +328,13 @@ const gotoDetail = (item,isPagePoint) =>{ const orderMoreTime = function(item){ if(item && item.order_product_list && item.order_product_list[0]){ let info = item.order_product_list[0]; - if(info.product_model=='movie'){ + console.log(info) + if (info.is_package === 1) { + wx.navigateTo({ + url: '/pages/info/postProductInfo/index?id='+info.id, + }) + } + else if(info.product_model=='movie'){ wx.navigateTo({ url: '/pages/list/movieticket/index', })