订单售后v3
This commit is contained in:
parent
d6bb1d1e8a
commit
bd04a6d31b
22
src/api/salesAfterOrder.ts
Normal file
22
src/api/salesAfterOrder.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import { useRequest } from "@/use/useHttp"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 售后订单列表
|
||||||
|
*/
|
||||||
|
export const GetHotSearchApi = () => {
|
||||||
|
return useRequest({
|
||||||
|
url: `/v1/mall/hotSearch/list`,
|
||||||
|
method: "get",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 申请售后订单列表
|
||||||
|
*/
|
||||||
|
export const ReturnApplyOrderApi = () => {
|
||||||
|
return useRequest({
|
||||||
|
url: `/v1/mall/returnApplyOrder`,
|
||||||
|
method: "get",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
@ -60,3 +60,12 @@ import { useRequest } from "@/use/useHttp"
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定公司
|
||||||
|
*/
|
||||||
|
export const BindingCompanyApi = () => {
|
||||||
|
return useRequest({
|
||||||
|
url: `/v1/mall/user/binding/company`,
|
||||||
|
method: "put",
|
||||||
|
})
|
||||||
|
}
|
@ -6,12 +6,12 @@
|
|||||||
// export const BASE_URL = `http://192.168.1.165:40001/lymarket` // 王霞
|
// export const BASE_URL = `http://192.168.1.165:40001/lymarket` // 王霞
|
||||||
// export const BASE_URL = `https://test.zzfzyc.com/lymarket` // 测试环境
|
// export const BASE_URL = `https://test.zzfzyc.com/lymarket` // 测试环境
|
||||||
// export const BASE_URL = `http://192.168.1.30:40001/lymarket` // 发
|
// export const BASE_URL = `http://192.168.1.30:40001/lymarket` // 发
|
||||||
export const BASE_URL = `http://192.168.1.30:50001/lymarket` // 发
|
// export const BASE_URL = `http://192.168.1.30:50001/lymarket` // 发
|
||||||
// export const BASE_URL = `https://dev.zzfzyc.com/lymarket` // 开发环境
|
// export const BASE_URL = `https://dev.zzfzyc.com/lymarket` // 开发环境
|
||||||
// export const BASE_URL = `https://www.zzfzyc.com/lymarket` // 正式环境
|
// export const BASE_URL = `https://www.zzfzyc.com/lymarket` // 正式环境
|
||||||
// export const BASE_URL = `http://192.168.1.5:40001/lymarket` // 王霞
|
// export const BASE_URL = `http://192.168.1.5:40001/lymarket` // 王霞
|
||||||
// export const BASE_URL = `http://192.168.1.224:50001/lymarket` // 添
|
// export const BASE_URL = `http://192.168.1.224:50001/lymarket` // 添
|
||||||
// export const BASE_URL = `http://192.168.1.15:50001/lymarket` // 杰
|
export const BASE_URL = `http://192.168.1.15:50001/lymarket` // 杰
|
||||||
|
|
||||||
// CDN
|
// CDN
|
||||||
// 生成密钥
|
// 生成密钥
|
||||||
|
@ -4,19 +4,25 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
.reduce, .plus{
|
.plus{
|
||||||
font-size: $font_size_big;
|
|
||||||
color: $color_main;
|
color: $color_main;
|
||||||
width: 46px;
|
width: 46px;
|
||||||
height: 46px;
|
height: 46px;
|
||||||
display: flex;
|
text-align: center;
|
||||||
align-items: center;
|
line-height: 43px;
|
||||||
justify-content:center;
|
|
||||||
font-size: 50px;
|
font-size: 50px;
|
||||||
background-color: $color_main;
|
background-color: $color_main;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
|
.reduce {
|
||||||
|
font-size: 50px;
|
||||||
|
width: 46px;
|
||||||
|
height: 46px;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 43px;
|
||||||
|
color:#007AFF;
|
||||||
|
}
|
||||||
.input{
|
.input{
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
@ -25,10 +31,13 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
width: 106px;
|
width: 106px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
|
||||||
input{
|
input{
|
||||||
font-size: $font_size_medium;
|
font-size: $font_size_medium;
|
||||||
|
text-align: right;
|
||||||
|
padding-right: 10px;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.unit{
|
.unit{
|
||||||
font-size: $font_size_min;
|
font-size: $font_size_min;
|
||||||
color: $color_font_two;
|
color: $color_font_two;
|
||||||
|
37
src/components/counter/index1.module.scss
Normal file
37
src/components/counter/index1.module.scss
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
.main{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
width: 100%;
|
||||||
|
.reduce, .plus{
|
||||||
|
font-size: $font_size_big;
|
||||||
|
color: $color_main;
|
||||||
|
width: 46px;
|
||||||
|
height: 46px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content:center;
|
||||||
|
font-size: 50px;
|
||||||
|
background-color: $color_main;
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
.input{
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 5px 10px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 106px;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
input{
|
||||||
|
font-size: $font_size_medium;
|
||||||
|
}
|
||||||
|
.unit{
|
||||||
|
font-size: $font_size_min;
|
||||||
|
color: $color_font_two;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
111
src/components/counter/index1.tsx
Normal file
111
src/components/counter/index1.tsx
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
import { Input, View } from "@tarojs/components"
|
||||||
|
import { useEffect, useMemo, useRef, useState } from "react"
|
||||||
|
import Big from 'big.js'
|
||||||
|
import styles from "./index.module.scss"
|
||||||
|
type params = {
|
||||||
|
minNum?: number, //最小值
|
||||||
|
maxNum?: number, //最大值
|
||||||
|
step?: number, //步长
|
||||||
|
defaultNum?: number, //默认值
|
||||||
|
digits?: number //多少位小数
|
||||||
|
onChange?:(val:number) => void,
|
||||||
|
onBlue?:(val:number) => void, //失去焦点触发
|
||||||
|
onClickBtn?:(val:number) => void,
|
||||||
|
unit?: string
|
||||||
|
}
|
||||||
|
export default ({minNum = 0, maxNum = 100, step=1, digits = 0, defaultNum = 0, onChange, onBlue, onClickBtn, unit = ''}: params) => {
|
||||||
|
const [value, setValue] = useState<any>({count:defaultNum})
|
||||||
|
|
||||||
|
const onPlus = () => {
|
||||||
|
let {count} = value
|
||||||
|
let num_res = Big(count).add(step).toNumber()
|
||||||
|
num_res = num_res >= maxNum?maxNum:num_res
|
||||||
|
num_res = formatDigits(num_res)
|
||||||
|
setValue({...value, count:num_res})
|
||||||
|
onChange?.(parseFloat(num_res))
|
||||||
|
onClickBtn?.(parseFloat(num_res))
|
||||||
|
}
|
||||||
|
const minus = () => {
|
||||||
|
let {count} = value
|
||||||
|
let num_res = Big(count).minus(step).toNumber()
|
||||||
|
num_res = num_res < minNum?0:num_res
|
||||||
|
setValue({...value, count:num_res})
|
||||||
|
onChange?.(parseFloat(num_res))
|
||||||
|
onClickBtn?.(parseFloat(num_res))
|
||||||
|
}
|
||||||
|
|
||||||
|
//保留小数
|
||||||
|
const formatDigits = (num) => {
|
||||||
|
num = num + ''
|
||||||
|
if(num.includes('.')&&digits > 0) {
|
||||||
|
console.log('num::',num.includes('.'))
|
||||||
|
let res = num.split('.')
|
||||||
|
let last_num = res[1].substr(0, digits)
|
||||||
|
return res[0] + '.' + last_num
|
||||||
|
}
|
||||||
|
return parseFloat(num)
|
||||||
|
}
|
||||||
|
|
||||||
|
//检查数据
|
||||||
|
const checkData = (val) => {
|
||||||
|
let num = parseFloat(val)
|
||||||
|
if(num > maxNum) return maxNum
|
||||||
|
if(num < minNum) return minNum
|
||||||
|
return val
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const onInputEven = (e) => {
|
||||||
|
let res = e.detail.value
|
||||||
|
if(res === '') {
|
||||||
|
setValue({...value, count:minNum})
|
||||||
|
onChange?.(minNum)
|
||||||
|
}
|
||||||
|
else if(!isNaN(Number(res))) {
|
||||||
|
let count = formatDigits(res)
|
||||||
|
count = checkData(count)
|
||||||
|
setValue({...value, count})
|
||||||
|
onChange?.(parseFloat(count as string))
|
||||||
|
} else {
|
||||||
|
let num = parseFloat(res)
|
||||||
|
if(!isNaN(num)) {
|
||||||
|
let count = formatDigits(num)
|
||||||
|
count = checkData(count)
|
||||||
|
setValue({...value, count})
|
||||||
|
onChange?.(count as number)
|
||||||
|
} else {
|
||||||
|
setValue({...value, count:defaultNum})
|
||||||
|
onChange?.(defaultNum)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const onBluerEven = () => {
|
||||||
|
let num = parseFloat(value.count)
|
||||||
|
if(!isNaN(num)) {
|
||||||
|
let count = formatDigits(num)
|
||||||
|
count = checkData(count)
|
||||||
|
setValue({...value, count})
|
||||||
|
onBlue?.(count as number)
|
||||||
|
} else {
|
||||||
|
setValue({...value, count:defaultNum})
|
||||||
|
onBlue?.(defaultNum)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<View className={styles.main}>
|
||||||
|
<View className={styles.reduce} onClick={() => minus()}>-</View>
|
||||||
|
<View className={styles.input}>
|
||||||
|
<Input
|
||||||
|
value={String(value.count)}
|
||||||
|
onInput={onInputEven}
|
||||||
|
onBlur={onBluerEven}
|
||||||
|
type='digit'
|
||||||
|
/>
|
||||||
|
<View className={styles.unit}>{unit}</View>
|
||||||
|
</View>
|
||||||
|
<View className={styles.plus} onClick={() => onPlus()}>+</View>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
@ -125,9 +125,14 @@ export default memo(({orderInfo, onClick}:Param) => {
|
|||||||
//点击按钮操作
|
//点击按钮操作
|
||||||
const submitBtns = (val, index) => {
|
const submitBtns = (val, index) => {
|
||||||
(val == 1)&&cancelOrder(); //取消订单按钮
|
(val == 1)&&cancelOrder(); //取消订单按钮
|
||||||
(val == 2)&&onClick?.(2); //去付款按钮
|
|
||||||
(val == 6)&&receiveOrder(); //确认收货
|
(val == 6)&&receiveOrder(); //确认收货
|
||||||
|
if (val == 1) {
|
||||||
|
cancelOrder()
|
||||||
|
} else if (val == 6) {
|
||||||
|
receiveOrder()
|
||||||
|
} else {
|
||||||
|
onClick?.(val)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//取消订单
|
//取消订单
|
||||||
|
@ -0,0 +1,64 @@
|
|||||||
|
.apply_after_sales_list{
|
||||||
|
padding: 0 20px;
|
||||||
|
.apply_after_sales_item{
|
||||||
|
margin-bottom: 50px;
|
||||||
|
.apply_after_sales_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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.color_list {
|
||||||
|
.color_item{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin: 20px 0;
|
||||||
|
}
|
||||||
|
.image{
|
||||||
|
width: 70px;
|
||||||
|
height: 70px;
|
||||||
|
image{
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.name_and_number{
|
||||||
|
padding-left: 30px;
|
||||||
|
flex:1;
|
||||||
|
text{
|
||||||
|
&:nth-child(1) {
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: $font_size;
|
||||||
|
}
|
||||||
|
&:nth-child(2) {
|
||||||
|
color: $color_font_two;
|
||||||
|
font-size: $font_size;
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.btn_count{
|
||||||
|
width: 216px;
|
||||||
|
height: 64px;
|
||||||
|
background-color: #ECF5FF;
|
||||||
|
border-radius: 40px 0px 16px 0px;
|
||||||
|
padding: 0 20px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
43
src/pages/applyAfterSales/components/kindList/index.tsx
Normal file
43
src/pages/applyAfterSales/components/kindList/index.tsx
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
import { formatHashTag, formatImgUrl } from "@/common/fotmat";
|
||||||
|
import Counter from "@/components/counter";
|
||||||
|
import { Image, Text, View } from "@tarojs/components";
|
||||||
|
import { memo, useCallback } from "react";
|
||||||
|
import styles from './index.module.scss'
|
||||||
|
|
||||||
|
type OrderParam = {
|
||||||
|
list?: any[],
|
||||||
|
sale_mode?: number,
|
||||||
|
sale_mode_name?: string,
|
||||||
|
unit?: string,
|
||||||
|
total_colors?: number,
|
||||||
|
total_fabrics?: number,
|
||||||
|
total_number?: number,
|
||||||
|
status?: number, //订单状态
|
||||||
|
}
|
||||||
|
|
||||||
|
export default memo(({order}:{order:OrderParam}) => {
|
||||||
|
//对应数量
|
||||||
|
const formatCount = useCallback((item) => {
|
||||||
|
return (order?.sale_mode == 0? item.roll : Number(item.length / 100)) + order?.unit
|
||||||
|
}, [order])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View className={styles.apply_after_sales_list}>
|
||||||
|
{order?.list?.map(item => <View className={styles.apply_after_sales_item}>
|
||||||
|
<View className={styles.apply_after_sales_title}>
|
||||||
|
<View className={styles.tag}>{order.sale_mode_name}</View>
|
||||||
|
<View className={styles.title}>{formatHashTag(item.code, item.name)}</View>
|
||||||
|
</View>
|
||||||
|
<View className={styles.color_list}>
|
||||||
|
{item.product_colors.map(colorItem => <View className={styles.color_item}>
|
||||||
|
<View className={styles.image}><Image src={formatImgUrl('')}/></View>
|
||||||
|
<View className={styles.name_and_number}><Text>{colorItem.code + ' ' + colorItem.name}</Text><Text>x {formatCount(colorItem)}</Text></View>
|
||||||
|
<View className={styles.btn_count}>
|
||||||
|
<Counter/>
|
||||||
|
</View>
|
||||||
|
</View>)}
|
||||||
|
</View>
|
||||||
|
</View>)}
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
})
|
@ -92,6 +92,9 @@
|
|||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
position: relative;
|
position: relative;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
|
&:nth-child(1) {
|
||||||
|
margin-left: 50px;
|
||||||
|
}
|
||||||
image{
|
image{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@ -114,70 +117,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
.apply_after_sales_list{
|
|
||||||
padding: 0 20px;
|
|
||||||
.apply_after_sales_item{
|
|
||||||
margin-bottom: 50px;
|
|
||||||
.apply_after_sales_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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.color_list {
|
|
||||||
.color_item{
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
margin: 20px 0;
|
|
||||||
}
|
|
||||||
.image{
|
|
||||||
width: 70px;
|
|
||||||
height: 70px;
|
|
||||||
image{
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
border-radius: 50%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.name_and_number{
|
|
||||||
padding-left: 30px;
|
|
||||||
flex:1;
|
|
||||||
text{
|
|
||||||
&:nth-child(1) {
|
|
||||||
font-weight: 700;
|
|
||||||
font-size: $font_size;
|
|
||||||
}
|
|
||||||
&:nth-child(2) {
|
|
||||||
color: $color_font_two;
|
|
||||||
font-size: $font_size;
|
|
||||||
margin-left: 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.btn_count{
|
|
||||||
width: 235px;
|
|
||||||
height: 64px;
|
|
||||||
background-color: #ECF5FF;
|
|
||||||
border-radius: 40px 0px 16px 0px;
|
|
||||||
padding: 0 20px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.btns_con{
|
.btns_con{
|
||||||
|
@ -1,24 +1,77 @@
|
|||||||
import { Image, ScrollView, Text, Textarea, View } from "@tarojs/components";
|
import { Image, ScrollView, Text, Textarea, View } from "@tarojs/components";
|
||||||
import { memo, useCallback, useMemo, useState } from "react";
|
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||||
import classnames from "classnames";
|
import classnames from "classnames";
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import { formatImgUrl } from "@/common/fotmat";
|
import { formatHashTag, formatImgUrl } from "@/common/fotmat";
|
||||||
import Counter from "@/components/counter";
|
import Counter from "@/components/counter";
|
||||||
import ReasonPopup from "./components/reasonPopup";
|
import ReasonPopup from "./components/reasonPopup";
|
||||||
import OtherReason from "./components/otherReason";
|
import OtherReason from "./components/otherReason";
|
||||||
import Taro from "@tarojs/taro";
|
import Taro, { useDidShow, useRouter } from "@tarojs/taro";
|
||||||
import useUploadCDNImg from "@/use/useUploadImage";
|
import useUploadCDNImg from "@/use/useUploadImage";
|
||||||
|
import { GetSaleOrderDetailApi } from "@/api/order";
|
||||||
|
import KindList from "./components/kindList"
|
||||||
|
|
||||||
type ReasonParam = 1|2|3 //1 退货原因 2 货物状况 3 退货说明
|
type ReasonParam = 1|2|3 //1 退货原因 2 货物状况 3 退货说明
|
||||||
export default () => {
|
export default () => {
|
||||||
const [showDesc, setShowDesc] = useState(true)
|
|
||||||
|
const router = useRouter()
|
||||||
|
const orderId = useRef<number>(Number(router.params.id))
|
||||||
|
|
||||||
|
useDidShow(() => {
|
||||||
|
getSaleOrderPreView()
|
||||||
|
})
|
||||||
|
|
||||||
|
//获取订单数据
|
||||||
|
const [orderDetail, setOrderDetail] = useState<any>() //获取到的原始数据
|
||||||
|
const {fetchData: getOrderFetchData} = GetSaleOrderDetailApi()
|
||||||
|
const getSaleOrderPreView = async () => {
|
||||||
|
if(orderId.current) {
|
||||||
|
let res = await getOrderFetchData({id: orderId.current})
|
||||||
|
setOrderDetail(res.data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//监听获取到的数据
|
||||||
|
useEffect(() => {
|
||||||
|
if(orderDetail)
|
||||||
|
formatData()
|
||||||
|
}, [orderDetail])
|
||||||
|
|
||||||
|
//格式化数据格式
|
||||||
|
const [formatDetailOrder, setFormatDetailOrder] = useState<any>() //格式化后的数据
|
||||||
|
const formatData = () => {
|
||||||
|
setFormatDetailOrder({
|
||||||
|
sale_mode: orderDetail.sale_mode,
|
||||||
|
sale_mode_name: orderDetail.sale_mode_name,
|
||||||
|
total_colors: orderDetail.total_colors, //总颜色数量
|
||||||
|
total_number: orderDetail.total_number, //总数量
|
||||||
|
total_fabrics: orderDetail.total_fabrics, //面料数量
|
||||||
|
unit: orderDetail.sale_mode == 0?'条':'m', //单位
|
||||||
|
list: orderDetail.product_list,
|
||||||
|
status: orderDetail.status, //订单状态
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//数据总量
|
||||||
|
const dataCount = useMemo(() => {
|
||||||
|
if(formatDetailOrder) {
|
||||||
|
return `${formatDetailOrder.total_fabrics}种面料,${formatDetailOrder.total_colors}种颜色,共${formatDetailOrder.total_number}条`
|
||||||
|
}
|
||||||
|
}, [formatDetailOrder])
|
||||||
|
|
||||||
|
//对应数量
|
||||||
|
const formatCount = useCallback((item) => {
|
||||||
|
return (formatDetailOrder?.sale_mode == 0? item.roll : Number(item.length / 100)) + formatDetailOrder?.unit
|
||||||
|
}, [formatDetailOrder])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//退货选择弹窗
|
//退货选择弹窗
|
||||||
const [showReason, setShowReason] = useState<{show:true|false, status:ReasonParam}>({show:false, status:1})
|
const [showReason, setShowReason] = useState<{show:true|false, status:ReasonParam}>({show:false, status:1})
|
||||||
const closeReason = useCallback(() => setShowReason({...showReason, show:false}), [])
|
const closeReason = useCallback(() => setShowReason({...showReason, show:false}), [])
|
||||||
const onShowReason = (status) => setShowReason({...showReason, status, show:true})
|
const onShowReason = (status) => setShowReason({...showReason, status, show:true})
|
||||||
|
|
||||||
|
|
||||||
//底部按钮
|
//底部按钮
|
||||||
const onSubmit = (val) => {
|
const onSubmit = (val) => {
|
||||||
|
|
||||||
@ -27,35 +80,10 @@ export default () => {
|
|||||||
return (
|
return (
|
||||||
<View className={styles.apply_after_sales_main}>
|
<View className={styles.apply_after_sales_main}>
|
||||||
<View className={styles.apply_after_sales_con}>
|
<View className={styles.apply_after_sales_con}>
|
||||||
<View className={styles.kind_number}><Text>2种面料,3种颜色,共6条</Text></View>
|
<View className={styles.kind_number}><Text>{dataCount}</Text></View>
|
||||||
<ScrollView scrollY className={styles.scroll}>
|
<ScrollView scrollY className={styles.scroll}>
|
||||||
<View className={styles.scroll_con}>
|
<View className={styles.scroll_con}>
|
||||||
<View className={styles.apply_after_sales_list}>
|
<KindList order={formatDetailOrder}/>
|
||||||
|
|
||||||
{new Array(5).fill(5).map(item => <View className={styles.apply_after_sales_item}>
|
|
||||||
<View className={styles.apply_after_sales_title}>
|
|
||||||
<View className={styles.tag}>大货</View>
|
|
||||||
<View className={styles.title}>0770# 21S单面平纹(食毛)</View>
|
|
||||||
</View>
|
|
||||||
<View className={styles.color_list}>
|
|
||||||
<View className={styles.color_item}>
|
|
||||||
<View className={styles.image}><Image src={formatImgUrl('')}/></View>
|
|
||||||
<View className={styles.name_and_number}><Text>1# 薄荷绿</Text><Text>x1</Text></View>
|
|
||||||
<View className={styles.btn_count}>
|
|
||||||
<Counter/>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View className={styles.color_item}>
|
|
||||||
<View className={styles.image}><Image src={formatImgUrl('')}/></View>
|
|
||||||
<View className={styles.name_and_number}><Text>1# 薄荷绿</Text><Text>x1</Text></View>
|
|
||||||
<View className={styles.btn_count}>
|
|
||||||
<Counter/>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>)}
|
|
||||||
|
|
||||||
</View>
|
|
||||||
<View className={styles.returnSaleInput}>
|
<View className={styles.returnSaleInput}>
|
||||||
<View className={styles.returnSaleInput_item}>
|
<View className={styles.returnSaleInput_item}>
|
||||||
<View className={styles.title}>退货原因</View>
|
<View className={styles.title}>退货原因</View>
|
||||||
@ -103,16 +131,26 @@ export default () => {
|
|||||||
//图片列表
|
//图片列表
|
||||||
const PictureItem = memo(() => {
|
const PictureItem = memo(() => {
|
||||||
const {getWxPhoto} = useUploadCDNImg()
|
const {getWxPhoto} = useUploadCDNImg()
|
||||||
//图片
|
const [imageList, setImageLise] = useState<string[]>([])
|
||||||
|
|
||||||
const uploadImage = async () => {
|
const uploadImage = async () => {
|
||||||
let res = await getWxPhoto('after-sale')
|
let res:any = await getWxPhoto('after-sale')
|
||||||
|
if(res.code == 200) {
|
||||||
|
setImageLise([...imageList, res.url])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除图片
|
||||||
|
const delImage = (index) => {
|
||||||
|
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
{imageList.map((item, index) =>
|
||||||
<View className={styles.ImgItem}>
|
<View className={styles.ImgItem}>
|
||||||
<Image mode="aspectFill" src={formatImgUrl('')} ></Image>
|
<Image mode="aspectFill" src={formatImgUrl(item)} ></Image>
|
||||||
<View className={classnames(styles.miconfont_close, 'iconfont icon-qingkong')}></View>
|
<View onClick={() => delImage(index)} className={classnames(styles.miconfont_close, 'iconfont icon-qingkong')}></View>
|
||||||
</View>
|
</View>)}
|
||||||
<View className={styles.uploadImg } onClick={uploadImage}>
|
<View className={styles.uploadImg } onClick={uploadImage}>
|
||||||
<Text className={classnames(styles.miconfont, 'iconfont icon-saomazhifu')}></Text>
|
<Text className={classnames(styles.miconfont, 'iconfont icon-saomazhifu')}></Text>
|
||||||
<Text className={styles.uploadText}>上传照片</Text>
|
<Text className={styles.uploadText}>上传照片</Text>
|
||||||
|
@ -70,7 +70,8 @@ import AddressInfoDetail from "./components/addressInfoDetail";
|
|||||||
total_fabrics: preViewOrder.total_fabrics, //面料数量
|
total_fabrics: preViewOrder.total_fabrics, //面料数量
|
||||||
unit: preViewOrder.sale_mode == 0?'条':'m', //单位
|
unit: preViewOrder.sale_mode == 0?'条':'m', //单位
|
||||||
list: preViewOrder.product_list,
|
list: preViewOrder.product_list,
|
||||||
total_should_collect_money: preViewOrder.total_should_collect_money //应收金额
|
total_should_collect_money: preViewOrder.total_should_collect_money, //应收金额
|
||||||
|
total_sale_price: preViewOrder.total_sale_price //合计金额
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const formatPreViewOrderMemo = useMemo(() => {
|
const formatPreViewOrderMemo = useMemo(() => {
|
||||||
@ -134,14 +135,15 @@ import AddressInfoDetail from "./components/addressInfoDetail";
|
|||||||
//提交订单
|
//提交订单
|
||||||
const {fetchData: saleOrderFetchData} = SaleOrderApi()
|
const {fetchData: saleOrderFetchData} = SaleOrderApi()
|
||||||
const submitOrderEven = () => {
|
const submitOrderEven = () => {
|
||||||
if(!submitOrderData?.address_id) {
|
|
||||||
alert.error('请选择地址')
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if(!submitOrderData?.shipment_mode) {
|
if(!submitOrderData?.shipment_mode) {
|
||||||
alert.error('请选择收货方式')
|
alert.error('请选择收货方式')
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if(!submitOrderData?.address_id&&submitOrderData?.shipment_mode == 2) {
|
||||||
|
alert.error('请选择地址')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
Taro.showModal({
|
Taro.showModal({
|
||||||
title: '确定提交?',
|
title: '确定提交?',
|
||||||
success: async function (res) {
|
success: async function (res) {
|
||||||
|
@ -40,9 +40,10 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat
|
|||||||
|
|
||||||
const [addressInfo, setAddressInfo] = useState<any>()
|
const [addressInfo, setAddressInfo] = useState<any>()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setAddressInfo(() => orderInfo)
|
if(orderInfo) {
|
||||||
if(orderInfo)
|
|
||||||
setReceivingStatus(() => orderInfo.shipment_mode||2)
|
setReceivingStatus(() => orderInfo.shipment_mode||2)
|
||||||
|
setAddressInfo(() => orderInfo)
|
||||||
|
}
|
||||||
}, [orderInfo])
|
}, [orderInfo])
|
||||||
|
|
||||||
//地址格式
|
//地址格式
|
||||||
|
@ -66,9 +66,14 @@
|
|||||||
font-size: $font_size;
|
font-size: $font_size;
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
}
|
}
|
||||||
.order_list_item_price{
|
.order_list_item_price, .order_list_item_price_dg{
|
||||||
font-size: 26px;
|
font-size: 26px;
|
||||||
color: $color_font_three;
|
color: $color_font_three;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
Text{
|
||||||
|
padding-left: 13px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.order_list_item_count{
|
.order_list_item_count{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { ORDER_STATUS } from "@/common/enum"
|
import { ORDER_STATUS } from "@/common/enum"
|
||||||
import { formatHashTag, formatPriceDiv } from "@/common/fotmat"
|
import { formatHashTag, formatPriceDiv, formatWeightDiv } from "@/common/fotmat"
|
||||||
import LabAndImg from "@/components/LabAndImg"
|
import LabAndImg from "@/components/LabAndImg"
|
||||||
import { View } from "@tarojs/components"
|
import { Text, View } from "@tarojs/components"
|
||||||
import { memo, useCallback, useMemo } from "react"
|
import { memo, useCallback, useMemo } from "react"
|
||||||
import EstimatedAmount from "../estimatedAmount"
|
import EstimatedAmount from "../estimatedAmount"
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
@ -16,7 +16,7 @@ type OrderParam = {
|
|||||||
total_fabrics: number,
|
total_fabrics: number,
|
||||||
total_number: number,
|
total_number: number,
|
||||||
status: number, //订单状态
|
status: number, //订单状态
|
||||||
total_sale_price: number, //销售金额
|
total_sale_price: number, //合计金额
|
||||||
total_should_collect_money: number, //应收金额
|
total_should_collect_money: number, //应收金额
|
||||||
total_weight_error_discount: number, //空差优惠
|
total_weight_error_discount: number, //空差优惠
|
||||||
the_previous_status: number, //取消订单时的订单状态
|
the_previous_status: number, //取消订单时的订单状态
|
||||||
@ -57,7 +57,8 @@ export default memo(({order, comfirm = false}:Param) => {
|
|||||||
SaleOrderStatusComplete, // 已完成
|
SaleOrderStatusComplete, // 已完成
|
||||||
SaleOrderStatusRefund, // 已退款
|
SaleOrderStatusRefund, // 已退款
|
||||||
SaleOrderStatusCancel, // 已取消
|
SaleOrderStatusCancel, // 已取消
|
||||||
SaleorderstatusWaitingPrePayment // 预付款
|
SaleorderstatusWaitingPrePayment, // 预付款
|
||||||
|
SaleOrderStatusTaking //提货
|
||||||
} = ORDER_STATUS
|
} = ORDER_STATUS
|
||||||
|
|
||||||
//金额列表枚举
|
//金额列表枚举
|
||||||
@ -70,7 +71,7 @@ export default memo(({order, comfirm = false}:Param) => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id:2,
|
id:2,
|
||||||
value:[SaleOrderStatusArranged.value, SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value],
|
value:[SaleOrderStatusTaking.value, SaleOrderStatusArranged.value, SaleOrderStatusWaitingPayment.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value],
|
||||||
label:'合计金额',
|
label:'合计金额',
|
||||||
field: 'total_sale_price'
|
field: 'total_sale_price'
|
||||||
},
|
},
|
||||||
@ -88,13 +89,13 @@ export default memo(({order, comfirm = false}:Param) => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id:5,
|
id:5,
|
||||||
value:[SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value],
|
value:[SaleOrderStatusTaking.value, SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value, SaleOrderStatusCancel.value],
|
||||||
label:'实付金额',
|
label:'实付金额',
|
||||||
field: 'actual_amount'
|
field: 'actual_amount'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
//是否显示价格
|
//订单流程是否显示价格
|
||||||
const showPrice = (item) => {
|
const showPrice = (item) => {
|
||||||
if (item.id == 2) {
|
if (item.id == 2) {
|
||||||
//合计金额 (剪板特殊请情况)
|
//合计金额 (剪板特殊请情况)
|
||||||
@ -102,9 +103,10 @@ export default memo(({order, comfirm = false}:Param) => {
|
|||||||
} else {
|
} else {
|
||||||
return (item.value.includes(order.status) && order.sale_mode != 1 )
|
return (item.value.includes(order.status) && order.sale_mode != 1 )
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//金额展示
|
//订单流程金额展示
|
||||||
const priceConDom = useMemo(() => {
|
const priceConDom = useMemo(() => {
|
||||||
if(!order) return
|
if(!order) return
|
||||||
return (
|
return (
|
||||||
@ -118,6 +120,28 @@ export default memo(({order, comfirm = false}:Param) => {
|
|||||||
)
|
)
|
||||||
}, [order])
|
}, [order])
|
||||||
|
|
||||||
|
//确认订单金额展示
|
||||||
|
const comfirmPriceConDom = useMemo(() => {
|
||||||
|
if(!order) return
|
||||||
|
let item = order.sale_mode == 1?priceList[1]:priceList[0]
|
||||||
|
return<EstimatedAmount key={item.id} number={formatPriceDiv(order[item.field])} title={item.label} />
|
||||||
|
}, [order])
|
||||||
|
|
||||||
|
//金额展示
|
||||||
|
const showPriceConDom = useMemo(() => {
|
||||||
|
return comfirm?comfirmPriceConDom:priceConDom
|
||||||
|
}, [order])
|
||||||
|
|
||||||
|
|
||||||
|
//散剪大约重量
|
||||||
|
const aboutWeight = useCallback((weight) => {
|
||||||
|
if(order.sale_mode == 2 ) {
|
||||||
|
let showWeight = [SaleorderstatusWaitingPrePayment.value, SaleOrderStatusBooking.value, SaleOrderStatusArranging.value].includes(order.status)
|
||||||
|
return showWeight?<View className={styles.order_list_item_price_dg}>; <Text>≈{formatWeightDiv(weight)}kg</Text></View>:<></>
|
||||||
|
}
|
||||||
|
return <></>
|
||||||
|
}, [order])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<View className={styles.orders_list_title}>{numText}</View>
|
<View className={styles.orders_list_title}>{numText}</View>
|
||||||
@ -139,7 +163,11 @@ export default memo(({order, comfirm = false}:Param) => {
|
|||||||
<View className={styles.order_list_item_con}>
|
<View className={styles.order_list_item_con}>
|
||||||
<View className={styles.order_list_item_des}>
|
<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_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}>
|
||||||
|
¥{standardPrice(colorItem.sale_price)}
|
||||||
|
{aboutWeight(colorItem.estimate_weight)}
|
||||||
|
</View>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.order_list_item_count}>
|
<View className={styles.order_list_item_count}>
|
||||||
<View className={styles.count_num}>×{formatCount(colorItem)}<text>{order.unit}</text></View>
|
<View className={styles.count_num}>×{formatCount(colorItem)}<text>{order.unit}</text></View>
|
||||||
@ -153,7 +181,7 @@ export default memo(({order, comfirm = false}:Param) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
<View className={styles.order_estimated_amount}>
|
<View className={styles.order_estimated_amount}>
|
||||||
{priceConDom}
|
{showPriceConDom}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
|
@ -93,9 +93,10 @@ import styles from './index.module.scss'
|
|||||||
city_name: orderDetail?.city_name,
|
city_name: orderDetail?.city_name,
|
||||||
district_name: orderDetail?.district_name,
|
district_name: orderDetail?.district_name,
|
||||||
address_detail: orderDetail?.address_detail,
|
address_detail: orderDetail?.address_detail,
|
||||||
// id: address.id,
|
|
||||||
name: orderDetail?.target_user_name,
|
name: orderDetail?.target_user_name,
|
||||||
phone: orderDetail?.target_user_phone
|
phone: orderDetail?.target_user_phone,
|
||||||
|
shipment_mode: orderDetail?.shipment_mode,
|
||||||
|
id: orderDetail?.id
|
||||||
}
|
}
|
||||||
|
|
||||||
}, [orderDetail])
|
}, [orderDetail])
|
||||||
@ -141,12 +142,16 @@ import styles from './index.module.scss'
|
|||||||
|
|
||||||
//获取底部按钮点击, 获取按钮状态
|
//获取底部按钮点击, 获取按钮状态
|
||||||
const orderStateClick = useCallback((val) => {
|
const orderStateClick = useCallback((val) => {
|
||||||
|
console.log('123456789',val)
|
||||||
if(val == 1 || val == 6) {
|
if(val == 1 || val == 6) {
|
||||||
//取消订单
|
//取消订单
|
||||||
getSaleOrderPreView()
|
getSaleOrderPreView()
|
||||||
}else if(val == 2) {
|
}else if(val == 2) {
|
||||||
//待付款
|
//待付款
|
||||||
toPay()
|
toPay()
|
||||||
|
} else if (val == 5) {
|
||||||
|
console.log('aa:::',orderDetail)
|
||||||
|
goLink('/pages/applyAfterSales/index',{id:orderDetail.id})
|
||||||
}
|
}
|
||||||
}, [orderDetail])
|
}, [orderDetail])
|
||||||
|
|
||||||
|
@ -26,87 +26,46 @@
|
|||||||
.order_address_text_title{
|
.order_address_text_title{
|
||||||
font-size: $font_size_medium;
|
font-size: $font_size_medium;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
@include common_ellipsis;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
.moreIconfont{
|
.moreIconfont{
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
}
|
}
|
||||||
|
.address_text{
|
||||||
|
word-break:break-all;
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.order_address_text_name{
|
.order_address_text_name{
|
||||||
|
color: #707070;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
display: flex;
|
||||||
|
margin-top: 20px;
|
||||||
text{
|
text{
|
||||||
&:nth-child(1) {
|
&:nth-child(1) {
|
||||||
color: #000;
|
font-size: $font_size_medium;
|
||||||
font-weight: 700;
|
|
||||||
font-size: $color_font_one;
|
|
||||||
margin-right: 40px;
|
margin-right: 40px;
|
||||||
}
|
}
|
||||||
&:nth-child(2) {
|
&:nth-child(2) {
|
||||||
color: $color_font_one;
|
flex:1;
|
||||||
font-size: $font_size_medium;
|
font-size: $font_size_medium;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.updateBtn{
|
.updateBtn{
|
||||||
width:200px;
|
width:152px;
|
||||||
font-size: $font_size_min;
|
font-size: 28px;
|
||||||
background-color: #F0F0F0;
|
height: 60px;
|
||||||
height: 64px;
|
|
||||||
border-radius: 24px;
|
|
||||||
color: $color_font_two;
|
color: $color_font_two;
|
||||||
position: absolute;
|
|
||||||
bottom: 10px;
|
|
||||||
right: 10px;
|
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
.updateBtn_list{
|
border: 2px solid #dddddd;
|
||||||
position: absolute;
|
border-radius: 36px;
|
||||||
display: flex;
|
|
||||||
z-index: 5;
|
|
||||||
width: 100%;
|
|
||||||
.updateBtn_item_select{
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.updateBtn_item{
|
|
||||||
flex:1;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 64px;
|
line-height: 60px;
|
||||||
}
|
|
||||||
.updateBtn_select{
|
|
||||||
color: #fff;
|
|
||||||
background-color: $color_main;
|
|
||||||
border-radius: 24px;
|
|
||||||
position: absolute;
|
|
||||||
width: 100px;
|
|
||||||
height: 61px;
|
|
||||||
z-index: 1;
|
|
||||||
transition: all 0.3s ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
.order_address_text_no{
|
|
||||||
flex: 1;
|
|
||||||
font-size: $font_size;
|
|
||||||
font-weight: 700;
|
|
||||||
margin-left: 30px;
|
|
||||||
}
|
|
||||||
.order_address_more_icon{
|
|
||||||
color: $color_font_three;
|
|
||||||
font-size: $font_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
.order_address_list {
|
|
||||||
height: 900px;
|
|
||||||
.order_address_title{
|
|
||||||
font-size: $font_size;
|
|
||||||
font-weight: 700;
|
|
||||||
width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
padding: 20px 0 30px 0;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,122 +1,26 @@
|
|||||||
import { EditSaleOrderAddressApi, EditSaleOrderShipmentModeApi } from "@/api/order";
|
|
||||||
import { alert } from "@/common/common";
|
|
||||||
import { debounce } from "@/common/util";
|
|
||||||
import AddressList from "@/components/AddressList";
|
|
||||||
import Popup from "@/components/popup";
|
|
||||||
import { Text, View } from "@tarojs/components"
|
import { Text, View } from "@tarojs/components"
|
||||||
import classnames from "classnames";
|
import classnames from "classnames";
|
||||||
import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useMemo, useState } from "react";
|
import {memo} from "react";
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
|
|
||||||
export type AddressInfoParam = {
|
export default memo(({defaultValue}:{defaultValue:string}) => {
|
||||||
province_name: string,
|
|
||||||
city_name: string,
|
|
||||||
district_name: string,
|
|
||||||
address_detail: string,
|
|
||||||
id?: number,
|
|
||||||
name: string,
|
|
||||||
phone: string,
|
|
||||||
}
|
|
||||||
type Param = {
|
|
||||||
onSelect?: (val:any) => void, //选择
|
|
||||||
defaultValue?: AddressInfoParam|null, //默认值
|
|
||||||
disabled?: false|true, //true禁用后只用于展示
|
|
||||||
shipment_mode?: 1|2, //1自提 2物流
|
|
||||||
onChangeShipmentMode?: (val: number) => void, //返回收货方式
|
|
||||||
orderId?: number //订单id
|
|
||||||
}
|
|
||||||
|
|
||||||
export default memo(forwardRef(({onSelect, onChangeShipmentMode, defaultValue = null, orderId = 0, shipment_mode = 1}: Param, ref) => {
|
|
||||||
const [showAddressList, setShowAddressList] = useState(false)
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setUserInfo(() => defaultValue)
|
|
||||||
}, [defaultValue])
|
|
||||||
|
|
||||||
const [userInfo, setUserInfo] = useState<any>()
|
|
||||||
|
|
||||||
//地址格式
|
|
||||||
const formatAddress = useMemo(() => {
|
|
||||||
if(userInfo)
|
|
||||||
return userInfo.province_name + userInfo.city_name + userInfo.district_name + userInfo.address_detail
|
|
||||||
}, [userInfo])
|
|
||||||
|
|
||||||
const changeShow = () => {
|
|
||||||
if(receivingStatus == 2)
|
|
||||||
setShowAddressList(() => true)
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setReceivingStatus(() => shipment_mode)
|
|
||||||
}, [shipment_mode])
|
|
||||||
|
|
||||||
//把内部方法提供给外部
|
|
||||||
useImperativeHandle(ref, () => ({
|
|
||||||
changeShow
|
|
||||||
}))
|
|
||||||
|
|
||||||
//收货方法,1:自提,2物流
|
|
||||||
const [receivingStatus, setReceivingStatus] = useState(1)
|
|
||||||
const {fetchData: shipmentModeFetchData} = EditSaleOrderShipmentModeApi()
|
|
||||||
const onReceivingStatus = (value, e) => {
|
|
||||||
e.stopPropagation()
|
|
||||||
changeReceivingStatus(value)
|
|
||||||
}
|
|
||||||
const changeReceivingStatus = debounce(async (value) => {
|
|
||||||
alert.loading('正在修改')
|
|
||||||
const res = await shipmentModeFetchData({id: orderId, shipment_mode:value})
|
|
||||||
if(res.success) {
|
|
||||||
alert.success('收货方式修改成功')
|
|
||||||
onChangeShipmentMode?.(value)
|
|
||||||
setReceivingStatus(value)
|
|
||||||
} else {
|
|
||||||
alert.none(res.msg)
|
|
||||||
}
|
|
||||||
}, 10)
|
|
||||||
|
|
||||||
//修改地址
|
|
||||||
const {fetchData: addressFetchData} = EditSaleOrderAddressApi()
|
|
||||||
const getAddress = async (value) => {
|
|
||||||
alert.loading('正在修改')
|
|
||||||
const res = await addressFetchData({id: orderId, address_id: value.id})
|
|
||||||
if(res.success) {
|
|
||||||
alert.success('地址修改成功')
|
|
||||||
onSelect?.(value)
|
|
||||||
setShowAddressList(() => false)
|
|
||||||
setUserInfo(() => value)
|
|
||||||
} else {
|
|
||||||
alert.none(res.msg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
<View className={styles.order_address} onClick={() => changeShow()}>
|
<View className={styles.order_address} >
|
||||||
<View className={classnames(styles.order_address_icon, 'iconfont', receivingStatus == 2?'icon-daohang':'icon-fahuo')}></View>
|
<View className={classnames(styles.order_address_icon, 'iconfont','icon-fahuo')}></View>
|
||||||
<View className={styles.order_address_text_con}>
|
<View className={styles.order_address_text_con}>
|
||||||
<View className={styles.order_address_text_title}>
|
<View className={styles.order_address_text_title}>
|
||||||
<Text>{formatAddress}</Text>
|
<Text className={classnames(styles.address_text, styles.address_text_no)}>{defaultValue}</Text>
|
||||||
{(receivingStatus == 2)&&<Text className={classnames(styles.moreIconfont,'iconfont icon-a-moreback')}></Text>}
|
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.order_address_text_name}>
|
<View className={styles.order_address_text_name}>
|
||||||
<Text>{userInfo?.name}</Text>
|
<Text>管理员</Text>
|
||||||
<Text>{userInfo?.phone}</Text>
|
<Text>13939399536</Text>
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View className={styles.updateBtn}>
|
<View className={styles.updateBtn}>
|
||||||
<View className={styles.updateBtn_list}>
|
上传物流
|
||||||
<View className={classnames(styles.updateBtn_item, receivingStatus==1&&styles.updateBtn_item_select)} onClick={(e) => onReceivingStatus(1,e)}>自提</View>
|
</View>
|
||||||
<View className={classnames(styles.updateBtn_item, receivingStatus==2&&styles.updateBtn_item_select)} onClick={(e) => onReceivingStatus(2,e)}>物流</View>
|
|
||||||
</View>
|
|
||||||
<View style={{transform: receivingStatus==1?'translateX(0)':'translateX(100%)'}} className={classnames(styles.updateBtn_select)}></View>
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<Popup show={showAddressList} showTitle={false} onClose={() => setShowAddressList(false)}>
|
|
||||||
<View className={styles.order_address_list}>
|
|
||||||
<View className={styles.order_address_title}>请选择收货地址</View>
|
|
||||||
<AddressList onSelect={getAddress}/>
|
|
||||||
</View>
|
</View>
|
||||||
</Popup>
|
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}))
|
})
|
@ -61,7 +61,7 @@ export default memo(({order, comfirm = false}:Param) => {
|
|||||||
{
|
{
|
||||||
id:1,
|
id:1,
|
||||||
value:[SaleOrderStatusBooking.value, SaleOrderStatusArranging.value],
|
value:[SaleOrderStatusBooking.value, SaleOrderStatusArranging.value],
|
||||||
label:'预估金额',
|
label:'扣款金额',
|
||||||
field: 'estimate_amount'
|
field: 'estimate_amount'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -12,6 +12,7 @@ import { Image, Text, Textarea, View } from "@tarojs/components"
|
|||||||
import Taro, {useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro";
|
import Taro, {useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro";
|
||||||
import classnames from "classnames";
|
import classnames from "classnames";
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState, memo } from "react";
|
import { useCallback, useEffect, useMemo, useRef, useState, memo } from "react";
|
||||||
|
import AddressInfoDetail from "./components/addressInfoDetail";
|
||||||
import ContentBox from "./components/contentBox";
|
import ContentBox from "./components/contentBox";
|
||||||
import KindList from "./components/kindList";
|
import KindList from "./components/kindList";
|
||||||
import OrderState from "./components/orderState";
|
import OrderState from "./components/orderState";
|
||||||
@ -101,6 +102,7 @@ import styles from './index.module.scss'
|
|||||||
return (
|
return (
|
||||||
<View className={styles.order_main}>
|
<View className={styles.order_main}>
|
||||||
<OrderState list={orderDetail?.logistics_details} payment_method={orderDetail?.payment_method}/>
|
<OrderState list={orderDetail?.logistics_details} payment_method={orderDetail?.payment_method}/>
|
||||||
|
<AddressInfoDetail defaultValue="广东省佛山市禅城区阿萨的飞机螺丝钉解放" />
|
||||||
<KindList order={formatPreViewOrderMemo}/>
|
<KindList order={formatPreViewOrderMemo}/>
|
||||||
<OrderDes/>
|
<OrderDes/>
|
||||||
{(orderDetail?.status != SaleOrderStatusCancel.value)&&<View className={styles.submit_order}>
|
{(orderDetail?.status != SaleOrderStatusCancel.value)&&<View className={styles.submit_order}>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import useUserInfo from "./useUserInfo"
|
import useUserInfo from "./useUserInfo"
|
||||||
import Taro, { useRouter } from "@tarojs/taro"
|
import Taro, { useRouter } from "@tarojs/taro"
|
||||||
import { GetWxUserInfoApi, GetAdminUserInfoApi, GetPhoneNumberApi } from "@/api/user"
|
import { GetWxUserInfoApi, GetAdminUserInfoApi, GetPhoneNumberApi, BindingCompanyApi } from "@/api/user"
|
||||||
import useLoginRequest from "./useLoginRequest"
|
import useLoginRequest from "./useLoginRequest"
|
||||||
import { SHARE_SCENE } from "@/common/enum"
|
import { SHARE_SCENE } from "@/common/enum"
|
||||||
import { GetShortCodeApi } from "@/api/share"
|
import { GetShortCodeApi } from "@/api/share"
|
||||||
@ -93,6 +93,7 @@ export default () => {
|
|||||||
|
|
||||||
//获取手机号码
|
//获取手机号码
|
||||||
const {fetchData: fetchDataUserPhone} = GetPhoneNumberApi()
|
const {fetchData: fetchDataUserPhone} = GetPhoneNumberApi()
|
||||||
|
const {fetchData: fetchBindingCompany} = BindingCompanyApi()
|
||||||
const getPhoneNumber = (code) => {
|
const getPhoneNumber = (code) => {
|
||||||
return new Promise( async (reslove, reject) => {
|
return new Promise( async (reslove, reject) => {
|
||||||
if(userInfo.adminUserInfo?.is_authorize_phone) {
|
if(userInfo.adminUserInfo?.is_authorize_phone) {
|
||||||
@ -102,6 +103,7 @@ export default () => {
|
|||||||
const res = await fetchDataUserPhone({code})
|
const res = await fetchDataUserPhone({code})
|
||||||
if(res.success) {
|
if(res.success) {
|
||||||
setUserInfo({...userInfo.userInfo, phone:res.data.phone_number})
|
setUserInfo({...userInfo.userInfo, phone:res.data.phone_number})
|
||||||
|
await fetchBindingCompany()
|
||||||
getAdminUserInfo()
|
getAdminUserInfo()
|
||||||
reslove(res.data)
|
reslove(res.data)
|
||||||
} else {
|
} else {
|
||||||
|
@ -126,7 +126,7 @@ export default () => {
|
|||||||
const getWxPhoto = (cdn_upload_type: cdn_upload_type_Param) => {
|
const getWxPhoto = (cdn_upload_type: cdn_upload_type_Param) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
Taro.chooseImage({
|
Taro.chooseImage({
|
||||||
count: 1, // 默认9
|
count: 1,
|
||||||
sizeType: ['original', 'compressed'],
|
sizeType: ['original', 'compressed'],
|
||||||
sourceType: ['album', 'camera'],
|
sourceType: ['album', 'camera'],
|
||||||
success: async function (res) {
|
success: async function (res) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user