|
@@ -485,7 +485,29 @@ class OrderController extends Controller
|
485
|
485
|
$self_role = session('role_name');
|
486
|
486
|
$createTime = date('Y-m-d H:i:s');
|
487
|
487
|
|
488
|
|
- return view('order/ordercreate', ['categorylist' => $catelist, 'adminlist'=>$adminList, 'teamlist'=>$teamList, 'self_role'=>$self_role, 'createTime'=>$createTime, 'last_url' => $_SERVER['HTTP_REFERER']]);
|
|
488
|
+ //当月礼品
|
|
489
|
+ $mtime = date('Y-m-01');
|
|
490
|
+ $gift_info = DB::table('customer_month_gift')->where('mtime', $mtime)->get();
|
|
491
|
+ $gift_info = json_decode(json_encode($gift_info), true);
|
|
492
|
+ $m_gift=array();
|
|
493
|
+ $b_gift=array();
|
|
494
|
+ foreach($gift_info as $k=>$v){
|
|
495
|
+ //获取礼品信息
|
|
496
|
+ $goods_name = Goods::where('id', $v['goods_id'])->pluck('name');
|
|
497
|
+ $sku = GoodsSkus::where('id', $v['sku_id'])->first();
|
|
498
|
+ $data = array();
|
|
499
|
+ $data['id'] = $v['id'];
|
|
500
|
+ $data['goods_name'] = $goods_name;
|
|
501
|
+ $data['propsName'] = $sku['propsName'];
|
|
502
|
+ $data['price'] = $sku['price'];
|
|
503
|
+ if($v['type'] == 0){
|
|
504
|
+ $m_gift[] = $data;
|
|
505
|
+ }else{
|
|
506
|
+ $b_gift[] = $data;
|
|
507
|
+ }
|
|
508
|
+ }
|
|
509
|
+
|
|
510
|
+ return view('order/ordercreate', ['categorylist' => $catelist, 'adminlist'=>$adminList, 'teamlist'=>$teamList, 'self_role'=>$self_role, 'createTime'=>$createTime, 'last_url' => $_SERVER['HTTP_REFERER'], 'm_gift'=>$m_gift, 'b_gift'=>$b_gift]);
|
489
|
511
|
}
|
490
|
512
|
/**
|
491
|
513
|
* 分组管理-进行添加操作
|
|
@@ -1938,5 +1960,48 @@ class OrderController extends Controller
|
1938
|
1960
|
return $mjOrder['order'];
|
1939
|
1961
|
}
|
1940
|
1962
|
|
|
1963
|
+ /**
|
|
1964
|
+ * 获取手机号会员信息
|
|
1965
|
+ */
|
|
1966
|
+ public function getVip(Request $request){
|
|
1967
|
+ $phone = $request->input('phone');
|
|
1968
|
+ $time = date('Y-m-d H:i:s');
|
|
1969
|
+ $customer_info = DB::table('customer_vip')->where('phone', $phone)->where('is_del', 0)->first();
|
|
1970
|
+ if(!empty($customer_info)){
|
|
1971
|
+ //判断是否过期
|
|
1972
|
+ if($customer_info->vip_end_time > $time){
|
|
1973
|
+ //未过期,1.获取优惠券,获取当月礼,获取生日礼,判断领取
|
|
1974
|
+ $coupons = DB::table('customer_coupons')->where('phone', $phone)->where('is_use', 0)->where('end_time', '>', $time)->first();
|
|
1975
|
+ $customer_info->coupons = $coupons;
|
|
1976
|
+ //判断是否领取当月礼
|
|
1977
|
+ $mtime = date('Y-m-01');
|
|
1978
|
+ $if_m_gift = DB::table('customer_gift_receives')->where('phone', $phone)->where('is_del',0)->where('gift_type', 0)->where('dtime', '>=', $mtime)->first();
|
|
1979
|
+ $customer_info->if_m_gift = 0;
|
|
1980
|
+ if(empty($if_m_gift)){
|
|
1981
|
+ $customer_info->if_m_gift = 1;
|
|
1982
|
+ }
|
|
1983
|
+
|
|
1984
|
+ //判断生日礼
|
|
1985
|
+ $birth_stime = date('m-d', strtotime($customer_info->birthday.' -3 day'));
|
|
1986
|
+ $birth_etime = date('m-d', strtotime($customer_info->birthday.' +3 day'));
|
|
1987
|
+ $today = date('m-d');
|
|
1988
|
+ $customer_info->if_b_gift = 0;
|
|
1989
|
+ if($today>=$birth_stime && $today<=$birth_etime){
|
|
1990
|
+ //生日期内,判断是否已领
|
|
1991
|
+ $if_b_gift = DB::table('customer_gift_receives')->where('phone', $phone)->where('is_del',0)->where('gift_type', 1)->where('dtime', '>=', $mtime)->first();
|
|
1992
|
+ if(empty($if_b_gift)){
|
|
1993
|
+ $customer_info->if_b_gift = 1;
|
|
1994
|
+ }
|
|
1995
|
+ }
|
|
1996
|
+
|
|
1997
|
+ $customer_info = json_encode($customer_info);
|
|
1998
|
+ exit(['code'=>0, 'data'=>$customer_info]);
|
|
1999
|
+ }
|
|
2000
|
+ exit(['code'=>1,'msg'=>'会员过期']);
|
|
2001
|
+ }
|
|
2002
|
+
|
|
2003
|
+ exit(['code'=>1,'msg'=>'不是会员']);
|
|
2004
|
+ }
|
|
2005
|
+
|
1941
|
2006
|
}
|
1942
|
2007
|
|