details.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <view>
  3. <ujp-navbar> 优惠券详情</ujp-navbar>
  4. <view class="details">
  5. <view class="details-title">
  6. <h4>优惠券明细</h4>
  7. </view>
  8. <view class="details-row" >
  9. <p>优惠券类型</p>
  10. <span>免费停车优惠券</span>
  11. </view>
  12. <view class="details-row">
  13. <p>免费停电时长</p>
  14. <span>
  15. {{parkingCoupon.freeMinute?minuteConversion(parkingCoupon.freeMinute,1):''}}
  16. </span>
  17. </view>
  18. <view class="details-row">
  19. <p>开始充电时间</p><span>{{chargingRecord.startTime?chargingRecord.startTime:chargingRecord.endTime}}</span>
  20. </view>
  21. <view class="details-row">
  22. <p>结束充电时间</p><span>{{chargingRecord.endTime}}</span>
  23. </view>
  24. <view class="details-row" >
  25. <p>订单编号</p>
  26. <span>{{chargingRecord.flowNo}}</span>
  27. </view>
  28. <view v-for="(item,i) in chargeDetails" :key="i" v-if="detail.deviceType!=0">
  29. <view class="details-row" style=" margin-top: 18px;">
  30. <p>区间充电量({{item.startTime}}-{{item.endTime}})</p>
  31. <span v-if="item.fixKwh&&item.kwh">{{(item.kwh+item.fixKwh).toFixed(2) }}度</span>
  32. <span v-else>{{item.kwh.toFixed(2) }}度</span>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="details">
  37. <view class="details-title">
  38. <h4>更多信息</h4>
  39. </view>
  40. <view class="details-row">
  41. <p>车牌号</p><span>{{chargingRecord.carNumber?chargingRecord.carNumber:'未填写'}}</span>
  42. </view>
  43. <view class="details-row">
  44. <p>用户姓名</p><span>{{chargingUser.nickName}}</span>
  45. </view>
  46. <view class="details-row">
  47. <p>联系方式</p><span>{{chargingUser.phone}}</span>
  48. </view>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import * as API from '@/apis/coupon.js'
  54. import {
  55. minuteConversion
  56. } from '@/utils'
  57. export default {
  58. data() {
  59. return {
  60. chargeDetails: [],
  61. id: '',
  62. sprList: [
  63. ],
  64. detail: {
  65. },
  66. options0: [
  67. {
  68. label: '自行车充电',
  69. value: 0,
  70. },
  71. {
  72. label: '直流快充',
  73. value: 1,
  74. },
  75. {
  76. label: '交流慢充',
  77. value: 2,
  78. }
  79. ],
  80. title: "",
  81. parkingCoupon: {},
  82. chargingUser: {},
  83. chargingRecord: {},
  84. couponObj: null,
  85. }
  86. },
  87. onLoad(op) {
  88. this.id = op.id;
  89. this.getInfo()
  90. },
  91. methods: {
  92. minuteConversion(a,b){
  93. return minuteConversion(a,b)
  94. },
  95. getPercent(estimateMinute) {
  96. var value = "";
  97. var ms = estimateMinute
  98. if (ms > 0) {
  99. var Hour = parseInt(Math.floor(ms / 60));
  100. var Fen = parseInt(Math.floor(ms % 60));
  101. if (Hour) {
  102. value += Hour + "小时"
  103. }
  104. if (Fen) {
  105. value += Fen + "分钟"
  106. }
  107. } else {
  108. value = "0分钟"
  109. }
  110. return value;
  111. },
  112. back() {
  113. uni.navigateBack({
  114. })
  115. },
  116. getInfo() {
  117. uni.showLoading({
  118. title: "加载中",
  119. mask: true,
  120. })
  121. API.couponDetails({
  122. id: this.id
  123. }).then((res) => {
  124. this.chargingRecord = res.data.chargingRecord
  125. this.chargingUser = res.data.chargingUser
  126. this.parkingCoupon = res.data.parkingCoupon
  127. uni.hideLoading()
  128. }).catch(error => {
  129. uni.showToast({
  130. title: error
  131. })
  132. })
  133. }
  134. }
  135. }
  136. </script>
  137. <style>
  138. page {
  139. background-color: #F7F7F7;
  140. }
  141. </style>
  142. <style lang="scss" scoped>
  143. .detailsBtn {
  144. margin: 16px;
  145. .detailsBtn-btn {
  146. border-color: #185AC6 !important;
  147. border-radius: 8px !important;
  148. background: none !important;
  149. color: #185AC6 !important;
  150. }
  151. }
  152. .details-title {
  153. margin-bottom: 16px;
  154. h4 {
  155. font-weight: normal;
  156. font-size: 16px;
  157. position: relative;
  158. padding-left: 10px;
  159. &::after {
  160. content: '';
  161. position: absolute;
  162. height: 12px;
  163. width: 4px;
  164. background-color: #27B148;
  165. left: 0;
  166. top: 5px;
  167. }
  168. }
  169. }
  170. .details-row {
  171. display: flex;
  172. justify-content: space-between;
  173. align-items: center;
  174. margin-top: 15px;
  175. p {
  176. color: #37393c;
  177. font-weight: bold;
  178. }
  179. }
  180. .details {
  181. margin: 34rpx;
  182. padding: 34rpx;
  183. background-color: #fff;
  184. border-radius: 8px;
  185. .details-head {
  186. text-align: center;
  187. display: flex;
  188. align-items: center;
  189. justify-content: center;
  190. h4 {
  191. font-size: 18px;
  192. font-weight: normal;
  193. margin-left: 4px;
  194. }
  195. }
  196. .details-price {
  197. margin-top: 28px;
  198. display: flex;
  199. align-items: flex-end;
  200. justify-content: center;
  201. h3 {
  202. font-size: 36px;
  203. color: #27B148;
  204. line-height: 36px;
  205. margin: 0 4px;
  206. font-weight: normal;
  207. }
  208. span {
  209. font-size: 20px;
  210. color: #27B148;
  211. }
  212. }
  213. .details-main {
  214. text-align: center;
  215. margin-bottom: 20px;
  216. p {
  217. color: #777;
  218. margin-top: 4px;
  219. }
  220. }
  221. }
  222. .details-row-sum {
  223. float: right;
  224. color: #888;
  225. font-size: 24rpx;
  226. }
  227. </style>