Browse Source

门票年龄限制

master
jiazhipeng 1 year ago
parent
commit
d6606de28e
  1. 162
      pages/mall/mall.vue
  2. 33
      subPackages/order/detail.vue
  3. 79
      subPackages/ticketBooking/order.vue

162
pages/mall/mall.vue

@ -1,21 +1,167 @@
<template>
<view></view>
<view class="bg">
<!-- <span class="iconfont topLeft" @click="goBack">&#xe660;</span> -->
<img :src="showImg('/uploads/20240826/53bbad9d231e7e0eb2404efb0c0903f4.png')" class="topImg" />
<view class="box">
<view class="item" v-for="item in list" :key="item.id" @click="viewDetail(item)">
<image class="item-img" :src="showImg(item.image)" mode=""></image>
<view class="content">
<view class="title text-overflowRows">{{item.title}}</view>
<view class="bottom">
<view class="price">
{{item.money/100}}
</view>
<view class="buy">
立即购买
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
list:[],
finished: false,
}
},
onShow() {
uni.navigateTo({
url: '/subPackages/techan/techanList'
});
onReady() {
this.getList()
},
methods: {
//
getList(){
this.Post({
type_id: 19,
offset: this.list.length,
limit: 10,
},'/api/goods/getGoodsByType').then(res => {
this.list = [...this.list, ...res.data];
if (res.data.length < 10) {
this.finished = true
}
})
},
viewDetail(item) {
this.goOtherDetail(item)
if(!item.link_type) {
uni.navigateTo({
url: '/subPackages/techan/detail?id=' + item.id
})
}
}
},
onReachBottom() {
setTimeout(() => {
if (!this.finished) this.getList()
},1000)
}
}
</script>
<style>
</style>
<style lang="scss" scoped>
view {
box-sizing: border-box;
}
.bg {
background: #FFFFFF;
min-height: 100vh;
padding-bottom: 26rpx;
}
.topLeft {
position: absolute;
left: 26rpx;
top: 101rpx;
font-size: 40rpx;
z-index: 2;
}
.topImg {
width: 750rpx;
height: 440rpx;
}
.box {
margin-top: 26.67rpx;
// border-radius: 20rpx 20rpx 0rpx 0rpx;
padding: 0 26.67rpx;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.item {
margin-bottom: 22rpx;
width: 335rpx;
height: 497rpx;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(153,153,153,0.38);
border-radius: 13rpx;
}
.item-img {
width: 100%;
height: 342rpx;
background: #87CD93;
border-radius: 13rpx 13rpx 0rpx 0rpx;
}
.content {
height: 145rpx;
padding: 0 13rpx 13.33rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.title {
font-family: PingFang SC;
font-weight: bold;
font-size: 29rpx;
color: #000000;
width: 291rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
}
.price {
font-size: 34.67rpx;
font-family: PingFangSC;
font-weight: bold;
color: #D60000;
}
.price::before {
content: '¥';
font-size: 24rpx;
}
.price::after {
content: '起';
font-size: 24rpx;
color: #999999;
font-weight: 500;
}
.buy {
width: 140rpx;
height: 42rpx;
background: #71B580;
border-radius: 21rpx;
text-align: center;
line-height: 42rpx;
font-family: PingFang SC;
font-weight: 500;
font-size: 27rpx;
color: #FFFFFF;
}
</style>

33
subPackages/order/detail.vue

@ -272,14 +272,14 @@
</view>
<view class="flex-between" style="margin-top: 30rpx;">
<view class="hotel-address flex-between">
<view class="address text-overflowRows">地址地址地址地址地址地址地址地 址地址地址地址地址地址</view>
<view class="hotel-address flex-between" @click.stop="goMap(info.order_child[0])">
<view class="address text-overflowRows">{{info.order_child[0].goods_data.address}}</view>
<view class="address-image">
<image src="https://static.ticket.sz-trip.com/yandu/images/order/navigation.png"></image>
<view>地图</view>
</view>
</view>
<view class="hotel-phone flex-center">
<view class="hotel-phone flex-center" @click.stop="callPhone(info.order_child[0].goods_data.tel)">
<image src="https://static.ticket.sz-trip.com/yandu/images/order/hotelPhone.png"></image>
<view>电话</view>
</view>
@ -604,6 +604,33 @@
}
});
},
callPhone (tel) {
let _this = this
uni.showActionSheet({
itemList: [tel,'呼叫'],
success: function (res) {
_this.clickPhone(tel)
}
});
},
goMap (info) {
let param = {
latitude: Number(info.goods_data.lat),
longitude: Number(info.goods_data.lon),
name: info.goods_title,
address: info.goods_data.address,
}
uni.openLocation({
...param,
success: function () {
console.log('success');
}
});
},
}
}
</script>

79
subPackages/ticketBooking/order.vue

@ -64,7 +64,7 @@
@click.stop="personClick(item,skuItem)">
<view class="person-item">
<view>{{item.name}}</view>
<!-- <view class="disabled">信息不符</view> -->
<view v-if="!judegeAgeLimit(skuItem, item)" class="disabled">信息不符</view>
</view>
<view class="selected" v-if="(skuItem.is_real_name&&skuItem.selPeople.some(v=>v.id==item.id))||(!skuItem.is_real_name&&skuItem.selPerson.id==item.id)">
<uni-icons color="#fff" type="checkmarkempty" size="10" ></uni-icons>
@ -90,9 +90,12 @@
<text style="padding-right: 30rpx;">{{person.name}}</text>
<img @click.stop="changeAddressAddPopup('open',person)" v-if="skuBuyMultiple" style="width: 32rpx;height: 32rpx;" :src="showImg('/uploads/20240827/337cf610ce5924c2a65b7a28b6a4891e.png')" alt="" />
</view>
<view style="padding: 20rpx 0 14rpx;">手机号 {{person.tel}}</view>
<view>身份证 {{person.id_number}}</view>
<view v-if="judegeAgeLimit(skuItem,person)">
<view style="padding: 20rpx 0 14rpx;">手机号 {{person.tel}}</view>
<view>身份证 {{person.id_number}}</view>
</view>
<view v-else style="color: #EE3E3B;padding: 20rpx 0 14rpx;">不符合适用人群年龄限制</view>
</view>
<img @click.stop="changeAddressAddPopup('open',person)" v-if="!skuBuyMultiple" style="width: 32rpx;height: 32rpx;"
@ -126,8 +129,13 @@
<text style="padding-right: 30rpx;">{{skuItem.selPerson.name}}</text>
<img @click.stop="changeAddressAddPopup('open',skuItem.selPerson)" v-if="skuBuyMultiple" style="width: 32rpx;height: 32rpx;" :src="showImg('/uploads/20240827/337cf610ce5924c2a65b7a28b6a4891e.png')" alt="" />
</view>
<view style="padding: 20rpx 0 14rpx;">手机号 {{skuItem.selPerson.tel}}</view>
<view>身份证 {{skuItem.selPerson.id_number}}</view>
<view v-if="judegeAgeLimit(skuItem,skuItem.selPerson)">
<view style="padding: 20rpx 0 14rpx;">手机号 {{skuItem.selPerson.tel}}</view>
<view>身份证 {{skuItem.selPerson.id_number}}</view>
</view>
<view v-else style="color: #EE3E3B;padding: 20rpx 0 14rpx;">不符合适用人群年龄限制</view>
</view>
<img @click.stop="changeAddressAddPopup('open',skuItem.selPerson)" v-if="!skuBuyMultiple" style="width: 32rpx;height: 32rpx;"
@ -409,6 +417,13 @@
data = JSON.parse(data)
// selPeople selPerson
data.pInfo.specifications.forEach(v=>{
let age_limit = null
try {
age_limit = JSON.parse(v.age_restriction)
} catch (e) {
age_limit = null
}
v.age_limit = age_limit
v.buyNum = 0;v.selPeople = [];v.selPerson = {}
v.is_card = Number(v.is_card);
v.is_real_name = Number(v.is_real_name)
@ -470,6 +485,26 @@
/*---------------出行人------------------------------*/
//
judegeAgeLimit (ticket, person) {
console.log(ticket,person)
let age_limit = ticket.age_limit
let personAge = person.age
let result = true
if (!age_limit) {
return true
} else {
if (age_limit.start&& result) {
result = personAge>=age_limit.start
}
if (age_limit.end&&result) {
result = personAge<=age_limit.start
}
}
return result
},
//
showAddressPopUp (person,personList, isMore) {
@ -477,7 +512,7 @@
let currentSku = this.pInfo.specifications[0]
if (currentSku.is_real_name) {
let personIndex = currentSku.selPeople.findIndex(v=>!v.id)
console.log(personIndex)
if (personIndex<0) {personIndex = 0}
person = currentSku.selPeople[personIndex]
personList = currentSku.selPeople
@ -486,7 +521,7 @@
personList = [currentSku.selPerson]
}
}
console.log(this.pInfo.specifications[0].selPeople[0])
this.currentPerson = person
this.currentPersonIds = []
personList.forEach(v=>{
@ -585,7 +620,6 @@
this.currentPerson.user_id = this.addressSelect.user_id
this.currentPerson.age = this.addressSelect.age
console.log(this.currentPerson, this.pInfo)
}
if (type == 'open') this.$refs.addressPopup.open('bottom');
@ -607,7 +641,7 @@
//
personClick (person, sku) {
console.log(sku)
//
if (sku.is_real_name) {
let personHave = sku.selPeople.find(v=>v.id == person.id)
@ -890,7 +924,6 @@
//
let canSubmit = true
this.pInfo.specifications.filter(v=>v.buyNum>0).forEach(sku=>{
debugger
if (!sku.is_card) {
if (!this.IsTel(sku.selPerson.tel)) {
uni.showToast({
@ -912,13 +945,25 @@
} else {
if (sku.is_real_name) {
if ( sku.selPeople.some(v=>!v.id)) {
if (sku.selPeople.some(v=>!v.id)) {
uni.showToast({
title:'请选择出行人',
icon:'none'
})
canSubmit = false
}
for(let v of sku.selPeople) {
let judegRes = this.judegeAgeLimit(sku, v)
if (!judegRes) {
uni.showToast({
title:'出行人年龄信息不符合使用限制',
icon:'none'
})
canSubmit = false
break;
}
}
let param = {
specifications_id: sku.id,
num: sku.buyNum,
@ -936,6 +981,16 @@
})
canSubmit = false
}
let judegRes = this.judegeAgeLimit(sku, sku.selPerson)
if (!judegRes) {
uni.showToast({
title:'出行人年龄信息不符合使用限制',
icon:'none'
})
canSubmit = false
}
let param = {
specifications_id: sku.id,
num: sku.buyNum,

Loading…
Cancel
Save