Browse Source

多规格下单

master
Enzo 4 years ago
parent
commit
f9c8ce1f04
  1. 4
      common/api.js
  2. 171
      pages/goodsDetail/index.vue
  3. 104
      pages/order/confirm_order.vue

4
common/api.js

@ -1,7 +1,7 @@
// appId: 正式 null | 测试 wxeb58570b5e04d147
export const DEV = "prod"; // dev 测试 | prod 正式
export const DEV = "dev"; // dev 测试 | prod 正式
export const VERSION = '1.0.0'; // 版本号
export const DEVURL = 'https://hainan.lanzulive.com'; // 测试服请求地址
export const DEVURL = 'https://yytx.eugyl.com'; // 测试服请求地址
// export const DEVURL = 'http://hainan.com'; // 测试服请求地址
export const PRODURL = 'https://yytx.eugyl.com'; // 正式服请求地址

171
pages/goodsDetail/index.vue

@ -38,7 +38,7 @@
</view>
<!-- 景区类型 -->
<view v-if="goods_detail.product.extends && goods_detail.product && goods_detail.product.type == 2">
<view class="goods-detail" @click="openMap(goods_detail.product.extends.field_2_address,goods_detail.product.extends.field_2_latitude,goods_detail.product.extends.field_2_longitude)">
<view class="goods-detail" v-if="goods_detail.product.extends.field_2_name && goods_detail.product.extends.field_2_address" @click="openMap(goods_detail.product.extends.field_2_address,goods_detail.product.extends.field_2_latitude,goods_detail.product.extends.field_2_longitude)">
<view class="lf-font-32 lf-font-bold lf-m-b-20">{{goods_detail.product.extends.field_2_name}}</view>
<view class="lf-row-between">
<view class="lf-line-2 lf-font-28 lf-color-333">{{goods_detail.product.extends.field_2_address}}</view>
@ -77,23 +77,23 @@
<u-popup v-model="scenic_spot" mode="bottom" :closeable="true" border-radius="20">
<view class="lf-p-32">
<view class="price lf-flex">
<lf-price :price="goods_detail.price"></lf-price>
<view class="pop-price lf-m-l-20 lf-font-24">¥{{ goods_detail.original_price }}</view>
<lf-price :price="goods_detail.product.spec[type_index].price"></lf-price>
<view class="pop-price lf-m-l-20 lf-font-24">¥{{ goods_detail.product.spec[type_index].original_price }}</view>
</view>
<view class="lf-font-24 lf-m-t-20 lf-color-555">
入园时间09月23日
开始时间{{ choose_date }}
</view>
<view style="margin-top: 60rpx;">
<text class="lf-font-32 lf-font-bold" style="color: #131315;">套餐类型</text>
<view class="lf-m-t-30 choose-father">
<view class="choose-span" :class="type_index==index?'choose-active':''" v-for="(i,index) of 2" @click="chooseType(index)">大床房</view>
<view class="choose-span" :class="type_index==index?'choose-active':''" v-for="(item,index) of goods_detail.product.spec" :key="index" @click="chooseType(index)">{{item.name}}</view>
</view>
</view>
<view class="lf-m-t-30">
<text class="lf-font-32 lf-font-bold" style="color: #131315;">入园时间</text>
<text class="lf-font-32 lf-font-bold" style="color: #131315;">开始时间</text>
<view class="lf-row-between list-item lf-m-t-20" style="padding: 0!important;">
<view class="lf-row-center">
<text class="lf-font-28 lf-color-gray">入园时间</text>
<text class="lf-font-28 lf-color-gray">开始时间</text>
</view>
<view class="lf-flex">
<picker mode="date" :value="choose_date" @change="pickerChange">
@ -105,7 +105,7 @@
</view>
</view>
<view style="margin-top: 60rpx;">
<button class="choose_btn">立即购买</button>
<button class="choose_btn" @click="toAddOrder()">立即购买</button>
</view>
</view>
</u-popup>
@ -166,22 +166,22 @@
<u-popup v-model="hotel" mode="bottom" :closeable="true" border-radius="20">
<view class="lf-p-32">
<view class="price lf-flex">
<lf-price :price="goods_detail.price"></lf-price>
<view class="pop-price lf-m-l-20 lf-font-24">¥{{ goods_detail.original_price }}</view>
<lf-price :price="goods_detail.product.spec[type_index].price"></lf-price>
<view class="pop-price lf-m-l-20 lf-font-24">¥{{ goods_detail.product.spec[type_index].original_price }}</view>
</view>
<view class="lf-font-24 lf-m-t-20 lf-color-555">
酒店住房日期09月22日-09月27日
酒店住房日期{{live_date}}~{{leave_date}}
</view>
<view style="margin-top: 60rpx;">
<text class="lf-font-32 lf-font-bold" style="color: #131315;">套餐类型</text>
<view class="lf-m-t-30 choose-father">
<view class="choose-span" :class="type_index==index?'choose-active':''" v-for="(i,index) of 2" @click="chooseType(index)">大床房</view>
<view class="choose-span" :class="type_index==index?'choose-active':''" v-for="(item,index) of goods_detail.product.spec" :key="index" @click="chooseType(index)">{{item.name}}</view>
</view>
</view>
<view class="lf-m-t-30">
<view class="lf-row-between">
<text class="lf-font-32 lf-font-bold" style="color: #131315;">酒店住房日期</text>
<text class="lf-font-24 lf-color-gray">共6</text>
<text class="lf-font-24 lf-color-gray" v-if="totalLive">{{totalLive}}</text>
</view>
<view class="lf-row-between list-item lf-m-t-20" style="padding: 0!important;">
<view class="lf-row-center">
@ -233,7 +233,7 @@
</view>
</view>
<view style="margin-top: 60rpx;">
<button class="choose_btn">立即购买</button>
<button class="choose_btn" @click="toAddOrder()">立即购买</button>
</view>
</view>
</u-popup>
@ -270,26 +270,25 @@
<u-popup v-model="travel_route" mode="bottom" :closeable="true" border-radius="20">
<view class="lf-p-32">
<view class="price lf-flex">
<lf-price :price="goods_detail.price"></lf-price>
<view class="pop-price lf-m-l-20 lf-font-24">¥{{ goods_detail.original_price }}</view>
<lf-price :price="goods_detail.product.spec[type_index].price"></lf-price>
<view class="pop-price lf-m-l-20 lf-font-24">¥{{ goods_detail.product.spec[type_index].original_price }}</view>
</view>
<view class="lf-font-24 lf-m-t-20 lf-color-555">
套餐类型奢玩云南6天出行日期09月22日-09月27日
套餐类型{{goods_detail.product.spec[type_index].name}}
</view>
<view style="margin-top: 60rpx;">
<text class="lf-font-32 lf-font-bold" style="color: #131315;">套餐类型</text>
<view class="lf-m-t-30 choose-father">
<view class="choose-span" :class="type_index==index?'choose-active':''" v-for="(i,index) of 2" @click="chooseType(index)">潮玩云南游6天</view>
<view class="choose-span" :class="type_index==index?'choose-active':''" v-for="(item,index) of goods_detail.product.spec" @click="chooseType(index)" :key="index">{{item.name}}</view>
</view>
</view>
<view class="lf-m-t-30">
<view class="lf-row-between">
<text class="lf-font-32 lf-font-bold" style="color: #131315;">出行日期</text>
<text class="lf-font-24 lf-color-gray">共6晚</text>
</view>
<view class="lf-row-between list-item lf-m-t-20" style="padding: 0!important;">
<view class="lf-row-center">
<text class="lf-font-28 lf-color-gray">出发时间</text>
<text class="lf-font-28 lf-color-gray">开始时间</text>
</view>
<view class="lf-flex">
<picker mode="date" :value="go_date" @change="goChange">
@ -299,21 +298,9 @@
<text class="lf-iconfont lf-icon-xiangyou lf-text-vertical lf-m-l-10"></text>
</view>
</view>
<view class="lf-row-between list-item" style="padding: 0!important;">
<view class="lf-row-center">
<text class="lf-font-28 lf-color-gray">回程时间</text>
</view>
<view class="lf-flex">
<picker mode="date" :value="back_date" @change="backChange">
<!-- <view class="lf-color-555 lf-text-right" style="width: 400rpx;">{{ '请选择收货时间...' }}</view> -->
<view class="lf-color-333 lf-text-right lf-font-28" style="width: 400rpx;">{{ back_date }}</view>
</picker>
<text class="lf-iconfont lf-icon-xiangyou lf-text-vertical lf-m-l-10"></text>
</view>
</view>
</view>
<view style="margin-top: 60rpx;">
<button class="choose_btn">立即购买</button>
<button class="choose_btn" @click="toAddOrder()">立即购买</button>
</view>
</view>
</u-popup>
@ -350,7 +337,7 @@
<view class="lf-m-t-1">分享</view>
</button>
</view>
<button class="btn" @click="toAddOrder">立即购买</button>
<button class="btn" @click="changePop(goods_detail.product.type)">立即购买</button>
</view>
<!-- 回到顶部 -->
<!-- <u-back-top :scroll-top="pageScrollTop" :custom-style="{background: 'rgba(51, 51 51, 0.3)'}" :icon-style="{color: '#ffffff'}"></u-back-top> -->
@ -375,16 +362,17 @@
//
scenic_spot: false,
type_index: 0,
choose_date: '请选择入园时间',
choose_date: '请选择开始时间',
//
hotel: false,
live_date: '请选择入住日期',
leave_date: '请选择离店日期',
arrive_date: '请选择到店日期',
arrive_time: '请选择到店时间',
totalLive: '',//宿
//线
travel_route: false,
go_date: '请选择出发日期',
go_date: '请选择开始时间',
back_date: '请选择回程日期',
//
canteen: false
@ -405,6 +393,15 @@
}
},
methods: {
compareDate(val) {
var nowTime = new Date(new Date().toLocaleDateString()).getTime();
let oldTime = new Date(new Date(val).toLocaleDateString()).getTime();
if(nowTime>oldTime) {
return false;
}else {
return true;
}
},
pickerChange(e) {
this.choose_date = e.detail.value;
console.log(e)
@ -426,6 +423,9 @@
},
leaveChange(e) {
this.leave_date = e.detail.value;
let live_date = new Date(new Date(this.live_date).toLocaleDateString()).getTime();
let leave_date = new Date(new Date(this.leave_date).toLocaleDateString()).getTime();
this.totalLive = parseInt(Math.abs(leave_date - live_date) / 1000 / 60 / 60 / 24);
},
chooseType(index) {
this.type_index = index;
@ -498,8 +498,105 @@
},
//
toAddOrder(){
//0线123
if(this.goods_detail.product.type == 2) {
//
if(this.choose_date != '请选择开始时间') {
let date_compare = this.compareDate(this.choose_date);
console.log(date_compare)
if(date_compare){
let goods_id = this.goods_detail.id;
let godds_type = this.goods_detail.product.type;
let enter_time = this.choose_date;
let spec_id = this.goods_detail.product.spec[this.type_index].id;
let type_text = this.goods_detail.product.spec[this.type_index].name;
this.$url('/pages/order/confirm_order?goods_id='+ goods_id+ '&spec_id='+ spec_id +'&goods_type='+godds_type+'&enter_time='+enter_time+'&goods_typetext='+type_text);
}else {
this.$msg('请选择正确的开始时间!');
}
}else {
this.$msg('请选择开始时间!');
}
}else if(this.goods_detail.product.type == 1) {
let date1 = false;
let date2 = false;
let date3 = false;
if(this.live_date != '请选择入住日期') {
let date_compare = this.compareDate(this.live_date);
if(date_compare){
date1 = true;
}else {
this.$msg('请选择正确的入住日期!');
return
}
}else {
this.$msg('请选择入住日期!');
return
}
if(this.leave_date != '请选择离店日期') {
let date_compare = this.compareDate(this.leave_date);
if(date_compare){
date2 = true;
}else {
this.$msg('请选择正确的离店日期!');
return
}
}else {
this.$msg('请选择离店日期!');
return
}
if(this.arrive_date != '请选择到店日期') {
let date_compare = this.compareDate(this.arrive_date);
if(date_compare){
date3 = true;
}else {
this.$msg('请选择正确的到店日期!');
return
}
}else {
this.$msg('请选择到店日期!');
return
}
if(this.arrive_time == '请选择到店时间') {
this.$msg('请选择到店时间!');
return
}
if(date1&&date2&&date3) {
let arrival_timedate = this.arrive_date + ' ' + this.arrive_time
console.log(arrival_time)
let goods_id = this.goods_detail.id;
let godds_type = this.goods_detail.product.type;
let spec_id = this.goods_detail.product.spec[this.type_index].id;
let type_text = this.goods_detail.product.spec[this.type_index].name;
//
let check_in_time = this.live_date;
let check_out_time = this.leave_date;
let totalLive = this.totalLive;
let arrival_time = arrival_timedate;
this.$url('/pages/order/confirm_order?goods_id='+ goods_id+ '&spec_id='+ spec_id +'&goods_type='+godds_type+'&check_in_time='+check_in_time+'&goods_typetext='+type_text+'&check_out_time='+check_out_time+'&arrival_time='+arrival_time+'&totalLive='+totalLive);
}
}else if(this.goods_detail.product.type == 0) {
if(this.go_date != '请选择开始时间') {
let date_compare = this.compareDate(this.go_date);
console.log(date_compare)
if(date_compare){
let goods_id = this.goods_detail.id;
this.$url('/pages/order/confirm_order?goods_id='+ goods_id);
let godds_type = this.goods_detail.product.type;
let departure_time = this.go_date;
let spec_id = this.goods_detail.product.spec[this.type_index].id;
let type_text = this.goods_detail.product.spec[this.type_index].name;
this.$url('/pages/order/confirm_order?goods_id='+ goods_id+ '&spec_id='+ spec_id +'&goods_type='+godds_type+'&departure_time='+departure_time+'&goods_typetext='+type_text);
}else {
this.$msg('请选择正确的开始时间!');
}
}else {
this.$msg('请选择开始时间!');
}
}
// let goods_id = this.goods_detail.id;
// this.$url('/pages/order/confirm_order?goods_id='+ goods_id);
},
//
lookImg(index){

104
pages/order/confirm_order.vue

@ -14,17 +14,17 @@
<u-icon name="phone"></u-icon>
</button>
</view>
<view class="cu-bar1 padding-lr">
<view class="cu-bar1 padding-lr" v-if="goods_type!=3">
<text class="lf-color-555 lf-font-28">身份证号码</text>
<input type="text" v-model="vertify_code" class="lf-color-999 lf-font-28 lf-text-left" style="position:absolute;right:180rpx" placeholder="请输入身份证号码"/>
</view>
<view class="cu-bar1 padding-lr">
<view class="cu-bar1 padding-lr" v-if="goods_type!=3">
<text class="lf-color-555 lf-font-28">性别</text>
<input type="text" v-model="sex" class="lf-color-999 lf-font-28 lf-text-left" style="position:absolute;right:180rpx" placeholder="请输入性别"/>
</view>
<view class="cu-bar1 padding-lr">
<view class="cu-bar1 padding-lr" v-if="goods_type!=3">
<text class="lf-color-555 lf-font-28">年龄</text>
<input type="text" v-model="age" class="lf-color-999 lf-font-28 lf-text-left" style="position:absolute;right:180rpx" placeholder="请输入年龄"/>
<input type="number" v-model="age" class="lf-color-999 lf-font-28 lf-text-left" style="position:absolute;right:180rpx" placeholder="请输入年龄"/>
</view>
</view>
<self-line/>
@ -63,17 +63,42 @@
</view> -->
<self-line/>
<view class="bg-white" v-if="enter_type!=1">
<!-- 酒店 -->
<view v-if="goods_type == 1">
<view class="cu-bar padding-lr">
<text class="lf-color-555 lf-font-28">套餐类型</text>
<text class="lf-font-28" style="color: #131315;">大床房</text>
<text class="lf-font-28" style="color: #131315;">{{goods_typetext}}</text>
</view>
<view class="cu-bar padding-lr">
<text class="lf-color-555 lf-font-28">酒店住房日期</text>
<text class="lf-font-28" style="color: #131315;">09月22日-09月27日 共6</text>
<text class="lf-font-28" style="color: #131315;">{{check_in_time}}-{{check_out_time}} {{totalLive}}</text>
</view>
<view class="cu-bar padding-lr">
<text class="lf-color-555 lf-font-28">到店时间</text>
<text class="lf-font-28" style="color: #131315;">09月22日 16:00</text>
<text class="lf-font-28" style="color: #131315;">{{arrival_time}}</text>
</view>
</view>
<!-- 景区 -->
<view v-if="goods_type == 2">
<view class="cu-bar padding-lr">
<text class="lf-color-555 lf-font-28">套餐类型</text>
<text class="lf-font-28" style="color: #131315;">{{goods_typetext}}</text>
</view>
<view class="cu-bar padding-lr">
<text class="lf-color-555 lf-font-28">开始时间</text>
<text class="lf-font-28" style="color: #131315;">{{enter_time}}</text>
</view>
</view>
<!-- 旅游路线 -->
<view v-if="goods_type == 0">
<view class="cu-bar padding-lr">
<text class="lf-color-555 lf-font-28">套餐类型</text>
<text class="lf-font-28" style="color: #131315;">{{goods_typetext}}</text>
</view>
<view class="cu-bar padding-lr">
<text class="lf-color-555 lf-font-28">开始时间</text>
<text class="lf-font-28" style="color: #131315;">{{departure_time}}</text>
</view>
</view>
</view>
<self-line/>
@ -153,16 +178,44 @@
pay_order_id: 0,
vertify_code: '',
sex: '',
age: ''
age: '',
goods_type: 0,
spec_id: 0,
goods_typetext: '',
//
enter_time: '',
//线
departure_time: '',
return_time: '',
//
check_in_time: '',
check_out_time: '',
arrival_time: '',
totalLive: ''
}
},
onLoad(e) {
//0线123
this.goods_id = e.goods_id;
this.goods_type = e.goods_type;
this.btn_type = e.btn_type;
this.order_id = e.order_id;
this.spec_id = e.spec_id;
this.enter_type = e.enter_type;
this.goods_typetext = e.goods_typetext;
if(this.goods_id) {
this.getGoodsData(this.pay_type);
if(this.goods_type == 2) {
this.enter_time = e.enter_time;
}else if(this.goods_type == 0) {
this.departure_time = e.departure_time;
}else if(this.goods_type == 1) {
this.check_in_time = e.check_in_time;
this.check_out_time = e.check_out_time;
this.arrival_time = e.arrival_time;
this.totalLive = e.totalLive;
console.log(this.check_in_time,this.check_out_time,this.arrival_time)
}
}
if(this.order_id && this.enter_type == 1) {
console.log('con列表执行')
@ -195,8 +248,7 @@
iv,
// token: userInfo.token //
}).then(res => {
this.$msg('更新成功', {icon: 'success'});
console.log(res)
this.phone = res.data.mobile;
})
}
},
@ -228,10 +280,40 @@
this.$msg('请输入联系电话!');
return;
}
if(this.goods_type != 3) {
if(!this.vertify_code) {
this.$msg('请输入身份证号!');
return;
}
if(!this.sex) {
this.$msg('请输入性别!');
return;
}
if(!this.age) {
this.$msg('请输入年龄!');
return;
}
}
if(!this.ifPay) return;
this.ifPay = false;
this.$http(this.API.API_CREATEORDER,{id: this.goods_id,num: 1,pay_type: this.pay_type,name:this.contact,mobile:this.phone}).then(res => {
this.$http(this.API.API_CREATEORDER,{
id: this.goods_id,
num: 1,
pay_type: this.pay_type,
name:this.contact,
mobile:this.phone,
spec_id: this.spec_id,
enter_time: this.enter_time,
sex: this.sex,
age: this.age,
id_card: this.vertify_code,
departure_time: this.departure_time,
return_time: this.return_time,
check_in_time: this.check_in_time,
check_out_time: this.check_out_time,
arrival_time: this.arrival_time
}).then(res => {
this.pay_order_id = res.data.id
if(this.pay_type == 1) {

Loading…
Cancel
Save