🌈 style(eslint): add eslint rules
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
import { Text, View } from '@tarojs/components'
|
||||
import Taro, { useRouter } from '@tarojs/taro'
|
||||
import type { FC } from 'react'
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react'
|
||||
import styles from './index.module.scss'
|
||||
import { DeliverNoticeOrder, DeliveryNoticeOrderAudit, DeliveryNoticeOrderUpload } from '@/api'
|
||||
import { formatDateTime, formatMeterDiv, formatWeightDiv } from '@/common/format'
|
||||
import Cell from '@/components/cell'
|
||||
@@ -6,12 +11,7 @@ import LayoutBlock from '@/components/layoutBlock'
|
||||
import NormalButton from '@/components/normalButton'
|
||||
import SaleModeTag from '@/components/saleModeTag'
|
||||
import UploadImage from '@/components/uploadImage'
|
||||
import { View, Text } from '@tarojs/components'
|
||||
import Taro from '@tarojs/taro'
|
||||
import { useRouter } from '@tarojs/taro'
|
||||
import { alert } from '@/common/common'
|
||||
import { FC, useCallback, useEffect, useMemo, useState } from 'react'
|
||||
import styles from './index.module.scss'
|
||||
|
||||
const DeliveryDetail: FC = () => {
|
||||
const router = useRouter()
|
||||
@@ -20,7 +20,7 @@ const DeliveryDetail: FC = () => {
|
||||
|
||||
const [detailInfo, setDetailInfo] = useState<Record<string, any>>({})
|
||||
|
||||
const getData = async () => {
|
||||
const getData = async() => {
|
||||
const { id, order_no } = router.params
|
||||
const res = await fetchData({
|
||||
id,
|
||||
@@ -39,21 +39,21 @@ const DeliveryDetail: FC = () => {
|
||||
const { fetchData: FetchAudit } = DeliveryNoticeOrderAudit()
|
||||
|
||||
const DetailItem = useMemo(() => {
|
||||
const element =
|
||||
!!detailInfo?.weight_list?.length &&
|
||||
detailInfo?.weight_list.map((weightItem) => {
|
||||
const element
|
||||
= !!detailInfo?.weight_list?.length
|
||||
&& detailInfo?.weight_list.map((weightItem) => {
|
||||
return (
|
||||
<View className={styles.detailInfo}>
|
||||
<Divider direction='horizontal' customClassName={styles.divider}></Divider>
|
||||
<Divider direction="horizontal" customClassName={styles.divider}></Divider>
|
||||
<View className={styles.detailInfoItem}>
|
||||
<View className={styles['detailInfoItem--title']}>
|
||||
<View className=''>
|
||||
<View className="">
|
||||
<Text style={{ marginRight: '20rpx' }}>
|
||||
{weightItem.product_code} {weightItem.product_name}
|
||||
</Text>
|
||||
<SaleModeTag saleMode={weightItem?.sale_mode} />
|
||||
</View>
|
||||
<View className=''>共 {weightItem?.sale_mode === 0 ? `${weightItem.roll} 条` : `${formatMeterDiv(weightItem?.length || 0)} 米`}</View>
|
||||
<View className="">共 {weightItem?.sale_mode === 0 ? `${weightItem.roll} 条` : `${formatMeterDiv(weightItem?.length || 0)} 米`}</View>
|
||||
</View>
|
||||
<View className={styles['detailInfoItem--detail']}>
|
||||
<View className={styles['detailInfoItem--detail--row']}>
|
||||
@@ -77,40 +77,43 @@ const DeliveryDetail: FC = () => {
|
||||
|
||||
const handleUploadChange = (imageList: string[]) => {
|
||||
console.log('imageList===>', imageList)
|
||||
setReadyToUploadList((prev) => [...prev, ...imageList])
|
||||
setReadyToUploadList(prev => [...prev, ...imageList])
|
||||
}
|
||||
// 上传附件
|
||||
const handleUploadPic = useCallback(async () => {
|
||||
const handleUploadPic = useCallback(async() => {
|
||||
const res = await uploadData({
|
||||
id: Number(router.params.id),
|
||||
delivery_appendix: readyToUploadList,
|
||||
})
|
||||
if (res.success) {
|
||||
alert.success('上传成功')
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
alert.error('上传核失败')
|
||||
}
|
||||
}, [readyToUploadList])
|
||||
|
||||
// 审核
|
||||
const handleAudit = useCallback(() => {
|
||||
if (readyToUploadList.length === 0 ) {
|
||||
if (readyToUploadList.length === 0) {
|
||||
alert.error('请先上传附件')
|
||||
return
|
||||
}
|
||||
Taro.showModal({
|
||||
confirmColor: '#337FFF',
|
||||
title: '确定审核?',
|
||||
success: async function (res) {
|
||||
async success(res) {
|
||||
if (res.confirm) {
|
||||
const res = await FetchAudit({ id: Number(router.params.id) })
|
||||
if (res.success) {
|
||||
alert.success('审核成功')
|
||||
getData()
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
alert.error('审核失败')
|
||||
}
|
||||
} else if (res.cancel) {
|
||||
}
|
||||
else if (res.cancel) {
|
||||
console.log('用户点击取消')
|
||||
}
|
||||
},
|
||||
@@ -120,10 +123,10 @@ const DeliveryDetail: FC = () => {
|
||||
const BottomBar = useMemo(() => {
|
||||
return (
|
||||
<View className={styles.bottomBar}>
|
||||
<NormalButton plain type='primary' round onClick={handleUploadPic}>
|
||||
<NormalButton plain type="primary" round onClick={handleUploadPic}>
|
||||
上传附件
|
||||
</NormalButton>
|
||||
<NormalButton type='primary' round onClick={handleAudit}>
|
||||
<NormalButton type="primary" round onClick={handleAudit}>
|
||||
确认审核
|
||||
</NormalButton>
|
||||
</View>
|
||||
@@ -132,7 +135,7 @@ const DeliveryDetail: FC = () => {
|
||||
return (
|
||||
<View className={styles.deliveryDetail}>
|
||||
<View className={styles.content}>
|
||||
<LayoutBlock circle customStyle={{padding: '24rpx'}}>
|
||||
<LayoutBlock circle customStyle={{ padding: '24rpx' }}>
|
||||
<View className={styles.detailTop}>
|
||||
<View className={styles.orderNo}>发货单号:{detailInfo?.order_no}</View>
|
||||
{detailInfo?.status === 0 ? <View className={styles['status--toBeAudit']}>待审核</View> : <View className={styles['status--audited']}>已完成</View>}
|
||||
@@ -147,19 +150,19 @@ const DeliveryDetail: FC = () => {
|
||||
</Text>
|
||||
</View>
|
||||
</LayoutBlock>
|
||||
<LayoutBlock circle customStyle={{padding: '24rpx'}}>
|
||||
<LayoutBlock circle customStyle={{ padding: '24rpx' }}>
|
||||
<View className={styles.orderInfoTop}>订单信息</View>
|
||||
<Divider direction='horizontal' customClassName={styles.divider}></Divider>
|
||||
<View className='orderInfoDetail'>
|
||||
<Cell title='订单备注:' desc={detailInfo?.sale_order_remark || '暂无备注信息'}></Cell>
|
||||
<Cell title='创建时间:' desc={formatDateTime(detailInfo?.create_time) || '暂无创建时间'}></Cell>
|
||||
<Cell title='发货方式:' desc={detailInfo?.shipment_mode_name || '暂无发货方式'}></Cell>
|
||||
<Cell title='发货地址:' desc={`${detailInfo.province_name}${detailInfo.city_name}${detailInfo.district_name}${detailInfo.address_detail}` || '暂无发货地址'}></Cell>
|
||||
<Divider direction="horizontal" customClassName={styles.divider}></Divider>
|
||||
<View className="orderInfoDetail">
|
||||
<Cell title="订单备注:" desc={detailInfo?.sale_order_remark || '暂无备注信息'}></Cell>
|
||||
<Cell title="创建时间:" desc={formatDateTime(detailInfo?.create_time) || '暂无创建时间'}></Cell>
|
||||
<Cell title="发货方式:" desc={detailInfo?.shipment_mode_name || '暂无发货方式'}></Cell>
|
||||
<Cell title="发货地址:" desc={`${detailInfo.province_name}${detailInfo.city_name}${detailInfo.district_name}${detailInfo.address_detail}` || '暂无发货地址'}></Cell>
|
||||
</View>
|
||||
</LayoutBlock>
|
||||
<LayoutBlock circle customStyle={{padding: '24rpx'}}>
|
||||
<LayoutBlock circle customStyle={{ padding: '24rpx' }}>
|
||||
<View className={styles.orderInfoTop}>附件</View>
|
||||
<Divider direction='horizontal' customClassName={styles.divider}></Divider>
|
||||
<Divider direction="horizontal" customClassName={styles.divider}></Divider>
|
||||
<UploadImage onlyRead={detailInfo?.status !== 0} onChange={handleUploadChange} defaultList={detailInfo?.delivery_appendix_url}></UploadImage>
|
||||
</LayoutBlock>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user