Browse Source

User type issue
https://dev.wormwood.com.sg/zentao/task-view-475.html

vbea 1 year ago
parent
commit
3893fb8467

+ 3 - 0
Strides-Admin/src/http/api/financial.js

@@ -78,6 +78,9 @@ const financial = {
   getPaymentTypeOptions() {
     return get(prefix + "payment-method-select")
   },
+  getChargePlatformOptions() {
+    return get(prefix + "charging-platform-select")
+  },
   /*信用余额操作部分-Start*/
   getCreditActionTypeOptions() {
     return get(prefix + "credit-action-type-select")

+ 3 - 3
Strides-Admin/src/utils/index.js

@@ -1,9 +1,9 @@
 import api from '../http/api/settings'
 
 /**
- * Parse the time to string
- * @param {(Object|string|number)} time
- * @param {string} cFormat
+ * 格式化时间为指定的格式
+ * @param {(Object|string|number)} time 指定时间
+ * @param {string} cFormat 指定格式,如:{y}-{m}-{d} {h}:{i}:{s}
  * @returns {string | null}
  */
 export function parseTime(time, cFormat) {

+ 73 - 25
Strides-Admin/src/views/transaction/transactions.vue

@@ -8,6 +8,41 @@
         label-width="0px"
         style="width: 100%;">
         <div class="filter-view">
+          <div>
+            <el-date-picker
+              v-model="filter.pageVo.dateRange"
+              type="daterange"
+              range-separator="-"
+              :clearable="false"
+              start-placeholder="Start Date"
+              end-placeholder="End Date"
+              value-format="yyyy-MM-dd"
+              @change="handleFilter"/>
+          </div>
+          <el-select
+            class="filter-view-item"
+            v-model="filter.pageVo.filter"
+            placeholder="Charging Status"
+            @change="handleFilter"
+            clearable>
+            <el-option
+              v-for="(item, index) in filterOptions"
+              :key="index"
+              :label="item.name"
+              :value="item.value"/>
+          </el-select>
+          <el-select
+            class="filter-view-item"
+            v-model="filter.pageVo.chargingPlatform"
+            placeholder="Charging Platform"
+            @change="changeUserType"
+            clearable>
+            <el-option
+              v-for="item in chargePlatOptions"
+              :key="item"
+              :label="item"
+              :value="item" />
+          </el-select>
           <el-select
             class="filter-view-item"
             v-model="filter.pageVo.userType"
@@ -45,28 +80,6 @@
               :label="item.value"
               :value="item.key" />
           </el-select>
-          <el-select
-            class="filter-view-item"
-            v-model="filter.pageVo.filter"
-            placeholder="Charging Status"
-            @change="handleFilter"
-            clearable>
-            <el-option
-              v-for="(item, index) in filterOptions"
-              :key="index"
-              :label="item.name"
-              :value="item.value"/>
-          </el-select>
-          <div>
-            <el-date-picker
-              v-model="filter.pageVo.dateRange"
-              type="daterange"
-              range-separator="-"
-              start-placeholder="Start Date"
-              end-placeholder="End Date"
-              value-format="yyyy-MM-dd"
-              @change="handleFilter"/>
-          </div>
           <div style="flex: 1; max-width: 500px;">
             <el-input
               v-model="filter.pageVo.criteria"
@@ -127,6 +140,14 @@
           <span :title="row.phoneNo">{{ row.phoneNo }}</span>
         </template>
       </el-table-column-->
+      <el-table-column
+        label="Charging Platform"
+        align="center"
+        min-width="120">
+        <template slot-scope="{row}">
+          <span :title="row.chargingPlatform">{{ row.chargingPlatform }}</span>
+        </template>
+      </el-table-column>
       <el-table-column
         label="User Type"
         align="center"
@@ -172,7 +193,7 @@
         label="Carpark Code"
         prop="carParkCode"
         align="center"
-        min-width="120"/>
+        min-width="90"/>
       <el-table-column
         min-width="90"
         label="Connector"
@@ -271,6 +292,7 @@ import Pagination from '@/components/Pagination'
 import api from '../../http/api/transaction'
 import apiUser from '../../http/api/apiUser.js'
 import financial from '@/http/api/financial'
+import { parseTime } from '@/utils'
 
 export default {
   components: { Pagination },
@@ -286,12 +308,14 @@ export default {
           userType: "",
           creditType: "",
           dateRange: [],
+          chargingPlatform : ""
         }
       },
       groupOptions: [],
       filterOptions: [],
       payTypeOptions: [],
       userTypeOptions: [],
+      chargePlatOptions: [],
       listLoading: true,
       tableList: [],
       total: 0,
@@ -302,12 +326,24 @@ export default {
     }
   },
   created() {
-    this.getFilters();
+    this.init();
     this.getUserTypeOption();
     this.getPaymentTypeOption();
-    //this.handleFilter();
+    this.getChargePlatformList();
+    this.getFilters();
   },
   methods: {
+    init() {
+      const date = new Date();
+      const year = date.getFullYear();
+      const month = date.getMonth();
+      const firstDay = new Date(year, month, 1);
+      const lastDay = new Date(year, month + 1, 0);
+      this.filter.pageVo.dateRange = [
+        parseTime(firstDay, "{y}-{m}-{d}"),
+        parseTime(lastDay, "{y}-{m}-{d}")
+      ]
+    },
     handleFilter() {
       this.filter.pageNo = 1;
       this.getList();
@@ -374,6 +410,18 @@ export default {
         })
       })
     },
+    getChargePlatformList() {
+      financial.getChargePlatformOptions().then(res => {
+        if (res.data) {
+          this.chargePlatOptions = res.data
+        }
+      }).catch(error => {
+        this.$message({
+          message: error,
+          type: 'error'
+        })
+      })
+    },
     getList() {
       this.listLoading = true;
       api.getTransactionPages(this.filter).then(res => {