From 3f9cf4d3482970e1d0818a0aa413f35d0038bd61 Mon Sep 17 00:00:00 2001
From: guoshengdong <q506072785@163.com>
Date: Thu, 16 Jan 2025 17:56:25 +0800
Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E4=B8=9A?=
 =?UTF-8?q?=E5=8A=A1=E7=BB=84=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 package-lock.json | 8 ++++----
 package.json      | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index 611e0ad9..f21fb187 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -15,7 +15,7 @@
         "@dt/fe-capacitor": "^1.0.10",
         "@dt/ui-ionic-icon": "^1.2.21",
         "@dt/ui-mobile": "^2.1.15",
-        "@dt/ui-mobile-business": "^2.1.47",
+        "@dt/ui-mobile-business": "^2.1.48",
         "@ionic/react": "8.2.7",
         "@ionic/react-router": "8.2.7",
         "cross-env": "^7.0.3",
@@ -2559,9 +2559,9 @@
       }
     },
     "node_modules/@dt/ui-mobile-business": {
-      "version": "2.1.47",
-      "resolved": "http://nexus.downtown8.com:8081/repository/npm/@dt/ui-mobile-business/-/ui-mobile-business-2.1.47.tgz",
-      "integrity": "sha512-GGYrLWxIrD+aJEFxVU/M0MigdUATXPI3a+d+zqi/weMbzzunf5mOc0vAPdclRVo6ay9cHdcIWQK0SDpokQ+PqQ==",
+      "version": "2.1.48",
+      "resolved": "http://nexus.downtown8.com:8081/repository/npm/@dt/ui-mobile-business/-/ui-mobile-business-2.1.48.tgz",
+      "integrity": "sha512-eGsGIR+Mz8afSreNiYnITI0tXSkIFlSRRbu6cUHdCmA1nD4KdTqrpboUUn0amyqKIG0fUQG6AiGPEj/GywEYmQ==",
       "dependencies": {
         "@emotion/is-prop-valid": "^1.3.1",
         "framer-motion": "^11.16.0",
diff --git a/package.json b/package.json
index 14590047..b417659b 100644
--- a/package.json
+++ b/package.json
@@ -50,7 +50,7 @@
     "@dt/fe-capacitor": "^1.0.10",
     "@dt/ui-ionic-icon": "^1.2.21",
     "@dt/ui-mobile": "^2.1.15",
-    "@dt/ui-mobile-business": "^2.1.47",
+    "@dt/ui-mobile-business": "^2.1.48",
     "@ionic/react": "8.2.7",
     "@ionic/react-router": "8.2.7",
     "cross-env": "^7.0.3",
-- 
GitLab


From 1a9a6cba50d8d24f5ed4d82577b10a4551579c7f Mon Sep 17 00:00:00 2001
From: guoshengdong <q506072785@163.com>
Date: Thu, 16 Jan 2025 18:09:56 +0800
Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E5=85=B3=E8=81=94=E4=B8=89?=
 =?UTF-8?q?=E6=96=B9=E9=A4=90=E5=93=81=E9=A1=B5=E9=9D=A2=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/common/locales/zh-CN.json                 |  1 +
 .../menu/takeout/productRelation/index.scss   |  4 +-
 .../menu/takeout/productRelation/index.tsx    | 62 +++++++++----------
 3 files changed, 34 insertions(+), 33 deletions(-)

diff --git a/src/common/locales/zh-CN.json b/src/common/locales/zh-CN.json
index 14535eba..5b84dcb5 100644
--- a/src/common/locales/zh-CN.json
+++ b/src/common/locales/zh-CN.json
@@ -498,6 +498,7 @@
     "relationSuccess": "关联成功",
     "relationYxProduct": "关联壹向餐品",
     "relationYxAdditional": "关联壹向加料",
+    "noProduct": "暂无餐品",
     "confirmRelation": "确定关联",
     "unlinkSuccess": "取消关联成功",
     "releaseHint": "关联壹向餐品后,后厨显示已关联的壹向餐品名,同时餐品统计报表更准确。",
diff --git a/src/pages/menu/takeout/productRelation/index.scss b/src/pages/menu/takeout/productRelation/index.scss
index e8e0677b..1e200d44 100644
--- a/src/pages/menu/takeout/productRelation/index.scss
+++ b/src/pages/menu/takeout/productRelation/index.scss
@@ -134,7 +134,9 @@
         }
       }
     }
-
+    .dt-ui-mb-empty {
+      height: 430px;
+    }
     &::part(scroll) {
       scroll-behavior: smooth;
     }
diff --git a/src/pages/menu/takeout/productRelation/index.tsx b/src/pages/menu/takeout/productRelation/index.tsx
index 7a9358af..09aebfb8 100644
--- a/src/pages/menu/takeout/productRelation/index.tsx
+++ b/src/pages/menu/takeout/productRelation/index.tsx
@@ -7,6 +7,7 @@ import {
   DtButton,
   toastLayer,
   useDtToast,
+  DtEmpty,
 } from '@dt/ui-mobile'
 import i18n from '@dt/fe-base/dist/i18n'
 import {
@@ -75,7 +76,7 @@ const OrderNoRule: React.FC = () => {
   const { channelType } = useParams<{ channelType: 'meituan' | 'eleme' }>()
   const history = useHistory()
   const [showProductChoose, setShowProductChoose] = useState<boolean>(false)
-  const [curTabKey, setCurTabKey] = useState<'all' | 'unRelease' | ''>('')
+  const [curTabKey, setCurTabKey] = useState<'all' | 'unRelease'>('unRelease')
   const [productList, setProductList] = useState<IProductProps[]>([])
   const [additionalList, setAdditionalList] = useState<IProductProps[]>([])
   const [currentRelationItem, setCurrentRelationItem] = useState<
@@ -87,7 +88,6 @@ const OrderNoRule: React.FC = () => {
   const [rHintVisible, setRHintVisible] = useState(true)
   const [hasAuth, setHasAuth] = useState(false)
   const [guideShow, setGuideShow] = useState(false)
-  const [present] = useDtToast()
   const { from } = getParams({ url: window.location.hash })
   const isGuide = from === 'guide'
   useEffect(() => {
@@ -189,6 +189,14 @@ const OrderNoRule: React.FC = () => {
     return unRelationAdditionalList.length + unRelationProductList.length
   }, [unRelationAdditionalList, unRelationProductList])
 
+  /** 切换不同tab展示餐品列表 */
+  const viewProductList = useMemo(() => {
+    return curTabKey === 'all' ? productList : unRelationProductList
+  }, [curTabKey, productList, unRelationProductList])
+  const viewAdditionalList = useMemo(() => {
+    return curTabKey === 'all' ? additionalList : unRelationAdditionalList
+  }, [additionalList, curTabKey, unRelationAdditionalList])
+
   const chooseProduct = (value: any) => {
     console.log(value, '==chosevalue')
     setShowProductChoose(false)
@@ -429,22 +437,6 @@ const OrderNoRule: React.FC = () => {
       </DtItemCard>
     )
   }
-  useEffect(() => {
-    if (
-      !curTabKey &&
-      (productList.length || additionalList.length) &&
-      (unRelationAdditionalList.length > 0 || unRelationProductList.length > 0)
-    ) {
-      setCurTabKey('unRelease')
-    }
-    // eslint-disable-next-line react-hooks/exhaustive-deps
-  }, [
-    unRelationAdditionalList,
-    unRelationProductList,
-    productList,
-    additionalList,
-  ])
-  console.log(currentRelationItem, selectItem, '==currentRelationItem')
   return (
     <DtGuideWrapper
       className='product-release-page-wrapper'
@@ -518,24 +510,30 @@ const OrderNoRule: React.FC = () => {
           ) : (
             ''
           )}
-          <div className='p-list-box'>
-            <div className='l-title'>{i18n.t('menu.name')}</div>
-            <div className='p-list-wrap'>
-              {curTabKey === 'all'
-                ? productList?.map((pItem) => listItem(pItem))
-                : unRelationProductList?.map((pItem) => listItem(pItem))}
+          {!!viewProductList.length && (
+            <div className='p-list-box'>
+              <div className='l-title'>{i18n.t('menu.name')}</div>
+              <div className='p-list-wrap'>
+                {viewProductList?.map((pItem) => listItem(pItem))}
+              </div>
             </div>
-          </div>
+          )}
 
-          <div className='p-list-box'>
-            <div className='l-title'>{i18n.t('product.modifierSingle')}</div>
-            <div className='p-list-wrap'>
-              {curTabKey === 'all'
-                ? additionalList?.map((pItem) => listItem(pItem))
-                : unRelationAdditionalList?.map((pItem) => listItem(pItem))}
+          {!!viewAdditionalList.length && (
+            <div className='p-list-box'>
+              <div className='l-title'>{i18n.t('product.modifierSingle')}</div>
+              <div className='p-list-wrap'>
+                {viewAdditionalList?.map((pItem) => listItem(pItem))}
+              </div>
             </div>
-          </div>
+          )}
         </div>
+        {!viewProductList.length && !viewAdditionalList.length && (
+          <DtEmpty
+            style={{ height: 200 }}
+            title={i18n.t('takeout.noProduct')}
+          />
+        )}
       </DtContent>
       <DtTaskMask
         isOpen={guideShow}
-- 
GitLab