✨ feat:新建收款完成100%

This commit is contained in:
Haiyi
2022-09-26 14:33:27 +08:00
parent 5c2e3d46ac
commit ccc3530aff
14 changed files with 223 additions and 62 deletions
@@ -64,4 +64,18 @@
font-size: 30px;
}
}
.itemBox {
width: 100%;
height: 88px;
display: flex;
align-items: center;
text-align: center;
justify-content: center;
line-height: 88px;
font-size: 28px;
font-weight: 500;
color: #000000;
border-bottom: 1px solid #f7f7f7;
}
}
+44 -2
View File
@@ -5,6 +5,7 @@ import { Image, Text, View } from '@tarojs/components'
import { formatImgUrl } from '@/common/format'
import classnames from 'classnames'
import styles from './index.module.scss'
import Popup from '@/components/popup'
//图片列表
type ImageParam = {
@@ -13,7 +14,7 @@ type ImageParam = {
onlyRead?: false | true
}
const PictureItem: FC<ImageParam> = memo(({ onChange, defaultList, onlyRead = false }) => {
const { getWxPhoto } = useUploadCDNImg()
const { getWxPhoto, getChatPhoto } = useUploadCDNImg()
const [imageList, setImageLise] = useState<string[]>([])
useEffect(() => {
@@ -22,13 +23,27 @@ const PictureItem: FC<ImageParam> = memo(({ onChange, defaultList, onlyRead = fa
//上传图片
const uploadImage = async () => {
let list: any = await getWxPhoto('after-sale', 5)
setshowPopup(true)
}
//上传图片逻辑
const handPic = async (id) => {
// let resArr = List.filter(item => {
// return item.check
// })
if (id == 1) {
var list: any = await getWxPhoto('after-sale', 5)
} else {
var list: any = await getChatPhoto('after-sale', 5)
}
let images: any[] = []
list?.map((item) => {
images.push(item.url)
})
setImageLise([...imageList, ...images])
setshowPopup(false)
}
//删除图片
const delImage = (index) => {
imageList.splice(index, 1)
@@ -50,6 +65,23 @@ const PictureItem: FC<ImageParam> = memo(({ onChange, defaultList, onlyRead = fa
})
}
//筛选内容展示
const [showPopup, setshowPopup] = useState(false)
const [List, setList] = useState<any[]>([{ id: 1, name: '手机相册', check: false }, { id: 2, name: '从微信对话选择', check: false }])
//点击选择的方式
const handItem = (item) => {
List.map(it => {
if (item.id == it.id) {
it.check = true
} else {
it.check = false
}
return it
})
setList([...List])
handPic(item.id)
}
return (
<View className={styles.image_main}>
{imageList?.map((item, index) => (
@@ -64,6 +96,16 @@ const PictureItem: FC<ImageParam> = memo(({ onChange, defaultList, onlyRead = fa
{/* <Text className={styles.uploadText}>上传照片</Text> */}
</View>
)}
<Popup title={'选择方式'} show={showPopup} onClose={() => setshowPopup(false)}>
{
List.map((item, index) => {
return (
<View className={styles.itemBox} key={index} onClick={() => handItem(item)}>{item.name}</View>
)
})
}
</Popup>
</View>
)
})