2022-06-10 20:30:30 +08:00

131 lines
6.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { Image, ScrollView, Text, Textarea, View } from "@tarojs/components";
import { memo, useCallback, useMemo, useState } from "react";
import classnames from "classnames";
import styles from './index.module.scss'
import { formatImgUrl } from "@/common/fotmat";
import Counter from "@/components/counter";
import ReasonPopup from "./components/reasonPopup";
import OtherReason from "./components/otherReason";
import Taro from "@tarojs/taro";
import useUploadCDNImg from "@/use/useUploadImage";
type ReasonParam = 1|2|3 //1 退货原因 2 货物状况 3 退货说明
export default () => {
const [showDesc, setShowDesc] = useState(true)
//退货选择弹窗
const [showReason, setShowReason] = useState<{show:true|false, status:ReasonParam}>({show:false, status:1})
const closeReason = useCallback(() => setShowReason({...showReason, show:false}), [])
const onShowReason = (status) => setShowReason({...showReason, status, show:true})
//底部按钮
const onSubmit = (val) => {
}
return (
<View className={styles.apply_after_sales_main}>
<View className={styles.apply_after_sales_con}>
<View className={styles.kind_number}><Text>236</Text></View>
<ScrollView scrollY className={styles.scroll}>
<View className={styles.scroll_con}>
<View className={styles.apply_after_sales_list}>
{new Array(5).fill(5).map(item => <View className={styles.apply_after_sales_item}>
<View className={styles.apply_after_sales_title}>
<View className={styles.tag}></View>
<View className={styles.title}>0770# 21S单面平纹()</View>
</View>
<View className={styles.color_list}>
<View className={styles.color_item}>
<View className={styles.image}><Image src={formatImgUrl('')}/></View>
<View className={styles.name_and_number}><Text>1# 绿</Text><Text>x1</Text></View>
<View className={styles.btn_count}>
<Counter/>
</View>
</View>
<View className={styles.color_item}>
<View className={styles.image}><Image src={formatImgUrl('')}/></View>
<View className={styles.name_and_number}><Text>1# 绿</Text><Text>x1</Text></View>
<View className={styles.btn_count}>
<Counter/>
</View>
</View>
</View>
</View>)}
</View>
<View className={styles.returnSaleInput}>
<View className={styles.returnSaleInput_item}>
<View className={styles.title}>退</View>
<View className={styles.select} onClick={() => onShowReason(1)}>
<Text></Text>
<Text className={classnames(styles.miconfont, 'iconfont icon-a-moreback')}></Text>
</View>
</View>
<View className={styles.returnSaleInput_item}>
<View className={styles.title}></View>
<View className={styles.select} onClick={() => onShowReason(2)}>
<Text></Text>
<Text className={classnames(styles.miconfont, 'iconfont icon-a-moreback')}></Text>
</View>
</View>
<View className={styles.returnSaleInput_item}>
<View className={styles.title}>退</View>
<View className={styles.select} onClick={() => onShowReason(3)}>
<Text></Text>
<Text className={classnames(styles.miconfont, 'iconfont icon-a-moreback')}></Text>
</View>
</View>
<View className={styles.returnSaleInput_item}>
<View className={styles.title}></View>
<PictureItem/>
</View>
</View>
<OtherReason/>
</View>
</ScrollView>
<View className="common_safe_area_y"></View>
</View>
<View className={styles.btns_con}>
<View className={styles.btns_two}>
<View className={styles.rest_btn} onClick={() => onSubmit(1)}></View>
<View className={styles.verify_btn } onClick={() => onSubmit(2)}></View>
</View >
</View >
<ReasonPopup show={showReason.show} onClose={closeReason} status={showReason.status}/>
</View>
)
}
//图片列表
const PictureItem = memo(() => {
const {uploadCDNImg} = useUploadCDNImg()
//图片
const uploadImage = () => {
Taro.chooseImage({
count: 1, // 默认9
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: function (res) {
const file = res.tempFiles[0]
uploadCDNImg(file, 'product', 'product')
}
})
}
return (
<>
<View className={styles.ImgItem}>
<Image mode="aspectFill" src={formatImgUrl('')} ></Image>
<View className={classnames(styles.miconfont_close, 'iconfont icon-qingkong')}></View>
</View>
<View className={styles.uploadImg } onClick={uploadImage}>
<Text className={classnames(styles.miconfont, 'iconfont icon-saomazhifu')}></Text>
<Text className={styles.uploadText}></Text>
</View>
</>
)
})