🦄 refactor:搜索历史加入购物车100%
This commit is contained in:
@@ -58,52 +58,37 @@ const AddressList = memo((props: Params) => {
|
||||
// 列表选择
|
||||
const { fetchData: selectFetch } = mpsaleOrderaddress()
|
||||
const handleSelect = async (item: any, index: number) => {
|
||||
Taro.showLoading({
|
||||
title: '请稍等...',
|
||||
mask: true
|
||||
})
|
||||
const res = await selectFetch({ address_id: item.id, id: Number(router.params.orderId), shipment_mode: 2 })
|
||||
if (res.msg === 'success') {
|
||||
Taro.hideLoading()
|
||||
Taro.showToast({
|
||||
title: '成功',
|
||||
icon: 'success'
|
||||
})
|
||||
Taro.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
} else {
|
||||
Taro.hideLoading()
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: 'error'
|
||||
if (router.params.orderId) {
|
||||
Taro.showLoading({
|
||||
title: '请稍等...',
|
||||
mask: true
|
||||
})
|
||||
const res = await selectFetch({ address_id: item.id, id: Number(router.params.orderId), shipment_mode: 2 })
|
||||
if (res.msg === 'success') {
|
||||
Taro.hideLoading()
|
||||
Taro.showToast({
|
||||
title: '成功',
|
||||
icon: 'success'
|
||||
})
|
||||
Taro.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
} else {
|
||||
Taro.hideLoading()
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
props.onSelect && props.onSelect(item, index);
|
||||
if (focusBorderEnabled) {
|
||||
setFocusId(item?.id);
|
||||
}
|
||||
}
|
||||
// 删除地址
|
||||
// const { fetchData: deleteFetch } = addressDeleteApi()
|
||||
// const handleDelete = (item: any) => {
|
||||
// showModal(({
|
||||
// title: "提示",
|
||||
// content: "是否删除地址?",
|
||||
// async success(ev) {
|
||||
// if (ev.confirm) {
|
||||
// const result = await deleteFetch({ id: item.id });
|
||||
// if (result.success) {
|
||||
// alert.success("删除成功");
|
||||
// getData();
|
||||
// } else {
|
||||
// alert.success(result.msg);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }))
|
||||
// }
|
||||
|
||||
return (
|
||||
<View className="address-scroll-view">
|
||||
<ScrollView scrollY refresherEnabled={props.refresherEnabled} enhanced refresherTriggered={refreshState} onRefresherRefresh={handleRefresh}>
|
||||
@@ -114,7 +99,7 @@ const AddressList = memo((props: Params) => {
|
||||
// data.length>0?
|
||||
// data.map((item,index)=>{
|
||||
return (
|
||||
<View onLongPress={() => handleDelete(item)} onClick={() => handleSelect(item, index)} className={`address-list ${focusId == item.id && 'address-active'}`}>
|
||||
<View onClick={() => handleSelect(item, index)} className={`address-list ${focusId == item.id && 'address-active'}`}>
|
||||
<View className="address-user">
|
||||
{item.name}
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user