Xxxu
2020-07-07 4f953ffc89fc95f83b152e914c5e65938b440f17
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
<template>
  <div>
    <el-card style="padding:0px;margin-top:0px;width:100%;height:100px;background-color:rgba(0,0,0,0);">
      <img src="http://47.106.172.9:443/download/weixin.png" height="70px" style="float:left">
      <div style="height:60px">
        <p style="margin-top:0px;font-size:16px">充电桩名称:</p>
        <span v-if="!changeNameVisable">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{chargeInfo.c2ChargingName}}({{chargeInfo.streetlightId}})</span>
        <el-tag v-if="chargeInfo.buttonFlag === 1 && !changeNameVisable" type="danger">故障</el-tag>
        <el-tag v-if="chargeInfo.buttonFlag === 0 && !changeNameVisable" type="success">正常</el-tag>              
        <el-input style="width:40%;background-color:rgba(0,0,0,0)" @keyup.enter.native="changeC2ChargingName" v-if="changeNameVisable" v-model="chargeInfo.c2ChargingName"></el-input>
        <el-button @click="changeNameVisable = !changeNameVisable" v-if="!changeNameVisable" style="float:right;background-color:rgba(0,0,0,0)" size="mini">修改</el-button>
        <el-button @click="changeNameVisable = !changeNameVisable" v-if="changeNameVisable" style="float:right;background-color:rgba(0,0,0,0)" size="mini" >取消</el-button>
        <el-button @click="changeC2ChargingName" v-if="changeNameVisable" style="float:right;background-color:rgba(0,0,0,0)" size="mini" >确定</el-button>
      </div>
    </el-card>
      <el-card style="padding:0px;margin-top:10px;width:100%;background-color:rgba(0,0,0,0);"> 
        <el-row style="margin-top:50px">
          <el-col :span="12">
            <div style="text-align:center">
              <el-button v-if="chargeSelectVisable" style="width:200px;height:200px;background-color:#67C23A;color:white" icon="el-icon-check" @click="chargeSelectVisable = !chargeSelectVisable,startChargeVisable=true,stopChargeTypeVisable = true" circle>开始充电</el-button>
              <!-- USB/电动车选择 -->
              <el-row v-if="startChargeVisable">
                <el-col :span="12">
                  <el-button style="width:200px;height:200px;background-color:#67C23A;color:white" icon="el-icon-check" @click="chargeTimeVisable = !chargeTimeVisable,startChargeVisable = !startChargeVisable,chargeType=0,stopChargeTypeVisable=true" circle>USB充电</el-button>
                </el-col>
                <el-col :span="12">
                  <el-button style="width:200px;height:200px;background-color:#67C23A;color:white" icon="el-icon-check" @click="chargeTimeVisable = !chargeTimeVisable,startChargeVisable = !startChargeVisable,chargeType=1,stopChargeTypeVisable=true" circle>电动车充电</el-button>
                </el-col>
              </el-row> 
              <div v-if="chargeTimeVisable">
                <el-card style="width:100%;height:200px;background-color:rgba(0,0,0,0);">
                  <el-form style="margin-top:5%">
                      <el-form-item label="充电时间">
                      <el-input-number style="width:20%" v-model="hour" controls-position="right" :min="0" :max="18"></el-input-number>时
                      <el-input-number style="width:20%" v-model="minitue" controls-position="right" :step="30" :min="0" :max="30"></el-input-number>分
                    </el-form-item>
                    <el-form-item>
                      <el-button type="success" @click="startCharging()">开始充电</el-button>
                      <el-button @click="chargeTimeVisable = false,chargeSelectVisable = true">取消</el-button>
                    </el-form-item>
                  </el-form>
                </el-card>
              </div>
            </div>      
          </el-col>
          <el-col :span="12">
            <div v-if="stopChargeTypeVisable" style="text-align:center">
              <el-button @click="stopChargeTypeVisable = !stopChargeTypeVisable" style="width:200px;height:200px;background-color:#F56C6C;color:white" icon="el-icon-close" circle>结束充电</el-button>
            </div> 
            <el-row v-if="!stopChargeTypeVisable">
              <el-col :span="12">
              <el-button @click="stopCharging(0)" style="width:200px;height:200px;background-color:#F56C6C;color:white" icon="el-icon-close" circle>USB结束充电</el-button>
              </el-col>
              <el-col :span="12">
              <el-button @click="stopCharging(1)" style="width:200px;height:200px;background-color:#F56C6C;color:white" icon="el-icon-close" circle>电动车结束充电</el-button>            
              </el-col>
            </el-row>     
          </el-col>
        </el-row>
        <el-row :gutter="40" style="margin-top:80px">
          <el-col :span="12">
            <el-card style="padding:0px;margin-top:20px;width:100%;height:120px;background-color:rgba(0,0,0,0);">
              <img src="http://47.106.172.9:443/download/weixin.png" height="80px" style="float:left">
              <div style="height:80px">
                <p style="margin-top:0px;font-size:20px">费率:</p>
                <span v-if="chargeInfo.usbcharge!=0">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{chargeInfo.usbcharge/10}}&nbsp;元</span>
                <span v-if="chargeInfo.usbcharge==0">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;免费&nbsp;</span>
              </div>
            </el-card>
            </el-col>
            <el-col :span="12">
              <el-card style="padding:0px;margin-top:20px;width:100%;height:120px;background-color:rgba(0,0,0,0);">
                <img src="http://47.106.172.9:443/download/weixin.png" height="80px" style="float:left">
                <div style="height:80px">
                  <p style="margin-top:0px;font-size:20px">USB口状态:</p>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                  <el-tag v-if="chargeInfo.usbStatus === 1" type="success">充电中</el-tag>
                  <el-tag v-else type="info">空闲</el-tag>
                </div>
              </el-card>
            </el-col>
          </el-row>
          <el-row :gutter="40" style="margin-top:10px">
            <el-col :span="12">
              <el-card style="padding:0px;margin-top:20px;width:100%;height:120px;background-color:rgba(0,0,0,0);">
                <img src="http://47.106.172.9:443/download/weixin.png" height="80px" style="float:left">
                <div style="height:80px">
                  <p style="margin-top:0px;font-size:20px">费率:</p>
                  <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{chargeInfo.elecharge/10}}&nbsp;元</span>
                </div>
              </el-card>
            </el-col>
            <el-col :span="12">
              <el-card style="padding:0px;margin-top:20px;width:100%;height:120px;background-color:rgba(0,0,0,0);">
                <img src="http://47.106.172.9:443/download/weixin.png" height="80px" style="float:left">
                <div style="height:80px">
                  <p style="margin-top:0px;font-size:20px">电动车口状态:</p>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                  <el-tag v-if="chargeInfo.eleStatus === 1" type="success">充电中</el-tag>
                  <el-tag v-else type="info">空闲</el-tag>
                </div>
              </el-card>
            </el-col>
          </el-row>
    </el-card>
      <el-row>
        <el-card style="padding:0px;background-color:rgba(0,0,0,0)">
          <el-button style="margin:0px;width:100%;border:0px;height:100%;background-color:rgba(0,0,0,0)"
                      @click="changeChargeVisable = !changeChargeVisable">费率修改</el-button>
          <el-button style="margin:0px;width:100%;border:0px;height:100%;background-color:rgba(0,0,0,0)" 
                      @click="getOrderList()">订单列表</el-button>
        </el-card>
      </el-row>
    <el-dialog
      title="费率修改"
      :visible.sync="changeChargeVisable"
      width="30%"
      style="background-color:rgba(0,0,0,0);color:black">
        <h3 style="margin-top:0px">费率调整为0为免费,费率范围为0 ~ 25.5元</h3>
        <el-form inline style="margin-bottom:0px;">
          <el-form-item label="USB口费率">
            <el-input style="width:70%" v-model="usbcharge"></el-input>元
          </el-form-item>
          <el-form-item label="电动车口费率">
            <el-input style="width:70%" v-model="elecharge"></el-input>元
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="changeCharge()">确定</el-button>
          <el-button @click="changeChargeVisable=false">取消</el-button>
        </div>
    </el-dialog>
 
    <el-dialog
      title="订单列表"
      :visible.sync="orderListVisable"
      width="100%"
      style="background-color:rgba(0,0,0,0);color:black">
      <el-input v-model="orderId"></el-input>
        <el-table
          :data="orderList"
          style="width: 100%">
          <el-table-column
            align="center"
            prop="outTradeNo"
            label="订单编号">
          </el-table-column>
          <el-table-column
            align="center"
            prop="streetlightId"
            label="所属灯杆ID">
          </el-table-column>
          <el-table-column
            align="center"
            prop="totalMoney"
            label="订单总金额">
            <template slot-scope="scope">
                <span v-if="scope.row.totalMoney === 0">免费</span>
                <span v-if="scope.row.totalMoney !== 0">{{scope.row.totalMoney}}</span>
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            label="订单退款金额">
            <template slot-scope="scope">
                <span v-if="scope.row.orderStatus === 'REFUND'">{{scope.row.refundMoney}}</span>
                <span v-else>--</span>
            </template>
          </el-table-column>
          <el-table-column
          prop="chargeType"
          label="充电口类型">
            <template slot-scope="scope">
                <el-tag v-if="scope.row.chargeType ===0" size="small" >USB</el-tag>
                <el-tag v-else-if="scope.row.chargeType ===1" size="small">电动车</el-tag>
                <el-tag v-else-if="scope.row.chargeType ===2" size="small">电动汽车</el-tag>
                <el-tag v-else size="small" type="danger" >未知异常,请联系管理员</el-tag>
            </template>
          </el-table-column>
          <el-table-column
          prop="orderType"
          label="支付方式">
            <template slot-scope="scope">
                <el-tag v-if="scope.row.orderType ===1" size="small" >支付宝</el-tag>
                <el-tag v-else-if="scope.row.orderType ===0" size="small" type="success">微信</el-tag>
                <el-tag v-else size="small" type="danger" >未知异常,请联系管理员</el-tag>
            </template>
          </el-table-column>
          <el-table-column
            prop="orderCreateTime"
            align="center"
            label="订单创建时间">
          </el-table-column>
          <el-table-column
          prop="orderStatus"
          label="订单状态">
            <template slot-scope="scope">
                <el-tag v-if="scope.row.orderStatus === 'SUCCESS'" size="small" type="success" >已支付</el-tag>
                <el-tag v-else-if="scope.row.orderStatus === 'FAIL'" size="small" type="info">未支付</el-tag>
                <el-tag v-else-if="scope.row.orderStatus === 'REFUND'" size="small" type="warning">已退款</el-tag>
                <el-tag v-else-if="scope.row.orderStatus === 'RFERROR'" size="small" type="error">退款失败</el-tag>
                <el-tag v-else size="small" type="danger" >未知异常,请联系管理员</el-tag>
            </template>
          </el-table-column>
          <el-table-column
            prop="orderPayTime"
            label="订单支付时间">
            <template slot-scope="scope">
                <span v-if="scope.row.orderStatus === 'SUCCESS'">{{scope.row.orderPayTime}}</span>
                <span v-else-if="scope.row.orderStatus === 'REFUND'">{{scope.row.orderPayTime}}</span>
                <span v-else>--:--:-- --:--:--</span>
            </template>
          </el-table-column>
          <el-table-column
            prop="orderRefundTime"
            label="订单退款时间">
            <template slot-scope="scope">
                <span v-if="scope.row.orderStatus === 'REFUND'">{{scope.row.orderRefundTime}}</span>
                <span v-else>--:--:-- --:--:--</span>
            </template>
          </el-table-column>
          <el-table-column
            align="center"
            label="操作面板">
            <template slot-scope="scope">
              <el-button type="text" size="small" @click="orderPanleHandle(scope.row.streetlightId,scope.row.outTradeNo,scope.row.orderStatus,scope.row.orderType,scope.row.totalMoney)">操作面板</el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          @size-change="sizeChangeHandle"
          @current-change="currentChangeHandle"
          :current-page="pageIndex"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="pageSize"
          :total="totalPage"
          layout="total, sizes, prev, pager, next, jumper">
        </el-pagination>
    </el-dialog>
 
      <!-- <p>灯杆id:{{chargeInfo.streetlightId}}</p>
      <p>充电桩名称:{{chargeInfo.c2ChargingName}}</p>
      <p>充电桩Mac地址:{{chargeInfo.c2ChargingMac}}</p>
      <p>充电桩USB口费率:{{chargeInfo.usbcharge/10}}</p>
      <p>充电桩电动车口费率:{{chargeInfo.elecharge/10}}</p>
      <p>充电桩电动汽车口费率:{{chargeInfo.carcharge/10}}</p>
      <p>充电桩新增时间:{{chargeInfo.c2ChargingAddTime}}</p> -->
  </div>
</template>
 
<script>
export default {
  data () {
    return {
      pageIndex: 1,
      pageSize: 10,
      totalPage: 0,
      drawer: false,
      panelHeight: '500px',
      isMoblie: true,
      streetlightId: 0,
      usbcharge: 0,
      elecharge: 0,
      chargeInfo: '',
      newName: '',
      orderList: [],
      chargeSelectVisable: true, // 充电类型选择按钮
      startChargeVisable: false, // 充电时间界面
      changeUSBVisable: false,
      changeEleVisable: false,
      chargeTimeVisable: false,
      changeNameVisable: false, // 修改名称界面
      changeChargeVisable: false, // 修改电价弹窗
      orderListVisable: false, // 订单列表界面
      hour: 0, // 开始充电设置小时
      minitue: 0, // 开始充电设置30*x分钟
      chargeType: -1, // 充电类型
      stopChargeTypeVisable: true,
      orderId: '' // 订单界面搜索绑定ID
    }
  },
  computed: {
    streetlightStateId () {
      return this.$store.state.charge.streetlightIdOfChargeControl
    }
  },
  watch: {
    streetlightStateId (curVal, oldVal) {
      this.streetlightId = curVal
      this.getChargeInfo(curVal)
    }
  },
  activated () {
  },
  methods: {
    getOrderList () {
      this.$http({
        url: this.$http.adornUrl('/pole/polec2charging/orderlist'),
        method: 'get',
        params: this.$http.adornParams({
          streetlightId: this.chargeInfo.streetlightId,
          page: this.pageIndex,
          limit: this.pageSize
        })
      }).then(({ data }) => {
        this.orderList = data.page.list
        this.totalPage = data.page.total
        this.pageIndex = data.page.pageNum
        this.orderListVisable = true
      })
    },
    // 每页数
    sizeChangeHandle (val) {
      this.pageSize = val
      this.pageIndex = 1
      this.getOrderList()
    },
    // 当前页
    currentChangeHandle (val) {
      this.pageIndex = val
      this.getOrderList()
    },
    // 获取充电桩信息
    getChargeInfo (streetlightId) {
      this.$http({
        url: this.$http.adornUrl('/pole/polec2charging/chargeInfo'),
        method: 'get',
        params: this.$http.adornParams({
          streetlightId: streetlightId
        })
      }).then(({ data }) => {
        this.chargeInfo = data.info
        this.usbcharge = data.info.usbcharge / 10
        this.elecharge = data.info.elecharge / 10
        if (this.chargeInfo.c2ChargingName !== undefined) {
          this.$message({
            message: '选择充电桩' + this.chargeInfo.c2ChargingName,
            type: 'success'
          })
        }
      })
    },
    changeC2ChargingName () {
      var streetlightId = this.chargeInfo.streetlightId
      this.$http({
        url: this.$http.adornUrl('/pole/polec2charging/changeChargingName'),
        method: 'get',
        params: this.$http.adornParams({
          streetlightId: streetlightId,
          c2ChargingName: this.chargeInfo.c2ChargingName
        })
      }).then(({ data }) => {
        this.changeNameVisable = false
        window.location.reload()
        this.$message({
          message: '修改成功',
          type: 'success'
        })
        this.$store.commit('updateStreetlightIdOfChargeControl', streetlightId)
      })
    },
    startCharging () {
      if (Number(this.hour) + Number(this.minitue) === 0) {
        this.$message({
          message: '未设置时间,请选择充电时间!',
          type: 'warning'
        })
        return -1
      }
      this.$http({
        url: this.$http.adornUrl('/pole/polec2charging/startCharging'),
        method: 'get',
        params: this.$http.adornParams({
          streetlightId: this.streetlightId,
          addressCode: this.chargeInfo.c2ChargingMac,
          totalTime: this.hour * 2 + this.minitue / 30,
          type: this.chargeType
        })
      }).then(({ data }) => {
        this.$message({
          message: data.msg,
          type: 'success'
        })
        this.chargeTimeVisable = false
        this.chargeSelectVisable = true
      })
    },
    stopCharging (val) {
      this.$http({
        url: this.$http.adornUrl('/pole/polec2charging/stopCharging'),
        method: 'get',
        params: this.$http.adornParams({
          streetlightId: this.streetlightId,
          addressCode: this.chargeInfo.c2ChargingMac,
          type: val
        })
      }).then(({ data }) => {
        this.$message({
          message: data.msg,
          type: 'success'
        })
        this.stopChargeTypeVisable = !this.stopChargeTypeVisable
      })
    },
    // 修改电价
    changeCharge () {
      this.$http({
        url: this.$http.adornUrl('/pole/polec2charging/changeCharge'),
        method: 'get',
        params: this.$http.adornParams({
          streetlightId: this.chargeInfo.streetlightId,
          addressCode: this.chargeInfo.c2ChargingMac,
          usbCharge: this.usbcharge,
          eleCharge: this.elecharge
        })
      }).then(({ data }) => {
        if (data.code === '0') {
          this.$message({
            message: data.msg,
            type: 'success'
          })
        } else {
          this.$message.error(data.msg)
        }
        this.changeChargeVisable = false
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.el-dialog__header {
  background-color: black;
}
</style>
<style>
.el-radio-button__inner {
  color: black;
  background-color: rgba(0, 0, 0, 0);
  border-color: black;
}
.el-radio-button__inner:hover {
  color: black;
}
.el-radio-button__orig-radio:checked + .el-radio-button__inner {
  background-color: grey;
  border-color: black;
}
.el-input-number__decrease is-disabled:focus {
  border-color: black;
}
.el-input-number__decrease:focus {
  border-color: black;
}
.mybg {
  height: 200px;
  width: 200px;
  background-image: url("http://47.106.172.9:443/download/yuan.jpg");
  background-repeat: no-repeat;
  background-size: 100% 100%;
  text-align: center;
  padding-top: 90px;
  /* background-color: black */
}
</style>