| | |
| | | <image class="hall-page__avatar" :src="centerUserInfo.fullImgUrl || '/static/image/ic_pic@2x.png'" mode="aspectFill"></image> |
| | | <text class="hall-page__name">{{ centerUserInfo.name }}</text> |
| | | </view> |
| | | <view class="hall-page__status" v-if="userInfo.auditStatus === 3" @click="openStatusPicker"> |
| | | <view class="hall-page__status" v-if="hasApprovedOfficial" @click="openStatusPicker"> |
| | | <view class="hall-page__status-dot" :class="{ 'hall-page__status-dot--offline': acceptingStatus === 0 }"></view> |
| | | <text class="hall-page__status-text">{{ acceptingStatus === 1 ? '接单中' : '已下线' }}</text> |
| | | <text class="hall-page__status-arrow">▼</text> |
| | | </view> |
| | | <view class="hall-page__user" style="opacity: 0;"> |
| | | <view class="hall-page__user" style="opacity: 0;"> |
| | | <image class="hall-page__avatar" :src="centerUserInfo.fullImgUrl || '/static/image/ic_pic@2x.png'" mode="aspectFill"></image> |
| | | <text class="hall-page__name">{{ centerUserInfo.name }}</text> |
| | | </view> |
| | |
| | | |
| | | <view class="hall-page__stats"> |
| | | <view v-for="item in stats" :key="item.label" class="hall-page__stat-item"> |
| | | <text class="hall-page__stat-value">{{ userInfo.auditStatus === 3 ? item.value : '-' }}</text> |
| | | <text class="hall-page__stat-value">{{ hasApprovedOfficial ? item.value : '-' }}</text> |
| | | <text class="hall-page__stat-label">{{ item.label }}</text> |
| | | </view> |
| | | </view> |
| | |
| | | <view class="hall-page__tabs"> |
| | | <view v-for="tab in displayTabs" :key="tab.value" class="hall-page__tab" :class="{ 'hall-page__tab--active': activeTab === tab.value }" @click="activeTab = tab.value"> |
| | | <text class="hall-page__tab-text">{{ tab.label }}</text> |
| | | <text v-if="tab.count" class="hall-page__tab-count">{{ userInfo.auditStatus === 3 ? tab.count : '' }}</text> |
| | | <text v-if="tab.count" class="hall-page__tab-count">{{ hasApprovedOfficial ? tab.count : '' }}</text> |
| | | <view v-if="activeTab === tab.value" class="hall-page__tab-line"></view> |
| | | </view> |
| | | <view class="hall-page__filter" @click="toggleFilterPopup(true)"> |
| | |
| | | </view> |
| | | </view> |
| | | |
| | | <scroll-view class="hall-page__body" scroll-y :style="bodyStyle"> |
| | | <view class="hall-page__verified" v-if="userInfo.auditStatus !== 3"> |
| | | <scroll-view class="hall-page__body" scroll-y :style="bodyStyle" @scrolltolower="handleScrollToLower"> |
| | | <view class="hall-page__verified" v-if="!hasApprovedOfficial"> |
| | | <image src="/static/image/default_unverified@2x.png" mode="widthFix"></image> |
| | | <button @click="toDriverCertification">去认证</button> |
| | | </view> |
| | | <view v-else-if="userInfo.auditStatus === 3 && acceptingStatus === 1 && currentOrderList.length" class="hall-page__list"> |
| | | <view v-else-if="hasApprovedOfficial && acceptingStatus === 1 && currentOrderList.length" class="hall-page__list"> |
| | | <view v-for="(item, index) in currentOrderList" :key="item.id" class="order-card" @click="goToOrderDetail(item, index)"> |
| | | <view class="order-card__head"> |
| | | <view class="order-card__time" v-if="item.remainMinutes > 0"> |
| | |
| | | <view class="order-card__route-main"> |
| | | <view class="order-card__route-item"> |
| | | <view class="order-card__route-texts"> |
| | | <text class="order-card__route-title">{{ item.depositShopName }}大苏打打算</text> |
| | | <text class="order-card__route-title"><text class="order-card__route-badge-text order-card__route-badge-text--take">取</text>{{ item.depositShopName }}</text> |
| | | <text class="order-card__route-desc">{{ item.depositShopAddress }}</text> |
| | | </view> |
| | | <image src="/static/image/ic_daohang@2x.png" mode="widthFix" class="order-card__nav" @click.stop="navigateToAddress(item, 'deposit')"></image> |
| | |
| | | <view class="order-card__route-item order-card__route-item--destination"> |
| | | <view class="order-card__route-texts"> |
| | | <template v-if="item.takeShopId"> |
| | | <text class="order-card__route-title">{{ item.takeName }}</text> |
| | | <text class="order-card__route-title"><text class="order-card__route-badge-text order-card__route-badge-text--send">送</text>{{ item.takeName }}</text> |
| | | <text class="order-card__route-desc">{{ item.takeAddress }}</text> |
| | | </template> |
| | | <text v-else class="order-card__route-title">{{ item.takeAddress }}</text> |
| | | <text v-else class="order-card__route-title"><text class="order-card__route-badge-text order-card__route-badge-text--send">送</text>{{ item.takeAddress }}</text> |
| | | </view> |
| | | <image src="/static/image/ic_daohang@2x.png" mode="widthFix" class="order-card__nav" @click.stop="navigateToAddress(item, 'take')"></image> |
| | | </view> |
| | |
| | | <text class="order-card__action-text">联系</text> |
| | | </view> |
| | | </view> |
| | | <button class="order-card__button order-card__button--code" hover-class="order-card__button--hover" @click.stop="handleShowPickupCode(item)">存件码</button> |
| | | <button class="order-card__button order-card__button--code" hover-class="order-card__button--hover" @click.stop="handleShowPickupCode(item)" v-if="item.takeShopId">存件码</button> |
| | | </template> |
| | | <button v-else class="order-card__button" hover-class="order-card__button--hover" @click.stop="handleGrabOrder(item)">立即抢单</button> |
| | | </view> |
| | |
| | | |
| | | <script> |
| | | import { mapState } from 'vuex' |
| | | import { checkLocationPermission } from '@/utils/utils' |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | |
| | | showFilterPopup: false, |
| | | acceptingStatus: 0, |
| | | showStatusPicker: false, |
| | | hasApprovedOfficial: false, |
| | | statusOptions: [ |
| | | { text: '上线', value: 1 }, |
| | | { text: '下线', value: 0 } |
| | |
| | | this.scrollHeight = Math.max(windowHeight - this.headerHeight, 0) |
| | | if (this.userInfo.auditStatus === 99) return; |
| | | this.acceptingStatus = this.userInfo.acceptingStatus || 0 |
| | | this.loadOrdersByTab(this.activeTab) |
| | | this.init() |
| | | uni.$on('locationPermissionGranted', () => { |
| | | this.init() |
| | | }) |
| | | uni.$on('jiedanSuccess', () => { |
| | | this.loadOrdersByTab(this.activeTab) |
| | | }) |
| | | }, |
| | | |
| | | onShow() { |
| | | this.getCenterInfo() |
| | | this.getCategoryListData() |
| | | this.getActiveOrderCount() |
| | | }, |
| | | |
| | | onReachBottom() { |
| | | if (this.acceptingStatus === 0) return; |
| | | if (this.activeTab === 'hall') { |
| | | this.hallPage++ |
| | | this.getHallOrders() |
| | | } |
| | | this.getUserInfoDetail() |
| | | }, |
| | | |
| | | computed: { |
| | |
| | | }, |
| | | |
| | | methods: { |
| | | init() { |
| | | console.log('index-init') |
| | | this.$u.api.centerInfo().then(res => { |
| | | if (res.code === 200) { |
| | | this.acceptingStatus = res.data.acceptingStatus |
| | | if (res.data.acceptingStatus === 1) { |
| | | this.loadOrdersByTab(this.activeTab) |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | handleScrollToLower() { |
| | | if (this.acceptingStatus === 0) return; |
| | | this.hallPage++ |
| | | if (this.activeTab === 'hall') { |
| | | console.log('hall') |
| | | this.getHallOrders() |
| | | } else if (this.activeTab === 'pickup') { |
| | | this.getPickupOrders() |
| | | } else if (this.activeTab === 'delivering') { |
| | | this.getDeliveringOrders() |
| | | } |
| | | }, |
| | | getUserInfoDetail() { |
| | | this.$u.api.verifyDetail().then(res => { |
| | | if (res.code === 200) { |
| | | this.hasApprovedOfficial = res.data.hasApprovedOfficial === true |
| | | } |
| | | }) |
| | | }, |
| | | formatRemainTime(minutes) { |
| | | if (!minutes) return 0 |
| | | if (minutes === 0) { |
| | |
| | | }) |
| | | }, |
| | | getActiveOrderCount() { |
| | | this.$u.api.activeOrderCount().then(res => { |
| | | if (res.code === 200) { |
| | | this.activeOrderCount = res.data |
| | | checkLocationPermission().then((granted) => { |
| | | if (granted) { |
| | | console.log('已有位置权限-订单数量') |
| | | this.$u.api.activeOrderCount().then(res => { |
| | | if (res.code === 200) { |
| | | this.activeOrderCount = res.data |
| | | } |
| | | }).catch((err) => { |
| | | this.activeOrderCount = null |
| | | }) |
| | | } else { |
| | | console.log('还没有位置权限-订单数量') |
| | | } |
| | | }).catch((err) => { |
| | | this.activeOrderCount = null |
| | | }) |
| | | }, |
| | | |
| | |
| | | } |
| | | this.stats = [ |
| | | { value: res.data.score, label: '服务分' }, |
| | | { value: res.data.todayCommission, label: '今日预计佣金' }, |
| | | { value: ((res.data.todayCommission / 100) || 0).toFixed(2), label: '今日预计佣金' }, |
| | | { value: res.data.todayOrderCount, label: '今日接单' } |
| | | ] |
| | | } |
| | |
| | | if (this.userInfo.auditStatus === 99) return; |
| | | if (this.acceptingStatus === 0) return; |
| | | if (tab === 'hall') { |
| | | console.log('抢单大厅') |
| | | this.hallPage = 1 |
| | | this.hallHasMore = true |
| | | this.orderList = [] |
| | | this.getHallOrders() |
| | | } else if (tab === 'pickup') { |
| | | console.log('待取货') |
| | | this.pickupOrderList = [] |
| | | this.getPickupOrders() |
| | | } else if (tab === 'delivering') { |
| | | console.log('配送中') |
| | | this.deliveringOrderList = [] |
| | | this.getDeliveringOrders() |
| | | } |
| | |
| | | if (this.hallLoading || !this.hallHasMore) { |
| | | return |
| | | } |
| | | this.hallLoading = true |
| | | |
| | | let distance = null |
| | | if (this.selectedFilters.distance !== '不限') { |
| | | const distanceText = this.selectedFilters.distance |
| | | if (distanceText.includes('km')) { |
| | | distance = parseInt(distanceText) * 1000 |
| | | |
| | | checkLocationPermission().then((granted) => { |
| | | if (granted) { |
| | | console.log('已有位置权限') |
| | | this.hallLoading = true |
| | | |
| | | let distance = null |
| | | if (this.selectedFilters.distance !== '不限') { |
| | | const distanceText = this.selectedFilters.distance |
| | | if (distanceText.includes('km')) { |
| | | distance = parseInt(distanceText) * 1000 |
| | | } else { |
| | | distance = parseInt(distanceText) |
| | | } |
| | | } |
| | | |
| | | const sortTypeMap = { |
| | | '综合排序': 1, |
| | | '距离最近': 2 |
| | | } |
| | | const sortType = this.selectedFilters.sort !== '不限' ? (sortTypeMap[this.selectedFilters.sort] || null) : null |
| | | |
| | | let gradeId = null |
| | | if (this.selectedFilters.level !== '不限') { |
| | | const selectedCategory = this.categoryList.find(item => item.name === this.selectedFilters.level) |
| | | if (selectedCategory) { |
| | | gradeId = selectedCategory.id |
| | | } |
| | | } |
| | | |
| | | this.$u.api.grabOrderHall({ |
| | | capacity: this.hallPageSize, |
| | | page: this.hallPage, |
| | | model: { |
| | | distance: distance, |
| | | gradeId: gradeId, |
| | | sortType: sortType |
| | | } |
| | | }).then(res => { |
| | | this.hallLoading = false |
| | | if (res.code === 200) { |
| | | const list = res.data.records || [] |
| | | this.orderList = this.hallPage === 1 ? list : this.orderList.concat(list) |
| | | this.hallHasMore = list.length >= this.hallPageSize |
| | | } |
| | | }).finally(() => { |
| | | this.hallLoading = false |
| | | }) |
| | | } else { |
| | | distance = parseInt(distanceText) |
| | | console.log('还没有位置权限') |
| | | } |
| | | } |
| | | |
| | | const sortTypeMap = { |
| | | '综合排序': 1, |
| | | '距离最近': 2 |
| | | } |
| | | const sortType = this.selectedFilters.sort !== '不限' ? (sortTypeMap[this.selectedFilters.sort] || null) : null |
| | | |
| | | let gradeId = null |
| | | if (this.selectedFilters.level !== '不限') { |
| | | const selectedCategory = this.categoryList.find(item => item.name === this.selectedFilters.level) |
| | | if (selectedCategory) { |
| | | gradeId = selectedCategory.id |
| | | } |
| | | } |
| | | |
| | | console.log('接单大厅:', { distance, gradeId, sortType }) |
| | | this.$u.api.grabOrderHall({ |
| | | capacity: this.hallPageSize, |
| | | page: this.hallPage, |
| | | model: { |
| | | distance: distance, |
| | | gradeId: gradeId, |
| | | sortType: sortType |
| | | } |
| | | }).then(res => { |
| | | console.log('接单大厅', res) |
| | | this.hallLoading = false |
| | | if (res.code === 200) { |
| | | const list = res.data.records || [] |
| | | this.orderList = this.hallPage === 1 ? list : this.orderList.concat(list) |
| | | this.hallHasMore = list.length >= this.hallPageSize |
| | | } |
| | | }).catch((err) => { |
| | | this.hallLoading = false |
| | | }) |
| | | }, |
| | | |
| | | getPickupOrders() { |
| | | if (this.acceptingStatus === 0) return; |
| | | if (this.pickupLoading) return |
| | | this.pickupLoading = true |
| | | this.$u.api.activeOrders({ status: 3 }).then(res => { |
| | | console.log('待取货:', res) |
| | | this.pickupLoading = false |
| | | if (res.code === 200) { |
| | | this.pickupOrderList = res.data.records || res.data || [] |
| | | |
| | | checkLocationPermission().then((granted) => { |
| | | if (granted) { |
| | | console.log('已有位置权限') |
| | | this.pickupLoading = true |
| | | this.$u.api.activeOrders({ status: 3 }).then(res => { |
| | | console.log('待取货:', res) |
| | | this.pickupLoading = false |
| | | if (res.code === 200) { |
| | | this.pickupOrderList = res.data.records || res.data || [] |
| | | } |
| | | }).catch((err) => { |
| | | this.pickupLoading = false |
| | | }) |
| | | } else { |
| | | console.log('还没有位置权限') |
| | | } |
| | | }).catch((err) => { |
| | | this.pickupLoading = false |
| | | }) |
| | | }, |
| | | |
| | | getDeliveringOrders() { |
| | | if (this.acceptingStatus === 0) return; |
| | | if (this.deliveringLoading) return |
| | | this.deliveringLoading = true |
| | | this.$u.api.activeOrders({ status: 4 }).then(res => { |
| | | console.log('配送中:', res) |
| | | this.deliveringLoading = false |
| | | if (res.code === 200) { |
| | | this.deliveringOrderList = res.data || [] |
| | | |
| | | checkLocationPermission().then((granted) => { |
| | | if (granted) { |
| | | console.log('已有位置权限') |
| | | this.deliveringLoading = true |
| | | this.$u.api.activeOrders({ status: 4 }).then(res => { |
| | | console.log('配送中:', res) |
| | | this.deliveringLoading = false |
| | | if (res.code === 200) { |
| | | this.deliveringOrderList = res.data || [] |
| | | } |
| | | }).catch((err) => { |
| | | this.deliveringLoading = false |
| | | }) |
| | | } else { |
| | | console.log('还没有位置权限') |
| | | } |
| | | }).catch((err) => { |
| | | this.deliveringLoading = false |
| | | }) |
| | | }, |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | &__route-badge { |
| | | width: 44rpx; |
| | | height: 44rpx; |
| | | border-radius: 50%; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | font-size: 24rpx; |
| | | font-weight: 600; |
| | | color: #ffffff; |
| | | margin-right: 16rpx; |
| | | flex-shrink: 0; |
| | | |
| | | &--take { |
| | | background: #10B2FA; |
| | | } |
| | | |
| | | &--send { |
| | | background: #FF8A00; |
| | | } |
| | | } |
| | | |
| | | &__route-badge-text { |
| | | display: inline-flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | width: 36rpx; |
| | | height: 36rpx; |
| | | border-radius: 50%; |
| | | font-size: 22rpx; |
| | | font-weight: 600; |
| | | color: #ffffff; |
| | | margin-right: 8rpx; |
| | | vertical-align: middle; |
| | | |
| | | &--take { |
| | | background: #10B2FA; |
| | | } |
| | | |
| | | &--send { |
| | | background: #FF8A00; |
| | | } |
| | | } |
| | | |
| | | &__route-texts { |
| | | flex: 1; |
| | | min-width: 0; |