|
@@ -414,8 +414,8 @@ class Classification extends Api |
|
@@ -414,8 +414,8 @@ class Classification extends Api |
414
|
$goods_spec = Db::name('litestore_goods_spec')
|
414
|
$goods_spec = Db::name('litestore_goods_spec')
|
415
|
->where('goods_id', $item['goods_id'])
|
415
|
->where('goods_id', $item['goods_id'])
|
416
|
->find();
|
416
|
->find();
|
417
|
- $item['price'] = $goods_spec['goods_price'];
|
|
|
418
|
- $item['line_price'] = $goods_spec['line_price'];
|
417
|
+ $item['price'] = round($goods_spec['goods_price'], 2);
|
|
|
418
|
+ $item['line_price'] = round($goods_spec['line_price'], 2);
|
419
|
//判断是否打折
|
419
|
//判断是否打折
|
420
|
$item['is_discount'] = 'is';
|
420
|
$item['is_discount'] = 'is';
|
421
|
if ($goods_spec['goods_price'] == $goods_spec['line_price']) {
|
421
|
if ($goods_spec['goods_price'] == $goods_spec['line_price']) {
|
|
@@ -452,9 +452,11 @@ class Classification extends Api |
|
@@ -452,9 +452,11 @@ class Classification extends Api |
452
|
$goods_spec = GoodsSpec::all(['goods_id' => $item['goods_id']]);
|
452
|
$goods_spec = GoodsSpec::all(['goods_id' => $item['goods_id']]);
|
453
|
foreach ($goods_spec as &$spec_value) {
|
453
|
foreach ($goods_spec as &$spec_value) {
|
454
|
//规格下的购物车数量
|
454
|
//规格下的购物车数量
|
455
|
- $spec_value['cart_number'] = Db::name('cart')
|
455
|
+ $number = Db::name('cart')
|
456
|
->where(['goods_id' => $spec_value['goods_id'], 'sku_id' => $spec_value['goods_spec_id'], 'user_id' => $this->auth->id])
|
456
|
->where(['goods_id' => $spec_value['goods_id'], 'sku_id' => $spec_value['goods_spec_id'], 'user_id' => $this->auth->id])
|
457
|
->value('number');
|
457
|
->value('number');
|
|
|
458
|
+
|
|
|
459
|
+ $spec_value['cart_number'] = $number ?? 0;
|
458
|
//判断是否打折
|
460
|
//判断是否打折
|
459
|
$spec_value['is_discount'] = 'is';
|
461
|
$spec_value['is_discount'] = 'is';
|
460
|
if ($spec_value['goods_price'] == $spec_value['line_price']) {
|
462
|
if ($spec_value['goods_price'] == $spec_value['line_price']) {
|
|
@@ -482,8 +484,8 @@ class Classification extends Api |
|
@@ -482,8 +484,8 @@ class Classification extends Api |
482
|
$goods_spec = Db::name('litestore_goods_spec')
|
484
|
$goods_spec = Db::name('litestore_goods_spec')
|
483
|
->where('goods_id', $item['goods_id'])
|
485
|
->where('goods_id', $item['goods_id'])
|
484
|
->find();
|
486
|
->find();
|
485
|
- $item['price'] = $goods_spec['goods_price'];
|
|
|
486
|
- $item['line_price'] = $goods_spec['line_price'];
|
487
|
+ $item['price'] = round($goods_spec['goods_price'], 2);
|
|
|
488
|
+ $item['line_price'] = round($goods_spec['line_price'], 2);
|
487
|
//判断是否打折
|
489
|
//判断是否打折
|
488
|
$item['is_discount'] = 'is';
|
490
|
$item['is_discount'] = 'is';
|
489
|
if ($goods_spec['goods_price'] == $goods_spec['line_price']) {
|
491
|
if ($goods_spec['goods_price'] == $goods_spec['line_price']) {
|
|
@@ -521,9 +523,11 @@ class Classification extends Api |
|
@@ -521,9 +523,11 @@ class Classification extends Api |
521
|
foreach ($goods_spec as &$spec_value) {
|
523
|
foreach ($goods_spec as &$spec_value) {
|
522
|
|
524
|
|
523
|
//规格下的购物车数量
|
525
|
//规格下的购物车数量
|
524
|
- $spec_value['cart_number'] = Db::name('cart')
|
526
|
+ $number = Db::name('cart')
|
525
|
->where(['goods_id' => $spec_value['goods_id'], 'sku_id' => $spec_value['goods_spec_id'], 'user_id' => $this->auth->id])
|
527
|
->where(['goods_id' => $spec_value['goods_id'], 'sku_id' => $spec_value['goods_spec_id'], 'user_id' => $this->auth->id])
|
526
|
->value('number');
|
528
|
->value('number');
|
|
|
529
|
+
|
|
|
530
|
+ $spec_value['cart_number'] = $number ?? 0;
|
527
|
//判断是否打折
|
531
|
//判断是否打折
|
528
|
$spec_value['is_discount'] = 'is';
|
532
|
$spec_value['is_discount'] = 'is';
|
529
|
if ($spec_value['goods_price'] == $spec_value['line_price']) {
|
533
|
if ($spec_value['goods_price'] == $spec_value['line_price']) {
|