🌈 style(eslint): add eslint rules
This commit is contained in:
@@ -1,48 +1,49 @@
|
||||
import { Image, Text, View } from "@tarojs/components";
|
||||
import { memo, useEffect, useMemo, useRef, useState } from "react";
|
||||
import classnames from "classnames";
|
||||
import { Image, Text, View } from '@tarojs/components'
|
||||
import { memo, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import classnames from 'classnames'
|
||||
import styles from './index.module.scss'
|
||||
import IconFont from '@/components/iconfont/iconfont'
|
||||
|
||||
interface propsObj {
|
||||
receivingStatus?: Number | null,
|
||||
onReceivingStatus?: (any, Number) => void,
|
||||
obj: any,
|
||||
handUp?: (any) => void
|
||||
receivingStatus?: Number | null
|
||||
onReceivingStatus?: (any, Number) => void
|
||||
obj: any
|
||||
handUp?: (any) => void
|
||||
}
|
||||
export default memo((props: propsObj) => {
|
||||
const {
|
||||
obj = {},
|
||||
handUp,
|
||||
} = props
|
||||
|
||||
const {
|
||||
obj = {},
|
||||
handUp
|
||||
} = props
|
||||
const seeFont = useMemo(() => {
|
||||
if (obj.stage == 1) {
|
||||
return '上传物流回单'
|
||||
}
|
||||
else {
|
||||
return '查看物流回单'
|
||||
}
|
||||
}, [obj])
|
||||
|
||||
const seeFont = useMemo(() => {
|
||||
if (obj.stage == 1) {
|
||||
return '上传物流回单'
|
||||
} else {
|
||||
return '查看物流回单'
|
||||
return (
|
||||
<View className={styles.addressBox}>
|
||||
<View className={styles.topFont}>请按以下退货地址寄回货物并提供退货物流信息</View>
|
||||
<View className={styles.topBox}>
|
||||
<View className={styles.cirle}>
|
||||
<IconFont name="icon-dingwei" size={26} color="#ffffff"></IconFont>
|
||||
</View>
|
||||
<View className={styles.address}>广东省佛山市禅城区陆盈纺织仓库</View>
|
||||
</View>
|
||||
<View className={styles.line}></View>
|
||||
<View className={styles.bottom}>
|
||||
<View className={styles.leftBottom}>
|
||||
<View className={styles.name}>谭先生</View>
|
||||
<View className={styles.phone}>{13242128982}</View>
|
||||
</View>
|
||||
{
|
||||
obj.stage != 0 && <View className={styles.btn} onClick={() => handUp?.(obj)}>{seeFont}</View>
|
||||
}
|
||||
}, [obj])
|
||||
|
||||
return (
|
||||
<View className={styles.addressBox}>
|
||||
<View className={styles.topFont}>请按以下退货地址寄回货物并提供退货物流信息</View>
|
||||
<View className={styles.topBox}>
|
||||
<View className={styles.cirle}>
|
||||
<IconFont name={'icon-dingwei'} size={26} color={'#ffffff'}></IconFont>
|
||||
</View>
|
||||
<View className={styles.address}>{'广东省佛山市禅城区陆盈纺织仓库'}</View>
|
||||
</View>
|
||||
<View className={styles.line}></View>
|
||||
<View className={styles.bottom}>
|
||||
<View className={styles.leftBottom}>
|
||||
<View className={styles.name}>{'谭先生'}</View>
|
||||
<View className={styles.phone}>{13242128982}</View>
|
||||
</View>
|
||||
{
|
||||
obj.stage != 0 && <View className={styles.btn} onClick={() => handUp?.(obj)}>{seeFont}</View>
|
||||
}
|
||||
</View>
|
||||
</View >
|
||||
)
|
||||
})
|
||||
</View>
|
||||
</View >
|
||||
)
|
||||
})
|
||||
|
||||
@@ -1,70 +1,68 @@
|
||||
import { Image, Text, View } from "@tarojs/components"
|
||||
import { memo, useEffect, useMemo, useRef, useState } from "react"
|
||||
import styles from './index.module.scss'
|
||||
import classnames from "classnames";
|
||||
import { formatDateTime, formatImgUrl } from "@/common/format";
|
||||
import { ORDER_STATUS, PAYMENT_METHOD } from "@/common/enum";
|
||||
import { Image, Text, View } from '@tarojs/components'
|
||||
import { memo, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import classnames from 'classnames'
|
||||
import * as dayjs from 'dayjs'
|
||||
import styles from './index.module.scss'
|
||||
import { formatDateTime, formatImgUrl } from '@/common/format'
|
||||
import { ORDER_STATUS, PAYMENT_METHOD } from '@/common/enum'
|
||||
|
||||
type List = {
|
||||
status: string,
|
||||
time: string,
|
||||
tag: string,
|
||||
desc: string,
|
||||
expire_time: string
|
||||
interface List {
|
||||
status: string
|
||||
time: string
|
||||
tag: string
|
||||
desc: string
|
||||
expire_time: string
|
||||
}
|
||||
|
||||
type Param = {
|
||||
onRefresh?: () => void,
|
||||
orderInfo?: {
|
||||
logistics_details: List[], //订单状态列表
|
||||
payment_method: number, //支付方式
|
||||
status: number, //订单状态
|
||||
account_period?: number, //账期
|
||||
account_period_time?: string //还款日期
|
||||
}
|
||||
interface Param {
|
||||
onRefresh?: () => void
|
||||
orderInfo?: {
|
||||
logistics_details: List[] // 订单状态列表
|
||||
payment_method: number // 支付方式
|
||||
status: number // 订单状态
|
||||
account_period?: number // 账期
|
||||
account_period_time?: string // 还款日期
|
||||
}
|
||||
}
|
||||
|
||||
export default memo(({ orderInfo = { logistics_details: [], payment_method: 0, status: 0 }, onRefresh }: Param) => {
|
||||
useEffect(() => {
|
||||
console.log('orderInfo33::', orderInfo)
|
||||
}, [orderInfo])
|
||||
useEffect(() => {
|
||||
console.log('orderInfo33::', orderInfo)
|
||||
}, [orderInfo])
|
||||
|
||||
const [showMore, setShowMore] = useState(false)
|
||||
const changeMore = () => {
|
||||
setShowMore(() => !showMore)
|
||||
const [showMore, setShowMore] = useState(false)
|
||||
const changeMore = () => {
|
||||
setShowMore(() => !showMore)
|
||||
}
|
||||
const dataList = useMemo(() => {
|
||||
const arr = orderInfo?.logistics_details
|
||||
if (orderInfo.logistics_details) {
|
||||
return arr.reverse()
|
||||
}
|
||||
const dataList = useMemo(() => {
|
||||
let arr = orderInfo?.logistics_details
|
||||
if (orderInfo.logistics_details) {
|
||||
return arr.reverse()
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
}, [orderInfo.logistics_details])
|
||||
else {
|
||||
return []
|
||||
}
|
||||
}, [orderInfo.logistics_details])
|
||||
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
{(dataList?.length > 0) && <View className={styles.order_flow_state}>
|
||||
<View className={classnames(styles.order_status_list, showMore && styles.order_status_list_show)}>
|
||||
{dataList.map((item, index) => <View className={styles.order_status_item}>
|
||||
{(dataList.length > 1) && <View className={classnames(styles.order_status_tail, (index == 0) && styles.order_status_tail_end)}></View>}
|
||||
{(dataList.length != (index + 1)) && <View className={styles.order_status_line}></View>}
|
||||
<View className={styles.order_status_content}>
|
||||
<View className={classnames(styles.order_status_title, (index == 0) && styles.order_status_select)}>{item.status}</View>
|
||||
<View className={classnames(styles.order_status_time, (index == 0) && styles.order_status_select)}>{formatDateTime(item.time)}</View>
|
||||
</View>
|
||||
<Text className={classnames(styles.order_status_des, (index == 0) && styles.order_status_des_select)}>{item.desc}</Text>
|
||||
</View>)}
|
||||
</View>
|
||||
{(dataList.length > 2) && <View className={styles.more} onClick={() => changeMore()}>
|
||||
<Text>{showMore && '收起详情' || '点击查看详情'}</Text>
|
||||
<Text className={classnames('iconfont icon-a-moreback', styles.miconfonts, showMore && styles.open_miconfonts)}></Text>
|
||||
</View>}
|
||||
</View>}
|
||||
</>
|
||||
)
|
||||
return (
|
||||
<>
|
||||
{(dataList?.length > 0) && <View className={styles.order_flow_state}>
|
||||
<View className={classnames(styles.order_status_list, showMore && styles.order_status_list_show)}>
|
||||
{dataList.map((item, index) => <View className={styles.order_status_item}>
|
||||
{(dataList.length > 1) && <View className={classnames(styles.order_status_tail, (index == 0) && styles.order_status_tail_end)}></View>}
|
||||
{(dataList.length != (index + 1)) && <View className={styles.order_status_line}></View>}
|
||||
<View className={styles.order_status_content}>
|
||||
<View className={classnames(styles.order_status_title, (index == 0) && styles.order_status_select)}>{item.status}</View>
|
||||
<View className={classnames(styles.order_status_time, (index == 0) && styles.order_status_select)}>{formatDateTime(item.time)}</View>
|
||||
</View>
|
||||
<Text className={classnames(styles.order_status_des, (index == 0) && styles.order_status_des_select)}>{item.desc}</Text>
|
||||
</View>)}
|
||||
</View>
|
||||
{(dataList.length > 2) && <View className={styles.more} onClick={() => changeMore()}>
|
||||
<Text>{showMore && '收起详情' || '点击查看详情'}</Text>
|
||||
<Text className={classnames('iconfont icon-a-moreback', styles.miconfonts, showMore && styles.open_miconfonts)}></Text>
|
||||
</View>}
|
||||
</View>}
|
||||
</>
|
||||
)
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export default {
|
||||
navigationBarTitleText: '售后详情',
|
||||
enablePullDownRefresh: true,
|
||||
"backgroundTextStyle": "dark"
|
||||
navigationBarTitleText: '售后详情',
|
||||
enablePullDownRefresh: true,
|
||||
backgroundTextStyle: 'dark',
|
||||
}
|
||||
|
||||
+400
-402
@@ -1,439 +1,437 @@
|
||||
import { View, Input, Button, Image } from '@tarojs/components'
|
||||
import { useCallback, useEffect, useMemo, useRef, useState, ReactNode, memo } from 'react'
|
||||
import styles from "./index.module.scss"
|
||||
import classnames from "classnames";
|
||||
import Taro, { faceVerifyForPay, useDidShow, useRouter, usePullDownRefresh } from '@tarojs/taro'
|
||||
import { Button, Image, Input, View } from '@tarojs/components'
|
||||
import Taro, { faceVerifyForPay, useDidShow, usePullDownRefresh, useRouter } from '@tarojs/taro'
|
||||
import type { ReactNode } from 'react'
|
||||
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import classnames from 'classnames'
|
||||
import styles from './index.module.scss'
|
||||
import ItemList from './components/itemList'
|
||||
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||
import {
|
||||
mpreturnApplyOrder,
|
||||
returnApplyOrdercancel,
|
||||
returnApplyOrderuploadAccessory
|
||||
} from "@/api/refound"
|
||||
import OrderState from './components/orderState'
|
||||
import AddressDetailBox from './components/addressDetailBox'
|
||||
import { IMG_CND_Prefix } from "@/common/constant";
|
||||
import Popup from '@/components/popup';
|
||||
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
|
||||
import {
|
||||
mpreturnApplyOrder,
|
||||
returnApplyOrdercancel,
|
||||
returnApplyOrderuploadAccessory,
|
||||
} from '@/api/refound'
|
||||
import { IMG_CND_Prefix } from '@/common/constant'
|
||||
import Popup from '@/components/popup'
|
||||
import UploadImage from '@/components/uploadImage'
|
||||
import { alert } from '@/common/common';
|
||||
import RefundCodelist from "@/components/RefundCodelist"
|
||||
import LabAndImg from "@/components/LabAndImg"
|
||||
import { alert } from '@/common/common'
|
||||
import RefundCodelist from '@/components/RefundCodelist'
|
||||
import LabAndImg from '@/components/LabAndImg'
|
||||
|
||||
export default () => {
|
||||
//页面下拉刷新
|
||||
usePullDownRefresh(() => {
|
||||
getDetail()
|
||||
// 页面下拉刷新
|
||||
usePullDownRefresh(() => {
|
||||
getDetail()
|
||||
})
|
||||
const router = useRouter()
|
||||
useEffect(() => {
|
||||
getDetail()
|
||||
}, [])
|
||||
// 获取详情
|
||||
const { fetchData: detailFetch } = mpreturnApplyOrder()
|
||||
const [DeatailObj, setDeatailObj] = useState<any>({})
|
||||
const getDetail = async() => {
|
||||
Taro.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true,
|
||||
})
|
||||
const router = useRouter()
|
||||
useEffect(() => {
|
||||
getDetail()
|
||||
}, [])
|
||||
//获取详情
|
||||
const { fetchData: detailFetch } = mpreturnApplyOrder()
|
||||
const [DeatailObj, setDeatailObj] = useState<any>({})
|
||||
const getDetail = async () => {
|
||||
Taro.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true
|
||||
const res = await detailFetch({ id: Number(router.params.id) })
|
||||
if (res.data) {
|
||||
setDeatailObj(res.data)
|
||||
orderMsg.map((it) => {
|
||||
if (it.leftTitle === '售后编号:') {
|
||||
it.rightTitle = res.data.return_order_no
|
||||
}
|
||||
if (it.leftTitle === '订单号:') {
|
||||
it.rightTitle = res.data.order_no
|
||||
}
|
||||
if (it.leftTitle === '退货原因:') {
|
||||
it.rightTitle = res.data.return_reason_name
|
||||
}
|
||||
if (it.leftTitle === '退货说明:') {
|
||||
it.rightTitle = res.data.return_explain_name
|
||||
}
|
||||
if (it.leftTitle === '其他说明:') {
|
||||
it.rightTitle = res.data.reason_describe
|
||||
}
|
||||
if (it.leftTitle === '货物状况:') {
|
||||
it.rightTitle = res.data.goods_status_name
|
||||
}
|
||||
if (it.leftTitle === '申请时间:') {
|
||||
it.rightTitle = formatDateTime(res.data.apply_time)
|
||||
}
|
||||
})
|
||||
setOrderMsg([...orderMsg])
|
||||
setPicList([...res.data?.accessory_url !== null ? res.data?.accessory_url : []])
|
||||
Taro.hideLoading()
|
||||
// 小程序提供的api,通知页面停止下拉刷新效果
|
||||
Taro.stopPullDownRefresh()
|
||||
}
|
||||
}
|
||||
|
||||
// 分辨用质检中还是质检前的数组
|
||||
const productList = useMemo(() => {
|
||||
if (DeatailObj.stage === 0
|
||||
|| (DeatailObj.sale_mode == 1 && DeatailObj.type == 1) || DeatailObj.stage === 1 || DeatailObj.stage === 2) {
|
||||
return DeatailObj.product_list
|
||||
}
|
||||
else {
|
||||
return DeatailObj.quality_check_pass_product
|
||||
}
|
||||
}, [DeatailObj])
|
||||
|
||||
// 订单信息文字数组
|
||||
const [orderMsg, setOrderMsg] = useState<any[]>([
|
||||
{
|
||||
leftTitle: '售后编号:',
|
||||
rightTitle: '------',
|
||||
showBtn: true,
|
||||
},
|
||||
{
|
||||
leftTitle: '订单号:',
|
||||
rightTitle: '------',
|
||||
showBtn: true,
|
||||
},
|
||||
{
|
||||
leftTitle: '退货原因:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
{
|
||||
leftTitle: '退货说明:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
{
|
||||
leftTitle: '其他说明:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
{
|
||||
leftTitle: '货物状况:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
{
|
||||
leftTitle: '申请时间:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
])
|
||||
|
||||
// 复制功能
|
||||
const clipboardData = (val) => {
|
||||
Taro.setClipboardData({
|
||||
data: val || '',
|
||||
success(res) {
|
||||
Taro.showToast({
|
||||
icon: 'none',
|
||||
title: '复制成功',
|
||||
})
|
||||
const res = await detailFetch({ id: Number(router.params.id) })
|
||||
if (res.data) {
|
||||
setDeatailObj(res.data)
|
||||
orderMsg.map(it => {
|
||||
if (it.leftTitle === '售后编号:') {
|
||||
it.rightTitle = res.data.return_order_no
|
||||
}
|
||||
if (it.leftTitle === '订单号:') {
|
||||
it.rightTitle = res.data.order_no
|
||||
}
|
||||
if (it.leftTitle === '退货原因:') {
|
||||
it.rightTitle = res.data.return_reason_name
|
||||
}
|
||||
if (it.leftTitle === '退货说明:') {
|
||||
it.rightTitle = res.data.return_explain_name
|
||||
}
|
||||
if (it.leftTitle === '其他说明:') {
|
||||
it.rightTitle = res.data.reason_describe
|
||||
}
|
||||
if (it.leftTitle === '货物状况:') {
|
||||
it.rightTitle = res.data.goods_status_name
|
||||
}
|
||||
if (it.leftTitle === '申请时间:') {
|
||||
it.rightTitle = formatDateTime(res.data.apply_time)
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 取消退货
|
||||
const { fetchData: cancelFetch } = returnApplyOrdercancel()
|
||||
const handCancle = async() => {
|
||||
Taro.showModal({
|
||||
content: '确定要取消吗?',
|
||||
confirmText: '确认',
|
||||
cancelText: '取消',
|
||||
async success(res) {
|
||||
if (res.confirm) {
|
||||
const res = await cancelFetch({ id: Number(DeatailObj.id) })
|
||||
Taro.showLoading({
|
||||
title: '请稍等...',
|
||||
mask: true,
|
||||
})
|
||||
if (res.msg === 'success') {
|
||||
Taro.showToast({
|
||||
title: '取消成功',
|
||||
})
|
||||
setOrderMsg([...orderMsg])
|
||||
setPicList([...res.data?.accessory_url !== null ? res.data?.accessory_url : []])
|
||||
Taro.hideLoading()
|
||||
// 小程序提供的api,通知页面停止下拉刷新效果
|
||||
Taro.stopPullDownRefresh();
|
||||
getDetail()
|
||||
}
|
||||
else {
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: 'error',
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
// 查看图片
|
||||
const [ShowPic, setShowPic] = useState(false)
|
||||
|
||||
//分辨用质检中还是质检前的数组
|
||||
const productList = useMemo(() => {
|
||||
if (DeatailObj.stage === 0 ||
|
||||
(DeatailObj.sale_mode == 1 && DeatailObj.type == 1) || DeatailObj.stage === 1 || DeatailObj.stage === 2) {
|
||||
return DeatailObj.product_list
|
||||
} else {
|
||||
return DeatailObj.quality_check_pass_product
|
||||
const [PicList, setPicList] = useState<any[]>([])
|
||||
|
||||
const handUp = (value) => {
|
||||
setShowPic(true)
|
||||
}
|
||||
|
||||
const onlyRead = useMemo(() => {
|
||||
if (DeatailObj.stage == 1) {
|
||||
return false
|
||||
}
|
||||
else {
|
||||
return true
|
||||
}
|
||||
}, [DeatailObj])
|
||||
|
||||
// 获取图片列表
|
||||
const picUrl = useRef([])
|
||||
const getImageList = useCallback((list) => {
|
||||
picUrl.current = list
|
||||
}, [])
|
||||
|
||||
// 提交附件
|
||||
const { fetchData: sureFetch } = returnApplyOrderuploadAccessory()
|
||||
const handSure = () => {
|
||||
let arr: any = []
|
||||
arr = [...picUrl.current]
|
||||
if (arr == 0) {
|
||||
return alert.error('请先添加附件')
|
||||
}
|
||||
Taro.showModal({
|
||||
content: '确定要提交吗?',
|
||||
confirmText: '确认',
|
||||
cancelText: '取消',
|
||||
async success(res) {
|
||||
if (res.confirm) {
|
||||
const res = await sureFetch({ id: Number(DeatailObj.id), accessory_url: arr })
|
||||
Taro.showLoading({
|
||||
title: '请稍等...',
|
||||
mask: true,
|
||||
})
|
||||
if (res.msg === 'success') {
|
||||
Taro.showToast({
|
||||
title: '成功',
|
||||
})
|
||||
setShowPic(false)
|
||||
Taro.hideLoading()
|
||||
getDetail()
|
||||
}
|
||||
else {
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: 'error',
|
||||
})
|
||||
}
|
||||
}
|
||||
}, [DeatailObj])
|
||||
},
|
||||
})
|
||||
}
|
||||
const proview = (item) => {
|
||||
Taro.previewImage({
|
||||
current: IMG_CND_Prefix + item, // 当前显示图片的 http 链接
|
||||
urls: DeatailObj.fabric_piece_accessory_url.map((item) => {
|
||||
item = IMG_CND_Prefix + item
|
||||
return item
|
||||
}), // 需要预览的图片 http 链接列表
|
||||
})
|
||||
}
|
||||
const [ShowCode, setShowCode] = useState(false)
|
||||
const handSee = () => {
|
||||
setShowCode(true)
|
||||
}
|
||||
|
||||
|
||||
//订单信息文字数组
|
||||
const [orderMsg, setOrderMsg] = useState<any[]>([
|
||||
return (
|
||||
<View className={styles.main}>
|
||||
<OrderState orderInfo={DeatailObj} />
|
||||
<AddressDetailBox
|
||||
obj={DeatailObj}
|
||||
handUp={() => handUp(DeatailObj)}
|
||||
></AddressDetailBox>
|
||||
<DefaultBox
|
||||
showMode
|
||||
title="客户信息"
|
||||
modeName={DeatailObj.sale_mode_name}
|
||||
>
|
||||
<View className={styles.pussBox}>
|
||||
<View className={styles.pussName}>{DeatailObj.purchaser_name}</View>
|
||||
<View className={styles.pussPhone}>{DeatailObj.purchaser_phone}</View>
|
||||
</View>
|
||||
</DefaultBox>
|
||||
<DefaultBox title="退款信息">
|
||||
<GoodsItem list={productList} obj={DeatailObj}></GoodsItem>
|
||||
<View className={styles.totalBox}>
|
||||
<View className={styles.totalLeft}>总计</View>
|
||||
<View className={styles.totalRight}>{DeatailObj.total_fabrics} 种面料,{DeatailObj?.total_colors} 种颜色,共 {
|
||||
DeatailObj?.sale_mode == 0 ? DeatailObj?.return_roll : DeatailObj?.total_number / 100
|
||||
} {DeatailObj?.sale_mode == 0 ? '条' : '米'}</View>
|
||||
</View>
|
||||
{
|
||||
leftTitle: '售后编号:',
|
||||
rightTitle: '------',
|
||||
showBtn: true
|
||||
},
|
||||
{
|
||||
leftTitle: '订单号:',
|
||||
rightTitle: '------',
|
||||
showBtn: true
|
||||
},
|
||||
{
|
||||
leftTitle: '退货原因:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
{
|
||||
leftTitle: '退货说明:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
{
|
||||
leftTitle: '其他说明:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
{
|
||||
leftTitle: '货物状况:',
|
||||
rightTitle: '------',
|
||||
},
|
||||
{
|
||||
leftTitle: '申请时间:',
|
||||
rightTitle: '------',
|
||||
}
|
||||
])
|
||||
|
||||
//复制功能
|
||||
const clipboardData = (val) => {
|
||||
Taro.setClipboardData({
|
||||
data: val || '',
|
||||
success: function (res) {
|
||||
Taro.showToast({
|
||||
icon: 'none',
|
||||
title: '复制成功',
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
//取消退货
|
||||
const { fetchData: cancelFetch } = returnApplyOrdercancel()
|
||||
const handCancle = async () => {
|
||||
Taro.showModal({
|
||||
content: "确定要取消吗?",
|
||||
confirmText: "确认",
|
||||
cancelText: "取消",
|
||||
success: async function (res) {
|
||||
if (res.confirm) {
|
||||
const res = await cancelFetch({ id: Number(DeatailObj.id) })
|
||||
Taro.showLoading({
|
||||
title: '请稍等...',
|
||||
mask: true
|
||||
})
|
||||
if (res.msg === 'success') {
|
||||
Taro.showToast({
|
||||
title: '取消成功'
|
||||
})
|
||||
Taro.hideLoading()
|
||||
getDetail()
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
//查看图片
|
||||
const [ShowPic, setShowPic] = useState(false)
|
||||
|
||||
|
||||
const [PicList, setPicList] = useState<any[]>([])
|
||||
|
||||
const handUp = (value) => {
|
||||
setShowPic(true)
|
||||
}
|
||||
|
||||
const onlyRead = useMemo(() => {
|
||||
if (DeatailObj.stage == 1) {
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}, [DeatailObj])
|
||||
|
||||
//获取图片列表
|
||||
const picUrl = useRef([])
|
||||
const getImageList = useCallback((list) => {
|
||||
picUrl.current = list
|
||||
}, [])
|
||||
|
||||
//提交附件
|
||||
const { fetchData: sureFetch } = returnApplyOrderuploadAccessory()
|
||||
const handSure = () => {
|
||||
let arr: any = []
|
||||
arr = [...picUrl.current]
|
||||
if (arr == 0) {
|
||||
return alert.error('请先添加附件')
|
||||
}
|
||||
Taro.showModal({
|
||||
content: "确定要提交吗?",
|
||||
confirmText: "确认",
|
||||
cancelText: "取消",
|
||||
success: async function (res) {
|
||||
if (res.confirm) {
|
||||
const res = await sureFetch({ id: Number(DeatailObj.id), accessory_url: arr, })
|
||||
Taro.showLoading({
|
||||
title: '请稍等...',
|
||||
mask: true
|
||||
})
|
||||
if (res.msg === 'success') {
|
||||
Taro.showToast({
|
||||
title: '成功'
|
||||
})
|
||||
setShowPic(false)
|
||||
Taro.hideLoading()
|
||||
getDetail()
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: res.msg,
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
const proview = (item) => {
|
||||
Taro.previewImage({
|
||||
current: IMG_CND_Prefix + item, // 当前显示图片的 http 链接
|
||||
urls: DeatailObj.fabric_piece_accessory_url.map((item) => {
|
||||
item = IMG_CND_Prefix + item;
|
||||
return item;
|
||||
}), // 需要预览的图片 http 链接列表
|
||||
});
|
||||
};
|
||||
const [ShowCode, setShowCode] = useState(false)
|
||||
const handSee = () => {
|
||||
setShowCode(true)
|
||||
}
|
||||
|
||||
return (
|
||||
<View className={styles.main}>
|
||||
<OrderState orderInfo={DeatailObj} />
|
||||
<AddressDetailBox
|
||||
obj={DeatailObj}
|
||||
handUp={() => handUp(DeatailObj)}
|
||||
></AddressDetailBox>
|
||||
<DefaultBox
|
||||
showMode={true}
|
||||
title={'客户信息'}
|
||||
modeName={DeatailObj.sale_mode_name}
|
||||
>
|
||||
<View className={styles.pussBox}>
|
||||
<View className={styles.pussName}>{DeatailObj.purchaser_name}</View>
|
||||
<View className={styles.pussPhone}>{DeatailObj.purchaser_phone}</View>
|
||||
</View>
|
||||
</DefaultBox>
|
||||
<DefaultBox title={'退款信息'}>
|
||||
<GoodsItem list={productList} obj={DeatailObj}></GoodsItem>
|
||||
<View className={styles.totalBox}>
|
||||
<View className={styles.totalLeft}>总计</View>
|
||||
<View className={styles.totalRight}>{DeatailObj.total_fabrics} 种面料,{DeatailObj?.total_colors} 种颜色,共 {
|
||||
DeatailObj?.sale_mode == 0 ? DeatailObj?.return_roll : DeatailObj?.total_number / 100
|
||||
} {DeatailObj?.sale_mode == 0 ? "条" : "米"}</View>
|
||||
</View>
|
||||
{
|
||||
(DeatailObj.stage == 3) &&
|
||||
<View className={styles.totalBox}>
|
||||
<View className={styles.totalLeft}>退款金额</View>
|
||||
<View className={styles.totalRight} style={{ color: '#F64861' }}>¥{
|
||||
formatPriceDiv(DeatailObj.refund_amount)
|
||||
}</View>
|
||||
(DeatailObj.stage == 3)
|
||||
&& <View className={styles.totalBox}>
|
||||
<View className={styles.totalLeft}>退款金额</View>
|
||||
<View className={styles.totalRight} style={{ color: '#F64861' }}>¥{
|
||||
formatPriceDiv(DeatailObj.refund_amount)
|
||||
}</View>
|
||||
</View>
|
||||
|
||||
}
|
||||
</DefaultBox>
|
||||
<DefaultBox title={'订单信息'}>
|
||||
{
|
||||
orderMsg.map((item, index) => {
|
||||
return (
|
||||
<View className={styles.detailBox} key={index}>
|
||||
<View className={styles.detailFont}>
|
||||
{item.leftTitle}
|
||||
</View>
|
||||
<View className={styles.detailRightFlex}>
|
||||
<View className={styles.detailRight}>{item.rightTitle}</View>
|
||||
{item.showBtn && <View className={styles.detailBtn} onClick={() => clipboardData(item.rightTitle)}>复制</View>}
|
||||
</View>
|
||||
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
</DefaultBox>
|
||||
<DefaultBox title={'售后图片'}>
|
||||
<View className={styles.picBox}>
|
||||
{
|
||||
DeatailObj?.fabric_piece_accessory_url?.length > 0 && DeatailObj?.fabric_piece_accessory_url.map((item, index) => {
|
||||
return (
|
||||
<Image className={styles.pic} lazyLoad key={index} onClick={() => proview(item)}
|
||||
mode="aspectFill" src={IMG_CND_Prefix + item}></Image>
|
||||
)
|
||||
})
|
||||
}
|
||||
{
|
||||
DeatailObj?.fabric_piece_accessory_url?.length === 0 && <View className={styles.noPic}>暂无图片</View>
|
||||
}
|
||||
}
|
||||
</DefaultBox>
|
||||
<DefaultBox title="订单信息">
|
||||
{
|
||||
orderMsg.map((item, index) => {
|
||||
return (
|
||||
<View className={styles.detailBox} key={index}>
|
||||
<View className={styles.detailFont}>
|
||||
{item.leftTitle}
|
||||
</View>
|
||||
<View className={styles.detailRightFlex}>
|
||||
<View className={styles.detailRight}>{item.rightTitle}</View>
|
||||
{item.showBtn && <View className={styles.detailBtn} onClick={() => clipboardData(item.rightTitle)}>复制</View>}
|
||||
</View>
|
||||
</DefaultBox>
|
||||
<View className={styles.safeBox}></View>
|
||||
|
||||
<View className={styles.bottomMuck}>
|
||||
{
|
||||
(DeatailObj.stage === 0 || DeatailObj.stage === 1) && <View className={styles.cancleBtn} onClick={() => handCancle()}>取消退货</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
{
|
||||
(DeatailObj.sale_mode == 0 && DeatailObj.stage == 3 && (DeatailObj.type == 1 || DeatailObj.type == 3)) && <View className={styles.seeButon} onClick={() => { handSee() }}>查看码单</View>
|
||||
}
|
||||
|
||||
</View>
|
||||
<RefundCodelist
|
||||
obj={DeatailObj}
|
||||
// picUrl={PicUrl}
|
||||
showPopup={ShowCode}
|
||||
popupClose={() => setShowCode(false)}
|
||||
></RefundCodelist>
|
||||
<Popup title={'查看/修改物流回单'} show={ShowPic} onClose={() => setShowPic(false)}>
|
||||
<>
|
||||
<UploadImage onChange={getImageList} defaultList={PicList} onlyRead={onlyRead} />
|
||||
{
|
||||
|
||||
!onlyRead && <View className={styles.picBtn} onClick={() => handSure()}>确认修改</View>
|
||||
}
|
||||
</>
|
||||
</Popup>
|
||||
</DefaultBox>
|
||||
<DefaultBox title="售后图片">
|
||||
<View className={styles.picBox}>
|
||||
{
|
||||
DeatailObj?.fabric_piece_accessory_url?.length > 0 && DeatailObj?.fabric_piece_accessory_url.map((item, index) => {
|
||||
return (
|
||||
<Image className={styles.pic} lazyLoad key={index} onClick={() => proview(item)}
|
||||
mode="aspectFill" src={IMG_CND_Prefix + item}
|
||||
></Image>
|
||||
)
|
||||
})
|
||||
}
|
||||
{
|
||||
DeatailObj?.fabric_piece_accessory_url?.length === 0 && <View className={styles.noPic}>暂无图片</View>
|
||||
}
|
||||
</View>
|
||||
)
|
||||
</DefaultBox>
|
||||
<View className={styles.safeBox}></View>
|
||||
|
||||
<View className={styles.bottomMuck}>
|
||||
{
|
||||
(DeatailObj.stage === 0 || DeatailObj.stage === 1) && <View className={styles.cancleBtn} onClick={() => handCancle()}>取消退货</View>
|
||||
|
||||
}
|
||||
{
|
||||
(DeatailObj.sale_mode == 0 && DeatailObj.stage == 3 && (DeatailObj.type == 1 || DeatailObj.type == 3)) && <View className={styles.seeButon} onClick={() => { handSee() }}>查看码单</View>
|
||||
}
|
||||
|
||||
</View>
|
||||
<RefundCodelist
|
||||
obj={DeatailObj}
|
||||
// picUrl={PicUrl}
|
||||
showPopup={ShowCode}
|
||||
popupClose={() => setShowCode(false)}
|
||||
></RefundCodelist>
|
||||
<Popup title="查看/修改物流回单" show={ShowPic} onClose={() => setShowPic(false)}>
|
||||
<>
|
||||
<UploadImage onChange={getImageList} defaultList={PicList} onlyRead={onlyRead} />
|
||||
{
|
||||
|
||||
!onlyRead && <View className={styles.picBtn} onClick={() => handSure()}>确认修改</View>
|
||||
}
|
||||
</>
|
||||
</Popup>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
interface Obs {
|
||||
title?: string,
|
||||
modeName?: string,
|
||||
showMode?: boolean,
|
||||
children?: ReactNode,
|
||||
clickNode?: () => void
|
||||
title?: string
|
||||
modeName?: string
|
||||
showMode?: boolean
|
||||
children?: ReactNode
|
||||
clickNode?: () => void
|
||||
}
|
||||
|
||||
const DefaultBox = memo((props: Obs) => {
|
||||
const {
|
||||
title = '标题',
|
||||
modeName = '大货',
|
||||
showMode = false,
|
||||
children,
|
||||
clickNode
|
||||
} = props
|
||||
const {
|
||||
title = '标题',
|
||||
modeName = '大货',
|
||||
showMode = false,
|
||||
children,
|
||||
clickNode,
|
||||
} = props
|
||||
|
||||
return (
|
||||
<View className={styles.defaltBox}>
|
||||
<View className={styles.titleBox}>
|
||||
<View className={styles.title}>{title}</View>
|
||||
{
|
||||
showMode && <View className={styles.modeName} onClick={() => clickNode?.()}>{modeName}</View>
|
||||
}
|
||||
</View>
|
||||
<View className={styles.modeLine}></View>
|
||||
{children}
|
||||
</View>
|
||||
)
|
||||
return (
|
||||
<View className={styles.defaltBox}>
|
||||
<View className={styles.titleBox}>
|
||||
<View className={styles.title}>{title}</View>
|
||||
{
|
||||
showMode && <View className={styles.modeName} onClick={() => clickNode?.()}>{modeName}</View>
|
||||
}
|
||||
</View>
|
||||
<View className={styles.modeLine}></View>
|
||||
{children}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
interface PropGoods {
|
||||
// item?: {
|
||||
// code?: string | number
|
||||
// }
|
||||
list: any[],
|
||||
obj: any
|
||||
// item?: {
|
||||
// code?: string | number
|
||||
// }
|
||||
list: any[]
|
||||
obj: any
|
||||
}
|
||||
const GoodsItem = memo((porps: PropGoods) => {
|
||||
const { list = [], obj = {} } = porps
|
||||
const { list = [], obj = {} } = porps
|
||||
|
||||
const labAndImgObj = useCallback((item) => {
|
||||
return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url }
|
||||
}, [])
|
||||
return (
|
||||
<>
|
||||
{
|
||||
list.map((item, index) => {
|
||||
return (
|
||||
<View className={styles.goodsBox} key={index}>
|
||||
<View className={styles.goodsProduct}>{item.code}# {item.name}</View>
|
||||
{
|
||||
item.product_colors.map((it, inx) => {
|
||||
return (
|
||||
<View className={styles.itemGoods}>
|
||||
{
|
||||
it.texture_url === '' &&
|
||||
<Image className={styles.itemPic} mode={'aspectFill'} src={'https://test.cdn.zzfzyc.com/mall/no_img.png'}></Image>
|
||||
}
|
||||
{
|
||||
it.texture_url !== '' &&
|
||||
<View className={styles.itemPic}>
|
||||
<LabAndImg value={labAndImgObj(it)} />
|
||||
const labAndImgObj = useCallback((item) => {
|
||||
return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url }
|
||||
}, [])
|
||||
return (
|
||||
<>
|
||||
{
|
||||
list.map((item, index) => {
|
||||
return (
|
||||
<View className={styles.goodsBox} key={index}>
|
||||
<View className={styles.goodsProduct}>{item.code}# {item.name}</View>
|
||||
{
|
||||
item.product_colors.map((it, inx) => {
|
||||
return (
|
||||
<View className={styles.itemGoods}>
|
||||
{
|
||||
it.texture_url === ''
|
||||
&& <Image className={styles.itemPic} mode="aspectFill" src="https://test.cdn.zzfzyc.com/mall/no_img.png"></Image>
|
||||
}
|
||||
{
|
||||
it.texture_url !== ''
|
||||
&& <View className={styles.itemPic}>
|
||||
<LabAndImg value={labAndImgObj(it)} />
|
||||
</View>
|
||||
}
|
||||
<View className={styles.clear}> </View>
|
||||
<View className={styles.itemRight}>
|
||||
<View className={styles.item_right_top}>
|
||||
<View className={styles.itemName}>{it.code}# {it.name}</View>
|
||||
{/* <View className={styles.itemNums}>x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'}</View> */}
|
||||
{
|
||||
obj.sale_mode == 0 && <View className={styles.itemNums}>x{obj.stage == 0 || obj.stage == 1 || obj.stage == 2
|
||||
? it.roll
|
||||
: obj.stage == 5 || obj.stage == 6 || obj.stage == 3
|
||||
? it.return_roll
|
||||
: it.roll}{obj?.sale_mode == 0 ? '条' : 'm'}</View>
|
||||
}
|
||||
{
|
||||
obj.sale_mode != 0 && <View className={styles.itemNums}>x{it.length / 100}m</View>
|
||||
}
|
||||
</View>
|
||||
<View className={styles.item_right_Bottom}>
|
||||
<View className={styles.itemMoney}>¥{it.sale_price / 100}/{obj?.sale_mode == 0 ? 'kg' : 'm'}</View>
|
||||
{/* <View className={styles.itemMoneyOne}>¥{formatPriceDiv(it.total_sale_price)}</View> */}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
<View className={styles.clear}> </View>
|
||||
<View className={styles.itemRight}>
|
||||
<View className={styles.item_right_top}>
|
||||
<View className={styles.itemName}>{it.code}# {it.name}</View>
|
||||
{/* <View className={styles.itemNums}>x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'}</View> */}
|
||||
{
|
||||
obj.sale_mode == 0 && <View className={styles.itemNums}>x{obj.stage == 0 || obj.stage == 1 || obj.stage == 2
|
||||
? it.roll
|
||||
: obj.stage == 5 || obj.stage == 6 || obj.stage == 3
|
||||
? it.return_roll
|
||||
: it.roll}{obj?.sale_mode == 0 ? '条' : 'm'}</View>
|
||||
}
|
||||
{
|
||||
obj.sale_mode != 0 && <View className={styles.itemNums}>x{it.length / 100}m</View>
|
||||
}
|
||||
</View>
|
||||
)
|
||||
<View className={styles.item_right_Bottom}>
|
||||
<View className={styles.itemMoney}>¥{it.sale_price / 100}/{obj?.sale_mode == 0 ? 'kg' : 'm'}</View>
|
||||
{/* <View className={styles.itemMoneyOne}>¥{formatPriceDiv(it.total_sale_price)}</View> */}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</>
|
||||
}
|
||||
</View>
|
||||
)
|
||||
})
|
||||
}
|
||||
</>
|
||||
|
||||
)
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user