index.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086
  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. compId:item.compId,
  448. cargoOwnerName: item.cargoOwnerName,
  449. cargoOwner: item.cargoOwner,
  450. sendPrivate: item.sendPrivate,
  451. sendCity: item.sendCity,
  452. sendArea: item.sendArea,
  453. sendDetailedAddress: item.sendDetailedAddress,
  454. unloadPrivate: item.unloadPrivate,
  455. unloadCity: item.unloadCity,
  456. unloadArea: item.unloadArea,
  457. unloadDetailedAddress: item.unloadDetailedAddress,
  458. goodsName: item.goodsName,
  459. distance: item.distance,
  460. freightPrice: item.freightPrice,
  461. driverName: res2.data.driverName,
  462. driverPhone: res2.data.driverPhone,
  463. cargoOwnerPhone: item.cargoOwnerPhone,
  464. id:item.id,
  465. billingMethod:item.billingMethod,
  466. freightAdvance:item.freightAdvance,
  467. goodsType:item.goodsType,
  468. goodsTypeKey:item.goodsTypeKey
  469. }
  470. that.$request.baseRequest('post', '/publishTaskInfo/api/addOrder', _obj).then(res => {
  471. if (res.code == 200) {
  472. that.$refs.uToast.show({
  473. type: 'success',
  474. message: "抢单成功!",
  475. complete() {
  476. uni.switchTab({
  477. url: "/pages/order/index"
  478. })
  479. }
  480. })
  481. } else {
  482. that.$refs.uToast.show({
  483. type: 'error',
  484. message: res.message,
  485. })
  486. }
  487. })
  488. .catch(res => {
  489. uni.$u.toast(res.message);
  490. });
  491. });
  492. this.isShowAlert = false
  493. },
  494. cancelClick() {
  495. this.isShowAlert = false
  496. },
  497. carLength(good) {
  498. let length = ''
  499. if (good.carLengthSmall && good.carLength) {
  500. length = good.carLengthSmall + '~' + good.carLength + '米'
  501. } else if (good.carLengthSmall && !good.carLength) {
  502. length = "大于" + good.carLengthSmall + '米'
  503. } else if (good.carLength && !good.carLengthSmall) {
  504. length = "小于" + good.carLength + '米'
  505. }
  506. return length
  507. },
  508. carType(good) {
  509. let _val = '';
  510. if (good.carModel == 1) {
  511. _val = ''
  512. } else {
  513. if (good.carModel.includes(2)) {
  514. _val += '高栏 '
  515. }
  516. if (good.carModel.includes(3)) {
  517. _val += '集装箱 '
  518. }
  519. if (good.carModel.includes(4)) {
  520. _val += '自卸车 '
  521. }
  522. }
  523. return _val
  524. },
  525. carWeight(good) {
  526. good.loadWeightSmall
  527. good.loadWeight
  528. let weight = ''
  529. if (good.loadWeightSmall && good.loadWeight) {
  530. weight = good.loadWeightSmall + '~' + good.loadWeight + '吨'
  531. } else if (good.loadWeightSmall) {
  532. weight = "大于" + good.loadWeightSmall + '吨'
  533. } else if (good.loadWeight) {
  534. weight = "小于" + good.loadWeight + '吨'
  535. }
  536. return weight
  537. },
  538. getdate() {
  539. var date = new Date()
  540. var year = date.getFullYear() //获取完整的年份(4位)
  541. var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  542. var datetime = date.getDate() //获取当前日(1-31)
  543. if (mouth < 10) {
  544. mouth = '0' + mouth
  545. }
  546. if (datetime < 10) {
  547. datetime = '0' + datetime
  548. }
  549. return String(year) + String(mouth) + String(datetime)
  550. },
  551. grabOrders(item) {
  552. this.isShowAlert = true
  553. this.ObjSelect = item
  554. },
  555. confirmSelectType(val) {
  556. this.pickerSelect = val.value[0]
  557. this.show = false
  558. this.upCallback({size:10,num:1})
  559. },
  560. selectTypeClose() {
  561. this.show = false
  562. },
  563. selectType() {
  564. this.show = true
  565. },
  566. // getLngLat() {
  567. // var that=this
  568. // // uni.showLoading({
  569. // // title: '获取定位信息'
  570. // // })
  571. // uni.getLocation({
  572. // type: 'gcj02',
  573. // geocode: true,
  574. // success: res => {
  575. // if (res.latitude) {
  576. // console.log(res)
  577. // if(res.address.city){
  578. // if(res.address.city.indexOf('市')!=-1){
  579. // res.address.city=res.address.city.substring(0,res.address.city.length-1)
  580. // }
  581. // }
  582. // if(res.address.province){
  583. // if(res.address.province.indexOf('省')!=-1){
  584. // res.address.province=res.address.province.substring(0,res.address.province.length-1)
  585. // }
  586. // }
  587. // uni.setStorageSync('fPlaceObj',{
  588. // fchoosearea:'全部',
  589. // fchoosecity:res.address.city,
  590. // fchooseprovince:res.address.province,
  591. // selected:res.address.city
  592. // })
  593. // uni.setStorageSync('sPlaceObj',{
  594. // schoosearea:'请选择区',
  595. // schoosecity:'请选择市',
  596. // schooseprovince:'全国',
  597. // selected:'全国'
  598. // })
  599. // let _pickerSelect;
  600. // if (that.pickerSelect == '运费先付') {
  601. // _pickerSelect = 1
  602. // } else {
  603. // _pickerSelect = 0
  604. // }
  605. // that.startPlace.selected=res.address.city
  606. // that.startPlace.fchoosecity=res.address.city
  607. // let _data = {
  608. // searchKeyWord: this.tabIndex + 1,
  609. // searchType: _pickerSelect,
  610. // pageSize: 10,
  611. // currentPage: 1,
  612. // loadingPlaceCity: that.startPlace.fchoosecity,
  613. // // unLoadingPlaceCity: this.endPlace.schoosecity
  614. // }
  615. // that.$forceUpdate()
  616. // // that.$set(that.startPlace,'selected',res.address.city)
  617. // // that.lng = res.longitude;
  618. // // that.lat = res.latitude;
  619. // that.$request.baseRequest('get', '/publishTaskInfo/selectGoodsSource', _data).then(res => {
  620. // if (res.code == 200) {
  621. // console.log(res.data.records)
  622. // uni.hideLoading()
  623. // that.mescroll.endBySize(res.data.records.length, res.data.total);
  624. // if(res.data.records){
  625. // that.goods = res.data.records
  626. // for (let i = 0; i < that.goods.length; i++) {
  627. // if (that.goods[i].peripheralInfo == 1) {
  628. // that.isFirstIndex = i
  629. // return
  630. // }
  631. // }
  632. // }else{
  633. // that.goods=[]
  634. // }
  635. // }
  636. // uni.hideLoading()
  637. // })
  638. // .catch(res => {
  639. // uni.$u.toast(res.message);
  640. // that.mescroll.endErr();
  641. // });
  642. // } else {
  643. // if (uni.getSystemInfoSync().platform == 'android') {
  644. // var context = plus.android.importClass("android.content.Context");
  645. // var locationManager = plus.android.importClass(
  646. // "android.location.LocationManager");
  647. // var main = plus.android.runtimeMainActivity();
  648. // var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
  649. // that.bool = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)
  650. // }
  651. // if (that.bool === false) {
  652. // uni.showModal({
  653. // title: '提示',
  654. // content: '请打开定位服务',
  655. // success: ({
  656. // confirm,
  657. // cancel
  658. // }) => {
  659. // if (confirm) {
  660. // if (uni.getSystemInfoSync().platform == 'android') {
  661. // var Intent = plus.android.importClass(
  662. // 'android.content.Intent');
  663. // var Settings = plus.android.importClass(
  664. // 'android.provider.Settings');
  665. // var intent = new Intent(Settings
  666. // .ACTION_LOCATION_SOURCE_SETTINGS);
  667. // var main = plus.android.runtimeMainActivity();
  668. // main.startActivity(intent); // 打开系统设置GPS服务页面
  669. // }
  670. // }
  671. // }
  672. // });
  673. // }
  674. // uni.hideLoading()
  675. // }
  676. // }
  677. // });
  678. // },
  679. toDetail(id) {
  680. var that=this
  681. that.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
  682. driverPhone: this.userInfo.phone,
  683. }).then(res2 => {
  684. // console.log('跳转',1111111)
  685. uni.setStorageSync('firstAuthentication', res2.data)
  686. that.firstAuthentication=uni.getStorageSync('firstAuthentication')
  687. // console.log(that.firstAuthentication)
  688. //司机是否认证身份
  689. // 保留uni.getStorageSync('firstAuthentication'),thisfirstAuthentication有缓存问题
  690. if (uni.getStorageSync('firstAuthentication').authenticationStatus == '已认证') {
  691. uni.$u.route('/pages/goodSource/shippingDetails', {
  692. id: id,
  693. });
  694. } else if (uni.getStorageSync('firstAuthentication').authenticationStatus == '已过期') {
  695. that.$refs.uToast.show({
  696. type: 'error',
  697. message: "证件已过期,请上传新证件!",
  698. })
  699. } else {
  700. that.$refs.uToast.show({
  701. type: 'error',
  702. message: "请先完成司机认证!",
  703. })
  704. }
  705. })
  706. },
  707. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  708. upCallback(page) {
  709. var that =this
  710. let _pickerSelect;
  711. if (this.pickerSelect == '运费先付') {
  712. _pickerSelect = 1
  713. } else {
  714. _pickerSelect = 0
  715. }
  716. //选择省市区
  717. let _data = {
  718. searchKeyWord: this.tabIndex + 1,
  719. searchType: _pickerSelect,
  720. // loadingPlace: this.startPlace.selected,
  721. // unLoadingPlace: this.endPlace.selected=="全国"?'':this.endPlace.selected,
  722. pageSize: page.size,
  723. currentPage: page.num,
  724. // loadingPlaceCity: this.startPlace.fchoosecity,
  725. // unLoadingPlaceCity: this.endPlace.schoosecity
  726. }
  727. console.log(uni.getStorageSync('longitudeAndLatitude'))
  728. // if (this.tabIndex == 2) {
  729. if(uni.getStorageSync('longitudeAndLatitude')){
  730. this.lng=uni.getStorageSync('longitudeAndLatitude').split(',')[0]
  731. this.lat=uni.getStorageSync('longitudeAndLatitude').split(',')[1]
  732. }
  733. _data.driverLongitude = this.lng
  734. _data.driverLatitude = this.lat
  735. // }
  736. console.log('------')
  737. console.log(_data)
  738. if (uni.getStorageSync('fPlaceObj')) {
  739. if (this.startPlace.fchoosearea && this.startPlace.fchoosearea == '全部' && this.startPlace
  740. .fchoosearea != '请选择区') {
  741. // _data.loadingPlaceCity = this.startPlace.fchoosecity
  742. if(this.startPlace.fchoosecity=='市辖区'){
  743. _data.loadingPlaceCity = this.startPlace.fchooseprovince
  744. }else{
  745. _data.loadingPlaceCity = this.startPlace.fchoosecity
  746. }
  747. } else if (this.startPlace.fchoosecity == '全部') {
  748. _data.loadingPlace = this.startPlace.selected
  749. } else {
  750. _data.loadingPlaceCity = this.startPlace.fchoosecity
  751. _data.loadingPlace = this.startPlace.fchoosearea
  752. }
  753. } else {
  754. _data.loadingPlaceCity = this.startPlace.fchoosecity
  755. }
  756. if (uni.getStorageSync('sPlaceObj')) {
  757. if (this.endPlace.schoosearea && this.endPlace.schoosearea == '全部' && this.endPlace.schoosearea !=
  758. '请选择区') {
  759. if(this.endPlace.schoosecity=='市辖区'){
  760. _data.unLoadingPlaceCity = this.endPlace.schooseprovince
  761. }else{
  762. _data.unLoadingPlaceCity = this.endPlace.schoosecity
  763. }
  764. } else if (this.endPlace.schoosearea) {
  765. _data.unLoadingPlace = this.endPlace.selected == "全国" ? '' : this.endPlace.selected
  766. } else {
  767. _data.unLoadingPlace = this.endPlace.selected == "全国" ? '' : this.endPlace.selected
  768. _data.unLoadingPlaceCity = this.endPlace.schoosecity
  769. }
  770. } else {
  771. _data.unLoadingPlace = this.endPlace.selected == "全国" ? '' : this.endPlace.selected
  772. }
  773. if (this.lng) {
  774. _data.longitude = this.lng
  775. _data.latitude = this.lat
  776. }
  777. uni.showLoading({
  778. mask: true,
  779. title: '加载中'
  780. })
  781. console.log(_data)
  782. this.$request.baseRequest('get', '/publishTaskInfo/selectGoodsSource', _data).then(res => {
  783. if (res.code == 200) {
  784. uni.hideLoading()
  785. if (page.num == 1) {
  786. this.goods = [];
  787. // this.otherGoods = []
  788. };
  789. if(res.data.records){
  790. for(var i=0;i<res.data.records.length;i++){
  791. if(res.data.records[i].cargoDistance){
  792. if(res.data.records[i].cargoDistance>10){
  793. res.data.records[i].cargoDistance=res.data.records[i].cargoDistance.toFixed(0)
  794. }else{
  795. res.data.records[i].cargoDistance=res.data.records[i].cargoDistance.toFixed(1)
  796. }
  797. }
  798. if(res.data.records[i].distance){
  799. if(res.data.records[i].distance>10){
  800. res.data.records[i].distance=res.data.records[i].distance.toFixed(0)
  801. }else{
  802. res.data.records[i].distance=res.data.records[i].distance.toFixed(1)
  803. }
  804. }
  805. }
  806. }
  807. this.mescroll.endBySize(res.data.records.length, res.data.total);
  808. // for (var i = 0; i < res.data.records.length; i++) {
  809. // res.data.records[i].cargoOwnerName1=
  810. // }
  811. //如果是第一页需手动制空列表
  812. if(res.data.records){
  813. that.goods = that.goods.concat(res.data.records);
  814. for (let i = 0; i < that.goods.length; i++) {
  815. if (that.goods[i].peripheralInfo == 1) {
  816. that.isFirstIndex = i
  817. return
  818. }
  819. }
  820. }else{
  821. that.goods=[]
  822. }
  823. }
  824. })
  825. .catch(res => {
  826. uni.$u.toast(res.message);
  827. this.mescroll.endErr();
  828. });
  829. },
  830. clickTab(val) {
  831. this.tabIndex = val.index
  832. this.upCallback({
  833. size: 10,
  834. num: 1,
  835. })
  836. },
  837. changeCity() {
  838. if (this.endPlace.selected == '全国') {
  839. this.$refs.uToast.show({
  840. type: 'error',
  841. message: "装车地不能为全国!",
  842. })
  843. return
  844. }
  845. [this.startPlace.fchooseprovince, this.endPlace.schooseprovince] = [this.endPlace.schooseprovince, this
  846. .startPlace.fchooseprovince
  847. ];
  848. [this.startPlace.fchoosecity, this.endPlace.schoosecity] = [this.endPlace.schoosecity, this.startPlace
  849. .fchoosecity
  850. ];
  851. [this.startPlace.fchoosearea, this.endPlace.schoosearea] = [this.endPlace.schoosearea, this.startPlace
  852. .fchoosearea
  853. ];
  854. [this.startPlace.selected, this.endPlace.selected] = [this.endPlace.selected, this.startPlace.selected];
  855. // [this.startPlace, this.endPlace] = [this.endPlace, this.startPlace];
  856. uni.setStorageSync('fPlaceObj', this.startPlace);
  857. uni.setStorageSync('sPlaceObj', this.endPlace);
  858. },
  859. goCity(type) {
  860. uni.$u.route('/pages/goodSource/selectCity', {
  861. startPlace: JSON.stringify(this.startPlace),
  862. endPlace: JSON.stringify(this.endPlace),
  863. type: type
  864. });
  865. },
  866. swiperChange(e) {
  867. this.tabIndex = e.detail.current
  868. }
  869. }
  870. }
  871. </script>
  872. <style scoped lang="scss">
  873. .content {
  874. background: #F2F4F7;
  875. }
  876. .banner {
  877. width: 100%;
  878. position: relative;
  879. }
  880. .u-flex-wrap{
  881. flex-wrap: wrap;
  882. }
  883. .fixed,
  884. .fixed1 {
  885. background: linear-gradient(97deg, #4FABFD 0%, #2772FB 100%);
  886. position: fixed;
  887. top: var(--status-bar-height);
  888. z-index: 999;
  889. // width: calc(100% - 40rpx);
  890. width: 100%;
  891. // margin:0 20rpx;
  892. }
  893. .fixed1 {
  894. top: 0;
  895. height: var(--status-bar-height);
  896. background: linear-gradient(97deg, #4FABFD 0%, #2772FB 100%);
  897. }
  898. .banner-img {
  899. width: 100%;
  900. }
  901. .head {
  902. position: absolute;
  903. width: calc(100% - 108rpx);
  904. bottom: 0;
  905. background: white;
  906. margin: 0 20rpx;
  907. border-radius: 20rpx;
  908. .item1,
  909. .item3 {
  910. width: 40%;
  911. .text {
  912. text-overflow: ellipsis;
  913. overflow: hidden;
  914. white-space: nowrap;
  915. }
  916. }
  917. .item1 .text {
  918. text-align: left;
  919. }
  920. .item3 .text {
  921. text-align: right;
  922. }
  923. }
  924. .change-btn {
  925. width: 86rpx;
  926. height: 86rpx;
  927. }
  928. .good-list {
  929. background-color: white;
  930. margin: 10px 10px 15px 10px;
  931. padding: 10px 0px 0px 0;
  932. border-radius: 30rpx;
  933. box-shadow: 0px 5rpx 20rpx #E3E3E3;
  934. .item1,
  935. .item3 {
  936. // width: 40%;
  937. display: flex;
  938. .text {
  939. text-overflow: ellipsis;
  940. overflow: hidden;
  941. white-space: nowrap;
  942. }
  943. }
  944. .item1 .text {
  945. text-align: left;
  946. }
  947. .item3 .text {
  948. text-align: right;
  949. }
  950. }
  951. .jt-icon {
  952. position: relative;
  953. top: 6rpx;
  954. width: 60rpx;
  955. margin: 0 20rpx;
  956. }
  957. .row {
  958. margin: 10rpx 0;
  959. align-items: center;
  960. }
  961. .item-bottom {
  962. background: #F0F5FF;
  963. padding: 0 30rpx;
  964. border-radius: 0 0 30rpx 30rpx;
  965. .name {
  966. font-size: 26rpx;
  967. font-weight: 700;
  968. color: #000000;
  969. margin-left: 30rpx;
  970. }
  971. .hp {
  972. margin: 30rpx;
  973. }
  974. .number-color {
  975. margin: 0 10rpx;
  976. }
  977. .qd {
  978. background: linear-gradient(97deg, #4FABFD 0%, #2772FB 100%);
  979. border-radius: 13px;
  980. font-size: 29rpx;
  981. font-weight: 400;
  982. color: #FFFFFF;
  983. padding: 10rpx 35rpx;
  984. }
  985. }
  986. .dw {
  987. align-items: center;
  988. }
  989. .place {
  990. height: var(--status-bar-height);
  991. }
  992. .tab-view {
  993. display: flex;
  994. align-items: center;
  995. justify-content: space-between;
  996. }
  997. .tab-right {
  998. display: flex;
  999. margin-right: 20rpx;
  1000. align-items: center;
  1001. }
  1002. .other-goods {
  1003. // background: red;
  1004. color:#999999;
  1005. margin: 40rpx 0;
  1006. display: flex;
  1007. justify-content: center;
  1008. font-size: 36rpx;
  1009. }
  1010. .level2-title {
  1011. font-size: 28rpx;
  1012. }
  1013. .yf-style {
  1014. position: relative;
  1015. .h-color {
  1016. position: absolute;
  1017. right: 0;
  1018. top: -30rpx;
  1019. }
  1020. }
  1021. .xf-iamge {
  1022. width: 74rpx;
  1023. height: 43rpx;
  1024. position: absolute;
  1025. top: -20rpx;
  1026. right: 0;
  1027. }
  1028. </style>