order-detail.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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">{{ formatDuration(orderInfo.chargeTime) || '--' }}</view>
  73. </view>
  74. <view class="cell">
  75. <view class="lable">充电电站</view>
  76. <view class="contet">{{ orderInfo.stationName }}</view>
  77. </view>
  78. <view class="cell">
  79. <view class="lable">终端名称</view>
  80. <view class="contet">{{ orderInfo.connectorName }}</view>
  81. </view>
  82. <view class="cell">
  83. <view class="lable">终端编号</view>
  84. <view class="contet">{{ orderInfo.connectorId }}</view>
  85. </view>
  86. <view class="hr"></view>
  87. <view class="cell">
  88. <view class="lable">订单金额</view>
  89. <view class="contet sum">
  90. {{ orderInfo.realCost }}元
  91. </view>
  92. </view>
  93. <view class="cell" v-if="orderInfo.discountMoney">
  94. <view class="lable">{{ orderInfo.discountDes }}</view>
  95. <view class="contet sum">-{{ orderInfo.discountMoney ? orderInfo.discountMoney.toFixed(4) : "0.00"
  96. }}元
  97. </view>
  98. </view>
  99. <view class="cell" v-if="orderInfo.firmPrice">
  100. <view class="lable">企业专享价减</view>
  101. <view class="contet sum">-{{ orderInfo.firmPrice ? orderInfo.firmPrice.toFixed(4) : "0.00" }}元
  102. </view>
  103. </view>
  104. <view class="cell" v-if="orderInfo.couponPrice">
  105. <view class="lable">优惠券减</view>
  106. <view class="contet sum">-{{ orderInfo.couponPrice ? orderInfo.couponPrice.toFixed(4) : "0.00" }}元
  107. </view>
  108. </view>
  109. <view class="cell">
  110. <view class="lable">实际付款</view>
  111. <view class="contet sum">{{ orderInfo.realCost || "0.00" }}元</view>
  112. </view>
  113. </view>
  114. <view class="tips">
  115. <image src="@/static/img/warn.svg" class="icon"></image>
  116. <text>本次充电费用已从您的“充电抵扣券”中抵扣结算</text>
  117. </view>
  118. </view>
  119. </ax-body>
  120. </template>
  121. <script>
  122. export default {
  123. onLoad(opts) {
  124. console.log("启动充值页面的参数:", opts)
  125. this.getOrderInfo(opts.chargeOrderNo);
  126. },
  127. data() {
  128. return {
  129. orderInfo: {
  130. id: 1
  131. }, //订单信息
  132. deviceInfo: {}, //充电桩详情
  133. }
  134. },
  135. methods: {
  136. getStopType() {
  137. var str = "用户主动终止";
  138. if (this.orderInfo.stopType) {
  139. if (this.orderInfo.stopType == 1) {
  140. str = "用户主动终止";
  141. } else if (this.orderInfo.stopType == 2) {
  142. str = "充电桩主动终止";
  143. }
  144. }
  145. return str;
  146. },
  147. clcaServicePrice() {
  148. var serivp = this.orderInfo.realCost - this.orderInfo.thirdPartyElecfee;
  149. if (this.orderInfo.discountMoney) {
  150. //有优惠价,服务费显示把优惠价加回去
  151. serivp = serivp + this.orderInfo.discountMoney;
  152. }
  153. return serivp ? serivp.toFixed(4) : "0.0000"
  154. },
  155. //查询订单详情
  156. getOrderInfo(chargeOrderNo) {
  157. this.$api.base("get", `/applet/v1/charge/queryOrder/${chargeOrderNo}`, {}, {}).then(res => {
  158. console.log("订单详情:", res)
  159. this.orderInfo = res.data;
  160. // this.deviceInfo = res.obj.deviceInfo;
  161. })
  162. },
  163. //拆解时间
  164. splitTime(time, index) {
  165. if (!time) {
  166. return;
  167. }
  168. return time.split(" ")[index];
  169. },
  170. formatDuration(seconds) {
  171. if (!seconds || seconds < 0) {
  172. return "0分钟";
  173. }
  174. const h = Math.floor(seconds / 3600);
  175. const m = Math.floor((seconds % 3600) / 60);
  176. if (h > 0) {
  177. return `${h}小时${m}分钟`;
  178. } else {
  179. return `${m}分钟`;
  180. }
  181. },
  182. getOrderStatus(status) {
  183. var str = "";
  184. //状态0待启动 1 充电中 2 结算中 3 已完成, 5未成功充电
  185. switch (status) {
  186. case 0:
  187. str = "待启动";
  188. break;
  189. case 1:
  190. str = "充电中";
  191. break;
  192. case 2:
  193. str = "结算中";
  194. break;
  195. case 3:
  196. str = "已完成";
  197. break;
  198. case 5:
  199. str = "未成功充电";
  200. break;
  201. }
  202. return str;
  203. }
  204. }
  205. }
  206. </script>
  207. <style scoped>
  208. @import url("order-detail.css");
  209. </style>