feat:申请退货80%

This commit is contained in:
Haiyi 2022-09-21 19:14:31 +08:00
parent 45de2e92c0
commit ff5b5a5fe2
12 changed files with 1300 additions and 78 deletions

View File

@ -106,6 +106,13 @@
"query": "id=607", "query": "id=607",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null
},
{
"name": "",
"pathName": "pages/applyGoods/index",
"query": "orderId=28114",
"launchMode": "default",
"scene": null
} }
] ]
} }

View File

@ -137,3 +137,33 @@ export const mpsearchHistory = () => {
method: "post", method: "post",
}) })
} }
//确认收货
export const mpsaleOrderreceive = () => {
return useRequest({
url: `/v1/mp/saleOrder/receive`,
method: "put",
})
}
//退货原因
export const mpenumreturnOrderreturnReason = () => {
return useRequest({
url: `/v1/mp/enum/returnOrder/returnReason`,
method: "get",
})
}
//二次选择退货原因
export const mpenumreturnExplain = () => {
return useRequest({
url: `/v1/mp/enum/returnExplain`,
method: "get",
})
}
//货物状况
export const mpenumreturngoodsStatus = () => {
return useRequest({
url: `/v1/mp/enum/return/goodsStatus`,
method: "get",
})
}

View File

@ -93,6 +93,12 @@ export default defineAppConfig({
pages: [ pages: [
"index" "index"
] ]
},
{
root: "pages/applyGoods",
pages: [
"index"
]
} }
], ],
}) })

View File

@ -0,0 +1,4 @@
export default {
navigationBarTitleText: '申请退货',
enableShareAppMessage: true,
}

View File

@ -0,0 +1,575 @@
.main {}
.bgBox {
margin: 24px;
background: #FFFFFF;
border-radius: 16px;
overflow: hidden;
}
.goodsBox {
margin-top: 24px;
overflow: hidden;
border-bottom: 8px solid #F7F7F7;
.goodsProduct {
font-size: 28px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #000000;
margin-left: 32px;
}
.goodsLine {
width: 638px;
height: 1px;
background: #000000;
opacity: 0.1;
margin-left: 32px;
margin-top: 24px;
}
.itemGoods {
margin-top: 24px;
display: flex;
.itemPic {
margin-left: 32px;
margin-right: 42px;
width: 108px;
height: 108px;
background: #322F2F;
border-radius: 8px;
}
.itemRight {
padding-bottom: 24px;
width: 495px;
border-bottom: 1px solid #f7f7f7;
.item_right_top {
margin-bottom: 41px;
display: flex;
align-items: center;
justify-content: space-between;
.itemName {
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #000000;
}
.itemNums {
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #000000;
}
}
.item_right_Bottom {
display: flex;
align-items: center;
justify-content: space-between;
.itemMoney {
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #000000;
}
.itemMoneyOne {
font-size: 28px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #000000;
}
.btn {
width: 120px;
height: 64px;
border-radius: 8px;
border: 1px solid #337FFF;
font-size: 28px;
font-weight: 400;
color: #337FFF;
text-align: center;
line-height: 64px;
}
.btnOne {
width: 204px;
height: 64px;
border-radius: 8px;
border: 1px solid #337FFF;
font-size: 28px;
font-weight: 400;
color: #337FFF;
text-align: center;
line-height: 64px;
}
.inputBox {
width: 189px;
height: 64px;
border-radius: 8px;
border: 1px solid #337FFF;
display: flex;
.redceBox {
width: 64px;
height: 64px;
border-radius: 8px 0px 0px 8px;
border-right: 1px solid #337FFF;
display: flex;
align-items: center;
justify-content: center;
.reduce {
width: 20px;
height: 2px;
background: #337FFF;
}
}
.inputBig {
width: 61px;
height: 64px;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
font-size: 24px;
font-weight: 400;
color: #337FFF;
}
.addBox {
width: 64px;
height: 64px;
border-left: 1px solid #337FFF;
display: flex;
align-items: center;
justify-content: center;
font-size: 40px;
color: #337FFF;
}
}
}
}
}
.itemGoods:last-child {
margin-top: 24px;
display: flex;
.itemPic {
margin-left: 32px;
margin-right: 42px;
width: 108px;
height: 108px;
background: #322F2F;
border-radius: 8px;
}
.itemRight {
padding-bottom: 24px;
width: 495px;
border-bottom: none;
.item_right_top {
margin-bottom: 41px;
display: flex;
align-items: center;
justify-content: space-between;
.itemName {
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #000000;
}
.itemNums {
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #000000;
}
}
.item_right_Bottom {
display: flex;
align-items: center;
justify-content: space-between;
.itemMoney {
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #000000;
}
.itemMoneyOne {
font-size: 28px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #000000;
}
.btn {
width: 120px;
height: 64px;
border-radius: 8px;
border: 1px solid #337FFF;
font-size: 28px;
font-weight: 400;
color: #337FFF;
text-align: center;
line-height: 64px;
}
.btnOne {
width: 204px;
height: 64px;
border-radius: 8px;
border: 1px solid #337FFF;
font-size: 28px;
font-weight: 400;
color: #337FFF;
text-align: center;
line-height: 64px;
}
}
}
}
}
.goodsBox {
border-bottom: none;
}
.hasSelect {
margin-left: 32px;
margin-right: 32px;
height: 54px;
background: #FEF9F4;
border-radius: 8px;
display: flex;
align-items: center;
font-size: 24px;
font-weight: 600;
color: #F79B31;
padding-left: 20px;
margin-bottom: 24px;
}
.resonBig {
overflow: hidden;
margin: 0 24px;
background: #FFFFFF;
border-radius: 16px 16px 0px 0px;
.reasonItem {
display: flex;
align-items: center;
border-bottom: 1px solid #f7f7f7;
margin: 32px;
padding-bottom: 32px;
justify-content: space-between;
.reasonLeft {
display: flex;
align-items: center;
.reasonFont {
font-size: 28px;
font-weight: 500;
color: #000000;
}
.xing {
font-size: 28px;
font-weight: 500;
color: #E42945;
}
.selectFont {
font-size: 28px;
font-weight: 400;
color: #000000;
margin-left: 40px;
}
}
.chakanquanbukehu {
font-size: 50px;
}
}
.picBig {
display: flex;
margin-top: 32px;
display: flex;
padding-bottom: 32px;
.picFont {
width: 130px;
font-size: 28px;
font-weight: 500;
color: #000000;
margin-left: 32px;
}
// .rightPic {
// margin-right: 32px;
// }
}
}
.descBox {
margin: 32px;
background: #FFFFFF;
border-radius: 16px 16px 0px 0px;
overflow: hidden;
.title {
font-size: 28px;
font-weight: 500;
color: #000000;
margin-top: 24px;
margin-left: 32px;
}
.textBox {
padding-top: 15px;
padding-left: 24px;
padding-right: 24px;
padding-bottom: 24px;
margin-right: 32px;
margin-top: 24px;
margin-left: 32px;
height: 210px;
background: #f6f6f6;
border-radius: 8px;
font-size: 28px;
font-weight: 400;
color: #000000;
margin-bottom: 32px;
}
}
.bottomBox {
width: 750px;
height: 160px;
background: #FFFFFF;
position: fixed;
bottom: 0;
z-index: 99;
display: flex;
padding-top: 16px;
justify-content: space-between;
.resetBox {
margin-left: 48px;
width: 311px;
height: 80px;
border-radius: 44px;
border: 1px solid #087EFF;
font-size: 28px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #337FFF;
text-align: center;
line-height: 80px;
}
.button {
margin-right: 32px;
width: 311px;
height: 80px;
background: #68b4ff;
border-radius: 44px;
font-size: 32px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #FFFFFF;
text-align: center;
line-height: 80px;
}
.activeButton {
margin-right: 32px;
width: 311px;
height: 80px;
background: #337FFF;
border-radius: 44px;
font-size: 32px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #fff;
text-align: center;
line-height: 80px;
}
}
.safeBox {
height: 160px;
width: 100%;
}
.popupBox {
padding-bottom: env(safe-area-inset-bottom);
.thirdBox {
margin-top: 20px;
padding-left: 48px;
.thirdTopfont {
font-size: 28px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #000000;
}
.timeBox2 {
margin-top: 24px;
background-color: #f6f6f6;
height: 68px;
background: #E9E9E9;
border-radius: 8px;
margin-right: 48px;
text-align: center;
line-height: 68px;
position: relative;
font-size: 28px;
font-weight: 400;
color: #000000;
.more {
position: absolute;
right: 30px;
top: 5px;
font-size: 40px;
}
}
.flexModebox {
margin-top: 24px;
display: flex;
flex-wrap: wrap;
.activemodeBox {
margin-bottom: 16px;
margin-right: 16px;
// width: 152px;
// height: 68px;
padding: 17px 34px 17px 34px;
background: rgba(51, 127, 255, 0.1);
border-radius: 8px;
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #337FFF;
text-align: center;
// line-height: 68px;
border: 1px solid #337FFF;
box-sizing: border-box;
}
.modeBox {
margin-bottom: 16px;
margin-right: 16px;
padding: 17px 34px 17px 34px;
// width: 152px;
// height: 68px;
background: #f6f6f6;
border-radius: 8px;
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #000000;
border: 1px solid #f6f6f6;
text-align: center;
// line-height: 68px;
box-sizing: border-box;
// opacity: 0.4;
}
}
}
.bottomBox1 {
width: 750px;
height: 160px;
background: #FFFFFF;
position: fixed;
bottom: 0;
z-index: 99;
display: flex;
padding-top: 16px;
justify-content: space-between;
.resetBox1 {
margin-left: 48px;
width: 311px;
height: 80px;
border-radius: 44px;
border: 1px solid #087EFF;
font-size: 28px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #337FFF;
text-align: center;
line-height: 80px;
}
.button1 {
margin-right: 32px;
width: 311px;
height: 80px;
background: #68b4ff;
border-radius: 44px;
font-size: 32px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #FFFFFF;
text-align: center;
line-height: 80px;
}
.activeButton1 {
margin-right: 32px;
width: 311px;
height: 80px;
background: #337FFF;
border-radius: 44px;
font-size: 32px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #fff;
text-align: center;
line-height: 80px;
}
}
// .areaBox {
// height: calc($customTabBarHeight + env(safe-area-inset-bottom));
// width: 100%;
// }
}

View File

@ -0,0 +1,536 @@
import { View, Input, Button, Image, Text, Textarea } 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 } from '@tarojs/taro'
import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format'
import {
mpsaleOrder,
mpenumreturnOrderreturnReason,
mpenumreturnExplain,
mpenumreturngoodsStatus
} from "@/api/order"
import Popup from '@/components/popup'
import UploadImage from '@/components/uploadImage'
export default () => {
const router = useRouter()
useDidShow(() => {
getDetail()
})
const { fetchData: infoFetch } = mpsaleOrder()
const [infoObj, setInfoObj] = useState<any>({})
const [ListArr, setListArr] = useState<any[]>([])
//获取订单详情
const getDetail = async () => {
const res = await infoFetch({ id: router.params.orderId })
res.data.av_return_product.forEach(item => {
item.av_product_color.map(it => {
it.isTui = false
it.nums = 1
})
return item
})
setListArr(res.data.av_return_product)
setInfoObj(res.data)
}
//点击退货
const handTui = (val) => {
let res = ListArr
res.forEach(item => {
item.av_product_color?.map(it => {
if (it.sale_order_detail_id == val.sale_order_detail_id) {
it.isTui = true
}
return it
})
})
setListArr([...res])
}
//点击取消退货
const handCancel = (val) => {
ListArr.forEach(item => {
item.av_product_color.map(it => {
if (it.sale_order_detail_id === val.sale_order_detail_id) {
it.isTui = false
}
return it
})
})
setListArr([...ListArr])
}
//点击减
const handReduce = (val) => {
ListArr.forEach(item => {
item.av_product_color.map(it => {
if (it.sale_order_detail_id === val.sale_order_detail_id) {
if (val.nums === 1) {
it.isTui = false
it.nums = 1
} else {
it.nums--
}
}
return it
})
})
setListArr([...ListArr])
}
const onInputEven = (e, val) => {
ListArr.forEach(item => {
item.av_product_color.map(it => {
if (it.sale_order_detail_id === val.sale_order_detail_id) {
if (Number(e.detail.value) < 1) {
it.nums = 1
} else {
it.nums = Number(e.detail.value)
}
if (Number(e.detail.value) > it.roll) {
it.nums = 1
}
}
return it
})
})
setListArr([...ListArr])
}
//点击加
const handAdd = (val) => {
ListArr.forEach(item => {
item.av_product_color.map(it => {
if (it.sale_order_detail_id === val.sale_order_detail_id) {
if (it.nums < it.roll) {
it.nums++
} else {
return
}
}
return it
})
})
setListArr([...ListArr])
}
const totalNums = useMemo(() => {
const arr: any[] = []
ListArr.forEach(item => {
item.av_product_color.forEach(it => {
if (it.isTui) {
arr.push(it)
}
})
})
return arr.length
}, [ListArr])
//获取图片列表
const picUrl = useRef([])
const getImageList = useCallback((list) => {
picUrl.current = list
}, [])
//判断是否允许提交
const isDisabled = useMemo(() => {
return false
}, [])
//筛选内容展示
const [showPopup, setshowPopup] = useState(false)
useEffect(() => {
getReason()
getReasonTwo()
}, [])
const queryRef = useRef(
{
return_reason: 1,//退货原因
return_explain: '',//退货理由
reasonName: '请选择',
reasonNameTwo: '请选择',
GoodStatus: '',
GoodStatusName: "请选择"
}
)
const [Query, setQuery] = useState<any>({
// reason_describe: '',//描述说明
return_reason: 1,//退货原因
reasonName: '请选择',
reasonNameTwo: '请选择',
return_explain: '',//退货理由
GoodStatus: '',
GoodStatusName: "请选择"
// goods_status: '',//货物状况
// fabric_piece_accessory_url:[],//退货图片
// sale_order_id:infoObj.id,//详情id
})
///获取退货原因
const { fetchData: resonFetch } = mpenumreturnOrderreturnReason()
const [ReasonList, setReasonList] = useState<any[]>([])
const getReason = async () => {
const res = await resonFetch()
if (res.data) {
setReasonList(res.data.list)
}
}
//获取退货原因2
const { fetchData: resonTwoFetch } = mpenumreturnExplain()
const [ReasonListTwo, setReasonListTwo] = useState<any[]>([])
const getReasonTwo = async () => {
const res = await resonTwoFetch({ return_reason: queryRef.current.return_reason })
if (res.data) {
setReasonListTwo(res.data.list)
}
}
//选择退货原因
const handReasonOne = (item) => {
ReasonList.map(it => {
if (it.id === item.id) {
it.default = true
} else {
it.default = false
}
return it
})
setQuery((val) => ({ ...val, return_reason: item.id, return_explain: '' }))
queryRef.current.return_reason = item.id
queryRef.current.reasonName = item.name
setReasonList([...ReasonList])
getReasonTwo()
}
//选择退货理由
const handReasonTwo = (item) => {
ReasonListTwo.map(it => {
if (it.id === item.id) {
it.default = true
} else {
it.default = false
}
return it
})
setReasonListTwo([...ReasonListTwo])
queryRef.current.reasonNameTwo = item.name
setQuery({ return_explain: item.id })
queryRef.current.return_explain = item.id
}
//重置
const handReset = () => {
queryRef.current.return_reason = 1
queryRef.current.return_explain = ''
queryRef.current.reasonName = '请选择'
queryRef.current.reasonNameTwo = '请选择'
setQuery((val) => ({ ...val, return_reason: 1, return_explain: '', reasonName: '请选择', reasonNameTwo: '请选择' }))
getReasonTwo()
const arrOne = resetArr(ReasonList)
setReasonList([...arrOne])
const arrTwo = resetArr(ReasonListTwo)
setReasonListTwo([...arrTwo])
}
//数组重置
const resetArr = (arr) => {
arr.map(it => {
it.default = false
return it
})
return arr
}
//判断选择原因
const selectIsDisabled = useMemo(() => {
if (Query.return_explain == '') {
return true
} else {
return false
}
}, [Query])
//确认选择退货原因
const handSlect = () => {
setQuery((val) => ({
...val,
reasonName: queryRef.current.reasonName,
reasonNameTwo: queryRef.current.reasonNameTwo
}))
setshowPopup(false)
}
//货物情况
const [DescPopup, setDescPopup] = useState(false)
const { fetchData: statusFetch } = mpenumreturngoodsStatus()
const [GoodStatusList, setGoodStatusList] = useState<any[]>([])
useEffect(() => {
getGoodStatus()
}, [])
const getGoodStatus = async () => {
const res = await statusFetch()
if (res.data) {
setGoodStatusList(res.data.list)
}
}
const handStatus = (item) => {
GoodStatusList.map(it => {
if (it.id === item.id) {
it.default = true
} else {
it.default = false
}
return it
})
setQuery((val) => ({ ...val, GoodStatus: item.id, GoodStatusName: item.name }))
setGoodStatusList([...GoodStatusList])
queryRef.current.GoodStatus = item.id
queryRef.current.GoodStatusName = item.name
}
//判断状态是否有选
const StatusIsDisabled = useMemo(() => {
if (Query.GoodStatus !== '') {
return false
} else {
return true
}
}, [Query])
//重置货物状态
const handResetStatus = () => {
const arr = resetArr(GoodStatusList)
setGoodStatusList([...arr])
queryRef.current.GoodStatus = ''
queryRef.current.GoodStatusName = '请选择'
setQuery((val) => ({ ...val, GoodStatus: '', GoodStatusName: '请选择' }))
}
//确认选择货物状况
const handSlectStatus = () => {
setQuery((val) => ({ ...val, GoodStatus: queryRef.current.GoodStatus, GoodStatusName: queryRef.current.GoodStatusName }))
setDescPopup(false)
}
return (
<View className={styles.main}>
<View className={styles.bgBox}>
<GoodsItem
list={ListArr}
obj={infoObj}
handTui={(item) => handTui(item)}
handCancel={(item) => handCancel(item)}
// onBlur={(e, item) => onBlur(e, item)}
handReduce={(item) => handReduce(item)}
handAdd={(item) => handAdd(item)}
onInputEven={(e, item) => onInputEven(e, item)}
></GoodsItem>
<View className={styles.hasSelect}>{totalNums}</View>
</View>
<View className={styles.resonBig}>
<View className={styles.reasonItem} onClick={() => { setshowPopup(true) }}>
<View className={styles.reasonLeft}>
<View className={styles.reasonFont}>退</View>
<Text className={styles.xing}>*</Text>
{
Query.reasonName === '请选择' && <View className={styles.selectFont}></View>
}
{
Query.reasonName !== '请选择' && <View className={styles.selectFont}>{Query.reasonName}/{Query.reasonNameTwo}</View>
}
</View>
<View className={classnames('iconfont', 'icon-chakanquanbukehu', styles.chakanquanbukehu)}></View>
</View>
<View className={styles.reasonItem} onClick={() => { setDescPopup?.(true) }}>
<View className={styles.reasonLeft}>
<View className={styles.reasonFont}></View>
<Text className={styles.xing}>*</Text>
{
Query.GoodStatusName === '请选择' && <View className={styles.selectFont}></View>
}
{
Query.GoodStatusName !== '请选择' && <View className={styles.selectFont}>{Query.GoodStatusName}</View>
}
</View>
<View className={classnames('iconfont', 'icon-chakanquanbukehu', styles.chakanquanbukehu)}></View>
</View>
<View className={styles.picBig}>
<View className={styles.picFont}></View>
<UploadImage onChange={getImageList} />
</View>
</View>
<View className={styles.descBox}>
<View className={styles.title}></View>
<View className={styles.textBox}>
<Textarea
// style='background:#f6f6f6;height:210px;padding:15rpx 24rpx 24rpx 24rpx;border-radius: 8rpx;'
placeholderStyle='font-size: 28rpx;font-weight: 400;'
autoFocus
placeholder={'选填/退货说明中选择时(其他问题)必填'}
></Textarea>
</View>
</View>
<View className={styles.safeBox}>
<View className={styles.bottomBox}>
<Button className={styles.resetBox} onClick={() => { handCancel() }}> </Button >
<Button className={classnames(isDisabled ? styles.button : styles.activeButton)} disabled={isDisabled} onClick={() => handSure()}> 退</Button >
</View>
</View>
<Popup title={'筛选情况'} show={showPopup} onClose={() => { setshowPopup?.(false) }}>
<View className={styles.popupBox}>
<View className={styles.thirdBox}>
<View className={styles.thirdTopfont}>退</View>
<View className={styles.flexModebox}>
{
ReasonList.map((item, index) => {
return (
<View onClick={() => { handReasonOne(item) }} className={classnames(item.default ? styles.activemodeBox : styles.modeBox)} key={index}>{item.name}</View>
)
})
}
</View>
</View>
<View className={styles.thirdBox}>
<View className={styles.thirdTopfont}>退</View>
<View className={styles.flexModebox}>
{
ReasonListTwo.map((item, index) => {
return (
<View onClick={() => { handReasonTwo(item) }} className={classnames(item.default ? styles.activemodeBox : styles.modeBox)} key={index}>{item.name}</View>
)
})
}
</View>
</View>
<View style={{ height: '100rpx' }}></View>
<View className={styles.bottomBox1}>
<Button className={styles.resetBox1} onClick={() => { handReset() }}> </Button >
<Button className={classnames(selectIsDisabled ? styles.button1 : styles.activeButton1)} disabled={selectIsDisabled} onClick={() => handSlect()}> </Button >
</View>
</View>
</Popup>
<Popup title={'筛选说明'} show={DescPopup} onClose={() => { setDescPopup?.(false) }}>
<View className={styles.popupBox}>
<View className={styles.thirdBox}>
<View className={styles.thirdTopfont}></View>
<View className={styles.flexModebox}>
{
GoodStatusList.map((item, index) => {
return (
<View onClick={() => { handStatus(item) }} className={classnames(item.default ? styles.activemodeBox : styles.modeBox)} key={index}>{item.name}</View>
)
})
}
</View>
</View>
<View style={{ height: '100rpx' }}></View>
<View className={styles.bottomBox1}>
<Button className={styles.resetBox1} onClick={() => { handResetStatus() }}> </Button >
<Button className={classnames(StatusIsDisabled ? styles.button1 : styles.activeButton1)} disabled={StatusIsDisabled} onClick={() => handSlectStatus()}> </Button >
</View>
</View>
</Popup>
</View>
)
}
//产品商品元素
interface PropGoods {
list: any[],
obj: {
sale_mode?: number | string
},
handTui?: (any) => void,
handCancel?: (any) => void,
onBlur?: (e: any, obj: any) => void,
onInputEven?: (e: any, obj: any) => void,
handReduce?: (any) => void,
handAdd?: (any) => void,
}
const GoodsItem = memo((porps: PropGoods) => {
const { list = [], obj = {}, handTui, handCancel, onBlur, handReduce, handAdd, onInputEven } = porps
// const [value, setValue] = useState<any>({ count: 1 })
// const onInputEven = (e) => {
// let res = Number(e.detail.value)
// if (res < 1) {
// setValue({ count: 1 })
// } else {
// setValue({ count: res })
// }
// }
return (
<>
{
list.map((item, index) => {
return (
<View className={styles.goodsBox} key={index}>
<View className={styles.goodsProduct}>{item.product_code}# {item.product_name}</View>
<View className={styles.goodsLine}></View>
{
item.av_product_color.map((it, inx) => {
return (
<View className={styles.itemGoods} key={inx}>
<View className={styles.itemPic} style={{ backgroundColor: `rgb(${it?.rgb?.r} ${it?.rgb?.g} ${it?.rgb?.b})` }}></View>
<View className={styles.itemRight}>
<View className={styles.item_right_top}>
<View className={styles.itemName}>{it.product_color_code} {it.product_color_name}</View>
</View>
<View className={styles.item_right_Bottom}>
<View className={styles.itemMoney}>x{obj?.sale_mode === 0 ? it.roll : it.length / 100}{obj?.sale_mode === 0 ? '条' : 'm'}</View>
{
!it.isTui && <View className={styles.btn} onClick={() => handTui?.(it)}>退</View>
}
{
(it.sale_mode != 0 && it.isTui) && <View className={styles.btnOne} onClick={() => handCancel?.(it)}>退</View>
}
{
(it.sale_mode == 0 && it.isTui) && <View className={styles.inputBox} >
<View className={styles.redceBox} onClick={() => handReduce?.(it)}>
<View className={styles.reduce}></View>
</View>
<View className={styles.inputBig}>
<Input type={'number'} value={it.nums} onInput={(e) => onInputEven?.(e, it)} maxlength={it.roll} onBlur={(e) => onBlur?.(e, it)}></Input>
</View>
<View className={styles.addBox} onClick={() => handAdd?.(it)}>
+
</View>
</View>
}
</View>
</View>
</View>
)
})
}
</View>
)
})
}
</>
)
})

View File

@ -65,7 +65,6 @@ export default memo((props: prosObj) => {
}, [obj]) }, [obj])
return ( return (
< > < >

View File

@ -22,7 +22,8 @@ import {
orderPaymentpreCollectOrderorderPaymentSubmission, orderPaymentpreCollectOrderorderPaymentSubmission,
mpsaleOrdercancel, mpsaleOrdercancel,
GetPayCode, GetPayCode,
mpsaleOrderaddress mpsaleOrderaddress,
mpsaleOrderreceive
} from '@/api/order' } from '@/api/order'
import { alert, goLink } from '@/common/common' import { alert, goLink } from '@/common/common'
import { formatPriceDiv, formatDateTime, formatWeightDiv } from '@/common/format' import { formatPriceDiv, formatDateTime, formatWeightDiv } from '@/common/format'
@ -477,6 +478,7 @@ export default () => {
setShowPay(false) setShowPay(false)
getDetail() getDetail()
} else { } else {
Taro.hideLoading()
Taro.showToast({ Taro.showToast({
title: restult?.msg, title: restult?.msg,
icon: 'error' icon: 'error'
@ -505,6 +507,52 @@ export default () => {
}) })
} }
//申请退货
const handApplyGood = () => {
if (infoObj.av_return_product.length == 0) {
return alert.error('暂无货物退')
} else {
Taro.navigateTo({
url: '/pages/applyGoods/index?orderId=' + infoObj.id
})
}
}
//确认收货
const { fetchData: receveFetch } = mpsaleOrderreceive()
const handSureGoods = async () => {
Taro.showModal({
content: "确认收货吗?",
confirmText: "确认",
cancelText: "取消",
success: async function (res) {
if (res.confirm) {
Taro.showLoading({
title: '请稍等...',
mask: true
})
const res = await receveFetch({ id: Number(infoObj.id) })
if (res?.msg === 'success') {
Taro.showToast({
title: '成功'
})
Taro.hideLoading()
setShowMore(false)
getDetail()
} else {
Taro.hideLoading()
Taro.showToast({
title: res?.msg,
icon: 'error'
})
}
}
}
})
}
return ( return (
<View className={styles.mainBox}> <View className={styles.mainBox}>
{(infoObj?.status != 10 && <OrderState orderInfo={infoObj} />)} {(infoObj?.status != 10 && <OrderState orderInfo={infoObj} />)}
@ -587,7 +635,12 @@ export default () => {
} }
{ {
showMore && <View className={styles.posssBox}> showMore && <View className={styles.posssBox}>
<BottomApply obj={infoObj}></BottomApply> <BottomApply
obj={infoObj}
handApplyGoods={() => handApplyGood?.()}
handApplyMoney={() => handApplyMoney?.()}
handSureGoods={() => handSureGoods?.()}
></BottomApply>
</View> </View>
} }
<BottomBtns <BottomBtns

View File

@ -207,6 +207,16 @@ export default () => {
} }
}) })
} }
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 链接列表
});
};
return ( return (
<View className={styles.main}> <View className={styles.main}>
@ -258,7 +268,7 @@ export default () => {
{ {
DeatailObj?.fabric_piece_accessory_url?.length > 0 && DeatailObj?.fabric_piece_accessory_url.map((item, index) => { DeatailObj?.fabric_piece_accessory_url?.length > 0 && DeatailObj?.fabric_piece_accessory_url.map((item, index) => {
return ( return (
<Image className={styles.pic} lazyLoad key={index} <Image className={styles.pic} lazyLoad key={index} onClick={() => proview(item)}
mode="aspectFill" src={IMG_CND_Prefix + item}></Image> mode="aspectFill" src={IMG_CND_Prefix + item}></Image>
) )
}) })

View File

@ -99,6 +99,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
margin-bottom: 10px;
.totalLeft { .totalLeft {
font-size: 28px; font-size: 28px;

View File

@ -11,10 +11,8 @@ import {
returnApplyOrderuploadAccessory returnApplyOrderuploadAccessory
} from "@/api/refound" } from "@/api/refound"
import OrderState from './components/orderState' import OrderState from './components/orderState'
import AddressDetailBox from './components/addressDetailBox' // import AddressDetailBox from './components/addressDetailBox'
import { IMG_CND_Prefix } from "@/common/constant"; import { IMG_CND_Prefix } from "@/common/constant";
import Popup from '@/components/popup';
import UploadImage from '@/components/uploadImage'
export default () => { export default () => {
const router = useRouter() const router = useRouter()
@ -48,23 +46,22 @@ export default () => {
if (it.leftTitle === '其他什么:') { if (it.leftTitle === '其他什么:') {
it.rightTitle = res.data.reason_describe it.rightTitle = res.data.reason_describe
} }
if (it.leftTitle === '货物状况:') { // if (it.leftTitle === '货物状况:') {
it.rightTitle = res.data.goods_status_name // it.rightTitle = res.data.goods_status_name
} // }
if (it.leftTitle === '申请时间:') { if (it.leftTitle === '申请时间:') {
it.rightTitle = formatDateTime(res.data.apply_time) it.rightTitle = formatDateTime(res.data.apply_time)
} }
}) })
setOrderMsg([...orderMsg]) setOrderMsg([...orderMsg])
setPicList([...res.data?.accessory_url !== null ? res.data?.accessory_url : []]) // setPicList([...res.data?.accessory_url !== null ? res.data?.accessory_url : []])
Taro.hideLoading() Taro.hideLoading()
} }
} }
//分辨用质检中还是质检前的数组 //分辨用质检中还是质检前的数组
const productList = useMemo(() => { const productList = useMemo(() => {
if (DeatailObj.stage === 0 || if (DeatailObj.stage == 0 || DeatailObj.type == 3) {
(DeatailObj.sale_mode == 1 && DeatailObj.type == 1) || DeatailObj.stage === 1 || DeatailObj.stage === 2) {
return DeatailObj.product_list return DeatailObj.product_list
} else { } else {
return DeatailObj.quality_check_pass_product return DeatailObj.quality_check_pass_product
@ -96,10 +93,10 @@ export default () => {
leftTitle: '其他什么:', leftTitle: '其他什么:',
rightTitle: '------', rightTitle: '------',
}, },
{ // {
leftTitle: '货物状况:', // leftTitle: '货物状况:',
rightTitle: '------', // rightTitle: '------',
}, // },
{ {
leftTitle: '申请时间:', leftTitle: '申请时间:',
rightTitle: '------', rightTitle: '------',
@ -151,70 +148,49 @@ export default () => {
} }
//查看图片 // //查看图片
const [ShowPic, setShowPic] = useState(false) // const [ShowPic, setShowPic] = useState(false)
const [PicList, setPicList] = useState<any[]>([]) // const [PicList, setPicList] = useState<any[]>([])
const handUp = (value) => { // const handUp = (value) => {
setShowPic(true) // setShowPic(true)
} // }
const onlyRead = useMemo(() => { // const onlyRead = useMemo(() => {
if (DeatailObj.stage == 1) { // if (DeatailObj.stage == 1) {
return false // return false
} else { // } else {
return true // return true
} // }
}, [DeatailObj]) // }, [DeatailObj])
//获取图片列表 // //获取图片列表
const picUrl = useRef([]) // const picUrl = useRef([])
const getImageList = useCallback((list) => { // const getImageList = useCallback((list) => {
picUrl.current = list // picUrl.current = list
}, []) // }, [])
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 { fetchData: sureFetch } = returnApplyOrderuploadAccessory()
const handSure = () => {
let arr: any = []
arr = [...picUrl.current, ...PicList]
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: '取消成功'
})
Taro.hideLoading()
getDetail()
} else {
Taro.showToast({
title: res.msg,
icon: 'error'
})
}
}
}
})
}
return ( return (
<View className={styles.main}> <View className={styles.main}>
<OrderState orderInfo={DeatailObj} /> <OrderState orderInfo={DeatailObj} />
<AddressDetailBox {/* <AddressDetailBox
obj={DeatailObj} obj={DeatailObj}
handUp={() => handUp(DeatailObj)} handUp={() => handUp(DeatailObj)}
></AddressDetailBox> ></AddressDetailBox> */}
<DefaultBox <DefaultBox
showMode={true} showMode={true}
title={'客户信息'} title={'客户信息'}
@ -233,6 +209,38 @@ export default () => {
DeatailObj?.sale_mode == 0 ? DeatailObj?.return_roll : DeatailObj?.total_number / 100 DeatailObj?.sale_mode == 0 ? DeatailObj?.return_roll : DeatailObj?.total_number / 100
} {DeatailObj?.sale_mode == 0 ? "条" : "米"}</View> } {DeatailObj?.sale_mode == 0 ? "条" : "米"}</View>
</View> </View>
{
DeatailObj.stage == 0 && <View className={styles.totalBox}>
<View className={styles.totalLeft}></View>
<View className={styles.totalRight}>{
formatPriceDiv(DeatailObj.total_refund_amount)
}</View>
</View>
}
{
(DeatailObj.stage == 5 || DeatailObj.stage == 6) && <View className={styles.totalBox}>
<View className={styles.totalLeft}>退</View>
<View className={styles.totalRight}>{
formatPriceDiv(DeatailObj.refund_amount)
}</View>
</View>
}
{
(DeatailObj.stage == 5 || DeatailObj.stage == 6) && <View className={styles.totalBox}>
<View className={styles.totalLeft}></View>
<View className={styles.totalRight}>{
formatPriceDiv(DeatailObj.other_deduction_amount)
}</View>
</View>
}
{
(DeatailObj.stage == 5 || DeatailObj.stage == 6) && <View className={styles.totalBox}>
<View className={styles.totalLeft}>退</View>
<View className={styles.totalRight}>{
formatPriceDiv(DeatailObj.refund_flow_name)
}</View>
</View>
}
</DefaultBox> </DefaultBox>
<DefaultBox title={'订单信息'}> <DefaultBox title={'订单信息'}>
{ {
@ -258,7 +266,7 @@ export default () => {
{ {
DeatailObj?.fabric_piece_accessory_url?.length > 0 && DeatailObj?.fabric_piece_accessory_url.map((item, index) => { DeatailObj?.fabric_piece_accessory_url?.length > 0 && DeatailObj?.fabric_piece_accessory_url.map((item, index) => {
return ( return (
<Image className={styles.pic} lazyLoad key={index} <Image className={styles.pic} lazyLoad key={index} onClick={() => proview(item)}
mode="aspectFill" src={IMG_CND_Prefix + item}></Image> mode="aspectFill" src={IMG_CND_Prefix + item}></Image>
) )
}) })
@ -274,13 +282,6 @@ export default () => {
<View className={styles.cancleBtn} onClick={() => handCancle()}>退</View> <View className={styles.cancleBtn} onClick={() => handCancle()}>退</View>
</View> </View>
} }
<Popup title={'查看/修改物流回单'} show={ShowPic} onClose={() => setShowPic(false)}>
<UploadImage onChange={getImageList} defaultList={PicList} onlyRead={onlyRead} />
{
!onlyRead && <View className={styles.picBtn} onClick={() => handSure()}></View>
}
</Popup>
</View> </View>
) )
} }

View File

@ -3,7 +3,7 @@
/* Project id 3619513 */ /* Project id 3619513 */
// url('/src/styles/iconfont.ttf') format('truetype'); // url('/src/styles/iconfont.ttf') format('truetype');
src: src:
url('/src/styles/iconfont.ttf?t=1663556335905') format('truetype'); url('iconfont.ttf?t=1663556335905') format('truetype');
} }
.iconfont { .iconfont {