...
|
...
|
@@ -11,6 +11,7 @@ |
|
|
<link rel="stylesheet" href="../../assets/css/api.css"/>
|
|
|
<link rel="stylesheet" href="../../assets/css/index.css">
|
|
|
<link rel="stylesheet" href="../../assets/css/doc.css">
|
|
|
<link rel="stylesheet" href="../../assets/css/weui.min.css">
|
|
|
<link rel="stylesheet" href="../../assets/icon/iconfont.css">
|
|
|
<style>
|
|
|
|
...
|
...
|
@@ -350,6 +351,150 @@ |
|
|
font-size: 0;
|
|
|
margin: 0;
|
|
|
}
|
|
|
.weui-dialog__hd{
|
|
|
line-height: 1;
|
|
|
padding: 0 0.5em .3em;
|
|
|
}
|
|
|
/*住房选择*/
|
|
|
.meal {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
justify-content: flex-end;
|
|
|
position: fixed;
|
|
|
top: 0;
|
|
|
left: 0;
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
}
|
|
|
|
|
|
.meal_title {
|
|
|
text-align: center;
|
|
|
color: #424242;
|
|
|
font-size: 15px;
|
|
|
font-weight: bold;
|
|
|
border-bottom: 1px solid #ccc;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: space-between;
|
|
|
padding: 0.25rem;
|
|
|
}
|
|
|
|
|
|
.meal_item {
|
|
|
background-color: #fff;
|
|
|
}
|
|
|
|
|
|
.pay_box {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: space-between;
|
|
|
padding: 0 10% 0.25rem 10%;
|
|
|
}
|
|
|
|
|
|
.pay_num {
|
|
|
font-size: 12px;
|
|
|
color: #424242;
|
|
|
}
|
|
|
|
|
|
.pay_btn_box {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
}
|
|
|
|
|
|
.pay_btn_box .iconfont {
|
|
|
font-size: 20px;
|
|
|
color: #ccc;
|
|
|
}
|
|
|
|
|
|
.pay_btn_box input {
|
|
|
width: 0.5rem;
|
|
|
text-align: center;
|
|
|
border: 0;
|
|
|
outline: none;
|
|
|
font-size: 15px;
|
|
|
}
|
|
|
|
|
|
.pay_num .limit {
|
|
|
padding: 0;
|
|
|
font-size: 12px;
|
|
|
color: #ccc;
|
|
|
}
|
|
|
|
|
|
.pay_btn {
|
|
|
font-size: 15px;
|
|
|
color: #fff;
|
|
|
background-color: #dbb25f;
|
|
|
text-align: center;
|
|
|
padding: 0.2rem 0;
|
|
|
}
|
|
|
|
|
|
.room_box, .price_box {
|
|
|
display: flex;
|
|
|
/*align-items: center;*/
|
|
|
justify-content: space-between;
|
|
|
padding: 0.2rem 0.4rem 0 0.4rem;
|
|
|
|
|
|
}
|
|
|
|
|
|
.room_left {
|
|
|
font-size: 15px;
|
|
|
color: #424242;
|
|
|
}
|
|
|
|
|
|
.youhui {
|
|
|
color: #d8b25f;
|
|
|
font-size: 12px;
|
|
|
margin-left: 0.1rem;
|
|
|
}
|
|
|
|
|
|
.room_right {
|
|
|
color: #dbb25f;
|
|
|
font-size: 15px;
|
|
|
}
|
|
|
|
|
|
.old_price {
|
|
|
text-decoration: line-through;
|
|
|
color: #ccc;
|
|
|
margin-left: 0.1rem;
|
|
|
}
|
|
|
|
|
|
.room_tips {
|
|
|
color: #ccc;
|
|
|
font-size: 12px;
|
|
|
padding: 0 0.4rem;
|
|
|
}
|
|
|
|
|
|
.price_left, .price_right {
|
|
|
display: flex;
|
|
|
/*align-items: center;*/
|
|
|
flex-wrap: wrap;
|
|
|
flex: 1;
|
|
|
}
|
|
|
|
|
|
.price_left span, .price_right span {
|
|
|
background-color: #f2f2f2;
|
|
|
color: #424242;
|
|
|
padding: 0 0.2rem;
|
|
|
font-size: 14px;
|
|
|
margin: 0 0.2rem 0.2rem 0;
|
|
|
border-radius: 0.05rem;
|
|
|
cursor: pointer;
|
|
|
min-width: 0.88rem;
|
|
|
text-align: center;
|
|
|
height: 0.48rem;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
}
|
|
|
|
|
|
.icon-cuohao {
|
|
|
font-size: 15px;
|
|
|
color: #424242;
|
|
|
}
|
|
|
|
|
|
.price_box .span_active {
|
|
|
background-color: #dbb25f;
|
|
|
color: #fff;
|
|
|
}
|
|
|
</style>
|
|
|
</head>
|
|
|
<body>
|
...
|
...
|
@@ -377,7 +522,7 @@ |
|
|
<div class="doc_right">{{meal?meal:'选择套餐>'}}</div>
|
|
|
</div>
|
|
|
<div v-else>
|
|
|
<div class="doc_item" @click="dateSelect">
|
|
|
<div class="doc_item" @click="dateSelect" id="sever">
|
|
|
<div class="doc_room"><span class="iconfont icon-taocan"></span><span>预约参观</span></div>
|
|
|
<div class="doc_right" v-if="date_info">{{date_info}}</div>
|
|
|
<span v-else class="doc_right">请选择时间 <span class="iconfont icon-xiangyou"></span></span>
|
...
|
...
|
@@ -414,7 +559,7 @@ |
|
|
</div>
|
|
|
</footer>
|
|
|
<!--预约-->
|
|
|
<div @click="close" class="meal" v-if="room">
|
|
|
<div @click="close" class="meal" v-if="c_room">
|
|
|
<div class="meal_item" @click.stop>
|
|
|
<div class="meal_title">
|
|
|
<span></span>
|
...
|
...
|
@@ -488,6 +633,7 @@ |
|
|
<script type="text/javascript" src="../../assets/js/weui.min.js"></script>
|
|
|
<script type="text/javascript" src="../../assets/js/public.js"></script>
|
|
|
<script type="text/javascript" src="../../assets/js/fastclick.js"></script>
|
|
|
<script type="text/javascript" src="../../assets/js/datePicker.js"></script>
|
|
|
<script>
|
|
|
new FastClick(document.body);
|
|
|
</script>
|
...
|
...
|
@@ -519,13 +665,16 @@ |
|
|
pos: 'fixed',
|
|
|
num: 1,
|
|
|
sever_list: [],
|
|
|
active_index: -1,
|
|
|
active_name: '',
|
|
|
priceList: [],
|
|
|
attribute: [],
|
|
|
id: '',
|
|
|
unit: '',
|
|
|
taocan: false
|
|
|
price_info: [],
|
|
|
active_index: -1,
|
|
|
active_index2: -1,
|
|
|
taocan: false,
|
|
|
c_room: false
|
|
|
},
|
|
|
created: function () {
|
|
|
this.id = localStorage.getItem('id');
|
...
|
...
|
@@ -578,117 +727,164 @@ |
|
|
set_rank: function () {
|
|
|
var app = this;
|
|
|
if (app.date_info) {
|
|
|
api.confirm({
|
|
|
// api.confirm({
|
|
|
// title: '选择套餐',
|
|
|
// msg: '预约参观和选择入住只能选择其中一类',
|
|
|
// buttons: ['确定', '取消']
|
|
|
// }, function (ret, err) {
|
|
|
// var index = ret.buttonIndex;
|
|
|
// if (index == 2) {
|
|
|
//
|
|
|
// }
|
|
|
// });
|
|
|
weui.confirm('预约参观和选择入住只能选择其中一类', {
|
|
|
title: '选择套餐',
|
|
|
msg: '预约参观和选择入住只能选择其中一类',
|
|
|
buttons: ['确定', '取消']
|
|
|
}, function (ret, err) {
|
|
|
var index = ret.buttonIndex;
|
|
|
if (index == 2) {
|
|
|
app.date_info = '';
|
|
|
app.room = '';
|
|
|
app.total = app.goods.good_price
|
|
|
}
|
|
|
buttons: [{
|
|
|
label: '取消',
|
|
|
type: 'default',
|
|
|
onClick: function(){ console.log('no') }
|
|
|
}, {
|
|
|
label: '确定',
|
|
|
type: 'primary',
|
|
|
onClick: function(){
|
|
|
app.date_info = '';
|
|
|
app.room = '';
|
|
|
app.total = app.goods.good_price
|
|
|
app.c_room = true
|
|
|
}
|
|
|
}]
|
|
|
});
|
|
|
} else {
|
|
|
api.openFrame({
|
|
|
bgColor: 'rgba(0,0,0,0.05)',
|
|
|
name: 'choose_room_f',
|
|
|
url: './choose_room_f.html',
|
|
|
bounces: false,
|
|
|
animation: {
|
|
|
type: "push",
|
|
|
subType: "from_bottom",
|
|
|
duration: 300
|
|
|
},
|
|
|
rect: {
|
|
|
x: 0,
|
|
|
y: 0,
|
|
|
w: 'auto',
|
|
|
h: 'auto'
|
|
|
},
|
|
|
pageParam: {
|
|
|
id: app.id,
|
|
|
attribute: app.attribute,
|
|
|
unit: app.unit
|
|
|
}
|
|
|
});
|
|
|
// api.openFrame({
|
|
|
// bgColor: 'rgba(0,0,0,0.05)',
|
|
|
// name: 'choose_room_f',
|
|
|
// url: './choose_room_f.html',
|
|
|
// bounces: false,
|
|
|
// animation: {
|
|
|
// type: "push",
|
|
|
// subType: "from_bottom",
|
|
|
// duration: 300
|
|
|
// },
|
|
|
// rect: {
|
|
|
// x: 0,
|
|
|
// y: 0,
|
|
|
// w: 'auto',
|
|
|
// h: 'auto'
|
|
|
// },
|
|
|
// pageParam: {
|
|
|
// id: app.id,
|
|
|
// attribute: app.attribute,
|
|
|
// unit: app.unit
|
|
|
// }
|
|
|
// });
|
|
|
app.c_room = true
|
|
|
}
|
|
|
},
|
|
|
// 选择日期
|
|
|
dateSelect: function () {
|
|
|
var app = this;
|
|
|
if (app.room) {
|
|
|
api.confirm({
|
|
|
weui.confirm('预约参观和选择入住只能选择其中一类', {
|
|
|
title: '选择套餐',
|
|
|
msg: '预约参观和选择入住只能选择其中一类',
|
|
|
buttons: ['取消', '确定']
|
|
|
}, function (ret, err) {
|
|
|
var index = ret.buttonIndex;
|
|
|
if (index == 1) {
|
|
|
app.date_info = '';
|
|
|
app.room = ''
|
|
|
}
|
|
|
buttons: [{
|
|
|
label: '取消',
|
|
|
type: 'default',
|
|
|
onClick: function(){ console.log('no') }
|
|
|
}, {
|
|
|
label: '确定',
|
|
|
type: 'primary',
|
|
|
onClick: function(){ console.log('yes') }
|
|
|
}]
|
|
|
});
|
|
|
// api.confirm({
|
|
|
// title: '选择套餐',
|
|
|
// msg: '',
|
|
|
// buttons: ['取消', '确定']
|
|
|
// }, function (ret, err) {
|
|
|
// var index = ret.buttonIndex;
|
|
|
// if (index == 1) {
|
|
|
// app.date_info = '';
|
|
|
// app.room = ''
|
|
|
// }
|
|
|
// });
|
|
|
} else {
|
|
|
// alert(getTimeDetil(72))
|
|
|
if (api.systemType == 'ios') {
|
|
|
api.openPicker({
|
|
|
type: 'date_time',
|
|
|
date: new Date(),
|
|
|
minDate: getTimeDetil(72),
|
|
|
title: '服务时间'
|
|
|
}, function (ret, err) {
|
|
|
if (ret) {
|
|
|
app.year = ret.year;
|
|
|
app.month = ret.month;
|
|
|
app.day = ret.day;
|
|
|
app.hour = ret.hour;
|
|
|
app.minute = ret.minute;
|
|
|
app.date_info = app.year + '-' + add0(app.month) + '-' + add0(app.day) + ' ' + add0(app.hour) + ':' + add0(app.minute);
|
|
|
if (checkDate(app.date_info, 3)) {
|
|
|
return app.date_info
|
|
|
} else {
|
|
|
toastMsg('服务时间请选择在3天以后');
|
|
|
return app.date_info = app.default_date
|
|
|
}
|
|
|
var calendar = new datePicker();
|
|
|
calendar.init({
|
|
|
'trigger': '#sever', /*按钮选择器,用于触发弹出插件*/
|
|
|
'type': 'datetime', /*模式:date日期;datetime日期时间;time时间;ym年月;*/
|
|
|
// 'minDate':getTimeDetil(3), /*最小日期*/
|
|
|
'minDate': formatDate(new Date(getTimeDetil(72)), 1), /*最小日期*/
|
|
|
'maxDate': '', /*最大日期*/
|
|
|
'onSubmit': function () {/*确认时触发事件*/
|
|
|
console.log(calendar.value);
|
|
|
if (calendar.value) {
|
|
|
app.date_info = calendar.value;
|
|
|
calendar.onClose()
|
|
|
} else {
|
|
|
console.log(err)
|
|
|
toastMsg('服务时间请选择在3天以后');
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
else {
|
|
|
api.openPicker({
|
|
|
type: 'date',
|
|
|
title: '服务日期',
|
|
|
}, function (ret, err) {
|
|
|
if (ret) {
|
|
|
app.year = ret.year;
|
|
|
app.month = ret.month;
|
|
|
app.day = ret.day;
|
|
|
api.openPicker({
|
|
|
type: 'time',
|
|
|
title: '服务时间'
|
|
|
}, function (rets, errs) {
|
|
|
if (rets) {
|
|
|
app.hour = rets.hour;
|
|
|
app.minute = rets.minute;
|
|
|
app.date_info = app.year + '-' + add0(app.month) + '-' + add0(app.day) + ' ' + add0(app.hour) + ':' + add0(app.minute);
|
|
|
if (checkDate(app.date_info, 1)) {
|
|
|
return app.date_info
|
|
|
} else {
|
|
|
toastMsg('选择生日不能小于当前时间');
|
|
|
return app.date_info = app.default_date
|
|
|
}
|
|
|
} else {
|
|
|
console.log(errs)
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
console.log(err)
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
'onClose': function () {/*取消时触发事件*/
|
|
|
// api.closeWin();
|
|
|
}
|
|
|
});
|
|
|
// // alert(getTimeDetil(72))
|
|
|
// api.openPicker({
|
|
|
// type: 'date_time',
|
|
|
// date: new Date(),
|
|
|
// minDate: getTimeDetil(72),
|
|
|
// title: '服务时间'
|
|
|
// }, function (ret, err) {
|
|
|
// if (ret) {
|
|
|
// app.year = ret.year;
|
|
|
// app.month = ret.month;
|
|
|
// app.day = ret.day;
|
|
|
// app.hour = ret.hour;
|
|
|
// app.minute = ret.minute;
|
|
|
// app.date_info = app.year + '-' + add0(app.month) + '-' + add0(app.day) + ' ' + add0(app.hour) + ':' + add0(app.minute);
|
|
|
// if (checkDate(app.date_info, 3)) {
|
|
|
// return app.date_info
|
|
|
// } else {
|
|
|
// toastMsg('服务时间请选择在3天以后');
|
|
|
// return app.date_info = app.default_date
|
|
|
// }
|
|
|
// } else {
|
|
|
// console.log(err)
|
|
|
// }
|
|
|
// });
|
|
|
// }
|
|
|
// else {
|
|
|
// api.openPicker({
|
|
|
// type: 'date',
|
|
|
// title: '服务日期',
|
|
|
// }, function (ret, err) {
|
|
|
// if (ret) {
|
|
|
// app.year = ret.year;
|
|
|
// app.month = ret.month;
|
|
|
// app.day = ret.day;
|
|
|
// api.openPicker({
|
|
|
// type: 'time',
|
|
|
// title: '服务时间'
|
|
|
// }, function (rets, errs) {
|
|
|
// if (rets) {
|
|
|
// app.hour = rets.hour;
|
|
|
// app.minute = rets.minute;
|
|
|
// app.date_info = app.year + '-' + add0(app.month) + '-' + add0(app.day) + ' ' + add0(app.hour) + ':' + add0(app.minute);
|
|
|
// if (checkDate(app.date_info, 1)) {
|
|
|
// return app.date_info
|
|
|
// } else {
|
|
|
// toastMsg('选择生日不能小于当前时间');
|
|
|
// return app.date_info = app.default_date
|
|
|
// }
|
|
|
// } else {
|
|
|
// console.log(errs)
|
|
|
// }
|
|
|
// });
|
|
|
// } else {
|
|
|
// console.log(err)
|
|
|
// }
|
|
|
// });
|
|
|
// }
|
|
|
}
|
|
|
},
|
|
|
// 预约时间
|
...
|
...
|
@@ -737,6 +933,7 @@ |
|
|
app.real_price = res.data.data.real_price;
|
|
|
app.price = res.data.data.price;
|
|
|
app.goods = res.data.data.goods;
|
|
|
document.title = app.goods.post_title;
|
|
|
app.attribute_type = res.data.data.attribute_type;
|
|
|
app.unit = res.data.data.unit;
|
|
|
loadEnd();
|
...
|
...
|
@@ -873,7 +1070,7 @@ |
|
|
// name: 'choose_meal_w'
|
|
|
// });
|
|
|
this.taocan = false
|
|
|
this.room = false
|
|
|
this.c_room = false
|
|
|
},
|
|
|
t_choose_sever: function (attr, index) {
|
|
|
var app = this;
|
...
|
...
|
@@ -928,18 +1125,21 @@ |
|
|
|
|
|
},
|
|
|
choose_left: function (index) {
|
|
|
var app = this;
|
|
|
app.active_index = index;
|
|
|
app.active_left = app.attribute[0][index];
|
|
|
app.num = app.price_info.limit_num;
|
|
|
app.getPrice();
|
|
|
},
|
|
|
choose_right: function (index) {
|
|
|
var app = this;
|
|
|
app.active_index2 = index;
|
|
|
app.active_right = app.attribute[1][index];
|
|
|
app.getPrice();
|
|
|
app.num = app.price_info.limit_num;
|
|
|
},
|
|
|
reduce: function () {
|
|
|
var app = this;
|
|
|
if (app.price_info.limit_num) {
|
|
|
if (app.num > app.price_info.limit_num) {
|
|
|
app.num--
|
...
|
...
|
@@ -949,14 +1149,18 @@ |
|
|
}else {
|
|
|
toastMsg('请选择入住类型')
|
|
|
}
|
|
|
app.total = parseFloat(app.price_info.price) * (app.num);
|
|
|
},
|
|
|
plus: function () {
|
|
|
var app = this;
|
|
|
if (app.num < app.price_info.limit_num) {
|
|
|
} else {
|
|
|
app.num++
|
|
|
}
|
|
|
app.total = parseFloat(app.price_info.price) * (app.num);
|
|
|
},
|
|
|
getPrice: function () {
|
|
|
var app = this;
|
|
|
if (app.active_left && app.active_right) {
|
|
|
var post = {
|
|
|
attribute: app.active_left + '_' + app.active_right,
|
...
|
...
|
@@ -975,17 +1179,23 @@ |
|
|
|
|
|
},
|
|
|
pay_go: function () {
|
|
|
var app = this;
|
|
|
if (app.active_left && app.active_right) {
|
|
|
api.sendEvent({
|
|
|
name: 'room',
|
|
|
extra: {
|
|
|
name_left: app.active_left,
|
|
|
name_right: app.active_right,
|
|
|
num: app.num,
|
|
|
price: app.price_info.price,
|
|
|
attribute_id: app.attribute_id
|
|
|
}
|
|
|
});
|
|
|
// api.sendEvent({
|
|
|
// name: 'room',
|
|
|
// extra: {
|
|
|
// name_left: app.active_left,
|
|
|
// name_right: app.active_right,
|
|
|
// num: app.num,
|
|
|
// price: app.price_info.price,
|
|
|
// attribute_id: app.attribute_id
|
|
|
// }
|
|
|
// });
|
|
|
app.room = app.active_left + ',' + app.active_right + ',' + app.num + app.unit;
|
|
|
// // alert(JSON.stringify(ret.value));
|
|
|
// app.num = ret.value.num;
|
|
|
// app.attribute_id = ret.value.attribute_id;
|
|
|
app.total = parseFloat(app.price_info.price) * (app.num);
|
|
|
app.close()
|
|
|
}
|
|
|
else {
|
...
|
...
|
|