diff --git a/app/controller/api/Spu.php b/app/controller/api/Spu.php index d1301de..14b0e4c 100755 --- a/app/controller/api/Spu.php +++ b/app/controller/api/Spu.php @@ -27,6 +27,8 @@ class Spu extends Base */ public function category(): Json { + $list = SpuRepository::getInstance()->category(0,["id,pid,title,cover"])->toArray(); + return $this->json(0, 'success', $list); if(input("hasChildren/d",0)){ $list = SpuRepository::getInstance()->categoryAll(["id,sort,pid,title,cover"]); diff --git a/app/repository/OrderRepository.php b/app/repository/OrderRepository.php index f95a494..ba47373 100755 --- a/app/repository/OrderRepository.php +++ b/app/repository/OrderRepository.php @@ -338,7 +338,7 @@ class OrderRepository extends Repository $arr['id'] = $sku['id']; $arr['stock'] = Db::raw('`stock` - '.($dataSku[$sku['coding']] ?? 1));; $updateSkuStock[] = $arr; - $updateSpuStock["spu_id"] = $sku['spu_id']; + $updateSpuStock[$sku['spu_id']] = $sku['spu_id']; } (new Sku())->saveAll($updateSkuStock); @@ -410,8 +410,8 @@ class OrderRepository extends Repository 'is_only' => isset($data['is_only']) && $data['is_only'] > 0 ? 1 : 0, 'is_score' => $data['is_score'] ?? 0, - 'wedding_date' => $data['wedding_date'] ?? null, - 'expected_delivery_date' => $data['expected_delivery_date'] ?? null, + 'wedding_date' => !empty($data['wedding_date']) ?$data['wedding_date']: null, + 'expected_delivery_date' => !empty($data['expected_delivery_date']) ?$data['expected_delivery_date']: null, 'address' => $data['address'] ?? '', 'phone' => $data['phone'] ?? '', 'contacts' => $data['contacts'] ?? '', diff --git a/public/static/manager/js/mall/spu.js b/public/static/manager/js/mall/spu.js index c94d8d8..a0d778f 100755 --- a/public/static/manager/js/mall/spu.js +++ b/public/static/manager/js/mall/spu.js @@ -50,7 +50,12 @@ layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect', 'laydate' // }, align: 'center' // }, {field: 'price', title: '价格(¥)'}, - {field: 'stock', title: '总库存', minWidth: 100}, + {templet: function (d) { + if(d.stock<=50){ + return ""+d.stock+"" + } + return d.stock; + }, title: '总库存', minWidth: 100}, // {field: 'amount', title: '销量(含初始销量)', minWidth: 100}, // {field: 'init_amount', title: '初始销量', minWidth: 100}, // {field: 'saleable_text', title: '状态', width: 150},