From 672181da644ff1091f0bf4fe62bee64122aca33e Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Tue, 28 Feb 2023 17:08:03 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(ID1001396=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E5=90=8E=EF=BC=8C=E5=8E=9F=E5=85=88=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=9A=84=E5=89=AA=E6=A0=B7=E4=BF=A1=E6=81=AF=E4=B8=8D?= =?UTF-8?q?=E8=A7=81=E4=BA=86):?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/cutSampleListOrder/index.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/pages/cutSampleListOrder/index.tsx b/src/pages/cutSampleListOrder/index.tsx index ddbcd84..c9f906c 100644 --- a/src/pages/cutSampleListOrder/index.tsx +++ b/src/pages/cutSampleListOrder/index.tsx @@ -1,5 +1,5 @@ import { Text, View } from '@tarojs/components' -import Taro, { getCurrentPages, useDidShow } from '@tarojs/taro' +import Taro, { getCurrentPages, useDidShow, useUnload } from '@tarojs/taro' import { useCallback, useMemo, useRef, useState } from 'react' import styles from './index.module.scss' import type { AddressItem } from './components/address' @@ -76,7 +76,9 @@ export default () => { getAddressDefault() } setRemarkData(info.remark) + }) + useUnload(() => { Taro.removeStorageSync('cutSample') Taro.removeStorageSync('cutSampleOther') }) @@ -188,11 +190,13 @@ export default () => { const res = await addressListFetchData() let defaultInfo: AddressItem|null = null res?.data.list?.map((item) => { - defaultInfo = { - id: item.id, - address_title: item.province_name + item.city_name + item.district_name + item.address_detail, - address_name: item.name, - address_phone: item.phone, + if (item.is_default) { + defaultInfo = { + id: item.id, + address_title: item.province_name + item.city_name + item.district_name + item.address_detail, + address_name: item.name, + address_phone: item.phone, + } } }) submitData.current.address_id = defaultInfo!.id || 0