✨ feat(优化码单):

This commit is contained in:
2023-01-10 11:49:26 +08:00
parent 3e688d7893
commit 65462bd077
34 changed files with 561 additions and 247 deletions
+2 -2
View File
@@ -8,7 +8,7 @@
font-weight: 700;
color: rgba(0, 0, 0, 0.8);
margin-top: 20px;
margin-right: 64px;
margin-right: 30px;
}
.form-list-label-required::before {
content: '*';
@@ -21,7 +21,7 @@
font-weight: 400;
}
.form-list-right-meet {
background: #f6f6f6;
// background: #f6f6f6;
width: 506px;
min-height: 80px;
border-radius: 20px;
+1 -16
View File
@@ -42,19 +42,6 @@ const Checkbox = (props: params, ref) => {
value: status,
defaultValue: false,
})
// const selectedRef = useRef(status)
// if (status !== undefined){
// selectedRef.current = status
// }
// const [, setForceUpdate] = useState({})
// const setSelected = useCallback((v: SetStateAction<boolean>) => {
// const nextValue = typeof v === 'function' ? (v as (prevValue: boolean) => boolean)(selectedRef.current) : v
// console.log('对比',nextValue, selectedRef.current)
// if (nextValue === selectedRef.current) return
// selectedRef.current = nextValue
// console.log('强制刷新', nextValue, selectedRef.current)
// setForceUpdate({})
// }, [])
const onSelectEven = () => {
if (disabled) { return false }
@@ -96,9 +83,7 @@ const Checkbox = (props: params, ref) => {
useImperativeHandle(ref, () => ({
onSelectEven,
}))
// useEffect(() => {
// setSelected(status)
// }, [status])
return (
<View className={classnames(customClassName, styles.checkbox)} style={customStyles} onClick={onSelectEven}>
{!hiddenCheckboxIcon && (
@@ -2,6 +2,7 @@
position: fixed;
font-size: 32px;
color: #fff;
z-index: 1300;
.code_list__card {
position: absolute;
width: 306px;
+9 -10
View File
@@ -8,12 +8,9 @@ import ViewCodeList from '@/components/viewCodeList/index'
interface param {
y: number
custom_print_id: number
sale_order_id: number
orderObj?: any
}
export default ({ y, custom_print_id = 0, sale_order_id = 0, orderObj = {} }: param) => {
export default ({ y, orderObj = {} }: param) => {
const [screenHeight, setScreenHeight] = useState({
customer_service_y: 0,
code_list_y: 0,
@@ -21,14 +18,16 @@ export default ({ y, custom_print_id = 0, sale_order_id = 0, orderObj = {} }: pa
const [showCode, setShowCode] = useState(false)
const onNavigateTo = () => {
if (custom_print_id) {
goLink(`/pages/codeSetting/index?custom_print_id=${custom_print_id}`)
if (orderObj?.custom_print_id) {
goLink(`/pages/codeSetting/index?custom_print_id=${orderObj?.custom_print_id}`)
}
else {
goLink(`/pages/codeSetting/index?sale_order_id=${sale_order_id}`)
goLink(`/pages/codeSetting/index?sale_order_id=${orderObj?.id}`)
}
}
const [showPopup, setshowPopup] = useState(false)
return (<>
{showCode && <View className={styles.mask} catchMove onClick={() => setShowCode(!showCode)}></View>}
<MovableView className={classnames(styles.code_list, styles.fixed_btn)} direction="all" inertia x="630rpx" y={`${y}rpx`}>
@@ -37,13 +36,13 @@ export default ({ y, custom_print_id = 0, sale_order_id = 0, orderObj = {} }: pa
<IconFont name="icon-yuanshimadanyulan" size={46} />
<Text>原始码单预览</Text>
</View>
<View className={styles['code_list__card--item']} >
{!!orderObj?.custom_print_id && <View className={styles['code_list__card--item']} >
<IconFont name="icon-zidingyimadanyulan" size={46} />
<Text>自定义码单预览</Text>
</View>
</View>}
<View className={styles['code_list__card--item']} onClick={onNavigateTo}>
<IconFont name="icon-bianjizidingyimadan" size={46} />
<Text>{custom_print_id ? '编辑自定义码单' : '新建自定义码单'}</Text>
<Text>{orderObj?.custom_print_id ? '编辑自定义码单' : '新建自定义码单'}</Text>
</View>
</View>}
<View className={styles['code_list--text']} onClick={() => setShowCode(!showCode)}>码单</View>
@@ -12,7 +12,7 @@
display: flex;
justify-content: center;
align-items: center;
z-index: 999;
z-index: 1300;
position: fixed;
image {
width: 100%;
+1 -1
View File
@@ -12,7 +12,7 @@
display: flex;
justify-content: center;
align-items: center;
z-index: 999;
z-index: 1300;
position: fixed;
image {
width: 100%;
+2 -3
View File
@@ -21,9 +21,8 @@ interface param {
messagePath?: string
showCart?: false|true
orderObj?: any
orderInfo?: any
}
const MoveBtn = ({ orderObj = {}, children = null, onShopClick, showList = [], messageTitle = '', messagePath = '', showCart = false, orderInfo = {} }: param) => {
const MoveBtn = ({ orderObj = {}, children = null, onShopClick, showList = [], messageTitle = '', messagePath = '', showCart = false }: param) => {
const userInfo = useSelector(state => state.userInfo)
// 获取购物车数据数量
const { getShopCount, commonData } = useCommonData()
@@ -103,7 +102,7 @@ const MoveBtn = ({ orderObj = {}, children = null, onShopClick, showList = [], m
>
<Image mode="aspectFit" src={formatImgUrl('/mall/float_button_customer_service.png')} />
</MovableView>}
{onShow('code') && <CodeSelect orderObj={orderObj} y={screenHeight.code as number} custom_print_id={orderInfo?.custom_print_id} sale_order_id={orderInfo?.id} />}
{onShow('code') && <CodeSelect orderObj={orderObj} y={screenHeight.code as number} />}
<Customer messageTitle={messageTitle} messagePath={messageTitle} show={customer_service_show} showCard={showCart} onClose={customerClose} />
</MovableArea>
)