🐳 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
+133 -130
View File
@@ -9,57 +9,99 @@ import styles from './index.module.scss'
import Popup from '@/components/popup'
import { debounce } from '@/common/util'
import {
mpsaleOrderpost,
mpsaleOrderpreView,
MpSaleOrderPost,
MpSaleOrderPreview,
} from '@/api/order'
import { alert } from '@/common/common'
import { formatDateTime, formatPriceDiv, formatWeightDiv } from '@/common/format'
import IconFont from '@/components/iconfont/iconfont'
export default () => {
// 卡片盒子元素
interface Obs {
title?: string
modeName?: string
showMode?: boolean
children?: ReactNode
clickNode?: () => void
}
const DefaultBox = (props: Obs) => {
const {
title = '标题',
modeName = '大货',
showMode = false,
children,
clickNode,
} = props
return (
<View className={styles.defaltBox}>
<View className={styles.titleBox}>
<View className={styles.title}>{title}</View>
{
showMode && <View className={styles.modeName} onClick={() => clickNode?.()}>{modeName}</View>
}
</View>
<View className={styles.modeLine}></View>
{children}
</View>
)
}
const DefaultBoxWithMemo = memo(DefaultBox)
// 产品商品元素
interface PropGoods {
// item?: {
// code?: string | number
// }
list: any[]
obj: {
sale_mode?: number | string
}
}
const GoodsItem = (porps: PropGoods) => {
const { list = [], obj = {} } = porps
return (
<>
{
list.map((item, index) => {
return (
<View className={styles.goodsBox} key={index}>
<View className={styles.goodsProduct}>{item.code}# {item.name}</View>
<View className={styles.goodsLine}></View>
{
item.product_colors.map((it, inx) => {
return (
<View className={styles.itemGoods} key={inx}>
<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.code} {it.name}</View>
<View className={styles.itemNums}>x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'}</View>
</View>
<View className={styles.item_right_Bottom}>
<View className={styles.itemMoney}>¥{it.sale_price / 100}/{obj?.sale_mode === 1 ? 'm' : 'kg'}</View>
<View className={styles.itemMoneyOne}>¥{formatPriceDiv(it.estimate_amount)}</View>
</View>
</View>
</View>
)
})
}
</View>
)
})
}
</>
)
}
const GoodsItemWithMemo = memo(GoodsItem)
const SubmitOrder = () => {
const router: any = useRouter()
const [infoObj, setInfoObj] = useState<any>({})
let selectId = -1
useDidShow(() => {
// 获取选择的地址
const pages = Taro.getCurrentPages()
const currPage = pages[pages.length - 1] // 获取当前页面
setInfoObj(val => ({
...val,
sale_mode: Number(router.params.sale_mode),
province_name: currPage.data?.addressObj?.province_name ? currPage.data?.addressObj?.province_name : '',
address_id: currPage.data?.addressObj?.id ? currPage.data?.addressObj?.id : '',
city_name: currPage.data?.addressObj?.city_name ? currPage.data?.addressObj?.city_name : '',
address_detail: currPage.data?.addressObj?.address_detail ? currPage.data?.addressObj?.address_detail : '',
district_name: currPage.data?.addressObj?.district_name ? currPage.data?.addressObj?.district_name : '',
target_user_name: currPage.data?.addressObj?.name ? currPage.data?.addressObj?.name : '',
purchaser_phone: currPage.data?.addressObj?.phone ? currPage.data?.addressObj?.phone : '',
}))
selectId = currPage.data?.addressObj?.id
const obj = currPage?.data?.ids?.filter((item) => { return item == selectId })
if (currPage?.data?.ids && obj.length === 0) {
setInfoObj(val => ({
...val,
sale_mode: Number(router.params.sale_mode),
province_name: '',
address_id: '',
city_name: '',
address_detail: '',
district_name: '',
target_user_name: '',
purchaser_phone: '',
}))
}
if (!currPage.data?.addressObj) {
setReceivingStatus(1)
}
else {
setReceivingStatus(2)
}
})
useEffect(() => {
getDetail()
}, [])
// 收货方法,1:自提,2物流
const [receivingStatus, setReceivingStatus] = useState<any>(null)
@@ -78,7 +120,7 @@ export default () => {
Taro.hideLoading()
}, 300)
const { fetchData: infoFetch } = mpsaleOrderpreView()
const { fetchData: infoFetch } = MpSaleOrderPreview()
const [pussName, setPusername] = useState<String>('')
// 获取订单详情
const getDetail = async() => {
@@ -116,7 +158,7 @@ export default () => {
}
// 提交订单
const { fetchData: postFetch } = mpsaleOrderpost()
const { fetchData: postFetch } = MpSaleOrderPost()
const handSure = () => {
if (receivingStatus == 2 && !infoObj.address_id) {
return alert.error('请选择地址')
@@ -174,6 +216,46 @@ export default () => {
useEffect(() => {
setInfoObj(infoObj)
}, [infoObj])
useDidShow(() => {
// 获取选择的地址
const pages = Taro.getCurrentPages()
const currPage = pages[pages.length - 1] // 获取当前页面
setInfoObj(val => ({
...val,
sale_mode: Number(router.params.sale_mode),
province_name: currPage.data?.addressObj?.province_name ? currPage.data?.addressObj?.province_name : '',
address_id: currPage.data?.addressObj?.id ? currPage.data?.addressObj?.id : '',
city_name: currPage.data?.addressObj?.city_name ? currPage.data?.addressObj?.city_name : '',
address_detail: currPage.data?.addressObj?.address_detail ? currPage.data?.addressObj?.address_detail : '',
district_name: currPage.data?.addressObj?.district_name ? currPage.data?.addressObj?.district_name : '',
target_user_name: currPage.data?.addressObj?.name ? currPage.data?.addressObj?.name : '',
purchaser_phone: currPage.data?.addressObj?.phone ? currPage.data?.addressObj?.phone : '',
}))
selectId = currPage.data?.addressObj?.id
const obj = currPage?.data?.ids?.filter((item) => { return item == selectId })
if (currPage?.data?.ids && obj.length === 0) {
setInfoObj(val => ({
...val,
sale_mode: Number(router.params.sale_mode),
province_name: '',
address_id: '',
city_name: '',
address_detail: '',
district_name: '',
target_user_name: '',
purchaser_phone: '',
}))
}
if (!currPage.data?.addressObj) {
setReceivingStatus(1)
}
else {
setReceivingStatus(2)
}
})
useEffect(() => {
getDetail()
}, [])
return (
<View className={styles.mainBox}>
<AddressDetailBox
@@ -182,7 +264,7 @@ export default () => {
receivingStatus={receivingStatus}
onReceivingStatus={(e, value) => onReceivingStatus(e, value)}
></AddressDetailBox>
<DefaultBox
<DefaultBoxWithMemo
showMode
title="客户信息"
modeName={infoObj.sale_mode_name}
@@ -191,10 +273,10 @@ export default () => {
<View className={styles.pussName}>{pussName}</View>
{/* <View className={styles.pussPhone}>{infoObj.purchaser_phone}</View> */}
</View>
</DefaultBox>
</DefaultBoxWithMemo>
{/* <View className={styles.total}> {infoObj.product_list?.length} 种面料,{infoObj.total_colors} 个颜色,共 {infoObj.sale_mode === 0 ? infoObj.total_number : infoObj.total_number / 100} {infoObj.sale_mode === 0 ? '条' : 'm'}</View> */}
<View className={styles.productBox}>
<GoodsItem list={infoObj?.product_list} obj={infoObj}></GoodsItem>
<GoodsItemWithMemo list={infoObj?.product_list} obj={infoObj}></GoodsItemWithMemo>
<View className={styles.flexMoney}>
<View className={styles.flexTotalBox}>
<View className={styles.totalFont}>合计金额</View>
@@ -204,9 +286,9 @@ export default () => {
<View className={styles.shoudPay}>¥{formatPriceDiv(infoObj.estimate_amount)}</View>
</View>
</View>
<DefaultBox title="备注信息" showMode modeName={`${'填写/修改备注'} >`} clickNode={() => setShowDesc(true)}>
<DefaultBoxWithMemo title="备注信息" showMode modeName={`${'填写/修改备注'} >`} clickNode={() => setShowDesc(true)}>
<View className={styles.remarkFont}>{infoObj.remark === '' ? '暂无' : infoObj.remark}</View>
</DefaultBox>
</DefaultBoxWithMemo>
<Popup show={showDesc} showTitle={false} onClose={() => setShowDesc(false)}>
<Remark onSave={e => getRemark(e)} defaultValue={infoObj.remark} showInput={!!showDesc} />
</Popup>
@@ -224,83 +306,4 @@ export default () => {
</View>
)
}
// 卡片盒子元素
interface Obs {
title?: string
modeName?: string
showMode?: boolean
children?: ReactNode
clickNode?: () => void
}
const DefaultBox = memo((props: Obs) => {
const {
title = '标题',
modeName = '大货',
showMode = false,
children,
clickNode,
} = props
return (
<View className={styles.defaltBox}>
<View className={styles.titleBox}>
<View className={styles.title}>{title}</View>
{
showMode && <View className={styles.modeName} onClick={() => clickNode?.()}>{modeName}</View>
}
</View>
<View className={styles.modeLine}></View>
{children}
</View>
)
})
// 产品商品元素
interface PropGoods {
// item?: {
// code?: string | number
// }
list: any[]
obj: {
sale_mode?: number | string
}
}
const GoodsItem = memo((porps: PropGoods) => {
const { list = [], obj = {} } = porps
return (
<>
{
list.map((item, index) => {
return (
<View className={styles.goodsBox} key={index}>
<View className={styles.goodsProduct}>{item.code}# {item.name}</View>
<View className={styles.goodsLine}></View>
{
item.product_colors.map((it, inx) => {
return (
<View className={styles.itemGoods}>
<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.code} {it.name}</View>
<View className={styles.itemNums}>x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'}</View>
</View>
<View className={styles.item_right_Bottom}>
<View className={styles.itemMoney}>¥{it.sale_price / 100}/{obj?.sale_mode === 1 ? 'm' : 'kg'}</View>
<View className={styles.itemMoneyOne}>¥{formatPriceDiv(it.estimate_amount)}</View>
</View>
</View>
</View>
)
})
}
</View>
)
})
}
</>
)
})
export default SubmitOrder