Commit 37ea3e5c authored by youjie's avatar youjie

no message

parent af08ccc9
......@@ -2,6 +2,10 @@ import { HttpResponse } from '../@types'
import request from './request'
class HotelService {
// 提交訂單
static async SetCustomerOrder(param:any):Promise<HttpResponse>{
return request('dict_post_SetCustomerOrder',param)
}
/**
* 查詢城市信息
......
......@@ -7,7 +7,7 @@
<q-icon class="cursor-pointer" name="close" size="18px" color="grey-5" @click="$emit('close')"></q-icon>
</div>
<q-separator color="grey-3" class="q-my-sm" />
<div style="height: 800px;">
<div style="height: 700px;">
<q-scroll-area v-if="HotelCarList.length>0" :thumb-style="scrollStyle.thumbStyle" :bar-style="scrollStyle.barStyle" class="full-height">
<q-list>
<q-item class="rounded-borders">
......@@ -47,12 +47,6 @@
</div>
</div>
<div class="row">
<div class="row items-center q-pr-md" style="flex-shrink: 0;">
<div>
<span class="fz16 text-red">{{room.Number}}</span>
<span class="fz12 q-pl-xs">{{$t('hotel.car.between')}}</span>
</div>
</div>
<div class="row items-center justify-between">
<div>
<q-btn rounded dense color="white" text-color="black" size="xs" icon="remove" @click='addGoods(item,index,x,i,room,s,0)'/>
......@@ -78,11 +72,30 @@
</div>
</div>
</div>
</div>
<!-- <q-separator color="grey-3" class="q-my-sm" dark vertical/> -->
</div>
<div class="row justify-end">
<div v-if="item.TaxesPrice>0">
<span class="text-red q-pr-sm f12">
{{$t('hotel.car.tax')}}
</span>
<span>
{{item.TaxesPrice}}
</span>
</div>
<div v-if="item.PriceInTangTax>0" class="q-pl-sm">
<span class="text-red q-pr-sm f12">
{{$t('hotel.car.soup')}}
</span>
<span>
{{item.PriceInTangTax}}
</span>
</div>
</div>
</div>
</q-card>
</q-item-section>
......@@ -93,6 +106,41 @@
{{$t('noneData')}}
</div>
</div>
<div class="column q-px-md">
<div class="row wrap justify-between col q-pb-lg">
<div class="col-6 q-pb-sm">
<n-select filterable @update:value="changeOrderType" style="max-width: 200px;"
v-model:value="parameters.OrderType" :placeholder="$t('hotel.car.OrderType')" :options="cacheHotels"
max-tag-count="responsive" size="large" value-field="ID" label-field="Name" />
</div>
<div v-if="parameters.OrderType==2" class="col-6">
<q-input v-model="parameters.TCNum" style="max-width: 200px;" mask="#.##" reverse-fill-mask dense
type="text" standout :label="$t('hotel.car.TCNum')" />
</div>
<template v-if="parameters.OrderType==1">
<q-input v-model="parameters.TCNum" style="max-width: 200px;" class="col-6 q-mr-md" mask="#.##" reverse-fill-mask dense
type="text" standout :label="$t('hotel.car.ContactName')" />
<q-input v-model="parameters.TCNum" style="max-width: 200px;" class="col-6 q-mr-md" mask="#.##" reverse-fill-mask dense
type="text" standout :label="$t('hotel.car.ContactNumber')" />
</template>
</div>
<div class="row justify-between">
<div>
<span class="fz14">¥</span>
{{parameters.Money}}
</div>
<q-btn color="red" style="width: 150px" :loading="loading" @click="submit">
<div class="ellipsis">
{{$t('hotel.car.submit')}}
</div>
</q-btn>
</div>
</div>
</q-card>
</template>
......@@ -111,27 +159,101 @@
},
setup(props) {
inject(DirtionmaryHelper.HOTEL_CAR_LIST)
// inject(DirtionmaryHelper.HOTEL_CAR_LIST)
const HotelCarList = inject(DirtionmaryHelper.HOTEL_CAR_LIST) as any
const {locale,t } = useI18n();
const data=reactive({
scrollStyle: {} as any,
addNum: 1,
DataList: [] as Array<any>,
parameters: {
Money: 0,
DetailList: [],
Remark: '',
OrderType: 1,//订单类型 1散客 2团队
TCNum: '',//=团队时 传递 组团号
ContactName: '',//=散客时 传递 联系人
ContactNumber: '',//=散客时 传递 联系人电话
OrderId: 0,
},
currentIndex: 0,
currentI: 0,
currentS: 0,
RemainingInventory: 0,
HotelLength: 0
HotelLength: 0,
loading: false,
cacheHotels: [
{Name:'散客',ID:1},
{Name:'团队',ID:2},
],
})
data.scrollStyle = useScrollModule().scrollStyle
// 今天购买数量
watch(data.DataList, (n, o) => {
watch(HotelCarList._value, (n, o) => {
methods.calculateNum()
methods.getMoney()
})
const methods = {
changeOrderType() {
setTimeout(() => {
console.log(data.parameters.OrderType)
}, 1000)
},
getMoney(){
data.parameters.Money = 0
HotelCarList._value.forEach(item=>{
item.timeList.forEach(t=>{
t.rooms.forEach(room=>{
let m = (room.PeopleNumber*room.Unit_Price)+(room.Number*room.TaxesPrice)+(room.Number*room.PriceInTangTax)
data.parameters.Money+=m
})
})
})
},
submit() {
data.parameters.DetailList = [] as Array<any>
HotelCarList._value.forEach(item=>{
item.timeList.forEach(t=>{
let datas = {
HotelId: item.HotelId,
Date: t.Date,
Destription:'',
RoomList:[],
}
t.rooms.forEach(room=>{
let msg = {
RoomType: room.RoomType,
Unit_Price: room.Unit_Price,
Number: room.Number,
PeopleNumber: room.PeopleNumber,
Destription: room.Destription?room.Destription:''
}
datas.RoomList.push(msg)
})
data.parameters.DetailList.push(datas)
})
})
console.log(data.parameters,'-----')
return
data.loading = true
HotelService.SetCustomerOrder(param)
.then(r => {
if (r.data.resultCode == ApiResult.SUCCESS) {
} else {
message.errorMsg(r.data.message)
}
data.loading = false
})
.catch(e => {
message.errorMsg(e.message)
data.loading = false
})
},
getLength(){
console.log(HotelCarList._value,'---')
data.HotelLength = 0
if(HotelCarList._value.length>0){
HotelCarList._value.forEach(item=>{
......@@ -142,47 +264,53 @@
})
})
}
},
// 计算房间数量
calculateNum(){
if(data.DataList[data.currentIndex].timeList[data.currentI].total){
data.DataList[data.currentIndex].timeList[data.currentI].total = 0
let DataList = data.DataList[data.currentIndex].timeList[data.currentI].rooms.length>0&&data.DataList[data.currentIndex].timeList[data.currentI].rooms
DataList&&DataList.forEach((item,index)=> {
if(DataList[data.currentIndex].timeList[data.currentI].total<DataList[data.currentIndex].timeList[data.currentI].RemainingInventory){
DataList[data.currentIndex].timeList[data.currentI].total+=item.Number
}
let list = HotelCarList._value
if(list&&list[data.currentIndex]){
// HotelCarList._value[data.currentIndex].timeList[data.currentI].total = 0
HotelCarList._value&&HotelCarList._value.forEach((item,index)=> {
item.timeList.forEach(t=>{
t.total = 0
t.rooms.forEach(room=>{
t.total+=room.Number
})
})
})
}
},
// 人数
addPeople(item: Object,index: any,x: Object,i: any,room: Object,s: any,type: any){
data.currentIndex = index
data.currentI = i
data.currentS = s
if(type==1&&x.Number<item.RemainingInventory){
s.PeopleNumber++
}else if(type==0&&x.Number>1){
s.PeopleNumber--
if(type==1&&room.Number<x.RemainingInventory){
room.PeopleNumber++
}else if(type==0&&room.PeopleNumber>1){
room.PeopleNumber--
}
// methods.getMoney()
},
// 房间数
addGoods(item: Object,index: any,x: Object,i: any,room: Object,s: any,type: any){
data.currentIndex = index
data.currentI = i
data.currentS = s
console.log(x.RemainingInventory)
if(type==1&&room.Number<x.RemainingInventory){
if(x.total<x.RemainingInventory){
room.Number++
}
}else if(type==0&&room.Number>0){
if(room.Number==1){
if(DataList[index].timeList[i].rooms.length==1){
DataList[index].timeList.splice(i, 1)
if(HotelCarList._value[index].timeList[i].rooms.length==1&&HotelCarList._value[index].timeList.length>1){
HotelCarList._value[index].timeList.splice(i, 1)
}else if(HotelCarList._value[index].timeList.length==1&&
HotelCarList._value[index].timeList[i].rooms.length==1){
HotelCarList._value.splice(index, 1)
return
}else{
DataList[index].timeList[i].splice(s, 1)
HotelCarList._value[index].timeList[i].rooms.splice(s, 1)
}
methods.getLength()
}
......@@ -193,6 +321,7 @@
}
onMounted(()=>{
methods.getLength()
methods.getMoney()
})
return {...toRefs(data),HotelCarList,...methods}
}
......
......@@ -78,6 +78,7 @@
import { UserActionsType } from '../../../store/modules/user/actions';
import { DirtionmaryHelper } from '../../../config/dictionary'
import message from '../../../utils/message'
import HotelService from '../../../api/hotel'
export default defineComponent({
props: {
HotelRow:{
......@@ -91,7 +92,6 @@
},
setup(props, context) {
const {locale,t } = useI18n();
inject(DirtionmaryHelper.HOTEL_CAR_LIST)
const HotelCarList = inject(DirtionmaryHelper.HOTEL_CAR_LIST)
const data=reactive({
HotelRow: props.HotelRow,
......@@ -118,7 +118,7 @@
addPeople(item: String,type:any){
if(type==1&&item.Number<data.hotelInfor.RemainingInventory){
item.PeopleNumber++
}else if(type==0&&item.Number>1){
}else if(type==0&&item.PeopleNumber>1){
item.PeopleNumber--
}
},
......@@ -158,6 +158,8 @@
rooms: [] as Array<any>
}
data.parameters.DetailList.forEach((x,index)=>{
msgData.TaxesPrice = x.TaxesPrice
msgData.PriceInTangTax = x.PriceInTangTax
if(x.Number>0){
let ArrData = {
HotelId: x.HotelId,
......@@ -176,39 +178,25 @@
msgData.timeList.push(msg)
if(data.total>0){
let list = HotelCarList._value
let fault = true
if(list.length>0){
let fault = true
list.forEach((item,index)=>{
if(item.HotelId==parameters.HotelId){
item.timeList.forEach((x,i)=>{
if(fault&&x.Date==parameters.Date){
HotelCarList._value[index].timeList.splice(i,1)
HotelCarList._value[index].timeList.push(msg)
console.log('000--')
fault = false
}else if(fault&&x.Date!=parameters.Date){
HotelCarList._value[index].timeList.push(msg)
console.log('11111--')
fault = false
}else{
// console.log(fault,x.Date,parameters.Date)
}
})
}else if(fault&&item.HotelId!=parameters.HotelId){
item.timeList.forEach((x,i)=>{
if(fault&&x.Date==parameters.Date){
HotelCarList._value[index].timeList.splice(i,1)
HotelCarList._value[index].timeList.push(msg)
fault = false
}else if(fault&&x.Date!=parameters.Date){
HotelCarList._value[index].timeList.push(msg)
fault = false
console.log('3333')
}
})
}
})
fault = true
if(fault) HotelCarList._value.push(msgData)
}else{
HotelCarList._value.push(msgData)
}
......
import { OrderType } from './../../@types/index';
// This is just an example,
// so you can safely delete all default props below
......@@ -122,7 +123,14 @@ export default {
addShopping: '加入購物車',
orderTitle: '訂單',
people: '人',
between: '间'
between: '间',
submit: '提交',
tax: '税',
soup: '入汤',
OrderType: '訂單類型',
TCNum: '组团号',
ContactName: '联系人名稱',
ContactNumber: '联系人电话'
},
shopping:{
labelNum: '房數',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment