index.vue 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228
  1. <!-- 货源 -->
  2. <template>
  3. <view @touchend="end" @touchmove="move" :class="{popupShow:isShowAlert}" class="content">
  4. <!-- <fh-no-network></fh-no-network> -->
  5. <view class="banner">
  6. <image class="banner-img" src="@/static/images/goodSource/banner@2x.png" mode='widthFix'></image>
  7. <view class="head flex s-row">
  8. <view class="flex flex-space-between">
  9. <view class="flex s-row item1" @click="goCity(0)">
  10. <view class="fontsize-28 gray place-title">装车</view>
  11. <view class="fontsize-46 fontweight-500 text">{{startPlace.selected}}</view>
  12. </view>
  13. <image class="change-btn item2" src="@/static/images/goodSource/change.png" mode='widthFix'
  14. @click="changeCity"></image>
  15. <view class="flex s-row item3" @click="goCity(1)">
  16. <view class="fontsize-28 gray text-align-right place-title">卸车</view>
  17. <view class="fontsize-46 fontweight-500 text">{{endPlace.selected}}</view>
  18. </view>
  19. </view>
  20. <view>
  21. <u-button type="" class="btn-color fontsize-36" @click="upCallback({size:10,num:1})"> 查询
  22. </u-button>
  23. </view>
  24. </view>
  25. </view>
  26. <view :class="scrollTop>1200?'fixed1':''"></view>
  27. <view class="tab-view">
  28. <u-tabs :list="tabList" @click="clickTab" :lineColor="scrollTop>1200?'white':'#000000'" :current='tabIndex'
  29. :inactiveStyle="{color: scrollTop>1200?'white':'',}" :activeStyle="{
  30. color: scrollTop>1200?'':'#000000',
  31. fontWeight: 'bold',
  32. transform: 'scale(1.25)',
  33. }" :class="scrollTop>1200?'fixed':''"></u-tabs>
  34. <view class="tab-right" @click="selectType">
  35. <view>{{pickerSelect}}</view>
  36. <image style='width:8px;height:8px;margin-left:5px;'
  37. :src="!showMenu?'../../static/images/order/xiala.png':'../../static/images/order/shangla.png'"
  38. mode=""></image>
  39. <!-- <u-icon name="arrow-down" size="20"></u-icon> -->
  40. </view>
  41. </view>
  42. <u-picker :show="show" :columns="columns" :closeOnClickOverlay='true' @close='selectTypeClose'
  43. @cancel='selectTypeClose' @confirm='confirmSelectType'></u-picker>
  44. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback">
  45. <view v-for="(good,index) in goods" :key="index" @click="toDetail(good.id)">
  46. <view v-if="good.peripheralInfo==1&&isFirstIndex==index" class="other-goods">周边货源</view>
  47. <view class="good-list">
  48. <view class="good-view">
  49. <image src="@/static/images/goodSource/xf.png" mode="widthFix" class="xf-iamge"
  50. v-if="good.freightAdvance==1"></image>
  51. <view class="list-left">
  52. <view class="flex align-center">
  53. <view class="item1">
  54. <view class="ssx">
  55. {{$helper.getProvinceAbbreviation(good.sendPrivate?good.sendPrivate:good.sendCity)}}
  56. </view>
  57. <view class="level2-title">{{$helper.filterUrban(good.sendCity)}}
  58. {{$helper.filterArea(good.sendArea)}}
  59. </view>
  60. </view>
  61. <image class="jt-icon item2" src="@/static/images/goodSource/jt.png" mode='widthFix'>
  62. </image>
  63. <view class="item3">
  64. <view class="ssx">
  65. {{$helper.getProvinceAbbreviation(good.unloadPrivate?good.unloadPrivate:good.unloadCity)}}
  66. </view>
  67. <view class="level2-title">{{$helper.filterUrban(good.unloadCity)}}
  68. {{$helper.filterArea(good.unloadArea)}}
  69. </view>
  70. </view>
  71. </view>
  72. <view class="flex flex-space-between yf-style">
  73. <view class="left">
  74. <view class="flex">
  75. <view class="gray" v-if="good.cargoDistance"><text class="text-space">货距</text>
  76. <text class="text-space">{{good.cargoDistance}}km</text>
  77. </view>
  78. <view class="gray " v-if="good.distance"><text class="text-space">运距</text><text
  79. class="text-space">{{good.distance}}km</text> </view>
  80. </view>
  81. <view class="u-flex-wrap flex gray row ">
  82. <view>{{good.goodsName}}</view>
  83. <!-- <u-line direction="col"></u-line> -->
  84. <view v-if="carLength(good)"><text class="line">|</text> {{carLength(good)}}
  85. </view>
  86. <view v-if="carType(good)"><text class="line">|</text>{{carType(good)}} </view>
  87. <view v-if="carWeight(good)"><text class="line">|</text>{{carWeight(good)}}
  88. </view>
  89. </view>
  90. <view class="flex row">
  91. <view class="row-tips" v-if="good.taskDescription">{{good.taskDescription}}
  92. </view>
  93. </view>
  94. </view>
  95. <view class="right flex h-color">
  96. <text class="fontsize-46">
  97. {{good.freightPrice}}
  98. </text>
  99. <text class="flex dw">{{good.billingMethod == 0?"元/吨":"元/车"}}</text>
  100. </view>
  101. </view>
  102. </view>
  103. <!-- <view class="right gray">
  104. {{$helper.changeTime(good.updateDate)}}
  105. </view> -->
  106. </view>
  107. <view class="flex flex-space-between item-bottom">
  108. <view class="left flex row" @click.stop="cargoOwner(good)">
  109. <u--image
  110. :src="good.cargoOwnerPortrait?good.cargoOwnerPortrait:'../../static/images/mine/tx.png'"
  111. width='57rpx' height='57rpx' shape="circle">
  112. </u--image>
  113. <view class="name">{{good.cargoOwnerName}}</view>
  114. <!-- <view class="hp flex fontsize-24">
  115. <view class="gray">评分</view>
  116. <view class="number-color">99%</view>
  117. </view>
  118. <view class="sum flex fontsize-24">
  119. <view class="gray">发运次数</view>
  120. <view class="number-color">106</view>
  121. </view> -->
  122. </view>
  123. <view class="right">
  124. <view @click.stop="grabOrders(good)" class="qd" v-if='hasLogin'>抢单</view>
  125. </view>
  126. </view>
  127. </view>
  128. </view>
  129. </mescroll-body>
  130. <u-toast ref="uToast"></u-toast>
  131. <u-modal :show="isShowAlert" :title="alertTitle" :closeOnClickOverlay='true' :confirmText='confirmText'
  132. :showCancelButton='showCancelButton' confirmColor='#2772FB' @confirm="$u.throttle(confirmClick(), 1000)"
  133. @close="cancelClick" @cancel="cancelClick"></u-modal>
  134. </view>
  135. </template>
  136. <script>
  137. var that
  138. import permision from "@/js_sdk/wa-permission/permission.js"
  139. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  140. import {
  141. mapState
  142. } from 'vuex';
  143. import {
  144. apiGoods
  145. } from "@/api/mock.js"
  146. export default {
  147. mixins: [MescrollMixin], // 使用mixin
  148. data() {
  149. return {
  150. confirmText: '确定',
  151. showCancelButton: true,
  152. isFirstIndex: null,
  153. ObjSelect: {},
  154. isShowAlert: false,
  155. alertTitle: '确定抢单?',
  156. show: false,
  157. columns: [
  158. ['全部类型', '运费先付']
  159. ],
  160. startPlace: {},
  161. endPlace: {},
  162. otherGoods: [], // 数据列表
  163. goods: [], // 数据列表
  164. src: 'https://cdn.uviewui.com/uview/album/1.jpg',
  165. height: "", // 需要固定swiper的高度
  166. tabList: [
  167. // {
  168. // name: '全部'
  169. // },
  170. {
  171. name: '推荐'
  172. }, {
  173. name: '按时间'
  174. }, {
  175. name: '按距离'
  176. },
  177. // {
  178. // name: '运费先付'
  179. // },
  180. ],
  181. pickerSelect: '全部类型',
  182. tabIndex: 0,
  183. scrollTop: 0,
  184. isdblclick: 0,
  185. count: 0,
  186. lng: '',
  187. lat: '',
  188. bool: false,
  189. showMenu: false,
  190. driverCommonId: "",
  191. driverPhone: "",
  192. driverName: ""
  193. }
  194. },
  195. onTabItemTap(e) {
  196. this.isdblclick++
  197. // tab 点击时执行,此处直接接收单击事件
  198. if (this.scrollTop > 1200) {
  199. if (this.isdblclick > 1) {
  200. uni.pageScrollTo({
  201. scrollTop: 0,
  202. duration: 300
  203. });
  204. }
  205. }
  206. },
  207. created() {
  208. },
  209. computed: {
  210. ...mapState(['hasLogin', 'userInfo', 'firstAuthentication'])
  211. },
  212. watch: {
  213. // startPlace(){
  214. // console.log(this.startPlace)
  215. // this.upCallback({page});
  216. // },
  217. },
  218. onLoad() {
  219. this.checkOpenGPSServiceByAndroidIOS()
  220. },
  221. onHide() {
  222. this.isdblclick = 0
  223. },
  224. onShow() {
  225. if (this.scrollTop > 1200) {
  226. uni.setTabBarItem({
  227. index: 0,
  228. text: '返回顶部',
  229. iconPath: 's',
  230. selectedIconPath: 'static/images/common/top@2x.png'
  231. })
  232. }
  233. uni.setTabBarItem({
  234. index: 2,
  235. text: '订单',
  236. iconPath: 'static/images/common/dingdan@2x(1).png',
  237. selectedIconPath: 'static/images/common/dingdan@2x.png'
  238. })
  239. var that = this
  240. setTimeout(() => {
  241. // var photol=await permision.checkSystemEnableLocation()
  242. if (uni.getStorageSync('confirm_location')) {
  243. that.get_localtion_permission()
  244. }
  245. //获取上一次点击起装卸地
  246. if (uni.getStorageSync('fPlaceObj')) {
  247. that.startPlace = uni.getStorageSync('fPlaceObj');
  248. }
  249. if (uni.getStorageSync('sPlaceObj')) {
  250. that.endPlace = uni.getStorageSync('sPlaceObj');
  251. }
  252. that.upCallback({
  253. size: 10,
  254. num: 1
  255. })
  256. }, 1500)
  257. that.$request.baseRequest('get', '/newsInfo/unreadMessage', {
  258. reCommonId: this.userInfo.id,
  259. }).then(res3 => {
  260. if (res3.data || res3.data == 0) {
  261. let name = 'myTip';
  262. let value = res3.data
  263. if (value == 0) {
  264. uni.removeTabBarBadge({
  265. index: 3
  266. })
  267. }
  268. that.$store.commit('$uStore', {
  269. name,
  270. value
  271. });
  272. if (value != 0 && value) {
  273. uni.setTabBarBadge({
  274. index: 3,
  275. text: value + ""
  276. })
  277. }
  278. }
  279. })
  280. // this.mescroll.resetUpScroll()
  281. },
  282. // async onLoad() {
  283. // that = this
  284. // // #ifdef APP-PLUS
  285. // let _status = await that.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
  286. // driverPhone: this.userInfo.phone,
  287. // }).then(res => {
  288. // return res.data.authenticationStatus
  289. // })
  290. // // if (_status == '已禁用') {
  291. // // this.isShowAlert = true
  292. // // this.alertTitle = '账号审核中'
  293. // // this.confirmText = '退出APP'
  294. // // this.showCancelButton = false
  295. // // } else {
  296. // // console.log(1231233212332312312213)
  297. // // }
  298. // // #endif
  299. // },
  300. onPageScroll(res) {
  301. this.scrollTop = res.scrollTop
  302. // console.log("页面滚动了", res.scrollTop)
  303. if (this.scrollTop > 1200) {
  304. uni.setTabBarItem({
  305. index: 0,
  306. text: '返回顶部',
  307. iconPath: 'static/images/common/top@2x.png',
  308. selectedIconPath: 'static/images/common/top@2x.png'
  309. })
  310. } else {
  311. uni.setTabBarItem({
  312. index: 0,
  313. text: '货源',
  314. iconPath: 'static/images/common/huoyuan@2x(1).png',
  315. selectedIconPath: 'static/images/common/huoyuan@2x.png'
  316. })
  317. }
  318. },
  319. methods: {
  320. stopRoll() {
  321. },
  322. async get_localtion_permission() {
  323. var photol = await permision.checkSystemEnableLocation()
  324. if (photol == true) {
  325. uni.removeStorageSync('confirm_location')
  326. // uni.showToast({
  327. // title: '只有文字弹窗',
  328. // icon: 'none', //如果要纯文本,不要icon,将值设为'none'
  329. // duration: 2000 //持续时间为 2秒
  330. // })
  331. this.getLngLat()
  332. } else {
  333. if (uni.getStorageSync('confirm_location')) {
  334. uni.removeStorageSync('confirm_location')
  335. }
  336. uni.setStorageSync('fPlaceObj', {
  337. fchoosearea: '全部',
  338. fchoosecity: '市辖区',
  339. fchooseprovince: '北京',
  340. selected: '东城'
  341. })
  342. uni.setStorageSync('sPlaceObj', {
  343. schoosearea: '请选择区',
  344. schoosecity: '请选择市',
  345. schooseprovince: '全国',
  346. selected: '全国'
  347. })
  348. uni.setStorageSync('longitudeAndLatitude', '116.3972,39.9096')
  349. }
  350. },
  351. async getLngLat() {
  352. await uni.getLocation({
  353. type: 'gcj02',
  354. geocode: true,
  355. success: res => {
  356. if (res.latitude) {
  357. if (res.address.city) {
  358. if (res.address.city.indexOf('市') != -1) {
  359. res.address.city = res.address.city.substring(0, res.address.city
  360. .length - 1)
  361. }
  362. }
  363. if (res.address.province) {
  364. if (res.address.province.indexOf('省') != -1) {
  365. res.address.province = res.address.province.substring(0, res.address
  366. .province.length - 1)
  367. }
  368. }
  369. uni.setStorageSync('fPlaceObj', {
  370. fchoosearea: '全部',
  371. fchoosecity: res.address.city,
  372. fchooseprovince: res.address.province,
  373. selected: res.address.city
  374. })
  375. uni.setStorageSync('sPlaceObj', {
  376. schoosearea: '请选择区',
  377. schoosecity: '请选择市',
  378. schooseprovince: '全国',
  379. selected: '全国'
  380. })
  381. uni.setStorageSync('longitudeAndLatitude', res.longitude + ',' + res.latitude)
  382. }
  383. }
  384. })
  385. },
  386. checkOpenGPSServiceByAndroidIOS() {
  387. let system = uni.getSystemInfoSync(); // 获取系统信息
  388. // console.log(system);
  389. if (system.platform === 'android') { // 判断平台
  390. var context = plus.android.importClass("android.content.Context");
  391. var locationManager = plus.android.importClass("android.location.LocationManager");
  392. var main = plus.android.runtimeMainActivity();
  393. var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
  394. if (!mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)) {
  395. // uni.showModal({
  396. // title: '提示',
  397. // content: '请打开定位服务功能',
  398. // // showCancel: false, // 不显示取消按钮
  399. // success(res) {
  400. // if (res.confirm) {
  401. // uni.setStorageSync('confirm_location', 1)
  402. // if (!mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)) {
  403. // var Intent = plus.android.importClass('android.content.Intent');
  404. // var Settings = plus.android.importClass('android.provider.Settings');
  405. // var intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
  406. // main.startActivity(intent); // 打开系统设置GPS服务页面
  407. // } else {
  408. // uni.setStorageSync('fPlaceObj', {
  409. // fchoosearea: '全部',
  410. // fchoosecity: '市辖区',
  411. // fchooseprovince: '北京',
  412. // selected: '东城'
  413. // })
  414. // uni.setStorageSync('sPlaceObj', {
  415. // schoosearea: '请选择区',
  416. // schoosecity: '请选择市',
  417. // schooseprovince: '全国',
  418. // selected: '全国'
  419. // })
  420. // uni.setStorageSync('longitudeAndLatitude', '116.3972,39.9096')
  421. // }
  422. // } else {
  423. // uni.setStorageSync('fPlaceObj', {
  424. // fchoosearea: '全部',
  425. // fchoosecity: '市辖区',
  426. // fchooseprovince: '北京',
  427. // selected: '东城'
  428. // })
  429. // uni.setStorageSync('sPlaceObj', {
  430. // schoosearea: '请选择区',
  431. // schoosecity: '请选择市',
  432. // schooseprovince: '全国',
  433. // selected: '全国'
  434. // })
  435. // uni.setStorageSync('longitudeAndLatitude', '116.3972,39.9096')
  436. // }
  437. // }
  438. // });
  439. uni.setStorageSync('fPlaceObj', {
  440. fchoosearea: '全部',
  441. fchoosecity: '市辖区',
  442. fchooseprovince: '北京',
  443. selected: '东城'
  444. })
  445. uni.setStorageSync('sPlaceObj', {
  446. schoosearea: '请选择区',
  447. schoosecity: '请选择市',
  448. schooseprovince: '全国',
  449. selected: '全国'
  450. })
  451. if (uni.getStorageSync('fPlaceObj')) {
  452. that.startPlace = uni.getStorageSync('fPlaceObj');
  453. }
  454. if (uni.getStorageSync('sPlaceObj')) {
  455. that.endPlace = uni.getStorageSync('sPlaceObj');
  456. }
  457. uni.setStorageSync('longitudeAndLatitude', '116.3972,39.9096')
  458. } else {
  459. this.getLngLat()
  460. }
  461. } else if (system.platform === 'ios') {
  462. // console.log("苹果");
  463. var cllocationManger = plus.ios.import("CLLocationManager");
  464. var enable = cllocationManger.locationServicesEnabled();
  465. var status = cllocationManger.authorizationStatus();
  466. plus.ios.deleteObject(cllocationManger);
  467. if (enable && status != 2) {
  468. this.getLngLat()
  469. console.log("手机系统的定位已经打开");
  470. } else {
  471. console.log("手机系统的定位没有打开");
  472. uni.showModal({
  473. title: '提示',
  474. content: '请前往设置-隐私-定位服务打开定位服务功能',
  475. // showCancel: false, // 不显示取消按钮
  476. success(res) {
  477. if (res.confirm) {
  478. var UIApplication = plus.ios.import("UIApplication");
  479. var application2 = UIApplication.sharedApplication();
  480. var NSURL2 = plus.ios.import("NSURL");
  481. // var setting2 = NSURL2.URLWithString("prefs:root=LOCATION_SERVICES");
  482. // var setting2 = NSURL2.URLWithString("App-Prefs:root=LOCATION_SERVICES");
  483. // var setting2 = NSURL2.URLWithString("app-settings");
  484. var setting2 = NSURL2.URLWithString("App-Prefs:root=Privacy&path=LOCATION");
  485. // var setting2 = NSURL2.URLWithString("App-Prefs:root=Privacy&path=LOCATION_SERVICES");
  486. application2.openURL(setting2);
  487. plus.ios.deleteObject(setting2);
  488. plus.ios.deleteObject(NSURL2);
  489. plus.ios.deleteObject(application2);
  490. this.getLngLat()
  491. }
  492. }
  493. });
  494. }
  495. }
  496. },
  497. cargoOwner(_obj) {
  498. // uni.$u.route('/pages/order/evaluateList');
  499. // console.log("查看---------------",_obj)
  500. uni.$u.route('/pages/goodSource/cargoOwnerSee', _obj)
  501. },
  502. mescrollInit(mescroll) {
  503. this.mescroll = mescroll;
  504. },
  505. confirmClick() {
  506. let item = this.ObjSelect
  507. var that = this
  508. let _obj = {
  509. driverCommonId: that.driverCommonId,
  510. commonId: item.commonId,
  511. compId: item.compId,
  512. cargoOwnerName: item.cargoOwnerReallyName,
  513. cargoOwner: item.cargoOwner,
  514. sendPrivate: item.sendPrivate,
  515. sendCity: item.sendCity,
  516. sendArea: item.sendArea,
  517. sendDetailedAddress: item.sendDetailedAddress,
  518. unloadPrivate: item.unloadPrivate,
  519. unloadCity: item.unloadCity,
  520. unloadArea: item.unloadArea,
  521. unloadDetailedAddress: item.unloadDetailedAddress,
  522. goodsName: item.goodsName,
  523. distance: item.distance,
  524. freightPrice: item.freightPrice,
  525. driverName: that.driverName,
  526. driverPhone: that.driverPhone,
  527. cargoOwnerPhone: item.cargoOwnerPhone,
  528. id: item.id,
  529. billingMethod: item.billingMethod,
  530. freightAdvance: item.freightAdvance,
  531. goodsType: item.goodsType,
  532. goodsTypeKey: item.goodsTypeKey
  533. }
  534. console.log("查看抢单",_obj)
  535. that.$request.baseRequest('post', '/publishTaskInfo/api/addOrder', _obj).then(res => {
  536. if (res.code == 200) {
  537. that.$refs.uToast.show({
  538. type: 'success',
  539. message: "抢单成功!",
  540. complete() {
  541. uni.switchTab({
  542. url: "/pages/order/index"
  543. })
  544. }
  545. })
  546. } else {
  547. that.$refs.uToast.show({
  548. type: 'error',
  549. message: res.message,
  550. })
  551. }
  552. })
  553. .catch(res => {
  554. uni.$u.toast(res.message);
  555. });
  556. // });
  557. this.isShowAlert = false
  558. },
  559. cancelClick() {
  560. this.isShowAlert = false
  561. },
  562. carLength(good) {
  563. let length = ''
  564. if (good.carLengthSmall && good.carLength) {
  565. length = good.carLengthSmall + '~' + good.carLength + '米'
  566. } else if (good.carLengthSmall && !good.carLength) {
  567. length = "大于" + good.carLengthSmall + '米'
  568. } else if (good.carLength && !good.carLengthSmall) {
  569. length = "小于" + good.carLength + '米'
  570. }
  571. return length
  572. },
  573. carType(good) {
  574. let _val = '';
  575. if (good.carModel == 1) {
  576. _val = ''
  577. } else {
  578. if (good.carModel.includes(2)) {
  579. _val += '高栏 '
  580. }
  581. if (good.carModel.includes(3)) {
  582. _val += '集装箱 '
  583. }
  584. if (good.carModel.includes(4)) {
  585. _val += '自卸车 '
  586. }
  587. }
  588. return _val
  589. },
  590. carWeight(good) {
  591. good.loadWeightSmall
  592. good.loadWeight
  593. let weight = ''
  594. if (good.loadWeightSmall && good.loadWeight) {
  595. weight = good.loadWeightSmall + '~' + good.loadWeight + '吨'
  596. } else if (good.loadWeightSmall) {
  597. weight = "大于" + good.loadWeightSmall + '吨'
  598. } else if (good.loadWeight) {
  599. weight = "小于" + good.loadWeight + '吨'
  600. }
  601. return weight
  602. },
  603. getdate() {
  604. var date = new Date()
  605. var year = date.getFullYear() //获取完整的年份(4位)
  606. var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  607. var datetime = date.getDate() //获取当前日(1-31)
  608. if (mouth < 10) {
  609. mouth = '0' + mouth
  610. }
  611. if (datetime < 10) {
  612. datetime = '0' + datetime
  613. }
  614. return String(year) + String(mouth) + String(datetime)
  615. },
  616. grabOrders(item) {
  617. let that = this
  618. this.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
  619. driverPhone: this.userInfo.phone,
  620. }).then(res2 => {
  621. if (res2.data.authenticationStatus == '已过期') {
  622. that.$refs.uToast.show({
  623. type: 'error',
  624. message: '证件已过期,请上传新证件!',
  625. })
  626. return
  627. } else if (res2.data.authenticationStatus == '未认证' || res2.data.authenticationStatus ==
  628. '已驳回') {
  629. that.$refs.uToast.show({
  630. type: 'error',
  631. message: '请先完成司机认证!',
  632. })
  633. return
  634. } else if (res2.data.authenticationStatus == '审核中') {
  635. that.$refs.uToast.show({
  636. type: 'error',
  637. message: '司机审核中!',
  638. })
  639. return
  640. } else if (res2.data.authenticationStatus == '已认证') {
  641. this.driverCommonId = res2.data.commonId
  642. this.driverPhone = res2.data.driverPhone
  643. this.driverName = res2.data.driverName
  644. this.isShowAlert = true
  645. this.ObjSelect = item
  646. }
  647. })
  648. },
  649. confirmSelectType(val) {
  650. this.pickerSelect = val.value[0]
  651. this.show = false
  652. this.upCallback({
  653. size: 10,
  654. num: 1
  655. })
  656. },
  657. selectTypeClose() {
  658. this.show = false
  659. },
  660. selectType() {
  661. this.show = true
  662. },
  663. // getLngLat() {
  664. // var that=this
  665. // // uni.showLoading({
  666. // // title: '获取定位信息'
  667. // // })
  668. // uni.getLocation({
  669. // type: 'gcj02',
  670. // geocode: true,
  671. // success: res => {
  672. // if (res.latitude) {
  673. // console.log(res)
  674. // if(res.address.city){
  675. // if(res.address.city.indexOf('市')!=-1){
  676. // res.address.city=res.address.city.substring(0,res.address.city.length-1)
  677. // }
  678. // }
  679. // if(res.address.province){
  680. // if(res.address.province.indexOf('省')!=-1){
  681. // res.address.province=res.address.province.substring(0,res.address.province.length-1)
  682. // }
  683. // }
  684. // uni.setStorageSync('fPlaceObj',{
  685. // fchoosearea:'全部',
  686. // fchoosecity:res.address.city,
  687. // fchooseprovince:res.address.province,
  688. // selected:res.address.city
  689. // })
  690. // uni.setStorageSync('sPlaceObj',{
  691. // schoosearea:'请选择区',
  692. // schoosecity:'请选择市',
  693. // schooseprovince:'全国',
  694. // selected:'全国'
  695. // })
  696. // let _pickerSelect;
  697. // if (that.pickerSelect == '运费先付') {
  698. // _pickerSelect = 1
  699. // } else {
  700. // _pickerSelect = 0
  701. // }
  702. // that.startPlace.selected=res.address.city
  703. // that.startPlace.fchoosecity=res.address.city
  704. // let _data = {
  705. // searchKeyWord: this.tabIndex + 1,
  706. // searchType: _pickerSelect,
  707. // pageSize: 10,
  708. // currentPage: 1,
  709. // loadingPlaceCity: that.startPlace.fchoosecity,
  710. // // unLoadingPlaceCity: this.endPlace.schoosecity
  711. // }
  712. // that.$forceUpdate()
  713. // // that.$set(that.startPlace,'selected',res.address.city)
  714. // // that.lng = res.longitude;
  715. // // that.lat = res.latitude;
  716. // that.$request.baseRequest('get', '/publishTaskInfo/selectGoodsSource', _data).then(res => {
  717. // if (res.code == 200) {
  718. // console.log(res.data.records)
  719. // uni.hideLoading()
  720. // that.mescroll.endBySize(res.data.records.length, res.data.total);
  721. // if(res.data.records){
  722. // that.goods = res.data.records
  723. // for (let i = 0; i < that.goods.length; i++) {
  724. // if (that.goods[i].peripheralInfo == 1) {
  725. // that.isFirstIndex = i
  726. // return
  727. // }
  728. // }
  729. // }else{
  730. // that.goods=[]
  731. // }
  732. // }
  733. // uni.hideLoading()
  734. // })
  735. // .catch(res => {
  736. // uni.$u.toast(res.message);
  737. // that.mescroll.endErr();
  738. // });
  739. // } else {
  740. // if (uni.getSystemInfoSync().platform == 'android') {
  741. // var context = plus.android.importClass("android.content.Context");
  742. // var locationManager = plus.android.importClass(
  743. // "android.location.LocationManager");
  744. // var main = plus.android.runtimeMainActivity();
  745. // var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
  746. // that.bool = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)
  747. // }
  748. // if (that.bool === false) {
  749. // uni.showModal({
  750. // title: '提示',
  751. // content: '请打开定位服务',
  752. // success: ({
  753. // confirm,
  754. // cancel
  755. // }) => {
  756. // if (confirm) {
  757. // if (uni.getSystemInfoSync().platform == 'android') {
  758. // var Intent = plus.android.importClass(
  759. // 'android.content.Intent');
  760. // var Settings = plus.android.importClass(
  761. // 'android.provider.Settings');
  762. // var intent = new Intent(Settings
  763. // .ACTION_LOCATION_SOURCE_SETTINGS);
  764. // var main = plus.android.runtimeMainActivity();
  765. // main.startActivity(intent); // 打开系统设置GPS服务页面
  766. // }
  767. // }
  768. // }
  769. // });
  770. // }
  771. // uni.hideLoading()
  772. // }
  773. // }
  774. // });
  775. // },
  776. toDetail(id) {
  777. var that = this
  778. that.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
  779. driverPhone: this.userInfo.phone,
  780. }).then(res2 => {
  781. // console.log('跳转',1111111)
  782. uni.setStorageSync('firstAuthentication', res2.data)
  783. that.firstAuthentication = uni.getStorageSync('firstAuthentication')
  784. // console.log(that.firstAuthentication)
  785. //司机是否认证身份
  786. // 保留uni.getStorageSync('firstAuthentication'),thisfirstAuthentication有缓存问题
  787. if (uni.getStorageSync('firstAuthentication').authenticationStatus == '已认证') {
  788. uni.$u.route('/pages/goodSource/shippingDetails', {
  789. id: id,
  790. });
  791. } else if (uni.getStorageSync('firstAuthentication').authenticationStatus == '已过期') {
  792. that.$refs.uToast.show({
  793. type: 'error',
  794. message: "证件已过期,请上传新证件!",
  795. })
  796. } else {
  797. that.$refs.uToast.show({
  798. type: 'error',
  799. message: "请先完成司机认证!",
  800. })
  801. }
  802. })
  803. },
  804. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  805. upCallback(page) {
  806. var that = this
  807. let _pickerSelect;
  808. if (this.pickerSelect == '运费先付') {
  809. _pickerSelect = 1
  810. } else {
  811. _pickerSelect = 0
  812. }
  813. //选择省市区
  814. let _data = {
  815. searchKeyWord: this.tabIndex + 1,
  816. searchType: _pickerSelect,
  817. // loadingPlace: this.startPlace.selected,
  818. // unLoadingPlace: this.endPlace.selected=="全国"?'':this.endPlace.selected,
  819. pageSize: page.size,
  820. currentPage: page.num,
  821. // loadingPlaceCity: this.startPlace.fchoosecity,
  822. // unLoadingPlaceCity: this.endPlace.schoosecity
  823. }
  824. console.log(uni.getStorageSync('longitudeAndLatitude'))
  825. // if (this.tabIndex == 2) {
  826. if (uni.getStorageSync('longitudeAndLatitude')) {
  827. this.lng = uni.getStorageSync('longitudeAndLatitude').split(',')[0]
  828. this.lat = uni.getStorageSync('longitudeAndLatitude').split(',')[1]
  829. }
  830. _data.driverLongitude = this.lng
  831. _data.driverLatitude = this.lat
  832. // }
  833. console.log('------')
  834. console.log(_data)
  835. if (uni.getStorageSync('fPlaceObj')) {
  836. if (this.startPlace.fchoosearea && this.startPlace.fchoosearea == '全部' && this.startPlace
  837. .fchoosearea != '请选择区') {
  838. // _data.loadingPlaceCity = this.startPlace.fchoosecity
  839. if (this.startPlace.fchoosecity == '市辖区') {
  840. _data.loadingPlaceCity = this.startPlace.fchooseprovince
  841. } else {
  842. _data.loadingPlaceCity = this.startPlace.fchoosecity
  843. }
  844. } else if (this.startPlace.fchoosecity == '全部') {
  845. _data.loadingPlace = this.startPlace.selected
  846. } else {
  847. _data.loadingPlaceCity = this.startPlace.fchoosecity
  848. _data.loadingPlace = this.startPlace.fchoosearea
  849. }
  850. } else {
  851. _data.loadingPlaceCity = this.startPlace.fchoosecity
  852. }
  853. if (uni.getStorageSync('sPlaceObj')) {
  854. if (this.endPlace.schoosearea && this.endPlace.schoosearea == '全部' && this.endPlace.schoosearea !=
  855. '请选择区') {
  856. if (this.endPlace.schoosecity == '市辖区') {
  857. _data.unLoadingPlaceCity = this.endPlace.schooseprovince
  858. } else {
  859. _data.unLoadingPlaceCity = this.endPlace.schoosecity
  860. }
  861. } else if (this.endPlace.schoosearea) {
  862. _data.unLoadingPlace = this.endPlace.selected == "全国" ? '' : this.endPlace.selected
  863. } else {
  864. _data.unLoadingPlace = this.endPlace.selected == "全国" ? '' : this.endPlace.selected
  865. _data.unLoadingPlaceCity = this.endPlace.schoosecity
  866. }
  867. } else {
  868. _data.unLoadingPlace = this.endPlace.selected == "全国" ? '' : this.endPlace.selected
  869. }
  870. if (this.lng) {
  871. _data.longitude = this.lng
  872. _data.latitude = this.lat
  873. }
  874. uni.showLoading({
  875. mask: true,
  876. title: '加载中'
  877. })
  878. console.log(_data)
  879. this.$request.baseRequest('get', '/publishTaskInfo/selectGoodsSource', _data).then(res => {
  880. uni.hideLoading()
  881. if (res.code == 200) {
  882. if (page.num == 1) {
  883. this.goods = [];
  884. // this.otherGoods = []
  885. };
  886. if (res.data.records) {
  887. for (var i = 0; i < res.data.records.length; i++) {
  888. if (res.data.records[i].cargoDistance) {
  889. if (res.data.records[i].cargoDistance > 10) {
  890. res.data.records[i].cargoDistance = res.data.records[i].cargoDistance
  891. .toFixed(0)
  892. } else {
  893. res.data.records[i].cargoDistance = res.data.records[i].cargoDistance
  894. .toFixed(1)
  895. }
  896. }
  897. if (res.data.records[i].distance) {
  898. if (res.data.records[i].distance > 10) {
  899. res.data.records[i].distance = res.data.records[i].distance.toFixed(0)
  900. } else {
  901. res.data.records[i].distance = res.data.records[i].distance.toFixed(1)
  902. }
  903. }
  904. }
  905. }
  906. this.mescroll.endBySize(res.data.records.length, res.data.total);
  907. // for (var i = 0; i < res.data.records.length; i++) {
  908. // res.data.records[i].cargoOwnerName1=
  909. // }
  910. //如果是第一页需手动制空列表
  911. if (res.data.records) {
  912. that.goods = that.goods.concat(res.data.records);
  913. for (let i = 0; i < that.goods.length; i++) {
  914. if (that.goods[i].peripheralInfo == 1) {
  915. that.isFirstIndex = i
  916. return
  917. }
  918. }
  919. } else {
  920. that.goods = []
  921. }
  922. }
  923. })
  924. .catch(res => {
  925. uni.hideLoading()
  926. uni.$u.toast(res.message);
  927. this.mescroll.endErr();
  928. });
  929. },
  930. clickTab(val) {
  931. this.tabIndex = val.index
  932. this.upCallback({
  933. size: 10,
  934. num: 1,
  935. })
  936. },
  937. changeCity() {
  938. if (this.endPlace.selected == '全国') {
  939. this.$refs.uToast.show({
  940. type: 'error',
  941. message: "装车地不能为全国!",
  942. })
  943. return
  944. }
  945. [this.startPlace.fchooseprovince, this.endPlace.schooseprovince] = [this.endPlace.schooseprovince, this
  946. .startPlace.fchooseprovince
  947. ];
  948. [this.startPlace.fchoosecity, this.endPlace.schoosecity] = [this.endPlace.schoosecity, this.startPlace
  949. .fchoosecity
  950. ];
  951. [this.startPlace.fchoosearea, this.endPlace.schoosearea] = [this.endPlace.schoosearea, this.startPlace
  952. .fchoosearea
  953. ];
  954. [this.startPlace.selected, this.endPlace.selected] = [this.endPlace.selected, this.startPlace.selected];
  955. // [this.startPlace, this.endPlace] = [this.endPlace, this.startPlace];
  956. uni.setStorageSync('fPlaceObj', this.startPlace);
  957. uni.setStorageSync('sPlaceObj', this.endPlace);
  958. },
  959. goCity(type) {
  960. uni.$u.route('/pages/goodSource/selectCity', {
  961. startPlace: JSON.stringify(this.startPlace),
  962. endPlace: JSON.stringify(this.endPlace),
  963. type: type
  964. });
  965. },
  966. swiperChange(e) {
  967. this.tabIndex = e.detail.current
  968. }
  969. }
  970. }
  971. </script>
  972. <style scoped lang="scss">
  973. .popupShow {
  974. overflow: hidden;
  975. position: fixed;
  976. height: 100vh;
  977. width: 100%;
  978. }
  979. .content {
  980. background: #F2F4F7;
  981. }
  982. .banner {
  983. width: 100%;
  984. position: relative;
  985. }
  986. .u-flex-wrap {
  987. flex-wrap: wrap;
  988. }
  989. .fixed,
  990. .fixed1 {
  991. background: linear-gradient(97deg, #4FABFD 0%, #2772FB 100%);
  992. position: fixed;
  993. top: var(--status-bar-height);
  994. z-index: 999;
  995. // width: calc(100% - 40rpx);
  996. width: 100%;
  997. // margin:0 20rpx;
  998. }
  999. .fixed1 {
  1000. top: 0;
  1001. height: var(--status-bar-height);
  1002. background: linear-gradient(97deg, #4FABFD 0%, #2772FB 100%);
  1003. }
  1004. .banner-img {
  1005. width: 100%;
  1006. }
  1007. .head {
  1008. position: absolute;
  1009. width: calc(100% - 108rpx);
  1010. bottom: 0;
  1011. background: white;
  1012. margin: 0 20rpx;
  1013. border-radius: 20rpx;
  1014. padding: 33rpx 33rpx 48rpx 33rpx;
  1015. .item1,
  1016. .item3 {
  1017. width: 40%;
  1018. .text {
  1019. text-overflow: ellipsis;
  1020. overflow: hidden;
  1021. white-space: nowrap;
  1022. }
  1023. }
  1024. .item1 .text {
  1025. text-align: left;
  1026. }
  1027. .item3 .text {
  1028. text-align: right;
  1029. }
  1030. }
  1031. .change-btn {
  1032. width: 86rpx;
  1033. height: 86rpx;
  1034. }
  1035. .good-list {
  1036. background-color: white;
  1037. margin: 10px 10px 15px 10px;
  1038. // padding: 10px 0px 0px 0;
  1039. border-radius: 30rpx;
  1040. box-shadow: 0px 5rpx 20rpx #E3E3E3;
  1041. .good-view {
  1042. padding: 10rpx 35rpx 10rpx 35rpx;
  1043. position: relative;
  1044. }
  1045. .item1,
  1046. .item3 {
  1047. // width: 40%;
  1048. display: flex;
  1049. .text {
  1050. text-overflow: ellipsis;
  1051. overflow: hidden;
  1052. white-space: nowrap;
  1053. }
  1054. }
  1055. .item1 .text {
  1056. text-align: left;
  1057. }
  1058. .item3 .text {
  1059. text-align: right;
  1060. }
  1061. }
  1062. .jt-icon {
  1063. position: relative;
  1064. // top: 6rpx;
  1065. width: 60rpx;
  1066. margin: 0 20rpx;
  1067. }
  1068. .row {
  1069. margin: 10rpx 0;
  1070. align-items: center;
  1071. }
  1072. .item-bottom {
  1073. background: #F0F5FF;
  1074. padding: 23rpx 30rpx;
  1075. border-radius: 0px 0px 18px 18px;
  1076. .name {
  1077. font-size: 26rpx;
  1078. font-weight: 700;
  1079. color: #000000;
  1080. margin-left: 30rpx;
  1081. }
  1082. .hp {
  1083. margin: 30rpx;
  1084. }
  1085. .number-color {
  1086. margin: 0 10rpx;
  1087. }
  1088. .qd {
  1089. background: linear-gradient(97deg, #4FABFD 0%, #2772FB 100%);
  1090. border-radius: 13rpx;
  1091. font-size: 29rpx;
  1092. font-weight: 400;
  1093. color: #FFFFFF;
  1094. padding: 15rpx 35rpx;
  1095. }
  1096. }
  1097. .dw {
  1098. align-items: center;
  1099. }
  1100. .place {
  1101. height: var(--status-bar-height);
  1102. }
  1103. .tab-view {
  1104. display: flex;
  1105. align-items: center;
  1106. justify-content: space-between;
  1107. padding-left: 20rpx;
  1108. }
  1109. .tab-right {
  1110. display: flex;
  1111. margin-right: 39rpx;
  1112. align-items: center;
  1113. }
  1114. .other-goods {
  1115. // background: red;
  1116. color: #999999;
  1117. margin: 40rpx 0;
  1118. display: flex;
  1119. justify-content: center;
  1120. font-size: 36rpx;
  1121. }
  1122. .level2-title {
  1123. font-size: 28rpx;
  1124. }
  1125. .yf-style {
  1126. position: relative;
  1127. .left {
  1128. font-size: 25.39rpx;
  1129. .text-space {
  1130. margin-right: 20rpx;
  1131. }
  1132. .line {
  1133. margin: 0 10rpx;
  1134. }
  1135. }
  1136. .h-color {
  1137. // position: absolute;
  1138. // right: 0;
  1139. // top: -30rpx;
  1140. }
  1141. }
  1142. .xf-iamge {
  1143. width: 74rpx;
  1144. height: 43rpx;
  1145. position: absolute;
  1146. top: -20rpx;
  1147. right: 0;
  1148. }
  1149. .place-title {
  1150. margin-bottom: 11rpx;
  1151. }
  1152. .btn-color {
  1153. margin-top: 52rpx;
  1154. padding: 30rpx 0;
  1155. }
  1156. </style>