index.vue 33 KB

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