| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- <?php
- namespace backendApi\modules\v1\models\lists\bonus;
- 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\FlowWallet;
- use common\models\User;
- use Yii;
- class FlowWalletList extends \common\libs\dataList\DataList implements DataListInterface {
- /**
- * 列表名称
- * @return string
- */
- public function getListName() {
- return '现金钱包流水';
- }
- /**
- * 列表筛选到的数据
- * @throws \yii\base\Exception
- */
- public function dataHandle() {
- $this->listData = FlowWallet::lists($this->condition, $this->params, [
- 'select' => 'FW.*,U.USER_NAME,U.REAL_NAME,U.IS_DEC',
- 'orderBy' => 'FW.CREATED_AT DESC,FW.ID DESC',
- 'from' => FlowWallet::tableName() . ' AS FW',
- 'join' => [
- ['LEFT JOIN', User::tableName() . ' AS U', 'FW.USER_ID=U.ID'],
- ],
- '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);
- // }
- }
- /**
- * 要展示和导出的所有字段
- * @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' => '结算月',
- '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']
- ],
- ],
- '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' => false, 'name' => '会员编号'],
- 'REAL_NAME' => ['isUserTable' => false, 'name' => '会员姓名'],
- 'LAST_DEC_LV_NAME' => ['isUserTable' => false, 'name' => '会员级别', 'other' => 'decLevel'],
- 'LAST_EMP_LV_NAME' => ['isUserTable' => false, 'name' => '聘级', 'other' => 'empLevel'],
- 'IS_DEC' => ['isUserTable' => false, 'name' => '是否报单中心', 'other' => 'yesOrNo'],
- 'AMOUNT' => ['isUserTable' => false, 'name' => '交易额'],
- 'TOTAL' => ['isUserTable' => false, 'name' => '交易后余额'],
- 'ADMIN_NAME' => ['isUserTable' => false, 'name' => '操作人'],
- 'REMARK' => ['isUserTable' => false, 'name' => '备注'],
- ];
- }
- return $this->filterTypes;
- }
- }
|