Parcourir la source

自动合格从ng迁移

theo il y a 3 ans
Parent
commit
d8e5917bbe

+ 122 - 0
backendApi/modules/v1/models/lists/shop/FlowRemainPvList.php

@@ -0,0 +1,122 @@
+<?php
+
+namespace backendApi\modules\v1\models\lists\shop;
+
+use common\helpers\Cache;
+use common\helpers\user\Info;
+use common\libs\dataList\column\Price;
+use common\libs\dataList\DataListInterface;
+use common\libs\dataList\column\DateTime;
+use common\models\FlowRemainPv;
+use Yii;
+
+class FlowRemainPvList extends \common\libs\dataList\DataList implements DataListInterface {
+    /**
+     * 列表名称
+     * @return string
+     */
+    public function getListName() {
+        return '剩余BV流水';
+    }
+
+    /**
+     * 列表筛选到的数据
+     * @throws \yii\base\Exception
+     */
+    public function dataHandle() {
+        $this->listData = FlowRemainPv::lists($this->condition, $this->params, [
+            'select' => 'FR.*,U.USER_NAME,U.REAL_NAME,U.IS_DEC',
+            'orderBy' => 'FR.UPDATED_AT DESC,FR.ID DESC',
+            'from' => FlowRemainPv::tableName() . ' AS FR',
+            'join' => [
+                ['LEFT JOIN', \common\models\User::tableName() . ' AS U', 'FR.USER_ID=U.ID'],
+            ],
+            'page' => $this->page,
+            'pageSize' => $this->pageSize,
+        ]);
+        foreach ($this->listData['list'] as $key => $value) {
+//            $this->listData['list'][$key]['LAST_STATUS_NAME'] = \Yii::$app->params['userStatus'][$value['LAST_STATUS']]['label'] ?? '';
+        }
+
+    }
+
+    /**
+     * 要展示和导出的所有字段
+     * @return array
+     */
+    public function getColumn() {
+        if (!$this->columns) {
+            $this->columns = [
+                'ID' => null,
+                'PERIOD_NUM' => [
+                    'header' => '期数', // 期数
+                    'headerOther' => [
+                        'width' => '150',
+                    ],
+                ],
+                'USER_NAME' => [
+                    'header' => '会员编号',//会员编号
+                    'headerOther' => [
+                        'width' => '150',
+                    ],
+                    'valueOther' => [
+                        'tag' => ['type' => 'info', 'size' => 'small', 'class' => 'no-border']
+                    ],
+                ],
+                'REAL_NAME' => [
+                    'header' => '会员姓名',//会员姓名
+                    'headerOther' => [
+                        'width' => '120',
+                    ],
+                    'valueOther' => [
+                        'tag' => ['type' => 'success', 'size' => 'small', 'class' => 'no-border']
+                    ],
+                ],
+                'REMAIN_PV_FLOW' => [
+                    'header' => '剩余PV流水',
+                    'headerOther' => [
+                        'width' => '150',
+                        'prop' => 'REMAIN_PV_FLOW',
+                    ],
+                ],
+                'REMAIN_PV_TOTAL' => [
+                    'header' => '总剩余PV',
+                    'headerOther' => [
+                        'width' => '150',
+                        'prop' => 'REMAIN_PV_TOTAL',
+                    ],
+                ],
+                'UPDATED_AT' => [
+                    'header' => '更新时间',//创建时间
+                    'value' => function ($row) {
+                        return (new DateTime([
+                            'value' => $row['UPDATED_AT'],
+                        ]))->result();
+                    },
+                    'headerOther' => ['width' => '170'],
+                ],
+                'ORDER_SN' => [
+                    'header' => '订单编号',
+                    'headerOther' => ['width' => '190'],
+                ]
+            ];
+        }
+        return $this->columns;
+    }
+
+    /**
+     * 前台用于筛选的类型集合
+     * @return mixed
+     */
+    public function getFilterTypes() {
+        if (!$this->filterTypes) {
+            $this->filterTypes = [
+                'UPDATED_AT' => ['isUserTable' => false, 'name' => '更新时间', 'other' => 'date'], // 创建时间
+                'PERIOD_NUM' => ['isUserTable' => false, 'name' => '期数'], // 期数
+                'USER_NAME' => ['isUserTable' => false, 'name' => '会员编号'], // 会员编号
+                'REAL_NAME' => ['isUserTable' => false, 'name' => '会员姓名'], // 会员姓名
+            ];
+        }
+        return $this->filterTypes;
+    }
+}

+ 104 - 0
backendApi/modules/v1/models/lists/shop/RemainPvList.php

@@ -0,0 +1,104 @@
+<?php
+
+namespace backendApi\modules\v1\models\lists\shop;
+
+use common\helpers\Cache;
+use common\helpers\user\Info;
+use common\libs\dataList\column\Price;
+use common\libs\dataList\DataListInterface;
+use common\libs\dataList\column\DateTime;
+use common\models\RemainPv;
+use Yii;
+
+class RemainPvList extends \common\libs\dataList\DataList implements DataListInterface {
+    /**
+     * 列表名称
+     * @return string
+     */
+    public function getListName() {
+        return '剩余BV';
+    }
+
+    /**
+     * 列表筛选到的数据
+     * @throws \yii\base\Exception
+     */
+    public function dataHandle() {
+        $this->listData = RemainPv::lists($this->condition, $this->params, [
+            'select' => 'FR.*,U.USER_NAME,U.REAL_NAME,U.IS_DEC',
+            'orderBy' => 'FR.UPDATED_AT DESC,FR.ID DESC',
+            'from' => RemainPv::tableName() . ' AS FR',
+            'join' => [
+                ['LEFT JOIN', \common\models\User::tableName() . ' AS U', 'FR.USER_ID=U.ID'],
+            ],
+            'page' => $this->page,
+            'pageSize' => $this->pageSize,
+        ]);
+        foreach ($this->listData['list'] as $key => $value) {
+//            $this->listData['list'][$key]['LAST_STATUS_NAME'] = \Yii::$app->params['userStatus'][$value['LAST_STATUS']]['label'] ?? '';
+        }
+
+    }
+
+    /**
+     * 要展示和导出的所有字段
+     * @return array
+     */
+    public function getColumn() {
+        if (!$this->columns) {
+            $this->columns = [
+                'ID' => null,
+                'USER_NAME' => [
+                    'header' => '会员编号',//会员编号
+                    'headerOther' => [
+                        'width' => '150',
+                    ],
+                    'valueOther' => [
+                        'tag' => ['type' => 'info', 'size' => 'small', 'class' => 'no-border']
+                    ],
+                ],
+                'REAL_NAME' => [
+                    'header' => '会员姓名',//会员姓名
+                    'headerOther' => [
+                        'width' => '120',
+                    ],
+                    'valueOther' => [
+                        'tag' => ['type' => 'success', 'size' => 'small', 'class' => 'no-border']
+                    ],
+                ],
+                'REMAIN_PV' => [
+                    'header' => '剩余PV',
+                    'headerOther' => [
+                        'width' => '150',
+                        'prop' => 'REMAIN_PV',
+                    ],
+                ],
+                'UPDATED_AT' => [
+                    'header' => '更新时间',//创建时间
+                    'value' => function ($row) {
+                        return (new DateTime([
+                            'value' => $row['UPDATED_AT'],
+                        ]))->result();
+                    },
+                    'headerOther' => ['width' => '170'],
+                ],
+            ];
+        }
+        return $this->columns;
+    }
+
+    /**
+     * 前台用于筛选的类型集合
+     * @return mixed
+     */
+    public function getFilterTypes() {
+        if (!$this->filterTypes) {
+            $this->filterTypes = [
+                'UPDATED_AT' => ['isUserTable' => false, 'name' => '更新时间', 'other' => 'date'], // 创建时间
+                'USER_NAME' => ['isUserTable' => false, 'name' => '会员编号'], // 会员编号
+                'REAL_NAME' => ['isUserTable' => false, 'name' => '会员姓名'], // 会员姓名
+            ];
+        }
+        return $this->filterTypes;
+    }
+}

+ 90 - 0
backendEle/src/views/shop/flow-remain-pv.vue

@@ -0,0 +1,90 @@
+<template>
+  <div v-loading="loading">
+    <div class="white-box">
+      <div class="filter-box">
+        <filter-user :filter-types="filterTypes" @select-value="handleFilterUser"></filter-user>
+      </div>
+      <el-table class="table-box" ref="multipleTable" :data="tableData" stripe style="width: 100%;" :height="tool.getTableHeight()">
+        <el-table-column v-for="(tableHeader, key) in tableHeaders" :key="key" :label="tableHeader.header" :width="tableHeader.other.width ? tableHeader.other.width : ''" :prop="tableHeader.other.prop ? tableHeader.other.prop : null">
+          <template slot-scope="scope">
+            <template v-if="scope.row[tableHeader.index].other.tag" >
+              <el-tag :type="scope.row[tableHeader.index].other.tag.type ? scope.row[tableHeader.index].other.tag.type : null" :size="scope.row[tableHeader.index].other.tag.size ? scope.row[tableHeader.index].other.tag.size : null" :class="scope.row[tableHeader.index].other.tag.class ? scope.row[tableHeader.index].other.tag.class : null" >{{scope.row[tableHeader.index].value}}</el-tag>
+            </template>
+            <template v-else>
+              <div v-html="scope.row[tableHeader.index].value"></div>
+            </template>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="white-box-footer">
+        <pagination :total="totalCount" :page_size="pageSize" @size-change="handleSizeChange" @current-change="handleCurrentChange"></pagination>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import network from '@/utils/network'
+import tool from '@/utils/tool'
+import baseInfo from '@/utils/baseInfo'
+import FilterUser from '../../components/FilterUser'
+import permission from '@/utils/permission'
+import Pagination from '@/components/Pagination'
+import filterHelper from '@/utils/filterHelper'
+
+export default {
+  name: 'shop_flow-remain-pv',
+  components: {FilterUser, Pagination},
+  mounted () {
+    this.getData()
+  },
+  data () {
+    return {
+      tableHeaders: null,
+      tableData: null,
+      loading: true,
+      multipleSelection: [],
+      currentPage: 1,
+      totalPages: 1,
+      totalCount: 1,
+      pageSize: 20,
+      tool: tool,
+      permission: permission,
+      baseDecLevels: baseInfo.decLevels(),
+      baseEmpLevels: baseInfo.empLevels(),
+      filterTypes: null,
+      filterModel: {}
+    }
+  },
+  methods: {
+    handleCurrentChange (page) {
+      this.getData(page, this.pageSize)
+    },
+    handleSizeChange (pageSize) {
+      this.getData(this.currentPage, pageSize)
+    },
+    handleFilterUser (filterData) {
+      filterHelper.handleFilterUser(this, filterData)
+    },
+    getData (page, pageSize) {
+      network.getPageData(this, 'shop/flow-remain-pv', page, pageSize, this.filterModel, response => {
+        this.filterTypes = response.filterTypes
+      })
+    }
+  }
+}
+
+</script>
+
+<style scoped>
+  .table-box .el-form-item__label {
+    width: 100px;
+    color: #99a9bf;
+  }
+
+  .table-box .el-form-item {
+    width: 30%;
+    margin-right: 0;
+    margin-bottom: 0;
+  }
+</style>

+ 90 - 0
backendEle/src/views/shop/remain-pv.vue

@@ -0,0 +1,90 @@
+<template>
+  <div v-loading="loading">
+    <div class="white-box">
+      <div class="filter-box">
+        <filter-user :filter-types="filterTypes" @select-value="handleFilterUser"></filter-user>
+      </div>
+      <el-table class="table-box" ref="multipleTable" :data="tableData" stripe style="width: 100%;" :height="tool.getTableHeight()">
+        <el-table-column v-for="(tableHeader, key) in tableHeaders" :key="key" :label="tableHeader.header" :width="tableHeader.other.width ? tableHeader.other.width : ''" :prop="tableHeader.other.prop ? tableHeader.other.prop : null">
+          <template slot-scope="scope">
+            <template v-if="scope.row[tableHeader.index].other.tag" >
+              <el-tag :type="scope.row[tableHeader.index].other.tag.type ? scope.row[tableHeader.index].other.tag.type : null" :size="scope.row[tableHeader.index].other.tag.size ? scope.row[tableHeader.index].other.tag.size : null" :class="scope.row[tableHeader.index].other.tag.class ? scope.row[tableHeader.index].other.tag.class : null" >{{scope.row[tableHeader.index].value}}</el-tag>
+            </template>
+            <template v-else>
+              <div v-html="scope.row[tableHeader.index].value"></div>
+            </template>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="white-box-footer">
+        <pagination :total="totalCount" :page_size="pageSize" @size-change="handleSizeChange" @current-change="handleCurrentChange"></pagination>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import network from '@/utils/network'
+import tool from '@/utils/tool'
+import baseInfo from '@/utils/baseInfo'
+import FilterUser from '../../components/FilterUser'
+import permission from '@/utils/permission'
+import Pagination from '@/components/Pagination'
+import filterHelper from '@/utils/filterHelper'
+
+export default {
+  name: 'shop_remain-pv',
+  components: {FilterUser, Pagination},
+  mounted () {
+    this.getData()
+  },
+  data () {
+    return {
+      tableHeaders: null,
+      tableData: null,
+      loading: true,
+      multipleSelection: [],
+      currentPage: 1,
+      totalPages: 1,
+      totalCount: 1,
+      pageSize: 20,
+      tool: tool,
+      permission: permission,
+      baseDecLevels: baseInfo.decLevels(),
+      baseEmpLevels: baseInfo.empLevels(),
+      filterTypes: null,
+      filterModel: {}
+    }
+  },
+  methods: {
+    handleCurrentChange (page) {
+      this.getData(page, this.pageSize)
+    },
+    handleSizeChange (pageSize) {
+      this.getData(this.currentPage, pageSize)
+    },
+    handleFilterUser (filterData) {
+      filterHelper.handleFilterUser(this, filterData)
+    },
+    getData (page, pageSize) {
+      network.getPageData(this, 'shop/remain-pv', page, pageSize, this.filterModel, response => {
+        this.filterTypes = response.filterTypes
+      })
+    }
+  }
+}
+
+</script>
+
+<style scoped>
+  .table-box .el-form-item__label {
+    width: 100px;
+    color: #99a9bf;
+  }
+
+  .table-box .el-form-item {
+    width: 30%;
+    margin-right: 0;
+    margin-bottom: 0;
+  }
+</style>

+ 25 - 0
common/models/FlowRemainPv.php

@@ -0,0 +1,25 @@
+<?php
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "{{%FLOW_REMAIN_PV}}".
+ *
+ * @property string $ID
+ * @property string $USER_ID 会员ID
+ * @property int $REMAIN_PV_FLOW 剩余BV FLOW
+ * @property int $UPDATED_AT 更新时间
+ * @property varchar $ORDER_SN 订单SN号
+ */
+class FlowRemainPv extends \common\components\ActiveRecord
+{
+    /**
+     * @inheritdoc
+     */
+    public static function tableName()
+    {
+        return '{{%FLOW_REMAIN_PV}}';
+    }
+
+}

+ 22 - 0
common/models/RemainPv.php

@@ -0,0 +1,22 @@
+<?php
+namespace common\models;
+
+use Yii;
+
+/**
+ * This is the model class for table "{{%REMAIN_PV}}".
+ *
+ * @property string $USER_ID 会员ID
+ * @property int $REMAIN_PV 剩余BV
+ * @property int $UPDATED_AT 更新时间
+ */
+class RemainPv extends \common\components\ActiveRecord
+{
+    /**
+     * @inheritdoc
+     */
+    public static function tableName()
+    {
+        return '{{%REMAIN_PV}}';
+    }
+}