index.vue 35 KB

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