|
@@ -532,7 +532,7 @@ class OrderController extends Controller
|
532
|
532
|
|
533
|
533
|
//redis防重复数据
|
534
|
534
|
$phone = $request->input('receiverMobile');
|
535
|
|
-
|
|
535
|
+
|
536
|
536
|
$redisKey = 'seafood.order_phone_add.'.$phone;
|
537
|
537
|
$res = RedisModel::setnx($redisKey, 1);
|
538
|
538
|
if( $res == 0 ){
|
|
@@ -767,10 +767,13 @@ class OrderController extends Controller
|
767
|
767
|
|
768
|
768
|
$skus = array_keys($order_skus);
|
769
|
769
|
if(!empty($skus)){
|
770
|
|
- $goods = Goods::select('gs.id as sku_id', 'goods.id as goods_id', 'goods.name', 'gs.propsName as props_name', 'gs.price', 'gs.is_weigh')->leftJoin('goods_skus as gs', 'gs.goodsCode', '=', 'goods.id')->whereIn('gs.id', $skus)->orderBy('goods.id', 'desc')->get();
|
|
770
|
+ $goods = Goods::select('gs.id as sku_id', 'goods.id as goods_id', 'goods.name', 'gs.propsName as props_name', 'gs.price', 'gs.is_weigh', 'gs.is_white', 'gs.quantity')->leftJoin('goods_skus as gs', 'gs.goodsCode', '=', 'goods.id')->whereIn('gs.id', $skus)->orderBy('goods.id', 'desc')->get();
|
771
|
771
|
$goods = json_decode(json_encode($goods),true);
|
772
|
772
|
foreach($goods as $k=>&$v){
|
773
|
773
|
$v['num'] = $order_skus[$v['sku_id']];
|
|
774
|
+ //计算实际库存 -还未到卖家云的量
|
|
775
|
+ $w_num = DB::table('order_goods_skus')->where('sku_id', $v['sku_id'])->where('is_del',0)->where('order_id','!=',$id)->where('mj_status',0)->sum('num');
|
|
776
|
+ $v['quantity'] = $v['quantity'] - $w_num;
|
774
|
777
|
}
|
775
|
778
|
$order['goods'] = $goods;
|
776
|
779
|
}
|
|
@@ -1122,6 +1125,11 @@ class OrderController extends Controller
|
1122
|
1125
|
CustomerInfo::where('phone', $consum->phone)->update(['balance'=>$balance]);
|
1123
|
1126
|
}
|
1124
|
1127
|
|
|
1128
|
+ #更新order_goods_skus状态
|
|
1129
|
+ $mj_status = array();
|
|
1130
|
+ $mj_status['mj_status'] = 2;
|
|
1131
|
+ OrderGoodsSkus::where('order_id', $id)->where('is_del', 0)->update($mj_status);
|
|
1132
|
+
|
1125
|
1133
|
#记录操作日志
|
1126
|
1134
|
$self_id = session('admin_id');
|
1127
|
1135
|
$self_name = session('real_name');
|
|
@@ -1188,6 +1196,11 @@ class OrderController extends Controller
|
1188
|
1196
|
$balance = $cust->balance + $order->receivedAmount;
|
1189
|
1197
|
CustomerInfo::where('phone', $consum->phone)->update(['balance'=>$balance]);
|
1190
|
1198
|
}
|
|
1199
|
+
|
|
1200
|
+ #更新order_goods_skus状态,退回库存
|
|
1201
|
+ $mj_status = array();
|
|
1202
|
+ $mj_status['mj_status'] = 2;
|
|
1203
|
+ OrderGoodsSkus::where('order_id', $id)->where('is_del', 0)->update($mj_status);
|
1191
|
1204
|
|
1192
|
1205
|
#记录操作日志
|
1193
|
1206
|
$self_id = session('admin_id');
|
|
@@ -1272,6 +1285,10 @@ class OrderController extends Controller
|
1272
|
1285
|
if( $syncMj == false ){
|
1273
|
1286
|
throw new Exception("订单同步到卖家云失败");
|
1274
|
1287
|
}
|
|
1288
|
+ #同步到卖家云,更新order_goods_skus状态
|
|
1289
|
+ $mj_status = array();
|
|
1290
|
+ $mj_status['mj_status'] = 1;
|
|
1291
|
+ OrderGoodsSkus::where('order_id', $id)->where('is_del', 0)->update($mj_status);
|
1275
|
1292
|
}
|
1276
|
1293
|
}
|
1277
|
1294
|
|