🦄 refactor:搜索历史加入购物车100%
This commit is contained in:
@@ -138,4 +138,11 @@
|
||||
z-index: 999;
|
||||
bottom: calc($customTabBarHeight + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
.noBottom {
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
z-index: 999;
|
||||
bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import Goods from "@/components/goodsItem"
|
||||
import BottomCustomer from "@/components/BottomCustomer"
|
||||
import VirtualList from '@tarojs/components/virtual-list'
|
||||
import DotLoading from "@/components/dotLoading"
|
||||
|
||||
interface prosObj {
|
||||
showPopup?: false | true,
|
||||
closePopup?: () => void,
|
||||
@@ -17,7 +16,7 @@ interface prosObj {
|
||||
handCheck?: (any) => void,
|
||||
addNums?: (any) => void
|
||||
reduceNums?: (any) => void
|
||||
oninputEvent?: (e: string, res: object) => void,
|
||||
// oninputEvent?: (e: string, res: object) => void,
|
||||
getSearchData: (any) => void,
|
||||
handPlus: (any) => void,
|
||||
handSure: () => void,
|
||||
@@ -28,7 +27,9 @@ interface prosObj {
|
||||
},
|
||||
modeFont: Number | string,
|
||||
clientName: string,
|
||||
clientId: Number
|
||||
clientId: Number,
|
||||
hasBottom?: true | false, //默认不占位底部
|
||||
onBlur?: (e: string, res: object) => void
|
||||
}
|
||||
export default memo(forwardRef((props: prosObj, ref) => {
|
||||
const {
|
||||
@@ -39,14 +40,16 @@ export default memo(forwardRef((props: prosObj, ref) => {
|
||||
handCheck,
|
||||
addNums,
|
||||
reduceNums,
|
||||
oninputEvent,
|
||||
// oninputEvent,
|
||||
getSearchData,
|
||||
handPlus,
|
||||
obj = {},
|
||||
modeFont = 0,
|
||||
clientName = '',
|
||||
clientId = -1,
|
||||
handSure
|
||||
handSure,
|
||||
hasBottom = true,
|
||||
onBlur
|
||||
} = props
|
||||
|
||||
useImperativeHandle(ref, () => ({
|
||||
@@ -78,26 +81,39 @@ export default memo(forwardRef((props: prosObj, ref) => {
|
||||
|
||||
//选择的条数或者米数
|
||||
const selectNums = useMemo(() => {
|
||||
var s = 0;
|
||||
goodList.forEach(function (val, idx, arr) {
|
||||
if (val.showInput) {
|
||||
s += val.nums;
|
||||
let arr: any = []
|
||||
goodList.forEach(item => {
|
||||
if (item.showInput) {
|
||||
arr.push(Number(item.nums))
|
||||
}
|
||||
}, 0);
|
||||
|
||||
return s;
|
||||
})
|
||||
let hate = sum(arr)
|
||||
return hate
|
||||
}, [goodList])
|
||||
// onInputEven={(e, obj) => oninputEvent?.(e, obj)}
|
||||
// onInputEven={(e, item) => oninputEvent?.(e, item)}
|
||||
|
||||
function sum(arr) {
|
||||
var s = 0;
|
||||
for (var i = arr.length - 1; i >= 0; i--) {
|
||||
s += arr[i];
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
const rows = memo(({ id, index, style, data }: any) => {
|
||||
let item = data[index]
|
||||
return (
|
||||
<>
|
||||
<Goods modeFont={(modeFont as number)}
|
||||
<Goods
|
||||
onBlur={(e, id) => onBlur?.(e, id)}
|
||||
modeFont={(modeFont as number)}
|
||||
handPlus={(item) => handPlus?.(item)}
|
||||
value={item || {}}
|
||||
clickAdd={(item) => addNums?.(item)}
|
||||
clickReduce={(item) => { reduceNums?.(item) }}></Goods>
|
||||
clickReduce={(item) => { reduceNums?.(item) }}
|
||||
goodList={goodList}
|
||||
></Goods>
|
||||
</>
|
||||
)
|
||||
})
|
||||
@@ -151,7 +167,10 @@ export default memo(forwardRef((props: prosObj, ref) => {
|
||||
<View className={styles.loading_more}>加载中<DotLoading /></View>
|
||||
</>
|
||||
}
|
||||
<View className={styles.posBox}>
|
||||
{
|
||||
!hasBottom && <View style={{ height: '100rpx' }}></View>
|
||||
}
|
||||
<View className={classnames(hasBottom === true ? styles.posBox : styles.noBottom)}>
|
||||
<BottomCustomer clientName={clientName} clientId={clientId} isDisabled={selectTotal > 0 && clientName !== '' ? false : true} handSure={() => { handSure() }}></BottomCustomer>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user