Bladeren bron

兑换积分

zxiansheng 4 jaren geleden
bovenliggende
commit
8df9711f88

+ 2 - 0
backendApi/config/menu.php

@@ -202,6 +202,8 @@ return [
 //            ['name'=>'领袖分红奖流水导出', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'flow-lx-export', 'routePath'=>'bonus/flow-lx-export', 'show'=>0,],
             ['name'=>'复消积分流水', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'flow-rp', 'routePath'=>'bonus/flow-rp', 'show'=>1,],
             ['name'=>'复消积分流水导出', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'flow-rp-export', 'routePath'=>'bonus/flow-rp-export', 'show'=>0,],
+            ['name'=>'兑换积分流水', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'flow-exchange', 'routePath'=>'bonus/flow-exchange', 'show'=>1,],
+            ['name'=>'兑换积分流水导出', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'flow-exchange-export', 'routePath'=>'bonus/flow-exchange-export', 'show'=>0,],
             ['name'=>'会员余额流水', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'flow-balance', 'routePath'=>'bonus/flow-balance', 'show'=>1,],
             ['name'=>'会员余额流水导出', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'flow-balance-export', 'routePath'=>'bonus/flow-balance-export', 'show'=>0,],
 //            ['name'=>'区域津贴核算', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'calc-qy', 'routePath'=>'bonus/calc-qy', 'show'=>1,],

+ 58 - 0
backendApi/modules/v1/controllers/BonusController.php

@@ -13,6 +13,7 @@ use backendApi\modules\v1\models\exportForms\BonusExportForm;
 use backendApi\modules\v1\models\lists\bonus\BalanceList;
 use backendApi\modules\v1\models\lists\bonus\FlowBalanceList;
 use backendApi\modules\v1\models\lists\bonus\FlowBonusList;
+use backendApi\modules\v1\models\lists\bonus\FlowExchangePointsList;
 use backendApi\modules\v1\models\lists\bonus\FlowReconsumePointsList;
 use backendApi\modules\v1\models\lists\bonus\FlowWalletList;
 use backendApi\modules\v1\models\lists\bonus\PerfMonthList;
@@ -57,6 +58,7 @@ use common\models\UserNetwork;
 use Yii;
 use common\helpers\Form;
 use common\models\FlowBonus;
+use common\models\FlowExchangePoints;
 use common\models\forms\PeriodForm;
 use common\models\Period;
 
@@ -392,6 +394,62 @@ class BonusController extends BaseController {
         return static::notice('导出开始,请到文件管理-导出文件查看');
     }
 
+
+    /**
+     * 兑换积分流水
+     * @return mixed
+     * @throws \yii\base\Exception
+     * @throws \yii\web\HttpException
+     */
+    public function actionFlowExchange() {
+        $filter = $this->filterCondition([
+            'userIds' => 'USER_ID',
+            'CREATED_AT' => 'CREATED_AT',
+            'PERIOD_NUM' => 'PERIOD_NUM',
+            'CALC_MONTH' => 'CALC_MONTH',
+            'DEAL_TYPE_NAME' => 'DEAL_TYPE_ID',
+            'LAST_DEC_LV_NAME' => 'LAST_DEC_LV',
+            'LAST_EMP_LV_NAME' => 'LAST_EMP_LV',
+            'AMOUNT' => 'AMOUNT',
+            'TOTAL' => 'TOTAL',
+            'ADMIN_NAME' => 'ADMIN_NAME',
+            'REMARK' => 'REMARK',
+        ]);
+        $condition = $filter['condition'];
+        $params = $filter['params'];
+        $listObj = new FlowExchangePointsList();
+        $data = $listObj->getList(['condition'=>$condition, 'params'=>$params]);
+        return static::notice($data);
+    }
+
+    /**
+     * 兑换积分流水导出
+     * @return mixed
+     * @throws \yii\db\Exception
+     * @throws \yii\web\HttpException
+     */
+    public function actionFlowExchangeExport() {
+        $filter = $this->filterCondition([
+            'userIds' => 'USER_ID',
+            'CREATED_AT' => 'CREATED_AT',
+            'PERIOD_NUM' => 'PERIOD_NUM',
+            'CALC_MONTH' => 'CALC_MONTH',
+            'DEAL_TYPE_NAME' => 'DEAL_TYPE_ID',
+            'LAST_DEC_LV_NAME' => 'LAST_DEC_LV',
+            'LAST_EMP_LV_NAME' => 'LAST_EMP_LV',
+            'AMOUNT' => 'AMOUNT',
+            'TOTAL' => 'TOTAL',
+            'ADMIN_NAME' => 'ADMIN_NAME',
+            'REMARK' => 'REMARK',
+        ]);
+        $form = new BonusExportForm();
+        $result = $form->run($filter, '兑换积分流水');
+        if (!$result) {
+            return static::notice(Form::formatErrorsForApi($form->getErrors()), 400);
+        }
+        return static::notice('导出开始,请到文件管理-导出文件查看');
+    }
+
     /**
      * 现金钱包流水
      * @return mixed

+ 207 - 0
backendApi/modules/v1/models/lists/bonus/FlowExchangePointsList.php

@@ -0,0 +1,207 @@
+<?php
+
+namespace backendApi\modules\v1\models\lists\bonus;
+
+use common\helpers\Cache;
+use common\helpers\user\Info;
+use common\libs\dataList\column\Price;
+use common\libs\dataList\column\YesNo;
+use common\libs\dataList\DataListInterface;
+use common\models\DealType;
+use common\libs\dataList\column\DateTime;
+use common\models\FlowExchangePoints;
+use Yii;
+
+class FlowExchangePointsList extends \common\libs\dataList\DataList implements DataListInterface {
+    /**
+     * 列表名称
+     * @return string
+     */
+    public function getListName() {
+        return '兑换积分流水';
+    }
+
+    /**
+     * 列表筛选到的数据
+     * @throws \yii\base\Exception
+     */
+    public function dataHandle() {
+        $this->listData = FlowExchangePoints::lists($this->condition, $this->params, [
+            'orderBy' => 'CREATED_AT DESC, ID DESC',
+            'page' => $this->page,
+            'pageSize' => $this->pageSize,
+        ]);
+        foreach ($this->listData['list'] as $key => $value) {
+            $userInfo = Info::baseInfoZh($value['USER_ID']);
+            $this->listData['list'][$key] = array_merge($userInfo, $value);
+            $this->listData['list'][$key]['DEAL_TYPE_NAME'] = DealType::getAllTypesForShow()[$value['DEAL_TYPE_ID']]['TYPE_NAME'] ?? '';
+            $this->listData['list'][$key]['LAST_DEC_LV_NAME'] = Cache::getDecLevelConfig()[$value['LAST_DEC_LV']]['LEVEL_NAME'] ?? '';
+            $this->listData['list'][$key]['LAST_EMP_LV_NAME'] = Cache::getEmpLevelConfig()[$value['LAST_EMP_LV']]['LEVEL_NAME'] ?? '';
+            $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,
+                'CREATED_AT' => [
+                    'header' => '创建时间',
+                    'value' => function ($row) {
+                        return (new DateTime([
+                            'value' => $row['CREATED_AT'],
+                        ]))->result();
+                    },
+                    'headerOther' => ['width' => '170'],
+                ],
+                'PERIOD_NUM' => '期数',
+                'CALC_MONTH' => '结算月',
+                'DEAL_TYPE_NAME' => [
+                    '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']
+                    ],
+                ],
+                'LAST_DEC_LV_NAME' => [
+                    'header' => '会员级别',
+                    'headerOther' => [
+                        'width' => '110',
+                    ],
+                    'valueOther' => [
+                        'tag' => ['type' => 'warning', 'size' => 'small', 'class' => 'no-border']
+                    ],
+                ],
+                'LAST_EMP_LV_NAME' => [
+                    'header' => '聘级',
+                    'headerOther' => [
+                        'width' => '130',
+                    ],
+                    'valueOther' => [
+                        'tag' => ['type' => 'warning', 'size' => 'small', 'class' => 'no-border']
+                    ],
+                ],
+                'IS_DEC' => [
+                    'header' => '是否报单中心',
+                    'value' => function ($row) {
+                        return (new YesNo([
+                            'value' => $row['IS_DEC'],
+                        ]))->result();
+                    },
+                    'headerOther' => function ($row) {
+                        return [
+                            'width' => '120',
+                        ];
+                    },
+                    'valueOther' => function ($row) {
+                        return [
+                            'tag' => ['type' => (isset($row['IS_DEC']) && $row['IS_DEC']) ? 'success' : 'info', 'size' => 'small']
+                        ];
+                    },
+                ],
+                'BEFORE_BALANCE' => [
+                    'header' => '交易前余额',
+                    'value' => function ($row) {
+                        return (new Price([
+                            'value' => $row['TOTAL'] - $row['AMOUNT'],
+                        ]))->result();
+                    },
+                    'headerOther' => [
+                        'width' => '150',
+                    ],
+                ],
+                'AMOUNT' => [
+                    'header' => '交易额',
+                    'value' => function ($row) {
+                        $result = (new Price([
+                            'value' => $row['AMOUNT'],
+                        ]))->result();
+                        return $row['IS_INCR'] > 0 ? '+' . $result : $result;
+                    },
+                    'headerOther' => [
+                        'width' => '150',
+                        'prop' => 'BONUS',
+                    ],
+                    'valueOther' => function ($row) {
+                        if ($row['IS_INCR'] > 0) {
+                            $type = 'success';
+                        } elseif ($row['IS_INCR'] == 0) {
+                            $type = 'danger';
+                        } else {
+                            $type = 'info';
+                        }
+                        return [
+                            'tag' => ['type' => $type, 'size' => 'small']
+                        ];
+                    },
+                ],
+                'TOTAL' => [
+                    'header' => '交易后余额',
+                    'value' => function ($row) {
+                        return (new Price([
+                            'value' => $row['TOTAL'],
+                        ]))->result();
+                    },
+                    'headerOther' => [
+                        'width' => '150',
+                    ],
+                ],
+                'ADMIN_NAME' => [
+                    'header' => '操作人',
+                    'headerOther' => ['width' => '110'],
+                ],
+                'REMARK' => [
+                    'header' => '备注',
+                    'headerOther' => ['width' => '250'],
+                ],
+            ];
+        }
+        return $this->columns;
+    }
+
+    /**
+     * 前台用于筛选的类型集合
+     * @return mixed
+     */
+    public function getFilterTypes() {
+        if (!$this->filterTypes) {
+            $this->filterTypes = [
+                'CREATED_AT' => ['isUserTable' => false, 'name' => '创建时间', 'other' => 'date'],
+                'PERIOD_NUM' => ['isUserTable' => false, 'name' => '期数'],
+                'CALC_MONTH' => ['isUserTable' => false, 'name' => '结算月', 'other' => 'month'],
+                'DEAL_TYPE_NAME' => ['isUserTable' => false, 'name' => '交易类型', 'other' => 'dealTypes'],
+                'USER_NAME' => ['isUserTable' => true, 'name' => '会员编号'],
+                'REAL_NAME' => ['isUserTable' => true, 'name' => '会员姓名'],
+                'LAST_DEC_LV_NAME' => ['isUserTable' => false, 'name' => '会员级别', 'other' => 'decLevel'],
+                'LAST_EMP_LV_NAME' => ['isUserTable' => false, 'name' => '聘级', 'other' => 'empLevel'],
+                'IS_DEC' => ['isUserTable' => true, 'name' => '是否报单中心', 'other' => 'yesOrNo'],
+                'AMOUNT' => ['isUserTable' => false, 'name' => '交易额'],
+                'TOTAL' => ['isUserTable' => false, 'name' => '交易后余额'],
+                'ADMIN_NAME' => ['isUserTable' => false, 'name' => '操作人'],
+                'REMARK' => ['isUserTable' => false, 'name' => '备注'],
+            ];
+        }
+        return $this->filterTypes;
+    }
+}

+ 12 - 0
backendEle/src/router/index.js

@@ -766,6 +766,18 @@ export const constantRouterMap = [
           ],
         },
       },
+      {
+        path: '/bonus/flow-exchange',
+        component: _import('bonus/flow-exchange'),
+        name: 'bonus_flow-exchange',
+        meta: {
+          title: '兑换积分流水',
+          breadcrumb: [
+            {title: '首页', path: '/dashboard/index'},
+            {title: '奖金管理', path: '/bonus/period'},
+          ],
+        },
+      },
       {
         path: '/bonus/flow-lx',
         component: _import('bonus/flow-lx'),

+ 107 - 0
backendEle/src/views/bonus/flow-exchange.vue

@@ -0,0 +1,107 @@
+<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">
+        <el-button type="success" size="small" @click="handleExport" v-show="permission.hasPermission(`bonus/flow-bonus-export`)">导出Excel</el-button>
+        <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: 'bonus_flow-exchange',
+    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, 'bonus/flow-exchange', page, pageSize, this.filterModel, response=>{
+          this.filterTypes = response.filterTypes
+        })
+      },
+      handleExport(){
+        this.$confirm(`确定要导出当前数据吗?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          return network.getData(`bonus/flow-exchange-export`, this.filterModel)
+        }).then(response => {
+          this.$message({
+            message: response,
+            type: 'success'
+          })
+        }).catch(response => {
+
+        })
+      },
+    }
+  }
+
+</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>

+ 10 - 0
console/controllers/BonusController.php

@@ -12,6 +12,7 @@ use backendApi\modules\v1\models\lists\bonus\CfLxAuditList;
 use backendApi\modules\v1\models\lists\bonus\FlowBalanceList;
 use backendApi\modules\v1\models\lists\bonus\FlowBonusList;
 use backendApi\modules\v1\models\lists\bonus\FlowCfList;
+use backendApi\modules\v1\models\lists\bonus\FlowExchangePointsList;
 use backendApi\modules\v1\models\lists\bonus\FlowLxList;
 use backendApi\modules\v1\models\lists\bonus\FlowReconsumePointsList;
 use backendApi\modules\v1\models\lists\bonus\OtherPeriodBonusList;
@@ -229,6 +230,15 @@ class BonusController extends BaseController
         return $this->_export($taskId, FlowReconsumePointsList::class, '复消积分流水列表');
     }
 
+    /**
+     * 兑换积分流水导出
+     * @param $taskId
+     * @return bool
+     */
+    public function actionFlowExchangeExport($taskId){
+        return $this->_export($taskId, FlowExchangePointsList::class, '兑换积分流水列表');
+    }
+
     /**
      * 车房养老奖流水导出
      * @param $taskId