微调卡券列表
This commit is contained in:
@@ -148,9 +148,9 @@ class IndexController extends AdminController
|
||||
// $export->column('price', function ($value, $original) {
|
||||
// return $value . "\t";
|
||||
// });
|
||||
$export->column('total', function ($value, $original) {
|
||||
return $value . "\t";
|
||||
});
|
||||
// $export->column('total', function ($value, $original) {
|
||||
// return $value . "\t";
|
||||
// });
|
||||
$export->column('资金通道结算', function ($value, $original) {
|
||||
return strip_tags($value);
|
||||
});
|
||||
|
||||
@@ -4,12 +4,14 @@ namespace App\Merchant\Controllers\Coupon;
|
||||
|
||||
use App\Merchant\Controllers\Controller;
|
||||
use App\Merchant\Exporters\CouponExport;
|
||||
use App\Models\ActivityRule;
|
||||
use App\Models\Coupon;
|
||||
use Auth;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class IndexController extends Controller
|
||||
{
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
$user = Auth::guard('merchant')->user();
|
||||
@@ -65,8 +67,7 @@ class IndexController extends Controller
|
||||
->whereIn('status', [2, 3])
|
||||
->orderBy('created_at', 'desc')->orderBy('id', 'desc')->paginate();
|
||||
|
||||
$all = Coupon::query()
|
||||
->where('user_id', $user->id)
|
||||
$all = Coupon::where('user_id', $user->id)
|
||||
->when($outlet, function ($q) use ($outlet) {
|
||||
$q->whereHas('outlet', function ($q) use ($outlet) {
|
||||
$q->whereHas('info', function ($q) use ($outlet) {
|
||||
@@ -102,11 +103,13 @@ class IndexController extends Controller
|
||||
'all' => $all->count(),
|
||||
'pass' => $pass->count(),
|
||||
'reject' => $reject->count(),
|
||||
'price' => $pass->sum('price'),
|
||||
'profit' => $pass->sum('profit'),
|
||||
'hasPrice' => $pass->where('is_profit', 1)->sum('profit'),
|
||||
// 'price' => $pass->sum('price'),
|
||||
// 'profit' => $pass->sum('profit'),
|
||||
// 'hasPrice' => $pass->where('is_profit', 1)->sum('profit'),
|
||||
];
|
||||
|
||||
$rules = ActivityRule::get();
|
||||
info(json_encode($rules));
|
||||
if ($action == 'search') {
|
||||
return view('Merchant::coupon.index', compact('coupons', 'data'));
|
||||
|
||||
@@ -115,11 +118,16 @@ class IndexController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function getData($request, $type)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 按照日期分润
|
||||
* @author 玄尘 2020-03-11
|
||||
* @param Request $request [description]
|
||||
* @return array|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
* @author 玄尘 2020-03-11
|
||||
*/
|
||||
public function profits(Request $request)
|
||||
{
|
||||
@@ -132,7 +140,10 @@ class IndexController extends Controller
|
||||
if ($list->isEmpty()) {
|
||||
return $this->error('分润失败!没有可处理的数据');
|
||||
}
|
||||
if (Coupon::where('user_id', $user->id)->whereDate('created_at', $date)->where('status', 2)->update(['status' => 4])) {
|
||||
if (Coupon::where('user_id', $user->id)
|
||||
->whereDate('created_at', $date)
|
||||
->where('status', 2)
|
||||
->update(['status' => 4])) {
|
||||
return $this->success('分润成功!');
|
||||
} else {
|
||||
return $this->error('分润失败!');
|
||||
@@ -154,6 +165,7 @@ class IndexController extends Controller
|
||||
if ($coupon->status == 2) {
|
||||
$coupon->status = 4;
|
||||
$coupon->save();
|
||||
|
||||
return $this->success('分润成功');
|
||||
} else {
|
||||
return $this->error('分润失败');
|
||||
|
||||
Reference in New Issue
Block a user