shippingDetails.vue 11 KB

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