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