|
@@ -116,18 +116,21 @@ class OrderController extends Controller
|
116
|
116
|
);
|
117
|
117
|
|
118
|
118
|
foreach($result as $k=>&$v){
|
119
|
|
-
|
|
119
|
+ //毛利 40%下
|
|
120
|
+ $v['pre_cost_flag'] = 0;
|
120
|
121
|
//获取商品信息
|
121
|
122
|
$v['goods'] = '';
|
122
|
123
|
$goods = DB::table('order_goods_skus')->where('order_id', $v['id'])->where('is_del', 0)->get();
|
123
|
124
|
if(!empty($goods)){
|
|
125
|
+ $v['pre_cost'] = 0;
|
124
|
126
|
foreach($goods as $item){
|
125
|
127
|
$goods_name = Goods::where('id', $item->goods_id)->pluck('name');
|
126
|
|
- $goods_sku_info = GoodsSkus::select('propsName', 'is_weigh')->where('id', $item->sku_id)->first();
|
|
128
|
+ $goods_sku_info = GoodsSkus::select('propsName', 'is_weigh', 'referenceCost')->where('id', $item->sku_id)->first();
|
127
|
129
|
if(!empty($goods_sku_info)){
|
128
|
130
|
$props_name = $goods_sku_info->propsName;
|
129
|
131
|
$is_weigh = $goods_sku_info->is_weigh;
|
130
|
132
|
$weigh_note = $is_weigh==1 ? '重量(斤)':'数量';
|
|
133
|
+ $v['pre_cost'] += $goods_sku_info->referenceCost * $item->num;
|
131
|
134
|
}else{
|
132
|
135
|
$props_name = '';
|
133
|
136
|
$weigh_note = '数量';
|
|
@@ -135,6 +138,11 @@ class OrderController extends Controller
|
135
|
138
|
|
136
|
139
|
$v['goods'][] = $goods_name.'('.$props_name.') '.$weigh_note.':'.$item->num.'';
|
137
|
140
|
}
|
|
141
|
+ $v['pre_cost'] = round($v['pre_cost'], 2);
|
|
142
|
+
|
|
143
|
+ if( ($v['receivedAmount'] - $v['pre_cost']) / $v['receivedAmount'] < 0.4){
|
|
144
|
+ $v['pre_cost_flag'] = 1;
|
|
145
|
+ }
|
138
|
146
|
}
|
139
|
147
|
|
140
|
148
|
#加粉时间
|
|
@@ -170,7 +178,10 @@ class OrderController extends Controller
|
170
|
178
|
$v['payment_type'] = '充值卡支付';
|
171
|
179
|
}else{
|
172
|
180
|
$v['payment_type'] = '';
|
173
|
|
- }
|
|
181
|
+ }
|
|
182
|
+
|
|
183
|
+ //计算毛利率
|
|
184
|
+
|
174
|
185
|
}
|
175
|
186
|
|
176
|
187
|
$yestoday = date('Y-m-d', strtotime('-1 day'));
|
|
@@ -191,6 +202,7 @@ class OrderController extends Controller
|
191
|
202
|
if($team_id>0) $query->where('team_id', $team_id);
|
192
|
203
|
})->where('id','>', 1)->where('is_use', 1)->get();
|
193
|
204
|
$adminList = json_decode(json_encode($adminList), true);
|
|
205
|
+
|
194
|
206
|
return view('order/orderlist', ['result' =>$result,
|
195
|
207
|
'page' =>$page,
|
196
|
208
|
'count' =>$count,
|
|
@@ -943,10 +955,9 @@ class OrderController extends Controller
|
943
|
955
|
}
|
944
|
956
|
|
945
|
957
|
//判断生日礼
|
946
|
|
- $birth_stime = date('m-d', strtotime($customer_info->birthday.' -3 day'));
|
947
|
|
- $birth_etime = date('m-d', strtotime($customer_info->birthday.' +3 day'));
|
948
|
|
- $today = date('m-d');
|
949
|
|
- if($today>=$birth_stime && $today<=$birth_etime){
|
|
958
|
+ $birth_time = date('m', strtotime($customer_info->birthday));
|
|
959
|
+ $tom = date('m');
|
|
960
|
+ if($tom==$birth_stime){
|
950
|
961
|
//生日期内,判断是否已领
|
951
|
962
|
$if_b_gift = DB::table('customer_gift_receives')->where('phone', $phone)->where('is_del',0)->where('gift_type', 1)->where('dtime', '>=', $mtime)->first();
|
952
|
963
|
if(empty($if_b_gift)){
|
|
@@ -2299,11 +2310,10 @@ class OrderController extends Controller
|
2299
|
2310
|
}
|
2300
|
2311
|
|
2301
|
2312
|
//判断生日礼
|
2302
|
|
- $birth_stime = date('m-d', strtotime($customer_info->birthday.' -3 day'));
|
2303
|
|
- $birth_etime = date('m-d', strtotime($customer_info->birthday.' +3 day'));
|
2304
|
|
- $today = date('m-d');
|
|
2313
|
+ $birth_time = date('m', strtotime($customer_info->birthday));
|
|
2314
|
+ $tom = date('m');
|
2305
|
2315
|
$customer_info->if_b_gift = 0;
|
2306
|
|
- if($today>=$birth_stime && $today<=$birth_etime){
|
|
2316
|
+ if($tom == $birth_time){
|
2307
|
2317
|
//生日期内,判断是否已领
|
2308
|
2318
|
$if_b_gift = DB::table('customer_gift_receives')->where('phone', $phone)->where('is_del',0)->where('gift_type', 1)->where('dtime', '>=', $mtime)->first();
|
2309
|
2319
|
if(empty($if_b_gift)){
|