diff --git a/config/prod.js b/config/prod.js
index 4e3a20d..03d07d7 100644
--- a/config/prod.js
+++ b/config/prod.js
@@ -7,9 +7,9 @@ module.exports = {
CURRENT_BASE_URL: '"https://www.zzfzyc.com/lymarket"',
},
mini: {
- optimizeMainPackage: {
- enable: true,
- },
+ // optimizeMainPackage: {
+ // enable: true,
+ // },
webpackChain: (chain, webpack) => {
chain.merge({
plugin: {
@@ -18,7 +18,7 @@ module.exports = {
args: [
{
terserOptions: {
- // compress: true, // 默认使用terser压缩
+ compress: true, // 默认使用terser压缩
compress: {
drop_console: true, // 去掉打印
}, // 默认使用terser压缩
diff --git a/src/common/common.ts b/src/common/common.ts
index 9adb0d3..f6462f1 100644
--- a/src/common/common.ts
+++ b/src/common/common.ts
@@ -1,43 +1,40 @@
-import Taro from "@tarojs/taro"
+import Taro from '@tarojs/taro'
import Qs from 'qs'
/**
* 跳转
- * @param path
- * @param params
+ * @param path
+ * @param params
* @param type false 跳转普通页面,true 跳转tabbar页面
*/
-type ParamLink = 'navigateTo'|'switchTab'|'reLaunch'|'redirectTo'
-export const goLink = (path = '', params = {}, way: ParamLink = 'navigateTo') => {
- if(path) {
- let params_str = Qs.stringify(params)
- console.log('params_str::',params_str)
- path = params_str?path+'?'+params_str:path
- console.log('path::', way)
- Taro[way]({url: path})
-
- }
-
+type ParamLink = 'navigateTo' | 'switchTab' | 'reLaunch' | 'redirectTo'
+export const goLink = (path = '', params = null, way: ParamLink = 'navigateTo') => {
+ if (path) {
+ let params_str = Qs.stringify(params || {})
+ path = params_str ? path + '?' + params_str : path
+ console.log('path::', way)
+ Taro[way]({ url: path })
+ }
}
/**
* 判断对象为空
- * @param object
- * @returns
+ * @param object
+ * @returns
*/
-export const isEmptyObject = (object: any)=>{
- if(object==undefined||object==null||Number.isNaN(object)){
- return true;
- }else{
- if(object.constructor==Object){
- return Reflect.ownKeys(object).length==0;
- }else if(object.constructor==Array){
- return object.length==0;
- }else if(object.constructor==String){
- return object=="";
- }
+export const isEmptyObject = (object: any) => {
+ if (object == undefined || object == null || Number.isNaN(object)) {
+ return true
+ } else {
+ if (object.constructor == Object) {
+ return Reflect.ownKeys(object).length == 0
+ } else if (object.constructor == Array) {
+ return object.length == 0
+ } else if (object.constructor == String) {
+ return object == ''
}
- return false;
}
+ return false
+}
/**
* 表单检索
@@ -58,86 +55,90 @@ export const isEmptyObject = (object: any)=>{
* @param message
* @returns
*/
-export const retrieval = (data: any, rules?: Object, message: string="请填写完信息")=>{
- return new Promise((resolve, reject)=>{
- if(rules){
- const keys = Reflect.ownKeys(rules);
- const result = keys.some((key:any)=>{
- for(let item of (rules as any)[key]){
-
- let _res = false;
- if(item.validator){
- if(item.validator(data[key],item)){
- _res=true;
- }
- }else if(item.regex){
- if(!item.regex.test(data[key])){
- _res=true;
- }
- }else{
- if(isEmptyObject(data[key])){
- _res=true;
- }
+export const retrieval = (data: any, rules?: Object, message: string = '请填写完信息') => {
+ return new Promise((resolve, reject) => {
+ if (rules) {
+ const keys = Reflect.ownKeys(rules)
+ const result = keys.some((key: any) => {
+ for (let item of (rules as any)[key]) {
+ let _res = false
+ if (item.validator) {
+ if (item.validator(data[key], item)) {
+ _res = true
+ }
+ } else if (item.regex) {
+ if (!item.regex.test(data[key])) {
+ _res = true
+ }
+ } else {
+ if (isEmptyObject(data[key])) {
+ _res = true
}
- message = item.message;
- return _res;
}
- });
- if(result){
- reject(message);
- }
- }else{
- const keys = Reflect.ownKeys(data);
- if(keys.some((key:any)=>isEmptyObject(data[key]))){
- reject(message);
+ message = item.message
+ return _res
}
+ })
+ if (result) {
+ reject(message)
+ }
+ } else {
+ const keys = Reflect.ownKeys(data)
+ if (keys.some((key: any) => isEmptyObject(data[key]))) {
+ reject(message)
}
- resolve(null);
- })
- }
- /**
- * toast提示
- */
- export const alert = {
- success(title: string){
- Taro.showToast({
- title,icon: "success"
- })
- },
- error(title: string){
- Taro.showToast({
- title,icon: "error"
- })
- },
- loading(title: string, mask: true|false = false){
- Taro.showToast({
- title,icon: "loading",
- mask
- })
- },
- none(title: string){
- Taro.showToast({
- title,icon: "none"
- })
-
- },
- showLoading(title: string, mask: true|false = true) {
- Taro.showLoading({title, mask})
- },
- hideLoading() {
- Taro.hideLoading()
}
- }
+ resolve(null)
+ })
+}
+/**
+ * toast提示
+ */
+export const alert = {
+ success(title: string) {
+ Taro.showToast({
+ title,
+ icon: 'success',
+ })
+ },
+ error(title: string) {
+ Taro.showToast({
+ title,
+ icon: 'error',
+ })
+ },
+ loading(title: string, mask: true | false = false) {
+ Taro.showToast({
+ title,
+ icon: 'loading',
+ mask,
+ })
+ },
+ none(title: string) {
+ Taro.showToast({
+ title,
+ icon: 'none',
+ })
+ },
+ showLoading(title: string, mask: true | false = true) {
+ Taro.showLoading({ title, mask })
+ },
+ hideLoading() {
+ Taro.hideLoading()
+ },
+}
// 金额千位分割符
export const formatKbPrice = (number: string) => {
- const ret = Array.from(number).reverse().reduce((result: string[],next,i,arr) => {
- if((i+1)%3 === 0 && (i+1) !== arr.length) {
- result.push(next,',')
- return result;
- }
- result.push(next);
- return result;
- },[])
- return ret.reverse().join('');
+ const ret = Array.from(number)
+ .reverse()
+ .reduce((result: string[], next, i, arr) => {
+ if ((i + 1) % 3 === 0 && i + 1 !== arr.length) {
+ result.push(next, ',')
+ return result
+ }
+ result.push(next)
+ return result
+ }, [])
+ return ret.reverse().join('')
}
diff --git a/src/common/constant.js b/src/common/constant.js
index 1cfe175..c500768 100644
--- a/src/common/constant.js
+++ b/src/common/constant.js
@@ -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.89: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://www.zzfzyc.com/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` // 杰
// CDN
@@ -22,6 +23,7 @@ export const UPLOAD_CDN_URL = `https://v0.api.upyun.com/`
// 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://cdn.zzfzyc.com'
//在线支付图片baseUrl
export const CAP_HTML_TO_IMAGE_BASE_URL = CURRENT_ENV.includes('production') ? 'https://www.zzfzyc.com' : 'https://test.zzfzyc.com'
diff --git a/src/components/LabAndImg/index.tsx b/src/components/LabAndImg/index.tsx
index 5905fbb..1d05866 100644
--- a/src/components/LabAndImg/index.tsx
+++ b/src/components/LabAndImg/index.tsx
@@ -7,7 +7,7 @@ import LabAndImgShow from '../LabAndImgShow'
//该组件宽高为100%需调整外层元素宽高
type Param = {
- value?: {
+ value: {
texture_url?: string //纹理图路径
lab?: { l: number; a: number; b: number } //lab
rgb?: { r: number; g: number; b: number } //rgb
@@ -21,7 +21,7 @@ export default memo(({ value, onClick, showStatus = false }: Param) => {
//lab是否都是0
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})` }
} else {
return null
@@ -30,10 +30,10 @@ export default memo(({ value, onClick, showStatus = false }: Param) => {
useEffect(() => {
if (value?.texture_url) {
- let res = value.texture_url.split(',').map((item) => {
+ let imgs = value.texture_url.split(',').map((item) => {
return formatImgUrl(item)
})
- setImgs(() => res)
+ setImgs(() => imgs)
}
}, [value])
@@ -41,6 +41,7 @@ export default memo(({ value, onClick, showStatus = false }: Param) => {
const closeLabAndImgShow = useCallback(() => {
setLabAndImgShow(false)
}, [])
+
const onShowLabAndImg = () => {
onClick?.(value)
if (!showStatus) return false
@@ -50,9 +51,9 @@ export default memo(({ value, onClick, showStatus = false }: Param) => {
return (
<>
onShowLabAndImg()}>
- {imgs?.length > 0 && }
- {!imgs?.length && rgbStyle && }
- {!imgs?.length && !rgbStyle && }
+ {value.texture_url && }
+ {!value.texture_url && rgbStyle && }
+ {!value.texture_url && !rgbStyle && }
>
diff --git a/src/components/afterOrderBtns/index.tsx b/src/components/afterOrderBtns/index.tsx
index 737d006..ce556d9 100644
--- a/src/components/afterOrderBtns/index.tsx
+++ b/src/components/afterOrderBtns/index.tsx
@@ -1,156 +1,168 @@
-import { alert } from "@/common/common"
-import { AFTER_ORDER_STATUS, ORDER_STATUS, REFUND_STATUS_ORDER, SALE_MODE } from "@/common/enum"
-import {Text, View } from "@tarojs/components"
-import Taro from "@tarojs/taro"
-import {useRef, memo, useState, useMemo } from "react"
-import classnames from "classnames";
-import styles from './index.module.scss'
-import { ReturnApplyOrderCancelApi } from "@/api/salesAfterOrder"
-import { throttle } from "@/common/util"
+import { alert } from '@/common/common'
+import { AFTER_ORDER_STATUS, ORDER_STATUS, REFUND_STATUS_ORDER, SALE_MODE } from '@/common/enum'
+import { Text, View } from '@tarojs/components'
+import Taro from '@tarojs/taro'
+import { useRef, memo, useState, useMemo } from 'react'
+import classnames from 'classnames'
+import styles from './index.module.scss'
+import { ReturnApplyOrderCancelApi } from '@/api/salesAfterOrder'
+import { throttle } from '@/common/util'
type Param = {
- orderInfo: {
- stage: number, //售后状态
- sale_mode: number, //订单类型
- type: number, //1退货,2退款
- return_apply_order_id: number //售后申请单
- is_quality_check: true|false //质检结果
- },
- onClick?: (val: number) => void, //点击后触发的事件,返回订单状态
- fixedBottom?: true|false, //是否固定在底部
-
+ orderInfo: {
+ stage: number //售后状态
+ sale_mode: number //订单类型
+ type: number //1退货,2退款
+ return_apply_order_id: number //售后申请单
+ is_quality_check: true | false //质检结果
+ }
+ onClick?: (val: number) => void //点击后触发的事件,返回订单状态
+ fixedBottom?: true | false //是否固定在底部
}
-export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => {
- //售后订单状态
- const {
- ReturnStageApplying,
- ReturnStageWaitCheck,
- ReturnStageReturned,
- ReturnStageQualityCheckPendingRefund,
- ReturnStageServiceOrderPendingRefund,
- } = AFTER_ORDER_STATUS
+export default memo(({ orderInfo, onClick, fixedBottom = true }: Param) => {
+ //售后订单状态
+ const { ReturnStageApplying, ReturnStageWaitCheck, ReturnStageReturned, ReturnStageQualityCheckPendingRefund, ReturnStageServiceOrderPendingRefund } =
+ AFTER_ORDER_STATUS
- const {
- ReturnApplyOrderTypeAdvanceReceiptRefund, // 预收退款
- ReturnApplyOrderTypeReturnForRefund, // 退货退款
- ReturnApplyOrderTypeSalesRefund // 销售退款
- } = REFUND_STATUS_ORDER
+ const {
+ ReturnApplyOrderTypeAdvanceReceiptRefund, // 预收退款
+ ReturnApplyOrderTypeReturnForRefund, // 退货退款
+ ReturnApplyOrderTypeSalesRefund, // 销售退款
+ } = REFUND_STATUS_ORDER
- //注册按钮
- type orderBtnsListParams = {id: number, label: string, validatarFunc: (val: typeof orderInfo) => any}
- const orderBtnsList = useRef([
- {
- id: 8,
- label: '申请记录',
- validatarFunc: (orderInfo) => {
- if(orderInfo.sale_mode !== 1) return [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value].includes(orderInfo.stage)
- return false
- },
- },
- {
- id: 1,
- label: '取消退货',
- validatarFunc: (orderInfo) => {
- if(orderInfo?.sale_mode != 1 && orderInfo.type == ReturnApplyOrderTypeReturnForRefund.value) return [ReturnStageApplying.value, ReturnStageWaitCheck.value].includes(orderInfo.stage)
- return false
- }
- },
- {
- id: 4,
- label: '质检结果',
- validatarFunc: (orderInfo) => {
- return orderInfo?.is_quality_check
- }
- },
- {
- id: 5,
- label: '上传物流',
- validatarFunc: (orderInfo) => {
- return orderInfo?.stage == ReturnStageWaitCheck.value
- }
- },
- {
- id: 6,
- label: '取消退款',
- validatarFunc: (orderInfo) => {
- 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)
- return false
- }
- },
- ])
+ //注册按钮
+ type orderBtnsListParams = { id: number; label: string; validatarFunc: (val: typeof orderInfo) => any }
+ const orderBtnsList = useRef([
+ {
+ id: 8,
+ label: '申请记录',
+ validatarFunc: (orderInfo) => {
+ if (orderInfo.sale_mode !== 1)
+ return [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value].includes(orderInfo.stage)
+ return false
+ },
+ },
+ {
+ id: 1,
+ label: '取消退货',
+ validatarFunc: (orderInfo) => {
+ if (orderInfo?.sale_mode != 1 && orderInfo.type == ReturnApplyOrderTypeReturnForRefund.value)
+ return [ReturnStageApplying.value, ReturnStageWaitCheck.value].includes(orderInfo.stage)
+ return false
+ },
+ },
+ {
+ id: 4,
+ label: '质检结果',
+ validatarFunc: (orderInfo) => {
+ return orderInfo?.is_quality_check
+ },
+ },
+ {
+ id: 5,
+ label: '上传物流',
+ validatarFunc: (orderInfo) => {
+ return orderInfo?.stage == ReturnStageWaitCheck.value
+ },
+ },
+ {
+ id: 6,
+ label: '取消退款',
+ validatarFunc: (orderInfo) => {
+ 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)
+ return false
+ },
+ },
+ ])
- //显示的按钮数组
- const orderBtnsShowList: any[] = useMemo(() => {
- return orderBtnsList.current.filter(item => {
- return item.validatarFunc(orderInfo)
- })
- }, [orderInfo])
+ //显示的按钮数组
+ const orderBtnsShowList: any[] = useMemo(() => {
+ return orderBtnsList.current.filter((item) => {
+ return item.validatarFunc(orderInfo)
+ })
+ }, [orderInfo])
-
-
- //点击按钮操作
- const submitBtns = throttle((val, index) => {
- if (val == 1) {
- cancelOrder({title:'要取消退货吗?', val})
- } else if (val == 6) {
- cancelOrder({title:'要取消退款吗?', val})
- } else {
- onClick?.(val)
- }
- }, 600)
-
- //取消退货/退款
- const {fetchData: returnApplyOrderCancelFetchData} = ReturnApplyOrderCancelApi()
- const cancelOrder = ({title = '', val}) => {
- Taro.showModal({
- title,
- success: async function (res) {
- if (res.confirm) {
- let res = await returnApplyOrderCancelFetchData({id: orderInfo?.return_apply_order_id})
- if(res.success) {
- alert.success('取消成功')
- onClick?.(val)
- } else {
- alert.none(res.msg)
- }
- } else if (res.cancel) {
- console.log('用户点击取消')
- }
- }
- })
+ //点击按钮操作
+ const submitBtns = throttle((val, index) => {
+ if (val == 1) {
+ cancelOrder({ title: '要取消退货吗?', val })
+ } else if (val == 6) {
+ cancelOrder({ title: '要取消退款吗?', val })
+ } else {
+ onClick?.(val)
}
+ }, 600)
- //显示更多按钮
- const [showMore, setShowMore] = useState(false)
- const styleTop = useMemo(() => {
- return {top:`-${(orderBtnsShowList.length - 3)*70 + 10}rpx`, left: `-${10}rpx`}
- }, [orderBtnsShowList])
+ //取消退货/退款
+ const { fetchData: returnApplyOrderCancelFetchData } = ReturnApplyOrderCancelApi()
+ const cancelOrder = ({ title = '', val }) => {
+ Taro.showModal({
+ title,
+ success: async function (res) {
+ if (res.confirm) {
+ let res = await returnApplyOrderCancelFetchData({ id: orderInfo?.return_apply_order_id })
+ if (res.success) {
+ alert.success('取消成功')
+ onClick?.(val)
+ } else {
+ alert.none(res.msg)
+ }
+ } else if (res.cancel) {
+ console.log('用户点击取消')
+ }
+ },
+ })
+ }
- return (
- <>
- {(orderBtnsShowList.length > 0)&&
-
- {(orderBtnsShowList.length > 3)&&
- setShowMore(!showMore)}>{!showMore?'更多':'关闭'}
- {showMore&&
-
- {orderBtnsShowList.map((item, index) => {
- return ((index >= 3) && submitBtns(item.id, index)}>{item.label})
- })}
+ //显示更多按钮
+ const [showMore, setShowMore] = useState(false)
+ const styleTop = useMemo(() => {
+ return { top: `-${(orderBtnsShowList.length - 3) * 70 + 10}rpx`, left: `-${10}rpx` }
+ }, [orderBtnsShowList])
+
+ return (
+ <>
+ {orderBtnsShowList.length > 0 && (
+
+
+ {orderBtnsShowList.length > 3 && (
+
+ setShowMore(!showMore)}>{!showMore ? '更多' : '关闭'}
+ {showMore && (
+
+
+ {orderBtnsShowList.map((item, index) => {
+ return (
+ index >= 3 && (
+ submitBtns(item.id, index)}>
+ {item.label}
- {/* setShowMore(false)}> */}
- }
- }
-
-
- {orderBtnsShowList.map((item, index) =>
- (index < 3)&& submitBtns(item.id, index)}>{item.label}
- )}
+ )
+ )
+ })}
-
- }
- >
- )
-})
\ No newline at end of file
+ {/* setShowMore(false)}> */}
+
+ )}
+
+ )}
+
+
+ {orderBtnsShowList.map(
+ (item, index) =>
+ index < 3 && (
+ submitBtns(item.id, index)}>
+ {item.label}
+
+ ),
+ )}
+
+
+
+ )}
+ >
+ )
+})
diff --git a/src/pages/applyAfterSales/index.tsx b/src/pages/applyAfterSales/index.tsx
index bd40d95..bf4647d 100644
--- a/src/pages/applyAfterSales/index.tsx
+++ b/src/pages/applyAfterSales/index.tsx
@@ -1,260 +1,271 @@
-import { Image, ScrollView, Text, View } from "@tarojs/components";
-import { FC, memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
-import classnames from "classnames";
-import styles from './index.module.scss'
-import ReasonPopup from "./components/reasonPopup";
-import Taro, { useDidShow, useRouter } from "@tarojs/taro";
-import { GetSaleOrderDetailApi } from "@/api/order";
-import KindList from "./components/kindList"
-import CutKindList from "./components/cutkindList"
-import { ReturnApplyOrderApi, ReturnExplainApi, ReturnGoodsStatusApi, ReturnReasonApi } from "@/api/salesAfterOrder";
-import { alert, goLink } from "@/common/common";
-import UploadImage from "@/components/uploadImage"
-import TextareaEnhance from "@/components/textareaEnhance";
-import useLogin from "@/use/useLogin";
-import { throttle } from "@/common/util";
+import { Image, ScrollView, Text, View } from '@tarojs/components'
+import { FC, memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import classnames from 'classnames'
+import styles from './index.module.scss'
+import ReasonPopup from './components/reasonPopup'
+import Taro, { useDidShow, useRouter } from '@tarojs/taro'
+import { GetSaleOrderDetailApi } from '@/api/order'
+import KindList from './components/kindList'
+import CutKindList from './components/cutkindList'
+import { ReturnApplyOrderApi, ReturnExplainApi, ReturnGoodsStatusApi, ReturnReasonApi } from '@/api/salesAfterOrder'
+import { alert, goLink } from '@/common/common'
+import UploadImage from '@/components/uploadImage'
+import TextareaEnhance from '@/components/textareaEnhance'
+import useLogin from '@/use/useLogin'
+import { throttle } from '@/common/util'
enum returnStatus {
- return_reason = 1, //原因
- goods_status = 2, //状况
- return_explain = 3, //说明
-
+ return_reason = 1, //原因
+ goods_status = 2, //状况
+ return_explain = 3, //说明
}
export default () => {
- useLogin()
- useDidShow(() => {
- getSaleOrderPreView()
+ useLogin()
+ useDidShow(() => {
+ getSaleOrderPreView()
+ })
+
+ const router = useRouter()
+ const orderId = useRef(Number(router.params.id))
+
+ //需要提交的数据
+ const [submitData, setSubmitData] = useState({
+ fabric_piece_accessory_url: [],
+ goods_status: '', //货物状况
+ reason_describe: '', //其他说明
+ return_explain: '', //退货说明
+ return_reason: '', //退货原因
+ roll: 0,
+ roll_list: [],
+ sale_order_id: orderId.current,
+ })
+
+ //获取订单数据
+ const [orderDetail, setOrderDetail] = useState() //获取到的原始数据
+ 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() //格式化后的数据
+ const formatData = () => {
+ setFormatDetailOrder({
+ ...orderDetail,
+ unit: orderDetail.sale_mode == 0 ? '条' : 'm', //单位
+ list: orderDetail.product_list,
})
+ }
- const router = useRouter()
- const orderId = useRef(Number(router.params.id))
-
- //需要提交的数据
- const [submitData, setSubmitData] = useState({
- fabric_piece_accessory_url: [],
- goods_status: '', //货物状况
- reason_describe: '', //其他说明
- return_explain: '', //退货说明
- return_reason: '', //退货原因
- roll: 0,
- roll_list: [],
- sale_order_id: orderId.current
- })
-
- //获取订单数据
- const [orderDetail, setOrderDetail] = useState() //获取到的原始数据
- const {fetchData: getOrderFetchData} = GetSaleOrderDetailApi()
- const getSaleOrderPreView = async () => {
- if(orderId.current) {
- let res = await getOrderFetchData({id: orderId.current})
- setOrderDetail(res.data)
- }
+ //数据总量
+ const dataCount = useMemo(() => {
+ if (formatDetailOrder) {
+ 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}`
}
+ }, [formatDetailOrder])
- //监听获取到的数据
- useEffect(() => {
- if(orderDetail) {
- formatData()
- }
- }, [orderDetail])
+ //面料数据
+ let roll_list = useRef({})
- //格式化数据格式
- const [formatDetailOrder, setFormatDetailOrder] = useState() //格式化后的数据
- const formatData = () => {
- setFormatDetailOrder({
- ...orderDetail,
- unit: orderDetail.sale_mode == 0?'条':'m', //单位
- list: orderDetail.product_list,
-
- })
+ //大货时获取计步器数据
+ const getNumChange = useCallback((val) => {
+ if (parseInt(val.number) > 0) {
+ roll_list.current[val.color_id] = { product_roll: val.number, sale_order_detail_id: val.sale_order_detail_id }
+ } else {
+ delete roll_list.current[val.color_id]
}
+ setSubmitData((e) => ({ ...e, roll_list: Object.values(roll_list.current) }))
+ }, [])
- //数据总量
- const dataCount = useMemo(() => {
- if(formatDetailOrder) {
- 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}`
- }
- }, [formatDetailOrder])
-
-
-
- //面料数据
- let roll_list = useRef({})
-
- //大货时获取计步器数据
- const getNumChange = useCallback((val) => {
- if(parseInt(val.number) > 0) {
- roll_list.current[val.color_id] = {product_roll: val.number, sale_order_detail_id: val.sale_order_detail_id}
- } else {
- delete roll_list.current[val.color_id]
- }
- setSubmitData((e) => ({...e, roll_list:Object.values(roll_list.current)}))
- }, [])
-
- //散剪和剪板
- const getSelectChange = useCallback((val) => {
- if(val.status) {
- roll_list.current[val.color_id] = {product_roll: val.length, sale_order_detail_id: val.sale_order_detail_id}
- } else {
- delete roll_list.current[val.color_id]
- }
- setSubmitData((e) => ({...e, roll_list:Object.values(roll_list.current)}))
- }, [])
-
- //获取图片列表
- const getImageList = useCallback((list) => {
- setSubmitData((e) => ({...e, fabric_piece_accessory_url:list}))
- }, [])
-
- //其他说明
- const getOtherReason = useCallback((val) => {
- setSubmitData((e) => ({...e, reason_describe: val}))
- }, [])
-
- //提交数据
- const {fetchData: fetchDataReturnApply} = ReturnApplyOrderApi()
- const onSubmitData = async () => {
- if(submitData.roll_list.length <= 0) return alert.none('请选择或输入退货颜色')
- console.log('submitData::',submitData)
- let res = await fetchDataReturnApply(submitData)
- if(res.success) {
- alert.success('申请成功')
- goLink('/pages/salesAfter/salesAfterList/index',{}, 'reLaunch')
- } else {
- alert.error(res.msg)
- }
+ //散剪和剪板
+ const getSelectChange = useCallback((val) => {
+ if (val.status) {
+ roll_list.current[val.sale_order_detail_id] = { product_roll: val.length, sale_order_detail_id: val.sale_order_detail_id }
+ } else {
+ delete roll_list.current[val.sale_order_detail_id]
}
+ setSubmitData((e) => ({ ...e, roll_list: Object.values(roll_list.current) }))
+ }, [])
- //底部按钮
- const onSubmit = throttle((val) => {
- if(val == 2) {
- if(submitData.goods_status === '') return alert.error('请选择货物状况')
- if(submitData.return_explain === '') return alert.error('请选择退货原因')
- if(!submitData.return_explain && !submitData.reason_describe) return alert.error('请填写其他说明')
- onSubmitData()
- } else {
- Taro.navigateBack()
- }
- }, 600)
+ //获取图片列表
+ const getImageList = useCallback((list) => {
+ setSubmitData((e) => ({ ...e, fabric_piece_accessory_url: list }))
+ }, [])
- //退货原因选择弹窗
- const [showReason, setShowReason] = useState(false)
- const closeReason = useCallback(() => setShowReason(false), [])
- const onShowReason = () => {
- setShowReason(true)
+ //其他说明
+ const getOtherReason = useCallback((val) => {
+ setSubmitData((e) => ({ ...e, reason_describe: val }))
+ }, [])
+
+ //提交数据
+ const { fetchData: fetchDataReturnApply } = ReturnApplyOrderApi()
+ const onSubmitData = async () => {
+ if (submitData.roll_list.length <= 0) return alert.none('请选择或输入退货颜色')
+ console.log('submitData::', submitData)
+ let res = await fetchDataReturnApply(submitData)
+ if (res.success) {
+ alert.success('申请成功')
+ goLink('/pages/salesAfter/salesAfterList/index', {}, 'reLaunch')
+ } else {
+ alert.error(res.msg)
}
- useEffect(() => {
- getReturnReason()
- }, [])
+ }
- //请求获取到的数据
- const [returnGoodsInfo, setReturnGoodsInfo] = useState([])
+ //底部按钮
+ const onSubmit = throttle((val) => {
+ if (val == 2) {
+ if (submitData.goods_status === '') return alert.error('请选择货物状况')
+ if (submitData.return_explain === '') return alert.error('请选择退货原因')
+ if (!submitData.return_explain && !submitData.reason_describe) return alert.error('请填写其他说明')
+ onSubmitData()
+ } else {
+ Taro.navigateBack()
+ }
+ }, 600)
- //退货原因
- const {fetchData: fetchDataReturnReason} = ReturnReasonApi()
- const getReturnReason = async () => {
- let res = await fetchDataReturnReason()
- setReturnGoodsInfo((e) => (res.data?.list))
- }
- //售后退货说明
- const {fetchData: fetchDataReturnExplain} = ReturnExplainApi()
- const getReturnExplain = async (id) => {
- let res = await fetchDataReturnExplain({return_reason: id})
- setReturnGoodsInfo((e) => (res.data?.list))
- }
- //退货原因选择列表返回的数据
- const [returnObj, setReturnObj] = useState([])
- const onReturnSelect = useCallback((val) => {
- let res = val.data[val.data.length - 1]
- if(val.index == 1) {
- getReturnExplain(res.id)
- setReturnGoodsInfo(() => [])
- }
- if(val.index == 2) setReturnObj(val.data)
- }, [])
- const onHeaderSelect = useCallback((val) => {
- setReturnGoodsInfo((e) => [])
- if(val.index == 1) getReturnReason()
- }, [])
+ //退货原因选择弹窗
+ const [showReason, setShowReason] = useState(false)
+ const closeReason = useCallback(() => setShowReason(false), [])
+ const onShowReason = () => {
+ setShowReason(true)
+ }
+ useEffect(() => {
+ getReturnReason()
+ }, [])
- //选择货物状况
- const [showStatus, setShowStatus] = useState(false)
- const [statusInfo, setStatusInfo] = useState()
- const [statusGoodsInfo, setStatusGoodsInfo] = useState([])
- const {fetchData: fetchDataGoodsStatus} = ReturnGoodsStatusApi()
- const getReturnGoodsStatus = async () => {
- let res = await fetchDataGoodsStatus()
- setStatusGoodsInfo((e) => (res.data?.list))
- }
- const onShowStatus = () => {
- setShowStatus(() => true)
- getReturnGoodsStatus()
- }
- const closeStatus = useCallback(() => {
- setShowStatus(() => false)
- }, [])
- const onStatusSelect = useCallback((val) => {
- let res = val.data[val.data.length - 1]
- setStatusInfo(res)
- }, [])
-
- useEffect(() => {
- if(returnObj.length > 0) {
- submitData.return_reason = returnObj[0].id
- submitData.return_explain = returnObj[1].id
- }
- if(statusInfo) {
- submitData.goods_status = statusInfo.id
- }
- setSubmitData(() => ({...submitData}))
- }, [returnObj, statusInfo])
+ //请求获取到的数据
+ const [returnGoodsInfo, setReturnGoodsInfo] = useState([])
-
- return (
-
-
- {dataCount}
-
-
- {(orderDetail?.sale_mode == 0)&&||
- }
-
-
- 退货原因
-
- 0&&styles.selected}>{returnObj?.length > 0?(returnObj[0]?.name + '/' +returnObj[1]?.name):'请选择'}
-
-
-
-
- 货物状况
-
- {statusInfo?.name||'请选择'}
-
-
-
-
- 拍照上传
-
-
-
-
-
-
-
-
-
-
-
-
-
- onSubmit(1)}>取消
- onSubmit(2)}>确认
-
-
-
-
+ //退货原因
+ const { fetchData: fetchDataReturnReason } = ReturnReasonApi()
+ const getReturnReason = async () => {
+ let res = await fetchDataReturnReason()
+ setReturnGoodsInfo((e) => res.data?.list)
+ }
+ //售后退货说明
+ const { fetchData: fetchDataReturnExplain } = ReturnExplainApi()
+ const getReturnExplain = async (id) => {
+ let res = await fetchDataReturnExplain({ return_reason: id })
+ setReturnGoodsInfo((e) => res.data?.list)
+ }
+ //退货原因选择列表返回的数据
+ const [returnObj, setReturnObj] = useState([])
+ const onReturnSelect = useCallback((val) => {
+ let res = val.data[val.data.length - 1]
+ if (val.index == 1) {
+ getReturnExplain(res.id)
+ setReturnGoodsInfo(() => [])
+ }
+ if (val.index == 2) setReturnObj(val.data)
+ }, [])
+ const onHeaderSelect = useCallback((val) => {
+ setReturnGoodsInfo((e) => [])
+ if (val.index == 1) getReturnReason()
+ }, [])
+
+ //选择货物状况
+ const [showStatus, setShowStatus] = useState(false)
+ const [statusInfo, setStatusInfo] = useState()
+ const [statusGoodsInfo, setStatusGoodsInfo] = useState([])
+ const { fetchData: fetchDataGoodsStatus } = ReturnGoodsStatusApi()
+ const getReturnGoodsStatus = async () => {
+ let res = await fetchDataGoodsStatus()
+ setStatusGoodsInfo((e) => res.data?.list)
+ }
+ const onShowStatus = () => {
+ setShowStatus(() => true)
+ getReturnGoodsStatus()
+ }
+ const closeStatus = useCallback(() => {
+ setShowStatus(() => false)
+ }, [])
+ const onStatusSelect = useCallback((val) => {
+ let res = val.data[val.data.length - 1]
+ setStatusInfo(res)
+ }, [])
+
+ useEffect(() => {
+ if (returnObj.length > 0) {
+ submitData.return_reason = returnObj[0].id
+ submitData.return_explain = returnObj[1].id
+ }
+ if (statusInfo) {
+ submitData.goods_status = statusInfo.id
+ }
+ setSubmitData(() => ({ ...submitData }))
+ }, [returnObj, statusInfo])
+
+ return (
+
+
+
+ {dataCount}
- )
-}
\ No newline at end of file
+
+
+ {(orderDetail?.sale_mode == 0 && ) || (
+
+ )}
+
+
+ 退货原因
+
+ 0 && styles.selected}>
+ {returnObj?.length > 0 ? returnObj[0]?.name + '/' + returnObj[1]?.name : '请选择'}
+
+
+
+
+
+ 货物状况
+
+ {statusInfo?.name || '请选择'}
+
+
+
+
+ 拍照上传
+
+
+
+
+
+
+
+
+
+
+
+
+ onSubmit(1)}>
+ 取消
+
+ onSubmit(2)}>
+ 确认
+
+
+
+
+
+
+ )
+}
diff --git a/src/pages/collection/components/createPopup/index.tsx b/src/pages/collection/components/createPopup/index.tsx
index 245643b..50426bb 100644
--- a/src/pages/collection/components/createPopup/index.tsx
+++ b/src/pages/collection/components/createPopup/index.tsx
@@ -1,66 +1,75 @@
-import Popup from "@/components/popup";
-import { Input, ScrollView, Text, View } from "@tarojs/components";
-import { memo, useCallback, useEffect, useMemo, useRef } from "react";
-import classnames from "classnames";
-import styles from './index.module.scss'
-import TextareaEnhance from "@/components/textareaEnhance";
-import { CreateFavoriteApi } from "@/api/favorite";
-import { alert } from "@/common/common";
+import Popup from '@/components/popup'
+import { Input, ScrollView, Text, View } from '@tarojs/components'
+import { memo, useCallback, useEffect, useMemo, useRef } from 'react'
+import classnames from 'classnames'
+import styles from './index.module.scss'
+import TextareaEnhance from '@/components/textareaEnhance'
+import { CreateFavoriteApi } from '@/api/favorite'
+import { alert } from '@/common/common'
//原因选择
type ReasonInfoParam = {
- show?: boolean, //显示
- onClose?: () => void, //关闭
- onSuccess?: (val:any) => void, //成功
- defaultValue?: {
- remark: string,
- name: string
- }, //默认数据
+ show?: boolean //显示
+ onClose?: () => void //关闭
+ onSuccess?: (val: any) => void //成功
+ defaultValue?: {
+ remark: string
+ name: string
+ } //默认数据
}
-export default memo(({show = false, onClose, onSuccess, defaultValue}: ReasonInfoParam) => {
-
- const submitData = useRef({
- "name": '',
- "remark": ''
- })
+export default memo(({ show = false, onClose, onSuccess, defaultValue }: ReasonInfoParam) => {
+ const submitData = useRef({
+ name: '',
+ remark: '',
+ })
- const getOtherReason = (val) => {
- submitData.current.remark = val
- }
+ const getOtherReason = (val) => {
+ submitData.current.remark = val
+ }
- const changeInput = (val) => {
- submitData.current.name = val.detail.value
- }
+ const changeInput = (val) => {
+ submitData.current.name = val.detail.value
+ }
- const onSubmit = () => {
- onSuccess?.(submitData.current)
- }
+ const onSubmit = () => {
+ onSuccess?.(submitData.current)
+ }
- useEffect(() => {
- submitData.current = {name: defaultValue?.name!, remark: defaultValue?.remark!}
- }, [defaultValue])
- return (
-
-
-
- 名称
-
-
-
-
-
- 简介
-
-
-
-
-
-
-
- onSubmit()}>确认
-
-
+ useEffect(() => {
+ submitData.current = { name: defaultValue?.name!, remark: defaultValue?.remark! }
+ }, [defaultValue])
+ return (
+
+
+
+ 名称
+
+
+
+
+
+ 简介
+
+
+
+
+
+
+
+ onSubmit()}>
+ 确认
-
- )
-})
\ No newline at end of file
+
+
+
+
+ )
+})
diff --git a/src/pages/depositList/index.scss b/src/pages/depositList/index.scss
index f58398d..c1281cb 100644
--- a/src/pages/depositList/index.scss
+++ b/src/pages/depositList/index.scss
@@ -1,49 +1,53 @@
-.credit-used{
+.credit-used {
height: 100vh;
background-color: #f3f3f3;
- .credit-used-list{
+ .credit-used-list {
background-color: white;
padding: 30px 25px;
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-weight: 400;
color: #000000;
margin-bottom: 20px;
}
- .credit-used-list-price{
+ .credit-used-list-price {
font-size: 28px;
font-weight: 400;
}
- .credit-used-list-right{
- display: flex;align-items: center;
+ .credit-used-list-right {
+ display: flex;
+ align-items: center;
}
- .credit-used-list-right-price view{
- display: flex;align-items: center;
+ .credit-used-list-right-price view {
+ display: flex;
+ align-items: center;
+ justify-content: flex-end;
}
- .credit-used-list-right text{
+ .credit-used-list-right text {
font-size: 30px;
margin-left: 10px;
}
- .credit-used-list-date{
+ .credit-used-list-date {
font-size: 24px;
font-weight: 400;
color: #ababab;
}
- .credit-used-list-orderno{
- font-size: 20px;
+ .credit-used-list-orderno {
+ font-size: 25px;
font-weight: 400;
- margin-top: 20px;
+ margin-top: 16px;
color: #ababab;
}
- .green{
- color: #07C160;
+ .green {
+ color: #07c160;
}
- .red{
- color: #FF0000;
+ .red {
+ color: #ff0000;
}
-}
\ No newline at end of file
+}
diff --git a/src/pages/depositList/index.tsx b/src/pages/depositList/index.tsx
index 4173f14..d71fcc4 100644
--- a/src/pages/depositList/index.tsx
+++ b/src/pages/depositList/index.tsx
@@ -38,12 +38,11 @@ export default () => {
-
+
{[1, 2, 3].includes(res.type as never) ? '+' : '-'}
{formatPriceDiv(res.amount_received_this_time)}
- {/* 处理中 */}
+ 余额:{formatPriceDiv(res.wallet_balance)}
diff --git a/src/pages/details/components/orderCount/index.tsx b/src/pages/details/components/orderCount/index.tsx
index 41e3f13..0fb5e37 100644
--- a/src/pages/details/components/orderCount/index.tsx
+++ b/src/pages/details/components/orderCount/index.tsx
@@ -6,7 +6,7 @@ import Counter from '../counter'
import Big from 'big.js'
import classnames from 'classnames'
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 { GetColorList } from '@/api/materialColor'
import { AddShoppingCartApi } from '@/api/shopCart'
@@ -18,7 +18,6 @@ import LabAndImg from '@/components/LabAndImg'
import VirtualList from '@tarojs/components/virtual-list'
import useCommonData from '@/use/useCommonData'
import LabAndImgShow from '@/components/LabAndImgShow'
-import InfiniteScroll from '@/components/infiniteScroll'
type param = {
show?: true | false
@@ -27,8 +26,6 @@ type param = {
productId?: number
}
export default memo(({ show = false, onClose, title = '', productId = 0 }: param) => {
- const [isPending, startTransition] = useTransition()
-
const { adminUserInfo } = useSelector((state) => state.userInfo)
const [selectList, _] = useState([
@@ -44,15 +41,11 @@ export default memo(({ show = false, onClose, title = '', productId = 0 }: param
//重置数据
useEffect(() => {
const newList = initList(list)
- startTransition(() => {
- setList([...newList])
- })
+ setList([...newList])
condition.current.code_or_name = null
setSearchShow(false)
}, [selectIndex])
- useEffect(() => console.log('isPending::', isPending), [isPending])
-
//获取面料颜色列表
const { fetchData: colorFetchData, state: colorState } = GetColorList()
const [list, setList] = useState([])
@@ -77,16 +70,14 @@ export default memo(({ show = false, onClose, title = '', productId = 0 }: param
}, [show])
//初始化列表数据
- const initList = (list) => {
+ const initList = useCallback((list) => {
const newList = list.map((item) => {
item.count = 0
item.show = false
- item.unit = selectList[selectIndex].unit
- item.formatePrice = Number(formatPriceDiv(item[selectList[selectIndex].priceField]))
return item
})
return newList
- }
+ }, [])
//卸载数据
useEffect(() => {
@@ -199,6 +190,21 @@ export default memo(({ show = false, onClose, title = '', productId = 0 }: param
setSearchShow(false)
}
+ //格式化金额
+ const formatPrice = useCallback(
+ (item) => {
+ const price = Number(formatPriceDiv(item[selectList[selectIndex].priceField]))
+ return (
+
+ ¥
+ {price}
+ /{selectList[selectIndex].eunit}
+
+ )
+ },
+ [selectIndex],
+ )
+
//显示图片弹窗
const [showLabImage, setShowLabImage] = useState(false)
const [labImageValue, setLabImageValue] = useState()
@@ -210,6 +216,47 @@ export default memo(({ show = false, onClose, title = '', productId = 0 }: param
setShowLabImage(() => false)
}, [])
+ //虚拟滚动
+ const Rows = memo(({ id, index, style, data }: any) => {
+ let item = data[index]
+ return (
+ <>
+ {(item && (
+
+
+
+
+
+ {formatHashTag(item.code, item.name)}
+ {formatPrice(item)}
+
+
+ {(!item.show && (
+ onAdd(item)}>
+ 添加
+
+ )) || (
+
+
+
+ )}
+
+
+ )) || }
+ >
+ )
+ })
+
return (
closePopup()}>
@@ -248,49 +295,19 @@ export default memo(({ show = false, onClose, title = '', productId = 0 }: param
{list.length <= 0 && colorState.loading && }
{list.length > 0 && !colorState.loading && (
-
-
- {list.map((item) => {
- return (
-
-
-
-
-
- {formatHashTag(item.code, item.name)}
-
-
- ¥
- {item.formatePrice}
- /{item.unit}
-
-
-
-
- {(!item.show && (
- onAdd(item)}>
- 添加
-
- )) || (
-
- 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}
- />
-
- )}
-
-
- )
- })}
-
-
+
+
+ {Rows}
+
+
+
)}
{list.length <= 0 && !colorState.loading && 暂无此商品}
diff --git a/src/pages/order/components/addressInfoDetail/index.tsx b/src/pages/order/components/addressInfoDetail/index.tsx
index 4a880ce..bc60949 100644
--- a/src/pages/order/components/addressInfoDetail/index.tsx
+++ b/src/pages/order/components/addressInfoDetail/index.tsx
@@ -150,15 +150,24 @@ export default memo(
//根据订单状态判断是否可修改
const limitEdit = () => {
- let res = [SaleorderstatusWaitingPrePayment.value, SaleOrderStatusBooking.value, SaleOrderStatusArranging.value, SaleOrderStatusArranged.value, SaleOrderStatusWaitingPayment.value].includes(
- orderInfo?.status as number,
- )
+ let res = [
+ SaleorderstatusWaitingPrePayment.value,
+ SaleOrderStatusBooking.value,
+ SaleOrderStatusArranging.value,
+ SaleOrderStatusArranged.value,
+ SaleOrderStatusWaitingPayment.value,
+ ].includes(orderInfo?.status as number)
if (!res && status != 1) alert.none('该订单状态不能修改地址!')
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(() => {
return logisticsShowList.includes(orderInfo?.status as number)
}, [orderInfo])
@@ -189,10 +198,14 @@ export default memo(
{(!logisticsShow && (
- onReceivingStatus(1, e)}>
+ onReceivingStatus(1, e)}>
自提
- onReceivingStatus(2, e)}>
+ onReceivingStatus(2, e)}>
物流
diff --git a/src/pages/order/components/advanceOrderState/index.tsx b/src/pages/order/components/advanceOrderState/index.tsx
index cdf9845..f11759a 100644
--- a/src/pages/order/components/advanceOrderState/index.tsx
+++ b/src/pages/order/components/advanceOrderState/index.tsx
@@ -1,74 +1,71 @@
-import { formatImgUrl } from "@/common/fotmat";
-import { Image, Text, View } from "@tarojs/components";
-import { memo, useEffect, useMemo, useRef, useState } from "react";
-import classnames from "classnames";
-import styles from './index.module.scss'
-import dayjs from "dayjs";
-import { useTimeCountDown } from "@/use/useCommon";
-import { ORDER_STATUS, PAYMENT_METHOD } from "@/common/enum";
+import { formatImgUrl } from '@/common/fotmat'
+import { Image, Text, View } from '@tarojs/components'
+import { memo, useEffect, useMemo, useRef, useState } from 'react'
+import classnames from 'classnames'
+import styles from './index.module.scss'
+import dayjs from 'dayjs'
+import { useTimeCountDown } from '@/use/useCommon'
+import { ORDER_STATUS, PAYMENT_METHOD } from '@/common/enum'
type List = {
- status: string,
- time: string,
- tag: string,
- desc: string,
- expire_time: string
+ status: string
+ time: string
+ tag: string
+ desc: string
+ expire_time: string
}
type Param = {
- onRefresh?: () => void,
- orderInfo?: {
- logistics_details:List[], //订单状态列表
- payment_method: number, //支付方式
- status: number, //订单状态
- }
+ onRefresh?: () => void
+ orderInfo?: {
+ logistics_details: List[] //订单状态列表
+ payment_method: number //支付方式
+ status: number //订单状态
+ }
}
+export default memo(({ orderInfo, onRefresh }: Param) => {
+ const { showTime, onStart, timeStatus } = useTimeCountDown()
-export default memo(({orderInfo, onRefresh}:Param) => {
+ //订单状态枚举
+ const { SaleorderstatusWaitingPrePayment } = ORDER_STATUS
- const {showTime, onStart, timeStatus} = useTimeCountDown()
+ //获取预付款最后时间
+ const endTime = useMemo(() => {
+ if (orderInfo?.status == SaleorderstatusWaitingPrePayment.value && orderInfo.logistics_details.length > 0) {
+ return orderInfo.logistics_details[0].expire_time
+ }
+ return ''
+ }, [orderInfo])
- //订单状态枚举
- const {SaleorderstatusWaitingPrePayment} = ORDER_STATUS
+ useEffect(() => {
+ if (endTime) onStart(endTime)
+ }, [endTime])
- //获取预付款最后时间
- const endTime = useMemo(() => {
- if(orderInfo?.status == SaleorderstatusWaitingPrePayment.value && orderInfo.logistics_details.length > 0) {
- return orderInfo.logistics_details[0].expire_time
- }
- return ''
- }, [orderInfo])
+ useEffect(() => {
+ if (timeStatus == 2) onRefresh?.()
+ }, [timeStatus])
- useEffect(() => {
- if(endTime) onStart(endTime)
- }, [endTime])
-
- useEffect(() => {
- if(timeStatus == 2) onRefresh?.()
- }, [timeStatus])
-
-
- return (
-
-
-
- 剩
- {showTime.HH}
- :
- {showTime.MM}
- :
- {showTime.SS}
-
- 支付关闭,订单自动取消
-
-
-
-
- onRefresh?.()}>
-
- 刷新
-
+ return (
+
+
+
+ 剩
+ {showTime.HH}
+ :
+ {showTime.MM}
+ :
+ {showTime.SS}
- )
-})
\ No newline at end of file
+ 支付关闭,订单自动取消
+
+
+
+
+ onRefresh?.()}>
+
+ 刷新
+
+
+ )
+})
diff --git a/src/pages/order/orderList/index.tsx b/src/pages/order/orderList/index.tsx
index c9f3c02..321d73e 100644
--- a/src/pages/order/orderList/index.tsx
+++ b/src/pages/order/orderList/index.tsx
@@ -1,7 +1,7 @@
import Search from '@/components/search'
import useLogin from '@/use/useLogin'
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 styles from './index.module.scss'
import Order from './components/order'
@@ -12,7 +12,6 @@ import OrderStatusList from './components/orderStatusList'
import { AddShoppingCartApi } from '@/api/shopCart'
import ShopCart from '@/components/shopCart'
import { alert } from '@/common/common'
-import { useRouter } from '@tarojs/runtime'
import Payment from '../components/payment'
import ApplyRefund from '../components/applyRefund'
import ReturnRecord from '../components/returnRecord'