index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. <template>
  2. <view>
  3. <u-navbar title="充电">
  4. <view class="slot-wrap">
  5. <view class="navbar-left"></view>
  6. <view class="navbar-right"><u-icon name="iconfontscan" custom-prefix="custom-icon" color="#1677ff" size="40"></u-icon></view>
  7. </view>
  8. </u-navbar>
  9. <view class="charge">
  10. <view class="chargeInfo">
  11. <view class="chargeInfo-row">
  12. <view class="u-flex"><p>桩号:</p><h4>8978789</h4></view>
  13. <view class="u-flex">
  14. <span>切换充电桩</span>
  15. <u-icon name="arrow-right" color="#999" size="24"></u-icon>
  16. </view>
  17. </view>
  18. <view class="chargeInfo-row">
  19. <view class="u-flex"><p>桩名:</p><h4>阿斯顿阿斯顿阿三的安舒打赏</h4></view>
  20. <view class="u-flex"></view>
  21. </view>
  22. <view class="chargeInfo-row">
  23. <view class="u-flex"><p>模式:</p><h4>0.25元(0-200W)1小时0.33元</h4></view>
  24. <view class="u-flex">
  25. <span>费用说明</span>
  26. <u-icon name="error-circle" color="#1677ff" size="32" @click="showTips()"></u-icon>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="chargeMain">
  31. <template v-for="(item,i) in list">
  32. <view :key="i" class="chargeMain-item "
  33. @click="selectItem(item)"
  34. :class="{
  35. 'active':item.id==submitForm.detailItem,
  36. 'occupy':item.status==2,
  37. 'fault':item.status==3,
  38. }"
  39. ><p>{{i+1}}</p>
  40. <p v-if="item.status==1">空闲</p>
  41. <p v-else-if="item.status==2">占用</p>
  42. <p v-else-if="item.status==3">故障</p>
  43. </view>
  44. </template>
  45. </view>
  46. </view>
  47. <view class="charge">
  48. <view class="chargeTime">
  49. <view v-for="(item,i) in timelist"
  50. class="chargeTime-item " :key="i"
  51. @click="submitForm.selectTime=item.id"
  52. :class="{
  53. 'chargeTime-active':submitForm.selectTime==item.id,
  54. 'chargeTime-first':i==0
  55. }"
  56. >
  57. <template v-if="i==0">
  58. <p>充满</p><p>自停</p>
  59. </template>
  60. <template v-else>
  61. {{item.name}}
  62. </template>
  63. </view>
  64. </view>
  65. <view class="chargeTime-text">
  66. <p>充电时长</p>
  67. <span>{{timelist[submitForm.selectTime].name}}</span>
  68. </view>
  69. </view>
  70. <view class="charge">
  71. <view class="chargeRadio">
  72. <view class="u-flex">
  73. <u-icon name="rmb-circle-fill" color="#ff9502" size="90"></u-icon>
  74. <view class="chargeRadio-text">
  75. <p>余额支付</p>
  76. <p>现有余额¥4.00</p>
  77. </view>
  78. </view>
  79. <u-radio-group>
  80. <u-radio></u-radio>
  81. </u-radio-group>
  82. </view>
  83. </view>
  84. <view class="foot-btn">
  85. <u-button type="primary" :custom-style="customStyle"
  86. @click="submit"
  87. shape="square">开始充电</u-button>
  88. </view>
  89. <u-modal v-model="showmodel" title="title" >
  90. <h1>111</h1>
  91. </u-modal>
  92. </view>
  93. </template>
  94. <script>
  95. import * as API_common from '@/apis/common.js'
  96. export default {
  97. data() {
  98. return {
  99. showmodel:false,
  100. //充电桩信息
  101. detail:{
  102. money:4.00,
  103. },
  104. //充电位子list
  105. list:[
  106. {
  107. id:'1',
  108. status:'1',
  109. },
  110. {
  111. id:'2',
  112. status:'2',
  113. },{
  114. id:'3',
  115. status:'3',
  116. },{
  117. id:'4',
  118. status:'1',
  119. },
  120. {
  121. id:'5',
  122. status:'1',
  123. },
  124. ],
  125. timelist:[
  126. {
  127. id:'0',
  128. name:'充满自停'
  129. },
  130. {
  131. id:'1',
  132. name:'1小时'
  133. },
  134. {
  135. id:'2',
  136. name:'2小时'
  137. },
  138. {
  139. id:'3',
  140. name:'3小时'
  141. },
  142. {
  143. id:'4',
  144. name:'4小时'
  145. },
  146. {
  147. id:'5',
  148. name:'5小时'
  149. },
  150. {
  151. id:'6',
  152. name:'6小时'
  153. },
  154. {
  155. id:'7',
  156. name:'7小时'
  157. },
  158. {
  159. id:'8',
  160. name:'8小时'
  161. },
  162. ],
  163. //提交信息
  164. submitForm:{
  165. detailNo:'',
  166. detailItem:'',
  167. selectTime:'0',
  168. paytype:'YE',
  169. },
  170. customStyle: {
  171. background: '#1677ff'
  172. }
  173. }
  174. },
  175. methods: {
  176. selectItem(row){
  177. if(row.status==1){
  178. this.submitForm.detailItem=row.id
  179. }else{
  180. uni.showToast({
  181. title:'当前设备不可选'
  182. })
  183. }
  184. },
  185. submit(){
  186. if(true){
  187. this.showmodel=true;
  188. }else{
  189. uni.showModal({
  190. title: '订单信息',
  191. content: '<h1>111</h1>',
  192. success: function (res) {
  193. if (res.confirm) {
  194. console.log('用户点击确定');
  195. } else if (res.cancel) {
  196. console.log('用户点击取消');
  197. }
  198. }
  199. });
  200. }
  201. },
  202. showTips(){
  203. uni.showModal({
  204. title: '提示',
  205. showCancel:true,
  206. content: '这是一个模态弹窗',
  207. success: function (res) {
  208. if (res.confirm) {
  209. console.log('用户点击确定');
  210. } else if (res.cancel) {
  211. console.log('用户点击取消');
  212. }
  213. }
  214. });
  215. }
  216. }
  217. }
  218. </script>
  219. <style>
  220. page{
  221. background-color: #f7f7f7;
  222. }
  223. </style>
  224. <style lang="scss" scoped>
  225. .slot-wrap {
  226. display: flex;
  227. align-items: center;
  228. justify-content: space-between;
  229. flex: 1;
  230. }
  231. .navbar-right {
  232. display: flex;
  233. margin-right: 20rpx;
  234. align-items: center;
  235. }
  236. .charge{
  237. padding: 15px;
  238. background-color: #fff;
  239. margin-bottom: 10px;
  240. }
  241. .chargeRadio{
  242. display: flex;
  243. justify-content: space-between;
  244. align-items: center;
  245. width: 100%;
  246. .chargeRadio-text{
  247. margin-left: 5px;
  248. }
  249. }
  250. .chargeTime{
  251. display: flex;
  252. overflow: scroll;
  253. padding-bottom: 15px;
  254. .chargeTime-item{
  255. border: 1px solid #1677ff;
  256. border-radius: 50%;
  257. min-width: 56px;
  258. height: 56px;
  259. text-align: center;
  260. line-height: 56px;
  261. margin-right: 20px;
  262. }
  263. .chargeTime-first{
  264. line-height: 20px !important;
  265. padding-top: 6px;
  266. margin-right: 20px;
  267. }
  268. .chargeTime-active{
  269. color:#fff;
  270. background-color: #1677ff;
  271. }
  272. }
  273. .chargeTime-text{
  274. border-top: 1px solid #f7f7f7;
  275. padding-top: 15px;
  276. display: flex;
  277. align-items: center;
  278. span{
  279. margin-left: 20px;
  280. color:#1677ff;
  281. }
  282. }
  283. .chargeInfo{
  284. .chargeInfo-row{
  285. display: flex;
  286. align-items: center;
  287. justify-content: space-between;
  288. margin-bottom: 10px;
  289. p{
  290. color:#999;
  291. }
  292. h4{
  293. font-weight: normal;
  294. }
  295. span{
  296. color:#1677ff;
  297. margin-right: 5px;
  298. }
  299. }
  300. }
  301. .chargeMain{
  302. display: flex;
  303. flex-wrap: wrap;
  304. justify-content: space-between;
  305. margin-top: 20px;
  306. .chargeMain-item{
  307. width: 18%;
  308. text-align: center;
  309. padding: 10px;
  310. border: 1px solid #1677ff;
  311. margin-bottom: 10px;
  312. border-radius: 10px;
  313. color:#1677ff;
  314. }
  315. .active{
  316. background-color:#1677ff;
  317. color:#fff;
  318. }
  319. .fault{
  320. background-color:#e1e1e1;
  321. color:#666;
  322. border: 1px solid #ccc;
  323. }
  324. .occupy{
  325. color:#FF4F3F;
  326. border: 1px solid #FF4F3F;
  327. }
  328. }
  329. .foot-btn{
  330. padding: 10px;
  331. position: fixed;
  332. left: 0;
  333. right: 0;
  334. bottom: 0;
  335. background-color: #fff;
  336. }
  337. </style>