| | |
| | | </view> |
| | | </view> |
| | | <button v-if="isServing" class="lecture-button" @tap="finishLecture">结束讲解</button> |
| | | <button v-else class="lecture-button" @tap="startLecture">开始讲解</button> |
| | | <button |
| | | v-else |
| | | class="lecture-button" |
| | | :loading="startingLecture" |
| | | :disabled="startingLecture" |
| | | @tap="startLecture" |
| | | >开始讲解</button> |
| | | </template> |
| | | <template v-else> |
| | | <view class="empty-order">暂无订单请耐心等待</view> |
| | |
| | | updateGuideOnlineStatus |
| | | } from '../../services/guide' |
| | | import { openMeetingPointPage } from '../../services/map' |
| | | import { getGuideOrders } from '../../services/order' |
| | | import { getGuideOrders, startGuideLecture } from '../../services/order' |
| | | import { playNotificationAlert } from '../../services/message' |
| | | import { getWorkbenchData } from '../../services/workbench' |
| | | import { formatDuration, maskPhone } from '../../utils/format' |
| | |
| | | countdownTimer: null, |
| | | refreshTimer: null, |
| | | refreshing: false, |
| | | startingLecture: false, |
| | | dialog: { |
| | | visible: false, |
| | | title: '提示', |
| | |
| | | }) |
| | | }, |
| | | startLecture() { |
| | | updateGuideOnlineStatus('serving', this.guide.receivingConfig || {}).then(() => { |
| | | this.loadData() |
| | | const orderId = this.activeReceivingOrder.id |
| | | if (this.startingLecture) { |
| | | return |
| | | } |
| | | if (!orderId) { |
| | | uni.showToast({ title: '当前没有可开始的订单', icon: 'none' }) |
| | | return |
| | | } |
| | | this.startingLecture = true |
| | | startGuideLecture(orderId).then((startedOrder) => { |
| | | this.updateGuide({ ...this.guide, onlineStatus: 'serving' }) |
| | | this.updateOrders(this.orders.map((order) => ( |
| | | order.id === startedOrder.id ? { ...order, ...startedOrder } : order |
| | | ))) |
| | | this.setupCountdown() |
| | | uni.showToast({ title: '已开始讲解', icon: 'none' }) |
| | | return this.loadData({ silent: true }) |
| | | }).catch((error) => { |
| | | uni.showToast({ title: error.message || '开始讲解失败', icon: 'none' }) |
| | | }).finally(() => { |
| | | this.startingLecture = false |
| | | }) |
| | | }, |
| | | finishLecture() { |