🐳 chore(eslint): 修正所有文件的eslint 错误❌
This commit is contained in:
+112
-116
@@ -5,19 +5,96 @@ import classnames from 'classnames'
|
||||
import styles from './index.module.scss'
|
||||
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||
import {
|
||||
mpenumrefundExplainone,
|
||||
mpreturnApplyOrder,
|
||||
mpsaleOrder,
|
||||
MpEnumRefundExplainOne,
|
||||
MpReturnApplyOrder,
|
||||
MpSaleOrder,
|
||||
} from '@/api/order'
|
||||
import Popup from '@/components/popup'
|
||||
|
||||
export default () => {
|
||||
useEffect(() => {
|
||||
getDetail()
|
||||
getEnum()
|
||||
}, [])
|
||||
// 产品商品元素
|
||||
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 ApplyMoney = () => {
|
||||
const Router = useRouter()
|
||||
const { fetchData: infoFetch } = mpsaleOrder()
|
||||
const { fetchData: infoFetch } = MpSaleOrder()
|
||||
const [ListArr, setListArr] = useState<any[]>([])
|
||||
const [infoObj, setInfoObj] = useState<any>({})
|
||||
|
||||
@@ -30,7 +107,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 +209,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])
|
||||
@@ -149,14 +222,20 @@ export default () => {
|
||||
|
||||
// 获取枚举
|
||||
const [List, setList] = useState<any[]>([])
|
||||
const { fetchData: explanFetch } = mpenumrefundExplainone()
|
||||
const { fetchData: explanFetch } = MpEnumRefundExplainOne()
|
||||
const getEnum = async() => {
|
||||
const res = await explanFetch()
|
||||
if (res.data) {
|
||||
setList(res.data.list)
|
||||
}
|
||||
}
|
||||
|
||||
const queryRef = useRef({
|
||||
reasonName: '请选择',
|
||||
})
|
||||
const [Query, setQuery] = useState<any>({
|
||||
reasonId: '',
|
||||
reasonName: '请选择',
|
||||
})
|
||||
// 选择退货原因
|
||||
const handReasonOne = (item) => {
|
||||
List.map((it) => {
|
||||
@@ -176,14 +255,6 @@ export default () => {
|
||||
// 筛选内容展示
|
||||
const [showPopup, setshowPopup] = useState(false)
|
||||
|
||||
const queryRef = useRef({
|
||||
reasonName: '请选择',
|
||||
})
|
||||
const [Query, setQuery] = useState<any>({
|
||||
reasonId: '',
|
||||
reasonName: '请选择',
|
||||
})
|
||||
|
||||
// 备注信息
|
||||
const [TextareaValue, setTextareaValue] = useState('')
|
||||
const getDesc = (e) => {
|
||||
@@ -214,7 +285,14 @@ export default () => {
|
||||
})
|
||||
return arr.length
|
||||
}, [ListArr])
|
||||
|
||||
// 数组重置
|
||||
const resetArr = (arr) => {
|
||||
arr.map((it) => {
|
||||
it.default = false
|
||||
return it
|
||||
})
|
||||
return arr
|
||||
}
|
||||
// 重置
|
||||
const handReset = () => {
|
||||
setQuery(({ reasonId: '', reasonName: '请选择' }))
|
||||
@@ -251,17 +329,13 @@ export default () => {
|
||||
return true
|
||||
}
|
||||
}, [Query])
|
||||
useEffect(() => {
|
||||
getDetail()
|
||||
getEnum()
|
||||
}, [])
|
||||
|
||||
// 数组重置
|
||||
const resetArr = (arr) => {
|
||||
arr.map((it) => {
|
||||
it.default = false
|
||||
return it
|
||||
})
|
||||
return arr
|
||||
}
|
||||
// 确认退款
|
||||
const { fetchData: sureFetch } = mpreturnApplyOrder()
|
||||
const { fetchData: sureFetch } = MpReturnApplyOrder()
|
||||
const handSure = () => {
|
||||
if (queryRef.current.reasonName == '其他问题' && TextareaValue == '') {
|
||||
Taro.showToast({
|
||||
@@ -354,7 +428,7 @@ export default () => {
|
||||
<View className={styles.main}>
|
||||
{
|
||||
showItem && <View className={styles.bgBox}>
|
||||
<GoodsItem
|
||||
<GoodsItemWithMemo
|
||||
list={ListArr}
|
||||
obj={infoObj}
|
||||
handTui={item => handTui(item)}
|
||||
@@ -363,7 +437,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>
|
||||
}
|
||||
@@ -435,82 +509,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 ApplyMoney
|
||||
|
||||
Reference in New Issue
Block a user