diff --git a/app/common/dao/store/DepositDao.php b/app/common/dao/store/DepositDao.php new file mode 100644 index 0000000..f9c08fa --- /dev/null +++ b/app/common/dao/store/DepositDao.php @@ -0,0 +1,25 @@ +<?php +// +---------------------------------------------------------------------- +// | CRMEB [ CRMEB赋能开发者,助力企业发展 ] +// +---------------------------------------------------------------------- +// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. +// +---------------------------------------------------------------------- +// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 +// +---------------------------------------------------------------------- +// | Author: CRMEB Team <admin@crmeb.com> +// +---------------------------------------------------------------------- +namespace app\common\dao\store; + +use app\common\dao\BaseDao; +use app\common\model\store\Deposit; + +class DepositDao extends BaseDao +{ + + + protected function getModel(): string + { + return Deposit::class; + } + +} diff --git a/app/common/dao/store/LotteryDao.php b/app/common/dao/store/LotteryDao.php new file mode 100644 index 0000000..762ff1b --- /dev/null +++ b/app/common/dao/store/LotteryDao.php @@ -0,0 +1,25 @@ +<?php +// +---------------------------------------------------------------------- +// | CRMEB [ CRMEB赋能开发者,助力企业发展 ] +// +---------------------------------------------------------------------- +// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. +// +---------------------------------------------------------------------- +// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 +// +---------------------------------------------------------------------- +// | Author: CRMEB Team <admin@crmeb.com> +// +---------------------------------------------------------------------- +namespace app\common\dao\store; + +use app\common\dao\BaseDao; +use app\common\model\store\Lottery; + +class LotteryDao extends BaseDao +{ + + + protected function getModel(): string + { + return Lottery::class; + } + +} diff --git a/app/common/model/store/Deposit.php b/app/common/model/store/Deposit.php new file mode 100644 index 0000000..d768d09 --- /dev/null +++ b/app/common/model/store/Deposit.php @@ -0,0 +1,30 @@ +<?php +// +---------------------------------------------------------------------- +// | CRMEB [ CRMEB赋能开发者,助力企业发展 ] +// +---------------------------------------------------------------------- +// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. +// +---------------------------------------------------------------------- +// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 +// +---------------------------------------------------------------------- +// | Author: CRMEB Team <admin@crmeb.com> +// +---------------------------------------------------------------------- +namespace app\common\model\store; + +use app\common\model\BaseModel; + + +class Deposit extends BaseModel +{ + + public static function tablePk(): string + { + return 'id'; + } + + public static function tableName(): string + { + return 'deposit'; + } + + +} diff --git a/app/common/model/store/Lottery.php b/app/common/model/store/Lottery.php new file mode 100644 index 0000000..1a576d6 --- /dev/null +++ b/app/common/model/store/Lottery.php @@ -0,0 +1,30 @@ +<?php +// +---------------------------------------------------------------------- +// | CRMEB [ CRMEB赋能开发者,助力企业发展 ] +// +---------------------------------------------------------------------- +// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. +// +---------------------------------------------------------------------- +// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 +// +---------------------------------------------------------------------- +// | Author: CRMEB Team <admin@crmeb.com> +// +---------------------------------------------------------------------- +namespace app\common\model\store; + +use app\common\model\BaseModel; + + +class Lottery extends BaseModel +{ + + public static function tablePk(): string + { + return 'id'; + } + + public static function tableName(): string + { + return 'lottery'; + } + + +} diff --git a/app/common/repositories/store/DepositRepository.php b/app/common/repositories/store/DepositRepository.php new file mode 100644 index 0000000..736bbf4 --- /dev/null +++ b/app/common/repositories/store/DepositRepository.php @@ -0,0 +1,109 @@ +<?php +// +---------------------------------------------------------------------- +// | CRMEB [ CRMEB赋能开发者,助力企业发展 ] +// +---------------------------------------------------------------------- +// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. +// +---------------------------------------------------------------------- +// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 +// +---------------------------------------------------------------------- +// | Author: CRMEB Team <admin@crmeb.com> +// +---------------------------------------------------------------------- +namespace app\common\repositories\store; + +use app\common\dao\store\DepositDao; +use app\common\dao\store\GuaranteeDao; +use app\common\repositories\BaseRepository; +use app\common\repositories\store\product\ProductRepository; +use FormBuilder\Factory\Elm; +use think\facade\Route; + +class DepositRepository extends BaseRepository +{ + /** + * @var GuaranteeDao + */ + protected $dao; + + + /** + * GuaranteeRepository constructor. + * @param DepositDao $dao + */ + public function __construct(DepositDao $dao) + { + $this->dao = $dao; + } + + /** + * TODO 平台列表 + * @param $where + * @param $page + * @param $limit + * @return array + * @author Qinii + * @day 5/17/21 + */ + public function getList($where,$page, $limit) + { + $query = $this->dao->getSearch($where)->order('id DESC'); + $count = $query->count(); + $list = $query->page($page,$limit)->select(); + return compact('count','list'); + } + + public function select(array $where) + { + $list = $this->dao->getSearch($where)->field('guarantee_id,guarantee_name,guarantee_info,image')->order('sort DESC')->select(); + return $list; + } + /** + * TODO 添加form + * @param int|null $id + * @param array $formData + * @return \FormBuilder\Form + * @author Qinii + * @day 5/17/21 + */ + public function form($id = null,array $formData = []) + { + $isCreate = is_null($id); + $action = Route::buildUrl($isCreate ? 'systemDepositCreate' : 'systemDepositUpdate', $isCreate ? [] : compact('id'))->build(); + return Elm::createForm($action, [ + Elm::number('money', '预存金额:')->placeholder('请输入等级名称')->min(0)->required(), + Elm::number('cycle', '周期:')->placeholder('请输入周期')->min(0)->required(), + Elm::number('diamond', '赠送钻石/天:')->placeholder('请输入赠送钻石数')->min(0)->required(), + Elm::number('diamond_max', '赠送最大钻石:')->placeholder('请输入赠送最大钻石数')->min(0)->required(), + Elm::number('count', '名额:')->placeholder('请输入名额')->min(0)->required(), + ])->setTitle($isCreate ? '添加预存' : '编辑预存')->formData($formData); + } + + /** + * TODO 编辑form + * @param $id + * @return \FormBuilder\Form + * @author Qinii + * @day 5/17/21 + */ + public function updateForm($id) + { + $ret = $this->dao->get($id); + return $this->form($id,$ret->toArray()); + } + + /** + * TODO 获取详情 + * @param $id + * @return array|\think\Model|null + * @author Qinii + * @day 5/17/21 + */ + public function get($id) + { + $where = [ + $this->dao->getPk() => $id, + 'is_del' => 0, + ]; + $ret = $this->dao->getWhere($where); + return $ret; + } +} diff --git a/app/common/repositories/store/LotteryRepository.php b/app/common/repositories/store/LotteryRepository.php new file mode 100644 index 0000000..2ba8254 --- /dev/null +++ b/app/common/repositories/store/LotteryRepository.php @@ -0,0 +1,74 @@ +<?php +// +---------------------------------------------------------------------- +// | CRMEB [ CRMEB赋能开发者,助力企业发展 ] +// +---------------------------------------------------------------------- +// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. +// +---------------------------------------------------------------------- +// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 +// +---------------------------------------------------------------------- +// | Author: CRMEB Team <admin@crmeb.com> +// +---------------------------------------------------------------------- +namespace app\common\repositories\store; + +use app\common\dao\store\GuaranteeDao; +use app\common\dao\store\LotteryDao; +use app\common\repositories\BaseRepository; + +class LotteryRepository extends BaseRepository +{ + /** + * @var GuaranteeDao + */ + protected $dao; + + + /** + * GuaranteeRepository constructor. + * @param LotteryDao $dao + */ + public function __construct(LotteryDao $dao) + { + $this->dao = $dao; + } + + /** + * TODO 平台列表 + * @param $where + * @param $page + * @param $limit + * @return array + * @author Qinii + * @day 5/17/21 + */ + public function getList($where,$page, $limit) + { + $query = $this->dao->getSearch($where)->order('sort DESC'); + $count = $query->count(); + $list = $query->page($page,$limit)->select(); + return compact('count','list'); + } + + public function select(array $where) + { + $list = $this->dao->getSearch($where)->field('guarantee_id,guarantee_name,guarantee_info,image')->order('sort DESC')->select(); + return $list; + } + + + /** + * TODO 获取详情 + * @param $id + * @return array|\think\Model|null + * @author Qinii + * @day 5/17/21 + */ + public function get($id) + { + $where = [ + $this->dao->getPk() => $id, + 'is_del' => 0, + ]; + $ret = $this->dao->getWhere($where); + return $ret; + } +} diff --git a/app/controller/admin/system/Deposit.php b/app/controller/admin/system/Deposit.php new file mode 100644 index 0000000..7891685 --- /dev/null +++ b/app/controller/admin/system/Deposit.php @@ -0,0 +1,152 @@ +<?php + +// +---------------------------------------------------------------------- +// | CRMEB [ CRMEB赋能开发者,助力企业发展 ] +// +---------------------------------------------------------------------- +// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. +// +---------------------------------------------------------------------- +// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 +// +---------------------------------------------------------------------- +// | Author: CRMEB Team <admin@crmeb.com> +// +---------------------------------------------------------------------- + + +namespace app\controller\admin\system; + + +use app\common\repositories\store\DepositRepository; +use app\validate\admin\DepositValidate; +use crmeb\basic\BaseController; +use FormBuilder\Exception\FormBuilderException; +use think\App; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; + +/** + * Class UserGroup + * @package app\controller\admin\user + * @author xaboy + * @day 2020-05-07 + */ +class Deposit extends BaseController +{ + /** + * @var DepositRepository + */ + protected $repository; + + /** + * UserGroup constructor. + * @param App $app + * @param DepositRepository $repository + */ + public function __construct(App $app, DepositRepository $repository) + { + parent::__construct($app); + $this->repository = $repository; + } + + /** + * @return mixed + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException + * @author xaboy + * @day 2020-05-07 + */ + public function lst() + { + [$page, $limit] = $this->getPage(); + return app('json')->success($this->repository->getList(['status' => 1], $page, $limit)); + } + + /** + * @return mixed + * @throws FormBuilderException + * @author xaboy + * @day 2020-05-07 + */ + public function createForm() + { + return app('json')->success(formToData($this->repository->form())); + } + + /** + * @param DepositValidate $validate + * @return mixed + * @author xaboy + * @day 2020-05-07 + */ + public function create(DepositValidate $validate) + { + $data = $this->checkParams($validate); + $this->repository->create($data); + + return app('json')->success('添加成功'); + } + + /** + * @param $id + * @return mixed + * @throws DbException + * @throws FormBuilderException + * @throws DataNotFoundException + * @throws ModelNotFoundException + * @author xaboy + * @day 2020-05-07 + */ + public function updateForm($id) + { + if (!$this->repository->exists($id)) + return app('json')->fail('数据不存在'); + return app('json')->success(formToData($this->repository->updateForm($id))); + } + + /** + * @param $id + * @param DepositValidate $validate + * @return mixed + * @throws DbException + * @author xaboy + * @day 2020-05-07 + */ + public function update($id, DepositValidate $validate) + { + $data = $this->checkParams($validate); + if (!$this->repository->exists($id)) + return app('json')->fail('数据不存在'); + $this->repository->update($id, $data); + + return app('json')->success('编辑成功'); + } + + /** + * @param $id + * @return mixed + * @throws DbException + * @author xaboy + * @day 2020-05-07 + */ + public function delete($id) + { + if (!$this->repository->exists($id)) + return app('json')->fail('数据不存在'); + $this->repository->update($id, array('status' => 0)); + + return app('json')->success('删除成功'); + } + + /** + * @param DepositValidate $validate + * @return array + * @author xaboy + * @day 2020-05-07 + */ + protected function checkParams(DepositValidate $validate) + { + $data = $this->request->params(['count','cycle', 'diamond', 'diamond_max', 'money']); + $validate->check($data); + return $data; + } +} diff --git a/app/controller/admin/system/Lottery.php b/app/controller/admin/system/Lottery.php new file mode 100644 index 0000000..8f536bc --- /dev/null +++ b/app/controller/admin/system/Lottery.php @@ -0,0 +1,106 @@ +<?php +// +---------------------------------------------------------------------- +// | CRMEB [ CRMEB赋能开发者,助力企业发展 ] +// +---------------------------------------------------------------------- +// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. +// +---------------------------------------------------------------------- +// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 +// +---------------------------------------------------------------------- +// | Author: CRMEB Team <admin@crmeb.com> +// +---------------------------------------------------------------------- +namespace app\controller\admin\system; + +use app\common\repositories\system\CacheRepository; +use app\common\repositories\system\config\ConfigValueRepository; +use crmeb\basic\BaseController; +use crmeb\services\RedisCacheService; +use think\App; +use think\facade\Cache as BaseCache; + +class Lottery extends BaseController +{ + /** + * @var CacheRepository + */ + protected $repository; + + /** + * CacheRepository constructor. + * @param App $app + */ + public function __construct(App $app, CacheRepository $repository) + { + parent::__construct($app); + $this->repository = $repository; + } + + + public function getKeyLst() + { + $type = $this->request->param('type', 0); + $data = $this->repository->getAgreeList($type); + return app('json')->success($data); + } + + + /** + * @Author:Qinii + * @Date: 2020/9/15 + * @return mixed + */ + public function getAgree($key) + { + $allow = $this->repository->getAgreeKey(); + if (!in_array($key, $allow)) return app('json')->fail('数据不存在'); + $data = $this->repository->getResult($key); + return app('json')->success($data); + } + + + /** + * @Author:Qinii + * @Date: 2020/9/15 + * @return mixed + */ + public function saveAgree($key) + { + $allow = $this->repository->getAgreeKey(); + if (!in_array($key, $allow)) return app('json')->fail('KEY不存在'); + + $value = $this->request->param('agree'); + $this->repository->save($key, $value); + + if ($key == CacheRepository::USER_PRIVACY) + $this->repository->setUserAgreement($value); + if ($key == CacheRepository::USER_AGREE) + $this->repository->setUserRegister($value); + + return app('json')->success('保存成功'); + } + + /** + * TODO 清除缓存 + * @return \think\response\Json + * @author Qinii + * @day 12/9/21 + */ + public function clearCache() + { + $type = $this->request->param('type', 1); + switch ($type) { + case 2: + BaseCache::tag('get_product')->clear(); + break; + case 3: + BaseCache::delete('get_api_config'); + break; + default: + BaseCache::clear(); + break; + } + $configValueRepository = app()->make(ConfigValueRepository::class); + $configValueRepository->syncConfig(); + $configValueRepository->special(); + return app('json')->success('清除缓存成功'); + } +} diff --git a/app/validate/admin/DepositValidate.php b/app/validate/admin/DepositValidate.php new file mode 100644 index 0000000..9ae1155 --- /dev/null +++ b/app/validate/admin/DepositValidate.php @@ -0,0 +1,30 @@ +<?php + +// +---------------------------------------------------------------------- +// | CRMEB [ CRMEB赋能开发者,助力企业发展 ] +// +---------------------------------------------------------------------- +// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. +// +---------------------------------------------------------------------- +// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 +// +---------------------------------------------------------------------- +// | Author: CRMEB Team <admin@crmeb.com> +// +---------------------------------------------------------------------- + + +namespace app\validate\admin; + + +use think\Validate; + +class DepositValidate extends Validate +{ + protected $failException = true; + + protected $rule = [ + 'money|金额' => 'require', + 'cycle|周期' => 'require', + 'diamond|分组名称' => 'require', + 'diamond_max|分组名称' => 'require', + 'count|名额' => 'require', + ]; +} diff --git a/route/admin/system.php b/route/admin/system.php index 25697eb..ce23325 100755 --- a/route/admin/system.php +++ b/route/admin/system.php @@ -33,6 +33,34 @@ Route::group(function () { '_auth' => false, ]); + Route::group('deposit', function () { + Route::get('lst', '/lst')->name('systemDepositLst')->option([ + '_alias' => '预存管理', + ]); + Route::post('create/deposit', '/create')->name('systemDepositCreate')->option([ + '_alias' => '预存添加', + ]); + Route::get('form', '/createForm')->name('systemDepositCreateForm')->option([ + '_alias' => '预存添加表单', + '_auth' => false, + '_form' => 'systemDepositCreate', + ]); + Route::delete(':id', '/delete')->name('systemDepositDelete')->option([ + '_alias' => '预存删除', + ]); + Route::post(':id', '/update')->name('systemDepositUpdate')->option([ + '_alias' => '预存编辑', + ]); + Route::get('form/:id', '/updateForm')->name('systemDepositUpdateForm')->option([ + '_alias' => '预存编辑表单', + '_auth' => false, + '_form' => 'systemDepositUpdate', + ]); + })->prefix('admin.system.Deposit')->option([ + '_path' => '/dashboard', + '_auth' => true, + ]); + Route::group('statistics', function () { diff --git a/view/admin/src/api/user.js b/view/admin/src/api/user.js index 9f57cab..f75cde2 100644 --- a/view/admin/src/api/user.js +++ b/view/admin/src/api/user.js @@ -87,6 +87,32 @@ export function groupLstApi(data) { export function groupDeleteApi(id) { return request.delete(`user/group/${id}`) } + +/** + * @description 预存管理 -- 编辑表单 + * @param {Object} param params {Object} 传值参数 + */ +export function depositEditApi(id) { + return request.get('deposit/form/' + id) +} +/** + * @description 预存管理 -- 添加表单 + */ +export function depositFormApi() { + return request.get('deposit/form') +} +/** + * @description 预存管理 -- 列表 + */ +export function depositLstApi(data) { + return request.get('deposit/lst', data) +} +/** + * @description 预存管理 -- 删除 + */ +export function depositDeleteApi(id) { + return request.delete(`deposit/${id}`) +} /** * @description 用户标签 -- 编辑表单 * @param {Object} param params {Object} 传值参数 @@ -337,7 +363,7 @@ export function recordListImportApi(data) { } /** * 获取版权信息 - * @returns + * @returns */ export function getVersion() { return request.get('../api/version') @@ -474,4 +500,16 @@ export function memberRecordCard(data) { */ export function memberGrowthLog(data) { return request.get(`user/member_log`, data) -} \ No newline at end of file +} + +/** + * @description 资产明细 -- 列表数据 + */ +export function assetsLogList(data) { + return request.get(`user/assets_list`,data) +} + +// 惠通宝转让记录 +export function getHuitongbao(data) { + return request.get('user/huitong_list', data) +} diff --git a/view/admin/src/router/modules/user.js b/view/admin/src/router/modules/user.js index 278e3f4..43f40e6 100644 --- a/view/admin/src/router/modules/user.js +++ b/view/admin/src/router/modules/user.js @@ -25,6 +25,24 @@ const userRouter = name: 'UserGroup', meta: { title: '用户分组', noCache: true } }, + { + path: 'assets', + component: () => import('@/views/user/assets'), + name: 'assets', + meta: { title: '转让记录', noCache: true } + }, + { + path: 'stock', + component: () => import('@/views/user/stock'), + name: 'stock', + meta: { title: '本票统计', noCache: true } + }, + { + path: 'deposit', + component: () => import('@/views/user/deposit'), + name: 'deposit', + meta: { title: '预存管理', noCache: true } + }, { path: 'label', component: () => import('@/views/user/group'), @@ -105,7 +123,6 @@ const userRouter = component: () => import('@/views/user/member/equity') }, { - path: 'description', name: 'memberDescription', meta: { title: '用户等级说明', @@ -115,7 +132,6 @@ const userRouter = component: () => import('@/views/user/member/description') }, { - path: 'vipAgreement', name: 'vipAgreement', meta: { title: '会员协议', @@ -142,7 +158,7 @@ const userRouter = }, component: () => import('@/views/user/member/record') }, - + ] }, ] diff --git a/view/admin/src/views/user/assets/index.vue b/view/admin/src/views/user/assets/index.vue new file mode 100644 index 0000000..28c6669 --- /dev/null +++ b/view/admin/src/views/user/assets/index.vue @@ -0,0 +1,323 @@ +<template> + <div class="divBox"> + <el-card class="box-card"> + <div slot="header" class="clearfix"> + <div class="container"> + <el-form size="small" inline label-width="100px"> + <el-form-item label="昵称:"> + <el-input + style="width: 200px" + placeholder="请输入昵称" + v-model="tableFrom.nickname" + /> + </el-form-item> + <el-form-item label="手机号:"> + <el-input + style="width: 200px" + placeholder="请输入手机号" + v-model="tableFrom.phone" + /> + </el-form-item> + <el-form-item label="货币类型:" clearable> + <el-select + v-model="tableFrom.asset_type" + placeholder="请选择货币类型" + clearable + > + <el-option value="1" label="消费积分">消费积分</el-option> + <el-option value="2" label="分红点">分红点</el-option> + <el-option value="3" label="福利积分">福利积分</el-option> + <el-option value="4" label="惠通宝">惠通宝</el-option> + <el-option value="5" label="贡献值">贡献值</el-option> + </el-select> + </el-form-item> + + <el-form-item label="分值来源:"> + <el-select + placeholder="请选择" + v-model="tableFrom.type" + clearable + > + <el-option value="1" label="个人下单">个人下单</el-option> + <el-option value="2" label="签到">签到</el-option> + <el-option value="3" label="消费积分兑换分红点">消费积分兑换分红点</el-option> + <el-option value="4" label="分红点返佣">分红点返佣</el-option> + <el-option value="5" label="推广返佣">推广返佣</el-option> + <el-option value="6" label="培育奖">培育奖</el-option> + <el-option value="7" label="区域代理奖">区域代理奖</el-option> + <el-option value="8" label="惠通宝兑换消费积分">惠通宝兑换消费积分</el-option> + <el-option value="9" label="转让他人">转让他人</el-option> + <el-option value="10" label="他人转让">他人转让</el-option> + </el-select> + </el-form-item> + + <el-form-item label="时间选择:" class="width100"> + <el-date-picker + v-model="timeVal" + value-format="yyyy/MM/dd" + format="yyyy/MM/dd" + size="small" + type="daterange" + placement="bottom-end" + placeholder="自定义时间" + style="width: 250px;" + @change="onchangeTime" + /> + </el-form-item> + <el-button size="small" type="primary" icon="el-icon-search" @click="getList()">搜索</el-button> + <el-button size="small" type="primary" @click="exportTableToExcel('table', 'exported-data')">导出</el-button> + </el-form> + </div> + </div> + <el-table v-loading="loading" :data="tableData.data" style="width: 100%" size="small" id="table"> + <el-table-column label="ID" prop="id" min-width="80"/> + <el-table-column label="用户昵称" prop="user_nickname" min-width="120"/> + <el-table-column label="手机" prop="user_phone" min-width="120"/> + <el-table-column label="货币类型" prop="asset_type" min-width="120"/> + <el-table-column label="分值来源" prop="type" min-width="120"/> + <el-table-column label="变动情况" prop="count" min-width="120"/> + <el-table-column label="变动时间" prop="create_time" min-width="120" /> + + </el-table> + <div class="block"> + <el-pagination + :page-sizes="[20, 40, 60, 80]" + :page-size="tableFrom.limit" + :current-page="tableFrom.page" + layout="total, sizes, prev, pager, next, jumper" + :total="tableData.total" + @size-change="handleSizeChange" + @current-change="pageChange" + /> + </div> + </el-card> + </div> +</template> + +<script> +import { mapState } from "vuex"; +import {discountsList, discountsChangeStatus, discountsGetDetails, assetsLogList} from "@/api/marketing"; +import { formatDate } from "@/utils/validate"; +import { roterPre } from '@/settings' + +import { saveAs } from 'file-saver'; +import * as XLSX from 'xlsx'; +export default { + name: "Discounts", + filters: { + formatDate(time) { + if (time !== 0) { + let date = new Date(time * 1000); + return formatDate(date, "yyyy-MM-dd hh:mm"); + } + }, + }, + data() { + return { + loading: false, + dialogLoading: false, + roterPre: roterPre, + dialogVisible: false, + tableData: { + data: [], + total: 0, + }, + tableFrom: { + type: "", + nickname: "", + phone: "", + page: 1, + asset_type: "", + limit: 20, + }, + specsMainData: [], + specsData: [], + timeVal: [], + formValidate: { + title: "", //套餐名称 + type: 0, //套餐类型 + image: "", //套餐主图 + is_time: 0, //是否限时 + is_limit: 0, //限量1/不限量0 + limit_num: 0, //限量 + link_ids: [], //参与用户标签 + time: [], //套餐时间 + sort: 0, //排序 + free_shipping: 1, //是否包邮 + status: 1, + products: [], + }, + }; + }, + computed: { + }, + created() { + this.getList(''); + }, + methods: { + exportTableToExcel(tableId, fileName) { + /* 获取表格数据 */ + const ws = XLSX.utils.table_to_sheet(document.getElementById(tableId)); + + /* 新建工作簿并添加工作表 */ + const wb = XLSX.utils.book_new(); + XLSX.utils.book_append_sheet(wb, ws, "Sheet1"); + + /* 生成Excel文件 */ + const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'binary' }); + + /* 字符串转ArrayBuffer */ + function s2ab(s) { + const buf = new ArrayBuffer(s.length); + const view = new Uint8Array(buf); + for (let i = 0; i !== s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF; + return buf; + } + + /* 保存文件 */ + saveAs(new Blob([s2ab(wbout)], { type: 'application/octet-stream' }), fileName + '.xlsx'); + }, + // 查看 + handleDetail(id) { + this.dialogVisible = true; + this.dialogLoading = true; + discountsGetDetails(id).then((res) => { + this.formValidate = res.data; + this.formValidate.time = res.data.time || []; + this.dialogLoading = false; + for (let i = 0; i < res.data.discountsProduct.length; i++) { + const element = res.data.discountsProduct[i]; + element.attr= []; + const attrArr = element['product'] && element['product']['attrValue'] || []; + for (let j = 0; j < attrArr.length; j++) { + const attr = attrArr[j]; + if (attr.productSku) { + element.attr.push(attr) + } + } + if (element.type == 1) { + this.specsMainData.push(element); + } else { + this.specsData.push(element); + } + } + }); + }, + + // 列表 + getList(num) { + this.loading = true; + this.tableFrom.page = num ? num : this.tableFrom.page; + assetsLogList(this.tableFrom) + .then(async (res) => { + this.tableData.data = res.data.list; + this.tableData.total = res.data.count; + this.loading = false; + }) + .catch((res) => { + this.loading = false; + this.$message.error(res.message); + }); + }, + pageChange(page) { + this.tableFrom.page = page; + this.getList(''); + }, + handleSizeChange(val) { + this.tableFrom.limit = val; + this.getList(''); + }, + + // 具体日期 + onchangeTime(e) { + this.timeVal = e; + this.tableFrom.date = this.timeVal ? this.timeVal.join("-") : ""; + }, + + // 修改是否显示 + onchangeIsShow(row) { + discountsChangeStatus(row.discount_id,row.status) + .then(async (res) => { + this.$message.success(res.message); + this.getList(''); + }) + .catch((res) => { + this.$message.error(res.message); + this.getList(''); + }); + }, + }, +}; +</script> + +<style scoped lang="scss"> +.tabBox_img { + width: 36px; + height: 36px; + border-radius: 4px; + cursor: pointer; + + img { + width: 100%; + height: 100%; + } +} +.box-container { + overflow: hidden; +} +.box-container .list { + float: left; + line-height: 40px; + +} +.box-container .sp { + width: 50%; + //white-space: nowrap; + //overflow: hidden; + //text-overflow: ellipsis; +} +.box-container .sp3 { + width: 33.3333%; +} +.box-container .sp100 { + width: 100%; +} +.box-container .list .name { + display: inline-block; + color: #606266; +} +.box-container .list .blue { + color: #1890ff; +} +.box-container .list.image { + margin: 20px 0; + position: relative; +} +.box-container .list.image img { + position: absolute; + top: -20px; +} +.labeltop{ + max-height: 280px; + min-height: 120px; + overflow-y: auto; +} +.title{ + margin-bottom: 16px; + color: #17233d; + font-size: 14px; + font-weight: bold; + padding-bottom: 2px; + border-bottom: 1px solid #dfe6ec; +} +.product-data { + display: flex; + align-items: center; + + .image { + width: 50px !important; + height: 50px !important; + margin-right: 10px; + } +} +</style> diff --git a/view/admin/src/views/user/deposit/index.vue b/view/admin/src/views/user/deposit/index.vue new file mode 100644 index 0000000..e3da8d1 --- /dev/null +++ b/view/admin/src/views/user/deposit/index.vue @@ -0,0 +1,166 @@ +<template> + <div class="divBox"> + <el-card> + <div class="mb20"> + <el-button size="small" type="primary" @click="onAdd">{{ '添加预存'}}</el-button> + </div> + <el-table + v-loading="listLoading" + :data="tableData.data" + size="small" + highlight-current-row + > + <el-table-column + label="ID" + min-width="60" + > + <template slot-scope="{row}"> + <span v-text="row.id" /> + </template> + </el-table-column> + <el-table-column + :label="'预存金额'" + min-width="180" + > + <template slot-scope="{row}"> + <span v-text="row.money" /> + </template> + </el-table-column> + <el-table-column + prop="cycle" + label="提现周期" + min-width="150" + /> + <el-table-column + prop="count" + label="名额" + min-width="150" + /> + <el-table-column + prop="diamond" + label="赠送钻石/天" + min-width="150" + /> + <el-table-column + prop="diamond_max" + label="钻石最大值" + min-width="150" + /> + <el-table-column + prop="create_time" + label="创建时间" + min-width="150" + /> + <el-table-column label="操作" min-width="90" fixed="right"> + <template slot-scope="scope"> + <el-button type="text" size="small" @click="onEdit(scope.row.id)">编辑</el-button> + <el-button type="text" size="small" @click="handleDelete(scope.row.id, scope.$index)">删除</el-button> + </template> + </el-table-column> + </el-table> + <div class="block"> + <el-pagination + background + :page-size="tableFrom.limit" + :current-page="tableFrom.page" + layout="total, prev, pager, next, jumper" + :total="tableData.total" + @size-change="handleSizeChange" + @current-change="pageChange" + /> + </div> + </el-card> + </div> +</template> + +<script> +// +---------------------------------------------------------------------- +// | CRMEB [ CRMEB赋能开发者,助力企业发展 ] +// +---------------------------------------------------------------------- +// | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved. +// +---------------------------------------------------------------------- +// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 +// +---------------------------------------------------------------------- +// | Author: CRMEB Team <admin@crmeb.com> +// +---------------------------------------------------------------------- +import { + depositLstApi, + depositFormApi, + depositEditApi, + depositDeleteApi, +} from '@/api/user' +export default { + name: 'UserGroup', + data() { + return { + tableFrom: { + page: 1, + limit: 20 + }, + tableData: { + data: [], + total: 0 + }, + listLoading: true + } + }, + mounted() { + this.getList() + }, + watch:{ + '$route.path': { + handler: function() { + this.getList() + }, + immediate: false, + deep: true + }, + }, + methods: { + // 列表 + getList() { + this.listLoading = true + depositLstApi(this.tableFrom).then(res => { + this.tableData.data = res.data.list + this.tableData.total = res.data.count + this.listLoading = false + }).catch(res => { + this.listLoading = false + this.$message.error(res.message) + }) + }, + pageChange(page) { + this.tableFrom.page = page + this.getList() + }, + handleSizeChange(val) { + this.tableFrom.limit = val + this.getList() + }, + // 添加 + onAdd() { + this.$modalForm(depositFormApi()).then(() => this.getList()) + }, + // 编辑 + onEdit(id) { + this.$modalForm(depositEditApi(id)).then(() => this.getList()) + }, + // 删除 + handleDelete(id, idx) { + this.$modalSure('删除').then(() => { + depositDeleteApi(id).then(({ message }) => { + this.$message.success(message) + this.tableData.data.splice(idx, 1) + this.getList() + }).catch(({ message }) => { + this.$message.error(message) + }) + }) + } + } +} +</script> + +<style scoped lang="scss"> + +</style> diff --git a/view/admin/src/views/user/stock/index.vue b/view/admin/src/views/user/stock/index.vue new file mode 100644 index 0000000..7511650 --- /dev/null +++ b/view/admin/src/views/user/stock/index.vue @@ -0,0 +1,112 @@ +<template> + <div class="divBox"> + <el-card class="box-card"> + <div class="search"> + <div class="input"> + <span>赠送方手机号</span> + <el-input v-model="account"></el-input> + </div> + <el-button size="small" style="margin-left:20px;" type="primary">查询</el-button> + <el-button size="small" type="info">重置</el-button> + </div> + <div class="info">惠通宝当前市值:{{huitong}}</div> + <el-table :data="tableData" style="width: 100%;"> + <el-table-column prop="user_phone" label="转让账户"></el-table-column> + <el-table-column prop="to_phone" label="收款账户"></el-table-column> + <el-table-column prop="count" label="转让数量"></el-table-column> + <el-table-column prop="create_time" label="转让时间"></el-table-column> + + </el-table> + <div style="text-align: right;"> + <el-pagination + @size-change="handleSizeChange" + @current-change="handleCurrentChange" + :current-page="pageIndex" + :page-sizes="[10, 20, 50, 100]" + :page-size="pageSize" + layout="total, sizes, prev, pager, next, jumper" + :total="total"> + </el-pagination> + </div> + </el-card> + + </div> + </template> + + <script> + import {getHuitongbao} from '@/api/user' + // +---------------------------------------------------------------------- + // | CRMEB [ CRMEB赋能开发者,助力企业发展 ] + // +---------------------------------------------------------------------- + // | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved. + // +---------------------------------------------------------------------- + // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 + // +---------------------------------------------------------------------- + // | Author: CRMEB Team <admin@crmeb.com> + // +---------------------------------------------------------------------- + import { + + } from '@/api/user' + + + export default { + + data() { + return { + account:'', + tableData:[], + pageIndex:1, + pageSize:10, + total:0, + huitong:0, + } + }, + mounted() { + this.getHuitongbaoHandle() + }, + methods: { + handleCurrentChange(val){ + this.pageIndex = val; + this.getHuitongbaoHandle() + }, + handleSizeChange(val){ + this.pageSize = val; + this.getHuitongbaoHandle() + }, + getHuitongbaoHandle(){ + let params = { + page:this.pageIndex, + limit:this.pageSize, + phone:this.account + } + getHuitongbao(params).then(res=>{ + console.log(res,"99") + this.tableData = res.data.list; + this.total = res.data.count; + this.huitong = res.data.huitong + }) + } + } + } + </script> + + <style lang="scss" scoped> + .search{ + display: flex; + align-items: center; + .input{ + display: flex; + align-items: center; + span{ + display:inline-block; + width:200px; + } + } + } + .info{ + font-size: 18px; + font-weight: bold; + margin:10px 0; + + } + </style>