Browse Source

优化订单功能

jun 5 months ago
parent
commit
0734d3bf3b

+ 1 - 0
.gitignore

@@ -7,6 +7,7 @@
 /storage/framework/testing/*
 /storage/framework/views/*
 /elkconf
+/public/uploads/*
 /public/uploads/product/*
 /public/uploads/score_product/*
 /public/uploads/company/*

+ 5 - 0
app/Http/Controllers/Admin/Orders.php

@@ -52,6 +52,7 @@ class Orders extends Auth{
 		$status					= request('status',0);
 		$startTime				= request('start_time','');
 		$endTime				= request('end_time','');
+		$is_regiment			= request('is_regiment','');
 		// 编码转ID
 		$id						= $code ? $Model->codeToId($code) : 0;
 		$productId				= $productCode ? $Product->codeToId($productCode) : 0;
@@ -72,6 +73,10 @@ class Orders extends Auth{
 		if( $startTime )		$map[] = ['orders_product.insert_time','>=',strtotime($startTime)];
 		if( $endTime )			$map[] = ['orders_product.insert_time','<=',strtotime($endTime)];
 		if( $status )			$map[] = ['orders_product.status','=',$status];
+        if($is_regiment){
+            if( $is_regiment == 1)		$map[] = ['orders.regiment_id','>',0];
+            if( $is_regiment == 2)		$map[] = ['orders.regiment_id','=',0];
+        }
 		// 查询数据
 		$list					= $OrdersProduct->query()
 									->join('custom','orders_product.custom_uid','=','custom.uid')

+ 2 - 2
app/Http/Controllers/Api/Orders.php

@@ -707,8 +707,8 @@ class Orders extends Api{
             // 判断库存
             if( $productInfo['stock'] < $productList[$buyInfo['product_id']]['decr'] )  return json_send(['code'=>'error','msg'=>$productInfo['product_name'].'-库存不足','data'=>['error'=>'产品库存不足=>'.$buyInfo['product_id']]]);
             // 计算价值
-            $priceTotal					= $buyInfo['buy_num'] * $regimentActiveInfo['regiment_price'];
-            $payTotal					= $buyInfo['buy_num'] * $productInfo['price'];
+            $priceTotal					= $buyInfo['buy_num'] * $productInfo['price'];
+            $payTotal					= $buyInfo['buy_num'] * $regimentActiveInfo['regiment_price'];
         }
         $orderInfo = [
             'custom_uid'		    => $uid,

+ 1 - 1
app/Models/PromoProduct.php

@@ -178,7 +178,7 @@ class PromoProduct extends Model
             if ($reduction){
                 foreach ($value as $k=>$v){
                     // 优惠价格 = 价格占总价的比例 * 优惠的总价
-                    $productPrice[$v['product_id']]['promo_rebate_price']          = number_format( $reduction * ($productPrice[$v['product_id']]['price_total'] / $reduction) , 2 , '.' ,'');
+                    $productPrice[$v['product_id']]['promo_rebate_price']          = number_format( $reduction * ($productPrice[$v['product_id']]['price_total'] / $priceSum) , 2 , '.' ,'');
                 }
             }
         }

BIN
public/uploads/ueditor/images/admin/1/20240911/thumb.jpg


+ 9 - 0
resources/views/admin/orders/index.blade.php

@@ -49,6 +49,13 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 			<option value="4" @if ( request('status') === '4' ) selected="selected" @endif >已取消</option>
 		</select>
 	</div>
+	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-12" style="margin-right: 2px;">
+		<select name="is_regiment" class="form-control">
+			<option value="" >是否团单</option>
+			<option value="1" @if ( request('is_regiment') === '1' ) selected="selected" @endif >是</option>
+			<option value="2" @if ( request('is_regiment') === '2' ) selected="selected" @endif >否</option>
+		</select>
+	</div>
 	<div class="form-group col col-lg-2 col-md-2 col-sm-2 col-xs-12" style="margin-right: 2px;">
 		<select name="orders_other" class="form-control">
 			<option value="0" >订单分类</option>
@@ -90,6 +97,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 						<th>收货地址</th>
 						<th>订单状态</th>
 						<th>下单时间</th>
+						<th>是否团单</th>
 						<th>操作</th>
 					</tr>
 				</thead>
@@ -109,6 +117,7 @@ style="margin: 0 auto;width: 96%;padding: 30px 0px;"
 						<td>{{$a['contact_province']}}/{{$a['contact_city']}}/{{$a['contact_area']}}/{{$a['contact_addr']}} {{$a['contact_shop']}}</td>
 						<td>{{$a['state']}}</td>
 						<td>{{date('Y-m-d H:i:s',$a['insert_time'])}}</td>
+						<td>{{$a['regiment_id']>0?'是':'否'}}</td>
 						<td>
 							@if( check_auth('admin/orders/detail') )
 								@if( $a['status']==9 )