Commit 3ca8cbb2 by zhangzhen

订单细节完善

parent 0c7bf820
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
<view class="order-page"> <view class="order-page">
<view class="flex-row header"> <view class="flex-row header">
<view class="part-left"> <view class="part-left">
<image :src="roomInfo.images.length?roomInfo.images[0]:'../../static/blank2.jpg'" mode="scaleToFill"></image> <image :src="roomInfo.images.length?roomInfo.images[0]:'../../static/blank2.jpg'" mode="scaleToFill">
</image>
</view> </view>
<view class="part-right"> <view class="part-right">
<view class="flex-between part-1"> <view class="flex-between part-1">
...@@ -55,10 +56,12 @@ ...@@ -55,10 +56,12 @@
<text class="text-title text-lg text-bold">时长选择:</text> <text class="text-title text-lg text-bold">时长选择:</text>
</view> </view>
<view class="flex-1 distance-box"> <view class="flex-1 distance-box">
<view v-for="(item,index) in distanceMode" :key="index" class="flex-col" style="margin: 0 20upx;" <view v-for="(item,index) in distanceMode" :key="index" class="flex-col" style="margin: 0 12upx;"
@tap="onDurationChange(index)"> @tap="onDurationChange(index)">
<view class="cu-tag radius" :class="index===distanceIndex? 'line-pink':'line-gray'"> <view class="cu-tag radius" :class="index===distanceIndex? 'line-pink':'line-gray'">
{{item.duration}}小时</view> <text>{{ index >= distanceMode.length-1 && !editDuration.length ? item.duration: item.duration+'小时'}}</text>
<text v-if="index >= distanceMode.length-1" class="cuIcon-edit text-lg"></text>
</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -154,7 +157,7 @@ ...@@ -154,7 +157,7 @@
<button class="cu-btn bg-pink round lg" @tap="onOrderCreate">确认支付</button> <button class="cu-btn bg-pink round lg" @tap="onOrderCreate">确认支付</button>
</view> </view>
</view> </view>
<uni-popup ref="popup" type="bottom"> <uni-popup ref="popup" type="bottom">
<view class="flex-col"> <view class="flex-col">
<view class="cu-bar bg-white"> <view class="cu-bar bg-white">
...@@ -162,7 +165,8 @@ ...@@ -162,7 +165,8 @@
<view class="action text-pink" @tap="onSelectedDate">确定</view> <view class="action text-pink" @tap="onSelectedDate">确定</view>
</view> </view>
<view class="select-box"> <view class="select-box">
<picker-view class="picker-view" indicator-style="height: 42px;" v-model="checkedDateList" @change="onBindChange"> <picker-view class="picker-view" indicator-style="height: 42px;" v-model="checkedDateList"
@change="onBindChange">
<picker-view-column> <picker-view-column>
<view class="item" v-for="(item,index) in hourList" :key="index"> <view class="item" v-for="(item,index) in hourList" :key="index">
<text>{{item}}</text> <text>{{item}}</text>
...@@ -177,7 +181,26 @@ ...@@ -177,7 +181,26 @@
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
<uni-popup ref="popupDuration" type="bottom">
<view class="flex-col">
<view class="cu-bar bg-white">
<view class="action text-gray" @tap="onHideModal">取消</view>
<view class="action text-pink" @tap="onSelectedDuration">确定</view>
</view>
<view class="select-box">
<picker-view class="picker-view" indicator-style="height: 42px;" v-model="durationIndex"
@change="onBindDuratin">
<picker-view-column>
<view class="item" v-for="(item,index) in hourList" :key="index">
<text>{{index+1}}小时</text>
</view>
</picker-view-column>
</picker-view>
</view>
</view>
</uni-popup>
</view> </view>
</template> </template>
...@@ -188,9 +211,13 @@ ...@@ -188,9 +211,13 @@
listSortDistance, listSortDistance,
roomInfo roomInfo
} from "@/api/store.js"; } from "@/api/store.js";
import {getUseCoupon} from "@/api/coupon" import {
import {orderCreate} from "@/api/order" getUseCoupon
} from "@/api/coupon"
import {
orderCreate
} from "@/api/order"
export default { export default {
data() { data() {
let dateList = []; let dateList = [];
...@@ -206,7 +233,7 @@ ...@@ -206,7 +233,7 @@
id: '', id: '',
hostUrl: config.hostUrl, hostUrl: config.hostUrl,
roomInfo: { roomInfo: {
images:[] images: []
}, },
startTime: moment().format("HH:mm"), startTime: moment().format("HH:mm"),
endTime: '12:00', endTime: '12:00',
...@@ -222,8 +249,10 @@ ...@@ -222,8 +249,10 @@
type: "2" type: "2"
} }
], ],
// 时长选择
distanceIndex: 0, distanceIndex: 0,
distanceMode: [{ distanceMode: [
{
duration: 4 duration: 4
}, },
{ {
...@@ -231,8 +260,12 @@ ...@@ -231,8 +260,12 @@
}, },
{ {
duration: 8, duration: 8,
},
{
duration: '其他',
} }
], ],
// 套餐
modeIndex: 0, modeIndex: 0,
packageMode: [{ packageMode: [{
label: "", label: "",
...@@ -248,12 +281,21 @@ ...@@ -248,12 +281,21 @@
} }
], ],
dateIntervalList: [], dateIntervalList: [],
duration:0, duration: 0,
couponList:[], couponList: [],
checkedIndex:[], checkedIndex: [],
checkedDateList:[0,0], checkedDateList: [0, 0],
hourList:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23"], durationIndex: [0],
minuteList:['0',"30"] hourList: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16",
"17", "18", "19", "20", "21", "22", "23"
],
minuteList: ['0', "30"],
orderTypeEnum: {
1: "预定",
2: "续费",
3: "充值"
},
editDuration: []
}; };
}, },
onLoad(option) { onLoad(option) {
...@@ -264,15 +306,15 @@ ...@@ -264,15 +306,15 @@
this.onLoading() this.onLoading()
}, },
methods: { methods: {
onGetUseCoupon(){ onGetUseCoupon() {
getUseCoupon({ getUseCoupon({
storeId:this.roomInfo.storeId, storeId: this.roomInfo.storeId,
roomId:this.roomInfo.id, roomId: this.roomInfo.id,
preStartDate:"2023-10-24 14:00", preStartDate: "2023-10-25 14:00",
preEndDate:"2023-10-24 18:00" preEndDate: "2023-10-25 18:00"
}).then(res=>{ }).then(res => {
if(res.statusCode == 200){ if (res.statusCode == 200) {
if(res.data&&res.data.length){ if (res.data && res.data.length) {
this.index = 1; this.index = 1;
this.packageMode = res.data; this.packageMode = res.data;
} }
...@@ -327,6 +369,10 @@ ...@@ -327,6 +369,10 @@
this.onSetEndTime() this.onSetEndTime()
}, },
onDurationChange(i) { onDurationChange(i) {
if(i>= this.distanceMode.length-1){
this.onEditDuration();
return
}
if (this.distanceIndex === i) return; if (this.distanceIndex === i) return;
this.distanceIndex = i this.distanceIndex = i
this.onSetEndTime() this.onSetEndTime()
...@@ -341,14 +387,14 @@ ...@@ -341,14 +387,14 @@
// 套餐模式 // 套餐模式
this.duration = this.packageMode[this.modeIndex].duration; this.duration = this.packageMode[this.modeIndex].duration;
this.endTime = this.startTime.split(":").map((item, k) => { this.endTime = this.startTime.split(":").map((item, k) => {
let num ='' let num = ''
if(k == 0){ if (k == 0) {
if((Number(item) + this.duration)>23){ if ((Number(item) + this.duration) > 23) {
num = Number(item) + this.duration-24 num = Number(item) + this.duration - 24
}else{ } else {
num = Number(item) + this.duration num = Number(item) + this.duration
} }
}else{ } else {
num = item num = item
} }
return num return num
...@@ -357,71 +403,96 @@ ...@@ -357,71 +403,96 @@
// 小时模式 // 小时模式
this.duration = this.distanceMode[this.distanceIndex].duration; this.duration = this.distanceMode[this.distanceIndex].duration;
this.endTime = this.startTime.split(":").map((item, k) => { this.endTime = this.startTime.split(":").map((item, k) => {
let num ='' let num = ''
if(k == 0){ if (k == 0) {
if((Number(item) + this.duration)>23){ if ((Number(item) + this.duration) > 23) {
num = Number(item) + this.duration-24 num = Number(item) + this.duration - 24
}else{ } else {
num = Number(item) + this.duration num = Number(item) + this.duration
} }
}else{ } else {
num = item num = item
} }
return num return num
}).join(":") }).join(":")
} }
this.onGetUseCoupon() this.onGetUseCoupon()
}, },
onSelectDate(){ onSelectDate() {
if(!this.checkedIndex.length){ if (!this.checkedIndex.length) {
let arr = this.startTime.split(":") let arr = this.startTime.split(":")
if(arr.length){ if (arr.length) {
if(Number(arr[1])<=10){ if (Number(arr[1]) <= 10) {
this.checkedDateList = [arr[0],0] this.checkedDateList = [arr[0], 0]
}else if(Number(arr[1])>10 && Number(arr[1])<=40){ } else if (Number(arr[1]) > 10 && Number(arr[1]) <= 40) {
this.checkedDateList = [arr[0],1] this.checkedDateList = [arr[0], 1]
}else if(Number(arr[1])>40){ } else if (Number(arr[1]) > 40) {
if(arr[0]>=23){ if (arr[0] >= 23) {
this.checkedDateList = [0,0] this.checkedDateList = [0, 0]
}else{ } else {
this.checkedDateList = [Number(arr[0])+1,0] this.checkedDateList = [Number(arr[0]) + 1, 0]
} }
} }
} }
} }
this.$refs.popup.open() this.$refs.popup.open()
}, },
onBindChange(e){
console.log(e.target.value); onBindChange(e) {
this.checkedIndex = e.target.value this.checkedIndex = e.target.value
}, },
onHideModal(){ onSelectedDate() {
this.$refs.popup.close()
},
onSelectedDate(){
this.checkedDateList = this.checkedIndex; this.checkedDateList = this.checkedIndex;
this.startTime = `${this.checkedDateList[0]}:${this.minuteList[this.checkedDateList[1]]}`; this.startTime = `${this.checkedDateList[0]}:${this.minuteList[this.checkedDateList[1]]}`;
console.log(this.startTime,"开始时间") console.log(this.startTime, "开始时间")
//重新设置结束时间 //重新设置结束时间
this.onSetEndTime() this.onSetEndTime()
this.onHideModal(); this.onHideModal();
}, },
onOrderCreate(){
onEditDuration() {
if(this.editDuration.length){
this.durationIndex = this.editDuration
}
this.$refs.popupDuration.open()
},
onBindDuratin(e) {
this.durationIndex = e.target.value
},
onSelectedDuration() {
this.distanceIndex = 3
this.editDuration = this.durationIndex;
this.distanceMode[this.distanceIndex] = {
duration: this.editDuration[0] + 1,
}
console.log(this.distanceMode,"1asdasdasd")
this.onHideModal()
this.$forceUpdate();
this.onSetEndTime()
},
onHideModal() {
this.$refs.popup.close()
this.$refs.popupDuration.close()
},
onOrderCreate() {
orderCreate({ orderCreate({
storeId:this.roomInfo.storeId, storeId: this.roomInfo.storeId,
roomId:this.roomInfo.id, roomId: this.roomInfo.id,
orderType:0, orderType: 1,
buyType:1, buyType: 1,
payType:1, payType: 1,
preStartDate:"2023-10-24 00:00", preStartDate: "2023-10-25 00:00:00",
preEndDate:"2023-10-24 04:00", preEndDate: "2023-10-25 04:00:00",
totalFee:100, totalFee: 100,
payFee:0 payFee: 0
}).then(res=>{ }).then(res => {
console.log(res,909090) console.log(res, 909090)
}) })
} }
} }
...@@ -744,12 +815,15 @@ ...@@ -744,12 +815,15 @@
} }
} }
} }
.select-box{
.select-box {
height: 320upx; height: 320upx;
background-color: #f1f1f1; background-color: #f1f1f1;
.picker-view{
.picker-view {
height: 100%; height: 100%;
.item{
.item {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
......
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