✨ feat:申请退货100%
This commit is contained in:
parent
ff5b5a5fe2
commit
d84d60414c
@ -165,5 +165,11 @@ export const mpenumreturngoodsStatus = () => {
|
||||
method: "get",
|
||||
})
|
||||
}
|
||||
|
||||
//申请退货
|
||||
export const mpreturnApplyOrder = () => {
|
||||
return useRequest({
|
||||
url: `/v1/mp/returnApplyOrder`,
|
||||
method: "put",
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,8 @@ import {
|
||||
mpsaleOrder,
|
||||
mpenumreturnOrderreturnReason,
|
||||
mpenumreturnExplain,
|
||||
mpenumreturngoodsStatus
|
||||
mpenumreturngoodsStatus,
|
||||
mpreturnApplyOrder
|
||||
} from "@/api/order"
|
||||
import Popup from '@/components/popup'
|
||||
import UploadImage from '@/components/uploadImage'
|
||||
@ -138,11 +139,7 @@ export default () => {
|
||||
}, [])
|
||||
|
||||
|
||||
//判断是否允许提交
|
||||
const isDisabled = useMemo(() => {
|
||||
|
||||
return false
|
||||
}, [])
|
||||
|
||||
//筛选内容展示
|
||||
const [showPopup, setshowPopup] = useState(false)
|
||||
@ -177,6 +174,18 @@ export default () => {
|
||||
// sale_order_id:infoObj.id,//详情id
|
||||
})
|
||||
|
||||
//判断是否允许提交
|
||||
const isDisabled = useMemo(() => {
|
||||
if (Query.GoodStatus !== '' &&
|
||||
Query.return_explain !== '' &&
|
||||
totalNums !== 0 &&
|
||||
Query.GoodStatus !== ''
|
||||
) {
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}, [Query])
|
||||
|
||||
///获取退货原因
|
||||
const { fetchData: resonFetch } = mpenumreturnOrderreturnReason()
|
||||
@ -210,7 +219,7 @@ export default () => {
|
||||
})
|
||||
setQuery((val) => ({ ...val, return_reason: item.id, return_explain: '' }))
|
||||
queryRef.current.return_reason = item.id
|
||||
queryRef.current.reasonName = item.name
|
||||
// queryRef.current.reasonName = item.name
|
||||
setReasonList([...ReasonList])
|
||||
getReasonTwo()
|
||||
}
|
||||
@ -226,9 +235,9 @@ export default () => {
|
||||
return it
|
||||
})
|
||||
setReasonListTwo([...ReasonListTwo])
|
||||
queryRef.current.reasonNameTwo = item.name
|
||||
// queryRef.current.reasonNameTwo = item.name
|
||||
setQuery({ return_explain: item.id })
|
||||
queryRef.current.return_explain = item.id
|
||||
// queryRef.current.return_explain = item.id
|
||||
}
|
||||
|
||||
//重置
|
||||
@ -266,6 +275,16 @@ export default () => {
|
||||
|
||||
//确认选择退货原因
|
||||
const handSlect = () => {
|
||||
const resOne = ReasonList.filter(item => {
|
||||
return item.default
|
||||
})
|
||||
queryRef.current.return_reason = resOne[0].id
|
||||
queryRef.current.reasonName = resOne[0].name
|
||||
const resTwo = ReasonListTwo.filter(item => {
|
||||
return item.default
|
||||
})
|
||||
queryRef.current.return_explain = resTwo[0].id
|
||||
queryRef.current.reasonNameTwo = resTwo[0].name
|
||||
setQuery((val) => ({
|
||||
...val,
|
||||
reasonName: queryRef.current.reasonName,
|
||||
@ -297,10 +316,8 @@ export default () => {
|
||||
}
|
||||
return it
|
||||
})
|
||||
setQuery((val) => ({ ...val, GoodStatus: item.id, GoodStatusName: item.name }))
|
||||
setQuery((val) => ({ ...val, GoodStatus: item.id }))
|
||||
setGoodStatusList([...GoodStatusList])
|
||||
queryRef.current.GoodStatus = item.id
|
||||
queryRef.current.GoodStatusName = item.name
|
||||
}
|
||||
|
||||
//判断状态是否有选
|
||||
@ -323,10 +340,82 @@ export default () => {
|
||||
|
||||
//确认选择货物状况
|
||||
const handSlectStatus = () => {
|
||||
const res = GoodStatusList.filter(item => {
|
||||
return item.default
|
||||
})
|
||||
queryRef.current.GoodStatus = res[0].id
|
||||
queryRef.current.GoodStatusName = res[0].name
|
||||
setQuery((val) => ({ ...val, GoodStatus: queryRef.current.GoodStatus, GoodStatusName: queryRef.current.GoodStatusName }))
|
||||
setDescPopup(false)
|
||||
}
|
||||
|
||||
//取消返回
|
||||
const handCancl = () => {
|
||||
Taro.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
}
|
||||
|
||||
//确认退货
|
||||
const { fetchData: sureFetch } = mpreturnApplyOrder()
|
||||
const handSure = () => {
|
||||
const arr: any = [];
|
||||
ListArr.forEach((item) => {
|
||||
item.av_product_color.forEach((it) => {
|
||||
arr.push({
|
||||
product_color_id: it.sale_mode == 0 ? it.product_color_id : '',
|
||||
product_id: it.sale_mode == 0 ? it.product_id : '',
|
||||
product_roll: it.sale_mode == 0 ? it.nums : 0,
|
||||
sale_order_detail_id: it.sale_order_detail_id,
|
||||
});
|
||||
});
|
||||
});
|
||||
const query = {
|
||||
reason_describe: TextareaValue,
|
||||
fabric_piece_accessory_url: picUrl.current,
|
||||
goods_status: Query.GoodStatus,
|
||||
return_reason: Query.return_reason,
|
||||
return_explain: Query.return_explain,
|
||||
roll: 0,
|
||||
roll_list: arr,
|
||||
sale_order_id: Number(infoObj.id),
|
||||
}
|
||||
Taro.showModal({
|
||||
content: "确认退货吗?",
|
||||
confirmText: "确认",
|
||||
cancelText: "取消",
|
||||
success: async function (res) {
|
||||
if (res.confirm) {
|
||||
Taro.showLoading({
|
||||
title: '请稍等...',
|
||||
mask: true
|
||||
})
|
||||
const res = await sureFetch(query)
|
||||
if (res?.msg === 'success') {
|
||||
Taro.showToast({
|
||||
title: '成功'
|
||||
})
|
||||
Taro.hideLoading()
|
||||
handCancl()
|
||||
} else {
|
||||
Taro.hideLoading()
|
||||
Taro.showToast({
|
||||
title: res?.msg,
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//备注信息
|
||||
const [TextareaValue, setTextareaValue] = useState('')
|
||||
const getDesc = (e) => {
|
||||
setTextareaValue(e)
|
||||
}
|
||||
return (
|
||||
<View className={styles.main}>
|
||||
<View className={styles.bgBox}>
|
||||
@ -348,10 +437,10 @@ export default () => {
|
||||
<View className={styles.reasonFont}>退货原因</View>
|
||||
<Text className={styles.xing}>*</Text>
|
||||
{
|
||||
Query.reasonName === '请选择' && <View className={styles.selectFont}>请选择</View>
|
||||
queryRef.current.reasonName === '请选择' && <View className={styles.selectFont}>请选择</View>
|
||||
}
|
||||
{
|
||||
Query.reasonName !== '请选择' && <View className={styles.selectFont}>{Query.reasonName}/{Query.reasonNameTwo}</View>
|
||||
queryRef.current.reasonName !== '请选择' && <View className={styles.selectFont}>{Query.reasonName}/{Query.reasonNameTwo}</View>
|
||||
}
|
||||
</View>
|
||||
<View className={classnames('iconfont', 'icon-chakanquanbukehu', styles.chakanquanbukehu)}></View>
|
||||
@ -361,10 +450,10 @@ export default () => {
|
||||
<View className={styles.reasonFont}>货物情况</View>
|
||||
<Text className={styles.xing}>*</Text>
|
||||
{
|
||||
Query.GoodStatusName === '请选择' && <View className={styles.selectFont}>请选择</View>
|
||||
queryRef.current.GoodStatusName === '请选择' && <View className={styles.selectFont}>请选择</View>
|
||||
}
|
||||
{
|
||||
Query.GoodStatusName !== '请选择' && <View className={styles.selectFont}>{Query.GoodStatusName}</View>
|
||||
queryRef.current.GoodStatusName !== '请选择' && <View className={styles.selectFont}>{Query.GoodStatusName}</View>
|
||||
}
|
||||
</View>
|
||||
<View className={classnames('iconfont', 'icon-chakanquanbukehu', styles.chakanquanbukehu)}></View>
|
||||
@ -378,6 +467,8 @@ export default () => {
|
||||
<View className={styles.title}>其他说明</View>
|
||||
<View className={styles.textBox}>
|
||||
<Textarea
|
||||
onInput={(e) => getDesc(e.detail.value)}
|
||||
value={TextareaValue}
|
||||
// style='background:#f6f6f6;height:210px;padding:15rpx 24rpx 24rpx 24rpx;border-radius: 8rpx;'
|
||||
placeholderStyle='font-size: 28rpx;font-weight: 400;'
|
||||
autoFocus
|
||||
@ -388,7 +479,7 @@ export default () => {
|
||||
<View className={styles.safeBox}>
|
||||
<View className={styles.bottomBox}>
|
||||
|
||||
<Button className={styles.resetBox} onClick={() => { handCancel() }}> 取消</Button >
|
||||
<Button className={styles.resetBox} onClick={() => { handCancl() }}> 取消</Button >
|
||||
<Button className={classnames(isDisabled ? styles.button : styles.activeButton)} disabled={isDisabled} onClick={() => handSure()}> 确认退货</Button >
|
||||
</View>
|
||||
</View>
|
||||
|
@ -515,6 +515,7 @@ export default () => {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/applyGoods/index?orderId=' + infoObj.id
|
||||
})
|
||||
setShowMore(false)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user