✨ feat:申请退货80%

This commit is contained in:
Haiyi
2022-09-21 19:14:31 +08:00
parent 45de2e92c0
commit ff5b5a5fe2
12 changed files with 1300 additions and 78 deletions
@@ -99,6 +99,7 @@
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10px;
.totalLeft {
font-size: 28px;
+74 -73
View File
@@ -11,10 +11,8 @@ import {
returnApplyOrderuploadAccessory
} from "@/api/refound"
import OrderState from './components/orderState'
import AddressDetailBox from './components/addressDetailBox'
// import AddressDetailBox from './components/addressDetailBox'
import { IMG_CND_Prefix } from "@/common/constant";
import Popup from '@/components/popup';
import UploadImage from '@/components/uploadImage'
export default () => {
const router = useRouter()
@@ -48,23 +46,22 @@ export default () => {
if (it.leftTitle === '其他什么:') {
it.rightTitle = res.data.reason_describe
}
if (it.leftTitle === '货物状况:') {
it.rightTitle = res.data.goods_status_name
}
// if (it.leftTitle === '货物状况:') {
// it.rightTitle = res.data.goods_status_name
// }
if (it.leftTitle === '申请时间:') {
it.rightTitle = formatDateTime(res.data.apply_time)
}
})
setOrderMsg([...orderMsg])
setPicList([...res.data?.accessory_url !== null ? res.data?.accessory_url : []])
// setPicList([...res.data?.accessory_url !== null ? res.data?.accessory_url : []])
Taro.hideLoading()
}
}
//分辨用质检中还是质检前的数组
const productList = useMemo(() => {
if (DeatailObj.stage === 0 ||
(DeatailObj.sale_mode == 1 && DeatailObj.type == 1) || DeatailObj.stage === 1 || DeatailObj.stage === 2) {
if (DeatailObj.stage == 0 || DeatailObj.type == 3) {
return DeatailObj.product_list
} else {
return DeatailObj.quality_check_pass_product
@@ -96,10 +93,10 @@ export default () => {
leftTitle: '其他什么:',
rightTitle: '------',
},
{
leftTitle: '货物状况:',
rightTitle: '------',
},
// {
// leftTitle: '货物状况:',
// rightTitle: '------',
// },
{
leftTitle: '申请时间:',
rightTitle: '------',
@@ -151,70 +148,49 @@ export default () => {
}
//查看图片
const [ShowPic, setShowPic] = useState(false)
// //查看图片
// const [ShowPic, setShowPic] = useState(false)
const [PicList, setPicList] = useState<any[]>([])
// const [PicList, setPicList] = useState<any[]>([])
const handUp = (value) => {
setShowPic(true)
}
// const handUp = (value) => {
// setShowPic(true)
// }
const onlyRead = useMemo(() => {
if (DeatailObj.stage == 1) {
return false
} else {
return true
}
}, [DeatailObj])
// const onlyRead = useMemo(() => {
// if (DeatailObj.stage == 1) {
// return false
// } else {
// return true
// }
// }, [DeatailObj])
//获取图片列表
const picUrl = useRef([])
const getImageList = useCallback((list) => {
picUrl.current = list
}, [])
// //获取图片列表
// const picUrl = useRef([])
// const getImageList = useCallback((list) => {
// picUrl.current = list
// }, [])
const proview = (item) => {
Taro.previewImage({
current: IMG_CND_Prefix + item, // 当前显示图片的 http 链接
urls: DeatailObj.fabric_piece_accessory_url.map((item) => {
item = IMG_CND_Prefix + item;
return item;
}), // 需要预览的图片 http 链接列表
});
};
//提交附件
const { fetchData: sureFetch } = returnApplyOrderuploadAccessory()
const handSure = () => {
let arr: any = []
arr = [...picUrl.current, ...PicList]
Taro.showModal({
content: "确定要提交吗?",
confirmText: "确认",
cancelText: "取消",
success: async function (res) {
if (res.confirm) {
const res = await sureFetch({ id: Number(DeatailObj.id), accessory_url: arr, })
Taro.showLoading({
title: '请稍等...',
mask: true
})
if (res.msg === 'success') {
Taro.showToast({
title: '取消成功'
})
Taro.hideLoading()
getDetail()
} else {
Taro.showToast({
title: res.msg,
icon: 'error'
})
}
}
}
})
}
return (
<View className={styles.main}>
<OrderState orderInfo={DeatailObj} />
<AddressDetailBox
{/* <AddressDetailBox
obj={DeatailObj}
handUp={() => handUp(DeatailObj)}
></AddressDetailBox>
></AddressDetailBox> */}
<DefaultBox
showMode={true}
title={'客户信息'}
@@ -233,6 +209,38 @@ export default () => {
DeatailObj?.sale_mode == 0 ? DeatailObj?.return_roll : DeatailObj?.total_number / 100
} {DeatailObj?.sale_mode == 0 ? "条" : "米"}</View>
</View>
{
DeatailObj.stage == 0 && <View className={styles.totalBox}>
<View className={styles.totalLeft}>合计金额</View>
<View className={styles.totalRight}>{
formatPriceDiv(DeatailObj.total_refund_amount)
}</View>
</View>
}
{
(DeatailObj.stage == 5 || DeatailObj.stage == 6) && <View className={styles.totalBox}>
<View className={styles.totalLeft}>退款金额</View>
<View className={styles.totalRight}>{
formatPriceDiv(DeatailObj.refund_amount)
}</View>
</View>
}
{
(DeatailObj.stage == 5 || DeatailObj.stage == 6) && <View className={styles.totalBox}>
<View className={styles.totalLeft}>其他扣除金额</View>
<View className={styles.totalRight}>{
formatPriceDiv(DeatailObj.other_deduction_amount)
}</View>
</View>
}
{
(DeatailObj.stage == 5 || DeatailObj.stage == 6) && <View className={styles.totalBox}>
<View className={styles.totalLeft}>退款去向</View>
<View className={styles.totalRight}>{
formatPriceDiv(DeatailObj.refund_flow_name)
}</View>
</View>
}
</DefaultBox>
<DefaultBox title={'订单信息'}>
{
@@ -258,7 +266,7 @@ export default () => {
{
DeatailObj?.fabric_piece_accessory_url?.length > 0 && DeatailObj?.fabric_piece_accessory_url.map((item, index) => {
return (
<Image className={styles.pic} lazyLoad key={index}
<Image className={styles.pic} lazyLoad key={index} onClick={() => proview(item)}
mode="aspectFill" src={IMG_CND_Prefix + item}></Image>
)
})
@@ -274,13 +282,6 @@ export default () => {
<View className={styles.cancleBtn} onClick={() => handCancle()}>取消退货</View>
</View>
}
<Popup title={'查看/修改物流回单'} show={ShowPic} onClose={() => setShowPic(false)}>
<UploadImage onChange={getImageList} defaultList={PicList} onlyRead={onlyRead} />
{
!onlyRead && <View className={styles.picBtn} onClick={() => handSure()}>确认修改</View>
}
</Popup>
</View>
)
}