From a2a05bf8a40920f95fda2f95e617c439973f7671 Mon Sep 17 00:00:00 2001 From: chenkainan Date: Wed, 18 Jun 2025 10:53:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 6 + pages/index/index.vue | 317 +++++++++++++++++++++++++++++++- pages/user/user.vue | 7 +- static/js/CommonFunction.js | 29 ++- subPackages/homestay/detail.vue | 50 ++++- subPackages/homestay/order.vue | 12 +- subPackages/order/trades.vue | 6 +- subPackages/webPage/webPage.vue | 22 +++ 8 files changed, 416 insertions(+), 33 deletions(-) create mode 100644 subPackages/webPage/webPage.vue diff --git a/pages.json b/pages.json index 766363f..821bde7 100644 --- a/pages.json +++ b/pages.json @@ -222,6 +222,12 @@ "style": { "navigationBarTitleText": "订单填写" } + }, + { + "path" : "webPage/webPage", + "style" : { + "navigationBarTitleText" : "" + } } ] }], diff --git a/pages/index/index.vue b/pages/index/index.vue index 064951d..997a87c 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -1,6 +1,66 @@ @@ -12,22 +72,273 @@ }, data() { return { - + homeUi: {}, + navList: [], + topBanner: [], + smallBanner: [], + recommendNav: [], + moduleList: [], + hotList: [], + finished: false } }, onLoad() { + }, + onReady() { + this.sendRequest() }, methods: { - + // 首页UI配置跳转 + gotoHomeDetail(item) { + if(item.jump_type == 'page') { + // 内页 + // 4外部小程序 5外部链接 6内页 + switch (item.page_type){ + case 4: + // #ifdef MP-WEIXIN + uni.navigateToMiniProgram({ + shortLink: item.page + }) + // #endif + break; + case 4: + this.gotoWebUrl(item.page) + break; + case 6: + this.gotoPath(item.page) + break; + default: + break; + } + }else if(item.jump_type == 'link') { + // 链接 + this.gotoWebUrl(item.url) + } + }, + // 广告跳转 + gotoBannerDetail(item) { + // 1产品详情 2功能模块 3外部链接 4外部小程序 + switch (item.jump_type){ + case 1: + this.gotoDetailByType(item.product_model) + break; + case 2: + this.gotoPath(item.tdata.url) + break; + case 3: + this.gotoWebUrl(item.tdata.url) + break; + case 4: + // #ifdef MP-WEIXIN + uni.navigateToMiniProgram({ + shortLink: item.tdata.url + }) + // #endif + break; + default: + break; + } + }, + sendRequest() { + // 获取首页UI配置 + let type_id = '' + // #ifdef MP-WEIXIN + type_id = 3 + // #endif + + // #ifdef H5 + type_id = 5 + // #endif + this.Post({ + type_id: type_id + },'/api/adv/get_home_ui').then(res => { + console.log(res.data) + // 标题图片 + for (let item of res.data.content) { + this.homeUi[item.id] = item.image + } + + // 金刚区 + this.navList = res.data.nav_menu + + // 推荐广告 + this.recommendNav = res.data.recommend_data + + // 下面板块 + this.moduleList = res.data.func_data + }) + + // 头部banner + this.Post({ + type_id: 5, + position: 0, + },"/api/adv/getAdv").then(res => { + if (res) { + this.topBanner = res.data + } + }); + + // 小banner + this.Post({ + type_id: 5, + position: 1, + },"/api/adv/getAdv").then(res => { + if (res) { + this.smallBanner = res.data + } + }); + + this.getHotList() + }, + getHotList() { + this.Post({ + tag_id: 648, + offset: this.hotList.length, + limit: 4 + },'/api/product/get_product_by_tag').then(res => { + this.hotList = [...this.hotList, ...res.data.list] + + if(res.data.list.length < 4) this.finished = true + }) + } + }, + onReachBottom() { + setTimeout(() => { + if(!this.finished) this.getHotList() + },1000) } } - diff --git a/pages/user/user.vue b/pages/user/user.vue index c441ac9..ec2bca9 100644 --- a/pages/user/user.vue +++ b/pages/user/user.vue @@ -107,14 +107,9 @@ title: '待发货', status: 'WAIT_POST' }, - { - src: 'https://static.ticket.sz-trip.com/shiweisuzhou/images/user/dsy.png', - title: '待使用', - status: '' - }, { src: 'https://static.ticket.sz-trip.com/shiweisuzhou/images/user/dcx.png', - title: '待出行', + title: '待使用/出行', status: 'WAIT_USE' }, { diff --git a/static/js/CommonFunction.js b/static/js/CommonFunction.js index f204a66..cd39142 100644 --- a/static/js/CommonFunction.js +++ b/static/js/CommonFunction.js @@ -235,16 +235,39 @@ Vue.prototype.getMaxCoupon = async function (param) { return res.data } +// H5小程序跳转外部链接 +Vue.prototype.gotoWebUrl = url => { + // #ifdef MP-WEIXIN + uni.navigateTo({ + url: '/subPackages/webPage/webPage?url=' + encodeURIComponent(url) + }) + // #endif + // #ifdef H5 + window.location.href = url + // #endif +} + // 根据类型跳转详情 Vue.prototype.gotoDetailByType = item => { let url = '' + if(item.is_package) { + url = '/subPackages/food/detail?id=' + item.id + + Vue.prototype.gotoPath(url) + return; + } switch (item.type){ case 'line': url = '/subPackages/line/lineDetail?id=' + item.id break; - case 'room': - url = '/subPackages/homestay/detail?id=958396' - // || item.scene_id || item.id + case 'hotel': + url = '/subPackages/homestay/detail?id=' + (item.scene_id || item.id) + break; + case 'ticket': + url = '/subPackages/ticket/detail?id=' + (item.scene_id || item.id) + break; + case 'post': + url = '/subPackages/techan/detail?id=' + item.id break; default: break; diff --git a/subPackages/homestay/detail.vue b/subPackages/homestay/detail.vue index 5791754..92cbc29 100644 --- a/subPackages/homestay/detail.vue +++ b/subPackages/homestay/detail.vue @@ -91,7 +91,11 @@ {{item.price/100}} - 预订 + + + + 预订 + @@ -278,12 +282,6 @@ getInfo() { this.Post({id: this.id},'/api/scene/detail').then(res => { let info = res.data; - try { - info.times_list_info = JSON.parse(info.times_list)[0] - } catch(e) { - console.log(e) - info.times_list_info = {start:'',end:''} - } this.info = info console.log(info) }); @@ -331,8 +329,14 @@ url:`/subPackages/homestay/order` }) }, - - + // 加入购物车 + addCart(item) { + this.Post({sku_id: item.id,num: 1 },'/api/cart/add_sku').then(res => { + if (res.code == 1) { + uni.showToast({title: res.msg,icon: 'none'}); + } + }); + }, closePopupRule() { this.$refs.popupRule.close() }, @@ -665,6 +669,34 @@ .noBuy { background: #ccc; } + + .btn-box { + width: 213rpx; + height: 47rpx; + display: flex; + + view { + width: 120rpx; + height: 47rpx; + background: #6A8A27; + border-radius: 0rpx 11rpx 11rpx 0rpx; + font-weight: bold; + font-size: 29rpx; + color: #FFFFFF; + } + + & view:first-child { + width: 93rpx; + height: 47rpx; + background: #D3E8A7; + border-radius: 11rpx 0rpx 0rpx 11rpx; + + image { + width: 32rpx; + height: 32rpx; + } + } + } } } diff --git a/subPackages/homestay/order.vue b/subPackages/homestay/order.vue index c90d364..2889b00 100644 --- a/subPackages/homestay/order.vue +++ b/subPackages/homestay/order.vue @@ -36,24 +36,22 @@ - + - - - 酒店需至少提前1天预约,预约成功后不可更改。如未提前电话预约,届时因满房造成无法办理入住,敬请谅解。 + - + - 证件要求:需身份证登记入住 + 证件要求:大陆居民身份证登记入住 @@ -147,7 +145,7 @@ 房型信息 - + diff --git a/subPackages/order/trades.vue b/subPackages/order/trades.vue index 1f3c89b..b66a2c0 100644 --- a/subPackages/order/trades.vue +++ b/subPackages/order/trades.vue @@ -86,11 +86,7 @@ id: 'WAIT_POST' }, { - name: '待使用', - id: '' - }, - { - name: '待出行', + name: '待使用/出行', id: 'WAIT_USE' }, { diff --git a/subPackages/webPage/webPage.vue b/subPackages/webPage/webPage.vue new file mode 100644 index 0000000..7dbd8ac --- /dev/null +++ b/subPackages/webPage/webPage.vue @@ -0,0 +1,22 @@ + + + + + \ No newline at end of file