index.vue 33 KB

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