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 | 107 | </view> |
| 108 | 108 | </view> |
| 109 | 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 | 133 | <view v-if="paramFrom.garInCarStore" class="company-in-car-store-box-info"> |
| 111 | 134 | <view class="company-clean-container-site-image-info-input-remark-box"> |
| 112 | 135 | <u--textarea v-model="paramFrom.remark" placeholder="请填写限制高度(米)"></u--textarea> |
| ... | ... | @@ -251,6 +274,7 @@ |
| 251 | 274 | carType: "", |
| 252 | 275 | garbageType: "装修垃圾", |
| 253 | 276 | garInCarStore: false, |
| 277 | + needFollowCar: false, | |
| 254 | 278 | garEstimatedCost: "" |
| 255 | 279 | }) |
| 256 | 280 | const dayTime = ref() |
| ... | ... | @@ -564,7 +588,9 @@ |
| 564 | 588 | garLongitude: userAddress.value.garLongitude, |
| 565 | 589 | garLatitude: userAddress.value.garLatitude, |
| 566 | 590 | garCoordinate: userAddress.value.garCoordinate, |
| 567 | - garInCarStore: paramFrom.value.garInCarStore | |
| 591 | + garInCarStore: paramFrom.value.garInCarStore, | |
| 592 | + needFollowCar: paramFrom.value.needFollowCar, | |
| 593 | + | |
| 568 | 594 | } |
| 569 | 595 | console.log("----------------------->5"); |
| 570 | 596 | if (!validateParams(params)) { |
| ... | ... | @@ -634,7 +660,7 @@ |
| 634 | 660 | } |
| 635 | 661 | for (const key in params) { |
| 636 | 662 | // 跳过garInCarStore |
| 637 | - if (key == "garInCarStore") { | |
| 663 | + if (key == "garInCarStore"||key == "needFollowCar") { | |
| 638 | 664 | continue; |
| 639 | 665 | } |
| 640 | 666 | if (!params[key] && key != "garRemark") { | ... | ... |
garbage-removal/src/pages/order-info/order-disposal/scan-detail/index.vue
| ... | ... | @@ -47,6 +47,7 @@ |
| 47 | 47 | {{ details.garHandlerCarCode }} |
| 48 | 48 | </view> |
| 49 | 49 | </view> |
| 50 | + | |
| 50 | 51 | <view class="scan-car-num"> |
| 51 | 52 | <view class="scan-car-num-label"> |
| 52 | 53 | 车辆载重 |
| ... | ... | @@ -56,6 +57,15 @@ |
| 56 | 57 | v-model="details.garCarryingWeight" @change="handlerInputChange"></up-input> |
| 57 | 58 | </view> |
| 58 | 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 | 69 | <!-- <view class="scan-upload-fill-image-box"> |
| 60 | 70 | <view class="scan-upload-fill-image-label"> |
| 61 | 71 | <view> |
| ... | ... | @@ -117,22 +127,57 @@ |
| 117 | 127 | longitude: ll[0], |
| 118 | 128 | latitude: ll[1] |
| 119 | 129 | }; |
| 130 | + // 获取定位后计算运距 | |
| 131 | + calculateDistance(); | |
| 120 | 132 | } |
| 121 | - | |
| 133 | + | |
| 122 | 134 | // 生命周期处理 |
| 123 | 135 | onMounted(() => { |
| 124 | 136 | // 挂载全局回调 |
| 125 | 137 | window.takeLocationCallBack = takeLocalCallBack |
| 126 | 138 | }) |
| 127 | - | |
| 139 | + | |
| 128 | 140 | onLoad((options) => { |
| 129 | 141 | // 获取定位信息 |
| 130 | 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 | 180 | const takeLocation = () => { |
| 134 | - console.log("获取定位信息"); | |
| 135 | - // 获取定位信息 | |
| 136 | 181 | window.JsInterface.takeLocation(); |
| 137 | 182 | } |
| 138 | 183 | |
| ... | ... | @@ -184,7 +229,6 @@ |
| 184 | 229 | console.log(val); |
| 185 | 230 | } |
| 186 | 231 | const handlerSubmit = async () => { |
| 187 | - | |
| 188 | 232 | // 校验参数 |
| 189 | 233 | let params = { |
| 190 | 234 | ...details.value, |
| ... | ... | @@ -193,7 +237,8 @@ |
| 193 | 237 | garOrderHandlerCompanyId: details.value.garOrderCompanyId, |
| 194 | 238 | // 添加定位信息 |
| 195 | 239 | latitude: location.value.latitude, |
| 196 | - longitude: location.value.longitude | |
| 240 | + longitude: location.value.longitude, | |
| 241 | + transportDistance : details.value.transportDistance | |
| 197 | 242 | } |
| 198 | 243 | if (validateParams(params)) { |
| 199 | 244 | await askTransport(params).then((res) => { |
| ... | ... | @@ -266,7 +311,6 @@ |
| 266 | 311 | if (options.garAskId) { |
| 267 | 312 | // TODO query |
| 268 | 313 | scanDetail(options.garAskId).then((res) => { |
| 269 | - console.log(res); | |
| 270 | 314 | details.value = res.data.data; |
| 271 | 315 | details.value.garOrderCompanyName = details.value.garOrderHandlerCompanyName; |
| 272 | 316 | fileList.value = details.value.fillImageList.map((item) => { | ... | ... |
garbage-removal/src/pages/order-info/order-driver/detail/index.vue
| ... | ... | @@ -126,6 +126,10 @@ |
| 126 | 126 | {{ dataGram.garRemark }} |
| 127 | 127 | </view> |
| 128 | 128 | </view> |
| 129 | + | |
| 130 | + <view v-if="dataGram.needFollowCar" class="follow-car-notice"> | |
| 131 | + <text style="color: red;">该订单需要跟车</text> | |
| 132 | + </view> | |
| 129 | 133 | </view> |
| 130 | 134 | <!-- 处理信息 --> |
| 131 | 135 | <view class="order-detail-container-box-card"> | ... | ... |
garbage-removal/src/pages/order-info/order-driver/upload/index.vue
garbage-removal/src/pages/order-info/order-other/detail/index.vue
| ... | ... | @@ -169,6 +169,7 @@ |
| 169 | 169 | <view class="order-detail-container-header-item"> |
| 170 | 170 | <text class="order-detail-container-header-title">备注:</text> |
| 171 | 171 | <view class="order-detail-container-header-content"> |
| 172 | + {{ dataGram.g }} | |
| 172 | 173 | {{ dataGram.garRemark }} |
| 173 | 174 | </view> |
| 174 | 175 | </view> | ... | ... |