添加:文创豆易出功能及审核流程
This commit is contained in:
parent
fe3575cf53
commit
9b94df5068
|
|
@ -23,41 +23,6 @@ class PluginApplication extends \app\common\services\PluginApplication{
|
|||
'left_first_show' => 0,
|
||||
'left_second_show' => 1,
|
||||
'child' => [
|
||||
/* 'plugin_cultural_space_index' => [
|
||||
'name' => '文创空间',
|
||||
'permit' => 1,
|
||||
'menu' => 1,
|
||||
'icon' => '',
|
||||
'url' => 'plugin.cultural-space.admin.index.index',
|
||||
'url_params' => '',
|
||||
'item' => 'plugin_cultural_space_index',
|
||||
'parents' => ['cultural-space'],
|
||||
'child' => [
|
||||
// 权限补充
|
||||
'plugin_cultural_space_index_index' => [
|
||||
'name' => '权重值明细',
|
||||
'url' => 'plugin.cultural-space.admin.index.index',
|
||||
'url_params' => '',
|
||||
'permit' => 1,
|
||||
'menu' => 0,
|
||||
'icon' => '',
|
||||
'item' => 'plugin_cultural_space_index_index',
|
||||
'parents' => ['cultural-space','plugin_cultural_space_index']
|
||||
],
|
||||
'plugin_cultural_space_index_record' => [
|
||||
'name' => '变更记录',
|
||||
'url' => 'plugin.cultural-space.admin.index.record',
|
||||
'url_params' => '',
|
||||
'permit' => 1,
|
||||
'menu' => 0,
|
||||
'icon' => '',
|
||||
'item' => 'plugin_cultural_space_index_record',
|
||||
'parents' => ['cultural-space','plugin_cultural_space_index']
|
||||
],
|
||||
]
|
||||
],*/
|
||||
|
||||
|
||||
'plugin_cultural_space_contribution' => [
|
||||
'name' => '贡献值管理',
|
||||
'permit' => 1,
|
||||
|
|
@ -104,6 +69,31 @@ class PluginApplication extends \app\common\services\PluginApplication{
|
|||
],
|
||||
]
|
||||
],
|
||||
'plugin_cultural_space_legumes' => [
|
||||
'name' => '易出申请',
|
||||
'permit' => 1,
|
||||
'menu' => 1,
|
||||
'icon' => '',
|
||||
'url' => 'plugin.cultural-space.admin.legumes.withdrawalApply',
|
||||
'url_params' => '',
|
||||
'item' => 'plugin_cultural_space_legumes',
|
||||
'parents' => ['cultural-space'],
|
||||
'child' => [
|
||||
// 权限补充
|
||||
'plugin_cultural_space_legumes_withdrawal' => [
|
||||
'name' => '易出申请',
|
||||
'url' => 'plugin.cultural-space.admin.legumes.withdrawalApply',
|
||||
'url_params' => '',
|
||||
'permit' => 1,
|
||||
'menu' => 0,
|
||||
'icon' => '',
|
||||
'item' => 'plugin_cultural_space_legumes_withdrawal',
|
||||
'parents' => ['cultural-space','plugin_cultural_space_legumes']
|
||||
],
|
||||
]
|
||||
],
|
||||
|
||||
|
||||
'plugin_cultural_space_set' => [
|
||||
'name' => '基本设置',
|
||||
'permit' => 1,
|
||||
|
|
|
|||
|
|
@ -8,12 +8,6 @@ use Yunshop\NewPoster\models\Poster;
|
|||
|
||||
class IndexController extends BaseController{
|
||||
|
||||
// 列表
|
||||
public function index(){
|
||||
|
||||
|
||||
return view('Yunshop\CulturalSpace::index.index')->render();
|
||||
}
|
||||
/**
|
||||
* Common: 设置信息编辑
|
||||
* Author: wu-hui
|
||||
|
|
|
|||
|
|
@ -0,0 +1,119 @@
|
|||
<?php
|
||||
namespace Yunshop\CulturalSpace\admin;
|
||||
|
||||
use app\common\components\BaseController;
|
||||
use app\common\exceptions\ShopException;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Yunshop\CulturalSpace\models\CulturalFund;
|
||||
use Yunshop\CulturalSpace\models\CulturalOrderFundLog;
|
||||
use Yunshop\CulturalSpace\models\CulturalSpaceGoodsLegumes;
|
||||
use Yunshop\CulturalSpace\models\CulturalSpaceLegumesWithdrawal;
|
||||
use Yunshop\UseStaff\models\ExternalApi;
|
||||
use Yunshop\UseStaff\models\UseStaff;
|
||||
|
||||
class LegumesController extends BaseController{
|
||||
/**
|
||||
* Common: 易出申请记录
|
||||
* Author: wu-hui
|
||||
* Time: 2023/11/29 15:49
|
||||
* @return array|\Illuminate\Http\JsonResponse|string
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function withdrawalApply(){
|
||||
if(request()->isMethod('post')){
|
||||
// 参数获取
|
||||
$search = request()->input('search');
|
||||
// 获取记录
|
||||
$result = CulturalSpaceLegumesWithdrawal::getList($search);
|
||||
|
||||
return $this->successJson('success',[
|
||||
'current_page' => $result['current_page'],
|
||||
'data' => $result['data'],
|
||||
'last_page' => $result['last_page'],
|
||||
]);
|
||||
}
|
||||
|
||||
return view('Yunshop\CulturalSpace::legumes.withdrawal_apply')->render();
|
||||
}
|
||||
/**
|
||||
* Common: 易出审核 - 驳回
|
||||
* Author: wu-hui
|
||||
* Time: 2023/11/29 16:37
|
||||
*/
|
||||
public function rejectReason(){
|
||||
// 参数获取
|
||||
$id = request()->input('id');
|
||||
$rejectReason = request()->input('reject_reason');
|
||||
// 处理
|
||||
DB::beginTransaction();
|
||||
try{
|
||||
// 信息获取
|
||||
$info = CulturalSpaceLegumesWithdrawal::find($id);
|
||||
// 修改状态
|
||||
$info->status = 2;
|
||||
$info->reject_reason = $rejectReason;
|
||||
$info->save();
|
||||
// 修改用户持有信息
|
||||
(new CulturalOrderFundLog())->transferHandle((int)$info->uid,(float)$info->withdrawal_total_num,0,"易出申请被驳回,返还易出数量",2);
|
||||
|
||||
// 修改费率
|
||||
$culturalFund = CulturalFund::uniacid()->first();
|
||||
$culturalFund->fund_money = $culturalFund->fund_money + (float)$info->withdrawal_num;// 减少基金总数 易出部分数量
|
||||
$culturalFund->voucher_number = $culturalFund->voucher_number + (float)$info->withdrawal_total_num;// 减少文创豆总数 提现数量(包括手续费)
|
||||
$culturalFund->last_fee = $culturalFund->current_fee;// 当前费率 成为 上一次费率
|
||||
$culturalFund->current_fee = $culturalFund->fund_money / $culturalFund->voucher_number;// 重新计算费率
|
||||
$culturalFund->save();
|
||||
|
||||
DB::commit();
|
||||
return $this->successJson('驳回成功');
|
||||
}catch(\Exception $e){
|
||||
DB::rollBack();
|
||||
return $this->errorJson($e->getMessage());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Common: 易出审核 - 通过并且打款
|
||||
* Author: wu-hui
|
||||
* Time: 2023/11/29 17:28
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function examinePass(){
|
||||
// 参数获取
|
||||
$id = request()->input('id');
|
||||
// 处理
|
||||
DB::beginTransaction();
|
||||
try{
|
||||
// 信息获取
|
||||
$info = CulturalSpaceLegumesWithdrawal::find($id);
|
||||
$uid = $info->uid;
|
||||
$buyGoodsNum = (float)$info->buy_goods_num;
|
||||
$realityAmount = $info->reality_amount;
|
||||
$month = $info->created_at->format('Ym');
|
||||
// 修改状态
|
||||
$info->status = 3;
|
||||
$info->save();
|
||||
// 打款 第三方代发(汇优财)
|
||||
$staff = UseStaff::getSingleInfo(['uid'=>$uid]);
|
||||
$info = [
|
||||
'uid' => $uid,
|
||||
'month' => $month,
|
||||
'member_id' => $staff['member_id'],
|
||||
'salary' => $realityAmount
|
||||
];
|
||||
$result = (new ExternalApi())->salaryModelOutOrder($info);
|
||||
if((int)$result['respCode'] != 2) throw new ShopException($result['respDesc']);
|
||||
// 商品兑换豆 到账
|
||||
(new CulturalSpaceGoodsLegumes())->changeHandle((int)$uid,$buyGoodsNum,1,"易出申请转换",0,['legumes_withdrawal_id' => $id]);
|
||||
|
||||
DB::commit();
|
||||
return $this->successJson('打款成功');
|
||||
}catch(\Exception $e){
|
||||
DB::rollBack();
|
||||
return $this->errorJson($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -19,6 +19,7 @@ use Yunshop\CulturalSpace\models\ContributionLog;
|
|||
use Yunshop\CulturalSpace\models\CulturalFund;
|
||||
use Yunshop\CulturalSpace\models\CulturalOrderFundLog;
|
||||
use Yunshop\CulturalSpace\models\CulturalSpace;
|
||||
use Yunshop\CulturalSpace\models\CulturalSpaceLegumesWithdrawal;
|
||||
use Yunshop\ShareholderDividend\models\ShareholderDividendModel;
|
||||
use Yunshop\TeamDividend\admin\models\MemberChild;
|
||||
use Yunshop\TeamDividend\models\TeamDividendAgencyModel;
|
||||
|
|
@ -221,7 +222,6 @@ class IndexController extends ApiController{
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Common: 获取用户当前持有的文创豆
|
||||
* Author: wu-hui
|
||||
|
|
@ -231,12 +231,14 @@ class IndexController extends ApiController{
|
|||
public function legumesHold(){
|
||||
$uid = \YunShop::app()->getMemberId();
|
||||
$voucher_number = sprintf("%.6f",CulturalSpace::uniacid()->where('uid',$uid)->value('voucher_number'));
|
||||
$set = Setting::get('plugin.cultural_space_set');
|
||||
$withdrawalCommissionRate = 20;//提现手续费比例
|
||||
|
||||
|
||||
return $this->successJson('success',[
|
||||
'voucher_number'=>$voucher_number,
|
||||
'commission_rate'=>$withdrawalCommissionRate
|
||||
'voucher_number' => $voucher_number,
|
||||
'commission_rate' => $withdrawalCommissionRate,
|
||||
'task_video_link' => $set['task_video_link']
|
||||
]);
|
||||
}
|
||||
/**
|
||||
|
|
@ -312,12 +314,12 @@ class IndexController extends ApiController{
|
|||
}
|
||||
}
|
||||
/**
|
||||
* Common: 提现处理
|
||||
* Common: 提现处理 弃用 提现修改为易出,当前方法直接弃用2023-11-29
|
||||
* Author: wu-hui
|
||||
* Time: 2023/11/23 10:04
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function withdrawal(){
|
||||
/*public function withdrawal(){
|
||||
// 参数获取
|
||||
$uid = \YunShop::app()->getMemberId();
|
||||
$withdrawalNumber = abs((float)request()->input('withdrawal_number'));
|
||||
|
|
@ -368,7 +370,7 @@ class IndexController extends ApiController{
|
|||
DB::rollBack();
|
||||
return $this->errorJson($e->getMessage());
|
||||
}
|
||||
}
|
||||
}*/
|
||||
/**
|
||||
* Common: 文创豆变更记录
|
||||
* Author: wu-hui
|
||||
|
|
@ -394,6 +396,30 @@ class IndexController extends ApiController{
|
|||
'last_page' => (int)$result['last_page'],
|
||||
]);
|
||||
}
|
||||
/**
|
||||
* Common: 文创豆易出申请
|
||||
* Author: wu-hui
|
||||
* Time: 2023/11/29 15:08
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function withdrawalNew(){
|
||||
DB::beginTransaction();
|
||||
try{
|
||||
// 参数获取
|
||||
$withdrawalNum = request()->input('withdrawal_num');
|
||||
$taskType = request()->input('task_type');
|
||||
// 处理提现
|
||||
(new CulturalSpaceLegumesWithdrawal())->applyWithdrawal($withdrawalNum,$taskType);
|
||||
|
||||
|
||||
DB::commit();
|
||||
return $this->successJson("易出申请成功");
|
||||
}catch(\Exception $e){
|
||||
DB::rollBack();
|
||||
return $this->errorJson($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
namespace Yunshop\CulturalSpace\models;
|
||||
|
||||
|
||||
use app\common\facades\Setting;
|
||||
use app\common\models\BaseModel;
|
||||
use app\common\models\Member;
|
||||
|
||||
class CulturalSpaceGoodsLegumes extends BaseModel{
|
||||
|
||||
public $table = 'yz_cultural_space_goods_legumes';
|
||||
public $casts = [
|
||||
'created_at' => 'datetime:Y-m-d H:i:s'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'uniacid',
|
||||
'uid',
|
||||
'goods_id',
|
||||
'order_id',
|
||||
'order_goods_id',
|
||||
'legumes_withdrawal_id',
|
||||
'change_type',
|
||||
'change_quantity',
|
||||
'change_front',
|
||||
'change_after',
|
||||
'remark',
|
||||
'created_at',
|
||||
'source'
|
||||
];
|
||||
|
||||
/**
|
||||
* Common: 变更记录处理
|
||||
* Author: wu-hui
|
||||
* Time: 2023/11/29 17:40
|
||||
* @param int $uid 用户id
|
||||
* @param float $changeNum 变更数量
|
||||
* @param int $changeType 变更类型:0=减少,1=增加
|
||||
* @param string $remark 备注
|
||||
* @param int $changeSource 记录来源:0=文创豆易出,1=商品兑换
|
||||
* @param array $params 其他参数:goods_id、order_id、order_goods_id、legumes_withdrawal_id
|
||||
* @return mixed
|
||||
*/
|
||||
public function changeHandle(int $uid,float $changeNum,int $changeType,string $remark,int $changeSource = 1,array $params = []){
|
||||
// 获取当前用户持有数量
|
||||
$changeFront = (float)CulturalSpace::uniacid()->where('uid',$uid)->value('goods_legumes');
|
||||
// 变更后的数量
|
||||
$changeAfter = $changeType == 1 ? $changeFront + $changeNum : $changeFront - $changeNum;
|
||||
// 变更记录
|
||||
$data = [
|
||||
'uniacid' => \YunShop::app()->uniacid,
|
||||
'uid' => $uid,// 用户id
|
||||
'goods_id' => $params['goods_id'] ?? 0,// 商品id
|
||||
'order_id' => $params['order_id'] ?? 0,// 订单id
|
||||
'order_goods_id' => $params['order_goods_id'] ?? 0,// 订单商品id
|
||||
'legumes_withdrawal_id' => $params['legumes_withdrawal_id'] ?? 0,// 文创豆易出申请id
|
||||
'change_type' => $changeType,// 变更类型:0=减少,1=增加
|
||||
'change_quantity' => $changeNum,// 变更数量
|
||||
'change_front' => $changeFront,// 变更前拥有的数量
|
||||
'change_after' => $changeAfter,// 变更后拥有的数量
|
||||
'remark' => $remark,
|
||||
'created_at' => time(),// 变更时间
|
||||
'source' => $changeSource,
|
||||
];
|
||||
$id = $this->insertGetId($data);
|
||||
// 修改用户持有
|
||||
CulturalSpace::uniacid()->where('uid',$uid)->update(['goods_legumes' => $changeAfter]);
|
||||
|
||||
return $id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,140 @@
|
|||
<?php
|
||||
namespace Yunshop\CulturalSpace\models;
|
||||
|
||||
|
||||
use app\common\facades\Setting;
|
||||
use app\common\models\BaseModel;
|
||||
use app\common\models\Member;
|
||||
|
||||
class CulturalSpaceLegumesWithdrawal extends BaseModel{
|
||||
|
||||
public $table = 'yz_cultural_space_legumes_withdrawal';
|
||||
public $casts = [
|
||||
'created_at' => 'datetime:Y-m-d H:i:s',
|
||||
'updated_at' => 'datetime:Y-m-d H:i:s'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'uniacid',
|
||||
'uid',
|
||||
'withdrawal_total_num',
|
||||
'fund_ratio',
|
||||
'fund_num',
|
||||
'buy_goods_ratio',
|
||||
'buy_goods_num',
|
||||
'withdrawal_ratio',
|
||||
'withdrawal_num',
|
||||
'commission_ratio',
|
||||
'commission_num',
|
||||
'reality_num',
|
||||
'current_fee',
|
||||
'reality_amount',
|
||||
'status',
|
||||
'reject_reason',
|
||||
'task_type',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
];
|
||||
/**
|
||||
* Common: 获取易出申请列表
|
||||
* Author: wu-hui
|
||||
* Time: 2023/11/29 15:52
|
||||
* @param $search
|
||||
* @param int $limit
|
||||
* @return array
|
||||
*/
|
||||
public function getList($search,$limit = 10){
|
||||
// 条件生成
|
||||
$where = [];
|
||||
if($search['uid'] > 0) $where[] = ['uid','=',$search['uid']];
|
||||
// 列表获取
|
||||
$list = self::uniacid()
|
||||
->where($where)
|
||||
->with([
|
||||
'member' => function($query){
|
||||
$query->select(['uid','nickname','realname','avatar']);
|
||||
}
|
||||
])
|
||||
->orderBy('created_at','DESC')
|
||||
->orderBy('id','DESC')
|
||||
->paginate($limit);
|
||||
|
||||
return $list ? $list->toArray() : [];
|
||||
}
|
||||
/**
|
||||
* Common: 易出申请
|
||||
* Author: wu-hui
|
||||
* Time: 2023/11/29 15:16
|
||||
* @param $totalNum
|
||||
* @param $taskType
|
||||
* @return mixed
|
||||
*/
|
||||
public function applyWithdrawal($totalNum,$taskType){
|
||||
$uid = \YunShop::app()->getMemberId();
|
||||
// 获取设置信息
|
||||
$set = Setting::get('plugin.cultural_space_set');
|
||||
// 获取各个部分的比例
|
||||
$fundRatio = (float)$set['legumes_fund_ratio'];// 基金池部分比例
|
||||
$withdrawalRatio = (float)sprintf("%.2f",100 - $fundRatio);//易出部分比例
|
||||
$buyGoodsRatio = (float)$set['legumes_buy_goods_ratio'];// 购物部分比例
|
||||
$realityWithdrawalRatio = (float)sprintf("%.2f",100 - $buyGoodsRatio);// 实际易出部分比例
|
||||
$commissionRatio = (float)$set['legumes_withdrawal_commission'];// 实际易出部分的手续费比例
|
||||
// 计算各个部分的文创豆数量
|
||||
$fund_num = (float)sprintf("%.2f",$totalNum * $fundRatio / 100 );// 基金池部分数量
|
||||
$withdrawal_num = (float)sprintf("%.2f",$totalNum * $withdrawalRatio / 100 );// 易出部分数量
|
||||
$buy_goods_num = (float)sprintf("%.2f",$withdrawal_num * $buyGoodsRatio / 100 );// 购物部分数量
|
||||
$reality_num = (float)sprintf("%.2f",$withdrawal_num * $realityWithdrawalRatio / 100 );// 实际易出部分数量
|
||||
$commission_num = (float)sprintf("%.2f",$reality_num * $commissionRatio / 100);// 手续费数量
|
||||
$reality_num = (float)sprintf("%.2f",$reality_num - $commission_num);// 实际易出部分 - 手续费 = 实际可得
|
||||
// 计算实际到账金额
|
||||
$culturalFund = CulturalFund::uniacid()->first();
|
||||
$currentFee = $culturalFund->current_fee;
|
||||
$reality_amount = (float)sprintf("%.2f",$reality_num * $currentFee);// 实际打款数量
|
||||
// 记录
|
||||
$data = [
|
||||
'uniacid' => \YunShop::app()->uniacid,
|
||||
'uid' => $uid,
|
||||
'withdrawal_total_num' => $totalNum, // 文创豆提现总数
|
||||
'fund_ratio' => $fundRatio, // 基金池比例
|
||||
'fund_num' => $fund_num, // 基金池数量
|
||||
'buy_goods_ratio' => $buyGoodsRatio, // 购物豆部分比例
|
||||
'buy_goods_num' => $buy_goods_num, // 购物豆部分数量
|
||||
'withdrawal_ratio' => $withdrawalRatio, // 易出部分比例
|
||||
'withdrawal_num' => $withdrawal_num, // 易出数量
|
||||
'commission_ratio' => $commissionRatio, // 手续费比例
|
||||
'commission_num' => $commission_num, // 手续费数量
|
||||
'reality_num' => $reality_num, // 实际易出文创豆
|
||||
'current_fee' => $currentFee, // 费率
|
||||
'reality_amount' => $reality_amount, // 实际提现打款数量(元)
|
||||
'status' => 0, // 审核状态:0=待审核,1=待打款,2=已驳回
|
||||
'task_type' => $taskType == 'video' ? 1 : 2, // 任务类型:0=不明确,1=视频,2=分享
|
||||
'created_at' => time(), // 申请时间
|
||||
'updated_at' => time(), // 更新时间
|
||||
];
|
||||
$id = self::insertGetId($data);
|
||||
// 修改费率
|
||||
$culturalFund->fund_money = $culturalFund->fund_money - $withdrawal_num;// 减少基金总数 易出部分数量
|
||||
$culturalFund->voucher_number = $culturalFund->voucher_number - $totalNum;// 减少文创豆总数 提现数量(包括手续费)
|
||||
$culturalFund->last_fee = $culturalFund->current_fee;// 当前费率 成为 上一次费率
|
||||
$culturalFund->current_fee = $culturalFund->fund_money / $culturalFund->voucher_number;// 重新计算费率
|
||||
$culturalFund->save();
|
||||
// 添加变更记录
|
||||
(new CulturalOrderFundLog())->transferHandle((int)$uid,(float)$totalNum,1,"易出申请",2);
|
||||
|
||||
return $id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Common: 一对一关联 用户信息
|
||||
* Author: wu-hui
|
||||
* Time: 2023/11/29 15:51
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
*/
|
||||
public function member(){
|
||||
return $this->hasOne(Member::class,'uid','uid');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -57,6 +57,7 @@ class GoodsCulturalSpace extends BaseModel{
|
|||
* @return array
|
||||
*/
|
||||
public static function getExchangeGoodsList(){
|
||||
$uid = \YunShop::app()->getMemberId();
|
||||
$result = self::uniacid()
|
||||
->select(['id','goods_id','legumes_exchange_price'])
|
||||
->with(['belongsToGoods'=>function($query){
|
||||
|
|
@ -74,7 +75,7 @@ class GoodsCulturalSpace extends BaseModel{
|
|||
];
|
||||
// 计算需要使用的文创豆
|
||||
$currentFee = (float)CulturalFund::uniacid()->value('current_fee');// 当前费率
|
||||
$holdExchangeLegumes = 0;// 当前用户持有的用以兑换商品的文创豆
|
||||
$holdExchangeLegumes = (float)CulturalSpace::uniacid()->where('uid',$uid)->value('goods_legumes');// 当前用户持有的用以兑换商品的文创豆
|
||||
$data['data'] = array_map(function($item) use ($currentFee,$holdExchangeLegumes){
|
||||
// 使用的文创豆
|
||||
$useLegumes = ceil($item['legumes_exchange_price'] * $currentFee);
|
||||
|
|
|
|||
|
|
@ -1,305 +0,0 @@
|
|||
@extends('layouts.base')
|
||||
<style>
|
||||
.user{
|
||||
display: inline-flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
overflow: hidden;
|
||||
height: 80px;
|
||||
}
|
||||
.user .user-avatar{
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
margin-right: 5px;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.user .user-avatar .avatar-image{
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
}
|
||||
.user .user-info{
|
||||
height: 50px;
|
||||
text-align: left;
|
||||
}
|
||||
.user .user-info .user-nickname{
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.user .user-info .user-status{
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.level_0{
|
||||
background-color: #5bc0de!important;
|
||||
}
|
||||
.level_1{
|
||||
background-color: #f0ad4e!important;
|
||||
}
|
||||
.level_2{
|
||||
background-color: #5cb85c!important;
|
||||
}
|
||||
.level_3{
|
||||
background-color: #337ab7!important;
|
||||
}
|
||||
.level_4{
|
||||
background-color: #d9534f!important;
|
||||
}
|
||||
.panel-body .label{
|
||||
display: inline-block;
|
||||
margin-bottom: 2px;
|
||||
border-radius: 2px;
|
||||
font-size: 14px!important;
|
||||
padding: 5px !important;
|
||||
text-transform: uppercase;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
.el-pagination{
|
||||
text-align: right!important;
|
||||
margin-top: 20px!important;
|
||||
}
|
||||
.panel-body{
|
||||
padding-top: 0;
|
||||
margin-bottom: 30px;
|
||||
overflow: auto;
|
||||
padding-right: 30px;
|
||||
}
|
||||
</style>
|
||||
@section('content')
|
||||
<div class="w1200 m0a" id="weightValueIndexContent">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<el-tabs v-model="tabs_active" @tab-click="changeTabs">
|
||||
<el-tab-pane label="变更明细" name="show_detail">
|
||||
{{--搜索--}}
|
||||
<el-form :inline="true" :model="search_list">
|
||||
<el-form-item label="变更类型">
|
||||
<el-select v-model="search_list.change_type" placeholder="全部">
|
||||
<el-option label="全部" value=""></el-option>
|
||||
<el-option label="减少" value="0"></el-option>
|
||||
<el-option label="增加" value="1"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="会员ID">
|
||||
<el-input v-model="search_list.member_id" placeholder="请输入会员ID"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="权重值类型">
|
||||
<el-select v-model="search_list.team_dividend_agency_level_id" placeholder="全部">
|
||||
<el-option label="全部" value=""></el-option>
|
||||
<el-option v-for="(item,index) in level_list" :key="index" :label="item.level_name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="clickSearch">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
{{--表单--}}
|
||||
<el-table :data="list" style="width: 100%">
|
||||
<el-table-column align="center" prop="id" label="ID" width="80"></el-table-column>
|
||||
<el-table-column align="center" prop="member" label="用户信息" width="230">
|
||||
<template slot-scope="scope">
|
||||
<div class="user">
|
||||
<div class="user-avatar">
|
||||
<img class="avatar-image" :src="scope.row.member.avatar_image || ''" />
|
||||
</div>
|
||||
<div class="user-info">
|
||||
<div class="user-nickname">昵称:[[scope.row.member.nickname || '']]</div>
|
||||
<div class="user-status">ID:[[scope.row.member.uid || '']]</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="change_front" label="变更前持有数" width="150"></el-table-column>
|
||||
<el-table-column align="center" prop="change_type" label="变更类型" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.change_type == 0 ? 'danger' : 'success'" disable-transitions>
|
||||
[[scope.row.change_type == 0 ? '减少' : '增加']]
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="change_quantity" label="变更数量" width="150"></el-table-column>
|
||||
<el-table-column align="center" prop="change_after" label="变更后持有数" width="150"></el-table-column>
|
||||
<el-table-column align="center" prop="change_quantity" label="权重值类型" width="150">
|
||||
<template slot-scope="scope">
|
||||
<span :class="'label level_'+scope.row.sort">
|
||||
[[scope.row.level.level_name ? scope.row.level.level_name + '权重值' : '']]
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="remark" label="变更原因"></el-table-column>
|
||||
<el-table-column align="center" prop="created_at" label="变更时间" width="200"></el-table-column>
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="统计明细" name="show_group">
|
||||
{{--搜索--}}
|
||||
<el-form :inline="true" :model="search_list">
|
||||
<el-form-item label="会员ID">
|
||||
<el-input v-model="search_list.member_id" placeholder="请输入会员ID"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="权重值类型">
|
||||
<el-select v-model="search_list.team_dividend_agency_level_id" placeholder="全部">
|
||||
<el-option label="全部" value=""></el-option>
|
||||
<el-option v-for="(item,index) in level_list" :key="index" :label="item.level_name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="clickSearch">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
{{--表单--}}
|
||||
<el-table :data="list" style="width: 100%">
|
||||
<el-table-column align="center" prop="id" label="ID" width="100"></el-table-column>
|
||||
<el-table-column align="center" prop="member" label="用户信息" width="300">
|
||||
<template slot-scope="scope">
|
||||
<div class="user">
|
||||
<div class="user-avatar">
|
||||
<img class="avatar-image" :src="scope.row.member.avatar_image || ''" />
|
||||
</div>
|
||||
<div class="user-info">
|
||||
<div class="user-nickname">昵称:[[scope.row.member.nickname || '']]</div>
|
||||
<div class="user-status">ID:[[scope.row.member.uid || '']]</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="change_quantity" label="权重值类型">
|
||||
<template slot-scope="scope">
|
||||
<span :class="'label level_'+scope.row.sort">
|
||||
[[scope.row.level.level_name ? scope.row.level.level_name + '权重值' : '']]
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="change_front">
|
||||
<template slot="header" slot-scope="scope">
|
||||
<span class="label label-default">平台总数</span>
|
||||
<span class="label label-info">用户持有</span>
|
||||
<span class="label label-warning">占比(%)</span>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<span class="label label-default">[[scope.row.total_quantity || '0.00' ]]</span>
|
||||
<span class="label label-info">[[scope.row.quantity || '0.00' ]]</span>
|
||||
<span class="label label-warning">[[scope.row.ratio ? scope.row.ratio + '%' : '0.00' ]]</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="created_at" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary" @click="seeDetail(scope.row.member_id,scope.row.team_dividend_agency_level_id)">变更明细</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
{{--分页--}}
|
||||
<el-pagination
|
||||
v-if="total_page > 1"
|
||||
background
|
||||
layout="prev, pager, next"
|
||||
:page-count="total_page"
|
||||
:current-page="page"
|
||||
@current-change="changePage">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
new Vue({
|
||||
el: '#weightValueIndexContent',
|
||||
delimiters: ['[[', ']]'],
|
||||
name: 'cultural_space_index_content',
|
||||
data: {
|
||||
tabs_active: 'show_detail',
|
||||
level_list: JSON.parse('{!! json_encode($level_list) !!}'),
|
||||
// 分页信息
|
||||
page: 1,
|
||||
total_page: 1,
|
||||
list: [],
|
||||
search_list: {
|
||||
member_id: '',
|
||||
team_dividend_agency_level_id: '',
|
||||
change_type: '',
|
||||
}
|
||||
},
|
||||
watch:{},
|
||||
mounted () {
|
||||
// this.getData();
|
||||
},
|
||||
methods: {
|
||||
// 获取数据 根据当前选项卡获取对应的信息
|
||||
getData(){
|
||||
let _this = this;
|
||||
let loading = _this.showLoading();
|
||||
let link = "{!! yzWebUrl('plugin.cultural-space.admin.index.changeRecord') !!}";
|
||||
if(_this.tabs_active === 'show_group') link = "{!! yzWebUrl('plugin.cultural-space.admin.index.changeGroupRecord') !!}";
|
||||
$.ajax({
|
||||
url: link,
|
||||
type: "post",
|
||||
data: {
|
||||
page: _this.page,
|
||||
search: _this.search_list,
|
||||
is_get: 1
|
||||
},
|
||||
success: function(result) {
|
||||
loading.close(0);
|
||||
let data = result.data;
|
||||
if(parseInt(result.result) === 1){
|
||||
// 处理数据
|
||||
_this.list = data.data;
|
||||
_this.total_page = data.last_page;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 切换选项卡
|
||||
changeTabs(){
|
||||
this.page = 1;
|
||||
this.search_list = {
|
||||
member_id: '',
|
||||
team_dividend_agency_level_id: '',
|
||||
change_type: '',
|
||||
};
|
||||
this.total_page = 1;
|
||||
this.list = [];
|
||||
this.getData();
|
||||
},
|
||||
// 数据分页
|
||||
changePage(val){
|
||||
this.page = val;
|
||||
this.getData();
|
||||
},
|
||||
// 相关搜索
|
||||
clickSearch(){
|
||||
this.page = 1;
|
||||
this.getData()
|
||||
},
|
||||
// 显示加载动画
|
||||
showLoading(){
|
||||
return this.$loading({
|
||||
lock: true,
|
||||
text: 'Loading',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
});
|
||||
},
|
||||
// 查看分组的变更明细
|
||||
seeDetail(member_id,level_id){
|
||||
let link = "{{yzWebUrl('plugin.cultural-space.admin.index.changeRecord')}}" + `&member_id=${member_id}&level_id=${level_id}`;
|
||||
let popup = util.ajaxshow(link,'权重值变更明细',{
|
||||
width: $(window).width() * 0.8 > 1200 ? $(window).width() * 0.8 : 1200,
|
||||
height: $(window).height() * 0.8 > 1200 ? $(window).height() * 0.8 : 1200,
|
||||
});
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
|
|
@ -0,0 +1,272 @@
|
|||
@extends('layouts.base')
|
||||
<style>
|
||||
.user{
|
||||
display: inline-flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
overflow: hidden;
|
||||
height: 80px;
|
||||
}
|
||||
.user .user-avatar{
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
margin-right: 5px;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.user .user-avatar .avatar-image{
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
}
|
||||
.user .user-info{
|
||||
height: 50px;
|
||||
text-align: left;
|
||||
}
|
||||
.user .user-info .user-nickname{
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.user .user-info .user-status{
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.panel-body .label{
|
||||
display: inline-block;
|
||||
margin-bottom: 2px;
|
||||
border-radius: 2px;
|
||||
font-size: 14px!important;
|
||||
padding: 5px !important;
|
||||
text-transform: uppercase;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
.el-pagination{
|
||||
text-align: right!important;
|
||||
margin-top: 20px!important;
|
||||
}
|
||||
.panel-body{
|
||||
padding-top: 0;
|
||||
margin-bottom: 30px;
|
||||
overflow: auto;
|
||||
padding-right: 30px;
|
||||
}
|
||||
</style>
|
||||
@section('content')
|
||||
<div class="w1200 m0a" id="mainContent">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
{{--搜索--}}
|
||||
<el-form :inline="true" :model="search_info">
|
||||
<el-form-item label="会员ID">
|
||||
<el-input v-model="search_info.uid" placeholder="请输入会员ID"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="clickSearch">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
{{--表格--}}
|
||||
<el-table :data="list" style="width: 100%">
|
||||
<el-table-column align="center" prop="id" label="ID" width="80"></el-table-column>
|
||||
<el-table-column align="center" prop="member" label="用户信息" width="230">
|
||||
<template slot-scope="scope">
|
||||
<div class="user">
|
||||
<div class="user-avatar">
|
||||
<img class="avatar-image" :src="scope.row.member.avatar_image || ''" />
|
||||
</div>
|
||||
<div class="user-info">
|
||||
<div class="user-nickname">昵称:[[scope.row.member.nickname || '']]</div>
|
||||
<div class="user-status">ID:[[scope.row.member.uid || '']]</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="withdrawal_total_num" label="易出总数" width="100"></el-table-column>
|
||||
<el-table-column align="center" label="基金池" width="110">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="warning" disable-transitions>[[scope.row.fund_ratio]]%</el-tag>
|
||||
<el-tag type="success" disable-transitions style="margin-top: 10px;">[[scope.row.fund_num]]豆</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="易出部分" width="110">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="warning" disable-transitions>[[scope.row.withdrawal_ratio]]%</el-tag>
|
||||
<el-tag type="success" disable-transitions style="margin-top: 10px;">[[scope.row.withdrawal_num]]豆</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="购物部分" width="110">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="warning" disable-transitions>[[scope.row.buy_goods_ratio]]%</el-tag>
|
||||
<el-tag type="success" disable-transitions style="margin-top: 10px;">[[scope.row.buy_goods_num]]豆</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="手续费" width="110">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="warning" disable-transitions>[[scope.row.commission_ratio]]%</el-tag>
|
||||
<el-tag type="success" disable-transitions style="margin-top: 10px;">[[scope.row.commission_num]]豆</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="current_fee" label="费率" width="80"></el-table-column>
|
||||
<el-table-column align="center" prop="change_type" label="实际易出" width="110">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="success" disable-transitions>[[scope.row.reality_num]]豆</el-tag>
|
||||
<el-tag type="info" disable-transitions style="margin-top: 10px;">[[scope.row.reality_amount]]元</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="change_type" label="审核状态" width="110">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.status == 0" type="info">待审核</el-tag>
|
||||
<el-tag v-if="scope.row.status == 1" type="warning">待打款</el-tag>
|
||||
<el-tag v-if="scope.row.status == 2" type="danger">已驳回</el-tag>
|
||||
<el-tag v-if="scope.row.status == 3" type="success">已打款</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="created_at" label="申请时间" width="200"></el-table-column>
|
||||
<el-table-column align="center" prop="created_at" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<div v-if="scope.row.status == 0">
|
||||
<el-button type="primary" @click="examinePass(scope.row.id)">通过并打款</el-button>
|
||||
<el-button type="danger" @click="rejectReason(scope.row.id)">驳回</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
{{--分页--}}
|
||||
<el-pagination
|
||||
v-if="total_page > 1"
|
||||
background
|
||||
layout="prev, pager, next"
|
||||
:page-count="total_page"
|
||||
:current-page="page"
|
||||
@current-change="changePage">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
new Vue({
|
||||
el: '#mainContent',
|
||||
delimiters: ['[[', ']]'],
|
||||
name: 'withdrawal_apply',
|
||||
data() {
|
||||
return {
|
||||
page: 1,
|
||||
total_page: 1,
|
||||
list: [],
|
||||
search_info: {
|
||||
uid: '',
|
||||
}
|
||||
}
|
||||
},
|
||||
watch:{},
|
||||
mounted () {
|
||||
this.getData();
|
||||
},
|
||||
methods: {
|
||||
// 获取数据 根据当前选项卡获取对应的信息
|
||||
getData(){
|
||||
let _this = this;
|
||||
let loading = _this.showLoading();
|
||||
// 请求获取数据
|
||||
$.ajax({
|
||||
url: "{!! yzWebUrl('plugin.cultural-space.admin.legumes.withdrawalApply') !!}",
|
||||
type: "post",
|
||||
data: {
|
||||
page: _this.page,
|
||||
search: _this.search_info,
|
||||
},
|
||||
success: function(result) {
|
||||
let data = result.data;
|
||||
if(parseInt(result.result) === 1){
|
||||
// 处理数据
|
||||
_this.list = data.data;
|
||||
_this.total_page = data.last_page;
|
||||
}
|
||||
loading.close();
|
||||
}
|
||||
});
|
||||
},
|
||||
// 数据分页
|
||||
changePage(val){
|
||||
this.page = val;
|
||||
this.getData();
|
||||
},
|
||||
// 相关搜索
|
||||
clickSearch(){
|
||||
this.page = 1;
|
||||
this.getData()
|
||||
},
|
||||
// 显示加载动画
|
||||
showLoading(){
|
||||
return this.$loading({
|
||||
lock: true,
|
||||
text: 'Loading',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
});
|
||||
},
|
||||
// 通过并且打款
|
||||
examinePass(id){
|
||||
let _this = this;
|
||||
_this.$confirm('确认通过审核并且立即打款吗!', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
// 通过并且打款
|
||||
$.ajax({
|
||||
url: "{!! yzWebUrl('plugin.cultural-space.admin.legumes.examinePass') !!}",
|
||||
type: "post",
|
||||
data: {
|
||||
id: id
|
||||
},
|
||||
success: function(result) {
|
||||
_this.$alert(result.msg).then(()=>{
|
||||
_this.getData();
|
||||
});
|
||||
}
|
||||
});
|
||||
}).catch(() => {});
|
||||
},
|
||||
// 驳回
|
||||
rejectReason(id){
|
||||
let _this = this;
|
||||
_this.$prompt('驳回原因', '提交审核', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
inputType: 'textarea',
|
||||
}).then(({ value }) => {
|
||||
// 驳回操作
|
||||
$.ajax({
|
||||
url: "{!! yzWebUrl('plugin.cultural-space.admin.legumes.rejectReason') !!}",
|
||||
type: "post",
|
||||
data: {
|
||||
id: id,
|
||||
reject_reason: value
|
||||
},
|
||||
success: function(result) {
|
||||
_this.$alert(result.msg).then(()=>{
|
||||
_this.getData();
|
||||
});
|
||||
}
|
||||
});
|
||||
}).catch(() => {});
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
})
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
Loading…
Reference in New Issue