terminal.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  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.phone) {
  172. this.$app.url.goto('/pages/index/index')
  173. return;
  174. }
  175. // this.$api.login({
  176. // "checkStatus": 1
  177. // }).then(() => {
  178. // this.userInfo = this.$app.storage.get(this.$config.keyname.userInfo);
  179. // if (this.userInfo.ecId) {
  180. // //查询该集团账户是否正常使用。
  181. // this.$api.base("post", "/chargeApi/queryEcInfo", {
  182. // "ecId": this.userInfo.ecId
  183. // }, {}).then(res => {
  184. // if (res.ecInfo && res.ecInfo.ecStatus == 1) {
  185. // this.isEc = true;
  186. // }
  187. // })
  188. // }
  189. // })
  190. },
  191. mounted() {
  192. // this.get_paymentMsg()
  193. setTimeout(() => {
  194. if (this.payment_msg != null) {
  195. this.$refs.filter.open()
  196. }
  197. }, 500)
  198. },
  199. data() {
  200. return {
  201. payment_msg: null,
  202. deviceId: 0,
  203. deviceStatus: 0,
  204. visit: '',
  205. personal: 1, // 1 个人订单 2 集团订单
  206. isEc: false, //是否集团的用户
  207. nowPriceTime: {}, //当前价格时间段信息
  208. deviceInfo: {}, //充电桩的信息
  209. accountInfo: { //账户信息
  210. balance: 0, //可用抵用券余额
  211. },
  212. userInfo: {},
  213. stationInfo: {}, //站点信息
  214. orderInfo: {}, //临时订单信息
  215. checkNum: 0, //检测订单状态次数
  216. ecInfo: {}, //集团信息
  217. discountInfo: null, //优惠信息
  218. selectedImg: 'https://hyxhsh.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/AwQTRxpEMqOG50293e26d86888b3e0f7324c429d2019.png/1.png',
  219. defaultImg: 'https://hyxhsh.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/SPh1u3KAqte830a107b2e3c5033b1d1027516d84d780.png/1.png'
  220. }
  221. },
  222. methods: {
  223. //通过用户id查询是否还有在充电中的订单
  224. queryInChange(deviceId, deviceStatus) {
  225. if (deviceStatus == 3 || deviceStatus == 4) {
  226. //占用充电状态;终端占用且不是自己,进入访问模式
  227. this.visit = true;
  228. }
  229. this.getDeviceInfo(deviceId); //获取设备、站的详情信息
  230. // this.getAccountInfo(); //获取账户信息
  231. this.checkedStartStatus(); //查询订单状态
  232. },
  233. //获取设备的详情信息
  234. getDeviceInfo(deviceId) {
  235. this.$api.base("get", "/applet/v1/station/connector/detail", {
  236. "connectorCode": deviceId
  237. }, {}).then(res => {
  238. this.deviceInfo = res.data;
  239. this.nowPriceTime = res.nowPriceTime;
  240. this.stationInfo = res.stationInfo;
  241. if (res.discountInfo) {
  242. this.discountInfo = res.discountInfo
  243. }
  244. if (this.deviceInfo.tipsStatus == 1) {
  245. this.$app.popup.alert(this.deviceInfo.tipsContent, "温馨提示");
  246. }
  247. })
  248. },
  249. // get_paymentMsg() {
  250. // // maspStatus(1:待补缴,2:已补缴)realPredictServiceCost平台;maspAmount第三方
  251. // this.$api.base("post", "/chargeApi/queryOrderList-arrearage", {}, {}).then(res => {
  252. // this.payment_msg = res.data
  253. // })
  254. // },
  255. //获取账户信息
  256. // getAccountInfo() {
  257. // if (this.personal == 1) {
  258. // //获取个人账户信息
  259. // this.$api.base("post", "/chargeApi/getUserAccount", {}, {}).then(res => {
  260. // this.accountInfo.balance = res.userAccount.balance;
  261. // })
  262. // } else {
  263. // //获取集团账户信息
  264. // this.$api.base("post", "/chargeApi/getEcUserAccount", {}, {
  265. // error: false
  266. // }).then(res => {
  267. // this.ecInfo = res.ecInfo;
  268. // this.accountInfo.balance = res.ecUserAccount.balance;
  269. // }).catch(err => {
  270. // this.accountInfo.balance = 0;
  271. // this.$app.popup.alert(err.msg, "温馨提示");
  272. // })
  273. // }
  274. // },
  275. //切换账户
  276. changeAccount(type) {
  277. if (this.personal == type) {
  278. return;
  279. }
  280. this.personal = type;
  281. this.getAccountInfo();
  282. },
  283. //当前集团折扣价
  284. getCurrEcPrice() {
  285. if (!this.nowPriceTime) {
  286. return 0;
  287. }
  288. var currEcP = this.nowPriceTime.price;
  289. if (this.ecInfo && this.ecInfo.ecDiscount) {
  290. var realServicePrice = this.nowPriceTime.servicePrice
  291. if (this.stationInfo.contractServicePrice) {
  292. realServicePrice = this.stationInfo.contractServicePrice
  293. }
  294. currEcP = (this.nowPriceTime.electrovalence + realServicePrice + this.nowPriceTime.addServicePrice *
  295. this.ecInfo.ecDiscount / 100);
  296. }
  297. console.log("dddd", currEcP)
  298. if (currEcP) {
  299. currEcP = currEcP.toFixed(2);
  300. }
  301. return Number(currEcP).toFixed(4);
  302. },
  303. //转换出电压值
  304. getVolt() {
  305. if (!this.deviceInfo.power) {
  306. return 0;
  307. }
  308. var v = this.deviceInfo.power / this.deviceInfo.current * 1000;
  309. return v;
  310. },
  311. startup() {
  312. if (this.visit) {
  313. this.$app.popup.alert("该充电枪被占用或存在异常,请重新尝试或更换其他充电枪。", "温馨提示");
  314. return;
  315. }
  316. //判断账户余额是否大于两元
  317. if (this.deviceInfo.availableBalance <= 3) {
  318. return this.$app.popup.confirm("无法启动充电,抵扣余量需大于3元,请先购买充电券!", "温馨提示!", {
  319. confirmText: "立即购券"
  320. }).then(confirm => {
  321. if (confirm) {
  322. this.$app.url.goto('/subPackages/coupon/coupon-buy/coupon-buy', true);
  323. }
  324. });
  325. }
  326. //统一下单并启动接口
  327. this.get_subMessage();
  328. },
  329. get_subMessage() {
  330. let _this = this
  331. uni.requestSubscribeMessage({
  332. tmplIds: ['03bv7QSrzH4DSjmNsI9P0lq0Vj3sBwpN5mgfZln7Rc4'],
  333. success(res) {
  334. _this.startChangeAndOrder();
  335. }
  336. })
  337. },
  338. // 主动发起购券操作
  339. gotoCouponBuy() {
  340. this.$app.url.goto('/subPackages/coupon/coupon-buy/coupon-buy', true);
  341. },
  342. //统一下单并启动接口
  343. startChangeAndOrder() {
  344. var obj = {
  345. orderType: this.deviceInfo.isEcUser ? 1 : 0, //订单类型 0-平台 1-企业
  346. equipmentId: this.deviceInfo.equipmentId,
  347. stationId: this.deviceInfo.stationId,
  348. couponId: null,
  349. // equipAuthSeq: '',
  350. connectorId: this.deviceInfo.connectorCode,
  351. }
  352. this.$api.base("post", "/applet/v1/charge/invokeCharge", obj, {}).then(res => {
  353. console.log(res, '返回数据');
  354. //下单成功,并进行了订单预充值
  355. this.orderInfo = res.data;
  356. if (res.code == "00000") {
  357. this.$app.url.goto('/subPackages/charging/charging/charging?chargeOrderNo=' + res.data.chargeOrderNo + "&deviceId=" +
  358. this.deviceInfo.id, false);
  359. } else {
  360. this.$app.popup.alert(res.msg, "温馨提示");
  361. }
  362. })
  363. },
  364. // 查询订单
  365. checkedStartStatus() {
  366. this.$api.base("get", "/applet/v1/station/charging-cost", {}, {}).then(res => {
  367. if (res.data.orderStatus == 2) {
  368. this.$app.popup.confirm("您有一个进行中充电订单,不可再次启动。", null, {
  369. showCancel: false,
  370. confirmText: "查看订单"
  371. }).then(cres => {
  372. this.$app.url.goto('/subPackages/charging/charging/charging?chargeOrderNo=' + res.data.chargeOrderNo +
  373. "&deviceId=" + this.deviceInfo.id, false);
  374. });
  375. }
  376. })
  377. },
  378. }
  379. }
  380. </script>
  381. <style scoped>
  382. @import url("terminal.css");
  383. </style>