🌈 style(eslint): 解决eslint的错误❌

This commit is contained in:
xuan
2022-12-01 18:10:18 +08:00
parent bd06efef61
commit 9e7b4d7d56
22 changed files with 222 additions and 223 deletions
+1 -2
View File
@@ -1,10 +1,9 @@
import Taro, { showModal, useDidShow, useRouter } from '@tarojs/taro'
import { Button, Navigator, ScrollView, Text, View } from '@tarojs/components'
import { forwardRef, memo, useEffect, useImperativeHandle, useState } from 'react'
import './index.scss'
import { MpPurchaserAddressList } from '@/api/addressList'
import { alert } from '@/common/common'
import Taro, { showModal, useDidShow, useRouter } from '@tarojs/taro'
import IconFont from '@/components/iconfont/iconfont'
import { MpSaleOrderAddress } from '@/api/order'
+16 -18
View File
@@ -16,8 +16,7 @@ interface Param {
}|null
onClick?: (val: number) => void // 点击后触发的事件,返回订单状态
}
export default memo(({ orderInfo, onClick }: Param) => {
const AfterOrderBtns = ({ orderInfo, onClick }: Param) => {
// 订单状态枚举
const {
SaleOrderStatusBooking,
@@ -93,15 +92,15 @@ export default memo(({ orderInfo, onClick }: Param) => {
if (item.id == 1) {
// 取消订单按钮
return (orderInfo.actual_amount == 0 && item.value.includes(orderInfo.status)) // 在待发货之前没有付过款
}
}
else if (item.id == 2) {
// 去付款按钮
return (orderInfo.wait_pay_amount != 0 && item.value.includes(orderInfo.status)) // 只要没有付完款就显示
}
}
else if (item.id == 3) {
// 申请退款, 只有大货才有
return (orderInfo.sale_mode == SaLeModeBulk.value && orderInfo.actual_amount != 0 && item.value.includes(orderInfo.status)) // 大货在待发货付过款
}
}
else if (item.id == 8) {
// 退款按钮(直接退款不用申请), 只有散剪和剪板有
return (orderInfo.sale_mode != SaLeModeBulk.value && orderInfo.actual_amount != 0 && item.value.includes(orderInfo.status)) // 散剪和剪板在待接单时付过款
@@ -120,13 +119,6 @@ export default memo(({ orderInfo, onClick }: Param) => {
})
}, [orderInfo])
// 点击按钮操作
const submitBtns = (val, index) => {
(val == 1) && cancelOrder(); // 取消订单按钮
(val == 2) && onClick?.(2); // 去付款按钮
(val == 6) && receiveOrder() // 确认收货
}
// 取消订单
const { fetchData: cancelFetchData } = CancelOrderApi()
const cancelOrder = () => {
@@ -138,11 +130,11 @@ export default memo(({ orderInfo, onClick }: Param) => {
if (res.success) {
alert.success('取消成功')
onClick?.(1)
}
}
else {
alert.none(res.msg)
}
}
}
else if (res.cancel) {
console.log('用户点击取消')
}
@@ -162,18 +154,23 @@ export default memo(({ orderInfo, onClick }: Param) => {
if (res.success) {
onClick?.(6)
alert.success('收货成功')
}
}
else {
alert.error('收货失败')
}
}
}
else if (res.cancel) {
console.log('用户点击取消')
}
},
})
}
// 点击按钮操作
const submitBtns = (val, index) => {
(val == 1) && cancelOrder(); // 取消订单按钮
(val == 2) && onClick?.(2); // 去付款按钮
(val == 6) && receiveOrder() // 确认收货
}
// 显示更多按钮
const [showMore, setShowMore] = useState(false)
const styleTop = useMemo(() => {
@@ -202,4 +199,5 @@ export default memo(({ orderInfo, onClick }: Param) => {
</View>
)
})
}
export default memo(AfterOrderBtns)
+12 -14
View File
@@ -87,19 +87,6 @@ const AfterOrderBtns = ({ orderInfo, onClick, fixedBottom = true }: Param) => {
})
}, [orderInfo])
// 点击按钮操作
const submitBtns = throttle((val, index) => {
if (val == 1) {
cancelOrder({ title: '要取消退货吗?', val })
}
else if (val == 6) {
cancelOrder({ title: '要取消退款吗?', val })
}
else {
onClick?.(val)
}
}, 600)
// 取消退货/退款
const { fetchData: returnApplyOrderCancelFetchData } = ReturnApplyOrderCancelApi()
const cancelOrder = ({ title = '', val }) => {
@@ -122,7 +109,18 @@ const AfterOrderBtns = ({ orderInfo, onClick, fixedBottom = true }: Param) => {
},
})
}
// 点击按钮操作
const submitBtns = throttle((val, index) => {
if (val == 1) {
cancelOrder({ title: '要取消退货吗?', val })
}
else if (val == 6) {
cancelOrder({ title: '要取消退款吗?', val })
}
else {
onClick?.(val)
}
}, 600)
// 显示更多按钮
const [showMore, setShowMore] = useState(false)
const styleTop = useMemo(() => {
+15 -12
View File
@@ -8,7 +8,7 @@ import SearchInput from '@/components/searchInput'
import Popup from '@/components/bluetooth/Popup'
import useCheckAuthorize from '@/use/useCheckAuthorize'
export default memo(() => {
const LinkBlueTooth = () => {
const { state, init, startScan, connect, disconnect } = useBluetooth()
const { check } = useCheckAuthorize({ scope: 'scope.bluetooth', msg: '请开启小程序蓝牙权限' })
@@ -21,10 +21,10 @@ export default memo(() => {
useEffect(() => {
if (!state.available) {
setLinkStatus(1)
}
}
else if (state.available && state.connected?.name) {
setLinkStatus(3)
}
}
else {
setLinkStatus(2)
}
@@ -40,6 +40,9 @@ export default memo(() => {
}
const [popupShow, setPopupShow] = useState(false)
const onFindEven = () => {
if (!state.discovering && !state.connected && !state.connecting) { startScan() }
}
// 显示设备列表
const onFindDevice = () => {
check().then((res) => {
@@ -48,16 +51,13 @@ export default memo(() => {
title: '请打开手机蓝牙',
icon: 'none',
})
}
}
else {
setPopupShow(true)
onFindEven()
}
})
}
const onFindEven = () => {
if (!state.discovering && !state.connected && !state.connecting) { startScan() }
}
// 断开链接
const onDisconnect = () => {
@@ -72,9 +72,11 @@ export default memo(() => {
<View className={styles.bluetooth_link} onClick={onFindDevice}>
<View className={classnames(styles.link_status, linkStatus == 3 && styles.link_statused, linkStatus == 2 && styles.link_statused_no)}></View>
{
linkStatus == 1 && <View className={classnames(styles.link_name, styles.link_name_no)}>请开启蓝牙</View>
|| linkStatus == 2 && <View className={classnames(styles.link_name, styles.link_name_no_link)}>未连接设备</View>
|| linkStatus == 3 && <View className={classnames(styles.link_name)}>{linkName}</View>
linkStatus == 1
? <View className={classnames(styles.link_name, styles.link_name_no)}>请开启蓝牙</View>
: linkStatus == 2
? <View className={classnames(styles.link_name, styles.link_name_no_link)}>未连接设备</View>
: linkStatus == 3 ? <View className={classnames(styles.link_name)}>{linkName}</View> : null
}
</View>
</SearchInput>
@@ -89,5 +91,6 @@ export default memo(() => {
</View>
</>
)
})
)
}
export default memo(LinkBlueTooth)
+3 -3
View File
@@ -7,8 +7,7 @@ interface Params {
onClose?: () => void
styleObj?: Object
}
export default memo(({ onClose, styleObj = {} }: Params) => {
const CloseBtn = ({ onClose, styleObj = {} }: Params) => {
return (
<View style={styleObj} className={style.icon_a_cuowuwrong_self} onClick={onClose}>
<View className={style.icon_a_btn}>
@@ -16,4 +15,5 @@ export default memo(({ onClose, styleObj = {} }: Params) => {
</View>
</View>
)
})
}
export default memo(CloseBtn)
+1 -1
View File
@@ -1,8 +1,8 @@
import { Block, View } from '@tarojs/components'
import Taro from '@tarojs/taro'
import type { FC } from 'react'
import React, { useEffect, useState } from 'react'
import './iconfont.scss'
import Taro from '@tarojs/taro'
import classnames from 'classnames'
const SystemWidth = Taro.getSystemInfoSync().windowWidth
+16 -18
View File
@@ -16,8 +16,7 @@ interface Param {
}|null
onClick?: (val: number) => void // 点击后触发的事件,返回订单状态
}
export default memo(({ orderInfo, onClick }: Param) => {
const OrderBtns = ({ orderInfo, onClick }: Param) => {
// 订单状态枚举
const {
SaleOrderStatusBooking,
@@ -93,15 +92,15 @@ export default memo(({ orderInfo, onClick }: Param) => {
if (item.id == 1) {
// 取消订单按钮
return (orderInfo.actual_amount == 0 && item.value.includes(orderInfo.status)) // 在待发货之前没有付过款
}
}
else if (item.id == 2) {
// 去付款按钮
return (orderInfo.wait_pay_amount != 0 && item.value.includes(orderInfo.status)) // 只要没有付完款就显示
}
}
else if (item.id == 3) {
// 申请退款, 只有大货才有
return (orderInfo.sale_mode == SaLeModeBulk.value && orderInfo.actual_amount != 0 && item.value.includes(orderInfo.status)) // 大货在待发货付过款
}
}
else if (item.id == 8) {
// 退款按钮(直接退款不用申请), 只有散剪和剪板有
return (orderInfo.sale_mode != SaLeModeBulk.value && orderInfo.actual_amount != 0 && item.value.includes(orderInfo.status)) // 散剪和剪板在待接单时付过款
@@ -120,13 +119,6 @@ export default memo(({ orderInfo, onClick }: Param) => {
})
}, [orderInfo])
// 点击按钮操作
const submitBtns = (val, index) => {
(val == 1) && cancelOrder(); // 取消订单按钮
(val == 2) && onClick?.(2); // 去付款按钮
(val == 6) && receiveOrder() // 确认收货
}
// 取消订单
const { fetchData: cancelFetchData } = CancelOrderApi()
const cancelOrder = () => {
@@ -138,11 +130,11 @@ export default memo(({ orderInfo, onClick }: Param) => {
if (res.success) {
alert.success('取消成功')
onClick?.(1)
}
}
else {
alert.none(res.msg)
}
}
}
else if (res.cancel) {
console.log('用户点击取消')
}
@@ -162,18 +154,23 @@ export default memo(({ orderInfo, onClick }: Param) => {
if (res.success) {
onClick?.(6)
alert.success('收货成功')
}
}
else {
alert.error('收货失败')
}
}
}
else if (res.cancel) {
console.log('用户点击取消')
}
},
})
}
// 点击按钮操作
const submitBtns = (val, index) => {
(val == 1) && cancelOrder(); // 取消订单按钮
(val == 2) && onClick?.(2); // 去付款按钮
(val == 6) && receiveOrder() // 确认收货
}
// 显示更多按钮
const [showMore, setShowMore] = useState(false)
const styleTop = useMemo(() => {
@@ -202,4 +199,5 @@ export default memo(({ orderInfo, onClick }: Param) => {
</View>
)
})
}
export default memo(OrderBtns)
+1 -1
View File
@@ -1,7 +1,7 @@
import Popup from '@/components/popup'
import { memo } from 'react'
import './index.scss'
import TimePicker from '../timePicker'
import Popup from '@/components/popup'
type DateArg = string | number | Date
interface Props {