对接售后退款申请

This commit is contained in:
2022-06-24 19:54:01 +08:00
parent 9503d35dbb
commit 3d349d405a
14 changed files with 134 additions and 66 deletions
-1
View File
@@ -67,7 +67,6 @@ export default () => {
unit: orderDetail.sale_mode == 0?'条':'m', //单位
list: orderDetail.product_list,
status: orderDetail.status, //订单状态
})
}
+2 -2
View File
@@ -192,9 +192,9 @@ export default (props:Params) => {
{
(!userInfo.adminUserInfo?.is_authorize_phone)&&<View className={styles.buy_btn} >
<Button className={styles.phoneBtn} open-type="getPhoneNumber" onGetPhoneNumber={(e) => placeOrder('to_phone',e)}></Button>
开始下单
选购商品
</View>
|| <View className={styles.buy_btn} onClick={() => placeOrder('to_order')}>开始下单</View>
|| <View className={styles.buy_btn} onClick={() => placeOrder('to_order')}>选购商品</View>
}
</View>
<CustomWrapper>
@@ -1,43 +1,76 @@
import Popup from "@/components/popup";
import TextareaEnhance from "@/components/textareaEnhance";
import { ScrollView, Text, View } from "@tarojs/components";
import { memo, useCallback, useState } from "react";
import { memo, useCallback, useEffect, useRef, useState } from "react";
import ReasonPopup from "../reasonPopup";
import styles from './index.module.scss'
import classnames from "classnames";
import { ApplyRefundApi } from "@/api/salesAfterOrder";
import { alert } from "@/common/common";
type Param = {
show?: true|false,
onClose?: () => void
onClose?: () => void,
orderId?: number
}
export default memo(({show, onClose}:Param) => {
export default memo(({show, onClose, orderId}:Param) => {
const getOtherReason = useCallback(() => {
//提交的数据
const submitData = useRef({
return_explain: 1,
sale_order_id: 0,
reason_describe: ''
})
}, [])
const onSubmit = (val) => {
useEffect(() => {
if(orderId)
submitData.current.sale_order_id = orderId
}, [orderId])
//申请退款
const {fetchData} = ApplyRefundApi()
const getApplyRefund = async () => {
let res = await fetchData(submitData.current)
if(!submitData.current.return_explain) return alert.error('请选择说明原因')
if(res.success) {
alert.error('申请成功')
} else {
alert.error('申请失败')
}
onClose?.()
}
//获取说明数据
const [list, setList] = useState<any[]>([])
//备注
const getOtherReason = useCallback((val) => {
submitData.current.reason_describe = val
}, [])
//显示说明
const [showReason, setShowReason] = useState(false)
const closeReason = useCallback(() => {
setShowReason(false)
}, [])
const onShowReason = () => {
setShowReason(true)
//提交
const onSubmit = () => {
getApplyRefund()
}
return (
<>
<Popup show={show} title="申请退款" onClose={onClose} >
<View className={styles.apply_after_sales_con}>
<View className={styles.returnSaleInput_item}>
<View className={styles.title}>退款说明</View>
<View className={styles.select} onClick={() => onShowReason()}>
<View className={styles.select} onClick={() => setShowReason(true)}>
<Text>请选择</Text>
<Text className={classnames(styles.miconfont, 'iconfont icon-a-moreback')}></Text>
</View>
@@ -51,7 +84,7 @@ export default memo(({show, onClose}:Param) => {
</View>
</View>
</Popup>
<ReasonPopup show={showReason} onClose={closeReason} />
<ReasonPopup show={showReason} onClose={closeReason} list={list} title="退款说明"/>
</>
)
})
@@ -22,6 +22,9 @@
.reason_item{
margin-bottom: 36px;
}
.select_item {
color: #007AFF;
}
}
}
}
@@ -1,34 +1,27 @@
import Popup from "@/components/popup";
import { ScrollView, Text, View } from "@tarojs/components";
import { memo, useMemo } from "react";
import classnames from "classnames";
import styles from './index.module.scss'
//原因选择
type ReasonInfoParam = {
show?: boolean,
onClose?: () => void,
show?: boolean, //显示
onClose?: () => void, //关闭
title?: string, //标题
list?: {id:number, name:string, typle?:number}[], //数据列表
onSelect?: (val: object) => void, //选择
defaultValue?: number, //默认选中
}
export default memo(({show = false, onClose}: ReasonInfoParam) => {
export default memo(({show = false, onClose, title = '', list= [], onSelect, defaultValue}: 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>退款说明</Text></View>
<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 onClick={() => onSelect?.(item)} key={item.id} className={classnames(styles.reason_item, item.id == defaultValue&&styles.select_item)}>{item.name}</View> )}
</View>
</ScrollView>
</View>
+3 -3
View File
@@ -19,13 +19,13 @@ export default ({onBlur, onSave, defaultValue = ''}:Param) => {
getDesc(defaultValue)
}, [defaultValue])
const getDesc = useCallback((value) => {
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)
@@ -34,7 +34,7 @@ export default ({onBlur, onSave, defaultValue = ''}:Param) => {
<View className={styles.order_popup}>
<View className={styles.order_popup_title}>编辑备注</View>
<View className={styles.order_popup_input}>
<Textarea placeholder="请添加备注" maxlength={descData.count} cursorSpacing={100} onInput={(e) => getDesc(e.detail.value)} onBlur={(e) => onBlur?.(e)}></Textarea>
<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>
+1 -1
View File
@@ -282,7 +282,7 @@ import styles from './index.module.scss'
<Remark onSave={(e) => getRemark(e)} defaultValue={orderDetail?.remark}/>
</Popup>
<Payment onSubmitSuccess={onPaySuccess} show={payMentShow} onClose={closePayShow} orderInfo={orderDetail} />
<ApplyRefund show={refundShow} onClose={applyRefundClose}/>
<ApplyRefund show={refundShow} onClose={applyRefundClose} orderId={orderDetail?.id}/>
<ShopCart show={showCart} onClose={() => setShowCart(false)}/>
<View className="common_safe_area_y"></View>
</View>
@@ -85,8 +85,8 @@ export default memo(({value, onClickBtn}: Param) => {
</View>
<View className={styles.product_list}>
<View className={styles.image}>
<LabAndImg value={{lab:value.lab,rgb:value.rgb,texture_url:value.texture_url}}/>
<View className={styles.color_num}>{value?.product_list[0].product_colors[0].code}</View>
<LabAndImg value={{lab:value.lab,rgb:value.rgb,texture_url:value.texture_url}}/>
<View className={styles.color_num}>{value?.product_list[0].product_colors[0].code}</View>
</View>
<View className={styles.color_list}>
{value?.product_list[0].product_colors.map((itemColor, index) => {
+10 -6
View File
@@ -5,7 +5,7 @@ import {
import { GetOrderPayApi } from "@/api/orderPay";
import { SaleOrderOrderDetailApi } from "@/api/salesAfterOrder";
import { alert, goLink } from "@/common/common";
import { ORDER_STATUS } from "@/common/enum";
import { AFTER_ORDER_STATUS, ORDER_STATUS } from "@/common/enum";
import { formatDateTime, formatImgUrl, formatPriceDiv } from "@/common/fotmat";
import AfterOrderBtns from "@/components/afterOrderBtns";
import OrderBtns from "@/components/orderBtns";
@@ -95,8 +95,10 @@ import styles from './index.module.scss'
}
}, [orderDetail])
//订单状态枚举
const {SaleOrderStatusCancel} = ORDER_STATUS
//售后订单状态枚举
const {
} = AFTER_ORDER_STATUS
//物流显示
const [logisticsShow, setLogisticsShow] = useState(false)
@@ -122,15 +124,17 @@ import styles from './index.module.scss'
//显示生气记录
const [applyRecord, setApplyRecord] = useState(false)
//货
return (
<View className={styles.order_main}>
<OrderState orderInfo={orderDetail}/>
<AddressInfoDetail return_address={orderDetail?.return_address} return_phone={orderDetail?.return_phone} stage={orderDetail?.stage} onLogistics={onShowLogistics}/>
<KindList order={formatPreViewOrderMemo}/>
<OrderDes orderInfo={orderDetail}/>
{(orderDetail?.status != SaleOrderStatusCancel.value)&&<View className={styles.submit_order}>
<AfterOrderBtns orderInfo={orderInfo} onClick={orderStateClick}/>
</View>}
<View className={styles.submit_order}>
<AfterOrderBtns orderInfo={orderInfo} onClick={orderStateClick} />
</View>
<AfterSalePricture urls={orderDetail?.fabric_piece_accessory_url}/>
<ReturnLogistics show={logisticsShow} id={orderDetail?.return_apply_order_id} onClose={onCloseLogistics} onSubmit={logisticsSuccess}/>
<ApplyRecord show={applyRecord} id={orderDetail?.id} onClose={() => setApplyRecord(false)}/>
@@ -109,7 +109,7 @@ export default memo(({value, onClickBtn}: Param) => {
<Text>订单号:{value?.order_no}</Text>
</View>
</View>
<AfterOrderBtns orderInfo={orderInfo} onClick={orderBtnsClick}/>
<AfterOrderBtns orderInfo={orderInfo} onClick={orderBtnsClick} />
</View>
)
})
-1
View File
@@ -107,7 +107,6 @@ export default () => {
const [logisticsShow, setLogisticsShow] = useState(false)
const onCloseLogistics = useCallback(() => setLogisticsShow(false), [])
return (
<View className={styles.order_list_main}>
<View className={styles.title}>