index.vue 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241
  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. async 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. //获取上一次点击起装卸地
  244. if (uni.getStorageSync('fPlaceObj')) {
  245. that.startPlace = uni.getStorageSync('fPlaceObj');
  246. } else {
  247. that.startPlace.selected = '北京'
  248. uni.setStorageSync('fPlaceObj', {
  249. fchoosearea: '全部',
  250. fchoosecity: '市辖区',
  251. fchooseprovince: '北京',
  252. selected: '北京'
  253. })
  254. }
  255. if (uni.getStorageSync('sPlaceObj')) {
  256. that.endPlace = uni.getStorageSync('sPlaceObj');
  257. } else {
  258. that.endPlace.selected = '全国';
  259. uni.setStorageSync('sPlaceObj', {
  260. schoosearea: '请选择区',
  261. schoosecity: '请选择市',
  262. schooseprovince: '全国',
  263. selected: '全国'
  264. })
  265. }
  266. that.upCallback({
  267. size: 10,
  268. num: 1
  269. })
  270. that.$request.baseRequest('get', '/newsInfo/unreadMessage', {
  271. reCommonId: this.userInfo.id,
  272. }).then(res3 => {
  273. if (res3.data || res3.data == 0) {
  274. let name = 'myTip';
  275. let value = res3.data
  276. if (value == 0) {
  277. uni.removeTabBarBadge({
  278. index: 3
  279. })
  280. }
  281. that.$store.commit('$uStore', {
  282. name,
  283. value
  284. });
  285. if (value != 0 && value) {
  286. uni.setTabBarBadge({
  287. index: 3,
  288. text: value + ""
  289. })
  290. }
  291. }
  292. })
  293. // this.mescroll.resetUpScroll()
  294. },
  295. // async onLoad() {
  296. // that = this
  297. // // #ifdef APP-PLUS
  298. // let _status = await that.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
  299. // driverPhone: this.userInfo.phone,
  300. // }).then(res => {
  301. // return res.data.authenticationStatus
  302. // })
  303. // // if (_status == '已禁用') {
  304. // // this.isShowAlert = true
  305. // // this.alertTitle = '账号审核中'
  306. // // this.confirmText = '退出APP'
  307. // // this.showCancelButton = false
  308. // // } else {
  309. // // console.log(1231233212332312312213)
  310. // // }
  311. // // #endif
  312. // },
  313. onPageScroll(res) {
  314. this.scrollTop = res.scrollTop
  315. // console.log("页面滚动了", res.scrollTop)
  316. if (this.scrollTop > 1200) {
  317. uni.setTabBarItem({
  318. index: 0,
  319. text: '返回顶部',
  320. iconPath: 'static/images/common/top@2x.png',
  321. selectedIconPath: 'static/images/common/top@2x.png'
  322. })
  323. } else {
  324. uni.setTabBarItem({
  325. index: 0,
  326. text: '货源',
  327. iconPath: 'static/images/common/huoyuan@2x(1).png',
  328. selectedIconPath: 'static/images/common/huoyuan@2x.png'
  329. })
  330. }
  331. },
  332. methods: {
  333. stopRoll() {
  334. },
  335. async get_localtion_permission() {
  336. var photol = await permision.checkSystemEnableLocation()
  337. if (photol == true) {
  338. this.getLngLat()
  339. } else {
  340. // that.$refs.uToast.show({
  341. // type: 'error',
  342. // message: "未获取定位权限!",
  343. // })
  344. this.checkOpenGPSServiceByAndroidIOS()
  345. }
  346. },
  347. async getLngLat() {
  348. await uni.getLocation({
  349. type: 'gcj02',
  350. geocode: true,
  351. success: res => {
  352. if (res.latitude) {
  353. if (res.address.city) {
  354. if (res.address.city.indexOf('市') != -1) {
  355. res.address.city = res.address.city.substring(0, res.address.city
  356. .length - 1)
  357. }
  358. }
  359. if (res.address.province) {
  360. if (res.address.province.indexOf('省') != -1) {
  361. res.address.province = res.address.province.substring(0, res.address
  362. .province.length - 1)
  363. }
  364. }
  365. uni.setStorageSync('fPlaceObj', {
  366. fchoosearea: '全部',
  367. fchoosecity: res.address.city,
  368. fchooseprovince: res.address.province,
  369. selected: res.address.city
  370. })
  371. uni.setStorageSync('sPlaceObj', {
  372. schoosearea: '请选择区',
  373. schoosecity: '请选择市',
  374. schooseprovince: '全国',
  375. selected: '全国'
  376. })
  377. uni.setStorageSync('longitudeAndLatitude', res.longitude + ',' + res.latitude)
  378. that.upCallback({
  379. size: 10,
  380. num: 1
  381. })
  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. console.log()
  408. }
  409. // else {
  410. // uni.setStorageSync('fPlaceObj', {
  411. // fchoosearea: '全部',
  412. // fchoosecity: '市辖区',
  413. // fchooseprovince: '北京',
  414. // selected: '东城'
  415. // })
  416. // uni.setStorageSync('sPlaceObj', {
  417. // schoosearea: '请选择区',
  418. // schoosecity: '请选择市',
  419. // schooseprovince: '全国',
  420. // selected: '全国'
  421. // })
  422. // uni.setStorageSync('longitudeAndLatitude', '116.3972,39.9096')
  423. // }
  424. } else {
  425. // uni.setStorageSync('fPlaceObj', {
  426. // fchoosearea: '全部',
  427. // fchoosecity: '市辖区',
  428. // fchooseprovince: '北京',
  429. // selected: '东城'
  430. // })
  431. // uni.setStorageSync('sPlaceObj', {
  432. // schoosearea: '请选择区',
  433. // schoosecity: '请选择市',
  434. // schooseprovince: '全国',
  435. // selected: '全国'
  436. // })
  437. // uni.setStorageSync('longitudeAndLatitude', '116.3972,39.9096')
  438. }
  439. }
  440. });
  441. // uni.setStorageSync('fPlaceObj', {
  442. // fchoosearea: '全部',
  443. // fchoosecity: '市辖区',
  444. // fchooseprovince: '北京',
  445. // selected: '东城'
  446. // })
  447. // uni.setStorageSync('sPlaceObj', {
  448. // schoosearea: '请选择区',
  449. // schoosecity: '请选择市',
  450. // schooseprovince: '全国',
  451. // selected: '全国'
  452. // })
  453. if (uni.getStorageSync('fPlaceObj')) {
  454. that.startPlace = uni.getStorageSync('fPlaceObj');
  455. }
  456. if (uni.getStorageSync('sPlaceObj')) {
  457. that.endPlace = uni.getStorageSync('sPlaceObj');
  458. }
  459. uni.setStorageSync('longitudeAndLatitude', '116.3972,39.9096')
  460. } else {
  461. this.getLngLat()
  462. }
  463. } else if (system.platform === 'ios') {
  464. // console.log("苹果");
  465. var cllocationManger = plus.ios.import("CLLocationManager");
  466. var enable = cllocationManger.locationServicesEnabled();
  467. var status = cllocationManger.authorizationStatus();
  468. plus.ios.deleteObject(cllocationManger);
  469. if (enable && status != 2) {
  470. this.getLngLat()
  471. console.log("手机系统的定位已经打开");
  472. } else {
  473. console.log("手机系统的定位没有打开");
  474. uni.showModal({
  475. title: '提示',
  476. content: '请前往设置-隐私-定位服务打开定位服务功能',
  477. // showCancel: false, // 不显示取消按钮
  478. success(res) {
  479. if (res.confirm) {
  480. var UIApplication = plus.ios.import("UIApplication");
  481. var application2 = UIApplication.sharedApplication();
  482. var NSURL2 = plus.ios.import("NSURL");
  483. // var setting2 = NSURL2.URLWithString("prefs:root=LOCATION_SERVICES");
  484. // var setting2 = NSURL2.URLWithString("App-Prefs:root=LOCATION_SERVICES");
  485. // var setting2 = NSURL2.URLWithString("app-settings");
  486. var setting2 = NSURL2.URLWithString("App-Prefs:root=Privacy&path=LOCATION");
  487. // var setting2 = NSURL2.URLWithString("App-Prefs:root=Privacy&path=LOCATION_SERVICES");
  488. application2.openURL(setting2);
  489. plus.ios.deleteObject(setting2);
  490. plus.ios.deleteObject(NSURL2);
  491. plus.ios.deleteObject(application2);
  492. this.getLngLat()
  493. }
  494. }
  495. });
  496. }
  497. }
  498. },
  499. cargoOwner(_obj) {
  500. // uni.$u.route('/pages/order/evaluateList');
  501. // console.log("查看---------------",_obj)
  502. uni.$u.route('/pages/goodSource/cargoOwnerSee', _obj)
  503. },
  504. mescrollInit(mescroll) {
  505. this.mescroll = mescroll;
  506. },
  507. confirmClick() {
  508. let item = this.ObjSelect
  509. var that = this
  510. let _obj = {
  511. driverCommonId: that.driverCommonId,
  512. commonId: item.commonId,
  513. compId: item.compId,
  514. cargoOwnerName: item.cargoOwnerReallyName,
  515. cargoOwner: item.cargoOwner,
  516. sendPrivate: item.sendPrivate,
  517. sendCity: item.sendCity,
  518. sendArea: item.sendArea,
  519. sendDetailedAddress: item.sendDetailedAddress,
  520. unloadPrivate: item.unloadPrivate,
  521. unloadCity: item.unloadCity,
  522. unloadArea: item.unloadArea,
  523. unloadDetailedAddress: item.unloadDetailedAddress,
  524. goodsName: item.goodsName,
  525. distance: item.distance,
  526. freightPrice: item.freightPrice,
  527. driverName: that.driverName,
  528. driverPhone: that.driverPhone,
  529. cargoOwnerPhone: item.cargoOwnerPhone,
  530. id: item.id,
  531. billingMethod: item.billingMethod,
  532. freightAdvance: item.freightAdvance,
  533. goodsType: item.goodsType,
  534. goodsTypeKey: item.goodsTypeKey
  535. }
  536. console.log("查看抢单", _obj)
  537. that.$request.baseRequest('post', '/publishTaskInfo/api/addOrder', _obj).then(res => {
  538. if (res.code == 200) {
  539. that.$refs.uToast.show({
  540. type: 'success',
  541. message: "抢单成功!",
  542. complete() {
  543. uni.switchTab({
  544. url: "/pages/order/index"
  545. })
  546. }
  547. })
  548. } else {
  549. that.$refs.uToast.show({
  550. type: 'error',
  551. message: res.message,
  552. })
  553. }
  554. })
  555. .catch(res => {
  556. uni.$u.toast(res.message);
  557. });
  558. // });
  559. this.isShowAlert = false
  560. },
  561. cancelClick() {
  562. this.isShowAlert = false
  563. },
  564. carLength(good) {
  565. let length = ''
  566. if (good.carLengthSmall && good.carLength) {
  567. length = good.carLengthSmall + '~' + good.carLength + '米'
  568. } else if (good.carLengthSmall && !good.carLength) {
  569. length = "大于" + good.carLengthSmall + '米'
  570. } else if (good.carLength && !good.carLengthSmall) {
  571. length = "小于" + good.carLength + '米'
  572. }
  573. return length
  574. },
  575. carType(good) {
  576. let _val = '';
  577. if (good.carModel == 1) {
  578. _val = ''
  579. } else {
  580. if (good.carModel.includes(2)) {
  581. _val += '高栏 '
  582. }
  583. if (good.carModel.includes(3)) {
  584. _val += '集装箱 '
  585. }
  586. if (good.carModel.includes(4)) {
  587. _val += '自卸车 '
  588. }
  589. }
  590. return _val
  591. },
  592. carWeight(good) {
  593. good.loadWeightSmall
  594. good.loadWeight
  595. let weight = ''
  596. if (good.loadWeightSmall && good.loadWeight) {
  597. weight = good.loadWeightSmall + '~' + good.loadWeight + '吨'
  598. } else if (good.loadWeightSmall) {
  599. weight = "大于" + good.loadWeightSmall + '吨'
  600. } else if (good.loadWeight) {
  601. weight = "小于" + good.loadWeight + '吨'
  602. }
  603. return weight
  604. },
  605. getdate() {
  606. var date = new Date()
  607. var year = date.getFullYear() //获取完整的年份(4位)
  608. var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  609. var datetime = date.getDate() //获取当前日(1-31)
  610. if (mouth < 10) {
  611. mouth = '0' + mouth
  612. }
  613. if (datetime < 10) {
  614. datetime = '0' + datetime
  615. }
  616. return String(year) + String(mouth) + String(datetime)
  617. },
  618. grabOrders(item) {
  619. let that = this
  620. this.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
  621. driverPhone: this.userInfo.phone,
  622. }).then(res2 => {
  623. if (res2.data.authenticationStatus == '已过期') {
  624. that.$refs.uToast.show({
  625. type: 'error',
  626. message: '证件已过期,请上传新证件!',
  627. })
  628. return
  629. } else if (res2.data.authenticationStatus == '未认证' || res2.data.authenticationStatus ==
  630. '已驳回') {
  631. that.$refs.uToast.show({
  632. type: 'error',
  633. message: '请先完成司机认证!',
  634. })
  635. return
  636. } else if (res2.data.authenticationStatus == '审核中') {
  637. that.$refs.uToast.show({
  638. type: 'error',
  639. message: '司机审核中!',
  640. })
  641. return
  642. } else if (res2.data.authenticationStatus == '已认证') {
  643. this.driverCommonId = res2.data.commonId
  644. this.driverPhone = res2.data.driverPhone
  645. this.driverName = res2.data.driverName
  646. this.isShowAlert = true
  647. this.ObjSelect = item
  648. }
  649. })
  650. },
  651. confirmSelectType(val) {
  652. this.pickerSelect = val.value[0]
  653. this.show = false
  654. this.upCallback({
  655. size: 10,
  656. num: 1
  657. })
  658. },
  659. selectTypeClose() {
  660. this.show = false
  661. },
  662. selectType() {
  663. this.show = true
  664. },
  665. // getLngLat() {
  666. // var that=this
  667. // // uni.showLoading({
  668. // // title: '获取定位信息'
  669. // // })
  670. // uni.getLocation({
  671. // type: 'gcj02',
  672. // geocode: true,
  673. // success: res => {
  674. // if (res.latitude) {
  675. // console.log(res)
  676. // if(res.address.city){
  677. // if(res.address.city.indexOf('市')!=-1){
  678. // res.address.city=res.address.city.substring(0,res.address.city.length-1)
  679. // }
  680. // }
  681. // if(res.address.province){
  682. // if(res.address.province.indexOf('省')!=-1){
  683. // res.address.province=res.address.province.substring(0,res.address.province.length-1)
  684. // }
  685. // }
  686. // uni.setStorageSync('fPlaceObj',{
  687. // fchoosearea:'全部',
  688. // fchoosecity:res.address.city,
  689. // fchooseprovince:res.address.province,
  690. // selected:res.address.city
  691. // })
  692. // uni.setStorageSync('sPlaceObj',{
  693. // schoosearea:'请选择区',
  694. // schoosecity:'请选择市',
  695. // schooseprovince:'全国',
  696. // selected:'全国'
  697. // })
  698. // let _pickerSelect;
  699. // if (that.pickerSelect == '运费先付') {
  700. // _pickerSelect = 1
  701. // } else {
  702. // _pickerSelect = 0
  703. // }
  704. // that.startPlace.selected=res.address.city
  705. // that.startPlace.fchoosecity=res.address.city
  706. // let _data = {
  707. // searchKeyWord: this.tabIndex + 1,
  708. // searchType: _pickerSelect,
  709. // pageSize: 10,
  710. // currentPage: 1,
  711. // loadingPlaceCity: that.startPlace.fchoosecity,
  712. // // unLoadingPlaceCity: this.endPlace.schoosecity
  713. // }
  714. // that.$forceUpdate()
  715. // // that.$set(that.startPlace,'selected',res.address.city)
  716. // // that.lng = res.longitude;
  717. // // that.lat = res.latitude;
  718. // that.$request.baseRequest('get', '/publishTaskInfo/selectGoodsSource', _data).then(res => {
  719. // if (res.code == 200) {
  720. // console.log(res.data.records)
  721. // uni.hideLoading()
  722. // that.mescroll.endBySize(res.data.records.length, res.data.total);
  723. // if(res.data.records){
  724. // that.goods = res.data.records
  725. // for (let i = 0; i < that.goods.length; i++) {
  726. // if (that.goods[i].peripheralInfo == 1) {
  727. // that.isFirstIndex = i
  728. // return
  729. // }
  730. // }
  731. // }else{
  732. // that.goods=[]
  733. // }
  734. // }
  735. // uni.hideLoading()
  736. // })
  737. // .catch(res => {
  738. // uni.$u.toast(res.message);
  739. // that.mescroll.endErr();
  740. // });
  741. // } else {
  742. // if (uni.getSystemInfoSync().platform == 'android') {
  743. // var context = plus.android.importClass("android.content.Context");
  744. // var locationManager = plus.android.importClass(
  745. // "android.location.LocationManager");
  746. // var main = plus.android.runtimeMainActivity();
  747. // var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
  748. // that.bool = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)
  749. // }
  750. // if (that.bool === false) {
  751. // uni.showModal({
  752. // title: '提示',
  753. // content: '请打开定位服务',
  754. // success: ({
  755. // confirm,
  756. // cancel
  757. // }) => {
  758. // if (confirm) {
  759. // if (uni.getSystemInfoSync().platform == 'android') {
  760. // var Intent = plus.android.importClass(
  761. // 'android.content.Intent');
  762. // var Settings = plus.android.importClass(
  763. // 'android.provider.Settings');
  764. // var intent = new Intent(Settings
  765. // .ACTION_LOCATION_SOURCE_SETTINGS);
  766. // var main = plus.android.runtimeMainActivity();
  767. // main.startActivity(intent); // 打开系统设置GPS服务页面
  768. // }
  769. // }
  770. // }
  771. // });
  772. // }
  773. // uni.hideLoading()
  774. // }
  775. // }
  776. // });
  777. // },
  778. toDetail(id) {
  779. var that = this
  780. that.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
  781. driverPhone: this.userInfo.phone,
  782. }).then(res2 => {
  783. // console.log('跳转',1111111)
  784. uni.setStorageSync('firstAuthentication', res2.data)
  785. that.firstAuthentication = uni.getStorageSync('firstAuthentication')
  786. // console.log(that.firstAuthentication)
  787. //司机是否认证身份
  788. // 保留uni.getStorageSync('firstAuthentication'),thisfirstAuthentication有缓存问题
  789. if (uni.getStorageSync('firstAuthentication').authenticationStatus == '已认证') {
  790. uni.$u.route('/pages/goodSource/shippingDetails', {
  791. id: id,
  792. });
  793. } else if (uni.getStorageSync('firstAuthentication').authenticationStatus == '已过期') {
  794. that.$refs.uToast.show({
  795. type: 'error',
  796. message: "证件已过期,请上传新证件!",
  797. })
  798. } else {
  799. that.$refs.uToast.show({
  800. type: 'error',
  801. message: "请先完成司机认证!",
  802. })
  803. }
  804. })
  805. },
  806. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  807. upCallback(page) {
  808. var that = this
  809. let _pickerSelect;
  810. if (this.pickerSelect == '运费先付') {
  811. _pickerSelect = 1
  812. } else {
  813. _pickerSelect = 0
  814. }
  815. //选择省市区
  816. let _data = {
  817. searchKeyWord: this.tabIndex + 1,
  818. searchType: _pickerSelect,
  819. // loadingPlace: this.startPlace.selected,
  820. // unLoadingPlace: this.endPlace.selected=="全国"?'':this.endPlace.selected,
  821. pageSize: page.size,
  822. currentPage: page.num,
  823. // loadingPlaceCity: this.startPlace.fchoosecity,
  824. // unLoadingPlaceCity: this.endPlace.schoosecity
  825. }
  826. console.log(uni.getStorageSync('longitudeAndLatitude'))
  827. // if (this.tabIndex == 2) {
  828. if (uni.getStorageSync('longitudeAndLatitude')) {
  829. this.lng = uni.getStorageSync('longitudeAndLatitude').split(',')[0]
  830. this.lat = uni.getStorageSync('longitudeAndLatitude').split(',')[1]
  831. }
  832. _data.driverLongitude = this.lng
  833. _data.driverLatitude = this.lat
  834. // }
  835. console.log('------')
  836. console.log(_data)
  837. if (uni.getStorageSync('fPlaceObj')) {
  838. if (this.startPlace.fchoosearea && this.startPlace.fchoosearea == '全部' && this.startPlace
  839. .fchoosearea != '请选择区') {
  840. // _data.loadingPlaceCity = this.startPlace.fchoosecity
  841. if (this.startPlace.fchoosecity == '市辖区') {
  842. _data.loadingPlaceCity = this.startPlace.fchooseprovince
  843. } else {
  844. _data.loadingPlaceCity = this.startPlace.fchoosecity
  845. }
  846. } else if (this.startPlace.fchoosecity == '全部') {
  847. _data.loadingPlace = this.startPlace.selected
  848. } else {
  849. _data.loadingPlaceCity = this.startPlace.fchoosecity
  850. _data.loadingPlace = this.startPlace.fchoosearea
  851. }
  852. } else {
  853. _data.loadingPlaceCity = this.startPlace.fchoosecity
  854. }
  855. if (uni.getStorageSync('sPlaceObj')) {
  856. if (this.endPlace.schoosearea && this.endPlace.schoosearea == '全部' && this.endPlace.schoosearea !=
  857. '请选择区') {
  858. if (this.endPlace.schoosecity == '市辖区') {
  859. _data.unLoadingPlaceCity = this.endPlace.schooseprovince
  860. } else {
  861. _data.unLoadingPlaceCity = this.endPlace.schoosecity
  862. }
  863. } else if (this.endPlace.schoosearea) {
  864. _data.unLoadingPlace = this.endPlace.selected == "全国" ? '' : this.endPlace.selected
  865. } else {
  866. _data.unLoadingPlace = this.endPlace.selected == "全国" ? '' : this.endPlace.selected
  867. _data.unLoadingPlaceCity = this.endPlace.schoosecity
  868. }
  869. } else {
  870. _data.unLoadingPlace = this.endPlace.selected == "全国" ? '' : this.endPlace.selected
  871. }
  872. if (this.lng) {
  873. _data.longitude = this.lng
  874. _data.latitude = this.lat
  875. }
  876. uni.showLoading({
  877. mask: true,
  878. title: '加载中'
  879. })
  880. console.log(_data)
  881. this.$request.baseRequest('get', '/publishTaskInfo/selectGoodsSource', _data).then(res => {
  882. uni.hideLoading()
  883. if (res.code == 200) {
  884. if (page.num == 1) {
  885. this.goods = [];
  886. // this.otherGoods = []
  887. };
  888. if (res.data.records) {
  889. for (var i = 0; i < res.data.records.length; i++) {
  890. if (res.data.records[i].cargoDistance) {
  891. if (res.data.records[i].cargoDistance > 10) {
  892. res.data.records[i].cargoDistance = res.data.records[i].cargoDistance
  893. .toFixed(0)
  894. } else {
  895. res.data.records[i].cargoDistance = res.data.records[i].cargoDistance
  896. .toFixed(1)
  897. }
  898. }
  899. if (res.data.records[i].distance) {
  900. if (res.data.records[i].distance > 10) {
  901. res.data.records[i].distance = res.data.records[i].distance.toFixed(0)
  902. } else {
  903. res.data.records[i].distance = res.data.records[i].distance.toFixed(1)
  904. }
  905. }
  906. }
  907. }
  908. this.mescroll.endBySize(res.data.records.length, res.data.total);
  909. // for (var i = 0; i < res.data.records.length; i++) {
  910. // res.data.records[i].cargoOwnerName1=
  911. // }
  912. //如果是第一页需手动制空列表
  913. if (res.data.records) {
  914. that.goods = that.goods.concat(res.data.records);
  915. for (let i = 0; i < that.goods.length; i++) {
  916. if (that.goods[i].peripheralInfo == 1) {
  917. that.isFirstIndex = i
  918. return
  919. }
  920. }
  921. } else {
  922. that.goods = []
  923. }
  924. }
  925. })
  926. .catch(res => {
  927. uni.hideLoading()
  928. uni.$u.toast(res.message);
  929. this.mescroll.endErr();
  930. });
  931. },
  932. async clickTab(val) {
  933. console.log("val", val)
  934. this.tabIndex = val.index
  935. if (val.name == '按距离') {
  936. console.log(1)
  937. // this.checkOpenGPSServiceByAndroidIOS()
  938. // var photol = await permision.checkSystemEnableLocation()
  939. // console.log("photol",photol)
  940. // if (!photol) {
  941. that.get_localtion_permission()
  942. // }
  943. } else {
  944. this.upCallback({
  945. size: 10,
  946. num: 1,
  947. })
  948. }
  949. },
  950. changeCity() {
  951. if (this.endPlace.selected == '全国') {
  952. this.$refs.uToast.show({
  953. type: 'error',
  954. message: "装车地不能为全国!",
  955. })
  956. return
  957. }
  958. [this.startPlace.fchooseprovince, this.endPlace.schooseprovince] = [this.endPlace.schooseprovince, this
  959. .startPlace.fchooseprovince
  960. ];
  961. [this.startPlace.fchoosecity, this.endPlace.schoosecity] = [this.endPlace.schoosecity, this.startPlace
  962. .fchoosecity
  963. ];
  964. [this.startPlace.fchoosearea, this.endPlace.schoosearea] = [this.endPlace.schoosearea, this.startPlace
  965. .fchoosearea
  966. ];
  967. [this.startPlace.selected, this.endPlace.selected] = [this.endPlace.selected, this.startPlace.selected];
  968. // [this.startPlace, this.endPlace] = [this.endPlace, this.startPlace];
  969. uni.setStorageSync('fPlaceObj', this.startPlace);
  970. uni.setStorageSync('sPlaceObj', this.endPlace);
  971. },
  972. goCity(type) {
  973. uni.$u.route('/pages/goodSource/selectCity', {
  974. startPlace: JSON.stringify(this.startPlace),
  975. endPlace: JSON.stringify(this.endPlace),
  976. type: type
  977. });
  978. },
  979. swiperChange(e) {
  980. this.tabIndex = e.detail.current
  981. }
  982. }
  983. }
  984. </script>
  985. <style scoped lang="scss">
  986. .popupShow {
  987. overflow: hidden;
  988. position: fixed;
  989. height: 100vh;
  990. width: 100%;
  991. }
  992. .content {
  993. background: #F2F4F7;
  994. }
  995. .banner {
  996. width: 100%;
  997. position: relative;
  998. }
  999. .u-flex-wrap {
  1000. flex-wrap: wrap;
  1001. }
  1002. .fixed,
  1003. .fixed1 {
  1004. background: linear-gradient(97deg, #4FABFD 0%, #2772FB 100%);
  1005. position: fixed;
  1006. top: var(--status-bar-height);
  1007. z-index: 999;
  1008. // width: calc(100% - 40rpx);
  1009. width: 100%;
  1010. // margin:0 20rpx;
  1011. }
  1012. .fixed1 {
  1013. top: 0;
  1014. height: var(--status-bar-height);
  1015. background: linear-gradient(97deg, #4FABFD 0%, #2772FB 100%);
  1016. }
  1017. .banner-img {
  1018. width: 100%;
  1019. }
  1020. .head {
  1021. position: absolute;
  1022. width: calc(100% - 108rpx);
  1023. bottom: 0;
  1024. background: white;
  1025. margin: 0 20rpx;
  1026. border-radius: 20rpx;
  1027. padding: 33rpx 33rpx 48rpx 33rpx;
  1028. .item1,
  1029. .item3 {
  1030. width: 40%;
  1031. .text {
  1032. text-overflow: ellipsis;
  1033. overflow: hidden;
  1034. white-space: nowrap;
  1035. }
  1036. }
  1037. .item1 .text {
  1038. text-align: left;
  1039. }
  1040. .item3 .text {
  1041. text-align: right;
  1042. }
  1043. }
  1044. .change-btn {
  1045. width: 86rpx;
  1046. height: 86rpx;
  1047. }
  1048. .good-list {
  1049. background-color: white;
  1050. margin: 10px 10px 15px 10px;
  1051. // padding: 10px 0px 0px 0;
  1052. border-radius: 30rpx;
  1053. box-shadow: 0px 5rpx 20rpx #E3E3E3;
  1054. .good-view {
  1055. padding: 10rpx 35rpx 10rpx 35rpx;
  1056. position: relative;
  1057. }
  1058. .item1,
  1059. .item3 {
  1060. // width: 40%;
  1061. display: flex;
  1062. .text {
  1063. text-overflow: ellipsis;
  1064. overflow: hidden;
  1065. white-space: nowrap;
  1066. }
  1067. }
  1068. .item1 .text {
  1069. text-align: left;
  1070. }
  1071. .item3 .text {
  1072. text-align: right;
  1073. }
  1074. }
  1075. .jt-icon {
  1076. position: relative;
  1077. // top: 6rpx;
  1078. width: 60rpx;
  1079. margin: 0 20rpx;
  1080. }
  1081. .row {
  1082. margin: 10rpx 0;
  1083. align-items: center;
  1084. }
  1085. .item-bottom {
  1086. background: #F0F5FF;
  1087. padding: 23rpx 30rpx;
  1088. border-radius: 0px 0px 18px 18px;
  1089. .name {
  1090. font-size: 26rpx;
  1091. font-weight: 700;
  1092. color: #000000;
  1093. margin-left: 30rpx;
  1094. }
  1095. .hp {
  1096. margin: 30rpx;
  1097. }
  1098. .number-color {
  1099. margin: 0 10rpx;
  1100. }
  1101. .qd {
  1102. background: linear-gradient(97deg, #4FABFD 0%, #2772FB 100%);
  1103. border-radius: 13rpx;
  1104. font-size: 29rpx;
  1105. font-weight: 400;
  1106. color: #FFFFFF;
  1107. padding: 15rpx 35rpx;
  1108. }
  1109. }
  1110. .dw {
  1111. align-items: center;
  1112. }
  1113. .place {
  1114. height: var(--status-bar-height);
  1115. }
  1116. .tab-view {
  1117. display: flex;
  1118. align-items: center;
  1119. justify-content: space-between;
  1120. // padding-left: 20rpx;
  1121. }
  1122. .tab-right {
  1123. display: flex;
  1124. margin-right: 39rpx;
  1125. align-items: center;
  1126. }
  1127. .other-goods {
  1128. // background: red;
  1129. color: #999999;
  1130. margin: 40rpx 0;
  1131. display: flex;
  1132. justify-content: center;
  1133. font-size: 36rpx;
  1134. }
  1135. .level2-title {
  1136. font-size: 28rpx;
  1137. }
  1138. .yf-style {
  1139. position: relative;
  1140. .left {
  1141. font-size: 25.39rpx;
  1142. .text-space {
  1143. margin-right: 20rpx;
  1144. }
  1145. .line {
  1146. margin: 0 10rpx;
  1147. }
  1148. }
  1149. .h-color {
  1150. // position: absolute;
  1151. // right: 0;
  1152. // top: -30rpx;
  1153. }
  1154. }
  1155. .xf-iamge {
  1156. width: 74rpx;
  1157. height: 43rpx;
  1158. position: absolute;
  1159. top: -20rpx;
  1160. right: 0;
  1161. }
  1162. .place-title {
  1163. margin-bottom: 11rpx;
  1164. }
  1165. .btn-color {
  1166. margin-top: 52rpx;
  1167. padding: 30rpx 0;
  1168. }
  1169. </style>