index.vue 35 KB

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