index.vue 35 KB

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