terminal.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <template>
  2. <ax-body blank="0">
  3. <image src="@/static/img/page-bg01.png" class="page-background"></image>
  4. <view class="body" :class="{ visit }">
  5. <!-- 主图 -->
  6. <view class="app-flex c-center host-graph">
  7. <image
  8. src="https://national-motion.oss-cn-beijing.aliyuncs.com/20251230/9ca38a2aa5784e06b9cac31587b188b3.png"
  9. mode="widthFix" class="image"></image>
  10. </view>
  11. <!-- 主参数 -->
  12. <view class="parameter">
  13. <view class="param">
  14. <view class="value">{{ deviceInfo.current }}</view>
  15. <view class="name">电流A</view>
  16. </view>
  17. <view class="param">
  18. <view class="value">{{ deviceInfo.currentVoltage || '0' }}</view>
  19. <view class="name">电压V</view>
  20. </view>
  21. <view class="param">
  22. <view class="value">{{ deviceInfo.power }}</view>
  23. <view class="name">功率KW</view>
  24. </view>
  25. </view>
  26. <view v-if="!visit" class="block">
  27. <view class="card">
  28. <view class="title">
  29. <text>我的抵扣券</text>
  30. <view class="more" v-if="isEc">
  31. <view class="switch" :class="{ 'personal': personal == 1 }"><text
  32. @click="changeAccount(1)">个人</text><text @click="changeAccount(2)">集团</text></view>
  33. </view>
  34. </view>
  35. <view class="coupon-image-card"
  36. :style="{ backgroundImage: `url(${personal == 1 ? selectedImg : defaultImg})` }">
  37. <view class="coupon-title">充电抵扣券</view>
  38. <view class="price-info">
  39. <view class="price-numer">{{ userInfo.accountBalance }}</view>
  40. <view class="price-text">剩余可抵扣充电余量</view>
  41. </view>
  42. <view class="shop-coupon-btn"
  43. :style="{ backgroundColor: personal == 1 ? '#FF6457' : '#3EB6F8' }" @click="gotoCouponBuy">
  44. 立即购券</view>
  45. </view>
  46. <!-- <view class="coupon" :class="{'personal':personal==1}">
  47. <view class="name">{{personal == 1?'充电抵扣券':'集团抵扣券'}}</view>
  48. <view class="feature"><view class="line"></view></view>
  49. <view class="info">
  50. <view class="value">{{accountInfo.balance}}</view>
  51. <view class="describe">剩余可抵扣充电费用 (元)</view>
  52. </view>
  53. </view> -->
  54. </view>
  55. </view>
  56. <view class="block">
  57. <view class="card">
  58. <view class="title">
  59. <text>费用信息</text>
  60. <view
  61. @click="$app.url.goto('/subPackages/charging/site-more/site-more?show=1&stationId=' + stationInfo.id)"
  62. class="more"><text>价格详情</text>
  63. <icon class="ax-iconline i-arrow-right icon"></icon>
  64. </view>
  65. </view>
  66. <view class="cell">
  67. <view class="lable">{{ personal == 1 ? '当前电价' : '集团折扣价' }}</view>
  68. <view class="contet app-flex middle">
  69. <view v-if="personal == 1"><text class="money">{{ deviceInfo.currentPrice }}</text><text>
  70. 元/度</text></view>
  71. <view v-else>
  72. <text class="obsolete">
  73. {{ deviceInfo.enterprisePrice }} 元/度
  74. </text>
  75. <text class="money">{{ getCurrEcPrice() }}</text><text> 元/度</text>
  76. </view>
  77. </view>
  78. </view>
  79. <view class="cell" v-if="discountInfo && personal == 1">
  80. <view class="lable">优惠</view>
  81. <view class="contet app-flex middle">
  82. <view>{{ discountInfo.temp3 }}<text class="money">{{ discountInfo.discount ?
  83. parseFloat(discountInfo.discount).toFixed(4) : "0.0000" }}</text><text>
  84. 元/度</text></view>
  85. </view>
  86. </view>
  87. <view class="cell" v-if="deviceInfo.isFirmUser">
  88. <view class="lable">企业专享价</view>
  89. <view class="contet app-flex middle">
  90. <view><text class="money">{{ deviceInfo.enterprisePrice }}</text><text>
  91. 元/度</text></view>
  92. </view>
  93. </view>
  94. <view class="cell">
  95. <view class="lable">当前时段</view>
  96. <view class="contet">{{ deviceInfo.currentPeriodDesc }}</view>
  97. </view>
  98. <view class="cell">
  99. <view class="lable">停车参考</view>
  100. <view class="contet">{{ deviceInfo.parkingTips || '--' }}</view>
  101. </view>
  102. </view>
  103. </view>
  104. <view class="block">
  105. <view class="card">
  106. <view class="title">终端信息</view>
  107. <view class="cell">
  108. <view class="lable">终端状态</view>
  109. <view class="contet">{{ deviceInfo.statusName }}</view>
  110. </view>
  111. <view class="cell">
  112. <view class="lable">终端编号</view>
  113. <view class="contet">{{ deviceInfo.connectorCode }}</view>
  114. </view>
  115. <view class="cell">
  116. <view class="lable">充电电站</view>
  117. <view class="contet">{{ deviceInfo.stationName }}</view>
  118. </view>
  119. <view class="cell">
  120. <view class="lable">充电终端</view>
  121. <view class="contet">{{ deviceInfo.connectorName }}</view>
  122. </view>
  123. <view class="cell">
  124. <view class="lable">车位编号</view>
  125. <view class="contet">{{ deviceInfo.parkNo ? deviceInfo.parkNo : "无" }}</view>
  126. </view>
  127. </view>
  128. </view>
  129. <!-- 信息 -->
  130. <view class="footer">
  131. <view class="tips">账单信息可能会有所延迟,具体以实际结算为准</view>
  132. <view>
  133. <button @click="startup()" class="startup">启动终端充电</button>
  134. <ax-ios-indicator min="10"></ax-ios-indicator>
  135. </view>
  136. </view>
  137. </view>
  138. <ax-popup ref="filter" position="" maskType="black" maskEnable>
  139. <view class="Modal-tips">
  140. <view class="tips-icon">!</view>
  141. <view class="icon-title">温馨提示</view>
  142. <view class="tips-text" v-if="payment_msg != null">
  143. 您有一笔超充订单{{ (payment_msg.maspAmount + payment_msg.maspRealAmount).toFixed(2) }}元待补缴</view>
  144. <view class="tips-btn">
  145. <view class="cancel-btn" @click="$refs.filter.close()">取消</view>
  146. <view class="confirm-btn" @click="$app.url.goto('/subPackages/coupon/coupon-buy/coupon-buy')">购券并补缴
  147. </view>
  148. </view>
  149. </view>
  150. </ax-popup>
  151. </ax-body>
  152. </template>
  153. <script>
  154. export default {
  155. onLoad(opts) {
  156. console.log("参数信息:", opts)
  157. /**
  158. * 判断终端是否占用状态
  159. * 判断占用终端设备的是不是用户自己
  160. */
  161. this.deviceId = opts.deviceId
  162. this.deviceStatus = opts.deviceStatus
  163. },
  164. onShow() {
  165. this.queryInChange(this.deviceId, this.deviceStatus);
  166. /**
  167. * 刷新用户信息
  168. */
  169. this.userInfo = this.$app.storage.get(this.$config.keyname.userInfo);
  170. console.log(this.userInfo, '获取到的用户信息');
  171. // if (!this.userInfo) {
  172. // this.$app.url.goto('/pages/index/index')
  173. // return;
  174. // }
  175. },
  176. mounted() {
  177. // this.get_paymentMsg()
  178. setTimeout(() => {
  179. if (this.payment_msg != null) {
  180. this.$refs.filter.open()
  181. }
  182. }, 500)
  183. },
  184. data() {
  185. return {
  186. payment_msg: null,
  187. deviceId: 0,
  188. deviceStatus: 0,
  189. visit: '',
  190. personal: 1, // 1 个人订单 2 集团订单
  191. isEc: false, //是否集团的用户
  192. nowPriceTime: {}, //当前价格时间段信息
  193. deviceInfo: {}, //充电桩的信息
  194. accountInfo: { //账户信息
  195. balance: 0, //可用抵用券余额
  196. },
  197. userInfo: {},
  198. stationInfo: {}, //站点信息
  199. orderInfo: {}, //临时订单信息
  200. checkNum: 0, //检测订单状态次数
  201. ecInfo: {}, //集团信息
  202. discountInfo: null, //优惠信息
  203. selectedImg: 'https://hyxhsh.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/AwQTRxpEMqOG50293e26d86888b3e0f7324c429d2019.png/1.png',
  204. defaultImg: 'https://hyxhsh.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/SPh1u3KAqte830a107b2e3c5033b1d1027516d84d780.png/1.png'
  205. }
  206. },
  207. methods: {
  208. //通过用户id查询是否还有在充电中的订单
  209. queryInChange(deviceId, deviceStatus) {
  210. if (deviceStatus == 3 || deviceStatus == 4) {
  211. //占用充电状态;终端占用且不是自己,进入访问模式
  212. this.visit = true;
  213. }
  214. this.getDeviceInfo(deviceId); //获取设备、站的详情信息
  215. // this.getAccountInfo(); //获取账户信息
  216. this.checkedStartStatus(); //查询订单状态
  217. },
  218. //获取设备的详情信息
  219. getDeviceInfo(deviceId) {
  220. this.$api.base("get", "/applet/v1/station/connector/detail", {
  221. "connectorCode": deviceId
  222. }, {}).then(res => {
  223. this.deviceInfo = res.data;
  224. this.nowPriceTime = res.nowPriceTime;
  225. this.stationInfo = res.stationInfo;
  226. if (res.discountInfo) {
  227. this.discountInfo = res.discountInfo
  228. }
  229. if (this.deviceInfo.tipsStatus == 1) {
  230. this.$app.popup.alert(this.deviceInfo.tipsContent, "温馨提示");
  231. }
  232. })
  233. },
  234. //切换账户
  235. changeAccount(type) {
  236. if (this.personal == type) {
  237. return;
  238. }
  239. this.personal = type;
  240. this.getAccountInfo();
  241. },
  242. //当前集团折扣价
  243. getCurrEcPrice() {
  244. if (!this.nowPriceTime) {
  245. return 0;
  246. }
  247. var currEcP = this.nowPriceTime.price;
  248. if (this.ecInfo && this.ecInfo.ecDiscount) {
  249. var realServicePrice = this.nowPriceTime.servicePrice
  250. if (this.stationInfo.contractServicePrice) {
  251. realServicePrice = this.stationInfo.contractServicePrice
  252. }
  253. currEcP = (this.nowPriceTime.electrovalence + realServicePrice + this.nowPriceTime.addServicePrice *
  254. this.ecInfo.ecDiscount / 100);
  255. }
  256. console.log("dddd", currEcP)
  257. if (currEcP) {
  258. currEcP = currEcP.toFixed(2);
  259. }
  260. return Number(currEcP).toFixed(4);
  261. },
  262. //转换出电压值
  263. getVolt() {
  264. if (!this.deviceInfo.power) {
  265. return 0;
  266. }
  267. var v = this.deviceInfo.power / this.deviceInfo.current * 1000;
  268. return v;
  269. },
  270. startup() {
  271. if (this.visit) {
  272. this.$app.popup.alert("该充电枪被占用或存在异常,请重新尝试或更换其他充电枪。", "温馨提示");
  273. return;
  274. }
  275. //判断账户余额是否大于两元
  276. if (this.deviceInfo.availableBalance <= 3) {
  277. return this.$app.popup.confirm("无法启动充电,抵扣余量需大于3元,请先购买充电券!", "温馨提示!", {
  278. confirmText: "立即购券"
  279. }).then(confirm => {
  280. if (confirm) {
  281. this.$app.url.goto('/subPackages/coupon/coupon-buy/coupon-buy', true);
  282. }
  283. });
  284. }
  285. //统一下单并启动接口
  286. this.get_subMessage();
  287. },
  288. get_subMessage() {
  289. let _this = this
  290. _this.startChangeAndOrder();
  291. },
  292. // 主动发起购券操作
  293. gotoCouponBuy() {
  294. this.$app.url.goto('/subPackages/coupon/coupon-buy/coupon-buy', true);
  295. },
  296. //统一下单并启动接口
  297. startChangeAndOrder() {
  298. var obj = {
  299. orderType: this.deviceInfo.isFirmUser ? 1 : 0, //订单类型 0-平台 1-企业
  300. equipmentId: this.deviceInfo.equipmentId,
  301. stationId: this.deviceInfo.stationId,
  302. couponId: null,
  303. // equipAuthSeq: '',
  304. connectorId: this.deviceInfo.connectorCode,
  305. }
  306. this.$api.base("post", "/applet/v1/charge/invokeCharge", obj, {}).then(res => {
  307. console.log(res, '返回数据');
  308. //下单成功,并进行了订单预充值
  309. this.orderInfo = res.data;
  310. if (res.code == "00000") {
  311. this.$app.url.goto('/subPackages/charging/charging/charging?chargeOrderNo=' + res.data.chargeOrderNo + "&deviceId=" +
  312. this.deviceInfo.id, false);
  313. } else {
  314. this.$app.popup.alert(res.msg, "温馨提示");
  315. }
  316. })
  317. },
  318. }
  319. }
  320. </script>
  321. <style scoped>
  322. @import url("terminal.css");
  323. </style>