|
@@ -532,20 +532,20 @@ class GoodsController extends Controller
|
532
|
532
|
{
|
533
|
533
|
$this->validate($request, [
|
534
|
534
|
'propsName' => 'required',
|
535
|
|
- 'price' => 'required',
|
|
535
|
+ //'price' => 'required',
|
536
|
536
|
], [
|
537
|
537
|
'propsName.required' => '规格不能为空',
|
538
|
|
- 'price.required' => '价格不能为空',
|
|
538
|
+ //'price.required' => '价格不能为空',
|
539
|
539
|
]);
|
540
|
540
|
$id = (int)$request->input('id');
|
541
|
541
|
$goods_id = (int)$request->input('goods_id');
|
542
|
542
|
$data = array();
|
543
|
543
|
$data['propsName'] = $request->input('propsName');
|
544
|
|
- $data['price'] = $request->input('price');
|
545
|
|
- $data['tagPrice'] = $request->input('tagPrice');
|
546
|
|
- $data['referenceCost'] = $request->input('referenceCost');
|
|
544
|
+ if($request->input('price') > 0) $data['price'] = $request->input('price');
|
|
545
|
+ if($request->input('tagPrice') > 0) $data['tagPrice'] = $request->input('tagPrice');
|
|
546
|
+ if($request->input('referenceCost') > 0) $data['referenceCost'] = $request->input('referenceCost');
|
547
|
547
|
$data['is_weigh'] = (int)$request->input('is_weigh');
|
548
|
|
- $data['outPrice'] = $request->input('outPrice');
|
|
548
|
+ if($request->input('outPrice') > 0) $data['outPrice'] = $request->input('outPrice');
|
549
|
549
|
|
550
|
550
|
DB::beginTransaction();
|
551
|
551
|
try{
|
|
@@ -558,14 +558,14 @@ class GoodsController extends Controller
|
558
|
558
|
$erpArr['skuId'] = $sku->erpSkuId;
|
559
|
559
|
if($data['is_weigh'] == 1){
|
560
|
560
|
$erpArr['propsName'] = str_replace('【按半斤称重】', '', $sku->propsName).'【按半斤称重】';
|
561
|
|
- $erpArr['price'] = round( $sku->price/2, 2 );
|
562
|
|
- $erpArr['tagPrice'] = round( $sku->tagPrice/2, 2 );
|
563
|
|
- $erpArr['referenceCost'] = round( $sku->referenceCost/2, 2 );
|
|
561
|
+ if($request->input('price') > 0) $erpArr['price'] = round( $sku->price/2, 2 );
|
|
562
|
+ if($request->input('tagPrice') > 0) $erpArr['tagPrice'] = round( $sku->tagPrice/2, 2 );
|
|
563
|
+ if($request->input('referenceCost') > 0) $erpArr['referenceCost'] = round( $sku->referenceCost/2, 2 );
|
564
|
564
|
}else{
|
565
|
565
|
$erpArr['propsName'] = str_replace('【按半斤称重】', '', $sku->propsName);
|
566
|
|
- $erpArr['price'] = $sku->price;
|
567
|
|
- $erpArr['tagPrice'] = $sku->tagPrice;
|
568
|
|
- $erpArr['referenceCost'] = $sku->referenceCost;
|
|
566
|
+ if($request->input('price') > 0) $erpArr['price'] = $sku->price;
|
|
567
|
+ if($request->input('tagPrice') > 0) $erpArr['tagPrice'] = $sku->tagPrice;
|
|
568
|
+ if($request->input('referenceCost') > 0) $erpArr['referenceCost'] = $sku->referenceCost;
|
569
|
569
|
}
|
570
|
570
|
|
571
|
571
|
$erp_up = Order::mjErpSkuUpdate($erpArr);
|
|
@@ -579,7 +579,7 @@ class GoodsController extends Controller
|
579
|
579
|
$shopArr['goodsCode'] = $sku->goodsCode;
|
580
|
580
|
$shopArr['outerCode'] = $sku->id;
|
581
|
581
|
$shopArr['propsName'] = $sku->propsName;
|
582
|
|
- $shopArr['price'] = $erpArr['price'];
|
|
582
|
+ if($request->input('price') > 0) $shopArr['price'] = $erpArr['price'];
|
583
|
583
|
|
584
|
584
|
$sku_up = Order::mjSkuUpdate($shopArr);
|
585
|
585
|
if( $sku_up == false ){
|