index.vue 25 KB

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