✨ feat(领取色卡):
This commit is contained in:
@@ -36,14 +36,17 @@
|
||||
border-color: $color_main;
|
||||
}
|
||||
}
|
||||
.checkbox_main_no_selected {
|
||||
border: 0 !important;
|
||||
}
|
||||
.checkbox_item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.no_checkbox_item {
|
||||
border: 0;
|
||||
background-color: #dddddd;
|
||||
border: 0 !important;
|
||||
background-color: #dddddd !important;
|
||||
}
|
||||
.checkbox_item_select {
|
||||
background-color: $color_main;
|
||||
|
||||
@@ -68,16 +68,16 @@ const Checkbox = (props: params, ref) => {
|
||||
[styles[`checkbox_main--${size}`]]: size,
|
||||
[styles['checkbox_main--round']]: round,
|
||||
[styles['checkbox_main--circle']]: circle,
|
||||
[styles.checkbox_main_no_selected]: disabled,
|
||||
}
|
||||
return classObject
|
||||
}
|
||||
|
||||
const getClassName = () => {
|
||||
const classObject = {
|
||||
return {
|
||||
[styles.no_checkbox_item]: disabled,
|
||||
[styles.checkbox_item_select]: selected,
|
||||
}
|
||||
return classObject
|
||||
}
|
||||
|
||||
useImperativeHandle(ref, () => ({
|
||||
|
||||
@@ -13,6 +13,8 @@ interface params {
|
||||
onChange?: (val: number) => void
|
||||
onBlue?: (val: number) => void // 失去焦点触发
|
||||
onClickBtn?: (val: number) => void
|
||||
onMax?: () => void // 触发大于最大值回调
|
||||
onMin?: () => void // 触发小于最小值回调
|
||||
unit?: string
|
||||
disabled?: true | false // 是否禁用
|
||||
returnZero?: true | false // 少于最小值时是否归0
|
||||
@@ -28,6 +30,8 @@ const CounterDisplayName = (props: params) => {
|
||||
onChange,
|
||||
onBlue,
|
||||
onClickBtn,
|
||||
onMax,
|
||||
onMin,
|
||||
returnZero = false,
|
||||
unit = '',
|
||||
disabled = false,
|
||||
@@ -76,14 +80,14 @@ const CounterDisplayName = (props: params) => {
|
||||
const count = value.count
|
||||
let num_res = value.count
|
||||
if (!isInteger(num_res)) {
|
||||
console.log('num_resaa::', num_res)
|
||||
num_res = Math.trunc(num_res)
|
||||
}
|
||||
else {
|
||||
console.log('num_resbb::', num_res)
|
||||
num_res = Big(count).minus(step).toNumber()
|
||||
}
|
||||
|
||||
if (num_res < minNum) { onMin?.() }
|
||||
|
||||
if (returnZero) {
|
||||
num_res = num_res < minNum ? 0 : num_res
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
.order_popup {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 20px 0;
|
||||
.order_popup_title {
|
||||
color: $font_size_big;
|
||||
font-weight: 700;
|
||||
color: #000000;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
.order_popup_input {
|
||||
width: 100%;
|
||||
padding: 0 25px;
|
||||
box-sizing: border-box;
|
||||
margin-top: 43px;
|
||||
position: relative;
|
||||
.descDataNum {
|
||||
position: absolute;
|
||||
right: 40px;
|
||||
bottom: 10px;
|
||||
height: 39px;
|
||||
font-size: $font_size_medium;
|
||||
color: $color_font_two;
|
||||
}
|
||||
textarea {
|
||||
background-color: #f3f3f3;
|
||||
border-radius: 10px;
|
||||
width: 100%;
|
||||
height: 313px;
|
||||
padding: 20px;
|
||||
padding-bottom: 50px;
|
||||
box-sizing: border-box;
|
||||
font-size: $font_size;
|
||||
border: 2px solid #e6e6e6;
|
||||
}
|
||||
}
|
||||
.order_save_address {
|
||||
height: 82px;
|
||||
background: $color_main;
|
||||
border-radius: 40px;
|
||||
width: 668px;
|
||||
text-align: center;
|
||||
line-height: 82px;
|
||||
color: #fff;
|
||||
margin-top: 60px;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
import { Textarea, View } from '@tarojs/components'
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
import styles from './index.module.scss'
|
||||
import Popup from '@/components/popup'
|
||||
|
||||
interface Param {
|
||||
onBlur?: (val: any) => void
|
||||
onSave?: (val: string) => void
|
||||
show: boolean
|
||||
onClose: (val: boolean) => void
|
||||
}
|
||||
export default (props: Param) => {
|
||||
const [descData, setDescData] = useState({
|
||||
number: 0,
|
||||
value: '',
|
||||
count: 200,
|
||||
})
|
||||
const [showDesc, setShowDesc] = useState(false)
|
||||
useEffect(() => {
|
||||
setShowDesc(props.show)
|
||||
}, [props.show])
|
||||
const getDesc = useCallback((e) => {
|
||||
const value = e.detail.value
|
||||
let res = value
|
||||
if (value.length > descData.count) {
|
||||
res = value.slice(0, descData.count)
|
||||
}
|
||||
setDescData({ ...descData, number: res.length, value: res })
|
||||
}, [])
|
||||
|
||||
const setSave = () => {
|
||||
props.onSave?.(descData.value)
|
||||
}
|
||||
return (
|
||||
<Popup show={showDesc} showTitle={false} onClose={() => props.onClose(false)}>
|
||||
<View className={styles.order_popup}>
|
||||
<View className={styles.order_popup_title}>编辑备注</View>
|
||||
<View className={styles.order_popup_input}>
|
||||
<Textarea value={descData.value} placeholder="请添加备注" maxlength={descData.count} cursorSpacing={100} onInput={e => getDesc(e)} onBlur={e => props.onBlur?.(e)}></Textarea>
|
||||
<View className={styles.descDataNum}>{descData.number}/{descData.count}</View>
|
||||
</View>
|
||||
<View className={styles.order_save_address} onClick={() => setSave()}>保存</View>
|
||||
</View>
|
||||
</Popup>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
.order_address_list {
|
||||
height: 80vh;
|
||||
.order_address_title {
|
||||
font-size: $font_size;
|
||||
font-weight: 700;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
padding: 20px 0 30px 0;
|
||||
height: 100px;
|
||||
}
|
||||
.addressList_con {
|
||||
padding-bottom: 20px;
|
||||
height: calc(100% - 160px);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,28 @@
|
||||
import { View } from '@tarojs/components'
|
||||
import { useState } from 'react'
|
||||
import { useEffect, useState } from 'react'
|
||||
import AddressList from '../AddressList'
|
||||
import styles from './index.module.scss'
|
||||
import Popup from '@/components/popup'
|
||||
|
||||
export default () => {
|
||||
const [showAddressList, setShowAddressList] = useState(false)
|
||||
return <Popup show={showAddressList} showTitle={false} onClose={() => setShowAddressList(false)}>
|
||||
interface Params {
|
||||
show: boolean
|
||||
onClose: (val: boolean) => void
|
||||
onSelect: (val: any) => void
|
||||
}
|
||||
export default (props: Params) => {
|
||||
const [show, setShow] = useState(false)
|
||||
useEffect(() => {
|
||||
setShow(props.show)
|
||||
}, [props.show])
|
||||
const getSelect = (e) => {
|
||||
props.onSelect(e)
|
||||
props.onClose(false)
|
||||
}
|
||||
return <Popup show={show} showTitle={false} onClose={() => props.onClose(false)}>
|
||||
<View className={styles.order_address_list}>
|
||||
<View className={styles.order_address_title}>请选择收货地址</View>
|
||||
<View className={styles.order_address_title}>请选择收货地址2</View>
|
||||
<View className={styles.addressList_con}>
|
||||
<AddressList />
|
||||
<AddressList onSelect={getSelect} />
|
||||
</View>
|
||||
</View>
|
||||
</Popup>
|
||||
|
||||
Reference in New Issue
Block a user