index.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143
  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">元/吨</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. uni.hideLoading()
  830. if (res.code == 200) {
  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.hideLoading()
  873. uni.$u.toast(res.message);
  874. this.mescroll.endErr();
  875. });
  876. },
  877. clickTab(val) {
  878. this.tabIndex = val.index
  879. this.upCallback({
  880. size: 10,
  881. num: 1,
  882. })
  883. },
  884. changeCity() {
  885. if (this.endPlace.selected == '全国') {
  886. this.$refs.uToast.show({
  887. type: 'error',
  888. message: "装车地不能为全国!",
  889. })
  890. return
  891. }
  892. [this.startPlace.fchooseprovince, this.endPlace.schooseprovince] = [this.endPlace.schooseprovince, this
  893. .startPlace.fchooseprovince
  894. ];
  895. [this.startPlace.fchoosecity, this.endPlace.schoosecity] = [this.endPlace.schoosecity, this.startPlace
  896. .fchoosecity
  897. ];
  898. [this.startPlace.fchoosearea, this.endPlace.schoosearea] = [this.endPlace.schoosearea, this.startPlace
  899. .fchoosearea
  900. ];
  901. [this.startPlace.selected, this.endPlace.selected] = [this.endPlace.selected, this.startPlace.selected];
  902. // [this.startPlace, this.endPlace] = [this.endPlace, this.startPlace];
  903. uni.setStorageSync('fPlaceObj', this.startPlace);
  904. uni.setStorageSync('sPlaceObj', this.endPlace);
  905. },
  906. goCity(type) {
  907. uni.$u.route('/pages/goodSource/selectCity', {
  908. startPlace: JSON.stringify(this.startPlace),
  909. endPlace: JSON.stringify(this.endPlace),
  910. type: type
  911. });
  912. },
  913. swiperChange(e) {
  914. this.tabIndex = e.detail.current
  915. }
  916. }
  917. }
  918. </script>
  919. <style scoped lang="scss">
  920. .popupShow {
  921. overflow: hidden;
  922. position: fixed;
  923. height: 100vh;
  924. width: 100%;
  925. }
  926. .content {
  927. background: #F2F4F7;
  928. }
  929. .banner {
  930. width: 100%;
  931. position: relative;
  932. }
  933. .u-flex-wrap{
  934. flex-wrap: wrap;
  935. }
  936. .fixed,
  937. .fixed1 {
  938. background: linear-gradient(97deg, #4FABFD 0%, #2772FB 100%);
  939. position: fixed;
  940. top: var(--status-bar-height);
  941. z-index: 999;
  942. // width: calc(100% - 40rpx);
  943. width: 100%;
  944. // margin:0 20rpx;
  945. }
  946. .fixed1 {
  947. top: 0;
  948. height: var(--status-bar-height);
  949. background: linear-gradient(97deg, #4FABFD 0%, #2772FB 100%);
  950. }
  951. .banner-img {
  952. width: 100%;
  953. }
  954. .head {
  955. position: absolute;
  956. width: calc(100% - 108rpx);
  957. bottom: 0;
  958. background: white;
  959. margin: 0 20rpx;
  960. border-radius: 20rpx;
  961. .item1,
  962. .item3 {
  963. width: 40%;
  964. .text {
  965. text-overflow: ellipsis;
  966. overflow: hidden;
  967. white-space: nowrap;
  968. }
  969. }
  970. .item1 .text {
  971. text-align: left;
  972. }
  973. .item3 .text {
  974. text-align: right;
  975. }
  976. }
  977. .change-btn {
  978. width: 86rpx;
  979. height: 86rpx;
  980. }
  981. .good-list {
  982. background-color: white;
  983. margin: 10px 10px 15px 10px;
  984. padding: 10px 0px 0px 0;
  985. border-radius: 30rpx;
  986. box-shadow: 0px 5rpx 20rpx #E3E3E3;
  987. .item1,
  988. .item3 {
  989. // width: 40%;
  990. display: flex;
  991. .text {
  992. text-overflow: ellipsis;
  993. overflow: hidden;
  994. white-space: nowrap;
  995. }
  996. }
  997. .item1 .text {
  998. text-align: left;
  999. }
  1000. .item3 .text {
  1001. text-align: right;
  1002. }
  1003. }
  1004. .jt-icon {
  1005. position: relative;
  1006. top: 6rpx;
  1007. width: 60rpx;
  1008. margin: 0 20rpx;
  1009. }
  1010. .row {
  1011. margin: 10rpx 0;
  1012. align-items: center;
  1013. }
  1014. .item-bottom {
  1015. background: #F0F5FF;
  1016. padding: 0 30rpx;
  1017. border-radius: 0 0 30rpx 30rpx;
  1018. .name {
  1019. font-size: 26rpx;
  1020. font-weight: 700;
  1021. color: #000000;
  1022. margin-left: 30rpx;
  1023. }
  1024. .hp {
  1025. margin: 30rpx;
  1026. }
  1027. .number-color {
  1028. margin: 0 10rpx;
  1029. }
  1030. .qd {
  1031. background: linear-gradient(97deg, #4FABFD 0%, #2772FB 100%);
  1032. border-radius: 13px;
  1033. font-size: 29rpx;
  1034. font-weight: 400;
  1035. color: #FFFFFF;
  1036. padding: 10rpx 35rpx;
  1037. }
  1038. }
  1039. .dw {
  1040. align-items: center;
  1041. }
  1042. .place {
  1043. height: var(--status-bar-height);
  1044. }
  1045. .tab-view {
  1046. display: flex;
  1047. align-items: center;
  1048. justify-content: space-between;
  1049. }
  1050. .tab-right {
  1051. display: flex;
  1052. margin-right: 20rpx;
  1053. align-items: center;
  1054. }
  1055. .other-goods {
  1056. // background: red;
  1057. color:#999999;
  1058. margin: 40rpx 0;
  1059. display: flex;
  1060. justify-content: center;
  1061. font-size: 36rpx;
  1062. }
  1063. .level2-title {
  1064. font-size: 28rpx;
  1065. }
  1066. .yf-style {
  1067. position: relative;
  1068. .h-color {
  1069. position: absolute;
  1070. right: 0;
  1071. top: -30rpx;
  1072. }
  1073. }
  1074. .xf-iamge {
  1075. width: 74rpx;
  1076. height: 43rpx;
  1077. position: absolute;
  1078. top: -20rpx;
  1079. right: 0;
  1080. }
  1081. </style>