shippingDetails.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. <!-- 发运详情 -->
  2. <template>
  3. <view class="content">
  4. <!-- <u-navbar title="发运详情" :bgColor="bgColor" @leftClick='back' :placeholder='true' leftIconColor="#fff" titleStyle='color:#fff'
  5. :rightText='caseText' @rightClick="rightClick">
  6. </u-navbar> -->
  7. <!-- <u-navbar leftText="发运详情" height="50" :bgColor="bgColor" @leftClick='back' :placeholder='true'
  8. leftIconColor="#fff" :titleStyle='titleStyle' leftIconSize='38rpx' rightIcon>
  9. </u-navbar> -->
  10. <u-navbar :placeholder='true' :bgColor="bgColor" @leftClick='back'>
  11. <view class="u-nav-slot nav-left" slot="left">
  12. <u-icon name="arrow-left" size="19" color="#fff"></u-icon>
  13. <text style="margin-left:20rpx;">发运详情</text>
  14. <!-- <u-line direction="column" :hairline="false" length="16" margin="0 8px"></u-line>
  15. <u-icon name="home" size="20"></u-icon> -->
  16. </view>
  17. <view class="u-nav-slot nav-right" slot="right">
  18. <!-- <text class="case-style" @click="rightClick">已关注</text>
  19. <image src="../../static/fenxiang.png" mode="widthFix" style="width: 40rpx;" @click="share"></image> -->
  20. </view>
  21. </u-navbar>
  22. <view class="top-bgc"></view>
  23. <view class="content-move">
  24. <view class="content1">
  25. <view class="row1 flex flex-space-between">
  26. <view class="left flex">
  27. <u-image
  28. :src="detailData.cargoOwnerPortrait?detailData.cargoOwnerPortrait:'../../static/images/mine/tx.png'"
  29. width='122rpx' height='122rpx' shape="circle">
  30. </u-image>
  31. <view class="fontsize-46 ml20">{{detailData.cargoOwnerCall}}</view>
  32. </view>
  33. <view class="right">
  34. <view class="flex">
  35. <view class="call fontsize-28"
  36. @click="$helper.contactCustomerService(detailData.cargoOwnerPhone)">
  37. <image style='width:12px;height:12px;margin-right:4px;'
  38. src="../../static/images/goodSource/dianhua.png" mode=""></image>联系货主
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="row hztype-style">
  44. {{detailData.cargoOwner}}
  45. </view>
  46. <!-- 当前版本不做 -->
  47. <view class="row3 flex fontsize-24">
  48. <!-- <view class="item flex">
  49. <view class="gray">好评率</view>
  50. <view class="number-color">99%</view>
  51. </view> -->
  52. <!-- <view class="item flex">
  53. <view class="gray">发运次数</view>
  54. <view class="number-color">106</view>
  55. </view> -->
  56. <!-- <view class="item flex">
  57. <view class="gray">评价</view>
  58. <view class="number-color">10</view>
  59. </view> -->
  60. </view>
  61. <view class="row4">
  62. <view class="flex fontsize-26">
  63. <view class="left">装</view>
  64. <view class="right flex align-center">
  65. {{detailData.sendPrivate}}{{detailData.sendCity}}{{detailData.sendArea}}{{detailData.sendDetailedAddress}}
  66. </view>
  67. </view>
  68. <u-line class="line" margin="20rpx 0"></u-line>
  69. <view class="flex fontsize-26">
  70. <view class="left-x">卸</view>
  71. <view class=" right align-center">
  72. {{detailData.unloadPrivate}}{{detailData.unloadCity}}{{detailData.unloadArea}}{{detailData.unloadDetailedAddress}}
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. <view class="content2">
  78. <view class="flex align-center">
  79. <view class="left">货物</view>
  80. <view class="right flex">
  81. <view>{{detailData.goodsName}}</view>
  82. <view style='margin: 0 10rpx;'>|</view>
  83. <view v-if='detailData.weight'>{{detailData.weight}}吨</view>
  84. <view v-else>无</view>
  85. </view>
  86. </view>
  87. <view class="flex align-center msx20">
  88. <view class="left">距离</view>
  89. <view class="right flex align-center">
  90. <view>运输距离约{{detailData.distance}}公里</view>
  91. <image @click="toMap()" style='width:14px;height:14px;margin-left:4px;'
  92. src="../../static/images/goodSource/dituzuobiao.png" mode=""></image>
  93. </view>
  94. </view>
  95. <view class="flex align-center">
  96. <view class="left">运费</view>
  97. <view class="right">{{detailData.freightPrice}}元/吨</view>
  98. </view>
  99. <view class="flex msx20">
  100. <view class="left">日期</view>
  101. <view class="right">
  102. <view class="in-row flex">
  103. <text style="margin-right: 40rpx;">发布</text>
  104. <view class="time">{{detailData.createDate}}</view>
  105. </view>
  106. </view>
  107. </view>
  108. <view class="flex msx20">
  109. <view class="left"></view>
  110. <view class="right">
  111. <view class="in-row flex">
  112. <text style="margin-right: 40rpx;">装车</text>
  113. <view class="time"
  114. v-if='detailData.loadingDateStart=="随时"&&detailData.loadingDateEnd=="随时"'>
  115. {{detailData.loadingDateStart}}
  116. </view>
  117. <view class="time" v-else>{{detailData.loadingDateStart}}~{{detailData.loadingDateEnd}}
  118. </view>
  119. </view>
  120. </view>
  121. </view>
  122. <view class="flex align-center">
  123. <view class="left">车型</view>
  124. <!-- carModel -->
  125. <view class="right">
  126. <text>{{this.carModel}}</text>
  127. <!-- <text v-show="detailData.carModel.indexOf('1') != -1">不限</text>
  128. <text v-show="detailData.carModel.indexOf('2') != -1">高栏 | </text>
  129. <text v-show="detailData.carModel.indexOf('3') != -1">集装箱 | </text>
  130. <text v-show="detailData.carModel.indexOf('4') != -1">自卸车</text> -->
  131. </view>
  132. <!-- <view class="right" v-else>不限</view> -->
  133. </view>
  134. <view class="flex mt20">
  135. <view class="left">描述</view>
  136. <view class="right">
  137. {{detailData.taskDescription?detailData.taskDescription:'无'}}
  138. </view>
  139. </view>
  140. </view>
  141. <view class="content3">
  142. <view class="left">运费<view class="text">{{detailData.freightPrice}}元/吨</view>
  143. </view>
  144. <view class="right">
  145. <view class="btn" @click.stop="grabOrders()">立即抢单</view>
  146. </view>
  147. <!-- <view class="right">
  148. <u-button type="error" text="已抢单" disabled></u-button>
  149. </view> -->
  150. </view>
  151. <u-toast ref="uToast"></u-toast>
  152. <u-modal :show="isShowAlert" :title="alertTitle" :closeOnClickOverlay='true' :showCancelButton='true'
  153. confirmColor='#2772FB' @confirm="$u.throttle(confirmClick(), 1000)" @close="cancelClick"
  154. @cancel="cancelClick"></u-modal>
  155. </view>
  156. </view>
  157. </template>
  158. <script>
  159. import {
  160. mapState
  161. } from 'vuex';
  162. export default {
  163. data() {
  164. return {
  165. titleStyle: {
  166. "fontSize": "38rpx",
  167. "fontWeight": 500,
  168. "color": "#FFFFFF"
  169. },
  170. isShowAlert: false,
  171. alertTitle: '确定抢单?',
  172. caseText: '关注',
  173. bgColor: '#317AFE',
  174. src: 'https://cdn.uviewui.com/uview/album/1.jpg',
  175. id: '',
  176. detailData: {},
  177. carModel:""
  178. };
  179. },
  180. onLoad(options) {
  181. console.log(options)
  182. this.id = options.id
  183. this.init()
  184. },
  185. computed: {
  186. ...mapState(['hasLogin', 'userInfo', 'firstAuthentication']),
  187. carLength() {
  188. let length = ''
  189. if (this.detailData.carLengthSmall && this.detailData.carLength) {
  190. length = this.detailData.carLengthSmall + '~' + this.detailData.carLength + '米'
  191. } else if (this.detailData.carLengthSmall) {
  192. length = "大于" + this.detailData.carLengthSmall + '米'
  193. } else if (this.detailData.carLength) {
  194. length = "小于" + this.detailData.carLength + '米'
  195. }
  196. console.log(length)
  197. return length
  198. },
  199. carWeight() {
  200. this.detailData.loadWeightSmall
  201. this.detailData.loadWeight
  202. let weight = ''
  203. if (this.detailData.loadWeightSmall && this.detailData.loadWeight) {
  204. weight = this.detailData.loadWeightSmall + '~' + this.detailData.loadWeight + '吨'
  205. } else if (this.detailData.loadWeightSmall) {
  206. weight = "大于" + this.detailData.loadWeightSmall + '吨'
  207. } else if (this.detailData.loadWeight) {
  208. weight = "小于" + this.detailData.loadWeight + '吨'
  209. }
  210. console.log(weight)
  211. return weight
  212. },
  213. },
  214. methods: {
  215. carType() {
  216. let _val = '';
  217. if (!this.detailData.carModel) this.detailData.carModel = ''
  218. if (this.detailData.carModel == 1) {
  219. _val = '不限'
  220. } else {
  221. if (this.detailData.carModel.includes(2)) {
  222. _val += '高栏/'
  223. }
  224. if (this.detailData.carModel.includes(3)) {
  225. _val += '集装箱/'
  226. }
  227. if (this.detailData.carModel.includes(4)) {
  228. _val += '自卸车'
  229. }
  230. }
  231. console.log(_val)
  232. this.carModel = _val
  233. },
  234. share() {
  235. console.log('share')
  236. },
  237. rightClick() {
  238. uni.$u.toast('后台接口未写');
  239. // 关注
  240. // console.log(123)
  241. // this.$request.baseRequest('get', '/publishTaskInfo/seeTask', {
  242. // reCommonId: this.userInfo.id,
  243. // }).then(res => {
  244. // this.mescroll.resetUpScroll()
  245. // })
  246. // .catch(res => {
  247. // uni.$u.toast(res.message);
  248. // });
  249. },
  250. init() {
  251. this.$request.baseRequest('get', '/publishTaskInfo/seeTask', {
  252. id: this.id,
  253. // id: '8f1f3c624d7946d79a9d44a4057d9623',
  254. }).then(res => {
  255. if (res.code == 200) {
  256. this.detailData = res.data
  257. this.carType()
  258. }
  259. })
  260. .catch(res => {
  261. uni.$u.toast(res.message);
  262. });
  263. },
  264. toMap() {
  265. uni.setStorageSync('sendaddress', {
  266. sendLatitude: this.detailData.sendLatitude,
  267. sendLongitude: this.detailData.sendLongitude,
  268. })
  269. uni.setStorageSync('unsendaddress', {
  270. unsendLatitude: this.detailData.unsendLatitude,
  271. unsendLongitude: this.detailData.unsendLongitude,
  272. })
  273. uni.setStorageSync('distance', this.detailData.distance, )
  274. uni.$u.route('/pages/goodSource/map', {
  275. id: 1,
  276. });
  277. },
  278. back() {
  279. uni.navigateBack({
  280. })
  281. },
  282. call() {
  283. uni.makePhoneCall({
  284. phoneNumber: '114' //仅为示例
  285. });
  286. },
  287. grabOrders() {
  288. this.isShowAlert = true
  289. },
  290. confirmClick() {
  291. let item = this.detailData
  292. console.log(item)
  293. var that = this
  294. this.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
  295. driverPhone: this.userInfo.phone,
  296. }).then(res2 => {
  297. if (res2.data.authenticationStatus == '已过期') {
  298. that.$refs.uToast.show({
  299. type: 'error',
  300. message: '证件已过期,请上传新证件!',
  301. })
  302. return
  303. } else if (res2.data.authenticationStatus == '未认证' || res2.data.authenticationStatus ==
  304. '已驳回') {
  305. that.$refs.uToast.show({
  306. type: 'error',
  307. message: '请先完成司机认证!',
  308. })
  309. return
  310. } else if (res2.data.authenticationStatus == '审核中') {
  311. that.$refs.uToast.show({
  312. type: 'error',
  313. message: '司机审核中!',
  314. })
  315. return
  316. }
  317. let _obj = {
  318. driverCommonId: res2.data.commonId,
  319. commonId: item.commonId,
  320. id: item.id,
  321. compId: item.compId,
  322. cargoOwnerName: item.cargoOwnerName,
  323. cargoOwner: item.cargoOwner,
  324. sendPrivate: item.sendPrivate,
  325. sendCity: item.sendCity,
  326. sendArea: item.sendArea,
  327. sendDetailedAddress: item.sendDetailedAddress,
  328. unloadPrivate: item.unloadPrivate,
  329. unloadCity: item.unloadCity,
  330. unloadArea: item.unloadArea,
  331. unloadDetailedAddress: item.unloadDetailedAddress,
  332. goodsName: item.goodsName,
  333. goodsType:item.goodsType,
  334. distance: item.distance,
  335. freightPrice: item.freightPrice,
  336. driverName: res2.data.driverName,
  337. driverPhone: res2.data.driverPhone,
  338. cargoOwnerPhone: item.cargoOwnerPhone
  339. }
  340. that.$request.baseRequest('post', '/publishTaskInfo/api/addOrder', _obj).then(res => {
  341. if (res.code == 200) {
  342. that.$refs.uToast.show({
  343. type: 'success',
  344. message: "抢单成功!",
  345. complete() {
  346. uni.switchTab({
  347. url: "/pages/order/index"
  348. })
  349. }
  350. })
  351. } else {
  352. that.$refs.uToast.show({
  353. type: 'error',
  354. message: res.message,
  355. })
  356. }
  357. })
  358. .catch(res => {
  359. uni.$u.toast(res.message);
  360. });
  361. }).catch(res => {
  362. uni.$u.toast(res.message);
  363. });
  364. this.isShowAlert = false
  365. },
  366. cancelClick() {
  367. this.isShowAlert = false
  368. },
  369. }
  370. }
  371. </script>
  372. <style lang="scss">
  373. /deep/.u-navbar__content__right__text {
  374. background: rgba(255, 255, 255, 0.2);
  375. padding: 3px 10px;
  376. border-radius: 16px;
  377. font-size: 26rpx;
  378. color: #FFFFFF;
  379. }
  380. .top-bgc {
  381. padding-top: 30rpx;
  382. position: relative;
  383. width: 100%;
  384. height: 519rpx;
  385. background: linear-gradient(180deg, #317AFE 0%, #F8F9FC 100%);
  386. }
  387. .content-move {
  388. position: relative;
  389. top: -460rpx;
  390. }
  391. .content1 {
  392. background: white;
  393. margin: 0 20rpx;
  394. border-radius: 20rpx;
  395. // padding: 0 46rpx;
  396. .hztype-style {
  397. width: 100%;
  398. font-size: 28rpx;
  399. color: #121212;
  400. padding: 0 0 20rpx 46rpx;
  401. font-weight: 700;
  402. border-bottom: 2px dotted #ccc
  403. }
  404. .row1 {
  405. padding: 0 46rpx;
  406. .left {
  407. position: relative;
  408. top: -50rpx;
  409. align-items: flex-end;
  410. }
  411. }
  412. .row3 {
  413. margin: 20rpx 0;
  414. .item {
  415. margin-right: 40rpx;
  416. }
  417. }
  418. .row4 {
  419. align-items: center;
  420. padding: 0 46rpx 46rpx 46rpx;
  421. margin-top: 20rpx;
  422. .left {
  423. display: flex;
  424. align-items: center;
  425. justify-content: center;
  426. width: 30rpx;
  427. height: 30rpx;
  428. background: #2772FB;
  429. padding: 20rpx;
  430. box-sizing: border-box;
  431. font-size: 26rpx;
  432. border-radius: 8rpx;
  433. color: #FFFFFF;
  434. }
  435. .left-x {
  436. display: flex;
  437. align-items: center;
  438. justify-content: center;
  439. width: 30rpx;
  440. height: 30rpx;
  441. background: #FE6300;
  442. padding: 20rpx;
  443. box-sizing: border-box;
  444. font-size: 26rpx;
  445. border-radius: 8rpx;
  446. color: #FFFFFF;
  447. }
  448. .right {
  449. color: #666666;
  450. margin-left: 20rpx;
  451. }
  452. }
  453. }
  454. .call {
  455. display: flex;
  456. align-items: center;
  457. background: #E5F0FE;
  458. padding: 10rpx 30rpx;
  459. border-radius: 30rpx;
  460. color: #2772FB;
  461. }
  462. .number-color {
  463. margin-left: 20rpx;
  464. }
  465. .content2 {
  466. background: white;
  467. border-radius: 20rpx;
  468. margin: 20rpx;
  469. padding: 30rpx;
  470. font-size: 26rpx;
  471. .left {
  472. color: #666666;
  473. margin-right: 20rpx;
  474. box-sizing: border-box;
  475. width: 8vw;
  476. }
  477. .right {
  478. width: 90%;
  479. }
  480. .in-row {
  481. .text {
  482. margin-right: 60rpx;
  483. }
  484. }
  485. }
  486. .content3 {
  487. position: fixed;
  488. bottom: 0;
  489. width: 100%;
  490. display: flex;
  491. background: white;
  492. justify-content: space-between;
  493. padding: 40rpx 20rpx;
  494. box-sizing: border-box;
  495. align-items: center;
  496. .left {
  497. display: flex;
  498. .text {
  499. color: #FE6300;
  500. margin-left: 20rpx;
  501. }
  502. }
  503. }
  504. .btn {
  505. background: #2772FB;
  506. color: white;
  507. font-size: 28rpx;
  508. border-radius: 40rpx;
  509. padding: 20rpx 40rpx;
  510. }
  511. .nav-left {
  512. display: flex;
  513. color: #fff;
  514. font-size: 38rpx;
  515. padding-top: 60rpx;
  516. box-sizing: border-box;
  517. }
  518. .nav-right {
  519. display: flex;
  520. align-items: center;
  521. padding-top: 60rpx;
  522. box-sizing: border-box;
  523. .case-style {
  524. margin-right: 20rpx;
  525. background: rgba(255, 255, 255, 0.2);
  526. border-radius: 32rpx;
  527. font-size: 24rpx;
  528. font-weight: 400;
  529. color: #FFFFFF;
  530. padding: 6rpx 28rpx;
  531. }
  532. }
  533. </style>