Commit c7a083a51d4b9cc8847f924a29ca8c3cf6e426be

Authored by lxf
1 parent d564572a

fix: 货源

Showing 1 changed file with 16 additions and 42 deletions   Show diff stats
pages/goodSource/add.vue
... ... @@ -117,7 +117,6 @@
117 117 </template>
118 118 <script>
119 119 import { urlParam } from '@/utils/param';
120   -import { formatLngLat } from '@/utils/format-value';
121 120 import { mapGetters } from 'vuex';
122 121 import dayjs from 'dayjs';
123 122 export default {
... ... @@ -322,48 +321,24 @@ export default {
322 321 });
323 322 },
324 323 selectAddress(index) {
  324 + uni.$once('select-detail', location => {
  325 + let station = {
  326 + lng: location.lng,
  327 + lat: location.lat,
  328 + provinceCode: location.provinceCode || '',
  329 + provinceName: location.provinceName || '',
  330 + cityCode: location.cityCode || '',
  331 + cityName: location.cityName || '',
  332 + areaCode: location.areaCode || '',
  333 + areaName: location.areaName || '',
  334 + address: location.address || '',
  335 + };
  336 + this.waypoints = index === 0 ? [station, this.waypoints[1]] : [this.waypoints[0], station];
  337 + this.computedDistance();
  338 + });
325 339 let lat = this.waypoints[index].lat ? Number(this.waypoints[index].lat) : '';
326 340 let lng = this.waypoints[index].lng ? Number(this.waypoints[index].lng) : '';
327   - wx.chooseLocation({
328   - latitude: lat ? Number(lat) : undefined,
329   - longitude: lng ? Number(lng) : undefined,
330   - })
331   - .then(res => {
332   - return formatLngLat({ lng: res.longitude, lat: res.latitude });
333   - })
334   - .then(location => {
335   - let station = {
336   - lng: location.lng,
337   - lat: location.lat,
338   - provinceCode: location.provinceCode,
339   - provinceName: location.provinceName,
340   - cityCode: location.cityCode,
341   - cityName: location.cityName,
342   - areaCode: location.areaCode,
343   - areaName: location.areaName,
344   - address: (location.provinceName || '') + (location.cityName || '') + (location.areaName || '') + (location.address || ''),
345   - };
346   - this.waypoints = index === 0 ? [station, this.waypoints[1]] : [this.waypoints[0], station];
347   - this.computedDistance();
348   - });
349   - // uni.$once('select-detail', location => {
350   - // let station = {
351   - // lng: location.lng,
352   - // lat: location.lat,
353   - // provinceCode: location.provinceCode,
354   - // provinceName: location.provinceName,
355   - // cityCode: location.cityCode,
356   - // cityName: location.cityName,
357   - // areaCode: location.areaCode,
358   - // areaName: location.areaName,
359   - // address: (location.provinceName || '') + (location.cityName || '') + (location.areaName || '') + (location.address || ''),
360   - // };
361   - // this.waypoints = index === 0 ? [station, this.waypoints[1]] : [this.waypoints[0], station];
362   - // });
363   - // let type = index === 0 ? 'getStartLatestAddress' : 'getEndLatestAddress';
364   - // let lat = this.waypoints[index].lat ? Number(this.waypoints[index].lat) : '';
365   - // let lng = this.waypoints[index].lng ? Number(this.waypoints[index].lng) : '';
366   - // uni.navigateTo({ url: `/pages/global/search-address?type=${type}&lng=${lng}&lat=${lat}` });
  341 + uni.navigateTo({ url: `/pages/global/search-address?lng=${lng}&lat=${lat}` });
367 342 },
368 343 computedDistance() {
369 344 if (this.waypoints[0].lng && this.waypoints[1].lng) {
... ... @@ -408,7 +383,6 @@ export default {
408 383 uni.$u.api.freightGoodsSourceV2[opType]({ ...this.form, ...startAddressObj, ...endAddressObj })
409 384 .then(res => {
410 385 if (res.success) {
411   - this.form = {};
412 386 uni.showToast({ title: '成功', icon: 'none' });
413 387 this.getOpenerEventChannel().emit('refreshData');
414 388 setTimeout(() => uni.navigateBack(), 1000);
... ...