index.vue 25 KB

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