detail.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <template>
  2. <view class="order-detail">
  3. <zs-skeleton type="orderDetail" :loading="pageLoading"></zs-skeleton>
  4. <view class="status-box">
  5. <view class="text-box">
  6. <view class="status">
  7. {{ info.goodsList[0] | filterType }}
  8. </view>
  9. </view>
  10. </view>
  11. <view class="content">
  12. <view class="title">
  13. 行程信息
  14. </view>
  15. <view class="item">
  16. <view class="label">
  17. 下单时间
  18. </view>
  19. <view class="value">
  20. {{ info.goodsList[0].extend.createTime }}
  21. </view>
  22. </view>
  23. <view class="item">
  24. <view class="label">
  25. 出发地点
  26. </view>
  27. <view class="value">
  28. {{ info.goodsList[0].extend.originName }}
  29. </view>
  30. </view>
  31. <view class="item">
  32. <view class="label">
  33. 到达地点
  34. </view>
  35. <view class="value ">
  36. {{ info.goodsList[0].extend.destinationName }}
  37. </view>
  38. </view>
  39. <view class="price-box">
  40. <view class="price">
  41. {{ info.goodsList[0].payAmount }} 元
  42. </view>
  43. <view class="text" @click="clickDetail">
  44. <view>收费明细</view>
  45. <image class="img" :class="show ? 'deg90' : '-deg90'" src="@/static/jiantou-icon.png"></image>
  46. </view>
  47. </view>
  48. <template v-if="show">
  49. <view class="item" :key="index" v-for="(item, index) in info.goodsList[0].extend.priceItems">
  50. <view class="label">
  51. {{ item.title }}
  52. </view>
  53. <view class="value">
  54. {{ item.value }}元
  55. </view>
  56. </view>
  57. </template>
  58. <view class="title" style=" margin-top: 28rpx;">
  59. 全程{{ (distance / 1000).toFixed(1) }}公里,{{ isNaN(minutes) ? 0 : minutes }}分钟
  60. </view>
  61. </view>
  62. <view class="content">
  63. <view class="title">
  64. 订单信息
  65. </view>
  66. <view class="item">
  67. <view class="label">
  68. 订单编号
  69. </view>
  70. <view class="value">
  71. {{ info.orderNo }}
  72. </view>
  73. </view>
  74. <view v-if="info.goodsList[0].goodsState == 'CLOSE'" class="item">
  75. <view class="label">
  76. 取消原因
  77. </view>
  78. <view class="value">
  79. {{ info.goodsList[0].extend.cancelReason }}
  80. </view>
  81. </view>
  82. <view class="item" v-if="info.goodsList[0].goodsState == 'USED'">
  83. <view class="label">
  84. 付款方式
  85. </view>
  86. <view class="value">
  87. 线下支付
  88. </view>
  89. </view>
  90. </view>
  91. <button type="default" :loading="btnLoading" class="pay-btn" v-if="info.goodsList[0].goodsState == 'WAIT_PAYMENT'"
  92. @click="toTrip">前往订单</button>
  93. </view>
  94. </template>
  95. <script>
  96. var QQMapWX = require('@/libs/qqmap-wx-jssdk.min.js');
  97. var qqmapsdk = new QQMapWX({
  98. key: 'KX5BZ-B64RC-RO62W-AMWAZ-VVTC3-YAFXF'
  99. });
  100. import { payDetails } from '@/api/payment.js';
  101. export default {
  102. data() {
  103. return {
  104. isVisual: false,//是否是虚拟商品
  105. codeData: '123',
  106. show: false,
  107. loading: false,
  108. pageLoading: true,
  109. info: {
  110. goodsList: [{
  111. goodsState: 'CLOSE', serviceFee: 0, extend: {
  112. }
  113. }]
  114. },
  115. distance: 0,
  116. minutes: 0
  117. }
  118. },
  119. watch: {
  120. // isNotTime(val) {
  121. // if(this.isNotTime){
  122. // this.payDetails(this.info.orderNo)
  123. // }
  124. // }
  125. },
  126. filters: {
  127. filterType: function (val) {
  128. if (val.refundLog && val.refundLog.refund == 'REFUSAL_REFUND' && !val.change) {
  129. return '拒绝退款'
  130. }
  131. else if (val.goodsState == 'APPLY_REFUND') {
  132. return '退款审核中'
  133. } else if (val.goodsState == 'CLOSE') {
  134. return '关闭订单'
  135. } else if (val.goodsState == 'REFUNDED') {
  136. return '已退款'
  137. } else if (val.goodsState == 'REFUSAL_REFUND') {
  138. return '拒绝退款'
  139. } else if (val.goodsState == 'APPLY_REFUNDING') {
  140. return '退款中'
  141. } else if (val.goodsState == 'USED') {
  142. return '已结束'
  143. } else if (val.goodsState == 'WAIT_PAYMENT') {
  144. return '进行中'
  145. } else if (val.goodsState == 'WAIT_USE') {
  146. return '待使用'
  147. } else {
  148. return ''
  149. }
  150. },
  151. },
  152. methods: {
  153. toTrip() {
  154. uni.redirectTo({
  155. url: '/trip/index/index'
  156. });
  157. },
  158. close() {
  159. this.show = false
  160. },
  161. // 获取订单详情
  162. payDetails(orderNo) {
  163. payDetails(orderNo).then(res => {
  164. this.pageLoading = false
  165. this.info = res.content
  166. this.distance = this.info.goodsList[0].extend.distance
  167. // 计算开始和结束的距离
  168. // const destinationLongitude = this.info.goodsList[0].extend.destinationLongitude
  169. // const destinationLatitude = this.info.goodsList[0].extend.destinationLatitude
  170. // const originLongitude = this.info.goodsList[0].extend.originLongitude
  171. // const originLatitude = this.info.goodsList[0].extend.originLatitude
  172. // qqmapsdk.calculateDistance({
  173. // mode: 'driving',
  174. // from: {
  175. // latitude: originLatitude,
  176. // longitude: originLongitude
  177. // },
  178. // to: [{
  179. // latitude: destinationLatitude,
  180. // longitude: destinationLongitude
  181. // }],
  182. // success: (res) => {
  183. // console.log(res)
  184. // if (res.message === 'Success') {
  185. // this.distance = res.result.elements[0].distance.toFixed(2)
  186. // }
  187. // }
  188. // })
  189. // 计算订单开始到结束的耗时
  190. // driverEndTime
  191. // driverArrivedTime
  192. const driverEndTime = new Date(this.info.goodsList[0].extend.driverEndTime).getTime()
  193. const startTime = new Date(this.info.goodsList[0].extend.driverStartTime).getTime()
  194. const time = driverEndTime - startTime
  195. console.log(time)
  196. // 转换为分钟数
  197. this.minutes = Math.ceil((time / 1000 / 60))
  198. })
  199. },
  200. clickDetail() {
  201. this.show = !this.show
  202. }
  203. },
  204. onReady() {
  205. },
  206. onLoad(options) {
  207. this.info.orderNo = options.id
  208. },
  209. onShow() {
  210. this.pageLoading = true
  211. this.payDetails(this.info.orderNo)
  212. },
  213. created() {
  214. // this.info = JSON.parse(uni.getStorageSync('order'))
  215. }
  216. }
  217. </script>
  218. <style lang="scss">
  219. .order-detail {
  220. background: #F9F9F9;
  221. min-height: 100vh;
  222. padding-bottom: 100rpx;
  223. .status-box {
  224. padding: 24rpx 24rpx 4rpx;
  225. display: flex;
  226. justify-content: space-between;
  227. .text-box {
  228. color: #181818;
  229. .status {
  230. font-weight: bold;
  231. font-size: 32rpx;
  232. display: flex;
  233. .u-count-down__text {
  234. color: $uni-color-primary !important;
  235. }
  236. }
  237. .notice {
  238. font-size: 24rpx;
  239. margin-top: 20rpx;
  240. }
  241. }
  242. }
  243. .pay-btn {
  244. background: $uni-color-primary;
  245. width: 688rpx;
  246. height: 80rpx;
  247. line-height: 80rpx;
  248. border-radius: 46rpx;
  249. color: #fff;
  250. margin-top: 50rpx;
  251. }
  252. .content {
  253. margin: 20rpx 30rpx;
  254. padding: 28rpx 24rpx;
  255. border-radius: 16rpx;
  256. background: #fff;
  257. .title {
  258. font-weight: 600;
  259. font-size: 28rpx;
  260. color: #222222;
  261. }
  262. .item {
  263. display: flex;
  264. align-items: center;
  265. justify-content: space-between;
  266. margin-top: 28rpx;
  267. .label {
  268. font-size: 28rpx;
  269. color: #AAAAAA;
  270. }
  271. .value {
  272. font-size: 28rpx;
  273. color: #222222;
  274. word-break: break-all;
  275. max-width: 80%;
  276. }
  277. }
  278. .price-box {
  279. display: flex;
  280. align-items: center;
  281. justify-content: space-between;
  282. margin-top: 28rpx;
  283. .price {
  284. font-size: 36rpx;
  285. font-weight: bold;
  286. color: #222222;
  287. }
  288. .text {
  289. font-size: 24rpx;
  290. color: #AAAAAA;
  291. display: flex;
  292. align-items: center;
  293. .img {
  294. margin-left: 16rpx;
  295. width: 24rpx;
  296. height: 24rpx;
  297. }
  298. .deg90 {
  299. rotate: 90deg;
  300. }
  301. .-deg90 {
  302. rotate: -90deg;
  303. }
  304. }
  305. }
  306. }
  307. }
  308. </style>