✨ feat(提货详情): 已完成提货详情
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
export default {
|
||||
navigationBarTitleText: '提货',
|
||||
navigationBarTitleText: '提货详情',
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ page {
|
||||
margin: 0 24px;
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
justify-content: space-between;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding-top: 24px;
|
||||
padding-bottom: calc(20px + constant(safe-area-inset-bottom));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { TakeGoodsOrder, TakeGoodsOrderAudit, DeliveryNoticeOrderUpload, TakeGoodsOrderRefuse } from '@/api'
|
||||
import { TakeGoodsOrder, TakeGoodsOrderAudit, TakeGoodsOrderRefuse } from '@/api'
|
||||
import { formatDateTime, formatMeterDiv, formatWeightDiv } from '@/common/format'
|
||||
import Cell from '@/components/cell'
|
||||
import Divider from '@/components/divider'
|
||||
@@ -12,6 +12,8 @@ import { useRouter } from '@tarojs/taro'
|
||||
import { alert } from '@/common/common'
|
||||
import { FC, useCallback, useEffect, useMemo, useState } from 'react'
|
||||
import styles from './index.module.scss'
|
||||
import Popup from '@/components/popup'
|
||||
import Remark from '../takeDelivery/components/remark'
|
||||
|
||||
const TakeDeliveryDetail: FC = () => {
|
||||
const router = useRouter()
|
||||
@@ -27,14 +29,16 @@ const TakeDeliveryDetail: FC = () => {
|
||||
})
|
||||
console.log('res==>', res.data)
|
||||
setDetailInfo(res.data)
|
||||
// 动态设置标题
|
||||
Taro.setNavigationBarTitle({
|
||||
title: res.data.take_goods_order_type_name,
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
getData()
|
||||
}, [])
|
||||
|
||||
const { fetchData: uploadData } = DeliveryNoticeOrderUpload()
|
||||
|
||||
const { fetchData: FetchAudit } = TakeGoodsOrderAudit()
|
||||
|
||||
const DetailItem = useMemo(() => {
|
||||
@@ -78,39 +82,63 @@ const TakeDeliveryDetail: FC = () => {
|
||||
console.log('imageList===>', imageList)
|
||||
setReadyToUploadList((prev) => [...prev, ...imageList])
|
||||
}
|
||||
|
||||
const { fetchData: refuseOrder } = TakeGoodsOrderRefuse()
|
||||
|
||||
const [showRemarkModal, setShowRemarkModal] = useState(false)
|
||||
|
||||
const handleRefuseOrder = async (remark: string) => {
|
||||
const res = await refuseOrder({
|
||||
id: Number(router.params.id),
|
||||
remark: remark,
|
||||
})
|
||||
if (res.success) {
|
||||
alert.success('拒收成功')
|
||||
getData()
|
||||
} else {
|
||||
alert.error('该操作失败')
|
||||
}
|
||||
}
|
||||
|
||||
const onRemarkSave = async (remark: string) => {
|
||||
handleRefuseOrder(remark)
|
||||
|
||||
}
|
||||
|
||||
// 拒收
|
||||
const handleRefuse = useCallback(async () => {}, [])
|
||||
const handleRefuse = useCallback(() => {
|
||||
setShowRemarkModal(true)
|
||||
}, [])
|
||||
|
||||
|
||||
|
||||
// 审核
|
||||
const handleAudit = useCallback(() => {
|
||||
Taro.showModal({
|
||||
confirmColor: '#337FFF',
|
||||
title: '确定审核?',
|
||||
title: '确定要提货?',
|
||||
success: async function (res) {
|
||||
if (res.confirm) {
|
||||
const res = await FetchAudit({ id: Number(router.params.id) })
|
||||
if (res.success) {
|
||||
alert.success('审核成功')
|
||||
alert.success('提货成功')
|
||||
getData()
|
||||
} else {
|
||||
alert.error('审核失败')
|
||||
alert.error('请求失败')
|
||||
}
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
},
|
||||
})
|
||||
}, [readyToUploadList])
|
||||
|
||||
const { fetchData: refuseOrder } = TakeGoodsOrderRefuse()
|
||||
const { fetchData: auditOrder } = TakeGoodsOrderAudit()
|
||||
|
||||
// 底部按钮栏
|
||||
const BottomBar = useMemo(() => {
|
||||
if (detailInfo?.take_goods_order_type === 0) {
|
||||
|
||||
if (detailInfo?.take_goods_order_type !== 0) {
|
||||
// 采购提货
|
||||
return (
|
||||
<View className={styles.bottomBar}>
|
||||
<NormalButton type='primary' plain round onClick={handleAudit}>
|
||||
<NormalButton type='primary' plain round onClick={handleAudit} customStyles={{ width: '100%' }}>
|
||||
确认提货
|
||||
</NormalButton>
|
||||
</View>
|
||||
@@ -118,11 +146,11 @@ const TakeDeliveryDetail: FC = () => {
|
||||
} else {
|
||||
// 退货提货
|
||||
return (
|
||||
<View className={styles.bottomBar}>
|
||||
<NormalButton type='primary' round onClick={handleRefuse}>
|
||||
<View className={styles.bottomBar} style={{ justifyContent: 'space-between' }}>
|
||||
<NormalButton type='primary' round onClick={handleRefuse} customStyles={{ width: '25%' }}>
|
||||
拒收
|
||||
</NormalButton>
|
||||
<NormalButton type='primary' plain round onClick={handleAudit}>
|
||||
<NormalButton type='primary' plain round onClick={handleAudit} customStyles={{ width: '25%' }}>
|
||||
确认提货
|
||||
</NormalButton>
|
||||
</View>
|
||||
@@ -176,13 +204,18 @@ const TakeDeliveryDetail: FC = () => {
|
||||
<Cell title='提货时间:' desc={formatDateTime(detailInfo?.audit_time)}></Cell>
|
||||
</View>
|
||||
</LayoutBlock>
|
||||
<LayoutBlock circle>
|
||||
<View className={styles.orderInfoTop}>备注信息</View>
|
||||
<Divider direction='horizontal' customClassName={styles.divider}></Divider>
|
||||
<View className='orderInfoDetail'>{detailInfo?.remark}</View>
|
||||
</LayoutBlock>
|
||||
{detailInfo?.take_goods_order_type !== 0 && (
|
||||
<LayoutBlock circle>
|
||||
<View className={styles.orderInfoTop}>备注信息</View>
|
||||
<Divider direction='horizontal' customClassName={styles.divider}></Divider>
|
||||
<View className='orderInfoDetail'>{detailInfo?.remark}</View>
|
||||
</LayoutBlock>
|
||||
)}
|
||||
</View>
|
||||
{detailInfo?.take_goods_status === 0 && BottomBar}
|
||||
<Popup show={showRemarkModal} showTitle={false} onClose={() => setShowRemarkModal(false)}>
|
||||
<Remark onSave={onRemarkSave} defaultValue={detailInfo?.remark} />
|
||||
</Popup>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user