terminal.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  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. // get_paymentMsg() {
  235. // // maspStatus(1:待补缴,2:已补缴)realPredictServiceCost平台;maspAmount第三方
  236. // this.$api.base("post", "/chargeApi/queryOrderList-arrearage", {}, {}).then(res => {
  237. // this.payment_msg = res.data
  238. // })
  239. // },
  240. //获取账户信息
  241. // getAccountInfo() {
  242. // if (this.personal == 1) {
  243. // //获取个人账户信息
  244. // this.$api.base("post", "/chargeApi/getUserAccount", {}, {}).then(res => {
  245. // this.accountInfo.balance = res.userAccount.balance;
  246. // })
  247. // } else {
  248. // //获取集团账户信息
  249. // this.$api.base("post", "/chargeApi/getEcUserAccount", {}, {
  250. // error: false
  251. // }).then(res => {
  252. // this.ecInfo = res.ecInfo;
  253. // this.accountInfo.balance = res.ecUserAccount.balance;
  254. // }).catch(err => {
  255. // this.accountInfo.balance = 0;
  256. // this.$app.popup.alert(err.msg, "温馨提示");
  257. // })
  258. // }
  259. // },
  260. //切换账户
  261. changeAccount(type) {
  262. if (this.personal == type) {
  263. return;
  264. }
  265. this.personal = type;
  266. this.getAccountInfo();
  267. },
  268. //当前集团折扣价
  269. getCurrEcPrice() {
  270. if (!this.nowPriceTime) {
  271. return 0;
  272. }
  273. var currEcP = this.nowPriceTime.price;
  274. if (this.ecInfo && this.ecInfo.ecDiscount) {
  275. var realServicePrice = this.nowPriceTime.servicePrice
  276. if (this.stationInfo.contractServicePrice) {
  277. realServicePrice = this.stationInfo.contractServicePrice
  278. }
  279. currEcP = (this.nowPriceTime.electrovalence + realServicePrice + this.nowPriceTime.addServicePrice *
  280. this.ecInfo.ecDiscount / 100);
  281. }
  282. console.log("dddd", currEcP)
  283. if (currEcP) {
  284. currEcP = currEcP.toFixed(2);
  285. }
  286. return Number(currEcP).toFixed(4);
  287. },
  288. //转换出电压值
  289. getVolt() {
  290. if (!this.deviceInfo.power) {
  291. return 0;
  292. }
  293. var v = this.deviceInfo.power / this.deviceInfo.current * 1000;
  294. return v;
  295. },
  296. startup() {
  297. if (this.visit) {
  298. this.$app.popup.alert("该充电枪被占用或存在异常,请重新尝试或更换其他充电枪。", "温馨提示");
  299. return;
  300. }
  301. //判断账户余额是否大于两元
  302. if (this.deviceInfo.availableBalance <= 3) {
  303. return this.$app.popup.confirm("无法启动充电,抵扣余量需大于3元,请先购买充电券!", "温馨提示!", {
  304. confirmText: "立即购券"
  305. }).then(confirm => {
  306. if (confirm) {
  307. this.$app.url.goto('/subPackages/coupon/coupon-buy/coupon-buy', true);
  308. }
  309. });
  310. }
  311. //统一下单并启动接口
  312. this.get_subMessage();
  313. },
  314. get_subMessage() {
  315. let _this = this
  316. // uni.requestSubscribeMessage({
  317. // tmplIds: ['03bv7QSrzH4DSjmNsI9P0lq0Vj3sBwpN5mgfZln7Rc4'],
  318. // success(res) {
  319. // _this.startChangeAndOrder();
  320. // }
  321. // })
  322. _this.startChangeAndOrder();
  323. },
  324. // 主动发起购券操作
  325. gotoCouponBuy() {
  326. this.$app.url.goto('/subPackages/coupon/coupon-buy/coupon-buy', true);
  327. },
  328. //统一下单并启动接口
  329. startChangeAndOrder() {
  330. var obj = {
  331. orderType: this.deviceInfo.isEcUser ? 1 : 0, //订单类型 0-平台 1-企业
  332. equipmentId: this.deviceInfo.equipmentId,
  333. stationId: this.deviceInfo.stationId,
  334. couponId: null,
  335. // equipAuthSeq: '',
  336. connectorId: this.deviceInfo.connectorCode,
  337. }
  338. this.$api.base("post", "/applet/v1/charge/invokeCharge", obj, {}).then(res => {
  339. console.log(res, '返回数据');
  340. //下单成功,并进行了订单预充值
  341. this.orderInfo = res.data;
  342. if (res.code == "00000") {
  343. if (res.data.status == 0 || res.data.status == 1) {
  344. this.$app.popup.confirm('您当前有正在进行中的订单,是否前往查看?', '温馨提示').then(confirm => {
  345. if (confirm) {
  346. this.$app.url.goto('/subPackages/charging/charging/charging?chargeOrderNo=' + res.data.chargeOrderNo +
  347. "&deviceId=" + this.deviceInfo.id, false);
  348. }
  349. });
  350. } else {
  351. this.$app.url.goto('/subPackages/charging/charging/charging?chargeOrderNo=' + res.data.chargeOrderNo + "&deviceId=" +
  352. this.deviceInfo.id, false);
  353. }
  354. } else {
  355. this.$app.popup.alert(res.msg, "温馨提示");
  356. }
  357. })
  358. },
  359. // 查询订单
  360. checkedStartStatus() {
  361. this.$api.base("get", "/applet/v1/station/charging-cost", {}, {}).then(res => {
  362. if (res.data.orderStatus == 2) {
  363. this.$app.popup.confirm("您有一个进行中充电订单,不可再次启动。", null, {
  364. showCancel: false,
  365. confirmText: "查看订单"
  366. }).then(cres => {
  367. this.$app.url.goto('/subPackages/charging/charging/charging?chargeOrderNo=' + res.data.chargeOrderNo +
  368. "&deviceId=" + this.deviceInfo.id, false);
  369. });
  370. }
  371. })
  372. },
  373. }
  374. }
  375. </script>
  376. <style scoped>
  377. @import url("terminal.css");
  378. </style>