feat:修改确认订单选择后无法渲染的问题,顶input框的高度问题

This commit is contained in:
Haiyi 2022-09-29 15:22:39 +08:00
parent 6b59d688db
commit 232d372796
19 changed files with 101 additions and 104 deletions

View File

@ -60,11 +60,15 @@ export default memo((props: prosObj) => {
const canBuy = useMemo(() => {
if (
(obj.sale_mode === 0 && obj.status === 7 && obj.collect_status == 1) ||
(obj.sale_mode === 0 && obj.status === 3 && obj.collect_status == 1) ||
(obj.sale_mode === 0 && obj.status === 3 && (obj.payment_method == 3 || obj.payment_method == 5)) ||
(obj.sale_mode === 0 && obj.status === 8 && (obj.payment_method == 3 || obj.payment_method == 5 || obj.collect_status == 1)) ||
(obj.sale_mode === 0 && obj.status === 9 && (obj.payment_method == 3 || obj.payment_method == 5 || obj.collect_status == 1)) ||
(obj.sale_mode === 0 && obj.status === 7 && obj.collect_status == 0) ||
(obj.sale_mode === 0 && obj.status === 7 && obj.settle_mode == 3) ||
(obj.sale_mode === 0 && obj.status === 3 && obj.collect_status == 1) ||
(obj.sale_mode === 0 && obj.status === 3 && obj.collect_status == 0) ||
(obj.sale_mode === 0 && obj.status === 8 && obj.collect_status == 1) ||
(obj.sale_mode === 0 && obj.status === 8 && obj.collect_status == 0) ||
(obj.sale_mode === 0 && obj.status === 9 && obj.collect_status == 1) ||
(obj.sale_mode === 0 && obj.status === 9 && obj.collect_status == 0) ||
(obj.sale_mode === 2 && obj.status === 2) ||
(obj.sale_mode === 2 && obj.status === 7)
) {
return true

View File

@ -33,8 +33,8 @@ export default memo((props: props) => {
const onInputEven = (e) => {
let res = e.detail.value
if (props.modeFont == 0) {
if (Number(res) < 0) {
setValue({ count: 1 })
if (Number(res) < 1) {
setValue({ count: '' })
}
}
if (props.modeFont == 1) {
@ -80,7 +80,7 @@ export default memo((props: props) => {
</View>
</View>
<View className={styles.numsBox}>
<Input type={type as any} value={value.count} onInput={onInputEven} onBlur={(e) => props.onBlur?.(e, props.value.id)}></Input>
<Input cursorSpacing={100} adjustPosition type={type as any} value={value.count} onInput={onInputEven} onBlur={(e) => props.onBlur?.(e, props.value.id)}></Input>
{/* <Input type={type as any} value={value.count} onInput={($event) => onInputEven($event, props.value)}></Input> */}
</View>

View File

@ -23,7 +23,8 @@ type Params = {
customRightSlot?: ReactNode
adjustPosition?: boolean,
showScan?: boolean
handScan?: () => void
handScan?: () => void,
cursorSpacing?: Number
}
export default memo(
@ -45,7 +46,8 @@ export default memo(
children,
customRightSlot,
showScan = false,
handScan
handScan,
cursorSpacing = 0
}: Params,
ref,
) => {
@ -94,6 +96,7 @@ export default memo(
)}
<View className={styles.input_bar}>
<Input
cursorSpacing={cursorSpacing as any}
adjustPosition={adjustPosition}
placeholderStyle='color:#ABABAB; font-size:26rpx'
onConfirm={onSearch}

View File

@ -108,7 +108,7 @@
.scrollviewBig {
.scrollview {
height: 300px;
// height: 300px;
.kongBox {
height: 181px;

View File

@ -141,7 +141,7 @@ export default memo(forwardRef((props: prosObj, ref) => {
<View className={styles.danwei}>{modeFont == 0 ? '大货' : modeFont == 1 ? '剪版' : '散剪'}{showModefont}</View>
</View>
<View className={styles.searchBox}>
<Search placeholder='请输入搜索布料' showBtn={false} changeOnSearch={getSearchData} debounceTime={300} adjustPosition={true} />
<Search cursorSpacing={100} placeholder='请输入搜索布料' showBtn={false} changeOnSearch={getSearchData} debounceTime={300} adjustPosition={true} />
</View>
{
goodList.length > 0 && <>

View File

@ -23,7 +23,6 @@ type TabBarIndexMap = {
}
const CustomTabBar: FC = () => {
console.log('重新渲染')
const { selectedId, tabItem } = useSelector((state) => {
console.log('sdfasdfa', state)

View File

@ -258,18 +258,19 @@ export default () => {
}
//输入框失焦
const onBlur = (e, id) => {
goodList.map((item) => {
goodList.map(item => {
if (item.id == id) {
if (search.modeId == 0 && (e.detail.value == '' || Number(e.detail.value) == 0)) {
item.nums = 1
item.showInput = false
} else {
item.nums = 1
} else if (search.modeId == 0 && (e.detail.value != '' || Number(e.detail.value) > 0)) {
item.nums = e.detail.value
}
if (search.modeId == 1 && Number(e.detail.value) < 0.5) {
item.nums = 0.5
item.showInput = false
} else {
} else if (search.modeId == 1 && Number(e.detail.value) >= 0.5) {
item.nums = e.detail.value
}
if (search.modeId == 2) {
@ -284,6 +285,7 @@ export default () => {
useEffect(() => {
setGoodlist(goodList)
console.log(goodList, 'goodListgoodList')
}, [goodList])
return (

View File

@ -561,7 +561,7 @@ export default () => {
title: '请稍等...',
mask: true
})
const restult = await obj.status !== 10 ? payOneFetch({ id: Number(obj.should_collect_order_id), payment_method: Number(arr[0]?.id) }) : payTwoFetch({ id: Number(obj.pre_collect_order_id), payment_method: Number(arr[0]?.id) })
const restult = await (obj.status !== 10 ? payOneFetch({ id: Number(obj.should_collect_order_id), payment_method: Number(arr[0]?.id) }) : payTwoFetch({ id: Number(obj.pre_collect_order_id), payment_method: Number(arr[0]?.id) }))
if (restult?.msg === 'success') {
Taro.showToast({
title: '交易成功'

View File

@ -7,7 +7,8 @@ interface prosObj {
sale_mode?: Number,
collect_status?: Number | string,
status?: Number,
payment_method?: Number
payment_method?: Number,
settle_mode?: Number | string,
}
handApplyGoods?: () => void,
handApplyMoney?: () => void,
@ -21,18 +22,21 @@ export default memo((props: prosObj) => {
collect_status: '',
status: '',
payment_method: 0,
settle_mode: ''
},
handApplyGoods,
handApplyMoney,
handSureGoods
} = props
//判断显示申请
//判断显示申请退
const showTuihuo = useMemo(() => {
if (
(obj.sale_mode === 0 && obj.status === 9 && obj.collect_status == 2) ||
(obj.sale_mode === 0 && obj.status === 9 && (obj.payment_method == 3 || obj.payment_method == 5 || obj.collect_status === 1)) ||
(obj.sale_mode === 2 && obj.status === 9)
(obj.sale_mode === 0 && obj.status == 9 && obj.collect_status == 0) ||
(obj.sale_mode === 0 && obj.status == 9 && obj.collect_status == 1) ||
(obj.sale_mode === 0 && obj.status == 9 && obj.collect_status == 2) ||
(obj.sale_mode === 0 && obj.status == 9 && obj.settle_mode == 3) ||
(obj.sale_mode === 2 && obj.status == 9)
) {
return true
} else return false
@ -40,14 +44,16 @@ export default memo((props: prosObj) => {
//判断显示申请退款
const showTuikuan = useMemo(() => {
if (
(obj.sale_mode === 0 && obj.status === 11 && (obj.collect_status == 1 || obj.collect_status == 2)) ||
(obj.sale_mode === 0 && obj.status === 7 && obj.collect_status == 2) ||
(obj.sale_mode === 0 && obj.status === 7 && obj.collect_status == 1) ||
(obj.sale_mode === 0 && obj.status === 3 && obj.collect_status == 2) ||
(obj.sale_mode === 0 && obj.status === 3 && obj.collect_status == 1) ||
(obj.sale_mode === 1 && obj.status === 0) ||
(obj.sale_mode === 1 && obj.status === 9) ||
(obj.sale_mode === 2 && obj.status === 0)
(obj.sale_mode === 0 && obj.status == 2 && obj.collect_status == 1) ||
(obj.sale_mode === 0 && obj.status == 7 && obj.collect_status == 0) ||
(obj.sale_mode === 0 && obj.status == 11 && (obj.collect_status == 1 || obj.collect_status == 2)) ||
(obj.sale_mode === 0 && obj.status == 3 && obj.collect_status == 0) ||
(obj.sale_mode === 0 && obj.status == 3 && obj.collect_status == 2) ||
(obj.sale_mode === 0 && obj.status == 3 && obj.collect_status == 1) ||
(obj.sale_mode === 1 && obj.status == 0) ||
(obj.sale_mode === 1 && obj.status == 9) ||
(obj.sale_mode === 2 && obj.status == 0 && obj.collect_status == 1) ||
(obj.sale_mode === 2 && obj.status == 0 && obj.collect_status == 2)
) {
return true
} else return false
@ -55,10 +61,12 @@ export default memo((props: prosObj) => {
//判断显示确认收货
const showTake = useMemo(() => {
if (
(obj.sale_mode === 0 && obj.status === 8 && obj.collect_status == 2) ||
(obj.sale_mode === 0 && obj.status === 8 && (obj.payment_method == 3 || obj.payment_method == 5 || obj.collect_status == 1)) ||
(obj.sale_mode === 1 && obj.status === 8) ||
(obj.sale_mode === 2 && obj.status === 8)
(obj.sale_mode === 0 && obj.status == 8 && obj.collect_status == 0) ||
(obj.sale_mode === 0 && obj.status == 8 && obj.collect_status == 1) ||
(obj.sale_mode === 0 && obj.status == 8 && obj.collect_status == 2) ||
(obj.sale_mode === 0 && obj.status == 8 && obj.settle_mode == 3) ||
(obj.sale_mode === 1 && obj.status == 8) ||
(obj.sale_mode === 2 && obj.status == 8)
) {
return true
} else return false

View File

@ -42,7 +42,6 @@
-webkit-box-orient: vertical;
-webkit-line-clamp: 2; /*这里设置几行*/
overflow: hidden;
}
.icon_more {
@ -67,6 +66,7 @@
margin-top: 24px;
.name {
line-height: 34px;
width: 84px;
height: 34px;
@include common_ellipsis();
@ -78,6 +78,7 @@
}
.phone {
height: 34px;
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;

View File

@ -3,56 +3,44 @@ import { memo, useEffect, useMemo, useRef, useState } from "react";
import classnames from "classnames";
import styles from './index.module.scss'
import IconFont from '@/components/iconfont/iconfont'
import { alert } from '@/common/common'
interface propsObj {
receivingStatus: Number | null,
onReceivingStatus?: (any, Number) => void,
obj: any,
obj?: any,
navSelect?: (any) => void
}
export default memo((props: propsObj) => {
const {
receivingStatus = 2,
receivingStatus = null,
onReceivingStatus,
obj = {},
navSelect
} = props
const addressInfo = useMemo(() => {
if (receivingStatus == 1) {
return obj.take_goods_address
} else {
return obj.province_name + obj.city_name + obj.district_name + obj.address_detail
}
}, [obj, receivingStatus])
// const addressPone = useMemo(() => {
// if (receivingStatus == 1) {
// return 13242128982
// } else {
// return obj.purchaser_phone
// }
// }, [obj,receivingStatus])
// const addressUser = useMemo(() => {
// if (receivingStatus == 1) {
// return '谭先生'
// } else {
// return obj.target_user_name
// }
// }, [obj,receivingStatus])
return (
<View className={styles.addressBox}>
<View className={styles.topBox} onClick={() => navSelect?.(obj)}>
<View className={styles.cirle}>
<IconFont name={'icon-dingwei'} size={26} color={'#ffffff'}></IconFont>
{/* <View className={classnames('iconfont', 'icon-dingwei', styles.dingwei)}></View> */}
</View>
<View className={styles.address}>{addressInfo}</View>
{
receivingStatus == 1 && <View className={styles.address}>{obj.take_goods_address}</View>
}
{
(obj?.province_name != '' && receivingStatus == 2) &&
<View className={styles.address}>{obj?.province_name}{obj?.city_name}{obj?.district_name}{obj?.address_detail}</View>
}
{
(obj?.province_name == '' && receivingStatus == 2) &&
<View className={styles.address}>{''}</View>
}
{
receivingStatus !== 1 &&
<IconFont name={'icon-chakanquanbukehu'} size={50} ></IconFont>
// <View className={classnames('iconfont', 'icon-chakanquanbukehu', styles.icon_more)}></View>
}
</View>
<View className={styles.line}></View>

View File

@ -49,7 +49,7 @@ export default () => {
//切换自提或者物流
const { fetchData: selectFetch } = mpsaleOrdershipmentMode()
const onReceivingStatus = debounce(async (e, value) => {
if (infoObj.status === 8 || infoObj.status === 9 || infoObj.status === 4 || infoObj.status === 5) {
if (infoObj.status === 8 || infoObj.status === 9 || infoObj.status === 4 || infoObj.status === 5 || infoObj.status === 3 || infoObj.status === 11) {
alert.error('不允许更改')
return false
}
@ -486,7 +486,7 @@ export default () => {
title: '请稍等...',
mask: true
})
let restult = await obj.status !== 10 ? payOneFetch({ id: Number(obj.should_collect_order_id), payment_method: Number(arr[0]?.id) }) : payTwoFetch({ id: Number(obj.pre_collect_order_id), payment_method: Number(arr[0]?.id) })
let restult = await (obj.status !== 10 ? payOneFetch({ id: Number(obj.should_collect_order_id), payment_method: Number(arr[0]?.id) }) : payTwoFetch({ id: Number(obj.pre_collect_order_id), payment_method: Number(arr[0]?.id) }))
if (restult?.msg === 'success') {
Taro.showToast({
title: '交易成功'
@ -515,7 +515,7 @@ export default () => {
const [showOffline, setShowOffine] = useState(false)
//选择地址
const handSelect = (obj) => {
if (receivingStatus === 1 || (infoObj.status === 8 || infoObj.status === 9 || infoObj.status === 4 || infoObj.status === 5)) {
if (receivingStatus === 1 || (infoObj.status === 8 || infoObj.status === 9 || infoObj.status === 4 || infoObj.status === 5 || infoObj.status === 11 || infoObj.status === 3)) {
alert.error('不允许更改')
return false
}

View File

@ -8,8 +8,8 @@
.pic {
width: 322px;
height: 322px;
background: #D8D8D8;
opacity: 0.3;
background: #fff;
// opacity: 0.3;
margin-bottom: 24px;
}

View File

@ -269,18 +269,18 @@ export default memo(() => {
//输入框失焦
const onBlur = (e, id) => {
goodList.map((item) => {
goodList.map(item => {
if (item.id == id) {
if (search.modeId == 0 && (e.detail.value == '' || Number(e.detail.value) == 0)) {
item.nums = 1
item.showInput = false
} else {
item.nums = 1
} else if (search.modeId == 0 && (e.detail.value != '' || Number(e.detail.value) > 0)) {
item.nums = e.detail.value
}
if (search.modeId == 1 && Number(e.detail.value) < 0.5) {
item.nums = 0.5
item.showInput = false
} else {
} else if (search.modeId == 1 && Number(e.detail.value) >= 0.5) {
item.nums = e.detail.value
}
if (search.modeId == 2) {
@ -334,7 +334,7 @@ export default memo(() => {
</View>
}
{
!histroyList.length && <Empty picUrl='' fonst={'无搜索历史'}></Empty>
!histroyList.length && <Empty picUrl='https://cdn.zzfzyc.com/empty.png' fonst={'无搜索历史'}></Empty>
}
</>
}
@ -354,7 +354,7 @@ export default memo(() => {
})
}
{
!searchList.length && <Empty picUrl='' fonst={'暂无数据'}></Empty>
!searchList.length && <Empty picUrl='https://cdn.zzfzyc.com/empty.png' fonst={'暂无数据'}></Empty>
}
</>
}

View File

@ -21,7 +21,6 @@ type PropsType = {
const ColorKindItem: FC<PropsType> = memo(
(props) => {
const { purchaserId, itemData, orderType = EnumSaleMode.Bulk } = props
console.log('重新渲染 ColorKindItem', itemData.id, orderType, purchaserId)
const { setChangedCheckbox, colorStore } = useShoppingContext()
// @ts-ignore
const { checked } = useWatch(purchaserId, itemData?.id)
@ -42,7 +41,7 @@ const ColorKindItem: FC<PropsType> = memo(
}, [])
const handleSelect = () => {
console.log('handleSelect')
// console.log('handleSelect')
setChangedCheckbox({
purchaserId: purchaserId,
goodsKind: { [itemData.id]: { ...colorStore[purchaserId].goodsKind?.[itemData.id]!, checked: true } },
@ -105,7 +104,7 @@ const ColorKindItem: FC<PropsType> = memo(
(preProp, nextProp) => {
const stringifyPreProp = JSON.stringify(preProp.itemData)
const stringifyNextProp = JSON.stringify(nextProp.itemData)
console.log('memo==>', preProp, nextProp)
// console.log('memo==>', preProp, nextProp)
let needMemoized = true
if (preProp.purchaserId !== nextProp.purchaserId) {
needMemoized = false

View File

@ -18,7 +18,6 @@ export interface ShoppingCartPropsType {
// 购物车上下文组件
export const ShoppingCart: FC<ShoppingCartPropsType> = (props) => {
const { children, onTriggerCheckbox, initialValues, ref: refProps } = props
console.log('重新渲染 ShoppingCart context', refProps)
const defaultShoppingCart = useShoppingCart()
@ -38,7 +37,7 @@ export const ShoppingCart: FC<ShoppingCartPropsType> = (props) => {
const [selectedAmount, setSelectedAmount] = useState(0)
const ctx: ShoppingContextValue = useMemo(() => {
console.log('useMemo ShoppingContextValue')
// console.log('useMemo ShoppingContextValue')
return {
isManageStatus,
setManageStatus,
@ -48,7 +47,7 @@ export const ShoppingCart: FC<ShoppingCartPropsType> = (props) => {
setCurrentCheckedSaleMode,
colorStore,
setChangedCheckbox(changedGoods) {
console.log('changedGoods==>', colorStore, changedGoods)
// console.log('changedGoods==>', colorStore, changedGoods)
setColorStore((prev) => {
const currentGoodsKind = { ...prev[changedGoods.purchaserId]?.goodsKind, ...changedGoods.goodsKind }
return {

View File

@ -35,12 +35,10 @@ enum BackEndSaleModeListFieldMap {
}
export default memo<PropsType>(props => {
console.log('props==>', props)
const { itemData } = props
const { setCurrentCheckedSaleMode } = useShoppingContext()
console.log('重新渲染 shoppingCartItem')
const [openDetail, setOpenDetail] = useState(false)
const handleOpenDetail = () => {
@ -109,14 +107,12 @@ export default memo<PropsType>(props => {
if (currentCheckedPurchaserId === itemData?.purchaser_id) {
return
}
console.log('handleClickLayout')
setSelectedAmount(0)
setCurrentCheckedSaleMode(selected)
setCurrentCheckedPurchaserId(itemData?.purchaser_id as number)
}
const handleChecked = () => {
console.log('handleChecked')
// 初始化选中状态
setChangedCheckbox({
purchaserId: itemData?.purchaser_id!,
@ -124,7 +120,6 @@ export default memo<PropsType>(props => {
})
}
const handleUnchecked = () => {
console.log('handleUnchecked')
// 初始化选中状态
setChangedCheckbox({
purchaserId: itemData?.purchaser_id!,
@ -134,7 +129,6 @@ export default memo<PropsType>(props => {
// 统计已选面料
const materialChecked = useMemo(() => {
const targetGoodsKind = colorStore?.[itemData?.purchaser_id!]?.['goodsKind']
console.log('targetGoodsKind==>', targetGoodsKind)
if (!targetGoodsKind || isEmptyObject(targetGoodsKind)) return 0
return new Set(
Object.values(targetGoodsKind)?.reduce((prev, item: Goods) => {

View File

@ -24,23 +24,24 @@ export default () => {
let currPage = pages[pages.length - 1]; // 获取当前页面
setInfoObj((val) => ({
...val,
province_name: currPage.data?.addressObj?.province_name,
address_id: currPage.data?.addressObj?.id,
city_name: currPage.data?.addressObj?.city_name,
address_detail: currPage.data?.addressObj?.address_detail,
district_name: currPage.data?.addressObj?.district_name,
target_user_name: currPage.data?.addressObj?.name,
purchaser_phone: currPage.data?.addressObj?.phone,
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 : '',
}))
if (!currPage.data?.addressObj) {
setReceivingStatus(1)
} else {
setReceivingStatus(2)
}
})
useEffect(() => {
getDetail()
}, [])
useEffect(() => {
setInfoObj(infoObj)
console.log(infoObj, 66666)
}, [infoObj])
//收货方法,1:自提2物流
const [receivingStatus, setReceivingStatus] = useState<any>(null)
@ -78,7 +79,6 @@ export default () => {
}
const res = await infoFetch(query)
setInfoObj(res.data)
setReceivingStatus(1)
}
//备注操作

View File

@ -13,7 +13,7 @@ export const useTimeCountDown = () => {
const timeObj: any = useRef()
const endTime = useRef('')
const onStart = (val = '') => {
console.log('time:::', val)
// console.log('time:::', val)
endTime.current = val
if (endTime.current) {
clearInterval(timeObj.current)
@ -50,7 +50,7 @@ export const useTimeCountDown = () => {
var HH = ('00' + hh).slice(-2)
var MM = ('00' + mm).slice(-2)
var SS = ('00' + ss).slice(-2)
console.log('endTime::', `${DD}-${HH}-${MM}-${SS}`)
// console.log('endTime::', `${DD}-${HH}-${MM}-${SS}`)
setShowTime((e) => ({ ...e, DD, HH, MM, SS }))
}
return {
@ -103,8 +103,8 @@ const defaultOptions = {
*/
export const useNeedMemoCallback = (options: Options = defaultOptions) => {
return (prevProps: NormalPropsType, nextProps: NormalPropsType) => {
console.log(options)
console.log('memo==>', prevProps, nextProps)
// console.log(options)
// console.log('memo==>', prevProps, nextProps)
let needMemoized = true
// 引用类型
// function array object
@ -115,8 +115,8 @@ export const useNeedMemoCallback = (options: Options = defaultOptions) => {
const handleDiff = () => {
for (let [key, value] of Object.entries(prevProps)){
if (!Object.is(value, nextProps[key])) {
console.log('函数不相等',value === nextProps[key])
console.log('asdfasdf',value)
// console.log('函数不相等',value === nextProps[key])
// console.log('asdfasdf',value)
needMemoized = false
break
}
@ -165,4 +165,4 @@ const bool = needMemo(
hobby: hobby,
},
)
console.log('bool==>', bool)
// console.log('bool==>', bool)