index.vue 32 KB

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