1
This commit is contained in:
parent
76a50f60b1
commit
dadef36afc
@ -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;
|
||||
|
@ -66,7 +66,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="footer">
|
||||
<view class="btn" @click="toggle('bottom')">开始预约</view>
|
||||
<view class="btn" @click="gotoReservation">开始预约</view>
|
||||
</view>
|
||||
<view>
|
||||
<!-- 普通弹窗 -->
|
||||
|
@ -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 = [];
|
||||
|
||||
// 获取今天是一周中的第几天,0表示周日,1表示周一,以此类推
|
||||
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()];
|
||||
|
||||
// 当天及之前的日期disabled为true,之后的日期disabled为false
|
||||
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) {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user