chenkainan 4 months ago
parent
commit
a2a05bf8a4
  1. 6
      pages.json
  2. 317
      pages/index/index.vue
  3. 7
      pages/user/user.vue
  4. 29
      static/js/CommonFunction.js
  5. 50
      subPackages/homestay/detail.vue
  6. 12
      subPackages/homestay/order.vue
  7. 6
      subPackages/order/trades.vue
  8. 22
      subPackages/webPage/webPage.vue

6
pages.json

@ -222,6 +222,12 @@
"style": {
"navigationBarTitleText": "订单填写"
}
},
{
"path" : "webPage/webPage",
"style" : {
"navigationBarTitleText" : ""
}
}
]
}],

317
pages/index/index.vue

@ -1,6 +1,66 @@
<template>
<view class="bg bg-padding">
<CustomTabBar :currentTab="2" />
<image :src="homeUi.dbtp" mode="heightFix" class="topImg"></image>
<!-- 搜索框 -->
<view class="search-box">
<image src="https://static.ticket.sz-trip.com/shiweisuzhou/images/index/search.png" mode=""></image>
搜一搜您想要的
</view>
<!-- 顶部轮播 -->
<swiper class="top-banner" :circular="true" :interval="6000" style="margin-top: 27rpx;"
:duration="800" :indicator-dots="false" :autoplay="true" v-if="topBanner && topBanner.length > 0">
<swiper-item v-for="(item, index) in topBanner" :key="index" @click.stop="gotoBannerDetail(item)">
<image class="top-banner" :src="showImg(item.head_img)" mode="aspectFill" lazy-load="true"></image>
</swiper-item>
</swiper>
<!-- 金刚区 -->
<view class="nav-box">
<view v-for="(item,index) in navList" :key="index" class="nav-item" @click="gotoHomeDetail(item)">
<image :src="item.icon" mode=""></image>
{{item.menu_name}}
</view>
</view>
<!-- 小轮播 -->
<swiper class="small-banner" :circular="true" :interval="6000" style="margin-top: 27rpx;"
:duration="800" :indicator-dots="false" :autoplay="true" v-if="smallBanner && smallBanner.length > 0">
<swiper-item v-for="(item, index) in smallBanner" :key="index" @click.stop="gotoBannerDetail(item)">
<image class="small-banner" :src="showImg(item.head_img)" mode="aspectFill" lazy-load="true"></image>
</swiper-item>
</swiper>
<!-- 推荐广告 -->
<view class="recommend-box">
<view v-for="(item,index) in recommendNav" :key="index" @click="gotoHomeDetail(item)">
<image :src="item.icon" mode="" class="recommend-item"></image>
</view>
</view>
<!-- 模块 -->
<view class="module-box">
<view v-for="(item,index) in moduleList" :key="index" @click="gotoHomeDetail(item)">
<image :src="item.icon" mode="widthFix" class="module-item"></image>
</view>
</view>
<!-- 热门推荐 -->
<image :src="homeUi.rmtjbttp" mode="heightFix" class="rmtj-img"></image>
<view class="hot-box">
<view v-for="(num,nums) in 2" :key="nums">
<view v-for="(item,index) in hotList" :key="index" v-if="index % 2 == nums" class="hot-item" @click="gotoDetailByType(item)">
<image :src="item.headimg" mode="widthFix"></image>
<view class="hot-content">
<view class="title">{{item.title}}</view>
<view class="price">{{item.price / 100}}</view>
</view>
</view>
</view>
</view>
</view>
</template>
@ -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)
}
}
</script>
<style>
<style lang="scss" scoped>
.bg {
width: 100%;
min-height: 100vh;
background: #CDE29E;
padding: 145rpx 26rpx;
}
image {
display: block;
}
.topImg {
height: 114.67rpx;
margin-left: 30rpx;
}
.search-box {
height: 67rpx;
background: rgba(255, 255, 255, .66);
border-radius: 20rpx;
margin-top: 24rpx;
display: flex;
align-items: center;
font-weight: 500;
font-size: 24rpx;
color: #808080;
image {
width: 30.67rpx;
height: 30.67rpx;
margin: 0 19rpx 0 27rpx;
}
}
.top-banner {
width: 100%;
height: 353rpx;
border-radius: 20rpx;
}
.nav-box {
margin-top: 45rpx;
display: flex;
flex-wrap: wrap;
.nav-item {
width: 20%;
display: flex;
flex-direction: column;
align-items: center;
image {
width: 100rpx;
height: 100rpx;
margin-bottom: 15rpx;
}
}
.nav-item:nth-child(n+6) {
margin-top: 36rpx;
}
}
.small-banner {
width: 100%;
height: 200rpx;
border-radius: 20rpx;
}
.recommend-box {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
.recommend-item {
width: 336.67rpx;
height: 225.33rpx;
margin-top: 40rpx;
}
}
.module-box {
margin-top: 40rpx;
.module-item {
margin-bottom: 20rpx;
width: 100%;
}
}
.rmtj-img {
margin-top: 73rpx;
height: 41.33rpx;
}
.hot-box {
margin-top: 40rpx;
display: flex;
justify-content: space-between;
.hot-item {
width: 340rpx;
background: #FFFFFF;
border-radius: 20rpx;
overflow: hidden;
margin-bottom: 16rpx;
image {
width: 340rpx;
}
.hot-content {
padding: 13rpx 13rpx 26rpx 13rpx;
.title {
font-weight: 500;
font-size: 28rpx;
color: #111111;
}
.price {
font-weight: 500;
font-size: 28rpx;
color: #E62525;
margin-top: 15rpx;
}
}
}
}
</style>

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

29
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;

50
subPackages/homestay/detail.vue

@ -91,7 +91,11 @@
</view>
<view class="price-container">
<view class="price">{{item.price/100}}</view>
<view :class="['btn', {'noBuy': item.stock == 0}]" @click="goOrder(item)">预订</view>
<!-- <view :class="['btn', {'noBuy': item.stock == 0}]" @click="goOrder(item)">预订</view> -->
<view class="btn-box">
<view class="flex-center" @click="addCart(item)"><image src="https://static.ticket.sz-trip.com/shiweisuzhou/images/homestay/gwc.png"></image></view>
<view class="flex-center" @click="goOrder(item)">预订</view>
</view>
</view>
</view>
</view>
@ -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;
}
}
}
}
}

12
subPackages/homestay/order.vue

@ -36,24 +36,22 @@
</view>
<view class="notice-container">
<view class="flex">
<view class="flex" style="align-items: center;">
<view class="flex-shrink-0" style="padding-top: 4rpx;">
<image src="https://static.ticket.sz-trip.com/shiweisuzhou/images/homestay/dui.png"></image>
</view>
<view class="flex-1 w-1rpx" style="padding-left: 14rpx;">
<!-- <view>订单确认后您在{{new Date(selectDate.startDay).Format('yyyy年MM月dd日')}}18:00前可免费取消或变更订单18:00后不可取消或修改将扣取全额房费</view> -->
<!-- <view style="color: #F84A56;">预期不可取消或/修改扣取全额房费</view> -->
<view>酒店需至少提前1天预约预约成功后不可更改如未提前电话预约届时因满房造成无法办理入住敬请谅解</view>
<view v-html="formateRichText(skuInfo.sku_model.bookinfo)"></view>
</view>
</view>
<view class="flex" style="padding-top: 22rpx;">
<view class="flex" style="padding-top: 22rpx;align-items: center;">
<view class="flex-shrink-0" style="padding-top: 4rpx;">
<image src="https://static.ticket.sz-trip.com/shiweisuzhou/images/homestay/tanhao.png">
</image>
</view>
<view class="flex-1 w-1rpx" style="padding-left: 14rpx;">
<view>证件要求身份证登记入住</view>
<view>证件要求大陆居民身份证登记入住</view>
</view>
</view>
@ -147,7 +145,7 @@
<view class="pop-detail-container">
<view class="pop-detail-title">房型信息</view>
<view v-html="formateRichText(skuInfo.sku_name)"></view>
<view v-html="formateRichText(skuInfo.sku_model.detailinfo)"></view>
</view>
</view>
</view>

6
subPackages/order/trades.vue

@ -86,11 +86,7 @@
id: 'WAIT_POST'
},
{
name: '待使用',
id: ''
},
{
name: '待出行',
name: '待使用/出行',
id: 'WAIT_USE'
},
{

22
subPackages/webPage/webPage.vue

@ -0,0 +1,22 @@
<template>
<web-view :src="url"></web-view>
</template>
<script>
export default {
data() {
return {
url: ''
}
},
onLoad(option) {
if (option.url) {
this.url = decodeURIComponent(option.url)
}
}
}
</script>
<style lang="scss" scoped>
</style>
Loading…
Cancel
Save