index.vue 33 KB

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