listData = HistoryBonus::lists($this->condition, $this->params, [ 'orderBy' => 'BACKUP_AT DESC, ID DESC', 'from' => HistoryBonus::tableName(), 'page' => $this->page, 'pageSize' => $this->pageSize, ]); $auditStatus = array_column(\Yii::$app->params['userStatus'], null, 'value'); foreach ($this->listData['list'] as $key => $value) { $this->listData['list'][$key]['USER_STATUS_NAME'] = $auditStatus[$value['USER_STATUS']]['label']; $this->listData['list'][$key]['DEC_LV_NAME'] = Cache::getDecLevelConfig()[$value['DEC_LV']]['LEVEL_NAME'] ?? ''; $this->listData['list'][$key]['EMP_LV_NAME'] = Cache::getEmpLevelConfig()[$value['EMP_LV']]['LEVEL_NAME'] ?? ''; $this->listData['list'][$key]['DEC_ROLE_NAME'] = DecRole::getRoleNameId($value['DEC_ROLE_ID']); $this->listData['list'][$key]['HIGHEST_EMP_LV_NAME'] = Cache::getEmpLevelConfig()[$value['HIGHEST_EMP_LV']]['LEVEL_NAME'] ?? ''; $this->listData['list'][$key]['DEC_DEC_ROLE_NAME'] = DecRole::getRoleNameId($value['DEC_DEC_ROLE_ID']); $this->listData['list'][$key]['PROVINCE_NAME'] = $value['PROVINCE'] ? Region::getCnName($value['PROVINCE']) : ''; $this->listData['list'][$key]['CITY_NAME'] = $value['CITY'] ? Region::getCnName($value['CITY']) : ''; $this->listData['list'][$key]['COUNTY_NAME'] = $value['COUNTY'] ? Region::getCnName($value['COUNTY']) : ''; $this->listData['list'][$key]['SUB_COM_NAME'] = ''; } } /** * 要展示和导出的所有字段 * @return array */ public function getColumn() { if (!$this->columns) { $this->columns = [ 'ID' => null, // 这种传输方式主要是用于索引,因为过滤后的字段可能没有这种ID,但是一些功能的操作还需要用这种ID去关联,例如前台会员列表中的勾选批量状态管理,这里需要的就是USER_ID 'USER_NAME' => [ 'header' => 'Member Code', // 会员编号 'headerOther' => ['width' => '150'], ], 'REAL_NAME' => [ 'header' => 'Member Name', // 会员姓名 'headerOther' => [ 'width' => '120', ], ], 'DEC_LV_NAME' => [ 'header' => 'Member Level', // 会员级别 'headerOther' => [ 'width' => '150', ], ], 'EMP_LV_NAME' => [ 'header' => 'Rank', // 聘级 'headerOther' => [ 'width' => '150', ], ], 'IS_DEC' => [ 'header' => 'Whether Distributor', // 是否报单中心 'value' => function ($row) { return (new YesNo([ 'value' => $row['IS_DEC'], ]))->result(); }, 'headerOther' => function ($row) { return [ 'width' => '150', ]; }, 'valueOther' => function ($row) { return [ 'tag' => ['type' => (isset($row['IS_DEC']) && $row['IS_DEC']) ? 'success' : 'info', 'size' => 'small'] ]; }, ], 'BONUS' => [ 'header' => 'Member Bonus', // 会员账户余额 'value' => function ($row) { return Tool::formatPrice($row['BONUS']); }, 'headerOther' => function ($row) { return [ 'width' => '150', ]; }, 'valueOther' => function ($row) { return [ 'tag' => ['type' => 'danger', 'size' => 'small', 'class' => 'no-border'] ]; }, ], 'WITHDRAW' => [ 'header' => 'Withdrawal Amount', // 提现金额 'value' => function ($row) { return Tool::formatPrice($row['WITHDRAW']); }, 'headerOther' => function ($row) { return [ 'width' => '150', ]; }, 'valueOther' => function ($row) { return [ 'tag' => ['type' => 'warning', 'size' => 'small', 'class' => 'no-border'] ]; }, ], 'WITHDRAW_REAL' => [ 'header' => 'Real Amount', // 实付金额 'value' => function ($row) { return Tool::formatPrice($row['WITHDRAW_REAL']); }, 'headerOther' => function ($row) { return [ 'width' => '150', ]; }, 'valueOther' => function ($row) { return [ 'tag' => ['type' => 'warning', 'size' => 'small', 'class' => 'no-border'] ]; }, ], 'WITHDRAW_FAIL' => [ 'header' => 'Actual Payment Of Failed Amount', // 实付失败金额 'value' => function ($row) { return Tool::formatPrice($row['WITHDRAW_FAIL']); }, 'headerOther' => function ($row) { return [ 'width' => '240', ]; }, 'valueOther' => function ($row) { return [ 'tag' => ['type' => 'warning', 'size' => 'small', 'class' => 'no-border'] ]; }, ], 'USER_STATUS_NAME' => [ 'header' => 'Member Status', // 会员状态 'headerOther' => ['width' => '150'], ], 'USER_STATUS_AT' => [ 'header' => 'Member Status Change Time', // 会员状态变更时间 'value' => function ($row) { return (new DateTime([ 'value' => $row['USER_STATUS_AT'], ]))->result(); }, 'headerOther' => ['width' => '210'], ], 'PERIOD_AT' => [ 'header' => 'Join Periods', // 加入期数 'headerOther' => ['width' => '150'], ], 'DEC_USER_NAME' => [ 'header' => 'Code Of Distributor', // 所属报单中心编号 'headerOther' => ['width' => '150'], ], 'DEC_REAL_NAME' => [ 'header' => 'Name Of Distributor', // 所属报单中心姓名 'headerOther' => ['width' => '150'], ], 'MOBILE' => [ 'header' => 'Phone Number', // 手机号码 'value' => function($row) { return "\t".$row['MOBILE']; }, 'headerOther' => ['width' => '150'], ], 'TEL' => [ 'header' => 'Alternate Phone Number', // 备用手机号码 'value' => function($row) { return "\t".$row['TEL']; }, 'headerOther' => ['width' => '190'], ], 'AREA' => [ 'header' => 'Commonly Used Address', // 常用地址 'value' => function ($row) { return $row['PROVINCE_NAME'] . $row['CITY_NAME'] . $row['COUNTY_NAME']; }, 'showValue' => function ($row) { return '