🌈 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

View File

@ -7,6 +7,7 @@
"eqeqeq": "off", "eqeqeq": "off",
"no-prototype-builtins": "off", "no-prototype-builtins": "off",
"import/first": "off", "import/first": "off",
"react/no-children-prop": "off" "react/no-children-prop": "off",
"import/no-commonjs": "off"
} }
} }

2
global.d.ts vendored
View File

@ -1,4 +1,4 @@
/// <reference path="node_modules/@tarojs/plugin-platform-weapp/types/shims-weapp.d.ts" /> /// <reference types="@tarojs/taro" />
declare module '*.png' declare module '*.png'
declare module '*.gif' declare module '*.gif'

View File

@ -4,7 +4,7 @@ import { useRequest } from '@/use/useHttp'
export { LoginApi } from './login/index' export { LoginApi } from './login/index'
export { export {
productabsorbcontrast, ProductAbsorbContrast,
SelectProductListApi, SelectProductListApi,
ColorListApi, ColorListApi,
ColorDetailedApi, ColorDetailedApi,

View File

@ -1,3 +1,3 @@
export { productabsorbcontrast, SelectProductListApi } from './product' export { ProductAbsorbContrast, SelectProductListApi } from './product'
export { ColorListApi, ColorDetailedApi, ColorSamplingSaveApi, TextureSaveApi } from './takeColor' export { ColorListApi, ColorDetailedApi, ColorSamplingSaveApi, TextureSaveApi } from './takeColor'
export { FindColorListApi } from './findColor' export { FindColorListApi } from './findColor'

View File

@ -1,7 +1,7 @@
import { useRequest } from '@/use/useHttp' import { useRequest } from '@/use/useHttp'
// 取色对比 // 取色对比
export const productabsorbcontrast = () => { export const ProductAbsorbContrast = () => {
return useRequest({ return useRequest({
url: '/v2/mp/product/color/absorb/contrast', url: '/v2/mp/product/color/absorb/contrast',
method: 'get', method: 'get',

View File

@ -18,9 +18,9 @@ const smallToBig = function(money) {
const cnInteger = '整' // 整数金额时后面跟的字符 const cnInteger = '整' // 整数金额时后面跟的字符
const cnIntLast = '元' // 整数完以后的单位 const cnIntLast = '元' // 整数完以后的单位
// 最大处理的数字 // 最大处理的数字
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
const maxNum = 999999999999999.9999 const maxNum = 999999999999999.9999
let integerNum // 金额整数部分
let decimalNum // 金额小数部分
// 输出的中文金额字符串 // 输出的中文金额字符串
let chineseStr = '' let chineseStr = ''
let parts // 分离金额后用的数组,预定义 let parts // 分离金额后用的数组,预定义
@ -40,15 +40,15 @@ const smallToBig = function(money) {
// 四舍五入保留两位小数,转换为字符串 // 四舍五入保留两位小数,转换为字符串
money = Math.round(money * 100).toString() money = Math.round(money * 100).toString()
integerNum = money.substr(0, money.length - 2) const integerNum = money.substr(0, money.length - 2) // 金额整数部分
decimalNum = money.substr(money.length - 2) const decimalNum = money.substr(money.length - 2) // 金额小数部分
// 获取整型部分转换 // 获取整型部分转换
if (parseInt(integerNum, 10) > 0) { if (parseInt(integerNum, 10) > 0) {
let zeroCount = 0 let zeroCount = 0
const IntLen = integerNum.length const IntLen = integerNum.length
for (var i = 0; i < IntLen; i++) { for (let i = 0; i < IntLen; i++) {
var n = integerNum.substr(i, 1) const n = integerNum.substr(i, 1)
const p = IntLen - i - 1 const p = IntLen - i - 1
const q = p / 4 const q = p / 4
const m = p % 4 const m = p % 4
@ -72,8 +72,8 @@ const smallToBig = function(money) {
// 小数部分 // 小数部分
if (decimalNum != '') { if (decimalNum != '') {
const decLen = decimalNum.length const decLen = decimalNum.length
for (var i = 0; i < decLen; i++) { for (let i = 0; i < decLen; i++) {
var n = decimalNum.substr(i, 1) const n = decimalNum.substr(i, 1)
if (n != '0') { if (n != '0') {
chineseStr += cnNums[Number(n)] + cnDecUnits[i] chineseStr += cnNums[Number(n)] + cnDecUnits[i]
} }

View File

@ -1,10 +1,9 @@
import Taro, { showModal, useDidShow, useRouter } from '@tarojs/taro'
import { Button, Navigator, ScrollView, Text, View } from '@tarojs/components' import { Button, Navigator, ScrollView, Text, View } from '@tarojs/components'
import { forwardRef, memo, useEffect, useImperativeHandle, useState } from 'react' import { forwardRef, memo, useEffect, useImperativeHandle, useState } from 'react'
import './index.scss' import './index.scss'
import { MpPurchaserAddressList } from '@/api/addressList' import { MpPurchaserAddressList } from '@/api/addressList'
import { alert } from '@/common/common' import { alert } from '@/common/common'
import Taro, { showModal, useDidShow, useRouter } from '@tarojs/taro'
import IconFont from '@/components/iconfont/iconfont' import IconFont from '@/components/iconfont/iconfont'
import { MpSaleOrderAddress } from '@/api/order' import { MpSaleOrderAddress } from '@/api/order'

View File

@ -16,8 +16,7 @@ interface Param {
}|null }|null
onClick?: (val: number) => void // 点击后触发的事件,返回订单状态 onClick?: (val: number) => void // 点击后触发的事件,返回订单状态
} }
const AfterOrderBtns = ({ orderInfo, onClick }: Param) => {
export default memo(({ orderInfo, onClick }: Param) => {
// 订单状态枚举 // 订单状态枚举
const { const {
SaleOrderStatusBooking, SaleOrderStatusBooking,
@ -120,13 +119,6 @@ export default memo(({ orderInfo, onClick }: Param) => {
}) })
}, [orderInfo]) }, [orderInfo])
// 点击按钮操作
const submitBtns = (val, index) => {
(val == 1) && cancelOrder(); // 取消订单按钮
(val == 2) && onClick?.(2); // 去付款按钮
(val == 6) && receiveOrder() // 确认收货
}
// 取消订单 // 取消订单
const { fetchData: cancelFetchData } = CancelOrderApi() const { fetchData: cancelFetchData } = CancelOrderApi()
const cancelOrder = () => { const cancelOrder = () => {
@ -173,7 +165,12 @@ export default memo(({ orderInfo, onClick }: Param) => {
}, },
}) })
} }
// 点击按钮操作
const submitBtns = (val, index) => {
(val == 1) && cancelOrder(); // 取消订单按钮
(val == 2) && onClick?.(2); // 去付款按钮
(val == 6) && receiveOrder() // 确认收货
}
// 显示更多按钮 // 显示更多按钮
const [showMore, setShowMore] = useState(false) const [showMore, setShowMore] = useState(false)
const styleTop = useMemo(() => { const styleTop = useMemo(() => {
@ -202,4 +199,5 @@ export default memo(({ orderInfo, onClick }: Param) => {
</View> </View>
) )
}) }
export default memo(AfterOrderBtns)

View File

@ -87,19 +87,6 @@ const AfterOrderBtns = ({ orderInfo, onClick, fixedBottom = true }: Param) => {
}) })
}, [orderInfo]) }, [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 { fetchData: returnApplyOrderCancelFetchData } = ReturnApplyOrderCancelApi()
const cancelOrder = ({ title = '', val }) => { 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 [showMore, setShowMore] = useState(false)
const styleTop = useMemo(() => { const styleTop = useMemo(() => {

View File

@ -8,7 +8,7 @@ import SearchInput from '@/components/searchInput'
import Popup from '@/components/bluetooth/Popup' import Popup from '@/components/bluetooth/Popup'
import useCheckAuthorize from '@/use/useCheckAuthorize' import useCheckAuthorize from '@/use/useCheckAuthorize'
export default memo(() => { const LinkBlueTooth = () => {
const { state, init, startScan, connect, disconnect } = useBluetooth() const { state, init, startScan, connect, disconnect } = useBluetooth()
const { check } = useCheckAuthorize({ scope: 'scope.bluetooth', msg: '请开启小程序蓝牙权限' }) const { check } = useCheckAuthorize({ scope: 'scope.bluetooth', msg: '请开启小程序蓝牙权限' })
@ -40,6 +40,9 @@ export default memo(() => {
} }
const [popupShow, setPopupShow] = useState(false) const [popupShow, setPopupShow] = useState(false)
const onFindEven = () => {
if (!state.discovering && !state.connected && !state.connecting) { startScan() }
}
// 显示设备列表 // 显示设备列表
const onFindDevice = () => { const onFindDevice = () => {
check().then((res) => { check().then((res) => {
@ -55,9 +58,6 @@ export default memo(() => {
} }
}) })
} }
const onFindEven = () => {
if (!state.discovering && !state.connected && !state.connecting) { startScan() }
}
// 断开链接 // 断开链接
const onDisconnect = () => { const onDisconnect = () => {
@ -72,9 +72,11 @@ export default memo(() => {
<View className={styles.bluetooth_link} onClick={onFindDevice}> <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> <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 == 1
|| linkStatus == 2 && <View className={classnames(styles.link_name, styles.link_name_no_link)}></View> ? <View className={classnames(styles.link_name, styles.link_name_no)}></View>
|| linkStatus == 3 && <View className={classnames(styles.link_name)}>{linkName}</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> </View>
</SearchInput> </SearchInput>
@ -90,4 +92,5 @@ export default memo(() => {
</> </>
) )
}) }
export default memo(LinkBlueTooth)

View File

@ -7,8 +7,7 @@ interface Params {
onClose?: () => void onClose?: () => void
styleObj?: Object styleObj?: Object
} }
const CloseBtn = ({ onClose, styleObj = {} }: Params) => {
export default memo(({ onClose, styleObj = {} }: Params) => {
return ( return (
<View style={styleObj} className={style.icon_a_cuowuwrong_self} onClick={onClose}> <View style={styleObj} className={style.icon_a_cuowuwrong_self} onClick={onClose}>
<View className={style.icon_a_btn}> <View className={style.icon_a_btn}>
@ -16,4 +15,5 @@ export default memo(({ onClose, styleObj = {} }: Params) => {
</View> </View>
</View> </View>
) )
}) }
export default memo(CloseBtn)

View File

@ -1,8 +1,8 @@
import { Block, View } from '@tarojs/components' import { Block, View } from '@tarojs/components'
import Taro from '@tarojs/taro'
import type { FC } from 'react' import type { FC } from 'react'
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import './iconfont.scss' import './iconfont.scss'
import Taro from '@tarojs/taro'
import classnames from 'classnames' import classnames from 'classnames'
const SystemWidth = Taro.getSystemInfoSync().windowWidth const SystemWidth = Taro.getSystemInfoSync().windowWidth

View File

@ -16,8 +16,7 @@ interface Param {
}|null }|null
onClick?: (val: number) => void // 点击后触发的事件,返回订单状态 onClick?: (val: number) => void // 点击后触发的事件,返回订单状态
} }
const OrderBtns = ({ orderInfo, onClick }: Param) => {
export default memo(({ orderInfo, onClick }: Param) => {
// 订单状态枚举 // 订单状态枚举
const { const {
SaleOrderStatusBooking, SaleOrderStatusBooking,
@ -120,13 +119,6 @@ export default memo(({ orderInfo, onClick }: Param) => {
}) })
}, [orderInfo]) }, [orderInfo])
// 点击按钮操作
const submitBtns = (val, index) => {
(val == 1) && cancelOrder(); // 取消订单按钮
(val == 2) && onClick?.(2); // 去付款按钮
(val == 6) && receiveOrder() // 确认收货
}
// 取消订单 // 取消订单
const { fetchData: cancelFetchData } = CancelOrderApi() const { fetchData: cancelFetchData } = CancelOrderApi()
const cancelOrder = () => { const cancelOrder = () => {
@ -173,7 +165,12 @@ export default memo(({ orderInfo, onClick }: Param) => {
}, },
}) })
} }
// 点击按钮操作
const submitBtns = (val, index) => {
(val == 1) && cancelOrder(); // 取消订单按钮
(val == 2) && onClick?.(2); // 去付款按钮
(val == 6) && receiveOrder() // 确认收货
}
// 显示更多按钮 // 显示更多按钮
const [showMore, setShowMore] = useState(false) const [showMore, setShowMore] = useState(false)
const styleTop = useMemo(() => { const styleTop = useMemo(() => {
@ -202,4 +199,5 @@ export default memo(({ orderInfo, onClick }: Param) => {
</View> </View>
) )
}) }
export default memo(OrderBtns)

View File

@ -1,7 +1,7 @@
import Popup from '@/components/popup'
import { memo } from 'react' import { memo } from 'react'
import './index.scss' import './index.scss'
import TimePicker from '../timePicker' import TimePicker from '../timePicker'
import Popup from '@/components/popup'
type DateArg = string | number | Date type DateArg = string | number | Date
interface Props { interface Props {

View File

@ -7,7 +7,7 @@ import LinkBlueTooth from '../components/bluetooth/LinkBlueTooth'
import styles from './index.module.scss' import styles from './index.module.scss'
import { useBluetooth } from '@/use/contextBlueTooth' import { useBluetooth } from '@/use/contextBlueTooth'
import { toRgb } from '@/common/bluetooth/color/colorSpace' import { toRgb } from '@/common/bluetooth/color/colorSpace'
import { productabsorbcontrast } from '@/api/index' import { ProductAbsorbContrast } from '@/api/index'
import { alert } from '@/common/common' import { alert } from '@/common/common'
const SampleComparison = () => { const SampleComparison = () => {
@ -82,7 +82,7 @@ const SampleComparison = () => {
const [data, setData] = useState('') const [data, setData] = useState('')
const [result, setResult] = useState('') const [result, setResult] = useState('')
const { fetchData } = productabsorbcontrast() const { fetchData } = ProductAbsorbContrast()
const handTake = async() => { const handTake = async() => {
if (searchField.l1 === '') { if (searchField.l1 === '') {
Taro.showToast({ Taro.showToast({

View File

@ -88,9 +88,9 @@ const CustomerDetails = () => {
<View className={styles.item_tagItem}>{infoObj?.purchaser_type_name || '暂无'}</View> <View className={styles.item_tagItem}>{infoObj?.purchaser_type_name || '暂无'}</View>
<View className={styles.item_tagItem}>{infoObj?.sale_user_name || '暂无'}</View> <View className={styles.item_tagItem}>{infoObj?.sale_user_name || '暂无'}</View>
{ {
infoObj?.label_list?.map((item) => { infoObj?.label_list?.map((item, key) => {
return ( return (
<View className={styles.item_tagItem}>{item.label_name}</View> <View key={key} className={styles.item_tagItem}>{item.label_name}</View>
) )
}) })
} }

View File

@ -24,7 +24,7 @@ interface Props {
showBorder?: boolean showBorder?: boolean
handNav?: () => void handNav?: () => void
} }
export default memo((props: Props) => { const Form = (props: Props) => {
const { const {
title = '标题', title = '标题',
isQuire = true, isQuire = true,
@ -70,4 +70,5 @@ export default memo((props: Props) => {
{children} {children}
</View> </View>
) )
}) }
export default memo(Form)

View File

@ -9,9 +9,8 @@ import ShopCart from '@/components/shoppingCart'
import { goLink } from '@/common/common' import { goLink } from '@/common/common'
import { KindListApi, ProductListApi } from '@/api/index' import { KindListApi, ProductListApi } from '@/api/index'
// import useLogin from '@/use/useLogin' // import useLogin from '@/use/useLogin'
import { MpProductColorList, MpShoppingCartProductColorList } from '@/api/order' import { ClientListApi, MpProductColorList, MpShoppingCartProductColorList } from '@/api/order'
import { dataLoadingStatus, getFilterData } from '@/common/util' import { dataLoadingStatus, getFilterData } from '@/common/util'
import { ClientListApi } from '@/api/order'
const Index = () => { const Index = () => {
// 获取客户 // 获取客户

View File

@ -34,8 +34,7 @@ interface filterObj {
sale_mode?: Number | undefined sale_mode?: Number | undefined
shipment_mode?: Number | undefined shipment_mode?: Number | undefined
} }
const Order = () => {
export default () => {
// 页码和页数 // 页码和页数
const [searchField, setSearchField] = useState<{ status: number | unknown; page: number; size: number; order_no: string }>({ const [searchField, setSearchField] = useState<{ status: number | unknown; page: number; size: number; order_no: string }>({
status: -1, status: -1,
@ -47,6 +46,21 @@ export default () => {
// 获取订单列表 // 获取订单列表
const { fetchData: listFetchData, state: orderState } = OrderListApi() const { fetchData: listFetchData, state: orderState } = OrderListApi()
const [orderData, setOrderData] = useState<{ list: any[]; total: number }>({ list: [], total: 0 }) const [orderData, setOrderData] = useState<{ list: any[]; total: number }>({ list: [], total: 0 })
// 筛选参数
const [searchObj, setsearchObj] = useState<filterObj>({
purchaser_id: '',
clientName: '',
sale_user_id: '',
saleuserName: '',
sale_mode: undefined,
shipment_mode: undefined,
})
// 筛选内容展示
const [showPopup, setshowPopup] = useState(false)
// 上拉加载数据
const pageNum = useRef({ size: searchField.size, page: searchField.page })
// 列表下拉刷新
const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false)
const getOrderList = async() => { const getOrderList = async() => {
const res = await listFetchData({ const res = await listFetchData({
...getFilterData(searchField), ...getFilterData(searchField),
@ -57,8 +71,6 @@ export default () => {
setRefresherTriggeredStatus(() => false) setRefresherTriggeredStatus(() => false)
} }
// 列表下拉刷新
const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false)
const getRefresherRefresh = async() => { const getRefresherRefresh = async() => {
pageNum.current.size = 1 pageNum.current.size = 1
setRefresherTriggeredStatus(true) setRefresherTriggeredStatus(true)
@ -67,11 +79,9 @@ export default () => {
// 数据加载状态 // 数据加载状态
const statusMore = useMemo(() => { const statusMore = useMemo(() => {
console.log({ list: orderData.list, total: orderData.total, status: orderState.loading }, '{ list: orderData.list, total: orderData.total, status: orderState.loading }') console.log({ list: orderData.list, total: orderData.total, status: orderState.loading }, '{ list: orderData.list, total: orderData.total, status: orderState.loading }')
return dataLoadingStatus({ list: orderData.list, total: orderData.total, status: orderState.loading }) return dataLoadingStatus({ list: orderData.list, total: orderData.total, status: orderState.loading! })
}, [orderData, orderState]) }, [orderData, orderState])
// 上拉加载数据
const pageNum = useRef({ size: searchField.size, page: searchField.page })
const getScrolltolower = useCallback(() => { const getScrolltolower = useCallback(() => {
if (orderData.list.length < orderData.total) { if (orderData.list.length < orderData.total) {
pageNum.current.page++ pageNum.current.page++
@ -106,8 +116,6 @@ export default () => {
setOrderData(() => ({ list: [], total: 0 })) setOrderData(() => ({ list: [], total: 0 }))
setSearchField(val => ({ ...val, order_no: e, size: 10 })) setSearchField(val => ({ ...val, order_no: e, size: 10 }))
}, []) }, [])
// 筛选内容展示
const [showPopup, setshowPopup] = useState(false)
const showSelctPopup = () => { const showSelctPopup = () => {
setshowPopup(true) setshowPopup(true)
} }
@ -131,15 +139,6 @@ export default () => {
})) }))
}) })
// 筛选参数
const [searchObj, setsearchObj] = useState<filterObj>({
purchaser_id: '',
clientName: '',
sale_user_id: '',
saleuserName: '',
sale_mode: undefined,
shipment_mode: undefined,
})
// 跳转选择客户 // 跳转选择客户
const navTo = (index) => { const navTo = (index) => {
if (index === 1) { if (index === 1) {
@ -201,6 +200,18 @@ export default () => {
} }
}, [searchObj]) }, [searchObj])
// 数组重置
const resetArr = (arr) => {
arr.map((it) => {
it.checked = false
return it
})
return arr
}
// 确认筛选
const handSure = async() => {
getOrderList()
}
// 重置 // 重置
const handReset = () => { const handReset = () => {
pageNum.current.page = 1 pageNum.current.page = 1
@ -218,19 +229,6 @@ export default () => {
const arrTwo = resetArr(deliveryList) const arrTwo = resetArr(deliveryList)
setdeliveryList([...arrTwo]) setdeliveryList([...arrTwo])
} }
// 数组重置
const resetArr = (arr) => {
arr.map((it) => {
it.checked = false
return it
})
return arr
}
// 确认筛选
const handSure = async() => {
getOrderList()
}
// 扫描 // 扫描
const handScan = () => { const handScan = () => {
Taro.scanCode({ Taro.scanCode({
@ -358,6 +356,103 @@ export default () => {
color: '#ffffff', color: '#ffffff',
}, },
]) ])
// 显示支付
const [showPay, setShowPay] = useState(false)
// 显示线下汇款
const [showOffline, setShowOffine] = useState(false)
// 扫码支付
const [showSide, setShowSide] = useState(true)
const [title, setTitle] = useState('')
const [picUrl, setPicUrl] = useState('')
const { fetchData: payFetch } = GetPayCode()
const handScanpay = async() => {
const list: any = []
itemObj.product_list.forEach((item) => {
item.product_colors.forEach((it) => {
list.push({
product_code: item.code,
product_name: item.name,
product_color_code: it.product_color_code,
product_color_name: it.product_color_name,
num: it.roll.toString(),
weight: formatWeightDiv(it.actual_weight).toString(),
sale_price: (it.sale_price / 100).toString(),
total_price:
it.total_sale_price !== 0
? (it.total_sale_price / 100).toString()
: (it.estimate_amount / 100).toString(),
length: (it.length / 100).toString(),
weight_error: formatWeightDiv(it.weight_error).toString(),
})
})
})
const query = {
list,
title: '面料销售电子确认单',
show_qrcode: true,
show_barcode: true,
show_wait_pay_amount: true,
order_type: itemObj.sale_mode_name,
shipment_mode: itemObj.shipment_mode_name,
company: itemObj.title_purchaser_name,
sale_user: itemObj.sale_user_name,
order_created_time: formatDateTime(itemObj.create_time),
order_no: itemObj.order_no,
target_user_name: itemObj.target_user_name,
target_address: itemObj.address_detail,
target_description: itemObj.remark,
pay_account: itemObj.transfer_remittance_account,
bank_account_name: itemObj.account_name,
bank_name: itemObj.bank_of_deposit,
pay_type: itemObj.settle_mode_name,
client: itemObj.purchaser_name,
phone: itemObj.target_user_phone,
order_total_length: (itemObj.total_number / 100).toString(),
order_total_price: (
itemObj.bill_total_sale_price / 100
).toString(),
total_weight_error_discount: (
itemObj.total_weight_error_discount / 100
).toString(),
order_total_num: itemObj.total_number.toString(),
qrcode: `${PAY_H5_CODE_URL}?sale_order_no=${itemObj.order_no}`,
order_total_weight: (itemObj.total_weight / 1000).toString(),
estimate_amount: (itemObj.estimate_amount / 100).toString(),
total_sale_price: (itemObj.total_sale_price / 100).toString(),
show_total_sale_price: true,
show_total_weight_error_discount: true,
actual_amount: (itemObj.actual_amount / 100).toString(),
wait_pay_amount: (itemObj.wait_pay_amount / 100).toString(),
order_total_weight_error: (
itemObj.total_weight_error / 1000
).toString(),
}
const res = await payFetch(query)
if (res.data) {
console.log(res.data.base64)
setShowSide(false)
setTitle('查看销售码单')
setPicUrl(res.data.base64)
}
}
// 选择支付方式
const clickItem = (item) => {
if (item.name === '扫码支付') { handScanpay() }
if (item.name === '线下汇款') { setShowOffine(true) }
payList.map((it) => {
if (item.id === it.id) {
it.checked = true
}
else {
it.checked = false
}
return it
})
setPayList([...payList])
}
const toPay = async(e, item) => { const toPay = async(e, item) => {
e.stopPropagation() e.stopPropagation()
@ -445,99 +540,6 @@ export default () => {
setTitle('待支付款项') setTitle('待支付款项')
setShowPay(true) setShowPay(true)
} }
// 选择支付方式
const clickItem = (item) => {
if (item.name === '扫码支付') { handScanpay() }
if (item.name === '线下汇款') { setShowOffine(true) }
payList.map((it) => {
if (item.id === it.id) {
it.checked = true
}
else {
it.checked = false
}
return it
})
setPayList([...payList])
}
// 扫码支付
const [showSide, setShowSide] = useState(true)
const [title, setTitle] = useState('')
const [picUrl, setPicUrl] = useState('')
const { fetchData: payFetch } = GetPayCode()
const handScanpay = async() => {
const list: any = []
itemObj.product_list.forEach((item) => {
item.product_colors.forEach((it) => {
list.push({
product_code: item.code,
product_name: item.name,
product_color_code: it.product_color_code,
product_color_name: it.product_color_name,
num: it.roll.toString(),
weight: formatWeightDiv(it.actual_weight).toString(),
sale_price: (it.sale_price / 100).toString(),
total_price:
it.total_sale_price !== 0
? (it.total_sale_price / 100).toString()
: (it.estimate_amount / 100).toString(),
length: (it.length / 100).toString(),
weight_error: formatWeightDiv(it.weight_error).toString(),
})
})
})
const query = {
list,
title: '面料销售电子确认单',
show_qrcode: true,
show_barcode: true,
show_wait_pay_amount: true,
order_type: itemObj.sale_mode_name,
shipment_mode: itemObj.shipment_mode_name,
company: itemObj.title_purchaser_name,
sale_user: itemObj.sale_user_name,
order_created_time: formatDateTime(itemObj.create_time),
order_no: itemObj.order_no,
target_user_name: itemObj.target_user_name,
target_address: itemObj.address_detail,
target_description: itemObj.remark,
pay_account: itemObj.transfer_remittance_account,
bank_account_name: itemObj.account_name,
bank_name: itemObj.bank_of_deposit,
pay_type: itemObj.settle_mode_name,
client: itemObj.purchaser_name,
phone: itemObj.target_user_phone,
order_total_length: (itemObj.total_number / 100).toString(),
order_total_price: (
itemObj.bill_total_sale_price / 100
).toString(),
total_weight_error_discount: (
itemObj.total_weight_error_discount / 100
).toString(),
order_total_num: itemObj.total_number.toString(),
qrcode: `${PAY_H5_CODE_URL}?sale_order_no=${itemObj.order_no}`,
order_total_weight: (itemObj.total_weight / 1000).toString(),
estimate_amount: (itemObj.estimate_amount / 100).toString(),
total_sale_price: (itemObj.total_sale_price / 100).toString(),
show_total_sale_price: true,
show_total_weight_error_discount: true,
actual_amount: (itemObj.actual_amount / 100).toString(),
wait_pay_amount: (itemObj.wait_pay_amount / 100).toString(),
order_total_weight_error: (
itemObj.total_weight_error / 1000
).toString(),
}
const res = await payFetch(query)
if (res.data) {
console.log(res.data.base64)
setShowSide(false)
setTitle('查看销售码单')
setPicUrl(res.data.base64)
}
}
// 确认交易 // 确认交易
const { fetchData: payOneFetch } = OrderPaymentOrderPaymentSubmission() const { fetchData: payOneFetch } = OrderPaymentOrderPaymentSubmission()
const { fetchData: payTwoFetch } = OrderPaymentPreCollectOrderOrderPaymentSubmission() const { fetchData: payTwoFetch } = OrderPaymentPreCollectOrderOrderPaymentSubmission()
@ -587,15 +589,10 @@ export default () => {
// } // }
} }
// 显示支付
const [showPay, setShowPay] = useState(false)
// 显示线下汇款
const [showOffline, setShowOffine] = useState(false)
return ( return (
<View> <View>
<View style={{ background: '#FFFFFF', paddingLeft: '20rpx', paddingBottom: '20rpx', position: 'sticky', top: '0', zIndex: '99' }}> <View style={{ background: '#FFFFFF', paddingLeft: '20rpx', paddingBottom: '20rpx', position: 'sticky', top: '0', zIndex: '99' }}>
<Search handScan={() => handScan()} defaultValue={searchField.order_no} showScan placeholder="搜索商品/名称/颜色/订单号" showBtn={false} changeOnSearch={getSearchData} debounceTime={300}> <Search handScan={() => handScan()} defaultValue={searchField.order_no} showScan placeholder="搜索商品/名称/颜色/订单号" showBtn={false} changeOnSearch={getSearchData}>
<View className={styles.flexBox} onClick={() => showSelctPopup()}> <View className={styles.flexBox} onClick={() => showSelctPopup()}>
<IconFont name="icon-shaixuan" size={35} color={!isDisabled ? '#0D7CFF' : ''} customClassName={styles.activeshaixuan} /> <IconFont name="icon-shaixuan" size={35} color={!isDisabled ? '#0D7CFF' : ''} customClassName={styles.activeshaixuan} />
{/* <View className={classnames('iconfont', 'icon-shaixuan', !isDisabled ? styles.icon_shaixuan : styles.activeshaixuan)}></View> */} {/* <View className={classnames('iconfont', 'icon-shaixuan', !isDisabled ? styles.icon_shaixuan : styles.activeshaixuan)}></View> */}
@ -726,3 +723,4 @@ export default () => {
</View> </View>
) )
} }
export default Order

View File

@ -61,7 +61,6 @@ const Delivery: FC = () => {
pageNum.current.page++ pageNum.current.page++
const size = pageNum.current.size * pageNum.current.page const size = pageNum.current.size * pageNum.current.page
setSearch(e => ({ ...e, size })) setSearch(e => ({ ...e, size }))
console.log(search, 11111)
} }
}, [takeDeliveryOrderList]) }, [takeDeliveryOrderList])

View File

@ -7,13 +7,15 @@ const composeEnhancers
&& (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ && (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
? (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({ ? (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
// Specify extensions options like name, actionsBlacklist, actionsCreators, serialize... // Specify extensions options like name, actionsBlacklist, actionsCreators, serialize...
}) : compose })
: compose
const middlewares = [ const middlewares = [
thunkMiddleware, thunkMiddleware,
] ]
if (process.env.NODE_ENV === 'development' && process.env.TARO_ENV !== 'quickapp') { if (process.env.NODE_ENV === 'development' && process.env.TARO_ENV !== 'quickapp') {
// eslint-disable-next-line @typescript-eslint/no-var-requires
middlewares.push(require('redux-logger').createLogger()) middlewares.push(require('redux-logger').createLogger())
} }

View File

@ -69,7 +69,10 @@ const stateObj: BluetoothStateType = {
// 取色仪主动返回的数据 // 取色仪主动返回的数据
deviceLab: null, deviceLab: null,
} }
const ContextBlueTooth = (props) => { interface PropsType {
children?: React.ReactNode
}
const ContextBlueTooth = (props: PropsType) => {
const refStatus = useRef(stateObj) const refStatus = useRef(stateObj)
const [state, setState] = useState(refStatus.current) const [state, setState] = useState(refStatus.current)