index.vue 32 KB

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