|
|
@@ -79,7 +79,7 @@
|
|
|
</view>
|
|
|
|
|
|
<!-- 新订单 -->
|
|
|
- <view class="order-section" v-if="pendingOrder">
|
|
|
+ <view class="order-section" v-if="pendingOrder && pendingOrderObj">
|
|
|
<view class="order-header">
|
|
|
<view class="order-header-bg">
|
|
|
<image src="/static/workbench/orderTop.png" mode="scaleToFill" />
|
|
|
@@ -91,17 +91,17 @@
|
|
|
</view>
|
|
|
<view class="order-card">
|
|
|
<view class="order-title-row">
|
|
|
- <text class="order-title one-line-text">{{ orderTitle }}</text>
|
|
|
+ <text class="order-title one-line-text">{{ pendingOrderObj.projectName || '' }}</text>
|
|
|
<!-- v-if="isNewCustomer" -->
|
|
|
- <text class="tag-new">{{ customerType }}</text>
|
|
|
+ <text class="tag-new">{{ pendingOrderObj.customerType || '' }}</text>
|
|
|
</view>
|
|
|
<view class="order-time">
|
|
|
<image class="order-icon" src="/static/workbench/orderTime.png" mode="aspectFit" />
|
|
|
- <text>{{ orderServiceTime }}</text>
|
|
|
+ <text>{{ pendingOrderObj.orderCreateTime || '' }}</text>
|
|
|
</view>
|
|
|
<view class="order-address">
|
|
|
<image class="order-icon1" src="/static/workbench/orderAddress.png" mode="aspectFit" />
|
|
|
- <text>{{ orderAddress }}</text>
|
|
|
+ <text>{{ pendingOrderObj.targetAddress || '' + '(' + pendingOrderObj.distanceDesc + ')' || '' }}</text>
|
|
|
</view>
|
|
|
<view class="order-actions">
|
|
|
<view class="reject-btn" @click="onRejectOrder">拒绝</view>
|
|
|
@@ -183,17 +183,20 @@
|
|
|
<image class="address-tip" src="/static/workbench/skillTip.png" mode="aspectFit" />
|
|
|
</view>
|
|
|
<view class="address-row">
|
|
|
- <image class="address-icon" src="/static/workbench/address.png" mode="aspectFit" />
|
|
|
+ <view class="address-icon-box">
|
|
|
+ <image class="address-icon" src="/static/workbench/address.png" mode="aspectFit" />
|
|
|
+
|
|
|
+ </view>
|
|
|
<!-- 根据授权状态显示不同内容 -->
|
|
|
- <text class="address-text" :class="{ 'auth-error': locationAuthStatus === 'denied' }">
|
|
|
- {{ locationAuthStatus === 'denied' ? '未授权,无法获取地理位置信息~' : (currentAddress || '暂无地址') }}
|
|
|
+ <text class="address-text" :class="{ 'auth-error': !isLocationPermi }">
|
|
|
+ {{ isLocationPermi ? '未授权,无法获取地理位置信息~' : (currentAddress || '暂无地址') }}
|
|
|
</text>
|
|
|
</view>
|
|
|
<view class="address-actions">
|
|
|
<view class="addr-btn" @click="goSwitchAddress">切换地址</view>
|
|
|
<view class="addr-divider" />
|
|
|
<view class="addr-btn" @click="handleUpdateAddress">
|
|
|
- {{ locationAuthStatus === 'denied' ? '去授权' : '更新地址' }}
|
|
|
+ {{ isLocationPermi ? '去授权' : '更新地址' }}
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -215,16 +218,25 @@
|
|
|
</view>
|
|
|
|
|
|
<!-- 拒绝接单弹窗 -->
|
|
|
- <view class="popup-mask" v-if="showRejectPopup" @click="closeRejectPopup">
|
|
|
- <view class="popup-box" @click.stop>
|
|
|
- <view class="popup-title">请输入拒绝接单原因</view>
|
|
|
- <input class="popup-input" v-model="rejectReason" maxlength="10" placeholder="请输入拒绝原因,最多10个字" />
|
|
|
- <view class="popup-btns">
|
|
|
- <view class="popup-btn" @click="closeRejectPopup">取消</view>
|
|
|
- <view class="popup-btn confirm" @click="submitReject">提交</view>
|
|
|
+ <u-popup :show="showRejectPopup" mode="center" :round="16" :mask-close-able="false">
|
|
|
+ <view class="modal-wrap">
|
|
|
+ <!-- 标题居中 -->
|
|
|
+ <view class="title">提示</view>
|
|
|
+ <!-- 正文 -->
|
|
|
+ <view class="content">
|
|
|
+ 请输入拒绝接单原因
|
|
|
+ <u--textarea class="popup-input" v-model="rejectReason" maxlength="30" placeholder="请输入拒绝原因" />
|
|
|
+
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <!-- 底部双按钮(必显示) -->
|
|
|
+ <view class="btn-box">
|
|
|
+ <view class="btn left " @click="submitReject">确认</view>
|
|
|
+ <view class="btn right" @click="closeRejectPopup">我在想想</view>
|
|
|
+
|
|
|
</view>
|
|
|
</view>
|
|
|
- </view>
|
|
|
+ </u-popup>
|
|
|
|
|
|
<!-- 接单状态底部弹窗 -->
|
|
|
<view class="popup-mask bottom" v-if="showStatusPopup" @click="showStatusPopup = false">
|
|
|
@@ -300,7 +312,7 @@
|
|
|
完善你的<text style="color: #45FFD7;">服务技能</text>标签,用户能快速找到你、下单更多!</text>
|
|
|
<!-- 手势图标指向管理按钮 -->
|
|
|
<image src="/static/workbench/handIcon.png" mode="aspectFit"
|
|
|
- style="width: 68rpx;height: 62rpx;position: absolute;right: -102rpx;bottom: -220rpx;" />
|
|
|
+ style="width: 68rpx;height: 62rpx;position: absolute;right: -102rpx;bottom: -200rpx;" />
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
@@ -311,33 +323,27 @@
|
|
|
|
|
|
<script>
|
|
|
import {
|
|
|
- getMerchantData,
|
|
|
- getInfo,
|
|
|
myIncome,
|
|
|
- getStaffWorkData,
|
|
|
- getWaitOrder,
|
|
|
- myBank,
|
|
|
getProjectByJsId,
|
|
|
- netStaffWork,
|
|
|
logout,
|
|
|
- getJsLocation,
|
|
|
} from '@/api/index';
|
|
|
import {
|
|
|
- orderDeatails,
|
|
|
- takeOrder,
|
|
|
- refuseOrder
|
|
|
+ acceptOrder,rejectOrder,
|
|
|
} from '@/api/order.js';
|
|
|
|
|
|
import {
|
|
|
switchToOffline,
|
|
|
- getSkillList, getWaitList
|
|
|
+ getSkillList, getWaitList,getCommentScore
|
|
|
} from '@/api/workbench.js';
|
|
|
import { normalizeStorageValue } from '@/utils/technicianProfile.js';
|
|
|
-import locationService from '@/utils/location.js';
|
|
|
+import locationService from '@/utils/location';
|
|
|
+// 推荐使用统一的 addressService
|
|
|
+import addressService from '@/utils/address.js';
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ pendingOrderObj: {},
|
|
|
// 开启定位提示
|
|
|
isLocationPermi: false,
|
|
|
currentAddress: '',
|
|
|
@@ -364,7 +370,6 @@ export default {
|
|
|
deductAmount: '12341.56',
|
|
|
},
|
|
|
pendingOrder: false,
|
|
|
- currentAddress: '',
|
|
|
showRejectPopup: false,
|
|
|
rejectReason: '',
|
|
|
showStatusPopup: false,
|
|
|
@@ -392,100 +397,77 @@ export default {
|
|
|
customerType: '',
|
|
|
orderTitle: '',
|
|
|
orderServiceTime: '',
|
|
|
- orderAddress: '',
|
|
|
+ locationLoaded: false, // 定位加载完成标记
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- // orderTitle() {
|
|
|
- // if (!this.pendingOrder) return ''
|
|
|
- // const goods = this.pendingOrder.cGoods || []
|
|
|
- // return goods[0]?.cTitle || '服务项目'
|
|
|
- // },
|
|
|
- // orderServiceTime() {
|
|
|
- // if (!this.pendingOrder) return ''
|
|
|
- // return this.formatOrderTime(
|
|
|
- // this.pendingOrder.reachTime || this.pendingOrder.dtCreateTime || ''
|
|
|
- // )
|
|
|
- // },
|
|
|
- // deductionAmount() {
|
|
|
- // return (
|
|
|
- // this.myIncome.kAmount ??
|
|
|
- // this.myIncome.deductAmount ??
|
|
|
- // this.myIncome.dAmount ??
|
|
|
- // 0
|
|
|
- // )
|
|
|
- // },
|
|
|
- // orderAddress() {
|
|
|
- // if (!this.pendingOrder) return ''
|
|
|
- // return this.pendingOrder.address || this.pendingOrder.atlasAdd || ''
|
|
|
- // },
|
|
|
+
|
|
|
isNewCustomer() {
|
|
|
return this.pendingOrder?.nB2 == 1
|
|
|
},
|
|
|
},
|
|
|
async onShow() {
|
|
|
- // 调用定位初始化
|
|
|
- locationService.initLocation().then(location => {
|
|
|
- console.log('定位成功:', location);
|
|
|
- // 更新页面地址显示
|
|
|
- this.currentAddress = location.formattedAddress || location.cityName || '暂无地址';
|
|
|
- }).catch(err => {
|
|
|
- console.error('定位失败:', err);
|
|
|
- });
|
|
|
- // // 定位逻辑
|
|
|
- // const locationData = await LocationService.LocationService();
|
|
|
- // console.log(locationData)
|
|
|
- // // #ifndef H5
|
|
|
- // if (locationData) this.isLocationPermi = locationData.isRefuse == 1;
|
|
|
- // // #endif
|
|
|
-
|
|
|
- this.getWaitList()
|
|
|
- await this.checkMerchantStatus()
|
|
|
- this.getSkillList();
|
|
|
- setTimeout(() => {
|
|
|
- if (!this.auditStatus) return
|
|
|
- if (this.auditStatus == 0 || this.auditStatus == 3) {
|
|
|
- this.showModal = true
|
|
|
- return
|
|
|
- }
|
|
|
- if (this.auditStatus == 1) {
|
|
|
- uni.showToast({
|
|
|
- title: '入驻审核中,暂无操作权限',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
-
|
|
|
- }
|
|
|
- this.loadPageData()
|
|
|
+ // 首次加载由onLoad主动调用,避免重复执行
|
|
|
+ if (!this.locationLoaded) return
|
|
|
+ await this.initData()
|
|
|
|
|
|
- // 新增:判断是否需要展示技能引导
|
|
|
- const guideFlag = uni.getStorageSync('merchant_skill_manage_guide')
|
|
|
- if (!guideFlag && this.auditStatus === 2) { // 仅审核通过正式商户展示
|
|
|
- this.$nextTick(() => this.getManageBtnRect())
|
|
|
- }
|
|
|
- }, 300)
|
|
|
|
|
|
},
|
|
|
- onLoad() {
|
|
|
-
|
|
|
- console.log('onLoad')
|
|
|
+ async onLoad() {
|
|
|
+ uni.setStorageSync('cityCode', '')
|
|
|
+ const locationData = await locationService.initLocation();
|
|
|
+ if (locationData.address) {
|
|
|
+ this.currentAddress = locationData.address.province + locationData.address.city + locationData.address.district + locationData.address.street + locationData.name
|
|
|
+ }
|
|
|
+ if (locationData) this.isLocationPermi = locationData.isRefuse == 1;
|
|
|
+ this.locationLoaded = true // 标记定位完成
|
|
|
+ await this.initData()
|
|
|
|
|
|
},
|
|
|
methods: {
|
|
|
+ async initData() {
|
|
|
+ // 查询待接单列表
|
|
|
+ await this.getWaitList()
|
|
|
+ // 查询商户状态
|
|
|
+ await this.checkMerchantStatus()
|
|
|
+ // 查询技能列表
|
|
|
+ await this.getSkillList();
|
|
|
+ // 查询商户的综合评分
|
|
|
+ this.getCommentScore()
|
|
|
+ setTimeout(() => {
|
|
|
+ if (!this.auditStatus) return
|
|
|
+ if (this.auditStatus == 0 || this.auditStatus == 3) {
|
|
|
+ this.showModal = true
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.auditStatus == 1) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '入驻审核中,暂无操作权限',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ // 新增:判断是否需要展示技能引导
|
|
|
+ const guideFlag = uni.getStorageSync('merchant_skill_manage_guide')
|
|
|
+ if (!guideFlag && this.auditStatus === 2) { // 仅审核通过正式商户展示
|
|
|
+ this.$nextTick(() => this.getManageBtnRect())
|
|
|
+ }
|
|
|
+ }, 300)
|
|
|
+
|
|
|
+ },
|
|
|
|
|
|
// 查询待接单列表
|
|
|
getWaitList() {
|
|
|
let params = {
|
|
|
- "techLat": 10.3,
|
|
|
- "techLng": 50.3
|
|
|
+ "techLat": uni.getStorageSync('positioning').latitude,
|
|
|
+ "techLng": uni.getStorageSync('positioning').longitude,
|
|
|
}
|
|
|
getWaitList(params).then(res => {
|
|
|
if (res.data.code == 200) {
|
|
|
if (!res.data.data) return
|
|
|
this.pendingOrder = true
|
|
|
- this.customerType = res.data.data[0].customerType || ''
|
|
|
- this.orderTitle = res.data.data[0].projectName || ''
|
|
|
- this.orderServiceTime = res.data.data[0].orderCreateTime || ''
|
|
|
- this.orderAddress = res.data.data[0].targetAddress + '(' + res.data.data[0].distanceDesc + ')' || ''
|
|
|
+ this.pendingOrderObj = res.data.data[0] || null
|
|
|
|
|
|
}
|
|
|
})
|
|
|
@@ -513,6 +495,10 @@ export default {
|
|
|
return merchantInfo.auditStatus//用户状态
|
|
|
|
|
|
|
|
|
+ },
|
|
|
+ // 更新地址
|
|
|
+ handleUpdateAddress() {
|
|
|
+ locationService.openSystemSettings();
|
|
|
},
|
|
|
// 我在想想:关闭弹窗
|
|
|
cancel() {
|
|
|
@@ -525,13 +511,6 @@ export default {
|
|
|
url: '/pages/join/applyJoin' // 替换你的入驻页面路径
|
|
|
})
|
|
|
},
|
|
|
- loadPageData() {
|
|
|
- // this.fetchMerchantInfo()
|
|
|
- // this.fetchWalletInfo()
|
|
|
- // this.fetchIncome()
|
|
|
- // this.fetchWorkData()
|
|
|
- // this.fetchBankCards()
|
|
|
- },
|
|
|
|
|
|
async getSkillList() {
|
|
|
let params = {
|
|
|
@@ -545,96 +524,7 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // fetchMerchantInfo() {
|
|
|
- // const params = {
|
|
|
- // cOpenId: uni.getStorageSync('wx_copenid')
|
|
|
- // }
|
|
|
- // getMerchantData(params).then(res => {
|
|
|
- // if (res.data.code != 200 || !res.data.data) return
|
|
|
- // const data = res.data.data
|
|
|
- // this.merchantInfo = data
|
|
|
- // this.cJsId = data.id
|
|
|
- // this.isWorking = data.nStatus2 == '0'
|
|
|
- // this.ratingScore = data.nStar != null ? Number(data.nStar).toFixed(1) : '0.0'
|
|
|
- // this.workStartTime = data.dtWorkStart || data.dtOnlineStart || null
|
|
|
- // this.restStartTime = data.dtRestStart || data.restStartTime || null
|
|
|
- // //this.syncCurrentAddress(data)
|
|
|
- // //this.fetchTodayOrders()
|
|
|
- // //this.fetchPendingOrder()
|
|
|
- // //this.fetchSkills()
|
|
|
- // })
|
|
|
- // },
|
|
|
- // fetchWalletInfo() {
|
|
|
- // getInfo().then(res => {
|
|
|
- // if (res.data.code == 200 && res.data.data) {
|
|
|
- // this.cJsId = res.data.data.id;
|
|
|
- // }
|
|
|
- // })
|
|
|
- // },
|
|
|
- // fetchIncome() {
|
|
|
- // myIncome().then(res => {
|
|
|
- // if (res.data.code == 200 && res.data.data) {
|
|
|
- // this.myIncome = res.data.data
|
|
|
- // }
|
|
|
- // })
|
|
|
- // },
|
|
|
- // fetchWorkData() {
|
|
|
- // getStaffWorkData({
|
|
|
- // openId: uni.getStorageSync('wx_copenid')
|
|
|
- // }).then(res => {
|
|
|
- // if (res.data.code == 200 && res.data.data) {
|
|
|
- // const minutes = res.data.data.onLine || 0
|
|
|
- // // this.onlineHours = (minutes / 60).toFixed(1).replace(/\.0$/, '')
|
|
|
- // }
|
|
|
- // })
|
|
|
- // },
|
|
|
- // fetchBankCards() {
|
|
|
- // myBank().then(res => {
|
|
|
- // if (res.data.code == 200 && Array.isArray(res.data.data)) {
|
|
|
- // // this.bankCardCount = res.data.data.length
|
|
|
- // }
|
|
|
- // })
|
|
|
- // },
|
|
|
- // fetchTodayOrders() {
|
|
|
- // if (!this.cJsId) return
|
|
|
- // getWaitOrder({
|
|
|
- // cJsId: this.cJsId
|
|
|
- // }).then(res => {
|
|
|
- // if (res.data.code == 200) {
|
|
|
- // this.todayOrderCount = res.data.data || 0
|
|
|
- // }
|
|
|
- // })
|
|
|
- // },
|
|
|
- fetchSkills() {
|
|
|
- // TODO: 接口联调后开启,当前使用假数据展示
|
|
|
- return
|
|
|
- const openId = uni.getStorageSync('wx_copenid')
|
|
|
- if (!openId) return
|
|
|
- getProjectByJsId({
|
|
|
- openId
|
|
|
- }).then(res => {
|
|
|
- if (res.data.code == 200 && Array.isArray(res.data.data)) {
|
|
|
- this.skillList = res.data.data
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- // fetchPendingOrder() {
|
|
|
- // if (!this.cJsId) return
|
|
|
- // orderDeatails({
|
|
|
- // cJsId: this.cJsId,
|
|
|
- // nStatus: 0,
|
|
|
- // current: 1,
|
|
|
- // size: 1,
|
|
|
- // }).then(res => {
|
|
|
- // if (res.data.code == 200 && res.data.data?.records?.length) {
|
|
|
- // this.pendingOrder = res.data.data.records[0]
|
|
|
- // this.slideX = 0
|
|
|
- // this.initSlideRange()
|
|
|
- // } else {
|
|
|
- // this.pendingOrder = null
|
|
|
- // }
|
|
|
- // })
|
|
|
- // },
|
|
|
+ // 格式化金额
|
|
|
formatMoney(amount) {
|
|
|
const num = parseFloat(amount)
|
|
|
if (isNaN(num)) return '0.00'
|
|
|
@@ -645,6 +535,7 @@ export default {
|
|
|
if (item.nMinute) return '/小时'
|
|
|
return ''
|
|
|
},
|
|
|
+ // 格式化订单时间
|
|
|
formatOrderTime(timeStr) {
|
|
|
if (!timeStr) return ''
|
|
|
const str = String(timeStr)
|
|
|
@@ -672,6 +563,7 @@ export default {
|
|
|
if (Number.isNaN(start)) return 0
|
|
|
return Math.max(0, Math.floor((Date.now() - start) / 3600000))
|
|
|
},
|
|
|
+ // 格式化状态描述
|
|
|
getStatusDesc(type) {
|
|
|
const isCurrent =
|
|
|
type === 'working' ? this.isWorking : !this.isWorking
|
|
|
@@ -687,10 +579,23 @@ export default {
|
|
|
}
|
|
|
return '今日辛苦啦,早点下线休息,注意劳逸结合!'
|
|
|
},
|
|
|
+ // 查询商户的综合评分
|
|
|
+ getCommentScore() {
|
|
|
+ getCommentScore({
|
|
|
+ merchantId: uni.getStorageSync('merchantId'),
|
|
|
+ }).then(res => {
|
|
|
+ if (res.data.code == 200) {
|
|
|
+ this.ratingScore = res.data.data.comprehensiveScore || 0
|
|
|
+ this.todayOrderCount = res.data.data.orderCount || 0
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 打开状态变更弹窗
|
|
|
openStatusPopup() {
|
|
|
this.statusDraft = this.isWorking ? 'working' : 'rest'
|
|
|
this.showStatusPopup = true
|
|
|
},
|
|
|
+ // 确认状态变更
|
|
|
confirmStatusChange() {
|
|
|
const wantWorking = this.statusDraft === 'working'
|
|
|
this.showStatusPopup = false
|
|
|
@@ -730,6 +635,7 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // 拒绝接单
|
|
|
async onRejectOrder() {
|
|
|
if (this.auditStatus == 0 || this.auditStatus == 3) {
|
|
|
this.showModal = true
|
|
|
@@ -746,10 +652,12 @@ export default {
|
|
|
this.showRejectPopup = true
|
|
|
this.rejectReason = ''
|
|
|
},
|
|
|
+ // 关闭拒绝接单弹窗
|
|
|
closeRejectPopup() {
|
|
|
this.showRejectPopup = false
|
|
|
this.rejectReason = ''
|
|
|
},
|
|
|
+ // 提交拒绝接单
|
|
|
submitReject() {
|
|
|
const reason = this.rejectReason.trim()
|
|
|
if (!reason) {
|
|
|
@@ -759,18 +667,20 @@ export default {
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
- refuseOrder({
|
|
|
- cId: this.pendingOrder.cId,
|
|
|
+
|
|
|
+ rejectOrder({
|
|
|
+ id: this.pendingOrderObj.orderId,
|
|
|
reasonRefusal: reason,
|
|
|
}).then(res => {
|
|
|
if (res.data.code == 200) {
|
|
|
uni.showToast({
|
|
|
- title: '已拒绝',
|
|
|
+ title: res.data.msg || '已拒绝',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
+ // 刷新待接单列表
|
|
|
+ this.getWaitList()
|
|
|
this.closeRejectPopup()
|
|
|
this.pendingOrder = null
|
|
|
- this.fetchTodayOrders()
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: res.data.msg || '操作失败',
|
|
|
@@ -793,6 +703,7 @@ export default {
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
async onSlideStart(e) {
|
|
|
if (this.auditStatus == 0 || this.auditStatus == 3) {
|
|
|
this.showModal = true
|
|
|
@@ -810,6 +721,7 @@ export default {
|
|
|
this.slideStartX = e.touches[0].clientX - this.slideX
|
|
|
this.initSlideRange()
|
|
|
},
|
|
|
+ //
|
|
|
onSlideMove(e) {
|
|
|
if (!this.isSliding) return
|
|
|
let x = e.touches[0].clientX - this.slideStartX
|
|
|
@@ -825,30 +737,29 @@ export default {
|
|
|
}
|
|
|
this.slideX = 0
|
|
|
},
|
|
|
+ // 滑动接单
|
|
|
acceptOrder() {
|
|
|
if (!this.pendingOrder) return
|
|
|
uni.showToast({
|
|
|
title: '接单失败',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
- return;
|
|
|
- takeOrder({
|
|
|
- cId: this.pendingOrder.cId
|
|
|
+ acceptOrder({
|
|
|
+ id: this.pendingOrderObj.orderId,
|
|
|
}).then(res => {
|
|
|
- if (res.data.code == 200) {
|
|
|
- uni.showToast({
|
|
|
- title: '已接单',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- this.pendingOrder = null
|
|
|
- this.fetchTodayOrders()
|
|
|
- } else {
|
|
|
+ console.log(res)
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ // 刷新待接单列表
|
|
|
+ this.getWaitList()
|
|
|
+ uni.showToast({ title: res.data.msg, icon: 'none' });
|
|
|
+ }else {
|
|
|
uni.showToast({
|
|
|
title: res.data.msg || '接单失败',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
},
|
|
|
goProfile() {
|
|
|
uni.navigateTo({
|
|
|
@@ -914,58 +825,25 @@ export default {
|
|
|
// const data = merchantData || this.merchantInfo
|
|
|
// this.currentAddress = data?.address || data?.name || ''
|
|
|
// },
|
|
|
- goSwitchAddress() {
|
|
|
- uni.chooseLocation({
|
|
|
- success: (res) => {
|
|
|
- console.log('切换地址', res)
|
|
|
|
|
|
- }
|
|
|
+
|
|
|
+ // 切换地址
|
|
|
+ async goSwitchAddress() {
|
|
|
+ // if (this.isLocationPermi) {
|
|
|
+ // uni.showToast({ title: '未授权,无法获取地理位置信息', icon: 'none' })
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ const res = await addressService.chooseLocation();
|
|
|
+ await locationService.updateData({
|
|
|
+ latitude: res.latitude,
|
|
|
+ longitude: res.longitude
|
|
|
});
|
|
|
+ // 使用经纬度进行逆地理编码
|
|
|
+ await locationService.updateGeocode();
|
|
|
+ this.currentAddress = uni.getStorageSync("city") + uni.getStorageSync("addressName") + res.address + res.name;
|
|
|
+ await this.initData()
|
|
|
},
|
|
|
- async goUpdateAddress() {
|
|
|
- if (!this.cJsId) {
|
|
|
- uni.showToast({ title: '请先登录', icon: 'none' })
|
|
|
- return
|
|
|
- }
|
|
|
- try {
|
|
|
- const res = await this.$utils.addressService.chooseLocation()
|
|
|
- console.log('选择地址', res)
|
|
|
- const params = {
|
|
|
- id: this.cJsId,
|
|
|
- cPhone: this.merchantInfo.cPhone,
|
|
|
- name: res.name,
|
|
|
- address: res.address,
|
|
|
- latitude: res.latitude,
|
|
|
- longitude: res.longitude,
|
|
|
- cOpenId: uni.getStorageSync('wx_copenid'),
|
|
|
- }
|
|
|
- const apiRes = await getJsLocation(params)
|
|
|
- if (apiRes.data.code == 200) {
|
|
|
- uni.setStorageSync('staffLocation', {
|
|
|
- name: res.name,
|
|
|
- address: res.address,
|
|
|
- latitude: res.latitude,
|
|
|
- longitude: res.longitude,
|
|
|
- })
|
|
|
- this.syncCurrentAddress()
|
|
|
- uni.showToast({
|
|
|
- title: '地址已更新',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: apiRes.data.msg || '更新失败',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- }
|
|
|
- } catch (err) {
|
|
|
- if (err?.cancelled) return
|
|
|
- uni.showToast({
|
|
|
- title: err?.message || '获取位置失败',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
+ // 更多功能
|
|
|
onMoreFeature(item) {
|
|
|
if (item.label == '退出登录') {
|
|
|
this.showModal2 = true
|
|
|
@@ -1675,10 +1553,16 @@ $page-bg: #f6f7f9;
|
|
|
.address-row {
|
|
|
display: flex;
|
|
|
align-items: flex-start;
|
|
|
- align-items: center;
|
|
|
margin-bottom: 32rpx;
|
|
|
}
|
|
|
|
|
|
+.address-icon-box {
|
|
|
+ height: 40rpx;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
.address-icon {
|
|
|
width: 24rpx;
|
|
|
height: 28rpx;
|
|
|
@@ -1690,7 +1574,6 @@ $page-bg: #f6f7f9;
|
|
|
flex: 1;
|
|
|
font-size: 26rpx;
|
|
|
color: #666666;
|
|
|
- line-height: 1.6;
|
|
|
|
|
|
&.auth-error {
|
|
|
color: #F53F3F; // 错误提示红色
|
|
|
@@ -1772,70 +1655,31 @@ $page-bg: #f6f7f9;
|
|
|
line-height: 1.4;
|
|
|
}
|
|
|
|
|
|
-/* 弹窗 */
|
|
|
-.popup-mask {
|
|
|
- position: fixed;
|
|
|
- left: 0;
|
|
|
- top: 0;
|
|
|
- right: 0;
|
|
|
- bottom: 0;
|
|
|
- background: rgba(0, 0, 0, 0.4);
|
|
|
- z-index: 999;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
-}
|
|
|
|
|
|
-.popup-box {
|
|
|
- width: 600rpx;
|
|
|
- background: #fff;
|
|
|
- border-radius: 8rpx;
|
|
|
- padding: 32rpx;
|
|
|
-}
|
|
|
+::v-deep .popup-input {
|
|
|
+ margin-top: 8rpx;
|
|
|
+ padding: 8rpx;
|
|
|
+ height: 124rpx;
|
|
|
+ background: #F7F8FA;
|
|
|
+ border-radius: 6rpx 6rpx 6rpx 6rpx;
|
|
|
+ border: none;
|
|
|
|
|
|
-.popup-title {
|
|
|
- font-size: 28rpx;
|
|
|
- color: #333;
|
|
|
- text-align: center;
|
|
|
- margin-bottom: 24rpx;
|
|
|
-}
|
|
|
|
|
|
-.popup-input {
|
|
|
- width: 100%;
|
|
|
- height: 72rpx;
|
|
|
- border: 1rpx solid #ddd;
|
|
|
- border-radius: 6rpx;
|
|
|
- padding: 0 20rpx;
|
|
|
- font-size: 26rpx;
|
|
|
- box-sizing: border-box;
|
|
|
-}
|
|
|
-
|
|
|
-.popup-btns {
|
|
|
- display: flex;
|
|
|
- gap: 24rpx;
|
|
|
- margin-top: 32rpx;
|
|
|
-}
|
|
|
+ .uni-textarea-placeholder {
|
|
|
+ font-weight: 400;
|
|
|
+ font-size: 28rpx;
|
|
|
+ color: #86909C !important;
|
|
|
|
|
|
-.popup-btn {
|
|
|
- flex: 1;
|
|
|
- height: 72rpx;
|
|
|
- line-height: 72rpx;
|
|
|
- text-align: center;
|
|
|
- border: 1rpx solid #ccc;
|
|
|
- border-radius: 6rpx;
|
|
|
- font-size: 28rpx;
|
|
|
- color: #666;
|
|
|
+ }
|
|
|
|
|
|
- &.confirm {
|
|
|
- background: linear-gradient(90deg, #3dd9cf 0%, #1ecbc3 100%);
|
|
|
- border-color: #1ecbc3;
|
|
|
- color: #fff;
|
|
|
+ .u-textarea__field {
|
|
|
+ font-weight: 400;
|
|
|
+ font-size: 26rpx;
|
|
|
+ color: #4E5969!important;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-.popup-mask.bottom {
|
|
|
- align-items: flex-end;
|
|
|
-}
|
|
|
+
|
|
|
|
|
|
.status-panel {
|
|
|
width: 100%;
|