order-detail.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <ax-body>
  3. <view class="page-background">
  4. <image src="@/static/img/order-detail-bg.png" mode="widthFix"></image>
  5. </view>
  6. <view class="body">
  7. <view style="height: 220rpx;"></view>
  8. <!-- 基础信息 -->
  9. <view class="base-info">
  10. <view class="content">
  11. <view class="name">
  12. <image src="@/static/img/order-detail-icon.png" class="icon" mode="widthFix"></image>
  13. <text>充电度数</text>
  14. </view>
  15. <view class="val"><text class="value">{{ orderInfo.totalCharge || 0 }}</text><text
  16. class="unit">度电</text></view>
  17. </view>
  18. <!-- <image src="@/static/img/order-detail-bg.png" class="bg" mode="widthFix"></image> -->
  19. </view>
  20. <!-- 单元格 -->
  21. <view class="cell-group multi-line">
  22. <view class="cell">
  23. <view class="lable">起始时间</view>
  24. <view class="contet">{{ orderInfo.startTime || '未知' }}</view>
  25. </view>
  26. <view class="cell">
  27. <view class="lable">终止时间</view>
  28. <view class="contet">{{ orderInfo.endTime || '未知' }}</view>
  29. </view>
  30. <view class="cell">
  31. <view class="lable">终止方式</view>
  32. <view class="contet">{{ getStopType() }}</view>
  33. </view>
  34. </view>
  35. <view class="cell-group" v-if="orderInfo.maspStatus != 0">
  36. <template v-if="orderInfo.maspStatus === 1">
  37. <view class="cell">
  38. <view class="load-payment">待补缴</view>
  39. <view class="load-payment-btn" @click="$app.url.goto('/subPackages/coupon/coupon-buy/coupon-buy')">去补缴</view>
  40. </view>
  41. <view class="cell">
  42. <view class="lable">超充金额</view>
  43. <view class="flow-money">{{ (orderInfo.maspAmount + orderInfo.maspRealAmount).toFixed(2) || '0'
  44. }}元
  45. </view>
  46. </view>
  47. </template>
  48. <template v-else-if="orderInfo.maspStatus === 2">
  49. <view class="finish-payment">已补缴</view>
  50. <view class="cell">
  51. <view class="lable">超充金额</view>
  52. <view class="contet">{{ (orderInfo.maspAmount + orderInfo.maspRealAmount).toFixed(2) }}</view>
  53. </view>
  54. <view class="cell">
  55. <view class="lable">补缴时间</view>
  56. <view class="contet">{{ orderInfo.maspTime }}</view>
  57. </view>
  58. </template>
  59. </view>
  60. <!-- 单元格 -->
  61. <view class="cell-group">
  62. <view class="cell">
  63. <view class="lable">订单状态</view>
  64. <view class="contet">{{ getOrderStatus(orderInfo.status) }}</view>
  65. </view>
  66. <view class="cell">
  67. <view class="lable">订单编号</view>
  68. <view class="contet">{{ orderInfo.chargeOrderNo }}</view>
  69. </view>
  70. <view class="cell">
  71. <view class="lable">车牌号</view>
  72. <view class="contet">{{ orderInfo.plateNum||'--' }}</view>
  73. </view>
  74. <view class="cell">
  75. <view class="lable">充电时长</view>
  76. <view class="contet">{{ formatDuration(orderInfo.chargeTime) || '--' }}</view>
  77. </view>
  78. <view class="cell">
  79. <view class="lable">充电电站</view>
  80. <view class="contet">{{ orderInfo.stationName }}</view>
  81. </view>
  82. <view class="cell">
  83. <view class="lable">终端名称</view>
  84. <view class="contet">{{ orderInfo.connectorName }}</view>
  85. </view>
  86. <view class="cell">
  87. <view class="lable">终端编号</view>
  88. <view class="contet">{{ orderInfo.connectorId }}</view>
  89. </view>
  90. <view class="hr"></view>
  91. <view class="cell">
  92. <view class="lable">订单金额</view>
  93. <view class="contet sum">
  94. {{ orderInfo.realCost }}元
  95. </view>
  96. </view>
  97. <view class="cell" v-if="orderInfo.discountMoney">
  98. <view class="lable">{{ orderInfo.discountDes }}</view>
  99. <view class="contet sum">-{{ orderInfo.discountMoney ? orderInfo.discountMoney.toFixed(4) : "0.00"
  100. }}元
  101. </view>
  102. </view>
  103. <view class="cell" v-if="orderInfo.firmPrice">
  104. <view class="lable">企业专享价减</view>
  105. <view class="contet sum">-{{ orderInfo.firmPrice ? orderInfo.firmPrice.toFixed(4) : "0.00" }}元
  106. </view>
  107. </view>
  108. <view class="cell" v-if="orderInfo.couponPrice">
  109. <view class="lable">优惠券减</view>
  110. <view class="contet sum">-{{ orderInfo.couponPrice ? orderInfo.couponPrice.toFixed(4) : "0.00" }}元
  111. </view>
  112. </view>
  113. <view class="cell">
  114. <view class="lable">实际付款</view>
  115. <view class="contet sum">{{ orderInfo.realCost || "0.00" }}元</view>
  116. </view>
  117. </view>
  118. <view class="tips">
  119. <image src="@/static/img/warn.svg" class="icon"></image>
  120. <text>本次充电费用已从您的“充电抵扣券”中抵扣结算</text>
  121. </view>
  122. </view>
  123. </ax-body>
  124. </template>
  125. <script>
  126. export default {
  127. onLoad(opts) {
  128. console.log("启动充值页面的参数:", opts)
  129. this.getOrderInfo(opts.chargeOrderNo);
  130. },
  131. data() {
  132. return {
  133. orderInfo: {
  134. id: 1
  135. }, //订单信息
  136. deviceInfo: {}, //充电桩详情
  137. }
  138. },
  139. methods: {
  140. getStopType() {
  141. var str = "用户主动终止";
  142. if (this.orderInfo.stopType) {
  143. if (this.orderInfo.stopType == 1) {
  144. str = "用户主动终止";
  145. } else if (this.orderInfo.stopType == 2) {
  146. str = "充电桩主动终止";
  147. }
  148. }
  149. return str;
  150. },
  151. clcaServicePrice() {
  152. var serivp = this.orderInfo.realCost - this.orderInfo.thirdPartyElecfee;
  153. if (this.orderInfo.discountMoney) {
  154. //有优惠价,服务费显示把优惠价加回去
  155. serivp = serivp + this.orderInfo.discountMoney;
  156. }
  157. return serivp ? serivp.toFixed(4) : "0.0000"
  158. },
  159. //查询订单详情
  160. getOrderInfo(chargeOrderNo) {
  161. this.$api.base("get", `/applet/v1/charge/queryOrder/${chargeOrderNo}`, {}, {}).then(res => {
  162. console.log("订单详情:", res)
  163. this.orderInfo = res.data;
  164. // this.deviceInfo = res.obj.deviceInfo;
  165. })
  166. },
  167. //拆解时间
  168. splitTime(time, index) {
  169. if (!time) {
  170. return;
  171. }
  172. return time.split(" ")[index];
  173. },
  174. formatDuration(seconds) {
  175. if (!seconds || seconds < 0) {
  176. return "0分钟";
  177. }
  178. const h = Math.floor(seconds / 3600);
  179. const m = Math.floor((seconds % 3600) / 60);
  180. if (h > 0) {
  181. return `${h}小时${m}分钟`;
  182. } else {
  183. return `${m}分钟`;
  184. }
  185. },
  186. getOrderStatus(status) {
  187. var str = "";
  188. //状态0待启动 1 充电中 2 结算中 3 已完成, 5未成功充电
  189. switch (status) {
  190. case 0:
  191. str = "待启动";
  192. break;
  193. case 1:
  194. str = "充电中";
  195. break;
  196. case 2:
  197. str = "结算中";
  198. break;
  199. case 3:
  200. str = "已完成";
  201. break;
  202. case 5:
  203. str = "未成功充电";
  204. break;
  205. }
  206. return str;
  207. }
  208. }
  209. }
  210. </script>
  211. <style scoped>
  212. @import url("order-detail.css");
  213. </style>