售后基本对完

This commit is contained in:
2022-07-01 20:28:45 +08:00
parent 4ac7890915
commit b2f17afe50
20 changed files with 780 additions and 93 deletions
@@ -8,7 +8,7 @@ type Param = {
return_address?:string,
return_phone?: string,
onLogistics?: (val: number) => void,
stage?: number
stage?: number,
}
export default memo(({return_address = '', return_phone = '', onLogistics, stage}:Param) => {
const {
@@ -30,12 +30,7 @@ export default memo(({return_address = '', return_phone = '', onLogistics, stage
//上传物流
const upLogistics = useMemo(() => {
return stage == ReturnStageWaitCheck.value
}, [stage])
//查看物流
const showLogistics = useMemo(() => {
return (stage == ReturnStageChecked.value || stage == ReturnStageQualityCheckPendingRefund.value)
}, [stage])
}, [stage])
return (
@@ -56,8 +51,8 @@ export default memo(({return_address = '', return_phone = '', onLogistics, stage
<Text>{return_phone}</Text>
{upLogistics&&<View className={styles.updateBtn} onClick={() => onLogistics?.(1)}>
上传物流
</View>}
{showLogistics&&<View className={styles.updateBtn} onClick={() => onLogistics?.(2)}>
</View>
||<View className={styles.updateBtn} onClick={() => onLogistics?.(2)}>
查看物流
</View>}
</View>
@@ -89,6 +89,11 @@
.order_list_item_price{
font-size: 26px;
color: $color_font_three;
text{
&:nth-child(1) {
margin-right: 10px;
}
}
}
}
.order_list_item_count{
@@ -98,7 +98,10 @@ export default memo(({show, onClose, onSubmit, id}:Param) => {
<View className={styles.order_list_item_con}>
<View className={styles.order_list_item_des}>
<View className={styles.order_list_item_title}>{colorItem.code + ' ' + colorItem.name}</View>
<View className={styles.order_list_item_price}>¥{standardPrice(colorItem.sale_price)}</View>
<View className={styles.order_list_item_price}>
<Text>¥{standardPrice(colorItem.sale_price)}</Text>
<Text>总重{standardPrice(colorItem.estimate_weight)}</Text>
</View>
</View>
<View className={styles.order_list_item_count}>
<View className={styles.count_num}>×{formatCount(colorItem)}<text>{formatDetailOrder.unit}</text></View>
@@ -0,0 +1,131 @@
.kindsList_main{
margin-top: 20px;
}
.orders_list_con{
background-color: #fff;
border-radius: 20px;
padding: 20px;
.orders_return_title{
font-size: 28px;
font-weight: 700;
padding-bottom: 20px;
}
.order_list{
&:nth-child(n+2) {
margin-top: 30px;
}
.order_list_title{
display: flex;
align-items: center;
.tag{
font-size: $font_size_min;
background-color: #CDE5FF;
padding: 5px 10px;
border-radius: 6px;
color: $color_main;
}
.title{
font-weight: 700;
font-size: $font_size;
margin-left: 20px;
flex:1;
}
.num{
color: $color_font_two;
font-size: $font_size_min;
}
}
}
.order_list_scroll{
margin-top: 30px;
.order_list_item {
display: flex;
&:nth-child(2) {
margin-top: 30px;
}
.order_list_item_img{
width: 126px;
height: 126px;
border-radius: 20px;
}
.order_list_item_con{
display: flex;
width: 100%;
flex:1;
border-bottom: 1px solid #f0f0f0;
height: 150px;
padding-top: 20px;
box-sizing: border-box;
}
.order_list_item_des{
flex:1;
box-sizing: border-box;
padding-left: 30px;
.order_list_item_title{
font-weight: 700;
font-size: $font_size;
margin-bottom: 15px;
}
.order_list_item_price{
font-size: 26px;
color: $color_font_three;
text{
&:nth-child(n+1) {
margin-right: 20px;
}
}
}
}
.order_list_item_count{
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-end;
.count_num{
color: $color_main;
font-size: $font_size;
margin-bottom: 15px;
font-weight: 400;
text{
font-size: $font_size_min;
}
}
.count_price {
font-size: $font_size;
font-weight: 700;
text{
font-size: $font_size_min;
}
}
}
}
}
.order_total{
padding-top: 20px;
display: flex;
justify-content: space-between;
text{
&:nth-child(1) {
font-size: 28px;
font-weight: 700;
}
&:nth-child(2) {
font-size: 24px;
font-weight: 700;
}
}
}
.order_estimated_amount{
display: flex;
align-items: flex-end;
flex-direction: column;
padding: 30px 0;
.order_price_des{
font-size: $font_size_medium;
color: $color_font_two;
}
}
}
@@ -0,0 +1,192 @@
import { AFTER_ORDER_STATUS, ORDER_STATUS } from "@/common/enum"
import { formatHashTag, formatPriceDiv, formatWeightDiv } from "@/common/fotmat"
import LabAndImg from "@/components/LabAndImg"
import { Text, View } from "@tarojs/components"
import { memo, useCallback, useMemo } from "react"
import EstimatedAmount from "../estimatedAmount"
import styles from './index.module.scss'
type OrderParam = {
estimate_amount: number, //预估金额
list: any[],
sale_mode: number,
sale_mode_name: string,
unit: string,
total_colors: number,
total_fabrics: number,
total_number: number,
stage: number, //订单状态
type: 1|2, //1退货, 2退款
total_sale_price: number, //销售金额
total_should_collect_money: number, //应收金额
total_weight_error_discount: number, //空差优惠
the_previous_status: number, //取消订单时的订单状态
actual_amount: number //实付金额
}
type Param = {
order: OrderParam,
comfirm?: boolean //是否是确认订单页面使用
}
export default memo(({order, comfirm = false}:Param) => {
//对应数量
const formatCount = useCallback((item) => {
return order?.sale_mode == 0? item.roll : Number(item.length / 100)
}, [order])
//对应单价
const standardPrice = useCallback(price => {
return formatPriceDiv(price).toLocaleString() + '/' + (order?.sale_mode == 1?'m':'kg')
}, [order])
//数量格式
const numText = useMemo(() => {
if(order)
return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${order?.total_number}${order?.unit}`
}, [order])
//售后单状态枚举
const {
ReturnStageApplying, // 申请中
ReturnStageWaitCheck, // 退货中
ReturnStageChecked, // 待验布
ReturnStageReturned, // 已退款
ReturnStageCancel, // 已取消
ReturnStageQualityCheckPendingRefund, // 已验布
ReturnStageServiceOrderPendingRefund, // 待退款
ReturnStageRejected, // 已拒绝
} = AFTER_ORDER_STATUS
//金额列表枚举
const priceList = [
{
id:1,
value:[],
label:'退货条数',
field: ''
},
{
id:2,
value:[
ReturnStageServiceOrderPendingRefund.value,
ReturnStageReturned.value
],
label:'扣款金额',
field: 'total_sale_price'
},
{
id:3,
value:[
ReturnStageServiceOrderPendingRefund.value,
ReturnStageReturned.value
],
label:'其他扣款',
field: 'total_weight_error_discount'
},
{
id:4,
value:[
ReturnStageServiceOrderPendingRefund.value,
ReturnStageReturned.value
],
label:'应退金额',
field: 'total_should_collect_money'
},
{
id:5,
value:[ReturnStageReturned.value],
label:'退款金额',
field: 'total_should_collect_money'
},
{
id:6,
value:[ReturnStageReturned.value],
label:'退款去向',
field: 'actual_amount'
},
{
id:7,
value:[ReturnStageQualityCheckPendingRefund.value],
label:'合计金额',
field: 'actual_amount'
},
]
//是否显示价格
const showPrice = useCallback((priceInfo) => {
if(priceInfo.value == 8) {
//合计金额
}
return priceInfo.value.includes(order?.stage)
}, [order])
const priceConDom = useMemo(() => {
if(!order) return
return (
<>
{
priceList.map(item => {
return <>{showPrice(item)&&<EstimatedAmount key={item.id} number={formatPriceDiv(order[item.field])} title={item.label} />}</>
})
}
</>
)
}, [order])
//整理颜色
const labAndRgbAndUrl = useCallback((item) => {
return {lab:{...item?.lab}, rgb:{...item?.rgb}, texturl_url: item?.texturl_url}
}, [])
//单价显示判断
const sale_price_show = useMemo(() => {
return order?.stage != ReturnStageServiceOrderPendingRefund.value && order?.stage != ReturnStageQualityCheckPendingRefund.value
}, [order])
return (
<View className={styles.kindsList_main}>
<View className={styles.orders_list_con}>
<View className={styles.orders_return_title}>{order?.type == 1?'退货信息':'退款信息'}</View>
{
order?.list?.map(item => {
return <View key={item.product_code} className={styles.order_list}>
<View className={styles.order_list_title}>
<View className={styles.tag}>{order.sale_mode_name}</View>
<View className={styles.title}>{formatHashTag(item.code, item.name)}</View>
<View className={styles.num}>共{item?.product_colors?.length}种</View>
</View>
<View className={styles.order_list_scroll}>
{item?.product_colors?.map(colorItem => {
return <View key={colorItem.id} className={styles.order_list_item}>
<View className={styles.order_list_item_img}>
<LabAndImg value={labAndRgbAndUrl(colorItem)}/>
</View>
<View className={styles.order_list_item_con}>
<View className={styles.order_list_item_des}>
<View className={styles.order_list_item_title}>{colorItem.code + ' ' + colorItem.name}</View>
<View className={styles.order_list_item_price}>
{sale_price_show&&<Text>¥{standardPrice(colorItem.sale_price)}</Text>}
<Text>总重{formatWeightDiv(colorItem.estimate_weight)}kg</Text>
</View>
</View>
<View className={styles.order_list_item_count}>
<View className={styles.count_num}>×{formatCount(colorItem)}<text>{order.unit}</text></View>
<View className={styles.count_price}><text>¥</text>{formatPriceDiv(colorItem.estimate_amount).toLocaleString()}</View>
</View>
</View>
</View>
})}
</View>
</View>
})
}
<View className={styles.order_total}><Text>合计</Text><Text>{numText}</Text></View>
<View className={styles.order_estimated_amount}>
{priceConDom}
</View>
</View>
</View>
)
})
@@ -72,6 +72,11 @@
.order_list_item_price{
font-size: 26px;
color: $color_font_three;
text{
&:nth-child(n+1) {
margin-right: 20px;
}
}
}
}
.order_list_item_count{
@@ -1,5 +1,5 @@
import { ORDER_STATUS } from "@/common/enum"
import { formatHashTag, formatPriceDiv } from "@/common/fotmat"
import { AFTER_ORDER_STATUS, ORDER_STATUS } from "@/common/enum"
import { formatHashTag, formatPriceDiv, formatWeightDiv } from "@/common/fotmat"
import LabAndImg from "@/components/LabAndImg"
import { Text, View } from "@tarojs/components"
import { memo, useCallback, useMemo } from "react"
@@ -45,57 +45,88 @@ export default memo(({order, comfirm = false}:Param) => {
return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${order?.total_number}${order?.unit}`
}, [order])
//售后单状态枚举
const {
ReturnStageApplying, // 申请中
ReturnStageWaitCheck, // 退货中
ReturnStageChecked, // 待验布
ReturnStageReturned, // 已退款
ReturnStageCancel, // 已取消
ReturnStageQualityCheckPendingRefund, // 已验布
ReturnStageServiceOrderPendingRefund, // 待退款
ReturnStageRejected, // 已拒绝
} = AFTER_ORDER_STATUS
//金额列表枚举
const priceList = [
{
id:1,
value:[],
label:'退货条数',
field: 'estimate_amount'
},
{
id:2,
value:[],
big_value:[
ReturnStageServiceOrderPendingRefund.value,
ReturnStageReturned.value
],
cut_value: [ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value],
model_value: [],
label:'扣款金额',
field: 'total_sale_price'
},
{
id:3,
value:[],
id:2,
big_value:[
ReturnStageServiceOrderPendingRefund.value,
ReturnStageReturned.value
],
cut_value: [],
model_value: [],
label:'其他扣款',
field: 'total_weight_error_discount'
},
{
id:4,
value:[],
id:3,
big_value:[
ReturnStageServiceOrderPendingRefund.value,
ReturnStageReturned.value
],
cut_value: [ReturnStageServiceOrderPendingRefund.value],
model_value: [
ReturnStageQualityCheckPendingRefund.value,
ReturnStageServiceOrderPendingRefund.value
],
label:'应退金额',
field: 'total_should_collect_money'
},
{
id:5,
value:[],
id:4,
big_value:[ReturnStageReturned.value],
cut_value: [ReturnStageReturned.value],
model_value: [ReturnStageReturned.value],
label:'退款金额',
field: 'total_should_collect_money'
},
{
id:6,
value:[],
id:5,
big_value:[ReturnStageReturned.value],
cut_value: [ReturnStageReturned.value],
model_value: [ReturnStageReturned.value],
label:'退款去向',
field: 'actual_amount'
},
{
id:7,
value:[],
label:'实付金额',
id:6,
big_value:[ReturnStageQualityCheckPendingRefund.value],
cut_value: [ReturnStageRejected.value, ReturnStageApplying.value, ReturnStageWaitCheck.value, ReturnStageChecked.value, ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value],
model_value: [ReturnStageApplying.value],
label:'合计金额',
field: 'actual_amount'
}
},
]
//是否显示价格
const showPrice = useCallback((priceInfo, status) => {
return priceInfo.value.includes(status)
const showPrice = useCallback((priceInfo) => {
let key = ['big_value', 'model_value', 'cut_value']
return priceInfo[key[order?.sale_mode]].includes(order?.stage)
}, [order])
const priceConDom = useMemo(() => {
@@ -104,7 +135,7 @@ export default memo(({order, comfirm = false}:Param) => {
<>
{
priceList.map(item => {
return <>{showPrice(item, order?.stage)&&<EstimatedAmount key={item.id} number={formatPriceDiv(order[item.field])} title={item.label} />}</>
return <>{showPrice(item)&&<EstimatedAmount key={item.id} number={formatPriceDiv(order[item.field])} title={item.label} />}</>
})
}
</>
@@ -115,6 +146,11 @@ export default memo(({order, comfirm = false}:Param) => {
const labAndRgbAndUrl = useCallback((item) => {
return {lab:{...item?.lab}, rgb:{...item?.rgb}, texturl_url: item?.texturl_url}
}, [])
//单价显示判断
const sale_price_show = useMemo(() => {
return order?.stage != ReturnStageServiceOrderPendingRefund.value && order?.stage != ReturnStageQualityCheckPendingRefund.value
}, [order])
return (
<View className={styles.kindsList_main}>
@@ -126,7 +162,7 @@ export default memo(({order, comfirm = false}:Param) => {
<View className={styles.order_list_title}>
<View className={styles.tag}>{order.sale_mode_name}</View>
<View className={styles.title}>{formatHashTag(item.code, item.name)}</View>
<View className={styles.num}>共{item?.product_colors.length}种</View>
<View className={styles.num}>共{item?.product_colors?.length}种</View>
</View>
<View className={styles.order_list_scroll}>
{item?.product_colors?.map(colorItem => {
@@ -137,7 +173,10 @@ export default memo(({order, comfirm = false}:Param) => {
<View className={styles.order_list_item_con}>
<View className={styles.order_list_item_des}>
<View className={styles.order_list_item_title}>{colorItem.code + ' ' + colorItem.name}</View>
<View className={styles.order_list_item_price}>¥{standardPrice(colorItem.sale_price)}</View>
<View className={styles.order_list_item_price}>
{sale_price_show&&<Text>¥{standardPrice(colorItem.sale_price)}</Text>}
<Text>总重{formatWeightDiv(colorItem.estimate_weight)}kg</Text>
</View>
</View>
<View className={styles.order_list_item_count}>
<View className={styles.count_num}>×{formatCount(colorItem)}<text>{order.unit}</text></View>
@@ -0,0 +1,131 @@
.kindsList_main{
margin-top: 20px;
}
.orders_list_con{
background-color: #fff;
border-radius: 20px;
padding: 20px;
.orders_return_title{
font-size: 28px;
font-weight: 700;
padding-bottom: 20px;
}
.order_list{
&:nth-child(n+2) {
margin-top: 30px;
}
.order_list_title{
display: flex;
align-items: center;
.tag{
font-size: $font_size_min;
background-color: #CDE5FF;
padding: 5px 10px;
border-radius: 6px;
color: $color_main;
}
.title{
font-weight: 700;
font-size: $font_size;
margin-left: 20px;
flex:1;
}
.num{
color: $color_font_two;
font-size: $font_size_min;
}
}
}
.order_list_scroll{
margin-top: 30px;
.order_list_item {
display: flex;
&:nth-child(2) {
margin-top: 30px;
}
.order_list_item_img{
width: 126px;
height: 126px;
border-radius: 20px;
}
.order_list_item_con{
display: flex;
width: 100%;
flex:1;
border-bottom: 1px solid #f0f0f0;
height: 150px;
padding-top: 20px;
box-sizing: border-box;
}
.order_list_item_des{
flex:1;
box-sizing: border-box;
padding-left: 30px;
.order_list_item_title{
font-weight: 700;
font-size: $font_size;
margin-bottom: 15px;
}
.order_list_item_price{
font-size: 26px;
color: $color_font_three;
text{
&:nth-child(n+1) {
margin-right: 20px;
}
}
}
}
.order_list_item_count{
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-end;
.count_num{
color: $color_main;
font-size: $font_size;
margin-bottom: 15px;
font-weight: 400;
text{
font-size: $font_size_min;
}
}
.count_price {
font-size: $font_size;
font-weight: 700;
text{
font-size: $font_size_min;
}
}
}
}
}
.order_total{
padding-top: 20px;
display: flex;
justify-content: space-between;
text{
&:nth-child(1) {
font-size: 28px;
font-weight: 700;
}
&:nth-child(2) {
font-size: 24px;
font-weight: 700;
}
}
}
.order_estimated_amount{
display: flex;
align-items: flex-end;
flex-direction: column;
padding: 30px 0;
.order_price_des{
font-size: $font_size_medium;
color: $color_font_two;
}
}
}
@@ -0,0 +1,168 @@
import { AFTER_ORDER_STATUS, ORDER_STATUS } from "@/common/enum"
import { formatHashTag, formatPriceDiv, formatWeightDiv } from "@/common/fotmat"
import LabAndImg from "@/components/LabAndImg"
import { Text, View } from "@tarojs/components"
import { memo, useCallback, useMemo } from "react"
import EstimatedAmount from "../estimatedAmount"
import styles from './index.module.scss'
type OrderParam = {
estimate_amount: number, //预估金额
list: any[],
sale_mode: number,
sale_mode_name: string,
unit: string,
total_colors: number,
total_fabrics: number,
total_number: number,
stage: number, //订单状态
type: 1|2, //1退货, 2退款
total_sale_price: number, //销售金额
total_should_collect_money: number, //应收金额
total_weight_error_discount: number, //空差优惠
the_previous_status: number, //取消订单时的订单状态
actual_amount: number //实付金额
}
type Param = {
order: OrderParam,
comfirm?: boolean //是否是确认订单页面使用
}
export default memo(({order, comfirm = false}:Param) => {
//对应数量
const formatCount = useCallback((item) => {
return order?.sale_mode == 0? item.roll : Number(item.length / 100)
}, [order])
//对应单价
const standardPrice = useCallback(price => {
return formatPriceDiv(price).toLocaleString() + '/' + (order?.sale_mode == 1?'m':'kg')
}, [order])
//数量格式
const numText = useMemo(() => {
if(order)
return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${order?.total_number}${order?.unit}`
}, [order])
//售后单状态枚举
const {
ReturnStageApplying, // 申请中
ReturnStageWaitCheck, // 退货中
ReturnStageChecked, // 待验布
ReturnStageReturned, // 已退款
ReturnStageCancel, // 已取消
ReturnStageQualityCheckPendingRefund, // 已验布
ReturnStageServiceOrderPendingRefund, // 待退款
ReturnStageRejected, // 已拒绝
} = AFTER_ORDER_STATUS
//金额列表枚举
const priceList = [
{
id:1,
value:[
ReturnStageServiceOrderPendingRefund.value,
ReturnStageReturned.value
],
label:'应退金额',
field: 'total_should_collect_money'
},
{
id:2,
value:[ReturnStageReturned.value],
label:'退款金额',
field: 'total_should_collect_money'
},
{
id:3,
value:[ReturnStageReturned.value],
label:'退款去向',
field: 'actual_amount'
},
{
id:4,
value:[ReturnStageQualityCheckPendingRefund.value],
label:'合计金额',
field: 'actual_amount'
},
]
//是否显示价格
const showPrice = useCallback((priceInfo) => {
if(priceInfo.value == 8) {
//合计金额
}
return priceInfo.value.includes(order?.stage)
}, [order])
const priceConDom = useMemo(() => {
if(!order) return
return (
<>
{
priceList.map(item => {
return <>{showPrice(item)&&<EstimatedAmount key={item.id} number={formatPriceDiv(order[item.field])} title={item.label} />}</>
})
}
</>
)
}, [order])
//整理颜色
const labAndRgbAndUrl = useCallback((item) => {
return {lab:{...item?.lab}, rgb:{...item?.rgb}, texturl_url: item?.texturl_url}
}, [])
//单价显示判断
const sale_price_show = useMemo(() => {
return order?.stage != ReturnStageServiceOrderPendingRefund.value && order?.stage != ReturnStageQualityCheckPendingRefund.value
}, [order])
return (
<View className={styles.kindsList_main}>
<View className={styles.orders_list_con}>
<View className={styles.orders_return_title}>{order?.type == 1?'退货信息':'退款信息'}</View>
{
order?.list?.map(item => {
return <View key={item.product_code} className={styles.order_list}>
<View className={styles.order_list_title}>
<View className={styles.tag}>{order.sale_mode_name}</View>
<View className={styles.title}>{formatHashTag(item.code, item.name)}</View>
<View className={styles.num}>共{item?.product_colors?.length}种</View>
</View>
<View className={styles.order_list_scroll}>
{item?.product_colors?.map(colorItem => {
return <View key={colorItem.id} className={styles.order_list_item}>
<View className={styles.order_list_item_img}>
<LabAndImg value={labAndRgbAndUrl(colorItem)}/>
</View>
<View className={styles.order_list_item_con}>
<View className={styles.order_list_item_des}>
<View className={styles.order_list_item_title}>{colorItem.code + ' ' + colorItem.name}</View>
<View className={styles.order_list_item_price}>
{sale_price_show&&<Text>¥{standardPrice(colorItem.sale_price)}</Text>}
<Text>总重{formatWeightDiv(colorItem.estimate_weight)}kg</Text>
</View>
</View>
<View className={styles.order_list_item_count}>
<View className={styles.count_num}>×{formatCount(colorItem)}<text>{order.unit}</text></View>
<View className={styles.count_price}><text>¥</text>{formatPriceDiv(colorItem.estimate_amount).toLocaleString()}</View>
</View>
</View>
</View>
})}
</View>
</View>
})
}
<View className={styles.order_total}><Text>合计</Text><Text>{numText}</Text></View>
<View className={styles.order_estimated_amount}>
{priceConDom}
</View>
</View>
</View>
)
})