(优化):
This commit is contained in:
parent
133e6414fa
commit
af34945fda
@ -7,9 +7,9 @@ module.exports = {
|
|||||||
CURRENT_BASE_URL: '"https://www.zzfzyc.com/lymarket"',
|
CURRENT_BASE_URL: '"https://www.zzfzyc.com/lymarket"',
|
||||||
},
|
},
|
||||||
mini: {
|
mini: {
|
||||||
optimizeMainPackage: {
|
// optimizeMainPackage: {
|
||||||
enable: true,
|
// enable: true,
|
||||||
},
|
// },
|
||||||
webpackChain: (chain, webpack) => {
|
webpackChain: (chain, webpack) => {
|
||||||
chain.merge({
|
chain.merge({
|
||||||
plugin: {
|
plugin: {
|
||||||
@ -18,7 +18,7 @@ module.exports = {
|
|||||||
args: [
|
args: [
|
||||||
{
|
{
|
||||||
terserOptions: {
|
terserOptions: {
|
||||||
// compress: true, // 默认使用terser压缩
|
compress: true, // 默认使用terser压缩
|
||||||
compress: {
|
compress: {
|
||||||
drop_console: true, // 去掉打印
|
drop_console: true, // 去掉打印
|
||||||
}, // 默认使用terser压缩
|
}, // 默认使用terser压缩
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Taro from "@tarojs/taro"
|
import Taro from '@tarojs/taro'
|
||||||
import Qs from 'qs'
|
import Qs from 'qs'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -7,37 +7,34 @@ import Qs from 'qs'
|
|||||||
* @param params
|
* @param params
|
||||||
* @param type false 跳转普通页面,true 跳转tabbar页面
|
* @param type false 跳转普通页面,true 跳转tabbar页面
|
||||||
*/
|
*/
|
||||||
type ParamLink = 'navigateTo'|'switchTab'|'reLaunch'|'redirectTo'
|
type ParamLink = 'navigateTo' | 'switchTab' | 'reLaunch' | 'redirectTo'
|
||||||
export const goLink = (path = '', params = {}, way: ParamLink = 'navigateTo') => {
|
export const goLink = (path = '', params = null, way: ParamLink = 'navigateTo') => {
|
||||||
if(path) {
|
if (path) {
|
||||||
let params_str = Qs.stringify(params)
|
let params_str = Qs.stringify(params || {})
|
||||||
console.log('params_str::',params_str)
|
path = params_str ? path + '?' + params_str : path
|
||||||
path = params_str?path+'?'+params_str:path
|
|
||||||
console.log('path::', way)
|
console.log('path::', way)
|
||||||
Taro[way]({url: path})
|
Taro[way]({ url: path })
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 判断对象为空
|
* 判断对象为空
|
||||||
* @param object
|
* @param object
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export const isEmptyObject = (object: any)=>{
|
export const isEmptyObject = (object: any) => {
|
||||||
if(object==undefined||object==null||Number.isNaN(object)){
|
if (object == undefined || object == null || Number.isNaN(object)) {
|
||||||
return true;
|
return true
|
||||||
}else{
|
} else {
|
||||||
if(object.constructor==Object){
|
if (object.constructor == Object) {
|
||||||
return Reflect.ownKeys(object).length==0;
|
return Reflect.ownKeys(object).length == 0
|
||||||
}else if(object.constructor==Array){
|
} else if (object.constructor == Array) {
|
||||||
return object.length==0;
|
return object.length == 0
|
||||||
}else if(object.constructor==String){
|
} else if (object.constructor == String) {
|
||||||
return object=="";
|
return object == ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表单检索
|
* 表单检索
|
||||||
@ -58,86 +55,90 @@ export const isEmptyObject = (object: any)=>{
|
|||||||
* @param message
|
* @param message
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export const retrieval = (data: any, rules?: Object, message: string="请填写完信息")=>{
|
export const retrieval = (data: any, rules?: Object, message: string = '请填写完信息') => {
|
||||||
return new Promise((resolve, reject)=>{
|
return new Promise((resolve, reject) => {
|
||||||
if(rules){
|
if (rules) {
|
||||||
const keys = Reflect.ownKeys(rules);
|
const keys = Reflect.ownKeys(rules)
|
||||||
const result = keys.some((key:any)=>{
|
const result = keys.some((key: any) => {
|
||||||
for(let item of (rules as any)[key]){
|
for (let item of (rules as any)[key]) {
|
||||||
|
let _res = false
|
||||||
let _res = false;
|
if (item.validator) {
|
||||||
if(item.validator){
|
if (item.validator(data[key], item)) {
|
||||||
if(item.validator(data[key],item)){
|
_res = true
|
||||||
_res=true;
|
|
||||||
}
|
}
|
||||||
}else if(item.regex){
|
} else if (item.regex) {
|
||||||
if(!item.regex.test(data[key])){
|
if (!item.regex.test(data[key])) {
|
||||||
_res=true;
|
_res = true
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
if(isEmptyObject(data[key])){
|
if (isEmptyObject(data[key])) {
|
||||||
_res=true;
|
_res = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
message = item.message;
|
message = item.message
|
||||||
return _res;
|
return _res
|
||||||
}
|
}
|
||||||
});
|
|
||||||
if(result){
|
|
||||||
reject(message);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
const keys = Reflect.ownKeys(data);
|
|
||||||
if(keys.some((key:any)=>isEmptyObject(data[key]))){
|
|
||||||
reject(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
resolve(null);
|
|
||||||
})
|
})
|
||||||
|
if (result) {
|
||||||
|
reject(message)
|
||||||
}
|
}
|
||||||
/**
|
} else {
|
||||||
|
const keys = Reflect.ownKeys(data)
|
||||||
|
if (keys.some((key: any) => isEmptyObject(data[key]))) {
|
||||||
|
reject(message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resolve(null)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/**
|
||||||
* toast提示
|
* toast提示
|
||||||
*/
|
*/
|
||||||
export const alert = {
|
export const alert = {
|
||||||
success(title: string){
|
success(title: string) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title,icon: "success"
|
title,
|
||||||
|
icon: 'success',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
error(title: string){
|
error(title: string) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title,icon: "error"
|
title,
|
||||||
|
icon: 'error',
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
loading(title: string, mask: true|false = false){
|
loading(title: string, mask: true | false = false) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title,icon: "loading",
|
title,
|
||||||
mask
|
icon: 'loading',
|
||||||
|
mask,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
none(title: string){
|
none(title: string) {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title,icon: "none"
|
title,
|
||||||
|
icon: 'none',
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
showLoading(title: string, mask: true|false = true) {
|
showLoading(title: string, mask: true | false = true) {
|
||||||
Taro.showLoading({title, mask})
|
Taro.showLoading({ title, mask })
|
||||||
},
|
},
|
||||||
hideLoading() {
|
hideLoading() {
|
||||||
Taro.hideLoading()
|
Taro.hideLoading()
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// 金额千位分割符
|
// 金额千位分割符
|
||||||
export const formatKbPrice = (number: string) => {
|
export const formatKbPrice = (number: string) => {
|
||||||
const ret = Array.from(number).reverse().reduce((result: string[],next,i,arr) => {
|
const ret = Array.from(number)
|
||||||
if((i+1)%3 === 0 && (i+1) !== arr.length) {
|
.reverse()
|
||||||
result.push(next,',')
|
.reduce((result: string[], next, i, arr) => {
|
||||||
return result;
|
if ((i + 1) % 3 === 0 && i + 1 !== arr.length) {
|
||||||
|
result.push(next, ',')
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
result.push(next);
|
result.push(next)
|
||||||
return result;
|
return result
|
||||||
},[])
|
}, [])
|
||||||
return ret.reverse().join('');
|
return ret.reverse().join('')
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export const BASE_URL = CURRENT_BASE_URL
|
// export const BASE_URL = CURRENT_BASE_URL
|
||||||
// export const BASE_URL = `http://192.168.0.75:50001/lymarket`
|
// export const BASE_URL = `http://192.168.0.75:50001/lymarket`
|
||||||
// export const BASE_URL = `http://192.168.0.89:50001/lymarket`
|
// export const BASE_URL = `http://192.168.0.89:50001/lymarket`
|
||||||
// export const BASE_URL = `http://10.0.0.5:50001/lymarket`
|
// export const BASE_URL = `http://10.0.0.5:50001/lymarket`
|
||||||
@ -12,7 +12,8 @@ export const BASE_URL = CURRENT_BASE_URL
|
|||||||
// 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.7:50002/lymarket` // 添
|
// export const BASE_URL = `http://192.168.1.7:50001/lymarket` // 添
|
||||||
|
export const BASE_URL = `http://192.168.1.22:50002/lymarket` // 婷
|
||||||
// export const BASE_URL = `http://192.168.1.42:50002/lymarket` // 杰
|
// export const BASE_URL = `http://192.168.1.42:50002/lymarket` // 杰
|
||||||
|
|
||||||
// CDN
|
// CDN
|
||||||
@ -22,6 +23,7 @@ export const UPLOAD_CDN_URL = `https://v0.api.upyun.com/`
|
|||||||
|
|
||||||
// cdn
|
// cdn
|
||||||
export const IMG_CND_Prefix = CURRENT_ENV.includes('production') ? 'https://cdn.zzfzyc.com' : 'https://test.cdn.zzfzyc.com'
|
export const IMG_CND_Prefix = CURRENT_ENV.includes('production') ? 'https://cdn.zzfzyc.com' : 'https://test.cdn.zzfzyc.com'
|
||||||
|
// export const IMG_CND_Prefix = CURRENT_ENV.includes('production') ? 'https://cdn.zzfzyc.com' : 'https://cdn.zzfzyc.com'
|
||||||
|
|
||||||
//在线支付图片baseUrl
|
//在线支付图片baseUrl
|
||||||
export const CAP_HTML_TO_IMAGE_BASE_URL = CURRENT_ENV.includes('production') ? 'https://www.zzfzyc.com' : 'https://test.zzfzyc.com'
|
export const CAP_HTML_TO_IMAGE_BASE_URL = CURRENT_ENV.includes('production') ? 'https://www.zzfzyc.com' : 'https://test.zzfzyc.com'
|
||||||
|
@ -7,7 +7,7 @@ import LabAndImgShow from '../LabAndImgShow'
|
|||||||
|
|
||||||
//该组件宽高为100%需调整外层元素宽高
|
//该组件宽高为100%需调整外层元素宽高
|
||||||
type Param = {
|
type Param = {
|
||||||
value?: {
|
value: {
|
||||||
texture_url?: string //纹理图路径
|
texture_url?: string //纹理图路径
|
||||||
lab?: { l: number; a: number; b: number } //lab
|
lab?: { l: number; a: number; b: number } //lab
|
||||||
rgb?: { r: number; g: number; b: number } //rgb
|
rgb?: { r: number; g: number; b: number } //rgb
|
||||||
@ -21,7 +21,7 @@ export default memo(({ value, onClick, showStatus = false }: Param) => {
|
|||||||
|
|
||||||
//lab是否都是0
|
//lab是否都是0
|
||||||
const rgbStyle = useMemo(() => {
|
const rgbStyle = useMemo(() => {
|
||||||
if (value?.lab && (value.lab.l || value.lab.a || value.lab.b)) {
|
if (value?.lab && (value?.lab.l || value?.lab.a || value?.lab.b)) {
|
||||||
return { backgroundColor: `rgb(${value.rgb?.r} ${value.rgb?.g} ${value.rgb?.b})` }
|
return { backgroundColor: `rgb(${value.rgb?.r} ${value.rgb?.g} ${value.rgb?.b})` }
|
||||||
} else {
|
} else {
|
||||||
return null
|
return null
|
||||||
@ -30,10 +30,10 @@ export default memo(({ value, onClick, showStatus = false }: Param) => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (value?.texture_url) {
|
if (value?.texture_url) {
|
||||||
let res = value.texture_url.split(',').map((item) => {
|
let imgs = value.texture_url.split(',').map((item) => {
|
||||||
return formatImgUrl(item)
|
return formatImgUrl(item)
|
||||||
})
|
})
|
||||||
setImgs(() => res)
|
setImgs(() => imgs)
|
||||||
}
|
}
|
||||||
}, [value])
|
}, [value])
|
||||||
|
|
||||||
@ -41,6 +41,7 @@ export default memo(({ value, onClick, showStatus = false }: Param) => {
|
|||||||
const closeLabAndImgShow = useCallback(() => {
|
const closeLabAndImgShow = useCallback(() => {
|
||||||
setLabAndImgShow(false)
|
setLabAndImgShow(false)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const onShowLabAndImg = () => {
|
const onShowLabAndImg = () => {
|
||||||
onClick?.(value)
|
onClick?.(value)
|
||||||
if (!showStatus) return false
|
if (!showStatus) return false
|
||||||
@ -50,9 +51,9 @@ export default memo(({ value, onClick, showStatus = false }: Param) => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<View className={styles.labAndImg_main} onClick={() => onShowLabAndImg()}>
|
<View className={styles.labAndImg_main} onClick={() => onShowLabAndImg()}>
|
||||||
{imgs?.length > 0 && <Image mode='aspectFill' src={imgs[0]} className={styles.labAndImg_image}></Image>}
|
{value.texture_url && <Image mode='aspectFill' src={imgs[0]} className={styles.labAndImg_image}></Image>}
|
||||||
{!imgs?.length && rgbStyle && <View className={styles.boxColor} style={{ ...rgbStyle }}></View>}
|
{!value.texture_url && rgbStyle && <View className={styles.boxColor} style={{ ...rgbStyle }}></View>}
|
||||||
{!imgs?.length && !rgbStyle && <Image mode='aspectFill' src={formatImgUrl('')} className={styles.labAndImg_image}></Image>}
|
{!value.texture_url && !rgbStyle && <Image mode='aspectFill' src={formatImgUrl('')} className={styles.labAndImg_image}></Image>}
|
||||||
</View>
|
</View>
|
||||||
<LabAndImgShow value={value} show={labAndImgShow} onClose={closeLabAndImgShow} />
|
<LabAndImgShow value={value} show={labAndImgShow} onClose={closeLabAndImgShow} />
|
||||||
</>
|
</>
|
||||||
|
@ -1,50 +1,45 @@
|
|||||||
import { alert } from "@/common/common"
|
import { alert } from '@/common/common'
|
||||||
import { AFTER_ORDER_STATUS, ORDER_STATUS, REFUND_STATUS_ORDER, SALE_MODE } from "@/common/enum"
|
import { AFTER_ORDER_STATUS, ORDER_STATUS, REFUND_STATUS_ORDER, SALE_MODE } from '@/common/enum'
|
||||||
import {Text, View } from "@tarojs/components"
|
import { Text, View } from '@tarojs/components'
|
||||||
import Taro from "@tarojs/taro"
|
import Taro from '@tarojs/taro'
|
||||||
import {useRef, memo, useState, useMemo } from "react"
|
import { useRef, memo, useState, useMemo } from 'react'
|
||||||
import classnames from "classnames";
|
import classnames from 'classnames'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import { ReturnApplyOrderCancelApi } from "@/api/salesAfterOrder"
|
import { ReturnApplyOrderCancelApi } from '@/api/salesAfterOrder'
|
||||||
import { throttle } from "@/common/util"
|
import { throttle } from '@/common/util'
|
||||||
|
|
||||||
type Param = {
|
type Param = {
|
||||||
orderInfo: {
|
orderInfo: {
|
||||||
stage: number, //售后状态
|
stage: number //售后状态
|
||||||
sale_mode: number, //订单类型
|
sale_mode: number //订单类型
|
||||||
type: number, //1退货,2退款
|
type: number //1退货,2退款
|
||||||
return_apply_order_id: number //售后申请单
|
return_apply_order_id: number //售后申请单
|
||||||
is_quality_check: true|false //质检结果
|
is_quality_check: true | false //质检结果
|
||||||
},
|
}
|
||||||
onClick?: (val: number) => void, //点击后触发的事件,返回订单状态
|
onClick?: (val: number) => void //点击后触发的事件,返回订单状态
|
||||||
fixedBottom?: true|false, //是否固定在底部
|
fixedBottom?: true | false //是否固定在底部
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => {
|
export default memo(({ orderInfo, onClick, fixedBottom = true }: Param) => {
|
||||||
//售后订单状态
|
//售后订单状态
|
||||||
const {
|
const { ReturnStageApplying, ReturnStageWaitCheck, ReturnStageReturned, ReturnStageQualityCheckPendingRefund, ReturnStageServiceOrderPendingRefund } =
|
||||||
ReturnStageApplying,
|
AFTER_ORDER_STATUS
|
||||||
ReturnStageWaitCheck,
|
|
||||||
ReturnStageReturned,
|
|
||||||
ReturnStageQualityCheckPendingRefund,
|
|
||||||
ReturnStageServiceOrderPendingRefund,
|
|
||||||
} = AFTER_ORDER_STATUS
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
ReturnApplyOrderTypeAdvanceReceiptRefund, // 预收退款
|
ReturnApplyOrderTypeAdvanceReceiptRefund, // 预收退款
|
||||||
ReturnApplyOrderTypeReturnForRefund, // 退货退款
|
ReturnApplyOrderTypeReturnForRefund, // 退货退款
|
||||||
ReturnApplyOrderTypeSalesRefund // 销售退款
|
ReturnApplyOrderTypeSalesRefund, // 销售退款
|
||||||
} = REFUND_STATUS_ORDER
|
} = REFUND_STATUS_ORDER
|
||||||
|
|
||||||
//注册按钮
|
//注册按钮
|
||||||
type orderBtnsListParams = {id: number, label: string, validatarFunc: (val: typeof orderInfo) => any}
|
type orderBtnsListParams = { id: number; label: string; validatarFunc: (val: typeof orderInfo) => any }
|
||||||
const orderBtnsList = useRef<orderBtnsListParams[]>([
|
const orderBtnsList = useRef<orderBtnsListParams[]>([
|
||||||
{
|
{
|
||||||
id: 8,
|
id: 8,
|
||||||
label: '申请记录',
|
label: '申请记录',
|
||||||
validatarFunc: (orderInfo) => {
|
validatarFunc: (orderInfo) => {
|
||||||
if(orderInfo.sale_mode !== 1) return [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value].includes(orderInfo.stage)
|
if (orderInfo.sale_mode !== 1)
|
||||||
|
return [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value].includes(orderInfo.stage)
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -52,64 +47,64 @@ export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => {
|
|||||||
id: 1,
|
id: 1,
|
||||||
label: '取消退货',
|
label: '取消退货',
|
||||||
validatarFunc: (orderInfo) => {
|
validatarFunc: (orderInfo) => {
|
||||||
if(orderInfo?.sale_mode != 1 && orderInfo.type == ReturnApplyOrderTypeReturnForRefund.value) return [ReturnStageApplying.value, ReturnStageWaitCheck.value].includes(orderInfo.stage)
|
if (orderInfo?.sale_mode != 1 && orderInfo.type == ReturnApplyOrderTypeReturnForRefund.value)
|
||||||
|
return [ReturnStageApplying.value, ReturnStageWaitCheck.value].includes(orderInfo.stage)
|
||||||
return false
|
return false
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
label: '质检结果',
|
label: '质检结果',
|
||||||
validatarFunc: (orderInfo) => {
|
validatarFunc: (orderInfo) => {
|
||||||
return orderInfo?.is_quality_check
|
return orderInfo?.is_quality_check
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 5,
|
id: 5,
|
||||||
label: '上传物流',
|
label: '上传物流',
|
||||||
validatarFunc: (orderInfo) => {
|
validatarFunc: (orderInfo) => {
|
||||||
return orderInfo?.stage == ReturnStageWaitCheck.value
|
return orderInfo?.stage == ReturnStageWaitCheck.value
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 6,
|
id: 6,
|
||||||
label: '取消退款',
|
label: '取消退款',
|
||||||
validatarFunc: (orderInfo) => {
|
validatarFunc: (orderInfo) => {
|
||||||
if (orderInfo?.sale_mode != 1 && orderInfo.type != ReturnApplyOrderTypeReturnForRefund.value) return [ReturnStageApplying.value, ReturnStageServiceOrderPendingRefund.value]?.includes(orderInfo.stage)
|
if (orderInfo?.sale_mode != 1 && orderInfo.type != ReturnApplyOrderTypeReturnForRefund.value)
|
||||||
|
return [ReturnStageApplying.value, ReturnStageServiceOrderPendingRefund.value]?.includes(orderInfo.stage)
|
||||||
if (orderInfo?.sale_mode == 1) return [ReturnStageApplying.value].includes(orderInfo.stage)
|
if (orderInfo?.sale_mode == 1) return [ReturnStageApplying.value].includes(orderInfo.stage)
|
||||||
return false
|
return false
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
//显示的按钮数组
|
//显示的按钮数组
|
||||||
const orderBtnsShowList: any[] = useMemo(() => {
|
const orderBtnsShowList: any[] = useMemo(() => {
|
||||||
return orderBtnsList.current.filter(item => {
|
return orderBtnsList.current.filter((item) => {
|
||||||
return item.validatarFunc(orderInfo)
|
return item.validatarFunc(orderInfo)
|
||||||
})
|
})
|
||||||
}, [orderInfo])
|
}, [orderInfo])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//点击按钮操作
|
//点击按钮操作
|
||||||
const submitBtns = throttle((val, index) => {
|
const submitBtns = throttle((val, index) => {
|
||||||
if (val == 1) {
|
if (val == 1) {
|
||||||
cancelOrder({title:'要取消退货吗?', val})
|
cancelOrder({ title: '要取消退货吗?', val })
|
||||||
} else if (val == 6) {
|
} else if (val == 6) {
|
||||||
cancelOrder({title:'要取消退款吗?', val})
|
cancelOrder({ title: '要取消退款吗?', val })
|
||||||
} else {
|
} else {
|
||||||
onClick?.(val)
|
onClick?.(val)
|
||||||
}
|
}
|
||||||
}, 600)
|
}, 600)
|
||||||
|
|
||||||
//取消退货/退款
|
//取消退货/退款
|
||||||
const {fetchData: returnApplyOrderCancelFetchData} = ReturnApplyOrderCancelApi()
|
const { fetchData: returnApplyOrderCancelFetchData } = ReturnApplyOrderCancelApi()
|
||||||
const cancelOrder = ({title = '', val}) => {
|
const cancelOrder = ({ title = '', val }) => {
|
||||||
Taro.showModal({
|
Taro.showModal({
|
||||||
title,
|
title,
|
||||||
success: async function (res) {
|
success: async function (res) {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
let res = await returnApplyOrderCancelFetchData({id: orderInfo?.return_apply_order_id})
|
let res = await returnApplyOrderCancelFetchData({ id: orderInfo?.return_apply_order_id })
|
||||||
if(res.success) {
|
if (res.success) {
|
||||||
alert.success('取消成功')
|
alert.success('取消成功')
|
||||||
onClick?.(val)
|
onClick?.(val)
|
||||||
} else {
|
} else {
|
||||||
@ -118,39 +113,56 @@ export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => {
|
|||||||
} else if (res.cancel) {
|
} else if (res.cancel) {
|
||||||
console.log('用户点击取消')
|
console.log('用户点击取消')
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//显示更多按钮
|
//显示更多按钮
|
||||||
const [showMore, setShowMore] = useState(false)
|
const [showMore, setShowMore] = useState(false)
|
||||||
const styleTop = useMemo(() => {
|
const styleTop = useMemo(() => {
|
||||||
return {top:`-${(orderBtnsShowList.length - 3)*70 + 10}rpx`, left: `-${10}rpx`}
|
return { top: `-${(orderBtnsShowList.length - 3) * 70 + 10}rpx`, left: `-${10}rpx` }
|
||||||
}, [orderBtnsShowList])
|
}, [orderBtnsShowList])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{(orderBtnsShowList.length > 0)&&<View className={classnames(fixedBottom&&styles.submit_order)}>
|
{orderBtnsShowList.length > 0 && (
|
||||||
|
<View className={classnames(fixedBottom && styles.submit_order)}>
|
||||||
<View className={styles.btns_list}>
|
<View className={styles.btns_list}>
|
||||||
{(orderBtnsShowList.length > 3)&&<View className={styles.more}>
|
{orderBtnsShowList.length > 3 && (
|
||||||
<Text onClick={() => setShowMore(!showMore)}>{!showMore?'更多':'关闭'}</Text>
|
<View className={styles.more}>
|
||||||
{showMore&&<View className={styles.more_con}>
|
<Text onClick={() => setShowMore(!showMore)}>{!showMore ? '更多' : '关闭'}</Text>
|
||||||
|
{showMore && (
|
||||||
|
<View className={styles.more_con}>
|
||||||
<View className={styles.more_list} style={styleTop}>
|
<View className={styles.more_list} style={styleTop}>
|
||||||
{orderBtnsShowList.map((item, index) => {
|
{orderBtnsShowList.map((item, index) => {
|
||||||
return ((index >= 3) &&<View className={styles.more_item} key={item.id} onClick={() => submitBtns(item.id, index)}>{item.label}</View>)
|
return (
|
||||||
|
index >= 3 && (
|
||||||
|
<View className={styles.more_item} key={item.id} onClick={() => submitBtns(item.id, index)}>
|
||||||
|
{item.label}
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
)
|
||||||
})}
|
})}
|
||||||
</View>
|
</View>
|
||||||
{/* <View className={styles.more_bg} catchMove onClick={() => setShowMore(false)}></View> */}
|
{/* <View className={styles.more_bg} catchMove onClick={() => setShowMore(false)}></View> */}
|
||||||
</View>}
|
</View>
|
||||||
</View>}
|
)}
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
|
||||||
<View className={styles.list_scroll}>
|
<View className={styles.list_scroll}>
|
||||||
{orderBtnsShowList.map((item, index) =>
|
{orderBtnsShowList.map(
|
||||||
(index < 3)&&<View key={item.id} className={classnames(styles.btns_item)} onClick={() => submitBtns(item.id, index)}>{item.label}</View>
|
(item, index) =>
|
||||||
|
index < 3 && (
|
||||||
|
<View key={item.id} className={classnames(styles.btns_item)} onClick={() => submitBtns(item.id, index)}>
|
||||||
|
{item.label}
|
||||||
|
</View>
|
||||||
|
),
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>}
|
</View>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
})
|
})
|
@ -1,24 +1,23 @@
|
|||||||
import { Image, ScrollView, Text, View } from "@tarojs/components";
|
import { Image, ScrollView, Text, View } from '@tarojs/components'
|
||||||
import { FC, memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
import { FC, 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 ReasonPopup from "./components/reasonPopup";
|
import ReasonPopup from './components/reasonPopup'
|
||||||
import Taro, { useDidShow, useRouter } from "@tarojs/taro";
|
import Taro, { useDidShow, useRouter } from '@tarojs/taro'
|
||||||
import { GetSaleOrderDetailApi } from "@/api/order";
|
import { GetSaleOrderDetailApi } from '@/api/order'
|
||||||
import KindList from "./components/kindList"
|
import KindList from './components/kindList'
|
||||||
import CutKindList from "./components/cutkindList"
|
import CutKindList from './components/cutkindList'
|
||||||
import { ReturnApplyOrderApi, ReturnExplainApi, ReturnGoodsStatusApi, ReturnReasonApi } from "@/api/salesAfterOrder";
|
import { ReturnApplyOrderApi, ReturnExplainApi, ReturnGoodsStatusApi, ReturnReasonApi } from '@/api/salesAfterOrder'
|
||||||
import { alert, goLink } from "@/common/common";
|
import { alert, goLink } from '@/common/common'
|
||||||
import UploadImage from "@/components/uploadImage"
|
import UploadImage from '@/components/uploadImage'
|
||||||
import TextareaEnhance from "@/components/textareaEnhance";
|
import TextareaEnhance from '@/components/textareaEnhance'
|
||||||
import useLogin from "@/use/useLogin";
|
import useLogin from '@/use/useLogin'
|
||||||
import { throttle } from "@/common/util";
|
import { throttle } from '@/common/util'
|
||||||
|
|
||||||
enum returnStatus {
|
enum returnStatus {
|
||||||
return_reason = 1, //原因
|
return_reason = 1, //原因
|
||||||
goods_status = 2, //状况
|
goods_status = 2, //状况
|
||||||
return_explain = 3, //说明
|
return_explain = 3, //说明
|
||||||
|
|
||||||
}
|
}
|
||||||
export default () => {
|
export default () => {
|
||||||
useLogin()
|
useLogin()
|
||||||
@ -38,22 +37,22 @@ export default () => {
|
|||||||
return_reason: '', //退货原因
|
return_reason: '', //退货原因
|
||||||
roll: 0,
|
roll: 0,
|
||||||
roll_list: [],
|
roll_list: [],
|
||||||
sale_order_id: orderId.current
|
sale_order_id: orderId.current,
|
||||||
})
|
})
|
||||||
|
|
||||||
//获取订单数据
|
//获取订单数据
|
||||||
const [orderDetail, setOrderDetail] = useState<any>() //获取到的原始数据
|
const [orderDetail, setOrderDetail] = useState<any>() //获取到的原始数据
|
||||||
const {fetchData: getOrderFetchData} = GetSaleOrderDetailApi()
|
const { fetchData: getOrderFetchData } = GetSaleOrderDetailApi()
|
||||||
const getSaleOrderPreView = async () => {
|
const getSaleOrderPreView = async () => {
|
||||||
if(orderId.current) {
|
if (orderId.current) {
|
||||||
let res = await getOrderFetchData({id: orderId.current})
|
let res = await getOrderFetchData({ id: orderId.current })
|
||||||
setOrderDetail(res.data)
|
setOrderDetail(res.data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//监听获取到的数据
|
//监听获取到的数据
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if(orderDetail) {
|
if (orderDetail) {
|
||||||
formatData()
|
formatData()
|
||||||
}
|
}
|
||||||
}, [orderDetail])
|
}, [orderDetail])
|
||||||
@ -63,64 +62,61 @@ export default () => {
|
|||||||
const formatData = () => {
|
const formatData = () => {
|
||||||
setFormatDetailOrder({
|
setFormatDetailOrder({
|
||||||
...orderDetail,
|
...orderDetail,
|
||||||
unit: orderDetail.sale_mode == 0?'条':'m', //单位
|
unit: orderDetail.sale_mode == 0 ? '条' : 'm', //单位
|
||||||
list: orderDetail.product_list,
|
list: orderDetail.product_list,
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//数据总量
|
//数据总量
|
||||||
const dataCount = useMemo(() => {
|
const dataCount = useMemo(() => {
|
||||||
if(formatDetailOrder) {
|
if (formatDetailOrder) {
|
||||||
let total_number = formatDetailOrder.sale_mode == 0?formatDetailOrder.av_total_number + '条':(formatDetailOrder.av_total_number/100) + '米'
|
let total_number = formatDetailOrder.sale_mode == 0 ? formatDetailOrder.av_total_number + '条' : formatDetailOrder.av_total_number / 100 + '米'
|
||||||
return `${formatDetailOrder.av_total_fabrics}种面料,${formatDetailOrder.av_total_colors}种颜色,共${total_number}`
|
return `${formatDetailOrder.av_total_fabrics}种面料,${formatDetailOrder.av_total_colors}种颜色,共${total_number}`
|
||||||
}
|
}
|
||||||
}, [formatDetailOrder])
|
}, [formatDetailOrder])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//面料数据
|
//面料数据
|
||||||
let roll_list = useRef({})
|
let roll_list = useRef({})
|
||||||
|
|
||||||
//大货时获取计步器数据
|
//大货时获取计步器数据
|
||||||
const getNumChange = useCallback((val) => {
|
const getNumChange = useCallback((val) => {
|
||||||
if(parseInt(val.number) > 0) {
|
if (parseInt(val.number) > 0) {
|
||||||
roll_list.current[val.color_id] = {product_roll: val.number, sale_order_detail_id: val.sale_order_detail_id}
|
roll_list.current[val.color_id] = { product_roll: val.number, sale_order_detail_id: val.sale_order_detail_id }
|
||||||
} else {
|
} else {
|
||||||
delete roll_list.current[val.color_id]
|
delete roll_list.current[val.color_id]
|
||||||
}
|
}
|
||||||
setSubmitData((e) => ({...e, roll_list:Object.values(roll_list.current)}))
|
setSubmitData((e) => ({ ...e, roll_list: Object.values(roll_list.current) }))
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
//散剪和剪板
|
//散剪和剪板
|
||||||
const getSelectChange = useCallback((val) => {
|
const getSelectChange = useCallback((val) => {
|
||||||
if(val.status) {
|
if (val.status) {
|
||||||
roll_list.current[val.color_id] = {product_roll: val.length, sale_order_detail_id: val.sale_order_detail_id}
|
roll_list.current[val.sale_order_detail_id] = { product_roll: val.length, sale_order_detail_id: val.sale_order_detail_id }
|
||||||
} else {
|
} else {
|
||||||
delete roll_list.current[val.color_id]
|
delete roll_list.current[val.sale_order_detail_id]
|
||||||
}
|
}
|
||||||
setSubmitData((e) => ({...e, roll_list:Object.values(roll_list.current)}))
|
setSubmitData((e) => ({ ...e, roll_list: Object.values(roll_list.current) }))
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
//获取图片列表
|
//获取图片列表
|
||||||
const getImageList = useCallback((list) => {
|
const getImageList = useCallback((list) => {
|
||||||
setSubmitData((e) => ({...e, fabric_piece_accessory_url:list}))
|
setSubmitData((e) => ({ ...e, fabric_piece_accessory_url: list }))
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
//其他说明
|
//其他说明
|
||||||
const getOtherReason = useCallback((val) => {
|
const getOtherReason = useCallback((val) => {
|
||||||
setSubmitData((e) => ({...e, reason_describe: val}))
|
setSubmitData((e) => ({ ...e, reason_describe: val }))
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
//提交数据
|
//提交数据
|
||||||
const {fetchData: fetchDataReturnApply} = ReturnApplyOrderApi()
|
const { fetchData: fetchDataReturnApply } = ReturnApplyOrderApi()
|
||||||
const onSubmitData = async () => {
|
const onSubmitData = async () => {
|
||||||
if(submitData.roll_list.length <= 0) return alert.none('请选择或输入退货颜色')
|
if (submitData.roll_list.length <= 0) return alert.none('请选择或输入退货颜色')
|
||||||
console.log('submitData::',submitData)
|
console.log('submitData::', submitData)
|
||||||
let res = await fetchDataReturnApply(submitData)
|
let res = await fetchDataReturnApply(submitData)
|
||||||
if(res.success) {
|
if (res.success) {
|
||||||
alert.success('申请成功')
|
alert.success('申请成功')
|
||||||
goLink('/pages/salesAfter/salesAfterList/index',{}, 'reLaunch')
|
goLink('/pages/salesAfter/salesAfterList/index', {}, 'reLaunch')
|
||||||
} else {
|
} else {
|
||||||
alert.error(res.msg)
|
alert.error(res.msg)
|
||||||
}
|
}
|
||||||
@ -128,10 +124,10 @@ export default () => {
|
|||||||
|
|
||||||
//底部按钮
|
//底部按钮
|
||||||
const onSubmit = throttle((val) => {
|
const onSubmit = throttle((val) => {
|
||||||
if(val == 2) {
|
if (val == 2) {
|
||||||
if(submitData.goods_status === '') return alert.error('请选择货物状况')
|
if (submitData.goods_status === '') return alert.error('请选择货物状况')
|
||||||
if(submitData.return_explain === '') return alert.error('请选择退货原因')
|
if (submitData.return_explain === '') return alert.error('请选择退货原因')
|
||||||
if(!submitData.return_explain && !submitData.reason_describe) return alert.error('请填写其他说明')
|
if (!submitData.return_explain && !submitData.reason_describe) return alert.error('请填写其他说明')
|
||||||
onSubmitData()
|
onSubmitData()
|
||||||
} else {
|
} else {
|
||||||
Taro.navigateBack()
|
Taro.navigateBack()
|
||||||
@ -152,40 +148,40 @@ export default () => {
|
|||||||
const [returnGoodsInfo, setReturnGoodsInfo] = useState([])
|
const [returnGoodsInfo, setReturnGoodsInfo] = useState([])
|
||||||
|
|
||||||
//退货原因
|
//退货原因
|
||||||
const {fetchData: fetchDataReturnReason} = ReturnReasonApi()
|
const { fetchData: fetchDataReturnReason } = ReturnReasonApi()
|
||||||
const getReturnReason = async () => {
|
const getReturnReason = async () => {
|
||||||
let res = await fetchDataReturnReason()
|
let res = await fetchDataReturnReason()
|
||||||
setReturnGoodsInfo((e) => (res.data?.list))
|
setReturnGoodsInfo((e) => res.data?.list)
|
||||||
}
|
}
|
||||||
//售后退货说明
|
//售后退货说明
|
||||||
const {fetchData: fetchDataReturnExplain} = ReturnExplainApi()
|
const { fetchData: fetchDataReturnExplain } = ReturnExplainApi()
|
||||||
const getReturnExplain = async (id) => {
|
const getReturnExplain = async (id) => {
|
||||||
let res = await fetchDataReturnExplain({return_reason: id})
|
let res = await fetchDataReturnExplain({ return_reason: id })
|
||||||
setReturnGoodsInfo((e) => (res.data?.list))
|
setReturnGoodsInfo((e) => res.data?.list)
|
||||||
}
|
}
|
||||||
//退货原因选择列表返回的数据
|
//退货原因选择列表返回的数据
|
||||||
const [returnObj, setReturnObj] = useState<any>([])
|
const [returnObj, setReturnObj] = useState<any>([])
|
||||||
const onReturnSelect = useCallback((val) => {
|
const onReturnSelect = useCallback((val) => {
|
||||||
let res = val.data[val.data.length - 1]
|
let res = val.data[val.data.length - 1]
|
||||||
if(val.index == 1) {
|
if (val.index == 1) {
|
||||||
getReturnExplain(res.id)
|
getReturnExplain(res.id)
|
||||||
setReturnGoodsInfo(() => [])
|
setReturnGoodsInfo(() => [])
|
||||||
}
|
}
|
||||||
if(val.index == 2) setReturnObj(val.data)
|
if (val.index == 2) setReturnObj(val.data)
|
||||||
}, [])
|
}, [])
|
||||||
const onHeaderSelect = useCallback((val) => {
|
const onHeaderSelect = useCallback((val) => {
|
||||||
setReturnGoodsInfo((e) => [])
|
setReturnGoodsInfo((e) => [])
|
||||||
if(val.index == 1) getReturnReason()
|
if (val.index == 1) getReturnReason()
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
//选择货物状况
|
//选择货物状况
|
||||||
const [showStatus, setShowStatus] = useState(false)
|
const [showStatus, setShowStatus] = useState(false)
|
||||||
const [statusInfo, setStatusInfo] = useState<any>()
|
const [statusInfo, setStatusInfo] = useState<any>()
|
||||||
const [statusGoodsInfo, setStatusGoodsInfo] = useState([])
|
const [statusGoodsInfo, setStatusGoodsInfo] = useState([])
|
||||||
const {fetchData: fetchDataGoodsStatus} = ReturnGoodsStatusApi()
|
const { fetchData: fetchDataGoodsStatus } = ReturnGoodsStatusApi()
|
||||||
const getReturnGoodsStatus = async () => {
|
const getReturnGoodsStatus = async () => {
|
||||||
let res = await fetchDataGoodsStatus()
|
let res = await fetchDataGoodsStatus()
|
||||||
setStatusGoodsInfo((e) => (res.data?.list))
|
setStatusGoodsInfo((e) => res.data?.list)
|
||||||
}
|
}
|
||||||
const onShowStatus = () => {
|
const onShowStatus = () => {
|
||||||
setShowStatus(() => true)
|
setShowStatus(() => true)
|
||||||
@ -200,61 +196,76 @@ export default () => {
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if(returnObj.length > 0) {
|
if (returnObj.length > 0) {
|
||||||
submitData.return_reason = returnObj[0].id
|
submitData.return_reason = returnObj[0].id
|
||||||
submitData.return_explain = returnObj[1].id
|
submitData.return_explain = returnObj[1].id
|
||||||
}
|
}
|
||||||
if(statusInfo) {
|
if (statusInfo) {
|
||||||
submitData.goods_status = statusInfo.id
|
submitData.goods_status = statusInfo.id
|
||||||
}
|
}
|
||||||
setSubmitData(() => ({...submitData}))
|
setSubmitData(() => ({ ...submitData }))
|
||||||
}, [returnObj, statusInfo])
|
}, [returnObj, statusInfo])
|
||||||
|
|
||||||
|
|
||||||
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>{dataCount}</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}>
|
||||||
{(orderDetail?.sale_mode == 0)&&<KindList order={formatDetailOrder} onNumChange={getNumChange} />||
|
{(orderDetail?.sale_mode == 0 && <KindList order={formatDetailOrder} onNumChange={getNumChange} />) || (
|
||||||
<CutKindList order={formatDetailOrder} onSelectChange={getSelectChange}/>}
|
<CutKindList order={formatDetailOrder} onSelectChange={getSelectChange} />
|
||||||
|
)}
|
||||||
<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>
|
||||||
<View className={styles.select} onClick={onShowReason}>
|
<View className={styles.select} onClick={onShowReason}>
|
||||||
<Text className={returnObj?.length > 0&&styles.selected}>{returnObj?.length > 0?(returnObj[0]?.name + '/' +returnObj[1]?.name):'请选择'}</Text>
|
<Text className={returnObj?.length > 0 && styles.selected}>
|
||||||
|
{returnObj?.length > 0 ? returnObj[0]?.name + '/' + returnObj[1]?.name : '请选择'}
|
||||||
|
</Text>
|
||||||
<Text className={classnames(styles.miconfont, 'iconfont icon-a-moreback')}></Text>
|
<Text className={classnames(styles.miconfont, 'iconfont icon-a-moreback')}></Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.returnSaleInput_item}>
|
<View className={styles.returnSaleInput_item}>
|
||||||
<View className={styles.title}>货物状况</View>
|
<View className={styles.title}>货物状况</View>
|
||||||
<View className={styles.select} onClick={onShowStatus}>
|
<View className={styles.select} onClick={onShowStatus}>
|
||||||
<Text className={statusInfo?.name&&styles.selected}>{statusInfo?.name||'请选择'}</Text>
|
<Text className={statusInfo?.name && styles.selected}>{statusInfo?.name || '请选择'}</Text>
|
||||||
<Text className={classnames(styles.miconfont, 'iconfont icon-a-moreback')}></Text>
|
<Text className={classnames(styles.miconfont, 'iconfont icon-a-moreback')}></Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.returnSaleInput_item}>
|
<View className={styles.returnSaleInput_item}>
|
||||||
<View className={styles.title}>拍照上传</View>
|
<View className={styles.title}>拍照上传</View>
|
||||||
<View className={styles.upload_image}>
|
<View className={styles.upload_image}>
|
||||||
<UploadImage onChange={getImageList}/>
|
<UploadImage onChange={getImageList} />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<TextareaEnhance onChange={getOtherReason} title='其他说明'/>
|
<TextareaEnhance onChange={getOtherReason} title='其他说明' />
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
<View className="common_safe_area_y"></View>
|
<View className='common_safe_area_y'></View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.btns_con}>
|
<View className={styles.btns_con}>
|
||||||
<View className={styles.btns_two}>
|
<View className={styles.btns_two}>
|
||||||
<View className={styles.rest_btn} onClick={() => onSubmit(1)}>取消</View>
|
<View className={styles.rest_btn} onClick={() => onSubmit(1)}>
|
||||||
<View className={styles.verify_btn } onClick={() => onSubmit(2)}>确认</View>
|
取消
|
||||||
</View >
|
</View>
|
||||||
</View >
|
<View className={styles.verify_btn} onClick={() => onSubmit(2)}>
|
||||||
<ReasonPopup show={showReason} onClose={closeReason} title='退货原因' list={returnGoodsInfo} onHeaderSelect={onHeaderSelect} onSelect={onReturnSelect} dataLength={2}/>
|
确认
|
||||||
<ReasonPopup show={showStatus} onClose={closeStatus} title='货物状况' list={statusGoodsInfo} onSelect={onStatusSelect} dataLength={1}/>
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<ReasonPopup
|
||||||
|
show={showReason}
|
||||||
|
onClose={closeReason}
|
||||||
|
title='退货原因'
|
||||||
|
list={returnGoodsInfo}
|
||||||
|
onHeaderSelect={onHeaderSelect}
|
||||||
|
onSelect={onReturnSelect}
|
||||||
|
dataLength={2}
|
||||||
|
/>
|
||||||
|
<ReasonPopup show={showStatus} onClose={closeStatus} title='货物状况' list={statusGoodsInfo} onSelect={onStatusSelect} dataLength={1} />
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
@ -1,27 +1,26 @@
|
|||||||
import Popup from "@/components/popup";
|
import Popup from '@/components/popup'
|
||||||
import { Input, ScrollView, Text, View } from "@tarojs/components";
|
import { Input, ScrollView, Text, View } from '@tarojs/components'
|
||||||
import { memo, useCallback, useEffect, useMemo, useRef } from "react";
|
import { memo, useCallback, useEffect, useMemo, useRef } from 'react'
|
||||||
import classnames from "classnames";
|
import classnames from 'classnames'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import TextareaEnhance from "@/components/textareaEnhance";
|
import TextareaEnhance from '@/components/textareaEnhance'
|
||||||
import { CreateFavoriteApi } from "@/api/favorite";
|
import { CreateFavoriteApi } from '@/api/favorite'
|
||||||
import { alert } from "@/common/common";
|
import { alert } from '@/common/common'
|
||||||
|
|
||||||
//原因选择
|
//原因选择
|
||||||
type ReasonInfoParam = {
|
type ReasonInfoParam = {
|
||||||
show?: boolean, //显示
|
show?: boolean //显示
|
||||||
onClose?: () => void, //关闭
|
onClose?: () => void //关闭
|
||||||
onSuccess?: (val:any) => void, //成功
|
onSuccess?: (val: any) => void //成功
|
||||||
defaultValue?: {
|
defaultValue?: {
|
||||||
remark: string,
|
remark: string
|
||||||
name: string
|
name: string
|
||||||
}, //默认数据
|
} //默认数据
|
||||||
}
|
}
|
||||||
export default memo(({show = false, onClose, onSuccess, defaultValue}: ReasonInfoParam) => {
|
export default memo(({ show = false, onClose, onSuccess, defaultValue }: ReasonInfoParam) => {
|
||||||
|
|
||||||
const submitData = useRef({
|
const submitData = useRef({
|
||||||
"name": '',
|
name: '',
|
||||||
"remark": ''
|
remark: '',
|
||||||
})
|
})
|
||||||
|
|
||||||
const getOtherReason = (val) => {
|
const getOtherReason = (val) => {
|
||||||
@ -37,28 +36,38 @@ export default memo(({show = false, onClose, onSuccess, defaultValue}: ReasonInf
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
submitData.current = {name: defaultValue?.name!, remark: defaultValue?.remark!}
|
submitData.current = { name: defaultValue?.name!, remark: defaultValue?.remark! }
|
||||||
}, [defaultValue])
|
}, [defaultValue])
|
||||||
return (
|
return (
|
||||||
<Popup show={show} title="新建收藏夹" onClose={onClose} >
|
<Popup show={show} title='新建收藏夹' onClose={onClose}>
|
||||||
<View className={styles.collection_con}>
|
<View className={styles.collection_con}>
|
||||||
<View className={styles.title_item}>
|
<View className={styles.title_item}>
|
||||||
<View className={styles.title}>名称</View>
|
<View className={styles.title}>名称</View>
|
||||||
<View className={styles.select}>
|
<View className={styles.select}>
|
||||||
<Input placeholder="请输入文件夹名称" className={styles.input} cursorSpacing={150} onInput={changeInput} value={defaultValue?.name} />
|
<Input
|
||||||
|
placeholder='请输入文件夹名称'
|
||||||
|
className={styles.input}
|
||||||
|
alwaysEmbed={true}
|
||||||
|
// adjustPosition={true}
|
||||||
|
cursorSpacing={100}
|
||||||
|
onInput={changeInput}
|
||||||
|
value={defaultValue?.name}
|
||||||
|
/>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.desc_item}>
|
<View className={styles.desc_item}>
|
||||||
<View className={styles.title}>简介</View>
|
<View className={styles.title}>简介</View>
|
||||||
<View className={styles.desc}>
|
<View className={styles.desc}>
|
||||||
<TextareaEnhance defaultValue={defaultValue?.remark} onChange={getOtherReason} placeholder="请输入简介" />
|
<TextareaEnhance defaultValue={defaultValue?.remark} onChange={getOtherReason} placeholder='请输入简介' />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View className={styles.btns_con}>
|
<View className={styles.btns_con}>
|
||||||
<View className={styles.btns_two}>
|
<View className={styles.btns_two}>
|
||||||
<View className={styles.verify_btn } onClick={() => onSubmit()}>确认</View>
|
<View className={styles.verify_btn} onClick={() => onSubmit()}>
|
||||||
</View >
|
确认
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</Popup>
|
</Popup>
|
||||||
|
@ -1,49 +1,53 @@
|
|||||||
.credit-used{
|
.credit-used {
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
background-color: #f3f3f3;
|
background-color: #f3f3f3;
|
||||||
.credit-used-list{
|
.credit-used-list {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
padding: 30px 25px;
|
padding: 30px 25px;
|
||||||
border-bottom: 1px solid #f6f6f6;
|
border-bottom: 1px solid #f6f6f6;
|
||||||
display: flex;justify-content: space-between;
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
.credit-used-list-left{
|
.credit-used-list-left {
|
||||||
}
|
}
|
||||||
.credit-used-list-type{
|
.credit-used-list-type {
|
||||||
font-size: 26px;
|
font-size: 26px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
.credit-used-list-price{
|
.credit-used-list-price {
|
||||||
font-size: 28px;
|
font-size: 28px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
.credit-used-list-right{
|
.credit-used-list-right {
|
||||||
display: flex;align-items: center;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
.credit-used-list-right-price view{
|
.credit-used-list-right-price view {
|
||||||
display: flex;align-items: center;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
.credit-used-list-right text{
|
.credit-used-list-right text {
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
.credit-used-list-date{
|
.credit-used-list-date {
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: #ababab;
|
color: #ababab;
|
||||||
}
|
}
|
||||||
.credit-used-list-orderno{
|
.credit-used-list-orderno {
|
||||||
font-size: 20px;
|
font-size: 25px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
margin-top: 20px;
|
margin-top: 16px;
|
||||||
color: #ababab;
|
color: #ababab;
|
||||||
}
|
}
|
||||||
.green{
|
.green {
|
||||||
color: #07C160;
|
color: #07c160;
|
||||||
}
|
}
|
||||||
.red{
|
.red {
|
||||||
color: #FF0000;
|
color: #ff0000;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -38,12 +38,11 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
<View className='credit-used-list-right'>
|
<View className='credit-used-list-right'>
|
||||||
<View className='credit-used-list-right-price'>
|
<View className='credit-used-list-right-price'>
|
||||||
<View
|
<View className={`credit-used-list-price ${[1, 2, 3].includes(res.type as never) ? 'red' : 'green'}`}>
|
||||||
className={`credit-used-list-price ${[1, 2, 3].includes(res.type as never) ? 'red' : 'green'}`}>
|
|
||||||
{[1, 2, 3].includes(res.type as never) ? '+' : '-'}
|
{[1, 2, 3].includes(res.type as never) ? '+' : '-'}
|
||||||
{formatPriceDiv(res.amount_received_this_time)}
|
{formatPriceDiv(res.amount_received_this_time)}
|
||||||
</View>
|
</View>
|
||||||
{/* <View className="credit-used-list-orderno">处理中</View> */}
|
<View className='credit-used-list-orderno'>余额:{formatPriceDiv(res.wallet_balance)}</View>
|
||||||
</View>
|
</View>
|
||||||
<Text className='iconfont icon-a-moreback'></Text>
|
<Text className='iconfont icon-a-moreback'></Text>
|
||||||
</View>
|
</View>
|
||||||
|
@ -6,7 +6,7 @@ import Counter from '../counter'
|
|||||||
import Big from 'big.js'
|
import Big from 'big.js'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import { memo, useCallback, useEffect, useRef, useState, useTransition } from 'react'
|
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||||
import { useSelector } from '@/reducers/hooks'
|
import { useSelector } from '@/reducers/hooks'
|
||||||
import { GetColorList } from '@/api/materialColor'
|
import { GetColorList } from '@/api/materialColor'
|
||||||
import { AddShoppingCartApi } from '@/api/shopCart'
|
import { AddShoppingCartApi } from '@/api/shopCart'
|
||||||
@ -18,7 +18,6 @@ import LabAndImg from '@/components/LabAndImg'
|
|||||||
import VirtualList from '@tarojs/components/virtual-list'
|
import VirtualList from '@tarojs/components/virtual-list'
|
||||||
import useCommonData from '@/use/useCommonData'
|
import useCommonData from '@/use/useCommonData'
|
||||||
import LabAndImgShow from '@/components/LabAndImgShow'
|
import LabAndImgShow from '@/components/LabAndImgShow'
|
||||||
import InfiniteScroll from '@/components/infiniteScroll'
|
|
||||||
|
|
||||||
type param = {
|
type param = {
|
||||||
show?: true | false
|
show?: true | false
|
||||||
@ -27,8 +26,6 @@ type param = {
|
|||||||
productId?: number
|
productId?: number
|
||||||
}
|
}
|
||||||
export default memo(({ show = false, onClose, title = '', productId = 0 }: param) => {
|
export default memo(({ show = false, onClose, title = '', productId = 0 }: param) => {
|
||||||
const [isPending, startTransition] = useTransition()
|
|
||||||
|
|
||||||
const { adminUserInfo } = useSelector((state) => state.userInfo)
|
const { adminUserInfo } = useSelector((state) => state.userInfo)
|
||||||
|
|
||||||
const [selectList, _] = useState([
|
const [selectList, _] = useState([
|
||||||
@ -44,15 +41,11 @@ export default memo(({ show = false, onClose, title = '', productId = 0 }: param
|
|||||||
//重置数据
|
//重置数据
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const newList = initList(list)
|
const newList = initList(list)
|
||||||
startTransition(() => {
|
|
||||||
setList([...newList])
|
setList([...newList])
|
||||||
})
|
|
||||||
condition.current.code_or_name = null
|
condition.current.code_or_name = null
|
||||||
setSearchShow(false)
|
setSearchShow(false)
|
||||||
}, [selectIndex])
|
}, [selectIndex])
|
||||||
|
|
||||||
useEffect(() => console.log('isPending::', isPending), [isPending])
|
|
||||||
|
|
||||||
//获取面料颜色列表
|
//获取面料颜色列表
|
||||||
const { fetchData: colorFetchData, state: colorState } = GetColorList()
|
const { fetchData: colorFetchData, state: colorState } = GetColorList()
|
||||||
const [list, setList] = useState<any[]>([])
|
const [list, setList] = useState<any[]>([])
|
||||||
@ -77,16 +70,14 @@ export default memo(({ show = false, onClose, title = '', productId = 0 }: param
|
|||||||
}, [show])
|
}, [show])
|
||||||
|
|
||||||
//初始化列表数据
|
//初始化列表数据
|
||||||
const initList = (list) => {
|
const initList = useCallback((list) => {
|
||||||
const newList = list.map((item) => {
|
const newList = list.map((item) => {
|
||||||
item.count = 0
|
item.count = 0
|
||||||
item.show = false
|
item.show = false
|
||||||
item.unit = selectList[selectIndex].unit
|
|
||||||
item.formatePrice = Number(formatPriceDiv(item[selectList[selectIndex].priceField]))
|
|
||||||
return item
|
return item
|
||||||
})
|
})
|
||||||
return newList
|
return newList
|
||||||
}
|
}, [])
|
||||||
|
|
||||||
//卸载数据
|
//卸载数据
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -199,6 +190,21 @@ export default memo(({ show = false, onClose, title = '', productId = 0 }: param
|
|||||||
setSearchShow(false)
|
setSearchShow(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//格式化金额
|
||||||
|
const formatPrice = useCallback(
|
||||||
|
(item) => {
|
||||||
|
const price = Number(formatPriceDiv(item[selectList[selectIndex].priceField]))
|
||||||
|
return (
|
||||||
|
<View className={styles.priceText}>
|
||||||
|
<Text>¥</Text>
|
||||||
|
{price}
|
||||||
|
<Text> /{selectList[selectIndex].eunit}</Text>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
[selectIndex],
|
||||||
|
)
|
||||||
|
|
||||||
//显示图片弹窗
|
//显示图片弹窗
|
||||||
const [showLabImage, setShowLabImage] = useState(false)
|
const [showLabImage, setShowLabImage] = useState(false)
|
||||||
const [labImageValue, setLabImageValue] = useState()
|
const [labImageValue, setLabImageValue] = useState()
|
||||||
@ -210,6 +216,47 @@ export default memo(({ show = false, onClose, title = '', productId = 0 }: param
|
|||||||
setShowLabImage(() => false)
|
setShowLabImage(() => false)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
//虚拟滚动
|
||||||
|
const Rows = memo(({ id, index, style, data }: any) => {
|
||||||
|
let item = data[index]
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{(item && (
|
||||||
|
<View className={styles.item} key={item.id}>
|
||||||
|
<View className={styles.item_color}>
|
||||||
|
<LabAndImg value={{ lab: item.lab, rgb: item.rgb, texture_url: item.texture_url, title: item.code }} showStatus={false} onClick={getLabAndImg} />
|
||||||
|
</View>
|
||||||
|
<View className={styles.item_con}>
|
||||||
|
<View className={styles.title}>{formatHashTag(item.code, item.name)}</View>
|
||||||
|
<View className={styles.num}>{formatPrice(item)}</View>
|
||||||
|
</View>
|
||||||
|
<View className={styles.btn_con}>
|
||||||
|
{(!item.show && (
|
||||||
|
<View className={styles.btn} onClick={() => onAdd(item)}>
|
||||||
|
添加
|
||||||
|
</View>
|
||||||
|
)) || (
|
||||||
|
<View className={styles.btn_count}>
|
||||||
|
<Counter
|
||||||
|
otherData={item}
|
||||||
|
onBlue={getInputValue}
|
||||||
|
defaultNum={item.count}
|
||||||
|
step={selectList[selectIndex].step}
|
||||||
|
digits={selectList[selectIndex].digits}
|
||||||
|
onClickBtn={getInputValue}
|
||||||
|
unit={selectList[selectIndex].unit}
|
||||||
|
minNum={selectList[selectIndex].minNum}
|
||||||
|
maxNum={selectList[selectIndex].maxNum}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
)) || <View className={styles.item}></View>}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={styles.shop_cart_main}>
|
<View className={styles.shop_cart_main}>
|
||||||
<Popup showTitle={false} show={showPopup} onClose={() => closePopup()}>
|
<Popup showTitle={false} show={showPopup} onClose={() => closePopup()}>
|
||||||
@ -248,49 +295,19 @@ export default memo(({ show = false, onClose, title = '', productId = 0 }: param
|
|||||||
<View className={styles.product_color_con}>
|
<View className={styles.product_color_con}>
|
||||||
{list.length <= 0 && colorState.loading && <LoadingCard />}
|
{list.length <= 0 && colorState.loading && <LoadingCard />}
|
||||||
{list.length > 0 && !colorState.loading && (
|
{list.length > 0 && !colorState.loading && (
|
||||||
<InfiniteScroll moreStatus={false}>
|
|
||||||
<View className={styles.color_con}>
|
<View className={styles.color_con}>
|
||||||
{list.map((item) => {
|
<VirtualList
|
||||||
return (
|
className={styles.virtual_list}
|
||||||
<View className={styles.item} key={item.id}>
|
height={400} /* 列表的高度 */
|
||||||
<View className={styles.item_color}>
|
width='100%' /* 列表的宽度 */
|
||||||
<LabAndImg value={{ lab: item.lab, rgb: item.rgb, texture_url: item.texture_url }} />
|
itemData={list} /* 渲染列表的数据 */
|
||||||
|
itemCount={list.length + 1} /* 渲染列表的长度 */
|
||||||
|
itemSize={100} /* 列表单项的高度 */
|
||||||
|
overscanCount={1}>
|
||||||
|
{Rows}
|
||||||
|
</VirtualList>
|
||||||
|
<View className='common_safe_area_y'></View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.item_con}>
|
|
||||||
<View className={styles.title}>{formatHashTag(item.code, item.name)}</View>
|
|
||||||
<View className={styles.num}>
|
|
||||||
<View className={styles.priceText}>
|
|
||||||
<Text>¥</Text>
|
|
||||||
{item.formatePrice}
|
|
||||||
<Text>/{item.unit}</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View className={styles.btn_con}>
|
|
||||||
{(!item.show && (
|
|
||||||
<View className={styles.btn} onClick={() => onAdd(item)}>
|
|
||||||
添加
|
|
||||||
</View>
|
|
||||||
)) || (
|
|
||||||
<View className={styles.btn_count}>
|
|
||||||
<Counter
|
|
||||||
onBlue={(e) => getInputValue(e, item)}
|
|
||||||
defaultNum={item.count}
|
|
||||||
step={selectList[selectIndex].step}
|
|
||||||
digits={selectList[selectIndex].digits}
|
|
||||||
onClickBtn={(e) => getInputValue(e, item)}
|
|
||||||
unit={selectList[selectIndex].unit}
|
|
||||||
minNum={selectList[selectIndex].minNum}
|
|
||||||
maxNum={selectList[selectIndex].maxNum}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
)}
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
})}
|
|
||||||
</View>
|
|
||||||
</InfiniteScroll>
|
|
||||||
)}
|
)}
|
||||||
{list.length <= 0 && !colorState.loading && <View className={styles.noData}>暂无此商品</View>}
|
{list.length <= 0 && !colorState.loading && <View className={styles.noData}>暂无此商品</View>}
|
||||||
</View>
|
</View>
|
||||||
|
@ -150,15 +150,24 @@ export default memo(
|
|||||||
|
|
||||||
//根据订单状态判断是否可修改
|
//根据订单状态判断是否可修改
|
||||||
const limitEdit = () => {
|
const limitEdit = () => {
|
||||||
let res = [SaleorderstatusWaitingPrePayment.value, SaleOrderStatusBooking.value, SaleOrderStatusArranging.value, SaleOrderStatusArranged.value, SaleOrderStatusWaitingPayment.value].includes(
|
let res = [
|
||||||
orderInfo?.status as number,
|
SaleorderstatusWaitingPrePayment.value,
|
||||||
)
|
SaleOrderStatusBooking.value,
|
||||||
|
SaleOrderStatusArranging.value,
|
||||||
|
SaleOrderStatusArranged.value,
|
||||||
|
SaleOrderStatusWaitingPayment.value,
|
||||||
|
].includes(orderInfo?.status as number)
|
||||||
if (!res && status != 1) alert.none('该订单状态不能修改地址!')
|
if (!res && status != 1) alert.none('该订单状态不能修改地址!')
|
||||||
return status == 1 ? true : res
|
return status == 1 ? true : res
|
||||||
}
|
}
|
||||||
|
|
||||||
//根据订单状态判断是否显示物流
|
//根据订单状态判断是否显示物流
|
||||||
const logisticsShowList = [SaleOrderStatusWaitingReceipt.value, SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusComplete.value, SaleOrderStatusRefund.value]
|
const logisticsShowList = [
|
||||||
|
SaleOrderStatusWaitingReceipt.value,
|
||||||
|
SaleOrderStatusAlreadyReceipt.value,
|
||||||
|
SaleOrderStatusComplete.value,
|
||||||
|
SaleOrderStatusRefund.value,
|
||||||
|
]
|
||||||
const logisticsShow = useMemo(() => {
|
const logisticsShow = useMemo(() => {
|
||||||
return logisticsShowList.includes(orderInfo?.status as number)
|
return logisticsShowList.includes(orderInfo?.status as number)
|
||||||
}, [orderInfo])
|
}, [orderInfo])
|
||||||
@ -189,10 +198,14 @@ export default memo(
|
|||||||
{(!logisticsShow && (
|
{(!logisticsShow && (
|
||||||
<View className={styles.updateBtn}>
|
<View className={styles.updateBtn}>
|
||||||
<View className={styles.updateBtn_list}>
|
<View className={styles.updateBtn_list}>
|
||||||
<View className={classnames(styles.updateBtn_item, receivingStatus == 1 && styles.updateBtn_item_select)} onClick={(e) => onReceivingStatus(1, e)}>
|
<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
|
||||||
|
className={classnames(styles.updateBtn_item, receivingStatus == 2 && styles.updateBtn_item_select)}
|
||||||
|
onClick={(e) => onReceivingStatus(2, e)}>
|
||||||
物流
|
物流
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
@ -1,54 +1,51 @@
|
|||||||
import { formatImgUrl } from "@/common/fotmat";
|
import { formatImgUrl } from '@/common/fotmat'
|
||||||
import { Image, Text, View } from "@tarojs/components";
|
import { Image, Text, View } from '@tarojs/components'
|
||||||
import { memo, useEffect, useMemo, useRef, useState } from "react";
|
import { memo, 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 dayjs from "dayjs";
|
import dayjs from 'dayjs'
|
||||||
import { useTimeCountDown } from "@/use/useCommon";
|
import { useTimeCountDown } from '@/use/useCommon'
|
||||||
import { ORDER_STATUS, PAYMENT_METHOD } from "@/common/enum";
|
import { ORDER_STATUS, PAYMENT_METHOD } from '@/common/enum'
|
||||||
|
|
||||||
type List = {
|
type List = {
|
||||||
status: string,
|
status: string
|
||||||
time: string,
|
time: string
|
||||||
tag: string,
|
tag: string
|
||||||
desc: string,
|
desc: string
|
||||||
expire_time: string
|
expire_time: string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Param = {
|
type Param = {
|
||||||
onRefresh?: () => void,
|
onRefresh?: () => void
|
||||||
orderInfo?: {
|
orderInfo?: {
|
||||||
logistics_details:List[], //订单状态列表
|
logistics_details: List[] //订单状态列表
|
||||||
payment_method: number, //支付方式
|
payment_method: number //支付方式
|
||||||
status: number, //订单状态
|
status: number //订单状态
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default memo(({ orderInfo, onRefresh }: Param) => {
|
||||||
export default memo(({orderInfo, onRefresh}:Param) => {
|
const { showTime, onStart, timeStatus } = useTimeCountDown()
|
||||||
|
|
||||||
const {showTime, onStart, timeStatus} = useTimeCountDown()
|
|
||||||
|
|
||||||
//订单状态枚举
|
//订单状态枚举
|
||||||
const {SaleorderstatusWaitingPrePayment} = ORDER_STATUS
|
const { SaleorderstatusWaitingPrePayment } = ORDER_STATUS
|
||||||
|
|
||||||
//获取预付款最后时间
|
//获取预付款最后时间
|
||||||
const endTime = useMemo(() => {
|
const endTime = useMemo(() => {
|
||||||
if(orderInfo?.status == SaleorderstatusWaitingPrePayment.value && orderInfo.logistics_details.length > 0) {
|
if (orderInfo?.status == SaleorderstatusWaitingPrePayment.value && orderInfo.logistics_details.length > 0) {
|
||||||
return orderInfo.logistics_details[0].expire_time
|
return orderInfo.logistics_details[0].expire_time
|
||||||
}
|
}
|
||||||
return ''
|
return ''
|
||||||
}, [orderInfo])
|
}, [orderInfo])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if(endTime) onStart(endTime)
|
if (endTime) onStart(endTime)
|
||||||
}, [endTime])
|
}, [endTime])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if(timeStatus == 2) onRefresh?.()
|
if (timeStatus == 2) onRefresh?.()
|
||||||
}, [timeStatus])
|
}, [timeStatus])
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={styles.advance_main}>
|
<View className={styles.advance_main}>
|
||||||
<View className={styles.time_con}>
|
<View className={styles.time_con}>
|
||||||
@ -63,7 +60,7 @@ export default memo(({orderInfo, onRefresh}:Param) => {
|
|||||||
<Text>支付关闭,订单自动取消</Text>
|
<Text>支付关闭,订单自动取消</Text>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.cardIcon}>
|
<View className={styles.cardIcon}>
|
||||||
<Image className={styles.image} src={formatImgUrl("/mall/my_cart.png")}/>
|
<Image className={styles.image} src={formatImgUrl('/mall/my_cart.png')} />
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.refresh} onClick={() => onRefresh?.()}>
|
<View className={styles.refresh} onClick={() => onRefresh?.()}>
|
||||||
<Text className={classnames(styles.mconfont, 'iconfont icon-shuaxin')}></Text>
|
<Text className={classnames(styles.mconfont, 'iconfont icon-shuaxin')}></Text>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import Search from '@/components/search'
|
import Search from '@/components/search'
|
||||||
import useLogin from '@/use/useLogin'
|
import useLogin from '@/use/useLogin'
|
||||||
import { View } from '@tarojs/components'
|
import { View } from '@tarojs/components'
|
||||||
import Taro, { useDidShow } from '@tarojs/taro'
|
import Taro, { useDidShow, useRouter } from '@tarojs/taro'
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
import Order from './components/order'
|
import Order from './components/order'
|
||||||
@ -12,7 +12,6 @@ import OrderStatusList from './components/orderStatusList'
|
|||||||
import { AddShoppingCartApi } from '@/api/shopCart'
|
import { AddShoppingCartApi } from '@/api/shopCart'
|
||||||
import ShopCart from '@/components/shopCart'
|
import ShopCart from '@/components/shopCart'
|
||||||
import { alert } from '@/common/common'
|
import { alert } from '@/common/common'
|
||||||
import { useRouter } from '@tarojs/runtime'
|
|
||||||
import Payment from '../components/payment'
|
import Payment from '../components/payment'
|
||||||
import ApplyRefund from '../components/applyRefund'
|
import ApplyRefund from '../components/applyRefund'
|
||||||
import ReturnRecord from '../components/returnRecord'
|
import ReturnRecord from '../components/returnRecord'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user