index.vue 35 KB

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