🌈 style(eslint): add eslint rules

This commit is contained in:
xuan
2022-11-26 14:35:05 +08:00
parent f3aa20f049
commit 99a920975f
245 changed files with 14909 additions and 14349 deletions
@@ -1,104 +1,101 @@
import { ScrollView, View, Text, Input } from '@tarojs/components'
import { memo, useCallback, useEffect, useMemo, useState } from 'react'
import styles from './index.module.scss'
import classnames from 'classnames'
// import BottomBtns from '@/components/BottomBtns'
import { formatPriceDiv, formatDateTime } from '@/common/format'
import { Input, ScrollView, Text, View } from '@tarojs/components'
import Taro from '@tarojs/taro'
import { memo, useCallback, useEffect, useMemo, useState } from 'react'
import classnames from 'classnames'
import styles from './index.module.scss'
// import BottomBtns from '@/components/BottomBtns'
import { formatDateTime, formatPriceDiv } from '@/common/format'
import IconFont from '@/components/iconfont/iconfont'
import UploadImage from '@/components/uploadImage'
interface Params {
title?: string, //传入的名称
require?: boolean, //是否显示必须选填的内容图标
isInput?: boolean, //是否显示输入框
inputValue?: string, //输入框的值
inputType?: any, //输入框类型
getInput?: (any) => void //输入框回调
showScan?: boolean, //是否显示扫描图标
placeholderFont?: string, //输入框默认文本
showMore?: boolean, // 是否显示更多图标
disabled?: boolean, // 是否输入框禁止
onlyRead?: boolean, //图片是否只读
showPic?: boolean, // 是否显示图片组件
getImageList?: (any) => void //上传图片回调
PicList?: any[], //默认图片列表
styleNone?: boolean, //根据不同的栏目调整样式
getScan?: (any) => void, // 扫描
navTo?: () => void, //跳转选择
showSizeFont?: boolean, //展示金额的大写
bigMoney?: any //展示的大写金额
title?: string // 传入的名称
require?: boolean // 是否显示必须选填的内容图标
isInput?: boolean // 是否显示输入框
inputValue?: string // 输入框的值
inputType?: any // 输入框类型
getInput?: (any) => void // 输入框回调
showScan?: boolean // 是否显示扫描图标
placeholderFont?: string // 输入框默认文本
showMore?: boolean // 是否显示更多图标
disabled?: boolean // 是否输入框禁止
onlyRead?: boolean // 图片是否只读
showPic?: boolean // 是否显示图片组件
getImageList?: (any) => void // 上传图片回调
PicList?: any[] // 默认图片列表
styleNone?: boolean // 根据不同的栏目调整样式
getScan?: (any) => void // 扫描
navTo?: () => void // 跳转选择
showSizeFont?: boolean // 展示金额的大写
bigMoney?: any // 展示的大写金额
}
export default memo((pros: Params) => {
return (
<View className={styles.itemBox}
style={{ justifyContent: `${pros.styleNone ? 'space-between' : ''}`, alignItems: `${pros.styleNone ? 'center' : ''}` }}>
<View className={styles.itemLeft}
>
<View className={styles.finkFlex}>
<View className={styles.itemTitle}>{pros.title}</View>
{
pros.require && <Text className={styles.xing}>*</Text>
}
</View>
{
pros.showSizeFont && <View className={styles.finkFont}>展示大小写</View>
}
</View>
{
pros.showPic &&
<View className={styles.bigPic}>
<UploadImage onChange={pros.getImageList} defaultList={pros.PicList} onlyRead={pros.onlyRead} />
</View>
}
{
!pros.showPic && <View className={styles.itemRight} onClick={() => pros.navTo?.()}
style={{
justifyContent: `${!pros.showSizeFont ? 'space-between' : ''}`, alignItems: `${!pros.showSizeFont ? 'center' : ''}`,
display: `${!pros.showSizeFont ? 'flex' : ''}`
}}
>
<View className={styles.rightFlex}>
{
pros.isInput && <Input
disabled={pros.disabled}
placeholder={pros.placeholderFont}
value={pros.inputValue}
className={styles.inputStyle}
type={pros.inputType}
placeholderStyle={styles.placeholderStyle}
onBlur={(e) => pros.getInput?.(e.detail.value)}
></Input>
}
{
!pros.isInput && <View className={styles.inputStyle}>{pros.inputValue}</View>
}
</View>
<View className={styles.iconFlex}></View>
{
pros.showMore && <IconFont name={'icon-chakanquanbukehu'} size={50} color={'#000000'}></IconFont>
}
{
pros.showScan && <View className={styles.shu}></View>
}
{
pros.showScan && <View onClick={(e) => pros.getScan?.(e)}><IconFont name={'icon-saomiao'} size={50} color={'#337FFF'}></IconFont></View>
}
{
pros.showSizeFont && <View className={styles.assginFont}>{pros.bigMoney}</View>
}
</View>
}
return (
<View className={styles.itemBox}
style={{ justifyContent: `${pros.styleNone ? 'space-between' : ''}`, alignItems: `${pros.styleNone ? 'center' : ''}` }}
>
<View className={styles.itemLeft}>
<View className={styles.finkFlex}>
<View className={styles.itemTitle}>{pros.title}</View>
{
pros.require && <Text className={styles.xing}>*</Text>
}
</View>
)
})
{
pros.showSizeFont && <View className={styles.finkFont}>展示大小写</View>
}
</View>
{
pros.showPic
&& <View className={styles.bigPic}>
<UploadImage onChange={pros.getImageList} defaultList={pros.PicList} onlyRead={pros.onlyRead} />
</View>
}
{
!pros.showPic && <View className={styles.itemRight} onClick={() => pros.navTo?.()}
style={{
justifyContent: `${!pros.showSizeFont ? 'space-between' : ''}`,
alignItems: `${!pros.showSizeFont ? 'center' : ''}`,
display: `${!pros.showSizeFont ? 'flex' : ''}`,
}}
>
<View className={styles.rightFlex}>
{
pros.isInput && <Input
disabled={pros.disabled}
placeholder={pros.placeholderFont}
value={pros.inputValue}
className={styles.inputStyle}
type={pros.inputType}
placeholderStyle={styles.placeholderStyle}
onBlur={e => pros.getInput?.(e.detail.value)}
></Input>
}
{
!pros.isInput && <View className={styles.inputStyle}>{pros.inputValue}</View>
}
</View>
<View className={styles.iconFlex}></View>
{
pros.showMore && <IconFont name="icon-chakanquanbukehu" size={50} color="#000000"></IconFont>
}
{
pros.showScan && <View className={styles.shu}></View>
}
{
pros.showScan && <View onClick={e => pros.getScan?.(e)}><IconFont name="icon-saomiao" size={50} color="#337FFF"></IconFont></View>
}
{
pros.showSizeFont && <View className={styles.assginFont}>{pros.bigMoney}</View>
}
</View>
}
</View>
)
})
+127 -131
View File
@@ -1,88 +1,84 @@
import { View, Input, Button, Textarea } from '@tarojs/components'
import { useCallback, useEffect, useMemo, useRef, useState, } from 'react'
import { Button, Input, Textarea, View } from '@tarojs/components'
import Taro, { faceVerifyForPay, useDidShow, useRouter } from '@tarojs/taro'
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import classnames from 'classnames'
import dayjs from 'dayjs'
import styles from './index.module.scss'
import Form from './components/form'
import Search from '@/components/search'
import { dataLoadingStatus, getFilterData } from '@/common/util'
import styles from "./index.module.scss"
import classnames from "classnames";
import Popup from '@/components/popup'
import InfiniteScroll from '@/components/infiniteScroll'
import Taro, { faceVerifyForPay, useDidShow, useRouter } from '@tarojs/taro'
import Form from './components/form'
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
import {
mpcashManagementOrder
} from "@/api/newCollection"
import TimePicker from "@/components/timePicker"
import dayjs from 'dayjs'
import { alert } from "@/common/common"
mpcashManagementOrder,
} from '@/api/newCollection'
import TimePicker from '@/components/timePicker'
import { alert } from '@/common/common'
import smallToBig from '@/common/money'
import { IMG_CND_Prefix } from "@/common/constant";
import { IMG_CND_Prefix } from '@/common/constant'
export default () => {
const router = useRouter()
const [Query, setQuery] = useState<any>({})
const { fetchData: getFetch } = mpcashManagementOrder()
useEffect(() => {
getDetail()
}, [])
const getDetail = async () => {
Taro.showLoading({
title: '请稍等',
mask: true
})
const res = await getFetch({ id: Number(router.params.id) })
if (res.data) {
// res.data?.payment_credential_url?.map(it => {
// it = IMG_CND_Prefix + it
// return it
// })
Taro.hideLoading()
setQuery(res.data)
}
const router = useRouter()
const [Query, setQuery] = useState<any>({})
const { fetchData: getFetch } = mpcashManagementOrder()
useEffect(() => {
getDetail()
}, [])
const getDetail = async() => {
Taro.showLoading({
title: '请稍等',
mask: true,
})
const res = await getFetch({ id: Number(router.params.id) })
if (res.data) {
// res.data?.payment_credential_url?.map(it => {
// it = IMG_CND_Prefix + it
// return it
// })
Taro.hideLoading()
setQuery(res.data)
}
}
useEffect(() => {
setQuery(Query)
}, [Query])
useEffect(() => {
setQuery(Query)
}, [Query])
const money = useMemo(() => {
let res = 0
res = Query.receipt_amount / 100
return res
}, [Query])
const money = useMemo(() => {
let res = 0
res = Query.receipt_amount / 100
return res
}, [Query])
return (
<>
<View className={styles.topBox}>
<View className={styles.topFont}>收款金额(元)</View>
<View className={styles.topMon}>{money}</View>
<View className={styles.topBigMon}>{smallToBig(typeof (money) == 'undefined' ? 0 : money)}</View>
</View>
<View className={styles.addBox}>
<View className={styles.msgBox}>
<View className={styles.msgLeft}>订单编号</View>
<View className={styles.msgFlex}>
<View className={styles.msgName}>{Query.order_no}</View>
<View className={styles.msgTime} style={{ color: '#E42945' }}>{Query.auditor_status_name}</View>
</View>
</View>
<Form
title={'客户名称'}
require={false}
isInput={true}
disabled={true}
inputValue={Query.purchaser_name}
showMore={false}
showScan={false}
styleNone={true}
showPic={false}
showSizeFont={false}
></Form>
{/* <Form
return (
<>
<View className={styles.topBox}>
<View className={styles.topFont}>收款金额(元)</View>
<View className={styles.topMon}>{money}</View>
<View className={styles.topBigMon}>{smallToBig(typeof (money) == 'undefined' ? 0 : money)}</View>
</View>
<View className={styles.addBox}>
<View className={styles.msgBox}>
<View className={styles.msgLeft}>订单编号</View>
<View className={styles.msgFlex}>
<View className={styles.msgName}>{Query.order_no}</View>
<View className={styles.msgTime} style={{ color: '#E42945' }}>{Query.auditor_status_name}</View>
</View>
</View>
<Form
title="客户名称"
require={false}
isInput
disabled
inputValue={Query.purchaser_name}
showMore={false}
showScan={false}
styleNone
showPic={false}
showSizeFont={false}
></Form>
{/* <Form
title={'收款金额'}
require={false}
isInput={true}
@@ -96,63 +92,63 @@ export default () => {
showSizeFont={true}
bigMoney={smallToBig(typeof (money) == 'undefined' ? 0 : money)}
></Form> */}
<Form
styleNone={false}
title={'收款凭证'}
require={false}
PicList={Query?.payment_credential_url}
isInput={false}
showMore={false}
showScan={false}
onlyRead={true}
showPic={true}
showSizeFont={false}
></Form>
<Form
title={'收款账户'}
require={false}
isInput={false}
disabled={true}
inputValue={Query.receiving_account}
showMore={false}
showScan={false}
styleNone={true}
showPic={false}
showSizeFont={false}
></Form>
<View className={styles.textAreaBox}>
<View className={styles.textAreaLeft}>备注信息</View>
<View className={styles.textAreaRight}>
{
Query.remark !== '' && <Textarea
disabled={true}
style={{ width: '70%' }}
value={Query.remark}
placeholderStyle='font-size: 28rpx;font-weight: 400;'
autoFocus
maxlength={64}
></Textarea>
}
<Form
styleNone={false}
title="收款凭证"
require={false}
PicList={Query?.payment_credential_url}
isInput={false}
showMore={false}
showScan={false}
onlyRead
showPic
showSizeFont={false}
></Form>
<Form
title="收款账户"
require={false}
isInput={false}
disabled
inputValue={Query.receiving_account}
showMore={false}
showScan={false}
styleNone
showPic={false}
showSizeFont={false}
></Form>
<View className={styles.textAreaBox}>
<View className={styles.textAreaLeft}>备注信息</View>
<View className={styles.textAreaRight}>
{
Query.remark !== '' && <Textarea
disabled
style={{ width: '70%' }}
value={Query.remark}
placeholderStyle="font-size: 28rpx;font-weight: 400;"
autoFocus
maxlength={64}
></Textarea>
}
{/* <View className={styles.numsTotal}>{`${typeof (Query.nums) == 'undefined' ? 0 : Query.nums}/64`}</View> */}
</View>
</View>
<View className={styles.msgBox}>
<View className={styles.msgLeft}>创建信息</View>
<View className={styles.msgFlex}>
<View className={styles.msgName}>{Query.creator_name}</View>
<View className={styles.msgTime}>{formatDateTime(Query.create_time)}</View>
</View>
</View>
<View className={styles.msgBox} style={{ borderBottom: 'none', paddingBottom: '10rpx' }}>
<View className={styles.msgLeft}>审核信息</View>
<View className={styles.msgFlex}>
<View className={styles.msgName}>{Query.auditor_name}</View>
<View className={styles.msgTime}>{formatDateTime(Query.audit_time)}</View>
</View>
</View>
</View >
<View className={styles.safeBox} style={{ height: '200rpx' }}></View>
</>
)
}
{/* <View className={styles.numsTotal}>{`${typeof (Query.nums) == 'undefined' ? 0 : Query.nums}/64`}</View> */}
</View>
</View>
<View className={styles.msgBox}>
<View className={styles.msgLeft}>创建信息</View>
<View className={styles.msgFlex}>
<View className={styles.msgName}>{Query.creator_name}</View>
<View className={styles.msgTime}>{formatDateTime(Query.create_time)}</View>
</View>
</View>
<View className={styles.msgBox} style={{ borderBottom: 'none', paddingBottom: '10rpx' }}>
<View className={styles.msgLeft}>审核信息</View>
<View className={styles.msgFlex}>
<View className={styles.msgName}>{Query.auditor_name}</View>
<View className={styles.msgTime}>{formatDateTime(Query.audit_time)}</View>
</View>
</View>
</View >
<View className={styles.safeBox} style={{ height: '200rpx' }}></View>
</>
)
}