This commit is contained in:
Vinjor 2024-10-26 16:57:01 +08:00
parent 76a50f60b1
commit dadef36afc
4 changed files with 158 additions and 95 deletions

View File

@ -3,9 +3,9 @@
<view class="header">
<text class="orderTitle">{{ orderInfo.title }}</text>
<!-- <text class="orderStatus" :class="['status_' + orderInfo.status]">-->
<text class="orderStatus" :class="['status_' + '01']">
{{ getOrderStatusTxt() }}
</text>
<!-- <text class="orderStatus" :class="['status_' + '01']">-->
<!-- {{ getOrderStatusTxt() }}-->
<!-- </text>-->
</view>
<view class="detail">
<view class="line">
@ -22,15 +22,15 @@
</view>
</view>
<view v-if="!hideFooter" class="footer">
<view class="btn" :class="{phone: isDetail}">
<image v-if="isDetail" class="btnIcon" src="../../static/icons/order-icon7.png" mode="aspectFit"></image>
<text>拨打电话</text>
</view>
<view class="btn" :class="{address: isDetail}">
<image v-if="isDetail" class="btnIcon" src="../../static/icons/order-icon6.png" mode="aspectFit"></image>
<text>地址导航</text>
</view>
<view v-if="!isDetail" class="btn primary" @click="showOrderDetail">查看订单</view>
<!-- <view class="btn" :class="{phone: isDetail}">-->
<!-- <image v-if="isDetail" class="btnIcon" src="../../static/icons/order-icon7.png" mode="aspectFit"></image>-->
<!-- <text>拨打电话</text>-->
<!-- </view>-->
<!-- <view class="btn" :class="{address: isDetail}">-->
<!-- <image v-if="isDetail" class="btnIcon" src="../../static/icons/order-icon6.png" mode="aspectFit"></image>-->
<!-- <text>地址导航</text>-->
<!-- </view>-->
<view v-if="!isDetail && orderInfo.ticketsId" class="btn primary" @click="showOrderDetail">查看订单</view>
</view>
</view>
</template>
@ -76,7 +76,7 @@
},
showOrderDetail() {
uni.navigateTo({
url: '/pages-order/orderDetail/orderDetail?info=' + encodeURIComponent(JSON.stringify(this.orderInfo))
url: '/pages-order/orderDetail/orderDetail?ticketsId=' + this.orderInfo.ticketsId
})
}
}
@ -89,6 +89,7 @@
border-radius: 12rpx 12rpx 12rpx 12rpx;
box-shadow: 2rpx 4rpx 8rpx #efefef;
padding: 0 30rpx;
margin-bottom: 30rpx;
.header {
display: flex;

View File

@ -66,7 +66,7 @@
</view>
</view>
<view class="footer">
<view class="btn" @click="toggle('bottom')">开始预约</view>
<view class="btn" @click="gotoReservation">开始预约</view>
</view>
<view>
<!-- 普通弹窗 -->

View File

@ -51,6 +51,14 @@
<input class="formItemInput" placeholder="请输入联系电话" type="text" v-model="formData.userMobile"/>
</view>
</view>
<view class="formItem">
<view class="formItem_content">
<view class="label">服务顾问</view>
<picker style="text-align: right; flex: 1;" @change="servicerPickerChange" :value="servicerIndex" :range="allServicerNameList">
<view class="uni-input">{{allServicerNameList[servicerIndex]}}</view>
</picker>
</view>
</view>
<view class="formItem">
<!-- <picker mode="selector" :range="['汽车维修']" @change="">
<view class="formItem_content">
@ -73,20 +81,20 @@
<view class="cardTitle">预约时间</view>
<view class="datePicker">
<view v-for="(date, index) in dateList" :key="date.date" class="dateItem"
:class="{active: chooseDate === date.date, disabled: date.disabled}"
:class="{active: chooseDate == date.date, disabled: date.disabled}"
@click="chooseDateFun(date)">
<text>{{date.date}}</text>
<text>{{date.title}}</text>
<image v-if="chooseDate === date.date" class="activeIcon"
<image v-if="chooseDate == date.date" class="activeIcon"
src="../../static/icons/order-icon11.png" mode="aspectFit"></image>
</view>
</view>
<view class="timerPicker">
<view v-for="(time, index) in timeList" :key="index" class="timeItem"
:class="{active: chooseTime === time.time, disabled: time.disabled}"
:class="{active: chooseTime == time.time, disabled: time.disabled}"
@click="chooseTimeFun(time)">
<text>{{time.time}}</text>
<image v-if="chooseTime === time.time" class="activeIcon"
<text>{{time.date}}</text>
<image v-if="chooseTime == time.date" class="activeIcon"
src="../../static/icons/order-icon11.png" mode="aspectFit"></image>
</view>
</view>
@ -137,33 +145,9 @@
// disabled: false
// }, ],
dateList:[],
chooseDate: '06-06',
chooseTime: '09:00',
timeList: [{
time: '09:00',
disabled: false
},
{
time: '11:00',
disabled: false
},
{
time: '14:00',
disabled: false
},
{
time: '15:00',
disabled: false
},
{
time: '16:00',
disabled: false
},
{
time: '17:00',
disabled: false
},
],
chooseDate: '',
chooseTime: '',
timeList: [],
carList: [],
car:{},
cusInfo: {},
@ -178,15 +162,31 @@
},
serviceList: [],
service:{},
info: {}
info: {},
//
servicerList:[{
id:"",
nickname:"请选择",
}],
//-
allServicerNameList:["请选择"],
//
servicerIndex:0,
};
},
onLoad(data){
this.info = getJSONData("shopInfo")
this.formData.corpId = this.info.id
//
this.$nextTick(()=>{
let userInfo = JSON.parse(getUserInfo())
console.log(userInfo,"userInfo")
this.formData.userName = userInfo.nickname
this.formData.userMobile = userInfo.mobile
this.formData.corpId = this.info.id
})
this.info = getJSONData("shopInfo")
this.getServer(this.info.id)
this.initCarList()
this.initDateList()
this.initServicerList()
},
onShow() {
if(!getToken()){
@ -194,55 +194,68 @@
url: '/pages/login/login'
})
}
this.initDateList()
},
methods: {
initDateList(){
const daysOfWeek = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
const currentDate = new Date();
const weekDates = [];
// 01
const todayDayOfWeek = currentDate.getDay();
//
currentDate.setDate(currentDate.getDate() - todayDayOfWeek);
for (let i = 0; i < 7; i++) {
// 'MM-DD'
let dateStr = `${currentDate.getMonth() + 1}-${currentDate.getDate()}`;
//
let title = daysOfWeek[currentDate.getDay()];
// disabledtruedisabledfalse
let disabled = currentDate < new Date(); //
//
weekDates.push({ date: dateStr, title, disabled });
//
currentDate.setDate(currentDate.getDate() + 1);
servicerPickerChange: function(e) {
console.log('picker发送选择改变携带值为', e.detail.value)
this.servicerIndex = e.detail.value
},
/**
* 查询所有服务顾问
* @returns {Promise<void>}
*/
async initServicerList(){
const res = await request({
url: "/app-api/repair/booking/getAllServicer",
method: "get",
params:{tenantId:this.info.tenantId},
tenantIdFlag:false
})
if(res.code==200 && res.data.length>0){
this.servicerList = this.servicerList.concat(res.data)
this.allServicerNameList = this.allServicerNameList.concat(res.data.map((item)=>{return item.nickname}))
}
},
async initDateList(){
this.dateList = []
const res = await request({
url: "/app-api/repair/booking/getBookingTime",
method: "get",
params:{tenantId:this.info.tenantId},
tenantIdFlag:false
})
if(res.code==200 && res.data.length>0){
this.dateList = res.data
this.chooseDateFun(this.dateList[0])
}
//
this.chooseDate = weekDates.find(day => day.disabled === false).date;
this.dateList = weekDates;
},
chooseTimeFun(time) {
if (time.disabled) {
return
}
this.chooseTime = time.time
this.chooseTime = time.date
},
chooseDateFun(date) {
if (date.disabled) {
return
}
this.chooseDate = date.date
this.timeList = date.timeList
},
submit() {
if(this.servicerIndex!=0){
//
this.formData.adviserId = this.servicerList[this.servicerIndex].id
this.formData.adviserName = this.servicerList[this.servicerIndex].nickname
}
if(""==this.chooseTime){
uni.showToast({
title: '请选择预约时间!',
icon: 'none'
})
return
}
this.formData.bookingTime = new Date((new Date().getFullYear() + "-" + this.chooseDate + " " + this.chooseTime + ":00")).getTime()
request({
url: "/userClient/repair/booking/update",
@ -291,8 +304,6 @@
method: "get"
})
this.cusInfo = res.data
this.formData.userName = this.cusInfo.userName
this.formData.userMobile = this.cusInfo.userMobile
},
//
async getServer(corpId) {

View File

@ -3,15 +3,28 @@
<VNavigationBar titleColor="rgba(0,0,0,0.9)" backgroundColor="transparent" title="我的预约">
</VNavigationBar>
<view class="body">
<scroll-view style="height: 100%;" scroll-y="true">
<view class="orderList">
<reservationOrderVue v-for="(item, index) in orderList" :key="index" :orderInfo="item">
</reservationOrderVue>
<scroll-view style="height: 100%;" scroll-y="true" class="itemContent" @scrolltolower="onReachBottomCus"
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">
<reservationOrderVue v-for="(item, index) in orderList" :key="index" :orderInfo="item">
</reservationOrderVue>
<reservationOrderVue v-for="(item, index) in orderList" :key="index" :orderInfo="item">
</reservationOrderVue>
<reservationOrderVue v-for="(item, index) in orderList" :key="index" :orderInfo="item">
</reservationOrderVue>
<reservationOrderVue v-for="(item, index) in orderList" :key="index" :orderInfo="item">
</reservationOrderVue>
<reservationOrderVue v-for="(item, index) in orderList" :key="index" :orderInfo="item">
</reservationOrderVue>
<reservationOrderVue v-for="(item, index) in orderList" :key="index" :orderInfo="item">
</reservationOrderVue>
<reservationOrderVue v-for="(item, index) in orderList" :key="index" :orderInfo="item">
</reservationOrderVue>
</scroll-view>
</view>
<view class="no-data" v-if="orderList.length==0">
<image class="" src="@/static/images/nothing.png" ></image>
</view>
</scroll-view>
</view>
</view>
</template>
@ -31,6 +44,11 @@
},
data() {
return {
pageNo: 1,
pageSize: 10,
total: 0,
//
isTriggered:false,
// orderList: [{
// title: '',
// status: '1',
@ -60,13 +78,37 @@
this.getBookingPage()
},
methods: {
/**
* 上滑加载数据
*/
onReachBottomCus() {
// *
if (this.pageNo * this.pageSize >= this.total) {
uni.$u.toast('没有更多数据了')
return
}
//+1,
this.pageNo++
//
this.getBookingPage()
},
/**
* 下拉刷新数据
*/
onRefresherrefresh(){
this.isTriggered = true
this.pageNo = 1
this.total = 0
this.orderList = []
this.getBookingPage()
},
async getBookingPage(){
const res = await request({
url: "/userClient/repair/booking/page",
method: "get",
params:{
pageNo: 1,
pageSize: 10
pageNo: this.pageNo,
pageSize: this.pageSize
}
})
const data = res.data.records
@ -76,16 +118,25 @@
method: "get",
})
const list = response.data
this.orderList = list.map(item => {
let thisDataList = list.map(item => {
return {
...item,
title: item.company.corpName,
address: item.company.address,
phone: item.company.mobilePhone,
busiTypeStr: item.servicePackage.name,
busiTypeStr: item.servicePackage?.name,
status: item.bookingStatus
}
})
if (this.pageNo != 1) {
this.orderList = this.orderList.concat(thisDataList)
} else {
this.orderList = thisDataList
}
//
this.total = res.data.total
this.isTriggered = false
}
}
}
@ -110,11 +161,11 @@
}
.orderList {
width: 686rpx;
margin: 0 auto;
height: 100%;
display: flex;
flex-direction: column;
row-gap: 20rpx;
margin: 0 40rpx;
}
.no-data{
text-align: center;