diff --git a/pages/info/postProductInfo/index.js b/pages/info/postProductInfo/index.js index b1d3001..f5a2632 100644 --- a/pages/info/postProductInfo/index.js +++ b/pages/info/postProductInfo/index.js @@ -29,7 +29,8 @@ Page({ cartCount: 0, shareImg: null, showShareFlag: false, - allowance_data: null + allowance_data: null, + showAllowance: false }, /** @@ -93,6 +94,11 @@ Page({ }) }, + changeAllowance: function () { + this.setData({ + showAllowance: !this.data.showAllowance + }) + }, BroswerRecord: function () { setTimeout(() => { if (app.globalData.uuid) { diff --git a/pages/info/postProductInfo/index.wxml b/pages/info/postProductInfo/index.wxml index ffba8d8..595326b 100644 --- a/pages/info/postProductInfo/index.wxml +++ b/pages/info/postProductInfo/index.wxml @@ -18,7 +18,7 @@ - + 补贴价 ¥{{ allowance_data.mini_price / 100 }}起 单品最高补贴{{ allowance_data.max_price / 100 }}元 @@ -108,7 +108,8 @@ {{info.sku[skuIndex].price/100}} - 补贴价:¥{{ (1 - allowance_data.discount_rate / 100) * info.sku[skuIndex].price / 100 }} + + 补贴价:¥{{ (1 - allowance_data.discount_rate / 100) * info.sku[skuIndex].price / 100 }} 已选择:{{info.sku[skuIndex].sku_name}} @@ -162,4 +163,11 @@ 保存到相册 + + + + + {{allowance_data.title}} + + \ No newline at end of file diff --git a/pages/info/postProductInfo/index.wxss b/pages/info/postProductInfo/index.wxss index fb4e2d2..bf4277a 100644 --- a/pages/info/postProductInfo/index.wxss +++ b/pages/info/postProductInfo/index.wxss @@ -792,4 +792,18 @@ page { background-color: #FDEDD4; margin-left: 20rpx; border-radius: 30rpx; +} + +.mask-allowance .mask-content { + margin: auto; + width: auto; + top: initial; + bottom: initial; + padding: 20rpx; + width: 80%; +} + +.mask-allowance .mask-content .rule-title { + text-align: center; + margin-bottom: 20rpx; } \ No newline at end of file diff --git a/pages/info/sceneProductInfo/index.js b/pages/info/sceneProductInfo/index.js index 5db666a..0e12985 100644 --- a/pages/info/sceneProductInfo/index.js +++ b/pages/info/sceneProductInfo/index.js @@ -21,7 +21,9 @@ Page({ isTest: true, retailId: "", shareImg: null, - showShareFlag: false + showShareFlag: false, + showAllowance: false, + allowance_data:null, }, /** @@ -86,7 +88,7 @@ Page({ this.setData({ info: res.data }) - util.pagePoint({event:'scene_view',param:{type:res.data.type,id:res.data.id}},1) + util.pagePoint({ event: 'scene_view', param: { type: res.data.type, id: res.data.id } }, 1) this.BroswerRecord() }) // 获取收藏的状态 @@ -123,6 +125,11 @@ Page({ console.log(res) }) }, + changeAllowance: function () { + this.setData({ + showAllowance: !this.data.showAllowance + }) + }, BroswerRecord: function () { setTimeout(() => { if (app.globalData.uuid) { @@ -177,12 +184,12 @@ Page({ bookingInfoTitle: e.currentTarget.dataset.item.sku_name }) util.pagePoint({ - event:"scene_notice", - param:{ - type:this.data.info.type, - id:this.data.info.id + event: "scene_notice", + param: { + type: this.data.info.type, + id: this.data.info.id } - },1) + }, 1) }, closeMask: function () { this.setData({ @@ -190,14 +197,14 @@ Page({ }) }, order: function (e) { - if(e.currentTarget.dataset.disable==1) return; + if (e.currentTarget.dataset.disable == 1) return; util.pagePoint({ - event:'scene_order', - param:{ - type:this.data.info.type, - id:this.data.info.id + event: 'scene_order', + param: { + type: this.data.info.type, + id: this.data.info.id } - },1) + }, 1) wx.setStorageSync('login_from', 'scene_order_login') wx.setStorageSync('order_from', 'scene_order_submit') app.globalData.couponInfo = null; @@ -208,21 +215,21 @@ Page({ url: '/pages/order/scene/index', }) }, - pagePoint: function(e){ + pagePoint: function (e) { util.pagePoint({ - event:e.currentTarget.dataset.event, - param:{ - type:this.data.info.type, - id:this.data.info.id + event: e.currentTarget.dataset.event, + param: { + type: this.data.info.type, + id: this.data.info.id } - },1) + }, 1) }, // 分享 share: function () { if (!wx.getStorageSync("jstrip_token")) { wx.setStorageSync('login_from', 'scene_share_login') commonApi.user_post("user/getMyInfo", {}).then(res => { - }).catch(err=>{ + }).catch(err => { }) return; } @@ -254,7 +261,7 @@ Page({ that.setData({ showShareFlag: !that.data.showShareFlag }) - util.pagePoint({event:'scene_share_save',param:{type:that.data.info.type,id:that.data.info.id}},1) + util.pagePoint({ event: 'scene_share_save', param: { type: that.data.info.type, id: that.data.info.id } }, 1) }, fail(res) { wx.showToast({ @@ -351,10 +358,10 @@ Page({ if (subtitle && subtitle.length > 10) { subtitle = subtitle.substr(0, 10) + '...' } - if(subtitle){ + if (subtitle) { ctx.fillText(subtitle, 25 * ratio, 540 * ratio); } - + // ctx.draw(); // 划线价 // ctx.setFillStyle("#999999"); @@ -478,15 +485,15 @@ Page({ * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { - if(app.globalData.configJson){ + if (app.globalData.configJson) { this.setData({ isTest: app.globalData.configJson.isTest }) } else { - setTimeout(()=>{ + setTimeout(() => { this.onReady() - },300) + }, 300) } }, @@ -499,13 +506,46 @@ Page({ } if (this.data.info && this.data.info.id) { this.drawImg() + // 获取补贴 + if (this.data.product.length == 1) { + commonApi.user_post("product/getProductAllowancePrice", { + product_code: this.data.product[0].product.product_code + }).then(resTwo => { + console.log(resTwo) + if (resTwo && resTwo.code == 1) { + this.setData({ + allowance_data: resTwo.data + }) + let spread_price = Number(this.data.allowance_data.discount_limit_price - this.data.allowance_data.user_used_price) + let sInfo = this.data.product[0].sku + console.log(9999, this.data.allowance_data.discount_rate / 100 * sInfo.price) + console.log(9999, spread_price) + if (spread_price > 0) { + if (spread_price < this.data.allowance_data.discount_rate / 100 * sInfo.price) { + this.setData({ + allowance_price: spread_price + }) + } else { + this.setData({ + allowance_price: this.data.allowance_data.discount_rate / 100 * sInfo.price + }) + } + this.changePrice() + } else { + this.setData({ + allowance_price: 0 + }) + } + } + }) + } } else { setTimeout(() => { this.onShow() }, 200) } - + }, /** diff --git a/pages/info/sceneProductInfo/index.wxml b/pages/info/sceneProductInfo/index.wxml index a1e33b9..678e2ba 100644 --- a/pages/info/sceneProductInfo/index.wxml +++ b/pages/info/sceneProductInfo/index.wxml @@ -6,8 +6,8 @@ 语音导览 --> - + @@ -17,20 +17,29 @@ {{info.title}} - {{item}} + {{item}} + 开园时间:{{info.open_time}} - 优待政策 | 景点介绍 + 优待政策 | 景点介绍 地址:{{info.address}} - {{info.garden_flag_text}} + {{info.garden_flag_text}} + + 补贴价 + ¥{{ info.allowance.mini_price / 100 }}起 + 单品最高补贴{{ info.allowance.max_price / 100 }}元 + {{item.title}} @@ -45,7 +54,9 @@ {{sku.price?sku.price/100:0}} - 立即预订 + 立即预订 @@ -60,10 +71,12 @@ 这里空空如也,快去向大家提问吧! - 去提问 + 去提问 + - + {{item.question_name}} @@ -76,15 +89,17 @@ {{item.created_time}}提问 --> - + - 查看全部问答 + + 查看全部问答 - 游客点评{{info.rate}}分 + 游客点评{{info.rate}}分 共{{commentTotal}}条 @@ -96,16 +111,19 @@ {{item.user.nickname}} - + {{item.create_time}} {{item.content}} - 查看全部点评 + + 查看全部点评 - + + @@ -117,17 +135,31 @@ 保存到相册 + + + + {{info.allowance.title}} + + + \ No newline at end of file diff --git a/pages/info/sceneProductInfo/index.wxss b/pages/info/sceneProductInfo/index.wxss index 13cf581..08e01c8 100644 --- a/pages/info/sceneProductInfo/index.wxss +++ b/pages/info/sceneProductInfo/index.wxss @@ -2,15 +2,18 @@ page { background: #f2f2f2; } + .swiper { width: 100%; height: 400rpx; } + .swiper image { height: 400rpx; display: block; width: 100%; } + .top-info { border-radius: 20rpx 20rpx 0 0; background: white; @@ -19,11 +22,13 @@ page { margin-top: -20rpx; padding: 20rpx 40rpx; } + .top-info .title { font-size: 32rpx; font-weight: 500; color: #000; } + .tags-box { margin-top: 10rpx; margin-bottom: 20rpx; @@ -33,6 +38,7 @@ page { font-size: 27rpx; height: 50rpx; } + .tags-box .tag { position: relative; line-height: 20rpx; @@ -41,6 +47,7 @@ page { line-height: 50rpx; margin-right: 10rpx; } + .tags-box .tag .line { content: "1"; display: block; @@ -53,32 +60,39 @@ page { top: 30rpx; z-index: -1; } + .tags-text { flex: 1; text-align: right; } + .tags-box .iconfont { margin-left: 4rpx; font-size: 24rpx; } + .address-box { justify-content: space-between; margin-top: 0; } + .info-address { color: #666; font-size: 27rpx; margin-bottom: 0rpx; line-height: 40rpx; } + .address-box .iconfont { font-size: 34rpx; } + .box { margin: 20rpx; background: white; border-radius: 13rpx; } + .box-top { line-height: 95rpx; border-bottom: 1rpx solid #d9d9d9; @@ -87,29 +101,35 @@ page { font-size: 35rpx; padding: 0 20rpx; } + .product-item { margin: 0 20rpx; padding: 27rpx 0; border-bottom: 1rpx solid #ccc; } + .skutitle { font-size: 29rpx; color: #333; font-weight: 500; } + .product-box { display: flex; align-items: flex-end; justify-content: space-between; margin-top: 20rpx; } + .product-left { flex: 1; } + .product-tags { display: flex; align-items: center; } + .product-tag { font-size: 20rpx; color: #0B898E; @@ -119,31 +139,38 @@ page { padding: 0 15rpx; margin-right: 13rpx; } + .product-tags .product-tags:last-child { margin-right: 0; } + .order-tip-text { margin-top: 33rpx; font-size: 24rpx; color: #666; } + .product-right { text-align: center; flex-shrink: 0; } + .product-right .price { color: #D62828; font-size: 24rpx; margin-bottom: 20rpx; } -.product-right .price text:nth-child(2){ + +.product-right .price text:nth-child(2) { font-weight: 500; font-size: 33rpx; } -.product-right .price text:nth-child(3){ + +.product-right .price text:nth-child(3) { color: #8D8D8D; font-size: 20rpx; } + .product-right .btn { background: #D62828; color: #fff; @@ -153,23 +180,28 @@ page { font-weight: 500; width: 176rpx; } + .product-right .btn.disable { background: #ccc; } + .box .product-item:last-child { border-bottom: none; } + .box-top .iconfont { color: #0B898E; font-size: 33rpx; margin-right: 16rpx; } + .empty-box { text-align: center; padding: 40rpx 0; font-size: 23rpx; color: #333; } + .empty-btn { margin: 0 auto; margin-top: 30rpx; @@ -181,17 +213,20 @@ page { font-size: 32rpx; margin-bottom: 10rpx; } + .box-top .score { color: #D62828; font-size: 30rpx; font-weight: 400; margin-left: 11rpx; } + .product-comment { margin: 0 20rpx; border-bottom: 1rpx solid #ccc; padding: 33rpx 0; } + .product-comment-top { display: flex; justify-content: space-between; @@ -199,31 +234,37 @@ page { align-items: center; font-size: 24rpx; } + .product-comment-top image { flex-shrink: 0; width: 57rpx; height: 57rpx; border-radius: 50%; } + .product-comment-top .comment-info { flex: 1; margin: 0 15rpx; color: #666; font-size: 21rpx; } + .product-comment-top .comment-info .iconfont { color: #D62828; font-size: 22rpx; } -.product-comment-top .comment-info .iconfont text { + +.product-comment-top .comment-info .iconfont text { margin-right: 6rpx; } + .comment-content { margin-left: 72rpx; margin-top: 36rpx; font-size: 28rpx; color: #000; } + .more-comment-btn { line-height: 93rpx; margin-right: 20rpx; @@ -232,23 +273,28 @@ page { font-size: 27rpx; font-weight: 500; } + .more-comment-btn .iconfont { margin-left: 6rpx; font-size: 24rpx; } + .all-comment-num { float: right; color: #999999; font-size: 27rpx; font-weight: 400; } + .ask-list .ask-item:nth-child(1) { margin-top: 40rpx; } + .ask-item { padding: 0 25rpx; margin-bottom: 40rpx; } + .item-ques { display: flex; color: #000; @@ -256,16 +302,19 @@ page { font-size: 29rpx; line-height: 38rpx; } + .item-ques image { width: 36rpx; margin-right: 18rpx; flex-shrink: 0; } + .item-ques .ques { font-size: 32rpx; font-weight: 500; flex: 1; } + .ques-tip { margin-left: 54rpx; color: #999999; @@ -274,14 +323,18 @@ page { align-items: center; justify-content: space-between; } + .ans-number { color: #0B898E; font-size: 28rpx; } + .ans-number .iconfont { font-size: 28rpx; } -.icon-xin,.icon-shoucang { + +.icon-xin, +.icon-shoucang { position: absolute; right: 100rpx; margin-top: 20rpx; @@ -294,9 +347,11 @@ page { font-size: 36rpx; z-index: 1; } + .icon-shoucang { color: #D62828; } + .ques-num { flex-shrink: 0; margin-left: 10rpx; @@ -304,6 +359,7 @@ page { color: #999; font-weight: 400; } + .audio-box { display: flex; align-items: center; @@ -319,6 +375,7 @@ page { font-size: 31rpx; z-index: 1; } + .audio-box image { width: 45rpx; display: block; @@ -333,6 +390,7 @@ page { bottom: 0; width: 100%; } + .mask-content .icon-close { position: absolute; right: 40rpx; @@ -348,10 +406,12 @@ page { align-items: center; justify-content: center; } + .share-img { display: block; width: 551rpx; } + .share-tips { width: 426rpx; height: 150rpx; @@ -367,12 +427,14 @@ page { text-align: center; line-height: 40rpx; } + .share-tips .img { display: block; width: 55rpx; margin: 0 auto; margin-bottom: 4rpx; } + .tipimg { position: absolute; left: 50%; @@ -386,11 +448,13 @@ page { justify-content: center; top: 34rpx; } + .tipimg image { width: 21rpx; display: block; - + } + .save-btn { width: 403rpx; line-height: 77rpx; @@ -402,6 +466,7 @@ page { font-weight: 500; margin-top: 50rpx; } + .status-text { position: absolute; right: 0; @@ -415,8 +480,60 @@ page { font-weight: bold; border-radius: 23rpx 0px 0px 23rpx; } + .status-text.disable { width: 120rpx; background: rgba(51, 51, 51, .1); color: #666666; +} + +.allowance-box { + height: 113rpx; + background: url("https://sz-qd.oss-cn-hangzhou.aliyuncs.com/uploads/20220606/0b2895725088c04fb182e09ec186f895.png"); + background-size: 100% auto; + background-repeat: no-repeat; + padding: 30rpx 30rpx 10rpx; + font-size: 24rpx; + color: #FFFFFF; + position: relative; + display: flex; + justify-content: start; + align-items: baseline; +} + +.allowance-box .com-price { + font-size: 30rpx; + color: #FFFFFF; +} + +.allowance-box .com-price:before { + font-size: 18rpx; + color: #FFFFFF; +} + +.allowance-box .com-price:after { + font-size: 18rpx; + color: #FFFFFF; +} + +.allowance-box .yellow { + color: #DF2115; + padding: 8rpx 14rpx; + background-color: #FDEDD4; + margin-left: 20rpx; + border-radius: 30rpx; +} + +.mask-allowance .mask-content { + margin: auto; + width: auto; + top: initial; + bottom: initial; + padding: 20rpx; + width: 80%; +} + +.mask-allowance .mask-content .rule-title { + text-align: center; + margin-bottom: 20rpx; } \ No newline at end of file diff --git a/pages/order/postOrder/index.js b/pages/order/postOrder/index.js index cbc5fe4..3ed318c 100644 --- a/pages/order/postOrder/index.js +++ b/pages/order/postOrder/index.js @@ -20,6 +20,7 @@ Page({ select_allowance: false, allowance_data: null, allowance_price: 0, + showAllowance: false, }, /** @@ -51,6 +52,11 @@ Page({ this.couponCom = this.selectAllComponents("#coupon")[0]; } }, + changeAllowance: function () { + this.setData({ + showAllowance: !this.data.showAllowance + }) + }, inputRemark: function (e) { let index = e.currentTarget.dataset.index, product = this.data.product; product[index].remark = e.detail.value; diff --git a/pages/order/postOrder/index.wxml b/pages/order/postOrder/index.wxml index 37a6c25..ee1f9f6 100644 --- a/pages/order/postOrder/index.wxml +++ b/pages/order/postOrder/index.wxml @@ -38,7 +38,7 @@ - 惠民补贴 + 惠民补贴 -¥{{allowance_price / 100}} 合计:¥{{postFee?(0+postFee)/100:0}} 提交订单 + + + + + {{allowance_data.title}} + + \ No newline at end of file diff --git a/pages/order/postOrder/index.wxss b/pages/order/postOrder/index.wxss index d70b647..fde5a52 100644 --- a/pages/order/postOrder/index.wxss +++ b/pages/order/postOrder/index.wxss @@ -210,4 +210,16 @@ page { line-height: 113rpx; padding: 0 20rpx; border-bottom: 1rpx solid #d8d8d8; +} + +.mask-allowance .mask-content { + margin: auto; + top: initial; + bottom: initial; + padding: 20rpx; +} + +.mask-allowance .mask-content .rule-title { + text-align: center; + margin-bottom: 20rpx; } \ No newline at end of file diff --git a/pages/order/scene/index.js b/pages/order/scene/index.js index 1c16b66..9a44ffe 100644 --- a/pages/order/scene/index.js +++ b/pages/order/scene/index.js @@ -8,20 +8,24 @@ Page({ * 页面的初始数据 */ data: { - product:app.globalData.product, - productNum:1, - linkmanList:[], - date:"", - time:"", - remark:"", - singlePrice:0, - type:null, - coupon:app.globalData.couponInfo, - isLogin:false, - kjId:null, - gp_id:null, - groupName:"", - prizeId:null + product: app.globalData.product, + productNum: 1, + linkmanList: [], + date: "", + time: "", + remark: "", + singlePrice: 0, + type: null, + coupon: app.globalData.couponInfo, + isLogin: false, + kjId: null, + gp_id: null, + groupName: "", + prizeId: null, + select_allowance: false, + showAllowance: false, + allowance_data: null, + allowance_price: 0, }, /** @@ -29,229 +33,250 @@ Page({ */ onLoad: function (options) { this.setData({ - type:options.type, - kjId:app.globalData.kjId, - gp_id:app.globalData.gp_id || app.globalData.team_id, - prizeId:wx.getStorageSync('prizeId') + type: options.type, + kjId: app.globalData.kjId, + gp_id: app.globalData.gp_id || app.globalData.team_id, + prizeId: wx.getStorageSync('prizeId') }) - if(!app.globalData.product){ + if (!app.globalData.product) { util.back(); return; } - if(app.globalData.product.productNum){ + if (app.globalData.product.productNum) { this.setData({ - productNum:app.globalData.product.productNum<1?1:app.globalData.product.productNum + productNum: app.globalData.product.productNum < 1 ? 1 : app.globalData.product.productNum }) } this.setData({ - product:app.globalData.product, - singlePrice:this.data.gp_id?app.globalData.product.sku.event_price:app.globalData.product.sku.price + product: app.globalData.product, + singlePrice: this.data.gp_id ? app.globalData.product.sku.event_price : app.globalData.product.sku.price }) - if(!this.data.kjId && !this.data.gp_id && this.data.product.isGroup!=1){ + if (!this.data.kjId && !this.data.gp_id && this.data.product.isGroup != 1) { this.couponCom = this.selectAllComponents("#coupon")[0]; } }, - changeGroupName:function(e){ + changeGroupName: function (e) { this.setData({ - groupName:e.detail.value + groupName: e.detail.value }) }, - setLinkman:function(e){ + setLinkman: function (e) { let linkmanList = e.detail; - if(this.data.productNum!=linkmanList.length && this.data.coupon){ + if (this.data.productNum != linkmanList.length && this.data.coupon) { wx.showToast({ title: '订单价格发生变化,请重新选择优惠券', icon: 'none' }) - if(!this.data.kjId && !this.data.gp_id && this.data.product.isGroup!=1){ + if (!this.data.kjId && !this.data.gp_id && this.data.product.isGroup != 1) { this.couponCom.setNullCoupon() } app.globalData.couponInfo = null; this.setData({ - coupon:null + coupon: null }) } - let productNum = linkmanList.length==0?1:linkmanList.length; - if(this.data.gp_id){ + let productNum = linkmanList.length == 0 ? 1 : linkmanList.length; + if (this.data.gp_id) { productNum = app.globalData.product.maxNum; } this.setData({ - productNum:productNum, - linkmanList:linkmanList + productNum: productNum, + linkmanList: linkmanList }) + this.changePrice() }, - add:function(){ - if(this.data.product.sku.sku_model.traveller_limit_num!=0 && this.data.productNum==this.data.product.sku.sku_model.traveller_limit_num){ + add: function () { + 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' + title: '出行人限购' + this.data.product.sku.sku_model.traveller_limit_num + "份", + icon: 'none' }) return; } this.setData({ - productNum:this.data.productNum+1 + productNum: this.data.productNum + 1 }) + this.changePrice() }, - minus:function(){ - if(this.data.productNum==1) return; - if(this.data.coupon){ + minus: function () { + 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){ + if (!this.data.kjId && !this.data.gp_id && this.data.product.isGroup != 1) { this.couponCom.setNullCoupon() } app.globalData.couponInfo = null; this.setData({ - productNum:(this.data.productNum-1), - coupon:null + productNum: (this.data.productNum - 1), + coupon: null }) + this.changePrice() }, - changeDate:function(e){ - if(e.detail.price!=this.data.singlePrice && this.data.coupon) { + changeDate: function (e) { + if (e.detail.price != this.data.singlePrice && this.data.coupon) { wx.showToast({ title: '订单价格发生变化,请重新选择优惠券', icon: 'none' }) this.setData({ - coupon:null + coupon: null }) - if(!this.data.kjId && !this.data.gp_id && this.data.product.isGroup!=1){ + if (!this.data.kjId && !this.data.gp_id && this.data.product.isGroup != 1) { this.couponCom.setNullCoupon() } app.globalData.couponInfo = null; } this.setData({ - date:e.detail, - singlePrice:this.data.gp_id?this.data.product.sku.event_price:e.detail.price + date: e.detail, + singlePrice: this.data.gp_id ? this.data.product.sku.event_price : e.detail.price + }) + this.changePrice() + }, + changeTime: function (e) { + this.setData({ + time: e.detail }) - console.log(e.detail) }, - changeTime:function(e){ + changeAllowance: function () { this.setData({ - time:e.detail + showAllowance: !this.data.showAllowance }) }, - changeRemark:function(e){ + changeRemark: function (e) { this.setData({ - remark:e.detail.value + remark: e.detail.value }) }, - 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=[]; - if(linkmanList.length{ + linkmanList.map(item => { linkmanIds.push(item.id) }) let data = { - coupon_id:this.data.coupon?this.data.coupon.id:null, - source:"WECHATXCX", + 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:date.sku_id?date.sku_id:product.sku.id, - start_time:time.start_time, - end_time:time.end_time, - use_date:date.date, - visitors:linkmanIds.join(","), - remark:remark, - product_num:app.globalData.product.isGroup==1?1:productNum + type: product.product.type, + product_id: product.product.id, + sku_id: date.sku_id ? date.sku_id : product.sku.id, + start_time: time.start_time, + end_time: time.end_time, + use_date: date.date, + visitors: linkmanIds.join(","), + remark: remark, + product_num: app.globalData.product.isGroup == 1 ? 1 : productNum }], - originate_order_id:this.data.kjId, - gp_id:app.globalData.gp_id, - team_id:app.globalData.team_id + originate_order_id: this.data.kjId, + gp_id: app.globalData.gp_id, + team_id: app.globalData.team_id } - if(app.globalData.from){ + if (app.globalData.from) { data.system_name = app.globalData.from; } - if(app.globalData.retailId){ + if (app.globalData.retailId) { data.commission_code = app.globalData.retailId; app.globalData.retailId = null; } - if(app.globalData.category_id){ + if (app.globalData.category_id) { data.category_id = app.globalData.category_id; } - if(this.data.prizeId){ + if (this.data.prizeId) { data.lottery_id = this.data.prizeId } - let service = 'order/create',postData={ - data:JSON.stringify(data) + let service = 'order/create', postData = { + data: JSON.stringify(data) } - if(app.globalData.product.isGroup==1){ + 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; } - - commonApi.user_post(service,postData).then(res=>{ - if(app.globalData.kjId){ + + commonApi.user_post(service, postData).then(res => { + if (app.globalData.kjId) { this.setData({ - kjId:null + kjId: null }); app.globalData.kjId = null; } - if(app.globalData.gp_id){ + if (app.globalData.gp_id) { this.setData({ - gp_id:null + gp_id: null }); app.globalData.gp_id = null; } - if(res.code==1 && app.globalData.product.isGroup==1){ + if (res.code == 1 && app.globalData.product.isGroup == 1) { // 团购跳转到团购详情 wx.navigateTo({ - url: '/pages/info/groupOrderInfo/index?id='+res.data.order_id+'&from=order' + url: '/pages/info/groupOrderInfo/index?id=' + res.data.order_id + '&from=order' }) } }) }, // 活动预约 - activityOrder:function(){ - if(this.data.linkmanList && this.data.linkmanList.length>0){ - commonApi.user_post("pbservice/Culture/booking",{ - id:this.data.product.product.id, - name:this.data.linkmanList[0].name, - card_number:this.data.linkmanList[0].id_number, - tel:this.data.linkmanList[0].tel - }).then(res=>{ - if(res.code==1){ + activityOrder: function () { + if (this.data.linkmanList && this.data.linkmanList.length > 0) { + commonApi.user_post("pbservice/Culture/booking", { + id: this.data.product.product.id, + name: this.data.linkmanList[0].name, + card_number: this.data.linkmanList[0].id_number, + tel: this.data.linkmanList[0].tel + }).then(res => { + if (res.code == 1) { wx.showToast({ title: '预约成功', - icon:'success' + icon: 'success' }) - setTimeout(()=>{ + setTimeout(() => { wx.navigateBack() - },1000) + }, 1000) return; } }) @@ -259,11 +284,20 @@ Page({ else { wx.showToast({ title: '请选择出行人', - icon:'none' + icon: 'none' }) return; } - + + }, + /** + * 选择补贴 + */ + selectAllowance: function () { + this.setData({ + select_allowance: !this.data.select_allowance + }) + this.changePrice() }, /** @@ -277,18 +311,49 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - if(!this.data.isLogin){ - commonApi.user_post("token/check").then(res=>{ - if(res.code==1){ + if (!this.data.isLogin) { + commonApi.user_post("token/check").then(res => { + if (res.code == 1) { this.setData({ - isLogin:true + isLogin: true }) } }) } this.setData({ - coupon:app.globalData.couponInfo + coupon: app.globalData.couponInfo }) + // 获取补贴 + if (this.data.product) { + commonApi.user_post("product/getProductAllowancePrice", { + product_code: this.data.product.product.product_code + }).then(resTwo => { + console.log(resTwo) + if (resTwo && resTwo.code == 1) { + this.setData({ + allowance_data: resTwo.data + }) + let spread_price = Number(this.data.allowance_data.discount_limit_price - this.data.allowance_data.user_used_price) + let sInfo = this.data.product.sku + if (spread_price > 0) { + if (spread_price < this.data.allowance_data.discount_rate / 100 * sInfo.price) { + this.setData({ + allowance_price: spread_price + }) + } else { + this.setData({ + allowance_price: this.data.allowance_data.discount_rate / 100 * sInfo.price + }) + } + this.changePrice() + } else { + this.setData({ + allowance_price: 0 + }) + } + } + }) + } }, /** @@ -303,8 +368,8 @@ Page({ */ onUnload: function () { this.setData({ - kjId:null, - gp_id:null + kjId: null, + gp_id: null }); app.globalData.kjId = null; app.globalData.gp_id = null; diff --git a/pages/order/scene/index.wxml b/pages/order/scene/index.wxml index 5689e66..393ea3d 100644 --- a/pages/order/scene/index.wxml +++ b/pages/order/scene/index.wxml @@ -5,7 +5,8 @@ {{product.product.title + product.isGroup==1?'(团体预约)':product.sku.sku_name}} 免费 - + 团体主体名称: @@ -21,7 +22,20 @@ - + + + + 惠民补贴 + + -¥{{allowance_price / 100}} + + + + + + 订单备注 @@ -33,7 +47,9 @@ 合计:¥0 - 合计:¥{{((singlePrice * productNum - (coupon?coupon.activity.money:0))>0?(singlePrice * productNum - (coupon?coupon.activity.money:0)):0)/ 100}} + 合计:¥{{((singlePrice * productNum - (coupon?coupon.activity.money:0))>0?(singlePrice * productNum - (coupon?coupon.activity.money:0)):0)/ 100}} + 提交订单 diff --git a/pages/order/scene/index.wxss b/pages/order/scene/index.wxss index 4994410..bd1bf08 100644 --- a/pages/order/scene/index.wxss +++ b/pages/order/scene/index.wxss @@ -2,43 +2,54 @@ 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 { + +.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; @@ -48,12 +59,14 @@ page { display: flex; align-items: center; } + .dates-boxes { display: flex; align-items: center; padding: 31rpx 21rpx; border-top: 1rpx solid #ccc; } + .date-item { width: 162rpx; height: 97rpx; @@ -68,29 +81,36 @@ page { align-items: center; flex-direction: column; } + .date-item.active { border-color: #0B898E; color: #fff; background: #0B898E; } + .date-item.disable { border-color: #CCCCCC; color: #666; } + .date-item .price { font-size: 25rpx; color: #D62828; } + .date-item.active .price { color: #fff; } + .date-item.disable .price { color: #666; } + .more-item { width: 99rpx; margin-right: 0; } + .date-times { display: flex; justify-content: space-between; @@ -101,6 +121,7 @@ page { border-top: 1rpx dashed #ccc; flex-wrap: wrap; } + .date-time { width: 315rpx; line-height: 58rpx; @@ -112,19 +133,23 @@ page { margin-bottom: 24rpx; color: #000; } + .date-time.disable { border-color: #ccc; color: #666666; } + .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; @@ -151,10 +176,12 @@ page { 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; @@ -164,6 +191,7 @@ page { font-size: 36rpx; font-weight: 500; } + .fixed-price-box { margin-left: 25rpx; flex-shrink: 0; @@ -171,11 +199,36 @@ page { 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; @@ -185,6 +238,7 @@ page { font-size: 28rpx; color: #000; } + .box-title input { flex: 1; display: block; @@ -194,17 +248,32 @@ page { 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; } \ No newline at end of file diff --git a/project.private.config.json b/project.private.config.json index 48d2c65..37323d8 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -13,15 +13,15 @@ "miniprogram": { "list": [ { - "name": "产品详情4407", + "name": "特产4407", "pathName": "pages/info/postProductInfo/index", "query": "id=4407", "scene": null }, { - "name": "pages/index/index", - "pathName": "pages/index/index", - "query": "id=59532108251510343335", + "name": "景点5447", + "pathName": "pages/info/sceneProductInfo/index", + "query": "id=5447", "scene": null }, { diff --git a/utils/https.js b/utils/https.js index 1e2e477..eff4157 100644 --- a/utils/https.js +++ b/utils/https.js @@ -2,7 +2,13 @@ var app = getApp(); import util from "../utils/util" // import userApi from "../utils/https/user.js"; // const baseUrl = "https://test.api.cloud.sz-trip.com/api/"; -const baseUrl = "https://api.cloud.sz-trip.com/api/"; +let baseUrl = "https://api.cloud.sz-trip.com/api/"; +const env = wx.getAccountInfoSync().miniProgram.envVersion +if (env == 'develop') { + baseUrl = "https://test.api.cloud.sz-trip.com/api/" +} else { + baseUrl = "https://api.cloud.sz-trip.com/api/"; +} const orders = ['', 'weight', 'distance', 'sale_number', 'sale_price', 'price']; //封装GET请求 function _get(url, data) {