公司演示版e鹿悦游
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CjyTravel/subPageC/bookHomestay/bookHomestay.vue

263 lines
7.9 KiB

11 months ago
<template>
11 months ago
<view class="v-pages bgcolor p-b-24">
<view class="v-card order small container-fluid m-t-24" style="padding-bottom: 60rpx;">
11 months ago
<view class="v-order-form">
<view class="v-form-date row flex-align-center">
<view class="start"><text class="date">{{orderInfo.startDate1}}</text></view>
<text class="mid">{{orderInfo.dayNum}}</text>
<view class="end"><text class="date">{{orderInfo.endDate1}}</text></view>
</view>
<view class="v-order-title">
{{orderInfo.houseName}}
</view>
<view class="v-order-tip">
<!-- <text
11 months ago
v-if="orderInfo.bedNum">{{orderInfo.bedNum}}张床{{orderInfo.bedWide}}米宽{{orderInfo.houseNam}}</text> -->
<text v-if="orderInfo.guest">{{orderInfo.guest}}人入住</text> <text class="m-l-10"
11 months ago
v-if="orderInfo.houseArea">{{orderInfo.houseArea}}</text>
</view>
11 months ago
<view class="v-order-wait">需等待商家确认</view>
11 months ago
</view>
</view>
11 months ago
11 months ago
<view class="v-card order small container-fluid m-t-24">
<view class="v-order-title m-b-24">
11 months ago
<view class="text"><text>入住信息</text></view>
</view>
<uni-forms class="v-order-form" ref="form" :modelValue="formData">
11 months ago
<!-- 整套民宿预定暂时不显示房间数量 -->
<!-- <uni-forms-item label="房间数量" name="roomNumber">
11 months ago
<uni-easyinput class="v-input" type="number" :inputBorder="false" v-model="formData.roomNumber"
placeholder="请输入房间数量" />
</uni-forms-item> -->
11 months ago
<uni-forms-item label="入住人" name="name">
<uni-easyinput class="v-input" type="text" :inputBorder="false" placeholderStyle="fontSize:24rpx"
v-model="formData.name" placeholder="请输入入住人姓名" />
11 months ago
</uni-forms-item>
<uni-forms-item label="身份证号" name="idCardNumber">
<uni-easyinput class="v-input" type="text" :inputBorder="false" placeholderStyle="fontSize:24rpx"
v-model="formData.idCardNumber" placeholder="请输入身份证号码" />
11 months ago
</uni-forms-item>
11 months ago
<uni-forms-item label="联系手机" name="phoneNumber">
<uni-easyinput class="v-input" type="number" :inputBorder="false" placeholderStyle="fontSize:24rpx"
v-model="formData.phoneNumber" placeholder="请输入手机号码" />
11 months ago
</uni-forms-item>
</uni-forms>
</view>
11 months ago
<view class="v-card order small container-fluid m-t-24">
<view class="v-order-title">
11 months ago
<view class="text"><text>发票服务</text></view>
</view>
<view class="m-t-24 v-form-content">如需发票请向民宿前台索取</view>
</view>
11 months ago
11 months ago
<view class="v-card order small bg1 container-fluid m-t-24">
11 months ago
<view class="v-order-title">
11 months ago
<view class="text"><text>下单说明</text></view>
</view>
<view class="m-t-24 v-form-content">订单需等待商家确认后才生效订单确认结果以平台订单信息为准</view>
</view>
11 months ago
11 months ago
<view class="v-order-submit row flex-align-center">
<view class="col price">
11 months ago
<text class="text">总价</text>
<text class="yuan">&yen;</text>
<text class="number">{{totalPrice}}</text>
11 months ago
</view>
<view class="btn" @click="orderSubmit">提交订单</view>
</view>
<u-popup :show="isPayPopup" mode="bottom" @close="closePay" round="10">
<f-pay :show-title="false" :show="isPayPopup" :order="orderPay"
:payMoney="orderPay.orderAmount" :tradeNo="orderPay.orderNumber"
@payResult="payResult"></f-pay>
</u-popup>
11 months ago
</view>
11 months ago
</template>
<script>
import fPay from "../components/f-pay/f-pay";
import uPopup from "../components/uview-ui/components/u-popup/u-popup.vue";
11 months ago
export default {
components: {
fPay,
uPopup
},
11 months ago
data() {
return {
//是否支付弹窗
isPayPopup: false,
11 months ago
orderInfo: {},
formData: {
name: undefined,
11 months ago
roomNumber: 1, //整套逻辑,暂定房间数为1
11 months ago
phoneNumber: undefined,
11 months ago
idtype: 1,
11 months ago
idCardNumber: undefined,
11 months ago
// phoneNumber: undefined,
// idtype: undefined,
// idCardNumber: undefined,
11 months ago
},
orderPay: undefined,
totalPrice: undefined,
11 months ago
rules: {
name: {
rules: [{
required: true,
errorMessage: '入住人姓名不能为空!',
}]
11 months ago
},
11 months ago
idCardNumber: {
rules: [{
required: true,
errorMessage: '身份证号码不能为空!',
},
{
validateFunction: function(rule, value, data, callback) {
const reg =
/(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)/;
if (reg.test(value) == false) {
callback('请输入正确的身份证号码!')
}
return true
}
}
]
11 months ago
},
11 months ago
phoneNumber: {
rules: [{
required: true,
errorMessage: '联系手机不能为空!',
},
{
validateFunction: function(rule, value, data, callback) {
const reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
if (reg.test(value) == false) {
callback('请输入正确的手机号码!')
}
return true
}
}
]
}
}
}
},
onReady() {
// 需要在onReady中设置规则
this.$refs.form.setRules(this.rules)
},
onLoad(options) {
const ticket = JSON.parse(decodeURIComponent(options.ticket));
11 months ago
this.orderInfo = ticket
this.totalPrice = Math.round(Number(this.orderInfo.housePrice) * Number(this.orderInfo.dayNum) * 100) / 100
this.formData.phoneNumber = this.orderInfo.mobile
11 months ago
},
methods: {
orderSubmit() {
this.$refs.form.validate().then(res => {
11 months ago
const extConfig = uni.getExtConfigSync ? uni.getExtConfigSync() : {};
let appId = extConfig.app_id
11 months ago
11 months ago
var data = {
"hotelId": this.orderInfo.hotelId,
"hotelName": this.orderInfo.hotelName,
"orderAmount": this.totalPrice,
11 months ago
"checkTime": this.orderInfo.startDate,
"checkOutTime": this.orderInfo.endDate,
"bedId": this.orderInfo.id,
"roomsNums": Number(this.formData.roomNumber),
11 months ago
11 months ago
"mobile": this.orderInfo.mobile,
"openid": this.orderInfo.openid,
"appid": appId,
11 months ago
"tenantId": "1",
"checkInPersonInfoDTOList": [this.formData]
};
11 months ago
11 months ago
this.$Request.post(this.$config.createHotelOrder, data, 'json', null, false, null).then((
res) => {
if (res.code == 0) {
this.orderPay = res.data
this.payOrder()
} else if (res.code == 600) {
11 months ago
uni.showToast({
title: res.msg,
11 months ago
icon: 'none',
duration: 2000
})
} else {
uni.showToast({
title: "网络拥挤,请稍后重试",
icon: 'none',
duration: 2000
})
}
11 months ago
});
11 months ago
11 months ago
}).catch(err => {
console.log('表单错误信息:', err);
})
},
payOrder(val) {
console.log("订单==========", val)
this.isPayPopup = true
},
//支付结果
payResult(data) {
if (data.payStatus == 1) {
uni.showToast({
title: '支付成功',
icon: 'none'
});
this.isPayPopup = false
setTimeout(() => {
uni.navigateTo({
url: "/subPageC/orderHomestay/orderList"
});
}, 1000)
} else {
uni.showToast({
title: '支付失败',
icon: 'none'
});
setTimeout(() => {
uni.navigateTo({
url: "/subPageC/orderHomestay/orderList"
});
}, 1000)
}
//uni.showToast({title: data.detail.errMsg,icon:'none'});
},
closePay() {
let that = this
uni.showModal({
title: '提示',
content: '确定取消支付?',
cancelText: '再想想',
showCancel: true,
success: function(res) {
if (res.confirm) {
that.isPayPopup = false
setTimeout(() => {
uni.redirectTo({
url: "/subPageC/orderHomestay/orderList"
});
}, 500)
} else if (res.cancel) {
console.log('用户点击取消');
}
}
})
}
11 months ago
}
}
11 months ago
</script>
<style lang="scss" scoped>
11 months ago
</style>