From 19df41c8d4497d08fb056f1fce3a3ca4bec14c41 Mon Sep 17 00:00:00 2001
From: wuhui_zzw <1760308791@qq.com>
Date: Wed, 20 Sep 2023 14:49:44 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E5=A2=9E=E5=8A=A0?=
=?UTF-8?q?=E8=AE=A1=E9=87=8F=E5=8D=95=E4=BD=8D=E5=B9=B6=E4=B8=94=E5=9C=A8?=
=?UTF-8?q?=E5=95=86=E5=93=81=E7=BB=84=E4=BB=B6=E5=92=8C=E5=95=86=E5=93=81?=
=?UTF-8?q?=E8=AF=A6=E6=83=85=E4=B8=AD=E6=98=BE=E7=A4=BA=E3=80=82=E6=94=AF?=
=?UTF-8?q?=E6=8C=81=E5=A4=9A=E8=AF=AD=E8=A8=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
beike/Models/ProductDescription.php | 2 +-
beike/Shop/Http/Resources/CartDetail.php | 4 +++
beike/Shop/Http/Resources/ProductDetail.php | 1 +
beike/Shop/Http/Resources/ProductSimple.php | 3 +++
.../views/pages/products/form/form.blade.php | 9 +++----
resources/lang/en/product.php | 3 ++-
resources/lang/zh_cn/product.php | 3 ++-
themes/default/product/product.blade.php | 25 +++++++++---------
themes/default/shared/product.blade.php | 26 ++++++++++++-------
9 files changed, 46 insertions(+), 30 deletions(-)
diff --git a/beike/Models/ProductDescription.php b/beike/Models/ProductDescription.php
index 78c6f341..90bea26f 100644
--- a/beike/Models/ProductDescription.php
+++ b/beike/Models/ProductDescription.php
@@ -8,5 +8,5 @@ class ProductDescription extends Base
{
use HasFactory;
- protected $fillable = ['locale', 'name', 'content', 'meta_title', 'meta_description', 'meta_keywords'];
+ protected $fillable = ['locale', 'name', 'content', 'meta_title', 'meta_description', 'meta_keywords', 'unit'];
}
diff --git a/beike/Shop/Http/Resources/CartDetail.php b/beike/Shop/Http/Resources/CartDetail.php
index ceb00e35..bade6f77 100644
--- a/beike/Shop/Http/Resources/CartDetail.php
+++ b/beike/Shop/Http/Resources/CartDetail.php
@@ -26,7 +26,9 @@ class CartDetail extends JsonResource
};
$skuCode = $sku->sku;
$description = $product->description;
+
$productName = $description->name;
+ $unit = $description->unit ?? '';
$subTotal = $price * $this->quantity;
$image = $sku->image ?: $product->image;
@@ -37,6 +39,8 @@ class CartDetail extends JsonResource
'product_sku' => $skuCode,
'name' => $productName,
'name_format' => sub_string($productName),
+ 'unit' => $unit,
+ 'unit_format' => $unit,
'image' => $image,
'image_url' => image_resize($image),
'quantity' => $this->quantity,
diff --git a/beike/Shop/Http/Resources/ProductDetail.php b/beike/Shop/Http/Resources/ProductDetail.php
index 573279a9..183c8f5b 100644
--- a/beike/Shop/Http/Resources/ProductDetail.php
+++ b/beike/Shop/Http/Resources/ProductDetail.php
@@ -34,6 +34,7 @@ class ProductDetail extends JsonResource
return [
'id' => $this->id,
'name' => $this->description->name ?? '',
+ 'unit' => $this->description->unit ?? '',
'description' => $this->description->content ?? '',
'meta_title' => $this->description->meta_title ?? '',
'meta_keywords' => $this->description->meta_keywords ?? '',
diff --git a/beike/Shop/Http/Resources/ProductSimple.php b/beike/Shop/Http/Resources/ProductSimple.php
index 91fe4c18..b46f343d 100644
--- a/beike/Shop/Http/Resources/ProductSimple.php
+++ b/beike/Shop/Http/Resources/ProductSimple.php
@@ -31,6 +31,7 @@ class ProductSimple extends JsonResource
}
$name = $this->description->name ?? '';
+ $unit = $this->description->unit ?? '';
$images = $this->images != NULL ? $this->images : [];
$data = [
@@ -38,6 +39,8 @@ class ProductSimple extends JsonResource
'sku_id' => $masterSku->id,
'name' => $name,
'name_format' => $name,
+ 'unit' => $unit,
+ 'unit_format' => $unit,
'url' => $this->url,
'price' => $masterSku->price,
'origin_price' => $masterSku->origin_price,
diff --git a/resources/beike/admin/views/pages/products/form/form.blade.php b/resources/beike/admin/views/pages/products/form/form.blade.php
index f6f64b1d..2be41d44 100644
--- a/resources/beike/admin/views/pages/products/form/form.blade.php
+++ b/resources/beike/admin/views/pages/products/form/form.blade.php
@@ -136,7 +136,9 @@
- {{--