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. console.log("查看抢单",_obj)
  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. let that = this
  599. this.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
  600. driverPhone: this.userInfo.phone,
  601. }).then(res2 => {
  602. if (res2.data.authenticationStatus == '已过期') {
  603. that.$refs.uToast.show({
  604. type: 'error',
  605. message: '证件已过期,请上传新证件!',
  606. })
  607. return
  608. } else if (res2.data.authenticationStatus == '未认证' || res2.data.authenticationStatus ==
  609. '已驳回') {
  610. that.$refs.uToast.show({
  611. type: 'error',
  612. message: '请先完成司机认证!',
  613. })
  614. return
  615. } else if (res2.data.authenticationStatus == '审核中') {
  616. that.$refs.uToast.show({
  617. type: 'error',
  618. message: '司机审核中!',
  619. })
  620. return
  621. } else if (res2.data.authenticationStatus == '已认证') {
  622. this.driverCommonId = res2.data.commonId
  623. this.driverPhone = res2.data.driverPhone
  624. this.driverName = res2.data.driverName
  625. this.isShowAlert = true
  626. this.ObjSelect = item
  627. }
  628. })
  629. },
  630. confirmSelectType(val) {
  631. this.pickerSelect = val.value[0]
  632. this.show = false
  633. this.upCallback({
  634. size: 10,
  635. num: 1
  636. })
  637. },
  638. selectTypeClose() {
  639. this.show = false
  640. },
  641. selectType() {
  642. this.show = true
  643. },
  644. // getLngLat() {
  645. // var that=this
  646. // // uni.showLoading({
  647. // // title: '获取定位信息'
  648. // // })
  649. // uni.getLocation({
  650. // type: 'gcj02',
  651. // geocode: true,
  652. // success: res => {
  653. // if (res.latitude) {
  654. // console.log(res)
  655. // if(res.address.city){
  656. // if(res.address.city.indexOf('市')!=-1){
  657. // res.address.city=res.address.city.substring(0,res.address.city.length-1)
  658. // }
  659. // }
  660. // if(res.address.province){
  661. // if(res.address.province.indexOf('省')!=-1){
  662. // res.address.province=res.address.province.substring(0,res.address.province.length-1)
  663. // }
  664. // }
  665. // uni.setStorageSync('fPlaceObj',{
  666. // fchoosearea:'全部',
  667. // fchoosecity:res.address.city,
  668. // fchooseprovince:res.address.province,
  669. // selected:res.address.city
  670. // })
  671. // uni.setStorageSync('sPlaceObj',{
  672. // schoosearea:'请选择区',
  673. // schoosecity:'请选择市',
  674. // schooseprovince:'全国',
  675. // selected:'全国'
  676. // })
  677. // let _pickerSelect;
  678. // if (that.pickerSelect == '运费先付') {
  679. // _pickerSelect = 1
  680. // } else {
  681. // _pickerSelect = 0
  682. // }
  683. // that.startPlace.selected=res.address.city
  684. // that.startPlace.fchoosecity=res.address.city
  685. // let _data = {
  686. // searchKeyWord: this.tabIndex + 1,
  687. // searchType: _pickerSelect,
  688. // pageSize: 10,
  689. // currentPage: 1,
  690. // loadingPlaceCity: that.startPlace.fchoosecity,
  691. // // unLoadingPlaceCity: this.endPlace.schoosecity
  692. // }
  693. // that.$forceUpdate()
  694. // // that.$set(that.startPlace,'selected',res.address.city)
  695. // // that.lng = res.longitude;
  696. // // that.lat = res.latitude;
  697. // that.$request.baseRequest('get', '/publishTaskInfo/selectGoodsSource', _data).then(res => {
  698. // if (res.code == 200) {
  699. // console.log(res.data.records)
  700. // uni.hideLoading()
  701. // that.mescroll.endBySize(res.data.records.length, res.data.total);
  702. // if(res.data.records){
  703. // that.goods = res.data.records
  704. // for (let i = 0; i < that.goods.length; i++) {
  705. // if (that.goods[i].peripheralInfo == 1) {
  706. // that.isFirstIndex = i
  707. // return
  708. // }
  709. // }
  710. // }else{
  711. // that.goods=[]
  712. // }
  713. // }
  714. // uni.hideLoading()
  715. // })
  716. // .catch(res => {
  717. // uni.$u.toast(res.message);
  718. // that.mescroll.endErr();
  719. // });
  720. // } else {
  721. // if (uni.getSystemInfoSync().platform == 'android') {
  722. // var context = plus.android.importClass("android.content.Context");
  723. // var locationManager = plus.android.importClass(
  724. // "android.location.LocationManager");
  725. // var main = plus.android.runtimeMainActivity();
  726. // var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
  727. // that.bool = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)
  728. // }
  729. // if (that.bool === false) {
  730. // uni.showModal({
  731. // title: '提示',
  732. // content: '请打开定位服务',
  733. // success: ({
  734. // confirm,
  735. // cancel
  736. // }) => {
  737. // if (confirm) {
  738. // if (uni.getSystemInfoSync().platform == 'android') {
  739. // var Intent = plus.android.importClass(
  740. // 'android.content.Intent');
  741. // var Settings = plus.android.importClass(
  742. // 'android.provider.Settings');
  743. // var intent = new Intent(Settings
  744. // .ACTION_LOCATION_SOURCE_SETTINGS);
  745. // var main = plus.android.runtimeMainActivity();
  746. // main.startActivity(intent); // 打开系统设置GPS服务页面
  747. // }
  748. // }
  749. // }
  750. // });
  751. // }
  752. // uni.hideLoading()
  753. // }
  754. // }
  755. // });
  756. // },
  757. toDetail(id) {
  758. var that = this
  759. that.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
  760. driverPhone: this.userInfo.phone,
  761. }).then(res2 => {
  762. // console.log('跳转',1111111)
  763. uni.setStorageSync('firstAuthentication', res2.data)
  764. that.firstAuthentication = uni.getStorageSync('firstAuthentication')
  765. // console.log(that.firstAuthentication)
  766. //司机是否认证身份
  767. // 保留uni.getStorageSync('firstAuthentication'),thisfirstAuthentication有缓存问题
  768. if (uni.getStorageSync('firstAuthentication').authenticationStatus == '已认证') {
  769. uni.$u.route('/pages/goodSource/shippingDetails', {
  770. id: id,
  771. });
  772. } else if (uni.getStorageSync('firstAuthentication').authenticationStatus == '已过期') {
  773. that.$refs.uToast.show({
  774. type: 'error',
  775. message: "证件已过期,请上传新证件!",
  776. })
  777. } else {
  778. that.$refs.uToast.show({
  779. type: 'error',
  780. message: "请先完成司机认证!",
  781. })
  782. }
  783. })
  784. },
  785. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  786. upCallback(page) {
  787. var that = this
  788. let _pickerSelect;
  789. if (this.pickerSelect == '运费先付') {
  790. _pickerSelect = 1
  791. } else {
  792. _pickerSelect = 0
  793. }
  794. //选择省市区
  795. let _data = {
  796. searchKeyWord: this.tabIndex + 1,
  797. searchType: _pickerSelect,
  798. // loadingPlace: this.startPlace.selected,
  799. // unLoadingPlace: this.endPlace.selected=="全国"?'':this.endPlace.selected,
  800. pageSize: page.size,
  801. currentPage: page.num,
  802. // loadingPlaceCity: this.startPlace.fchoosecity,
  803. // unLoadingPlaceCity: this.endPlace.schoosecity
  804. }
  805. console.log(uni.getStorageSync('longitudeAndLatitude'))
  806. // if (this.tabIndex == 2) {
  807. if (uni.getStorageSync('longitudeAndLatitude')) {
  808. this.lng = uni.getStorageSync('longitudeAndLatitude').split(',')[0]
  809. this.lat = uni.getStorageSync('longitudeAndLatitude').split(',')[1]
  810. }
  811. _data.driverLongitude = this.lng
  812. _data.driverLatitude = this.lat
  813. // }
  814. console.log('------')
  815. console.log(_data)
  816. if (uni.getStorageSync('fPlaceObj')) {
  817. if (this.startPlace.fchoosearea && this.startPlace.fchoosearea == '全部' && this.startPlace
  818. .fchoosearea != '请选择区') {
  819. // _data.loadingPlaceCity = this.startPlace.fchoosecity
  820. if (this.startPlace.fchoosecity == '市辖区') {
  821. _data.loadingPlaceCity = this.startPlace.fchooseprovince
  822. } else {
  823. _data.loadingPlaceCity = this.startPlace.fchoosecity
  824. }
  825. } else if (this.startPlace.fchoosecity == '全部') {
  826. _data.loadingPlace = this.startPlace.selected
  827. } else {
  828. _data.loadingPlaceCity = this.startPlace.fchoosecity
  829. _data.loadingPlace = this.startPlace.fchoosearea
  830. }
  831. } else {
  832. _data.loadingPlaceCity = this.startPlace.fchoosecity
  833. }
  834. if (uni.getStorageSync('sPlaceObj')) {
  835. if (this.endPlace.schoosearea && this.endPlace.schoosearea == '全部' && this.endPlace.schoosearea !=
  836. '请选择区') {
  837. if (this.endPlace.schoosecity == '市辖区') {
  838. _data.unLoadingPlaceCity = this.endPlace.schooseprovince
  839. } else {
  840. _data.unLoadingPlaceCity = this.endPlace.schoosecity
  841. }
  842. } else if (this.endPlace.schoosearea) {
  843. _data.unLoadingPlace = this.endPlace.selected == "全国" ? '' : this.endPlace.selected
  844. } else {
  845. _data.unLoadingPlace = this.endPlace.selected == "全国" ? '' : this.endPlace.selected
  846. _data.unLoadingPlaceCity = this.endPlace.schoosecity
  847. }
  848. } else {
  849. _data.unLoadingPlace = this.endPlace.selected == "全国" ? '' : this.endPlace.selected
  850. }
  851. if (this.lng) {
  852. _data.longitude = this.lng
  853. _data.latitude = this.lat
  854. }
  855. uni.showLoading({
  856. mask: true,
  857. title: '加载中'
  858. })
  859. console.log(_data)
  860. this.$request.baseRequest('get', '/publishTaskInfo/selectGoodsSource', _data).then(res => {
  861. uni.hideLoading()
  862. if (res.code == 200) {
  863. if (page.num == 1) {
  864. this.goods = [];
  865. // this.otherGoods = []
  866. };
  867. if (res.data.records) {
  868. for (var i = 0; i < res.data.records.length; i++) {
  869. if (res.data.records[i].cargoDistance) {
  870. if (res.data.records[i].cargoDistance > 10) {
  871. res.data.records[i].cargoDistance = res.data.records[i].cargoDistance
  872. .toFixed(0)
  873. } else {
  874. res.data.records[i].cargoDistance = res.data.records[i].cargoDistance
  875. .toFixed(1)
  876. }
  877. }
  878. if (res.data.records[i].distance) {
  879. if (res.data.records[i].distance > 10) {
  880. res.data.records[i].distance = res.data.records[i].distance.toFixed(0)
  881. } else {
  882. res.data.records[i].distance = res.data.records[i].distance.toFixed(1)
  883. }
  884. }
  885. }
  886. }
  887. this.mescroll.endBySize(res.data.records.length, res.data.total);
  888. // for (var i = 0; i < res.data.records.length; i++) {
  889. // res.data.records[i].cargoOwnerName1=
  890. // }
  891. //如果是第一页需手动制空列表
  892. if (res.data.records) {
  893. that.goods = that.goods.concat(res.data.records);
  894. for (let i = 0; i < that.goods.length; i++) {
  895. if (that.goods[i].peripheralInfo == 1) {
  896. that.isFirstIndex = i
  897. return
  898. }
  899. }
  900. } else {
  901. that.goods = []
  902. }
  903. }
  904. })
  905. .catch(res => {
  906. uni.hideLoading()
  907. uni.$u.toast(res.message);
  908. this.mescroll.endErr();
  909. });
  910. },
  911. clickTab(val) {
  912. this.tabIndex = val.index
  913. this.upCallback({
  914. size: 10,
  915. num: 1,
  916. })
  917. },
  918. changeCity() {
  919. if (this.endPlace.selected == '全国') {
  920. this.$refs.uToast.show({
  921. type: 'error',
  922. message: "装车地不能为全国!",
  923. })
  924. return
  925. }
  926. [this.startPlace.fchooseprovince, this.endPlace.schooseprovince] = [this.endPlace.schooseprovince, this
  927. .startPlace.fchooseprovince
  928. ];
  929. [this.startPlace.fchoosecity, this.endPlace.schoosecity] = [this.endPlace.schoosecity, this.startPlace
  930. .fchoosecity
  931. ];
  932. [this.startPlace.fchoosearea, this.endPlace.schoosearea] = [this.endPlace.schoosearea, this.startPlace
  933. .fchoosearea
  934. ];
  935. [this.startPlace.selected, this.endPlace.selected] = [this.endPlace.selected, this.startPlace.selected];
  936. // [this.startPlace, this.endPlace] = [this.endPlace, this.startPlace];
  937. uni.setStorageSync('fPlaceObj', this.startPlace);
  938. uni.setStorageSync('sPlaceObj', this.endPlace);
  939. },
  940. goCity(type) {
  941. uni.$u.route('/pages/goodSource/selectCity', {
  942. startPlace: JSON.stringify(this.startPlace),
  943. endPlace: JSON.stringify(this.endPlace),
  944. type: type
  945. });
  946. },
  947. swiperChange(e) {
  948. this.tabIndex = e.detail.current
  949. }
  950. }
  951. }
  952. </script>
  953. <style scoped lang="scss">
  954. .popupShow {
  955. overflow: hidden;
  956. position: fixed;
  957. height: 100vh;
  958. width: 100%;
  959. }
  960. .content {
  961. background: #F2F4F7;
  962. }
  963. .banner {
  964. width: 100%;
  965. position: relative;
  966. }
  967. .u-flex-wrap {
  968. flex-wrap: wrap;
  969. }
  970. .fixed,
  971. .fixed1 {
  972. background: linear-gradient(97deg, #4FABFD 0%, #2772FB 100%);
  973. position: fixed;
  974. top: var(--status-bar-height);
  975. z-index: 999;
  976. // width: calc(100% - 40rpx);
  977. width: 100%;
  978. // margin:0 20rpx;
  979. }
  980. .fixed1 {
  981. top: 0;
  982. height: var(--status-bar-height);
  983. background: linear-gradient(97deg, #4FABFD 0%, #2772FB 100%);
  984. }
  985. .banner-img {
  986. width: 100%;
  987. }
  988. .head {
  989. position: absolute;
  990. width: calc(100% - 108rpx);
  991. bottom: 0;
  992. background: white;
  993. margin: 0 20rpx;
  994. border-radius: 20rpx;
  995. padding: 33rpx 33rpx 48rpx 33rpx;
  996. .item1,
  997. .item3 {
  998. width: 40%;
  999. .text {
  1000. text-overflow: ellipsis;
  1001. overflow: hidden;
  1002. white-space: nowrap;
  1003. }
  1004. }
  1005. .item1 .text {
  1006. text-align: left;
  1007. }
  1008. .item3 .text {
  1009. text-align: right;
  1010. }
  1011. }
  1012. .change-btn {
  1013. width: 86rpx;
  1014. height: 86rpx;
  1015. }
  1016. .good-list {
  1017. background-color: white;
  1018. margin: 10px 10px 15px 10px;
  1019. // padding: 10px 0px 0px 0;
  1020. border-radius: 30rpx;
  1021. box-shadow: 0px 5rpx 20rpx #E3E3E3;
  1022. .good-view {
  1023. padding: 10rpx 35rpx 10rpx 35rpx;
  1024. position: relative;
  1025. }
  1026. .item1,
  1027. .item3 {
  1028. // width: 40%;
  1029. display: flex;
  1030. .text {
  1031. text-overflow: ellipsis;
  1032. overflow: hidden;
  1033. white-space: nowrap;
  1034. }
  1035. }
  1036. .item1 .text {
  1037. text-align: left;
  1038. }
  1039. .item3 .text {
  1040. text-align: right;
  1041. }
  1042. }
  1043. .jt-icon {
  1044. position: relative;
  1045. // top: 6rpx;
  1046. width: 60rpx;
  1047. margin: 0 20rpx;
  1048. }
  1049. .row {
  1050. margin: 10rpx 0;
  1051. align-items: center;
  1052. }
  1053. .item-bottom {
  1054. background: #F0F5FF;
  1055. padding: 23rpx 30rpx;
  1056. border-radius: 0px 0px 18px 18px;
  1057. .name {
  1058. font-size: 26rpx;
  1059. font-weight: 700;
  1060. color: #000000;
  1061. margin-left: 30rpx;
  1062. }
  1063. .hp {
  1064. margin: 30rpx;
  1065. }
  1066. .number-color {
  1067. margin: 0 10rpx;
  1068. }
  1069. .qd {
  1070. background: linear-gradient(97deg, #4FABFD 0%, #2772FB 100%);
  1071. border-radius: 13rpx;
  1072. font-size: 29rpx;
  1073. font-weight: 400;
  1074. color: #FFFFFF;
  1075. padding: 15rpx 35rpx;
  1076. }
  1077. }
  1078. .dw {
  1079. align-items: center;
  1080. }
  1081. .place {
  1082. height: var(--status-bar-height);
  1083. }
  1084. .tab-view {
  1085. display: flex;
  1086. align-items: center;
  1087. justify-content: space-between;
  1088. padding-left: 20rpx;
  1089. }
  1090. .tab-right {
  1091. display: flex;
  1092. margin-right: 39rpx;
  1093. align-items: center;
  1094. }
  1095. .other-goods {
  1096. // background: red;
  1097. color: #999999;
  1098. margin: 40rpx 0;
  1099. display: flex;
  1100. justify-content: center;
  1101. font-size: 36rpx;
  1102. }
  1103. .level2-title {
  1104. font-size: 28rpx;
  1105. }
  1106. .yf-style {
  1107. position: relative;
  1108. .left {
  1109. font-size: 25.39rpx;
  1110. .text-space {
  1111. margin-right: 20rpx;
  1112. }
  1113. .line {
  1114. margin: 0 10rpx;
  1115. }
  1116. }
  1117. .h-color {
  1118. // position: absolute;
  1119. // right: 0;
  1120. // top: -30rpx;
  1121. }
  1122. }
  1123. .xf-iamge {
  1124. width: 74rpx;
  1125. height: 43rpx;
  1126. position: absolute;
  1127. top: -20rpx;
  1128. right: 0;
  1129. }
  1130. .place-title {
  1131. margin-bottom: 11rpx;
  1132. }
  1133. .btn-color {
  1134. margin-top: 52rpx;
  1135. padding: 30rpx 0;
  1136. }
  1137. </style>