部分优化对接售后原因枚举

This commit is contained in:
2022-06-23 16:57:12 +08:00
parent 7c758f6896
commit 3b0f32c88a
13 changed files with 130 additions and 351 deletions
@@ -3,39 +3,22 @@ import { ScrollView, Text, View } from "@tarojs/components";
import { memo, useMemo } from "react";
import styles from './index.module.scss'
type ReasonParam = 1|2|3 //1 退货原因 2 货物状况 3 退货说明
//原因选择
type ReasonInfoParam = {
show?: boolean,
onClose?: () => void,
status: ReasonParam
title?: string,
list?: {id:number, name:string}[]
}
export default memo(({show = false, onClose, status}: ReasonInfoParam) => {
const title = useMemo(() => {
if(status == 1) return '退货原因'
if(status == 2) return '货物状况'
if(status == 3) return '退货说明'
},[status])
export default memo(({show = false, onClose, title = '', list= []}: ReasonInfoParam) => {
return (
<Popup showIconButton={false} show={show} title="申请退货" onClose={onClose} >
<Popup showIconButton={false} show={show} title={title} onClose={onClose} >
<View className={styles.reason_return_con}>
<View className={styles.reason_title}><Text>{title}</Text></View>
<ScrollView scrollY className={styles.reason_scroll}>
<View className={styles.reason_list}>
<View className={styles.reason_item}>完好无损带原标签</View>
<View className={styles.reason_item}>完好无损带原标签</View>
<View className={styles.reason_item}>完好无损带原标签</View>
<View className={styles.reason_item}>完好无损带原标签</View>
<View className={styles.reason_item}>完好无损带原标签</View>
<View className={styles.reason_item}>完好无损带原标签</View>
<View className={styles.reason_item}>完好无损带原标签</View>
<View className={styles.reason_item}>完好无损带原标签</View>
<View className={styles.reason_item}>完好无损带原标签</View>
<View className={styles.reason_item}>完好无损带原标签</View>
<View className={styles.reason_item}>完好无损带原标签</View>
<View className={styles.reason_item}>完好无损带原标签</View>
<View className={styles.reason_item}>完好无损带原标签</View>
<View className={styles.reason_item}>完好无损带原标签</View>
{list.map(item => <View key={item.id} className={styles.reason_item}>{item.name}</View> )}
</View>
</ScrollView>
</View>
+18 -5
View File
@@ -7,7 +7,7 @@ import OtherReason from "./components/otherReason";
import { useDidShow, useRouter } from "@tarojs/taro";
import { GetSaleOrderDetailApi } from "@/api/order";
import KindList from "./components/kindList"
import { ReturnApplyOrderApi } from "@/api/salesAfterOrder";
import { ReturnApplyOrderApi, ReturnGoodsStatusApi } from "@/api/salesAfterOrder";
import { alert, goLink } from "@/common/common";
import UploadImage from "@/components/uploadImage"
import TextareaEnhance from "@/components/textareaEnhance";
@@ -76,9 +76,11 @@ export default () => {
//退货选择弹窗
const [showReason, setShowReason] = useState<{show:true|false, status:ReasonParam}>({show:false, status:1})
const [showReason, setShowReason] = useState<{show:true|false, title: string}>({show:false, title: ''})
const closeReason = useCallback(() => setShowReason({...showReason, show:false}), [])
const onShowReason = (status) => setShowReason({...showReason, status, show:true})
const onShowReason = (status) => {
setShowReason({...showReason, show:true})
}
//面料数据
let roll_list = useRef({})
@@ -143,7 +145,18 @@ export default () => {
onSubmitData()
}
}
const [returnGoodsInfo, setReturnGoodsInfo] = useState<{title:string, list: any[]}>({title:'', list:[]})
//售后货物状况
const {fetchData: fetchDataGoodsStatus} = ReturnGoodsStatusApi()
const getReturnGoodsStatus = async () => {
let res = await fetchDataGoodsStatus()
setReturnGoodsInfo((e) => ({...e, title: '售后货物状况', list:res.data?.list||[]}))
}
useEffect(() => {
getReturnGoodsStatus()
}, [])
return (
<View className={styles.apply_after_sales_main}>
<View className={styles.apply_after_sales_con}>
@@ -192,7 +205,7 @@ export default () => {
<View className={styles.verify_btn } onClick={() => onSubmit(2)}>确认</View>
</View >
</View >
<ReasonPopup show={showReason.show} onClose={closeReason} status={showReason.status}/>
<ReasonPopup show={showReason.show} onClose={closeReason} title={returnGoodsInfo.title} list={returnGoodsInfo.list}/>
</View>
)
}
@@ -72,6 +72,9 @@
padding-bottom:151px;
}
.color_con{
.virtual_list{
padding-bottom: 300px;
}
.item {
display: flex;
justify-content: space-between;
@@ -50,20 +50,14 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param)
//获取面料颜色列表
const {fetchData:colorFetchData, state: colorState} = GetColorList()
const [list, setList] = useState<any[]>([])
const [loading, setLoading] = useState(false)
const condition = useRef({physical_warehouse:adminUserInfo?.physical_warehouse, sale_mode:selectIndex, product_id:0, code_or_name:null})
const getColorList = async () => {
setLoading(() => true)
let {data} = await colorFetchData(getFilterData(condition.current))
let lists = initList(data.list)
setList(() => [...lists])
setLoading(() => false)
}
const [showPopup, setShowPopup] = useState(false)
useEffect(() => {
console.log('colorState::',colorState)
}, [colorState])
//显示获取
useEffect(() => {
@@ -206,32 +200,35 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param)
const Rows = memo(({id, index, style, data}:any) => {
let item = data[index]
return (
<View className={styles.item} key={item.id}>
<View className={styles.item_color}>
<LabAndImg value={{lab:item.lab,rgb:item.rgb,texture_url:item.texture_url}}/>
</View>
<View className={styles.item_con}>
<View className={styles.title}>{formatHashTag(item.code, item.name)}</View>
<View className={styles.num}>
{formatPrice(item)}
<>
{item&&<View className={styles.item} key={item.id}>
<View className={styles.item_color}>
<LabAndImg value={{lab:item.lab,rgb:item.rgb,texture_url:item.texture_url}}/>
</View>
</View>
<View className={styles.btn_con}>
{!item.show&&<View className={styles.btn} onClick={() => onAdd(item)}>添加</View>
||<View className={styles.btn_count}>
<Counter
onBlue={(e) => getInputValue(e, item)}
defaultNum={item.count}
step={selectList[selectIndex].step}
digits={selectList[selectIndex].digits}
onClickBtn={(e) => getInputValue(e, item)}
unit={selectList[selectIndex].unit}
minNum={selectList[selectIndex].minNum}
maxNum={selectList[selectIndex].maxNum}
/>
</View>}
</View>
</View>
<View className={styles.item_con}>
<View className={styles.title}>{formatHashTag(item.code, item.name)}</View>
<View className={styles.num}>
{formatPrice(item)}
</View>
</View>
<View className={styles.btn_con}>
{!item.show&&<View className={styles.btn} onClick={() => onAdd(item)}>添加</View>
||<View className={styles.btn_count}>
<Counter
onBlue={(e) => getInputValue(e, item)}
defaultNum={item.count}
step={selectList[selectIndex].step}
digits={selectList[selectIndex].digits}
onClickBtn={(e) => getInputValue(e, item)}
unit={selectList[selectIndex].unit}
minNum={selectList[selectIndex].minNum}
maxNum={selectList[selectIndex].maxNum}
/>
</View>}
</View>
</View>||<View className={styles.item}></View>
}
</>
)
})
@@ -296,10 +293,11 @@ export default memo(({show = false, onClose, title = '', productId = 0}: param)
// </InfiniteScroll>}
<View className={styles.color_con}>
<VirtualList
className={styles.virtual_list}
height={400} /* 列表的高度 */
width='100%' /* 列表的宽度 */
itemData={list} /* 渲染列表的数据 */
itemCount={list.length} /* 渲染列表的长度 */
itemCount={list.length + 1} /* 渲染列表的长度 */
itemSize={100} /* 列表单项的高度 */
overscanCount={1}
>
+6 -1
View File
@@ -2,7 +2,7 @@ import { SaleOrderPreViewApi, SaleOrderApi } from "@/api/order";
import { formatPriceDiv } from "@/common/fotmat";
import Popup from "@/components/popup";
import { View } from "@tarojs/components"
import Taro, { useDidShow} from "@tarojs/taro";
import Taro, { useDidShow, usePullDownRefresh} from "@tarojs/taro";
import classnames from "classnames";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import AddressInfo from "./components/addressInfo";
@@ -160,6 +160,11 @@ import AddressInfoDetail from "./components/addressInfoDetail";
}
})
}
//页面下拉刷新
usePullDownRefresh(() => {
getSaleOrderPreView()
})
return (
<View className={styles.order_main}>
<AddressInfoDetail orderInfo={defaultAddress} onSelect={getAddress} onChangeShipmentMode={selectShipmentMode} status={1}/>
@@ -35,9 +35,9 @@ $top:190px;
border-radius: 10px;
padding-bottom: 100px;
position: relative;
background: radial-gradient(circle 20px at left $top, transparent 20px, #fff 20px + 3px) left 0px/60% no-repeat ,
radial-gradient(circle 20px at right $top, transparent 20px, #fff 20px + 3px) right 0px/60% no-repeat;
filter: drop-shadow(2px 2px 6px rgba(0, 0, 0, .16));
// background: radial-gradient(circle 20px at left $top, transparent 20px, #fff 20px + 3px) left 0px/60% no-repeat ,
// radial-gradient(circle 20px at right $top, transparent 20px, #fff 20px + 3px) right 0px/60% no-repeat;
// filter: drop-shadow(2px 2px 6px rgba(0, 0, 0, .16));
position: relative;
&::before{
content: '';
+5 -1
View File
@@ -142,6 +142,10 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
)
}, [payInfo])
//选择改变
const changeSelect = () => {
}
return (
<View className={styles.payment_main}>
<Popup show={show} showTitle={false} onClose={onClose} >
@@ -167,7 +171,7 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param)
</View>
</View>
<View className={styles.payment_list_con}>
<View className={styles.payment_list_item}>
<View className={styles.payment_list_item} onClick={changeSelect}>
<View className={styles.payment_list_item_left}>
<View className={styles.payment_list_item_left_name}>
<View className={classnames('iconfont icon-a-tuikuanshouhou', styles.miconfont)}></View>
+38
View File
@@ -12,6 +12,8 @@ import { dataLoadingStatus, getFilterData } from "@/common/util"
import OrderStatusList from "./components/orderStatusList"
import Payment from "../order/components/payment"
import { ORDER_STATUS } from "@/common/enum"
import { AddShoppingCartApi } from "@/api/shopCart"
import ShopCart from "@/components/shopCart"
export default () => {
const {checkLogin} = useLogin()
@@ -108,6 +110,9 @@ export default () => {
payment_method: orderInfo.payment_method //支付方式
})
toPay()
} else if (status == 7) {
//购买
addShopCart(orderInfo)
}
}, [orderData])
@@ -128,6 +133,38 @@ export default () => {
closePayShow()
}, [])
//添加购物车
const [showCart, setShowCart] = useState(false)
const {fetchData:addFetchData} = AddShoppingCartApi()
const addShopCart = async (item) => {
let color_list:{product_color_id: number, roll?: number, length?: number}[] = []
item?.product_list.map(pitem => {
pitem?.product_colors.map(citem => {
if(item?.sale_mode == 0) {
return color_list.push({product_color_id: citem.id, roll: citem.roll})
} else {
return color_list.push({product_color_id: citem.id, length: citem.length})
}
})
})
const state = await addFetchData({
sale_mode: item?.sale_mode,
color_list
})
if(state.success) {
Taro.showToast({
title:'已加入购物车'
})
setShowCart(true)
} else {
Taro.showToast({
icon:'none',
title: state.msg
})
}
}
return (
<View className={styles.order_list_main}>
@@ -142,6 +179,7 @@ export default () => {
})}
</InfiniteScroll>
</View>
<ShopCart show={showCart} onClose={() => setShowCart(false)}/>
<Payment onSubmitSuccess={onPaySuccess} show={payMentShow} onClose={closePayShow} orderInfo={payOrderInfo}/>
</View>
)