From 24fef20608116de5dd15e6b4b09cea766aeb6f94 Mon Sep 17 00:00:00 2001 From: jiazhipeng Date: Fri, 30 Aug 2024 15:44:54 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=92=E5=BA=97=E6=B0=91=E5=AE=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 18 + static/js/CommonFunction.js | 9 + static/js/request.js | 2 +- subPackages/hotelHomestay/detail.vue | 761 ++++++++++++++++++++ subPackages/hotelHomestay/hotelHomestay.vue | 45 +- subPackages/hotelHomestay/order.vue | 600 +++++++++++++++ subPackages/hotelHomestay/policy.vue | 110 +++ subPackages/techan/detail.vue | 16 +- subPackages/techan/order.vue | 52 +- subPackages/ticketBooking/detail.vue | 15 +- subPackages/ticketBooking/order.vue | 203 +++++- subPackages/ticketBooking/ticketBooking.vue | 17 +- 12 files changed, 1779 insertions(+), 69 deletions(-) create mode 100644 subPackages/hotelHomestay/detail.vue create mode 100644 subPackages/hotelHomestay/order.vue create mode 100644 subPackages/hotelHomestay/policy.vue diff --git a/pages.json b/pages.json index 26f6596..06f7c7c 100644 --- a/pages.json +++ b/pages.json @@ -138,6 +138,24 @@ "navigationStyle": "custom" } }, + { + "path": "hotelHomestay/detail", + "style": { + "navigationBarTitleText": "酒店详情" + } + }, + { + "path": "hotelHomestay/policy", + "style": { + "navigationBarTitleText": "设施/政策" + } + }, + { + "path": "hotelHomestay/order", + "style": { + "navigationBarTitleText": "酒店民宿" + } + }, { "path": "food/taocanDetail", "style": { diff --git a/static/js/CommonFunction.js b/static/js/CommonFunction.js index cb001e9..72df1a0 100644 --- a/static/js/CommonFunction.js +++ b/static/js/CommonFunction.js @@ -195,4 +195,13 @@ Date.prototype.Format = function(fmt) if(new RegExp("("+ k +")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length))); return fmt; +} + +// 获取最大优惠券 params:{money:100,sku_ids:1,2} +Vue.prototype.getMaxCoupon = async function (param) { + let res = await this.Post(param, "/api/coupon/use_max_coupon_list") + if (res.code == 1 && res.data.id) { + this.$store.commit("choseCoupon",res.data); + } + return res.data } \ No newline at end of file diff --git a/static/js/request.js b/static/js/request.js index e71d867..77bb1d5 100644 --- a/static/js/request.js +++ b/static/js/request.js @@ -16,7 +16,7 @@ Vue.prototype.Post = (params, apiurl) => { data: params || {}, header: params.header || { 'content-type': 'application/json', - 'token': params.token || '2dd9b712-f118-41f6-b3a8-602e4fbb0ce3' + 'token': params.token || '75895d8b-1804-42e1-8be8-bfdaa9574a5f' }, success: res => { uni.hideLoading() diff --git a/subPackages/hotelHomestay/detail.vue b/subPackages/hotelHomestay/detail.vue new file mode 100644 index 0000000..94cb777 --- /dev/null +++ b/subPackages/hotelHomestay/detail.vue @@ -0,0 +1,761 @@ + + + + + diff --git a/subPackages/hotelHomestay/hotelHomestay.vue b/subPackages/hotelHomestay/hotelHomestay.vue index e99754f..210c7a3 100644 --- a/subPackages/hotelHomestay/hotelHomestay.vue +++ b/subPackages/hotelHomestay/hotelHomestay.vue @@ -9,10 +9,10 @@ - + - + @@ -22,11 +22,12 @@ {{item.title}} - - 盐都精选 - 盐都精选 + + + {{tag}} + - + {{showPrice(item.price)}} @@ -39,7 +40,7 @@ - 没有更多数据了 + @@ -59,20 +60,17 @@ headImg:null, navList: [], actNavIndex: 0, - type_id: 9,//演出票务的景点分类id + type_id: 11,//酒店分类id } }, onShow() { this.headImg = 'https://tongli.sz-trip.com/uploads/20240826/8653c32761e01ee683505eddba1ae22b.png' this.finished = false - this.list = [ - {id:1, title:'景点名称景点名称景点名称 景点名称', - address:'景点名称景点名称景点名称 景点名称景点名称景点名称景点名称 景点名称',price:10000, - image:'https://tongli.sz-trip.com/uploads/20240826/a87488f6225789aa19dbb437671d388d.png', - } - ] // this.getHeadImg('piaowu') }, + onReady() { + this.getList() + }, onLoad(options) { let that = this uni.getSystemInfo({ @@ -107,10 +105,11 @@ // 根据景点标签获取景点列表 getList(){ this.Post({ - tag_id: this.navList[this.actNavIndex].id, - offset: this.list.length, - limit: 10 - },'https://yjdtadmin.sz-trip.com/api/scenic/getScenicByTagId').then(res => { + scenic_type_id: this.type_id,offset: this.list.length,limit: 10, + lon: uni.getStorageSync('location').lon || '120', + lat: uni.getStorageSync('location').lat || '30', + }, + '/api/Scenic/getScenicByType').then(res => { this.list = [...this.list, ...res.data]; if (res.data.length < 10) { this.finished = true @@ -123,9 +122,9 @@ this.Post({ type: 4, id: item.id - }, 'https://yjdtadmin.sz-trip.com/api/scenic/collect').then(res => { - if (res.code == 200) { - uni.showToast({title: res.msg}) + }, '/api/scenic/collect').then(res => { + if (res.code == 1) { + uni.showToast({title: res.msg,icon:'none'}) if (item.is_collect == 1) { item.is_collect = 0 } else { @@ -213,6 +212,8 @@ .tag-container{ display: flex; + flex-wrap: nowrap; + overflow-x: auto; .tag{ background: rgba(205,233,209,0.3); border-radius: 7rpx 5rpx 5rpx 7rpx; @@ -224,11 +225,13 @@ color: #4E7956; text-align: center; margin-right: 12rpx; + flex-shrink: 0; } } .priceBox{ + width: 120rpx; .price{ font-family: PingFang SC; font-weight: bold; diff --git a/subPackages/hotelHomestay/order.vue b/subPackages/hotelHomestay/order.vue new file mode 100644 index 0000000..36c859d --- /dev/null +++ b/subPackages/hotelHomestay/order.vue @@ -0,0 +1,600 @@ + + + + + diff --git a/subPackages/hotelHomestay/policy.vue b/subPackages/hotelHomestay/policy.vue new file mode 100644 index 0000000..3c4dbb8 --- /dev/null +++ b/subPackages/hotelHomestay/policy.vue @@ -0,0 +1,110 @@ + + + + + diff --git a/subPackages/techan/detail.vue b/subPackages/techan/detail.vue index 45f62e3..f6232d8 100644 --- a/subPackages/techan/detail.vue +++ b/subPackages/techan/detail.vue @@ -31,7 +31,7 @@ 选择: - {{sku[productIndex].title}} + {{sku[productIndex].title || '暂无可选规格'}} @@ -181,7 +181,7 @@ '/api/goods/getSpecificationsByGoodsId' ).then(res => { if (res) { - this.sku = res.data; + this.sku = res.data || []; } }); }, @@ -218,6 +218,14 @@ this.$refs.popup.close() }, openPop() { + if (!this.sku||this.sku.length<=0) { + uni.showToast({ + title:'暂无可选规格', + icon:'none' + }) + return + } + if (!this.popShow) { this.$refs.popup.open() } else { @@ -227,8 +235,8 @@ order(item) { let goods = this.sku[this.productIndex] goods.buyNum = this.buyNum - uni.setStorageSync('order', JSON.stringify(goods)); //规格 - uni.setStorageSync('info', JSON.stringify(this.info)); //商品 + uni.setStorageSync('teChanOrder', JSON.stringify(goods)); //规格 + uni.setStorageSync('teChanInfo', JSON.stringify(this.info)); //商品 uni.navigateTo({ url: '/subPackages/techan/order' }); diff --git a/subPackages/techan/order.vue b/subPackages/techan/order.vue index 5967d60..04d00ae 100644 --- a/subPackages/techan/order.vue +++ b/subPackages/techan/order.vue @@ -117,7 +117,7 @@ - + 优惠券 请选择 @@ -233,8 +233,8 @@ export default { }, onLoad() { this.$store.commit("choseCoupon", ""); - this.info = JSON.parse(uni.getStorageSync('order')); - this.detail = JSON.parse(uni.getStorageSync('info')); + this.info = JSON.parse(uni.getStorageSync('teChanOrder')); + this.detail = JSON.parse(uni.getStorageSync('teChanInfo')); if (!this.info) { uni.navigateBack(); return @@ -257,6 +257,15 @@ export default { }, onUnload(){ uni.$off("updateDataByConnect",this.getDataByConnect) + }, + onReady () { + this.$nextTick(()=>{ + setTimeout(()=>{ + this.getMaxCouponData() + },1000) + }) + + }, methods: { getContacts() { @@ -409,7 +418,7 @@ export default { } } else{ - price = ((this.info.money) * this.info.buyNum + postPrice) - (((this.info.money) * this.info.buyNum + postPrice) * this.coupon.percent) + price = ((this.info.money) * this.info.buyNum + postPrice) - (((this.info.money) * this.info.buyNum + postPrice) * this.coupon.percent/100) } } else { price = (this.info.money) * this.info.buyNum + postPrice @@ -441,7 +450,7 @@ export default { }); return; } - if (!this.IsTel(this.pickupPerson)) { + if (!this.IsTel(this.pickupPerson.phone)) { uni.showToast({ title: '请输入自提人手机号', icon: 'none' @@ -462,7 +471,6 @@ export default { if (this.sendType == 2) { goodsItem.extract_id = this.pickupAddress.id; - goodsItem.contact_id = this.pickupPerson.id; } else if (this.sendType == 1){ goodsItem.consignee_id = this.contacts.id } @@ -473,9 +481,8 @@ export default { coupon: this.coupon ? this.coupon.id : "", remark: this.remark, is_post: this.info.is_post, - reserve_name: this.reserve_name, - reserve_phone: this.reserve_phone, - reserve_idcard: this.reserve_idcard + reserve_name: this.pickupPerson.name, + reserve_phone: this.pickupPerson.phone, }; this.Post( { @@ -484,6 +491,8 @@ export default { }, '/api/order/place' ).then(res => { + uni.removeStorageSync('teChanOrder') + uni.removeStorageSync('teChanInfo') if (res.code == 1) { this.Post( { @@ -523,6 +532,15 @@ export default { } }, + // 获取最大优惠券 + async getMaxCouponData () { + let param = {money:this.allprice,sku_ids:this.info.id} + let res = await this.getMaxCoupon(param) + if (res.id) { + this.coupon = res + } + } + } @@ -801,20 +819,20 @@ view { } } .btn-list { - width: 750rpx; + width: 100%; height: 166rpx; background: #ffffff; box-shadow: 0rpx -3rpx 9rpx 1rpx rgba(227, 229, 232, 0.5); display: flex; position: fixed; bottom: 0; - padding: 20rpx 50rpx; + padding: 20rpx 20rpx; align-items: center; justify-content: space-between; .btn { width: 294rpx; height: 88rpx; - background: linear-gradient(90deg, #F84A56, #FF9834); + background: #F84A56; border-radius: 43rpx; text-align: center; line-height: 88rpx; @@ -829,14 +847,14 @@ view { display: flex; align-items: center; .text { - font-size: 28rpx; + font-size: 29rpx; font-family: PingFangSC-Regular, PingFang SC; - font-weight: 400; - color: #393b3e; + font-weight: 500; + color: #333; } .price { margin-left: 15rpx; - font-size: 48rpx; + font-size: 36rpx; font-family: PingFangSC-Regular, PingFang SC; font-weight: 400; color: #fc5109; @@ -844,7 +862,7 @@ view { content: '¥'; display: inline-block; color: #fc5109; - font-size: 24rpx; + font-size: 36rpx; } } .post-text { diff --git a/subPackages/ticketBooking/detail.vue b/subPackages/ticketBooking/detail.vue index dcb288e..8d01116 100644 --- a/subPackages/ticketBooking/detail.vue +++ b/subPackages/ticketBooking/detail.vue @@ -25,7 +25,7 @@ 营业时间 - {{info.times_list_info.start}}-{{info.times_list_info.end}} + {{info.open_description}} @@ -44,8 +44,8 @@ - 门票预定 - + 门票预定 + {{ item.title }} @@ -76,7 +76,7 @@ - 景点简介 + 介绍 @@ -321,7 +321,12 @@ let orderSkuIndex = this.selectGoods.specifications.findIndex(v=>v.id == that.skuInfo.id) let item = this.selectGoods.specifications.splice(orderSkuIndex, 1)[0]; // 将购买的数据放在第一位 item.buyNum = 1 - item.selPeople = [{}] + item.selPeople = [ + { + id:null,id_number:null,name:null, + tel:null,user_id:null,age:null, + }, + ] this.selectGoods.specifications.unshift(item); let param = { diff --git a/subPackages/ticketBooking/order.vue b/subPackages/ticketBooking/order.vue index f859be2..3c3b400 100644 --- a/subPackages/ticketBooking/order.vue +++ b/subPackages/ticketBooking/order.vue @@ -28,17 +28,30 @@ - - {{skuItem.title}} - - 123 - 点击添加出行人信息 + + + + + {{skuItem.title}} + + + 出行人1 + {{person.name}} + + 点击添加出行人信息 + - - + + + 合计: + {{ 10 }} + + + 立即购买 + @@ -50,7 +63,8 @@ 添加出行人 - + @@ -91,9 +105,10 @@ buyNum: 0, - addressList: [], - currentPerson: {}, - addressSelect: {}, + addressList: [], // 出行人列表 + currentPerson: {}, // 列表当前要设置的出行人 用地址引用直接修改 + currentPersonIds: [], // 当前门票的所有出行人 + addressSelect: {}, // 出行人弹窗选择的人 } }, @@ -129,9 +144,15 @@ }, // 选择出行人 - showAddressPopUp (person) { - person.id = 1 + showAddressPopUp (person,personList) { this.currentPerson = person + this.currentPersonIds = [] + personList.forEach(v=>{ + if (v.id) { + this.currentPersonIds.push(v.id) + } + }) + if (person.id) { this.addressSelect = person } else { @@ -151,6 +172,7 @@ if (confirm) { // 赋值 this.currentPerson.id = this.addressSelect.id + this.currentPerson.name = this.addressSelect.name this.currentPerson.id_number = this.addressSelect.id_number this.currentPerson.tel = this.addressSelect.tel this.currentPerson.user_id = this.addressSelect.user_id @@ -164,7 +186,16 @@ this.$forceUpdate(); }, seldThisAddress(item){ - this.addressSelect = item + if (this.addressSelect.id == item.id) { + this.addressSelect = {} + } else { + if (this.currentPersonIds.includes(item.id)&&item.id!=this.currentPerson.id) { + return + } else { + this.addressSelect = item + } + } + }, @@ -214,9 +245,15 @@ // this.$toast("本产品单笔限购"+this.max_num+"份") // } if (Array.isArray(skuItem.selPeople)) { - skuItem.selPeople.push({}) + skuItem.selPeople.push({ + id:null,id_number:null,name:null, + tel:null,user_id:null,age:null, + }) } else { - skuItem.selPeople = [{}] + skuItem.selPeople = [{ + id:null,id_number:null,name:null, + tel:null,user_id:null,age:null, + }] } }, @@ -290,6 +327,79 @@ }) }, + + order() { + let use_date = this.allSeldDate[this.seldDateIndex].date + let start_time =this.timesArr[this.seldTimeIndex].start_time + let end_time = this.timesArr[this.seldTimeIndex].end_time + let goods = [] + + + // 设置参数 + console.log(this.pInfo) + this.pInfo.specifications.forEach(sku=>{ + if (sku.buyNum != sku.selPeople.length) { + uni.showToast({ + title:'请选择出行人', + icon:'none' + }) + } + if (sku.buyNum>=1) { + let param = { + specifications_id: sku.id, + num: sku.buyNum, + contact_id: sku.selPeople.filter(v=>v.id).map(v=>v.id), + date: use_date, + start_time: start_time, + end_time: end_time, + } + goods.push(param) + } + }) + console.log(goods) + + + let data = { + goods: goods, + coupon: this.coupon ? this.coupon.id : "", + // reserve_name: this.reserve_name, + // reserve_phone: this.reserve_phone + // remark: this.remark + } + console.log('data数据',data); + this.Post({ + method: 'POST', + data: JSON.stringify(data) + }, '/api/order/place').then(res => { + if (res.code == 200) { + console.log(res.data.order_id); + let order_id = res.data.order_id + this.$store.commit("changeOrderInfo", null); + this.$store.commit("choseCoupon", ""); + this.Post({ + order_id: order_id, + type: "miniprogram", + platform: 'miniprogram' + }, '/api/pay/unify').then(res => { + if (res.data) { + uni.requestPayment({ + nonceStr: res.data.nonceStr, + package: res.data.package, + paySign: res.data.paySign, + signType: res.data.signType, + timeStamp: res.data.timeStamp, + complete() { + uni.navigateTo({ + url: '/subPackages/order/trades' + }) + } + }) + } + }) + } + }) + } + } } @@ -574,6 +684,11 @@ .popup-item.active{ background-image: linear-gradient(135deg, #9EE4FE, #7FD491); } + .popup-item.disabled{ + .item-top { + background-color: #999; + } + } } .button { @@ -592,4 +707,60 @@ } } + +.btn-list { + width: 750rpx; + height: 166rpx; + background: #ffffff; + box-shadow: 0rpx -3rpx 9rpx 1rpx rgba(227, 229, 232, 0.5); + display: flex; + position: fixed; + bottom: 0; + padding: 20rpx 50rpx; + align-items: center; + justify-content: space-between; + .btn { + width: 294rpx; + height: 88rpx; + background: linear-gradient(90deg, #F84A56, #FF9834); + border-radius: 43rpx; + text-align: center; + line-height: 88rpx; + + font-size: 36rpx; + font-family: PingFang SC; + font-weight: 500; + color: #FFFFFF; + + } + .price-box { + display: flex; + align-items: center; + .text { + font-size: 28rpx; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #393b3e; + } + .price { + margin-left: 15rpx; + font-size: 48rpx; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #fc5109; + &:before { + content: '¥'; + display: inline-block; + color: #fc5109; + font-size: 24rpx; + } + } + .post-text { + margin-left: 15rpx; + color: #fc5109; + font-size: 24rpx; + } + } +} + diff --git a/subPackages/ticketBooking/ticketBooking.vue b/subPackages/ticketBooking/ticketBooking.vue index dfbbc8d..27d9b3c 100644 --- a/subPackages/ticketBooking/ticketBooking.vue +++ b/subPackages/ticketBooking/ticketBooking.vue @@ -18,7 +18,12 @@ {{item.address}} - {{showPrice(item.price)}} + + + {{showPrice(item.price)}} + @@ -42,15 +47,17 @@ finished: false, headImg:null, - type_id: 10,//演出票务的景点分类id + type_id: 10,//景点分类id } }, onShow() { this.headImg = 'https://tongli.sz-trip.com/uploads/20240826/a87488f6225789aa19dbb437671d388d.png' this.finished = false - this.getList() // this.getHeadImg('piaowu') }, + onReady() { + this.getList() + }, onLoad(options) { let that = this uni.getSystemInfo({ @@ -173,12 +180,12 @@ color: #F02A2A; text-align: right; } - .price::before{ + .price-money::before{ content: '¥'; color: #F02A2A; font-size: 24rpx; } - .price::after{ + .price-money::after{ content: '起'; color: #999; font-size: 24rpx;