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

View File

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

View File

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

View File

@ -3,15 +3,28 @@
<VNavigationBar titleColor="rgba(0,0,0,0.9)" backgroundColor="transparent" title="我的预约"> <VNavigationBar titleColor="rgba(0,0,0,0.9)" backgroundColor="transparent" title="我的预约">
</VNavigationBar> </VNavigationBar>
<view class="body"> <view class="body">
<scroll-view style="height: 100%;" scroll-y="true">
<view class="orderList"> <view class="orderList">
<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 v-for="(item, index) in orderList" :key="index" :orderInfo="item">
</reservationOrderVue> </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>
<view class="no-data" v-if="orderList.length==0"> <view class="no-data" v-if="orderList.length==0">
<image class="" src="@/static/images/nothing.png" ></image> <image class="" src="@/static/images/nothing.png" ></image>
</view> </view>
</scroll-view>
</view> </view>
</view> </view>
</template> </template>
@ -31,6 +44,11 @@
}, },
data() { data() {
return { return {
pageNo: 1,
pageSize: 10,
total: 0,
//
isTriggered:false,
// orderList: [{ // orderList: [{
// title: '', // title: '',
// status: '1', // status: '1',
@ -60,13 +78,37 @@
this.getBookingPage() this.getBookingPage()
}, },
methods: { 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(){ async getBookingPage(){
const res = await request({ const res = await request({
url: "/userClient/repair/booking/page", url: "/userClient/repair/booking/page",
method: "get", method: "get",
params:{ params:{
pageNo: 1, pageNo: this.pageNo,
pageSize: 10 pageSize: this.pageSize
} }
}) })
const data = res.data.records const data = res.data.records
@ -76,16 +118,25 @@
method: "get", method: "get",
}) })
const list = response.data const list = response.data
this.orderList = list.map(item => { let thisDataList = list.map(item => {
return { return {
...item, ...item,
title: item.company.corpName, title: item.company.corpName,
address: item.company.address, address: item.company.address,
phone: item.company.mobilePhone, phone: item.company.mobilePhone,
busiTypeStr: item.servicePackage.name, busiTypeStr: item.servicePackage?.name,
status: item.bookingStatus 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 { .orderList {
width: 686rpx; height: 100%;
margin: 0 auto;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
row-gap: 20rpx; row-gap: 20rpx;
margin: 0 40rpx;
} }
.no-data{ .no-data{
text-align: center; text-align: center;