skyblued 2 rokov pred
rodič
commit
c15a2493ff

+ 3 - 0
src/views/cart/components/address/index.module.less

@@ -33,3 +33,6 @@
     font-size: 14px;
     color: #666;
 }
+.emtry{
+  padding-top: 2px;
+}

+ 36 - 25
src/views/cart/components/address/index.tsx

@@ -41,31 +41,42 @@ export default defineComponent({
 
     return () => (
       <>
-        <Cell
-          class={styles.cell}
-          is-link={props.isLink}
-          onClick={() => selectAddress()}
-          v-slots={{
-            icon: () => <Icon name={iconAddress} size={19} />,
-            title: () => (
-              <div>
-                <span class={styles.userName}>{props.item.name}</span>
-                <span class={styles.phone}>
-                  {(props.item &&
-                    props.item.phoneNumber &&
-                    props.item.phoneNumber.replace(
-                      /^(\d{3})\d{4}(\d+)/,
-                      '$1****$2'
-                    )) ||
-                    '去填写收货地址'}
-                </span>
-              </div>
-            ),
-            label: () => (
-              <span class={styles.addressInfo}>{addressInfo.value}</span>
-            )
-          }}
-        ></Cell>
+        {props.item && props.item.phoneNumber ? (
+          <Cell
+            class={styles.cell}
+            is-link={props.isLink}
+            onClick={() => selectAddress()}
+            v-slots={{
+              icon: () => <Icon name={iconAddress} size={19} />,
+              title: () => (
+                <div>
+                  <span class={styles.userName}>{props.item.name}</span>
+                  <span class={styles.phone}>
+                    {(props.item &&
+                      props.item.phoneNumber &&
+                      props.item.phoneNumber.replace(
+                        /^(\d{3})\d{4}(\d+)/,
+                        '$1****$2'
+                      ))}
+                  </span>
+                </div>
+              ),
+              label: () => (
+                <span class={styles.addressInfo}>{addressInfo.value}</span>
+              )
+            }}
+          ></Cell>
+        ) : (
+          <Cell
+            class={styles.cell}
+            is-link={props.isLink}
+            onClick={() => selectAddress()}
+            v-slots={{
+              icon: () => <Icon name={iconAddress} size={19} />,
+              title: () => <div class={styles.emtry}>去填写收货地址</div>
+            }}
+          ></Cell>
+        )}
       </>
     )
   }