🐳 chore(eslint): 修正所有文件的eslint 错误❌

This commit is contained in:
xuan
2022-11-28 11:06:15 +08:00
parent 99a920975f
commit cc99111b4f
149 changed files with 3270 additions and 3252 deletions
+119 -123
View File
@@ -5,21 +5,99 @@ import classnames from 'classnames'
import styles from './index.module.scss'
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
import {
mpenumreturnExplain,
mpenumreturnOrderreturnReason,
mpenumreturngoodsStatus,
mpreturnApplyOrder,
mpsaleOrder,
MpEnumReturnExplain,
MpEnumReturnGoodsStatus,
MpEnumReturnOrderReturnReason,
MpReturnApplyOrder,
MpSaleOrder,
} from '@/api/order'
import Popup from '@/components/popup'
import UploadImage from '@/components/uploadImage'
export default () => {
// 产品商品元素
interface PropGoods {
list: any[]
obj: {
sale_mode?: number | string
}
handTui?: (any) => void
handCancel?: (any) => void
onBlur?: (e: any, obj: any) => void
onInputEven?: (e: any, obj: any) => void
handReduce?: (any) => void
handAdd?: (any) => void
}
const GoodsItem = (porps: PropGoods) => {
const { list = [], obj = {}, handTui, handCancel, onBlur, handReduce, handAdd, onInputEven } = porps
// const [value, setValue] = useState<any>({ count: 1 })
// const onInputEven = (e) => {
// let res = Number(e.detail.value)
// if (res < 1) {
// setValue({ count: 1 })
// } else {
// setValue({ count: res })
// }
// }
return (
<>
{
list.map((item, index) => {
return (
<View className={styles.goodsBox} key={index}>
<View className={styles.goodsProduct}>{item.product_code}# {item.product_name}</View>
<View className={styles.goodsLine}></View>
{
item.av_product_color.map((it, inx) => {
return (
<View className={styles.itemGoods} key={inx}>
<Image className={styles.itemPic} mode="aspectFill" src="https://test.cdn.zzfzyc.com/mall/no_img.png"></Image>
{/* <View className={styles.itemPic} style={{ backgroundColor: `rgb(${it?.rgb?.r} ${it?.rgb?.g} ${it?.rgb?.b})` }}></View> */}
<View className={styles.itemRight}>
<View className={styles.item_right_top}>
<View className={styles.itemName}>{it.product_color_code} {it.product_color_name}</View>
</View>
<View className={styles.item_right_Bottom}>
<View className={styles.itemMoney}>x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'}</View>
{
!it.isTui && <View className={styles.btn} onClick={() => handTui?.(it)}>退货</View>
}
{
(it.sale_mode != 0 && it.isTui) && <View className={styles.btnOne} onClick={() => handCancel?.(it)}>已选择退货</View>
}
{
(it.sale_mode == 0 && it.isTui) && <View className={styles.inputBox} >
<View className={styles.redceBox} onClick={() => handReduce?.(it)}>
<View className={styles.reduce}></View>
</View>
<View className={styles.inputBig}>
<Input type="number" value={it.nums} onInput={e => onInputEven?.(e, it)} maxlength={it.roll} onBlur={e => onBlur?.(e, it)}></Input>
</View>
<View className={styles.addBox} onClick={() => handAdd?.(it)}>
+
</View>
</View>
}
</View>
</View>
</View>
)
})
}
</View>
)
})
}
</>
)
}
const GoodsItemWithMemo = memo(GoodsItem)
const ApplyGoods = () => {
const router = useRouter()
useEffect(() => {
getDetail()
}, [])
const { fetchData: infoFetch } = mpsaleOrder()
const { fetchData: infoFetch } = MpSaleOrder()
const [infoObj, setInfoObj] = useState<any>({})
const [ListArr, setListArr] = useState<any[]>([])
// 获取订单详情
@@ -31,7 +109,7 @@ export default () => {
const res = await infoFetch({ id: router.params.orderId })
if (res.data) {
res.data.av_return_product.forEach((item) => {
item.av_product_color.map((it) => {
item.av_product_color.forEach((it) => {
it.isTui = false
it.nums = 1
})
@@ -132,16 +210,12 @@ export default () => {
// 点击加
const handAdd = (val) => {
ListArr.forEach((item) => {
item.av_product_color.map((it) => {
item.av_product_color.forEach((it) => {
if (it.sale_order_detail_id === val.sale_order_detail_id) {
if (it.nums < it.roll) {
it.nums++
}
else {
return
}
}
return it
})
})
setListArr([...ListArr])
@@ -159,6 +233,10 @@ export default () => {
return arr.length
}, [ListArr])
useEffect(() => {
getDetail()
}, [])
// 获取图片列表
const picUrl = useRef([])
const getImageList = useCallback((list) => {
@@ -168,11 +246,6 @@ export default () => {
// 筛选内容展示
const [showPopup, setshowPopup] = useState(false)
useEffect(() => {
getReason()
getReasonTwo()
}, [])
const queryRef = useRef(
{
return_reason: 1, // 退货原因
@@ -210,7 +283,7 @@ export default () => {
}, [Query, totalNums])
/// 获取退货原因
const { fetchData: resonFetch } = mpenumreturnOrderreturnReason()
const { fetchData: resonFetch } = MpEnumReturnOrderReturnReason()
const [ReasonList, setReasonList] = useState<any[]>([])
const getReason = async() => {
const res = await resonFetch()
@@ -220,7 +293,7 @@ export default () => {
}
// 获取退货原因2
const { fetchData: resonTwoFetch } = mpenumreturnExplain()
const { fetchData: resonTwoFetch } = MpEnumReturnExplain()
const [ReasonListTwo, setReasonListTwo] = useState<any[]>([])
const getReasonTwo = async() => {
const res = await resonTwoFetch({ return_reason: queryRef.current.return_reason })
@@ -264,7 +337,18 @@ export default () => {
// queryRef.current.return_explain = item.id
}
useEffect(() => {
getReason()
getReasonTwo()
}, [])
// 数组重置
const resetArr = (arr) => {
arr.map((it) => {
it.default = false
return it
})
return arr
}
// 重置
const handReset = () => {
queryRef.current.return_reason = 1
@@ -279,15 +363,6 @@ export default () => {
setReasonListTwo([...arrTwo])
}
// 数组重置
const resetArr = (arr) => {
arr.map((it) => {
it.default = false
return it
})
return arr
}
// 判断选择原因
const selectIsDisabled = useMemo(() => {
if (Query.return_explain !== '') {
@@ -327,18 +402,18 @@ export default () => {
// 货物情况
const [DescPopup, setDescPopup] = useState(false)
const { fetchData: statusFetch } = mpenumreturngoodsStatus()
const { fetchData: statusFetch } = MpEnumReturnGoodsStatus()
const [GoodStatusList, setGoodStatusList] = useState<any[]>([])
useEffect(() => {
getGoodStatus()
}, [])
const getGoodStatus = async() => {
const res = await statusFetch()
if (res.data) {
setGoodStatusList(res.data.list)
}
}
useEffect(() => {
getGoodStatus()
}, [])
const handStatus = (item) => {
GoodStatusList.map((it) => {
if (it.id === item.id) {
@@ -389,9 +464,10 @@ export default () => {
delta: 1,
})
}
// 备注信息
const [TextareaValue, setTextareaValue] = useState('')
// 确认退货
const { fetchData: sureFetch } = mpreturnApplyOrder()
const { fetchData: sureFetch } = MpReturnApplyOrder()
const handSure = () => {
if (Query.reasonNameTwo == '其他问题' && TextareaValue == '') {
Taro.showToast({
@@ -458,15 +534,13 @@ export default () => {
setQuery(Query)
}, [Query])
// 备注信息
const [TextareaValue, setTextareaValue] = useState('')
const getDesc = (e) => {
setTextareaValue(e)
}
return (
<View className={styles.main}>
<View className={styles.bgBox}>
<GoodsItem
<GoodsItemWithMemo
list={ListArr}
obj={infoObj}
handTui={item => handTui(item)}
@@ -475,7 +549,7 @@ export default () => {
handReduce={item => handReduce(item)}
handAdd={item => handAdd(item)}
onInputEven={(e, item) => onInputEven(e, item)}
></GoodsItem>
></GoodsItemWithMemo>
<View className={styles.hasSelect}>汇总:已选{totalNums}种商品</View>
</View>
<View className={styles.resonBig}>
@@ -589,82 +663,4 @@ export default () => {
</View>
)
}
// 产品商品元素
interface PropGoods {
list: any[]
obj: {
sale_mode?: number | string
}
handTui?: (any) => void
handCancel?: (any) => void
onBlur?: (e: any, obj: any) => void
onInputEven?: (e: any, obj: any) => void
handReduce?: (any) => void
handAdd?: (any) => void
}
const GoodsItem = memo((porps: PropGoods) => {
const { list = [], obj = {}, handTui, handCancel, onBlur, handReduce, handAdd, onInputEven } = porps
// const [value, setValue] = useState<any>({ count: 1 })
// const onInputEven = (e) => {
// let res = Number(e.detail.value)
// if (res < 1) {
// setValue({ count: 1 })
// } else {
// setValue({ count: res })
// }
// }
return (
<>
{
list.map((item, index) => {
return (
<View className={styles.goodsBox} key={index}>
<View className={styles.goodsProduct}>{item.product_code}# {item.product_name}</View>
<View className={styles.goodsLine}></View>
{
item.av_product_color.map((it, inx) => {
return (
<View className={styles.itemGoods} key={inx}>
<Image className={styles.itemPic} mode="aspectFill" src="https://test.cdn.zzfzyc.com/mall/no_img.png"></Image>
{/* <View className={styles.itemPic} style={{ backgroundColor: `rgb(${it?.rgb?.r} ${it?.rgb?.g} ${it?.rgb?.b})` }}></View> */}
<View className={styles.itemRight}>
<View className={styles.item_right_top}>
<View className={styles.itemName}>{it.product_color_code} {it.product_color_name}</View>
</View>
<View className={styles.item_right_Bottom}>
<View className={styles.itemMoney}>x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'}</View>
{
!it.isTui && <View className={styles.btn} onClick={() => handTui?.(it)}>退货</View>
}
{
(it.sale_mode != 0 && it.isTui) && <View className={styles.btnOne} onClick={() => handCancel?.(it)}>已选择退货</View>
}
{
(it.sale_mode == 0 && it.isTui) && <View className={styles.inputBox} >
<View className={styles.redceBox} onClick={() => handReduce?.(it)}>
<View className={styles.reduce}></View>
</View>
<View className={styles.inputBig}>
<Input type="number" value={it.nums} onInput={e => onInputEven?.(e, it)} maxlength={it.roll} onBlur={e => onBlur?.(e, it)}></Input>
</View>
<View className={styles.addBox} onClick={() => handAdd?.(it)}>
+
</View>
</View>
}
</View>
</View>
</View>
)
})
}
</View>
)
})
}
</>
)
})
export default ApplyGoods