Commit 5b1f0e15aeb969249e314618aa6ce8f5c0a49977
1 parent
91e4cb7d
运距需求
Showing
5 changed files
with
85 additions
and
10 deletions
garbage-removal/src/pages/home-info/clean/index.vue
| @@ -107,6 +107,29 @@ | @@ -107,6 +107,29 @@ | ||
| 107 | </view> | 107 | </view> |
| 108 | </view> | 108 | </view> |
| 109 | </view> | 109 | </view> |
| 110 | + | ||
| 111 | + <!-- 添加是否需要跟车选项 --> | ||
| 112 | + <view class="company-clean-container-car-main-content-type"> | ||
| 113 | + <view class="company-clean-container-car-main-content-type-price-area"> | ||
| 114 | + <text style="color: red;">*</text>是否需要跟车: | ||
| 115 | + </view> | ||
| 116 | + <view | ||
| 117 | + style="width:100%;display: flex;justify-content: flex-start;align-items: center; "> | ||
| 118 | + <view style="display: flex; align-items: center;"> | ||
| 119 | + <up-radio-group shape="square" size="34" v-model="paramFrom.needFollowCar" | ||
| 120 | + placement="row"> | ||
| 121 | + <up-radio activeColor="#19a97c" labelSize="32" iconSize="30" | ||
| 122 | + :customStyle="{ marginRight: '30rpx' }" label="需要" :name="true"> | ||
| 123 | + </up-radio> | ||
| 124 | + <up-radio activeColor="#19a97c" labelSize="32" iconSize="30" | ||
| 125 | + :customStyle="{ marginRight: '30rp' }" label="不需要" :name="false"> | ||
| 126 | + </up-radio> | ||
| 127 | + </up-radio-group> | ||
| 128 | + </view> | ||
| 129 | + </view> | ||
| 130 | + </view> | ||
| 131 | + | ||
| 132 | + | ||
| 110 | <view v-if="paramFrom.garInCarStore" class="company-in-car-store-box-info"> | 133 | <view v-if="paramFrom.garInCarStore" class="company-in-car-store-box-info"> |
| 111 | <view class="company-clean-container-site-image-info-input-remark-box"> | 134 | <view class="company-clean-container-site-image-info-input-remark-box"> |
| 112 | <u--textarea v-model="paramFrom.remark" placeholder="请填写限制高度(米)"></u--textarea> | 135 | <u--textarea v-model="paramFrom.remark" placeholder="请填写限制高度(米)"></u--textarea> |
| @@ -251,6 +274,7 @@ | @@ -251,6 +274,7 @@ | ||
| 251 | carType: "", | 274 | carType: "", |
| 252 | garbageType: "装修垃圾", | 275 | garbageType: "装修垃圾", |
| 253 | garInCarStore: false, | 276 | garInCarStore: false, |
| 277 | + needFollowCar: false, | ||
| 254 | garEstimatedCost: "" | 278 | garEstimatedCost: "" |
| 255 | }) | 279 | }) |
| 256 | const dayTime = ref() | 280 | const dayTime = ref() |
| @@ -564,7 +588,9 @@ | @@ -564,7 +588,9 @@ | ||
| 564 | garLongitude: userAddress.value.garLongitude, | 588 | garLongitude: userAddress.value.garLongitude, |
| 565 | garLatitude: userAddress.value.garLatitude, | 589 | garLatitude: userAddress.value.garLatitude, |
| 566 | garCoordinate: userAddress.value.garCoordinate, | 590 | garCoordinate: userAddress.value.garCoordinate, |
| 567 | - garInCarStore: paramFrom.value.garInCarStore | 591 | + garInCarStore: paramFrom.value.garInCarStore, |
| 592 | + needFollowCar: paramFrom.value.needFollowCar, | ||
| 593 | + | ||
| 568 | } | 594 | } |
| 569 | console.log("----------------------->5"); | 595 | console.log("----------------------->5"); |
| 570 | if (!validateParams(params)) { | 596 | if (!validateParams(params)) { |
| @@ -634,7 +660,7 @@ | @@ -634,7 +660,7 @@ | ||
| 634 | } | 660 | } |
| 635 | for (const key in params) { | 661 | for (const key in params) { |
| 636 | // 跳过garInCarStore | 662 | // 跳过garInCarStore |
| 637 | - if (key == "garInCarStore") { | 663 | + if (key == "garInCarStore"||key == "needFollowCar") { |
| 638 | continue; | 664 | continue; |
| 639 | } | 665 | } |
| 640 | if (!params[key] && key != "garRemark") { | 666 | if (!params[key] && key != "garRemark") { |
garbage-removal/src/pages/order-info/order-disposal/scan-detail/index.vue
| @@ -47,6 +47,7 @@ | @@ -47,6 +47,7 @@ | ||
| 47 | {{ details.garHandlerCarCode }} | 47 | {{ details.garHandlerCarCode }} |
| 48 | </view> | 48 | </view> |
| 49 | </view> | 49 | </view> |
| 50 | + | ||
| 50 | <view class="scan-car-num"> | 51 | <view class="scan-car-num"> |
| 51 | <view class="scan-car-num-label"> | 52 | <view class="scan-car-num-label"> |
| 52 | 车辆载重 | 53 | 车辆载重 |
| @@ -56,6 +57,15 @@ | @@ -56,6 +57,15 @@ | ||
| 56 | v-model="details.garCarryingWeight" @change="handlerInputChange"></up-input> | 57 | v-model="details.garCarryingWeight" @change="handlerInputChange"></up-input> |
| 57 | </view> | 58 | </view> |
| 58 | </view> | 59 | </view> |
| 60 | + | ||
| 61 | + <view class="scan-car-num"> | ||
| 62 | + <view class="scan-car-num-label"> | ||
| 63 | + 运距 | ||
| 64 | + </view> | ||
| 65 | + <view class="scan-car-num-content"> | ||
| 66 | + {{ details.transportDistance }} | ||
| 67 | + </view> | ||
| 68 | + </view> | ||
| 59 | <!-- <view class="scan-upload-fill-image-box"> | 69 | <!-- <view class="scan-upload-fill-image-box"> |
| 60 | <view class="scan-upload-fill-image-label"> | 70 | <view class="scan-upload-fill-image-label"> |
| 61 | <view> | 71 | <view> |
| @@ -117,22 +127,57 @@ | @@ -117,22 +127,57 @@ | ||
| 117 | longitude: ll[0], | 127 | longitude: ll[0], |
| 118 | latitude: ll[1] | 128 | latitude: ll[1] |
| 119 | }; | 129 | }; |
| 130 | + // 获取定位后计算运距 | ||
| 131 | + calculateDistance(); | ||
| 120 | } | 132 | } |
| 121 | - | 133 | + |
| 122 | // 生命周期处理 | 134 | // 生命周期处理 |
| 123 | onMounted(() => { | 135 | onMounted(() => { |
| 124 | // 挂载全局回调 | 136 | // 挂载全局回调 |
| 125 | window.takeLocationCallBack = takeLocalCallBack | 137 | window.takeLocationCallBack = takeLocalCallBack |
| 126 | }) | 138 | }) |
| 127 | - | 139 | + |
| 128 | onLoad((options) => { | 140 | onLoad((options) => { |
| 129 | // 获取定位信息 | 141 | // 获取定位信息 |
| 130 | takeLocation(); | 142 | takeLocation(); |
| 131 | }); | 143 | }); |
| 144 | + | ||
| 145 | + // 计算运距函数 | ||
| 146 | + const calculateDistance = () => { | ||
| 147 | + // 检查是否有起点经纬度信息 | ||
| 148 | + if (!details.value.garLatitude || !details.value.garLongitude) { | ||
| 149 | + return; | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + const startLat= details.value.garLatitude; | ||
| 153 | + const startLng = details.value.garLongitude; | ||
| 154 | + | ||
| 155 | + | ||
| 156 | + | ||
| 157 | + const endLat = location.value.latitude; // 终点纬度(当前定位) | ||
| 158 | + const endLng = location.value.longitude; // 终点经度(当前定位) | ||
| 159 | + | ||
| 160 | + // 检查是否有终点经纬度 | ||
| 161 | + if (!endLat || !endLng) { | ||
| 162 | + return; | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + // 使用Haversine公式计算两点之间的距离(公里) | ||
| 166 | + const R = 6371; // 地球半径(公里) | ||
| 167 | + const dLat = (endLat - startLat) * Math.PI / 180; | ||
| 168 | + const dLng = (endLng - startLng) * Math.PI / 180; | ||
| 169 | + const a = | ||
| 170 | + Math.sin(dLat/2) * Math.sin(dLat/2) + | ||
| 171 | + Math.cos(startLat * Math.PI / 180) * Math.cos(endLat * Math.PI / 180) * | ||
| 172 | + Math.sin(dLng/2) * Math.sin(dLng/2); | ||
| 173 | + const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); | ||
| 174 | + const distance = R * c; // 距离(公里) | ||
| 175 | + | ||
| 176 | + // 更新运距信息,保留两位小数 | ||
| 177 | + details.value.transportDistance = distance.toFixed(2) + ' 公里'; | ||
| 178 | + } | ||
| 132 | 179 | ||
| 133 | const takeLocation = () => { | 180 | const takeLocation = () => { |
| 134 | - console.log("获取定位信息"); | ||
| 135 | - // 获取定位信息 | ||
| 136 | window.JsInterface.takeLocation(); | 181 | window.JsInterface.takeLocation(); |
| 137 | } | 182 | } |
| 138 | 183 | ||
| @@ -184,7 +229,6 @@ | @@ -184,7 +229,6 @@ | ||
| 184 | console.log(val); | 229 | console.log(val); |
| 185 | } | 230 | } |
| 186 | const handlerSubmit = async () => { | 231 | const handlerSubmit = async () => { |
| 187 | - | ||
| 188 | // 校验参数 | 232 | // 校验参数 |
| 189 | let params = { | 233 | let params = { |
| 190 | ...details.value, | 234 | ...details.value, |
| @@ -193,7 +237,8 @@ | @@ -193,7 +237,8 @@ | ||
| 193 | garOrderHandlerCompanyId: details.value.garOrderCompanyId, | 237 | garOrderHandlerCompanyId: details.value.garOrderCompanyId, |
| 194 | // 添加定位信息 | 238 | // 添加定位信息 |
| 195 | latitude: location.value.latitude, | 239 | latitude: location.value.latitude, |
| 196 | - longitude: location.value.longitude | 240 | + longitude: location.value.longitude, |
| 241 | + transportDistance : details.value.transportDistance | ||
| 197 | } | 242 | } |
| 198 | if (validateParams(params)) { | 243 | if (validateParams(params)) { |
| 199 | await askTransport(params).then((res) => { | 244 | await askTransport(params).then((res) => { |
| @@ -266,7 +311,6 @@ | @@ -266,7 +311,6 @@ | ||
| 266 | if (options.garAskId) { | 311 | if (options.garAskId) { |
| 267 | // TODO query | 312 | // TODO query |
| 268 | scanDetail(options.garAskId).then((res) => { | 313 | scanDetail(options.garAskId).then((res) => { |
| 269 | - console.log(res); | ||
| 270 | details.value = res.data.data; | 314 | details.value = res.data.data; |
| 271 | details.value.garOrderCompanyName = details.value.garOrderHandlerCompanyName; | 315 | details.value.garOrderCompanyName = details.value.garOrderHandlerCompanyName; |
| 272 | fileList.value = details.value.fillImageList.map((item) => { | 316 | fileList.value = details.value.fillImageList.map((item) => { |
garbage-removal/src/pages/order-info/order-driver/detail/index.vue
| @@ -126,6 +126,10 @@ | @@ -126,6 +126,10 @@ | ||
| 126 | {{ dataGram.garRemark }} | 126 | {{ dataGram.garRemark }} |
| 127 | </view> | 127 | </view> |
| 128 | </view> | 128 | </view> |
| 129 | + | ||
| 130 | + <view v-if="dataGram.needFollowCar" class="follow-car-notice"> | ||
| 131 | + <text style="color: red;">该订单需要跟车</text> | ||
| 132 | + </view> | ||
| 129 | </view> | 133 | </view> |
| 130 | <!-- 处理信息 --> | 134 | <!-- 处理信息 --> |
| 131 | <view class="order-detail-container-box-card"> | 135 | <view class="order-detail-container-box-card"> |
garbage-removal/src/pages/order-info/order-driver/upload/index.vue
| @@ -88,7 +88,7 @@ | @@ -88,7 +88,7 @@ | ||
| 88 | if (!location.value.latitude) { | 88 | if (!location.value.latitude) { |
| 89 | uni.$u.toast("定位获取超时,请检查权限"); | 89 | uni.$u.toast("定位获取超时,请检查权限"); |
| 90 | }else{ | 90 | }else{ |
| 91 | - uni.$u.toast(location.value.longitude,location.value.latitude); | 91 | + |
| 92 | } | 92 | } |
| 93 | }, 5000); | 93 | }, 5000); |
| 94 | // 获取定位信息 | 94 | // 获取定位信息 |
garbage-removal/src/pages/order-info/order-other/detail/index.vue
| @@ -169,6 +169,7 @@ | @@ -169,6 +169,7 @@ | ||
| 169 | <view class="order-detail-container-header-item"> | 169 | <view class="order-detail-container-header-item"> |
| 170 | <text class="order-detail-container-header-title">备注:</text> | 170 | <text class="order-detail-container-header-title">备注:</text> |
| 171 | <view class="order-detail-container-header-content"> | 171 | <view class="order-detail-container-header-content"> |
| 172 | + {{ dataGram.g }} | ||
| 172 | {{ dataGram.garRemark }} | 173 | {{ dataGram.garRemark }} |
| 173 | </view> | 174 | </view> |
| 174 | </view> | 175 | </view> |