index.vue 34 KB

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