✨ feat(提货详情): 已完成提货详情

This commit is contained in:
xuan
2022-09-26 10:45:46 +08:00
parent 0a3bdd83f3
commit 2a73febdba
6 changed files with 158 additions and 33 deletions
@@ -27,21 +27,21 @@ const ItemList:FC<PropsType> = (props) => {
})
}
const { fetchData, state } = TakeGoodsOrderAudit()
const { fetchData } = TakeGoodsOrderAudit()
// 确认审核
const handleAudit = (id: number) => {
Taro.showModal({
content: '确认要审核吗?',
content: '确认要提货吗?',
confirmColor: '#337FFF',
success: async (res) => {
if (res.confirm) {
const res = await fetchData({ id })
if (res.success) {
Taro.showToast({ title: '审核成功', icon: 'success' })
Taro.showToast({ title: '提货成功', icon: 'success' })
onSuccess?.()
}else{
Taro.showToast({ title: '审核失败', icon: 'error' })
Taro.showToast({ title: '操作失败', icon: 'error' })
}
}
},
@@ -53,10 +53,10 @@ const ItemList:FC<PropsType> = (props) => {
<View className={styles.topBar}>
<View className={styles.topBar__orderNo}>
<View>单号:{itemData?.take_goods_order_no}</View>
{itemData?.take_goods_status === 0 && <View className={classnames(styles.topBar__orderStatus, styles['topBar__orderStatus--takingGoods'])}>提货中</View>}
{itemData?.take_goods_status === 1 && (
<View className={classnames(styles.topBar__orderStatus, styles['topBar__orderStatus--finished'])}>已收货</View>
{itemData?.take_goods_status === 0 && (
<View className={classnames(styles.topBar__orderStatus, styles['topBar__orderStatus--takingGoods'])}>提货中</View>
)}
{itemData?.take_goods_status === 1 && <View className={classnames(styles.topBar__orderStatus, styles['topBar__orderStatus--finished'])}>已收货</View>}
</View>
<Text className={styles.topBar__orderType}>{itemData?.take_goods_order_type_name}</Text>
</View>
@@ -66,17 +66,18 @@ const ItemList:FC<PropsType> = (props) => {
<View className={styles.content__row__left}>货品信息:</View>
<View className={styles.content__row__right}>
<SaleModeTag saleMode={itemData.sale_mode} size='small' customClassName={styles.tag}></SaleModeTag>
{/* TODO: 面料字段、颜色字段 */}
{itemData.delivery_product_nums}种面料,{itemData.delivery_product_color_nums}种颜色,共
{itemData?.sale_mode === EnumSaleMode.Bulk ? `${itemData?.take_roll}条` : `${formatMeterDiv(itemData?.take_meters)}米`}
</View>
</View>
<View className={styles.content__row}>
<View className={styles.content__row__left}>供应信息:</View>
<View className={styles.content__row__right}>{itemData?.delivery_address || '空'}</View>
<View className={styles.content__row__right}>{itemData?.supplier_name || '空'}</View>
</View>
<View className={styles.content__row}>
<View className={styles.content__row__left}>创建时间:</View>
<View className={styles.content__row__right}>{formatDateTime(itemData?.create_time) || '空'}</View>
<View className={styles.content__row__right}>{formatDateTime(itemData?.take_goods_order_create_time) || '空'}</View>
</View>
</View>
<View className={styles.bottomBar}>
@@ -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: #007aff;
border-radius: 40px;
width: 668px;
text-align: center;
line-height: 82px;
color: #fff;
margin-top: 60px;
}
}
@@ -0,0 +1,43 @@
import Popup from "@/components/popup"
import { Textarea, View } from "@tarojs/components"
import { useCallback, useEffect, useState } from "react"
import styles from './index.module.scss'
type Param = {
onBlur?: (val:any) => void
onSave?: (val: string) => void
defaultValue?: string
}
export default ({onBlur, onSave, defaultValue = ''}:Param) => {
const [descData, setDescData] = useState({
number: 0,
value: '',
count: 200
})
useEffect(() => {
getDesc(defaultValue)
}, [defaultValue])
const getDesc = (value) => {
let res = value
if(value.length > descData.count) {
res = value.slice(0, descData.count)
}
setDescData({...descData, number:res.length, value: res})
}
const setSave = () => {
onSave?.(descData.value)
}
return (
<View className={styles.order_popup}>
<View className={styles.order_popup_title}>编辑备注</View>
<View className={styles.order_popup_input}>
<Textarea placeholder="请添加备注" value={descData?.value} maxlength={descData.count} cursorSpacing={100} onInput={(e) => getDesc(e.detail.value)} onBlur={(e) => onBlur?.(e)}></Textarea>
<View className={styles.descDataNum}>{descData.number}/{descData.count}</View>
</View>
<View className={styles.order_save_address} onClick={() => setSave()}>保存</View>
</View>
)
}