detail.vue 6.7 KB

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