shippingDetails.vue 11 KB

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