From 4a0615e63724df0326ff114e59b67d5e53d13757 Mon Sep 17 00:00:00 2001 From: Devil Date: Wed, 23 Dec 2020 17:32:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=8F=90=E4=BA=A4=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E3=80=81=E4=BB=93=E5=BA=93=E8=87=AA=E5=8A=A8=E6=8B=86?= =?UTF-8?q?=E5=8D=95=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/index/view/default/buy/index.html | 3 +-- application/service/OrderSplitService.php | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/application/index/view/default/buy/index.html b/application/index/view/default/buy/index.html index 375652d22..3b2e73ea8 100755 --- a/application/index/view/default/buy/index.html +++ b/application/index/view/default/buy/index.html @@ -652,8 +652,7 @@ function BuySubmitBack(e) Prompt(e.msg, 'success'); setTimeout(function() { - window.open(e.data.jump_url, '_blank'); - window.close(); + window.location.href = e.data.jump_url; }, 1500); } else { $('form.form-validation').find('button[type="submit"]').button('reset'); diff --git a/application/service/OrderSplitService.php b/application/service/OrderSplitService.php index 6f8322c4d..e558a5fd2 100644 --- a/application/service/OrderSplitService.php +++ b/application/service/OrderSplitService.php @@ -233,6 +233,9 @@ class OrderSplitService */ public static function GoodsWarehouseAggregate($data) { + // 默认仓库 + $warehouse_default = []; + // 数据分组 $result = []; foreach($data as $v) @@ -242,18 +245,16 @@ class OrderSplitService // 获取商品库存 $where = [ - 'wgs.goods_id' => $v['goods_id'], - 'wgs.md5_key' => md5(implode('', array_column($spec, 'value'))), - 'wg.is_enable' => 1, - 'w.is_enable' => 1, - 'w.is_delete_time' => 0, + ['wgs.goods_id', '=', $v['goods_id']], + ['wgs.md5_key', '=', md5(implode('', array_column($spec, 'value')))], + ['wgs.inventory', '>', 0], + ['wg.is_enable', '=', 1], + ['w.is_enable', '=', 1], + ['w.is_delete_time', '=', 0], ]; $field = 'distinct w.id,w.name,w.alias,w.lng,w.lat,w.province,w.city,w.county,w.address,wgs.inventory,w.is_default,w.level'; $warehouse = Db::name('WarehouseGoodsSpec')->alias('wgs')->join(['__WAREHOUSE_GOODS__'=>'wg'], 'wgs.warehouse_id=wg.warehouse_id')->join(['__WAREHOUSE__'=>'w'], 'wg.warehouse_id=w.id')->where($where)->field($field)->order('w.level desc,w.is_default desc,wgs.inventory desc')->select(); - // 默认仓库 - $warehouse_default = []; - // 商品仓库分组 if(!empty($warehouse)) { @@ -266,7 +267,7 @@ class OrderSplitService $temp_v = $v; // 购买数量计算 - if($temp_v['stock'] > $w['inventory']) + if($temp_v['stock'] > $w['inventory'] && $w['inventory'] > 0) { $temp_v['stock'] = $w['inventory']; }