index.vue 34 KB

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