shippingDetails.vue 14 KB

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