Commit d1cb44617638c3a6d394abb0216ce2d5f8365bd6
1 parent
789ce9cb
下单车辆信息展示修改
Showing
1 changed file
with
64 additions
and
83 deletions
garbage-removal/src/pages/home-info/clean/index.vue
| ... | ... | @@ -30,50 +30,43 @@ |
| 30 | 30 | </view> |
| 31 | 31 | </view> |
| 32 | 32 | </view> |
| 33 | + | |
| 33 | 34 | <view class="company-clean-container-car-main"> |
| 34 | 35 | <view class="company-clean-container-car-main-content"> |
| 35 | - <view v-if="paramFrom.carType" class="company-clean-container-car-main-content-type"> | |
| 36 | + <view class="company-clean-container-car-main-content-type"> | |
| 36 | 37 | <view class="company-clean-container-car-main-content-type-price-area"> |
| 37 | 38 | <text style="color: red;">*</text>车辆信息: |
| 38 | 39 | </view> |
| 39 | - <view style=" width:100%;display:flex; color:#909399; align-items: center;"> | |
| 40 | - <myPiker :parentValue="paramFrom.carType" @change="handlePickerCarInfoConfirm" | |
| 41 | - :modelValue="paramFrom.carType" :array="candidates" :title="'车辆信息'"> | |
| 42 | - </myPiker> | |
| 43 | - </view> | |
| 44 | 40 | </view> |
| 45 | - <view class="company-clean-container-car-main-content-img"> | |
| 46 | - <image class="company-clean-container-car-main-content-img" :src="carFront" /> | |
| 41 | + | |
| 42 | + <view> | |
| 43 | + <swiper style="height: 588rpx;" @change="onChangeSwiper" indicator-dots circular > | |
| 44 | + <swiper-item v-for="(car,index) in garCarInfoList" :key="index" > | |
| 45 | + <view style="font-size: 16px;text-align: center;"><text>{{car.carType}}</text></view> | |
| 46 | + <view><image :src="combinationImagePath(car)" ></image></view> | |
| 47 | + <view><text style="color:#909399;font-size: 14px;">{{car.remark}}</text></view> | |
| 48 | + </swiper-item> | |
| 49 | + </swiper> | |
| 47 | 50 | </view> |
| 48 | - <view class="company-clean-container-car-main-content-remark" style="margin: 20rpx 0; font-size: 23rpx;"> | |
| 49 | - {{ garCarTransportInfo }} | |
| 51 | + | |
| 52 | + <view class="company-clean-container-car-main-content-type"> | |
| 53 | + <view class="company-clean-container-car-main-content-type-price-area"> | |
| 54 | + <text style="color: red;">*</text>车辆容积: | |
| 55 | + </view> | |
| 56 | + <view style=" width:100%;display:flex; color:#909399; align-items: center;"> | |
| 57 | + <text>{{containerVolume}} 方</text> | |
| 58 | + </view> | |
| 50 | 59 | </view> |
| 51 | - <view class=" company-clean-container-car-main-content"> | |
| 52 | - <view class="company-clean-container-car-popup"> | |
| 53 | - <!-- 主要内容 --> | |
| 54 | - <view class="company-clean-container-car-popup-content"> | |
| 55 | - <view class="company-clean-container-car-popup-content-title"> | |
| 56 | - <view style="text-align: left;"> | |
| 57 | - <text style="color: red;">*</text>车辆选择: | |
| 58 | - </view> | |
| 59 | - </view> | |
| 60 | - <view class="company-clean-container-car-popup-content-box"> | |
| 61 | - <view class="company-clean-container-car-popup-content-box-item" | |
| 62 | - v-for="(item, index) in garCarInfoList" :key="index"> | |
| 63 | - <view class="company-clean-container-car-popup-content-box-item-text"> | |
| 64 | - {{ item.garOrderCarType }} | |
| 65 | - </view> | |
| 66 | - <view class="company-clean-container-car-popup-content-box-item-number" | |
| 67 | - hover-class="hoverClickStyle"> | |
| 68 | - <u-number-box :min="0" :max="9999" integer buttonSize="46" :inputWidth="100" | |
| 69 | - v-model="garCarInfoList[item.garOrderCarType].garOrderCarNumber" | |
| 70 | - :disabledInput="true"></u-number-box> | |
| 71 | - </view> | |
| 72 | - </view> | |
| 73 | - </view> | |
| 74 | - </view> | |
| 60 | + | |
| 61 | + <view class="company-clean-container-car-main-content-type"> | |
| 62 | + <view class="company-clean-container-car-main-content-type-price-area"> | |
| 63 | + <text style="color: red;">*</text>添加车辆数量: | |
| 64 | + </view> | |
| 65 | + <view style=" width:100%;display:flex; color:#909399; align-items: center;"> | |
| 66 | + <u-number-box :min="0" :max="9999" integer buttonSize="46" :inputWidth="100" :disabledInput="true" v-model="carNumber[swiperIndex]" @change="numberBoxChange"></u-number-box> | |
| 75 | 67 | </view> |
| 76 | 68 | </view> |
| 69 | + | |
| 77 | 70 | <view class="company-clean-container-car-main-content-type"> |
| 78 | 71 | <view class="company-clean-container-car-main-content-type-price-area"> |
| 79 | 72 | <text style="color: red;">*</text>垃圾类型: |
| ... | ... | @@ -204,37 +197,11 @@ const isCallBtn = ref(false); |
| 204 | 197 | const garCarInfoList = ref({}) |
| 205 | 198 | const garCarLabelInfoList = ref({}) |
| 206 | 199 | const garCarLabelInfoNow = ref() |
| 207 | -const garCarTransportInfo = computed(() => { | |
| 208 | - try { | |
| 209 | - let carInfo = garCarLabelInfoNow.value | |
| 210 | - let lengthWidthHeight = carInfo.lengthWidthHeight.split(";"); | |
| 211 | - let boxLength = lengthWidthHeight[0]; // 箱子的长度(单位:米) | |
| 212 | - let boxWidth = lengthWidthHeight[1]; // 箱子的宽度(单位:米) | |
| 213 | - let boxHeight = lengthWidthHeight[2]; // 箱子的高度(单位:米) | |
| 214 | - let bagLength = 0.75; // 袋子的长度(单位:米) | |
| 215 | - let bagWidth = 0.45; // 袋子的宽度(单位:米) | |
| 216 | - let bagHeight = 0.16; // 袋子的高度(单位:米) | |
| 217 | - | |
| 218 | - let boxVolume = boxLength * boxWidth * boxHeight; // 箱子的体积(单位:立方米) | |
| 219 | - let bagVolume = bagLength * bagWidth * bagHeight; // 袋子的体积(单位:立方米) | |
| 220 | - | |
| 221 | - let bagCount = Math.floor(boxVolume / bagVolume); // 箱子可以容纳的袋子数量(向下取整) | |
| 222 | - return `箱体长${boxLength}m宽${boxWidth}m高${boxHeight}m,最多课容纳约${bagCount}袋袋装修垃圾(${bagLength * 100}cm * ${bagWidth * 100}cm每袋)。` | |
| 223 | - } catch (error) { | |
| 224 | - return "符合装修垃圾运输管理规范的专用运输车辆。" | |
| 225 | - } | |
| 226 | -}) | |
| 200 | +const swiperIndex =ref(0) | |
| 201 | +const containerVolume=ref("") | |
| 202 | +const carNumber=ref([]); | |
| 227 | 203 | // 车辆数量 |
| 228 | -const garCarNumberCount = computed(() => { | |
| 229 | - let count = 0; | |
| 230 | - if (garCarInfoList.value) { | |
| 231 | - for (const key in garCarInfoList.value) { | |
| 232 | - const element = garCarInfoList.value[key]; | |
| 233 | - count = typeof element.garOrderCarNumber === 'number' ? count + element.garOrderCarNumber : count; | |
| 234 | - } | |
| 235 | - } | |
| 236 | - return count; | |
| 237 | -}) | |
| 204 | +const garCarNumberCount = ref() | |
| 238 | 205 | const garbageTypeList = ref(["装修垃圾", "建筑垃圾"]) |
| 239 | 206 | const paramFrom = ref({ |
| 240 | 207 | carNumber: 0, |
| ... | ... | @@ -268,6 +235,27 @@ const changeAgree = (e) => { |
| 268 | 235 | const onChange = (e) => { |
| 269 | 236 | } |
| 270 | 237 | |
| 238 | +const onChangeSwiper=(e)=>{ | |
| 239 | + swiperIndex.value = e.detail.current; | |
| 240 | + containerVolume.value = garCarInfoList.value[e.detail.current].containerVolume; | |
| 241 | +} | |
| 242 | + | |
| 243 | +const numberBoxChange=(value)=>{ | |
| 244 | + garCarInfoList.value[swiperIndex.value].garOrderCarNumber=value.value; | |
| 245 | + carNumber.value[swiperIndex.value]=value.value; | |
| 246 | + if(!garCarNumberCount.value){ | |
| 247 | + garCarNumberCount.value=0; | |
| 248 | + } | |
| 249 | + let va = 0; | |
| 250 | + console.log(garCarInfoList.value[swiperIndex.value].garOrderCarNumber); | |
| 251 | + carNumber.value.forEach(function(item,index,arr){ | |
| 252 | + if(item){ | |
| 253 | + va = va+item; | |
| 254 | + } | |
| 255 | + }) | |
| 256 | + | |
| 257 | + garCarNumberCount.value = va; | |
| 258 | +} | |
| 271 | 259 | /** |
| 272 | 260 | * 初始化信息 |
| 273 | 261 | */ |
| ... | ... | @@ -275,6 +263,11 @@ onLoad((options) => { |
| 275 | 263 | initOptions(options); |
| 276 | 264 | }) |
| 277 | 265 | |
| 266 | + | |
| 267 | +const combinationImagePath=(car)=>{ | |
| 268 | + return import.meta.env.VITE_BASE_URL+"/"+car.carLeft; | |
| 269 | +} | |
| 270 | + | |
| 278 | 271 | const initOptions = async (options) => { |
| 279 | 272 | companyObj.value = JSON.parse(options.companyObj); |
| 280 | 273 | tel.value = options.tel; |
| ... | ... | @@ -298,24 +291,9 @@ const initOptions = async (options) => { |
| 298 | 291 | return |
| 299 | 292 | } |
| 300 | 293 | queryCarList({ companyId: companyObj.value.id }).then(res => { |
| 301 | - // 设置车辆类型 | |
| 302 | - candidates.value = [...new Set(res.data.rows | |
| 303 | - .filter(item => item.containerVolume) | |
| 304 | - .map(item => { | |
| 305 | - garCarLabelInfoList.value[item.containerVolume + "方车"] = item | |
| 306 | - return item.containerVolume + "方车" | |
| 307 | - })) | |
| 308 | - ]; | |
| 309 | - // 设置初始车辆数量 | |
| 310 | - candidates.value.forEach((item, index) => { | |
| 311 | - garCarInfoList.value[item] = { | |
| 312 | - garOrderCarNumber: 0, | |
| 313 | - garOrderCarType: item | |
| 314 | - } | |
| 315 | - }) | |
| 316 | - // 设置默认车辆 | |
| 317 | - paramFrom.value.carType = candidates.value[0]; | |
| 318 | - garCarLabelInfoNow.value = garCarLabelInfoList.value[paramFrom.value.carType] | |
| 294 | + | |
| 295 | + garCarInfoList.value=res.data.rows; | |
| 296 | + | |
| 319 | 297 | }) |
| 320 | 298 | } |
| 321 | 299 | |
| ... | ... | @@ -386,7 +364,10 @@ const orderClick = ref(true) |
| 386 | 364 | const handleOderSure = async () => { |
| 387 | 365 | let garCarInfos = []; |
| 388 | 366 | for (const key in garCarInfoList.value) { |
| 389 | - garCarInfos.push(garCarInfoList.value[key]) | |
| 367 | + if(garCarInfoList.value[key]&& garCarInfoList.value[key].garOrderCarNumber && garCarInfoList.value[key].garOrderCarNumber>0){ | |
| 368 | + garCarInfos.push(garCarInfoList.value[key]); | |
| 369 | + } | |
| 370 | + | |
| 390 | 371 | } |
| 391 | 372 | |
| 392 | 373 | let params = { | ... | ... |