From 349d41c62d96afae2e51dbaa0ed3190da37fe818 Mon Sep 17 00:00:00 2001 From: Haiyi <1021441632@qq.com> Date: Wed, 29 Jun 2022 20:09:30 +0800 Subject: [PATCH 01/12] =?UTF-8?q?fix=E4=BF=AE=E5=A4=8D=E9=87=8D=E7=BD=AE?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/sampleComparison/index.tsx | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/pages/sampleComparison/index.tsx b/src/pages/sampleComparison/index.tsx index 6639e3a..6dc80ff 100644 --- a/src/pages/sampleComparison/index.tsx +++ b/src/pages/sampleComparison/index.tsx @@ -18,11 +18,11 @@ export default () => { a2: '', b2: '', }) - - const [colorList, setColorList] = useState({ - one: null, - two: null - }) + type ColorList = { + one?: any, + two?: any + } + const [colorList, setColorList] = useState() const { state: colorState, measureAndGetLab } = useBluetooth() const getLab = async (val) => { @@ -57,25 +57,28 @@ export default () => { useEffect(() => { if (colorState.deviceLab) { - if (colorList.one?.constructor === Object) { - const rgb = toRgb([colorList.one.L, colorList.one.a, colorList.one.b]) + if ((colorList as any).one?.constructor === Object) { + const rgb = toRgb([(colorList as any).one.L, (colorList as any).one.a, (colorList as any).one.b]) setBlueToothColor(`rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`) setTime(getNowTime()) setSearchField({ ...searchField, l1: rgb[0], a1: rgb[1], b1: rgb[2] }) } - if (colorList.two?.constructor === Object) { - const rgb = toRgb([colorList.two.L, colorList.two.a, colorList.two.b]) + if ((colorList as any).two?.constructor === Object) { + + const rgb = toRgb([(colorList as any).two.L, (colorList as any).two.a, (colorList as any).two.b]) setBlueToothColorTwo(`rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`) setTimeTwo(getNowTime()) setSearchField({ ...searchField, l2: rgb[0], a2: rgb[1], b2: rgb[2] }) + } } }, [colorList]) const reset = () => { + setColorList({}) setBlueToothColor('') setBlueToothColorTwo('') setTime('') - setTime('') + setTimeTwo('') setData('') setResult('') } From d0d4219413085db7f1496d7f6aef6f5ab6edc367 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Wed, 29 Jun 2022 20:32:12 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E7=94=B5=E5=AD=90=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=89=88v3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/order.ts | 10 + src/common/constant.js | 4 +- src/components/textareaEnhance/index.tsx | 11 +- src/components/uploadImage/index.tsx | 10 +- src/pages/orderList/index copy.tsx | 194 ++++++++++++++++++ src/pages/orderList/index.tsx | 18 +- .../components/returnLogistics/index.tsx | 11 +- src/pages/salesAfter/index.tsx | 8 +- .../{index copy 2.tsx => index copy.tsx} | 11 +- src/pages/salesAfterList/index.tsx | 11 +- 10 files changed, 252 insertions(+), 36 deletions(-) create mode 100644 src/pages/orderList/index copy.tsx rename src/pages/salesAfterList/{index copy 2.tsx => index copy.tsx} (93%) diff --git a/src/api/order.ts b/src/api/order.ts index 26c175c..952811e 100644 --- a/src/api/order.ts +++ b/src/api/order.ts @@ -99,4 +99,14 @@ export const ReceiveOrderApi = () => { url: `/v1/mall/saleOrder/receive`, method: "put", }) +} + +/** + * 订单状态列表 + */ + export const OrderStatusListApi = () => { + return useRequest({ + url: `/v1/mall/enum/filterSaleOrderStatus`, + method: "get", + }) } \ No newline at end of file diff --git a/src/common/constant.js b/src/common/constant.js index 9eb3a66..3dc9ec4 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -10,8 +10,8 @@ // 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.42:50001/lymarket` // 杰 +// export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添 +export const BASE_URL = `http://192.168.1.42:50001/lymarket` // 杰 // CDN // 生成密钥 diff --git a/src/components/textareaEnhance/index.tsx b/src/components/textareaEnhance/index.tsx index 7d41b2c..80c8c7a 100644 --- a/src/components/textareaEnhance/index.tsx +++ b/src/components/textareaEnhance/index.tsx @@ -1,5 +1,5 @@ import {Textarea, View } from "@tarojs/components"; -import { memo, useMemo, useState } from "react"; +import { memo, useEffect, useMemo, useState } from "react"; import styles from './index.module.scss' import classnames from "classnames"; @@ -17,8 +17,7 @@ export default memo(({onChange, title = '', placeholder = '请输入', defaultVa count: 200, show: false }) - const getDesc = (e) => { - let value = e.detail.value + const getDesc = (value) => { let res = value if(value.length > descData.count) { res = value.slice(0, descData.count) @@ -27,6 +26,10 @@ export default memo(({onChange, title = '', placeholder = '请输入', defaultVa onChange?.(res) } + useEffect(() => { + getDesc(defaultValue) + }, [defaultValue]) + const toggleShowRealTextarea = (show) => { setDescData({...descData, show:show}) } @@ -34,7 +37,7 @@ export default memo(({onChange, title = '', placeholder = '请输入', defaultVa {title} - {descData.show&&|| + {descData.show&&|| toggleShowRealTextarea(true)}>{descData.value||placeholder} } {descData.number +'/'+ descData.count} diff --git a/src/components/uploadImage/index.tsx b/src/components/uploadImage/index.tsx index 8a144be..91d5425 100644 --- a/src/components/uploadImage/index.tsx +++ b/src/components/uploadImage/index.tsx @@ -8,11 +8,17 @@ import styles from './index.module.scss' //图片列表 type ImageParam = { - onChange?:(val: string[]) => void + onChange?:(val: string[]) => void, + defaultList?: string[] } -const PictureItem:FC = memo(({onChange}) => { +const PictureItem:FC = memo(({onChange, defaultList = []}) => { const {getWxPhoto} = useUploadCDNImg() const [imageList, setImageLise] = useState([]) + + useEffect(() => { + setImageLise(defaultList) + }, [defaultList]) + //上传图片 const uploadImage = async () => { let res:any = await getWxPhoto('after-sale') diff --git a/src/pages/orderList/index copy.tsx b/src/pages/orderList/index copy.tsx new file mode 100644 index 0000000..66d344b --- /dev/null +++ b/src/pages/orderList/index copy.tsx @@ -0,0 +1,194 @@ +import Search from "@/components/search" +import useLogin from "@/use/useLogin" +import { Image, ScrollView, Text, View } from "@tarojs/components" +import Taro, { useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro" +import { useCallback, useEffect, useMemo, useRef, useState } from "react" +import styles from './index.module.scss' +import classnames from "classnames"; +import Order from "./components/order" +import InfiniteScroll from "@/components/infiniteScroll" +import {GetOrderStatusListApi, GetOrderListApi, OrderStatusListApi} from '@/api/order' +import { dataLoadingStatus, getFilterData } from "@/common/util" +import OrderStatusList from "./components/orderStatusList" +import Payment from "../order/components/payment" +import { ORDER_STATUS } from "@/common/enum" +import { AddShoppingCartApi } from "@/api/shopCart" +import ShopCart from "@/components/shopCart" +import ApplyRefund from "./components/applyRefund" +import { alert } from "@/common/common" + +export default () => { + const {checkLogin} = useLogin() + useDidShow(async () => { + await checkLogin() + }) + + //搜索参数 + const [searchField, setSearchField] = useState({ + status: -1, + page : 1, + size : 10, + Name:'' + }) + + //获取订单状态 + const {fetchData: orderStatusListFetchData} = OrderStatusListApi() + const [statusList, setStatusList] = useState([{id: -1, name: '全部'}]) + const getOrderStatusList = () => { + const status = Object.values(ORDER_STATUS).map(item => { + return {id: item.value, name: item.label} + }) + setStatusList((e) => [...e, ...status]) + } + useEffect(() => { + getOrderStatusList() + }, []) + + //获取订单列表 + const {fetchData: listFetchData, state:orderState} = GetOrderListApi() + const [orderData, setOrderData] = useState<{list:any[], total:number}>({list:[], total:0}) + const getOrderList = async () => { + let res = await listFetchData(getFilterData(searchField)) + setOrderData({list: res.data.list, total: res.data.total}) + setRefresherTriggeredStatus(() => false) + } + + + //监听筛选条件变化 + useEffect(() => { + getOrderList() + }, [searchField]) + + //上拉加载数据 + const pageNum = useRef({size: searchField.size, page: searchField.page}) + const getScrolltolower = useCallback(() => { + if(orderData.list.length < orderData.total) { + pageNum.current.page++ + const size = pageNum.current.size * pageNum.current.page + setSearchField({...searchField, size }) + } + }, [orderData]) + + //状态改变 + const changeStatus = useCallback((e) => { + pageNum.current.page = 1 + setSearchField((value) => ({...value, status:e, size:10})) + setOrderData(() => ({list:[], total:0})) + }, []) + + + //数据加载状态 + const statusMore = useMemo(() => { + return dataLoadingStatus({list:orderData.list, total: orderData.total, status: orderState.loading}) + }, [orderData, orderState]) + + //输入了搜索关键字 + const getSearchData = useCallback((e) => { + pageNum.current.page = 1 + setOrderData(() => ({list:[], total:0})) + setSearchField((val) => ({...val, name:e, size:10})) + }, []) + + + //列表下拉刷新 + const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false) + const getRefresherRefresh = async () => { + pageNum.current.size = 1 + setRefresherTriggeredStatus(true) + setSearchField((val) => ({...val, size:10})) + } + + //监听点击的按钮 + const clickOrderBtn = useCallback(({status, orderInfo}) => { + setCallBackPayOrderInfo(() => orderInfo) + if(status == 1 || status == 6) { + getOrderList() + } else if(status == 2) { + //去支付 + toPay() + } else if (status == 3) { + //申请退款 + if(!orderInfo?.av_return_roll) return alert.none('该订单已申请过退款') + setRefundShow(true) + } else if (status == 7) { + //购买 + addShopCart(orderInfo) + } + }, [orderData]) + + + const [callBackOrderInfo, setCallBackPayOrderInfo] = useState() + + //去付款 + const [payMentShow, setPayMentShow] = useState(false) + const toPay = () => { + setPayMentShow(true) + } + //关闭支付弹窗 + const closePayShow = useCallback(() => { + setPayMentShow(() => false) + }, []) + //支付成功 + const onPaySuccess = useCallback(() => { + getOrderList() + closePayShow() + }, []) + + //添加购物车 + const [showCart, setShowCart] = useState(false) + const {fetchData:addFetchData} = AddShoppingCartApi() + const addShopCart = async (item) => { + let color_list:{product_color_id: number, roll?: number, length?: number}[] = [] + item?.product_list.map(pitem => { + pitem?.product_colors.map(citem => { + if(item?.sale_mode == 0) { + return color_list.push({product_color_id: citem.id, roll: citem.roll}) + } else { + return color_list.push({product_color_id: citem.id, length: citem.length}) + } + }) + }) + const state = await addFetchData({ + sale_mode: item?.sale_mode, + color_list + }) + if(state.success) { + Taro.showToast({ + title:'已加入购物车' + }) + setShowCart(true) + } else { + Taro.showToast({ + icon:'none', + title: state.msg + }) + } + + } + + //申请退款 + const [refundShow, setRefundShow] = useState(false) + const applyRefundClose = useCallback(() => { + setRefundShow(false) + }, []) + + + return ( + + + + + + + + {orderData?.list.map(item => { + return + })} + + + + setShowCart(false)}/> + + + ) +} diff --git a/src/pages/orderList/index.tsx b/src/pages/orderList/index.tsx index fa55e30..10a3d57 100644 --- a/src/pages/orderList/index.tsx +++ b/src/pages/orderList/index.tsx @@ -1,17 +1,15 @@ import Search from "@/components/search" import useLogin from "@/use/useLogin" -import { Image, ScrollView, Text, View } from "@tarojs/components" -import Taro, { useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro" +import {View } from "@tarojs/components" +import Taro, { useDidShow,} from "@tarojs/taro" import { useCallback, useEffect, useMemo, useRef, useState } from "react" import styles from './index.module.scss' -import classnames from "classnames"; import Order from "./components/order" import InfiniteScroll from "@/components/infiniteScroll" -import {GetOrderStatusListApi, GetOrderListApi} from '@/api/order' +import { GetOrderListApi, OrderStatusListApi} from '@/api/order' import { dataLoadingStatus, getFilterData } from "@/common/util" import OrderStatusList from "./components/orderStatusList" import Payment from "../order/components/payment" -import { ORDER_STATUS } from "@/common/enum" import { AddShoppingCartApi } from "@/api/shopCart" import ShopCart from "@/components/shopCart" import ApplyRefund from "./components/applyRefund" @@ -32,13 +30,11 @@ export default () => { }) //获取订单状态 - // const {fetchData: statusFetchData} = GetOrderStatusListApi() + const {fetchData: orderStatusListFetchData} = OrderStatusListApi() const [statusList, setStatusList] = useState([{id: -1, name: '全部'}]) - const getOrderStatusList = () => { - const status = Object.values(ORDER_STATUS).map(item => { - return {id: item.value, name: item.label} - }) - setStatusList((e) => [...e, ...status]) + const getOrderStatusList = async () => { + let res = await orderStatusListFetchData() + setStatusList((e) => [...e, ...res.data.list]) } useEffect(() => { getOrderStatusList() diff --git a/src/pages/salesAfter/components/returnLogistics/index.tsx b/src/pages/salesAfter/components/returnLogistics/index.tsx index 3d6b19f..e49f04c 100644 --- a/src/pages/salesAfter/components/returnLogistics/index.tsx +++ b/src/pages/salesAfter/components/returnLogistics/index.tsx @@ -11,9 +11,11 @@ type Param = { show?: true|false, onClose?: () => void, onSubmit?: () => void, - id?: number //订单id + id?: number, //订单id + images: string[], //图片列表 + descValue?: string, //描述 } -export default memo(({show = false, onClose, onSubmit, id = 0}: Param) => { +export default memo(({show = false, onClose, onSubmit, id = 0, images = [], descValue = ''}: Param) => { //需要提交的数据 const submitData = useRef({ accessory_url: [], @@ -45,6 +47,7 @@ export default memo(({show = false, onClose, onSubmit, id = 0}: Param) => { } else { alert.error('上传失败') } + onSubmit?.() } return ( @@ -54,11 +57,11 @@ export default memo(({show = false, onClose, onSubmit, id = 0}: Param) => { 上传附件: - + - + onSubmitEven()}>保存 diff --git a/src/pages/salesAfter/index.tsx b/src/pages/salesAfter/index.tsx index d84ae04..b6f3e05 100644 --- a/src/pages/salesAfter/index.tsx +++ b/src/pages/salesAfter/index.tsx @@ -116,9 +116,13 @@ import styles from './index.module.scss' }) } }, [orderDetail]) - const onCloseLogistics = useCallback(() => setLogisticsShow(false), []) + const onCloseLogistics = useCallback(() => { + setLogisticsShow(false) + }, []) //物流成功上传 const logisticsSuccess = useCallback(() => { + console.log('12312132121113') + setLogisticsShow(false) getSaleOrderPreView() }, []) @@ -137,7 +141,7 @@ import styles from './index.module.scss' - + setApplyRecord(false)}/> diff --git a/src/pages/salesAfterList/index copy 2.tsx b/src/pages/salesAfterList/index copy.tsx similarity index 93% rename from src/pages/salesAfterList/index copy 2.tsx rename to src/pages/salesAfterList/index copy.tsx index 2d64951..6cc25ea 100644 --- a/src/pages/salesAfterList/index copy 2.tsx +++ b/src/pages/salesAfterList/index copy.tsx @@ -10,7 +10,7 @@ import InfiniteScroll from "@/components/infiniteScroll" import { dataLoadingStatus, getFilterData } from "@/common/util" import OrderStatusList from "./components/orderStatusList" import { AFTER_ORDER_STATUS } from "@/common/enum" -import { GetSaleOrderListApi, RefundOrderSatausApi } from "@/api/salesAfterOrder" +import { GetSaleOrderListApi } from "@/api/salesAfterOrder" import ReturnLogistics from "./components/returnLogistics" export default () => { @@ -29,10 +29,11 @@ export default () => { //获取订单状态 const [statusList, setStatusList] = useState([{id: -1, name: '全部'}]) - const {fetchData: fetchDataStatus} = RefundOrderSatausApi() - const getOrderStatusList = async () => { - let res = await fetchDataStatus() - setStatusList((e) => [...e, ...res.data.list]) + const getOrderStatusList = () => { + const status = Object.values(AFTER_ORDER_STATUS).map(item => { + return {id: item.value, name: item.label} + }) + setStatusList((e) => [...e, ...status]) } useEffect(() => { getOrderStatusList() diff --git a/src/pages/salesAfterList/index.tsx b/src/pages/salesAfterList/index.tsx index 6cc25ea..2d64951 100644 --- a/src/pages/salesAfterList/index.tsx +++ b/src/pages/salesAfterList/index.tsx @@ -10,7 +10,7 @@ import InfiniteScroll from "@/components/infiniteScroll" import { dataLoadingStatus, getFilterData } from "@/common/util" import OrderStatusList from "./components/orderStatusList" import { AFTER_ORDER_STATUS } from "@/common/enum" -import { GetSaleOrderListApi } from "@/api/salesAfterOrder" +import { GetSaleOrderListApi, RefundOrderSatausApi } from "@/api/salesAfterOrder" import ReturnLogistics from "./components/returnLogistics" export default () => { @@ -29,11 +29,10 @@ export default () => { //获取订单状态 const [statusList, setStatusList] = useState([{id: -1, name: '全部'}]) - const getOrderStatusList = () => { - const status = Object.values(AFTER_ORDER_STATUS).map(item => { - return {id: item.value, name: item.label} - }) - setStatusList((e) => [...e, ...status]) + const {fetchData: fetchDataStatus} = RefundOrderSatausApi() + const getOrderStatusList = async () => { + let res = await fetchDataStatus() + setStatusList((e) => [...e, ...res.data.list]) } useEffect(() => { getOrderStatusList() From 4ac7890915a5213f8a5bfa6b92125624c5868fa6 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Thu, 30 Jun 2022 20:31:51 +0800 Subject: [PATCH 03/12] =?UTF-8?q?=E7=94=B5=E5=AD=90=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=89=88v3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/favorite.ts | 22 ++++++ src/api/salesAfterOrder.ts | 10 +++ src/api/user.ts | 10 +++ src/common/constant.js | 4 +- .../addCollection/index.module.scss | 47 +++++++++++++ src/components/addCollection/index.tsx | 49 +++++++++++++ src/components/shopCart/index.tsx | 24 ++++++- src/components/textareaEnhance/index.tsx | 2 +- src/components/uploadImage/index.tsx | 8 +-- .../components/cutKindList/index.module.scss | 64 +++++++++++++++++ .../components/cutKindList/index.tsx | 69 +++++++++++++++++++ .../components/kindList/index.tsx | 31 ++++----- src/pages/applyAfterSales/index.tsx | 10 ++- .../components/createPopup/index.tsx | 40 +++++------ src/pages/collection/index.tsx | 68 ++++++++++++++---- src/pages/details/index.tsx | 24 +++++-- .../order/components/applyRefund/index.tsx | 28 +++++--- src/pages/order/index.tsx | 6 +- .../salesAfter/components/kindList/index.tsx | 13 +--- src/pages/salesAfter/index.tsx | 11 +-- src/pages/userEdit/index.tsx | 11 ++- src/use/useHttp.ts | 8 +++ 22 files changed, 452 insertions(+), 107 deletions(-) create mode 100644 src/components/addCollection/index.module.scss create mode 100644 src/components/addCollection/index.tsx create mode 100644 src/pages/applyAfterSales/components/cutKindList/index.module.scss create mode 100644 src/pages/applyAfterSales/components/cutKindList/index.tsx diff --git a/src/api/favorite.ts b/src/api/favorite.ts index 964d317..0032d7b 100644 --- a/src/api/favorite.ts +++ b/src/api/favorite.ts @@ -33,4 +33,26 @@ export const DelFavoriteApi = () => { url: `/v1/mall/favorite`, method: "delete", }) +} + +/** + * 更新收藏夹 + * @returns +*/ +export const UpdateFavoriteApi = () => { + return useRequest({ + url: `/v1/mall/favorite`, + method: "put", + }) +} + +/** + * 加入收藏夹 + * @returns +*/ +export const AddFavoriteApi = () => { + return useRequest({ + url: `/v1/mall/favorite/product`, + method: "post", + }) } \ No newline at end of file diff --git a/src/api/salesAfterOrder.ts b/src/api/salesAfterOrder.ts index 9178eea..23a6732 100644 --- a/src/api/salesAfterOrder.ts +++ b/src/api/salesAfterOrder.ts @@ -99,4 +99,14 @@ export const GetSaleOrderListApi = () => { url: `/v1/mall/enum/filterReturnStage`, method: "get", }) +} + +/** + * 退款说明 + */ + export const RefundExplainApi = () => { + return useRequest({ + url: `/v1/mall/enum/refundExplain`, + method: "get", + }) } \ No newline at end of file diff --git a/src/api/user.ts b/src/api/user.ts index 7d7c97f..aa29919 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -68,4 +68,14 @@ import { useRequest } from "@/use/useHttp" url: `/v1/mall/user/binding/company`, method: "put", }) +} + +/** + * 申请下单权限 + */ + export const ApplyOrderAccessApi = () => { + return useRequest({ + url: `/v1/mall/orderAccess/apply`, + method: "post", + }) } \ No newline at end of file diff --git a/src/common/constant.js b/src/common/constant.js index 3dc9ec4..9eb3a66 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -10,8 +10,8 @@ // 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.42:50001/lymarket` // 杰 +export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添 +// export const BASE_URL = `http://192.168.1.42:50001/lymarket` // 杰 // CDN // 生成密钥 diff --git a/src/components/addCollection/index.module.scss b/src/components/addCollection/index.module.scss new file mode 100644 index 0000000..a4e7480 --- /dev/null +++ b/src/components/addCollection/index.module.scss @@ -0,0 +1,47 @@ + +.collection_con{ + padding: 20px ; + .header{ + display: flex; + justify-content: center; + position: relative; + .title{ + font-size: 30px; + font-weight: 700; + } + .miconfont_con{ + position: absolute; + right: 10px; + top: 0; + font-size: 26px; + color: #007AFF; + .miconfont{ + font-size: 30px; + color: #007AFF; + border: 1px solid #007AFF; + border-radius: 50%; + margin-right: 10px; + } + } + } + .scrollView{ + height: 60vh; + } + .collection_item{ + padding: 30px 0 15px 0; + border-bottom: 1px solid #F3F3F3; + .name{ + font-size: 26px; + font-weight: 700; + text{ + font-weight: normal; + } + } + .desc{ + font-size: 22px; + color: #707070; + padding-left: 10px; + margin-top: 20px; + } + } +} \ No newline at end of file diff --git a/src/components/addCollection/index.tsx b/src/components/addCollection/index.tsx new file mode 100644 index 0000000..6e56256 --- /dev/null +++ b/src/components/addCollection/index.tsx @@ -0,0 +1,49 @@ +import Popup from "@/components/popup"; +import { Input, ScrollView, Text, View } from "@tarojs/components"; +import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react"; +import classnames from "classnames"; +import styles from './index.module.scss' +import TextareaEnhance from "@/components/textareaEnhance"; +import { CreateFavoriteApi, FavoriteListApi } from "@/api/favorite"; +import { alert, goLink } from "@/common/common"; +import { getFilterData } from "@/common/util"; + +//原因选择 +type ReasonInfoParam = { + show?: boolean, //显示 + onClose?: () => void, //关闭 + onAdd?: (val: any) => void + +} +export default memo(({show = false, onClose, onAdd}: ReasonInfoParam) => { + //获取列表 + const [list, setList] = useState([]) + const {fetchData: fetchDataList} = FavoriteListApi() + const getFavoriteList = async () => { + let res = await fetchDataList(getFilterData()) + setList(() => res.data.list) + } + useEffect(() => { + if(show) getFavoriteList() + }, [show]) + + return ( + + + + 选择文件夹 + + + goLink('/pages/collection/index')}>新建 + + + + {list?.map((item: any) => onAdd?.(item)} className={styles.collection_item}> + {item.name}({item.product_color_list?.length||0}) + {item.remark} + )} + + + + ) +}) \ No newline at end of file diff --git a/src/components/shopCart/index.tsx b/src/components/shopCart/index.tsx index 905ef9d..91a3c82 100644 --- a/src/components/shopCart/index.tsx +++ b/src/components/shopCart/index.tsx @@ -13,6 +13,7 @@ import { formatHashTag, formatImgUrl, formatPriceDiv } from "@/common/fotmat"; import { setParam } from "@/common/system"; import { debounce } from "@/common/util"; import Counter from "../counter"; +import { ApplyOrderAccessApi, GetAdminUserInfoApi } from "@/api/user"; type param = { show?: true|false, @@ -211,7 +212,25 @@ export default ({show = false, onClose}: param) => { //去结算 - const orderDetail = debounce(() => { + const {fetchData: useFetchData} = GetAdminUserInfoApi() + const orderDetail = debounce( async () => { + let res = await useFetchData() + if(res.data.order_access_status !== 3) { + Taro.showModal({ + title: '提示', + content: '暂未开通下单权限功能,稍后有客服联系您,请注意接受电话。', + cancelText: '联系客服', + confirmText: '我知道', + success: function (res) { + if (res.confirm) { + + } else if (res.cancel) { + console.log('用户点击取消') + } + } + }) + return false + } getSelectId() if(selectIds.current.length == 0) { alert.error('请选择面料') @@ -223,6 +242,7 @@ export default ({show = false, onClose}: param) => { } }, 500) + //计数组件-当后端修改完成才修改前端显示 const {fetchData: fetchDataUpdateShoppingCart} = UpdateShoppingCartApi() const [UpdateShoppingCartLoading, setUpdateShoppingCartLoading] = useState(false) @@ -241,7 +261,7 @@ export default ({show = false, onClose}: param) => { closePopup()} > - + {!selectStatus?'全选':'反选'} diff --git a/src/components/textareaEnhance/index.tsx b/src/components/textareaEnhance/index.tsx index 80c8c7a..6ed0296 100644 --- a/src/components/textareaEnhance/index.tsx +++ b/src/components/textareaEnhance/index.tsx @@ -17,7 +17,7 @@ export default memo(({onChange, title = '', placeholder = '请输入', defaultVa count: 200, show: false }) - const getDesc = (value) => { + const getDesc = (value = '') => { let res = value if(value.length > descData.count) { res = value.slice(0, descData.count) diff --git a/src/components/uploadImage/index.tsx b/src/components/uploadImage/index.tsx index 91d5425..9fe4775 100644 --- a/src/components/uploadImage/index.tsx +++ b/src/components/uploadImage/index.tsx @@ -11,14 +11,14 @@ type ImageParam = { onChange?:(val: string[]) => void, defaultList?: string[] } -const PictureItem:FC = memo(({onChange, defaultList = []}) => { +const PictureItem:FC = memo(({onChange, defaultList}) => { const {getWxPhoto} = useUploadCDNImg() const [imageList, setImageLise] = useState([]) useEffect(() => { - setImageLise(defaultList) + setImageLise(defaultList||[]) }, [defaultList]) - + //上传图片 const uploadImage = async () => { let res:any = await getWxPhoto('after-sale') @@ -33,7 +33,7 @@ const PictureItem:FC = memo(({onChange, defaultList = []}) => { } //监听上传的图片变化 useEffect(() => { - onChange?.(imageList||[]) + onChange?.(imageList) }, [imageList]) //预览图片 diff --git a/src/pages/applyAfterSales/components/cutKindList/index.module.scss b/src/pages/applyAfterSales/components/cutKindList/index.module.scss new file mode 100644 index 0000000..bc49015 --- /dev/null +++ b/src/pages/applyAfterSales/components/cutKindList/index.module.scss @@ -0,0 +1,64 @@ +.apply_after_sales_list{ + padding: 0 20px; + .apply_after_sales_item{ + margin-bottom: 50px; + .apply_after_sales_title{ + display: flex; + align-items: center; + .tag{ + font-size: $font_size_min; + background-color: #CDE5FF; + padding: 5px 10px; + border-radius: 6px; + color: $color_main; + } + .title{ + font-weight: 700; + font-size: $font_size; + margin-left: 20px; + flex:1; + } + } + .color_list { + .color_item{ + display: flex; + align-items: center; + margin: 30px 0; + } + .image{ + width: 70px; + height: 70px; + image{ + width: 100%; + height: 100%; + border-radius: 50%; + } + } + .name_and_number{ + padding-left: 30px; + flex:1; + text{ + &:nth-child(1) { + font-weight: 700; + font-size: $font_size; + } + &:nth-child(2) { + color: $color_font_two; + font-size: $font_size; + margin-left: 20px; + } + } + } + .btn_count{ + width: 216px; + height: 64px; + background-color: #ECF5FF; + border-radius: 40px 0px 16px 0px; + padding: 0 20px; + display: flex; + align-items: center; + } + } + } + +} diff --git a/src/pages/applyAfterSales/components/cutKindList/index.tsx b/src/pages/applyAfterSales/components/cutKindList/index.tsx new file mode 100644 index 0000000..826ef66 --- /dev/null +++ b/src/pages/applyAfterSales/components/cutKindList/index.tsx @@ -0,0 +1,69 @@ +import { formatHashTag, formatImgUrl } from "@/common/fotmat"; +import Counter from "@/components/counter"; +import MCheckbox from "@/components/checkbox"; +import { Image, Text, View } from "@tarojs/components"; +import { FC, memo, useCallback } from "react"; +import styles from './index.module.scss' + +type OrderParam = { + list?: any[], + sale_mode?: number, + sale_mode_name?: string, + unit?: string, + total_colors?: number, + total_fabrics?: number, + total_number?: number, + status?: number, //订单状态 +} + +type Param = { + order: OrderParam, + onSelectChange?: (val: {color_id:number, length: number, status: true|false, sale_order_detail_id:number}) => void +} + +const kindeList:FC = memo(({order, onSelectChange}) => { + //对应数量 + const formatCount = useCallback((item) => { + return (order?.sale_mode == 0? item.roll : Number(item.length / 100)) + order?.unit + }, [order]) + + + //checkbox选中回调 + const selectCallBack = (colorItem) => { + console.log('colorItem::',colorItem) + onSelectChange?.({color_id:colorItem.id, length:colorItem.length, sale_order_detail_id:colorItem.sale_order_detail_id, status: true}) + } + + //checkbox关闭回调 + const colseCallBack = (colorItem) => { + onSelectChange?.({color_id:colorItem.id, length:colorItem.length, status: false, sale_order_detail_id:colorItem.sale_order_detail_id,}) + } + + //判断该面料下的颜色都退完了 + const colorNum = (item) => { + let res = item.product_colors.some(val => { + return val.return_roll == 0 + }) + return res + } + + return ( + + {order?.list?.map(item => colorNum(item)&& + + {order.sale_mode_name} + {formatHashTag(item.code, item.name)} + + + {item.product_colors.map(colorItem => (colorItem.return_roll == 0)&& + + {colorItem.code + ' ' + colorItem.name}x {formatCount(colorItem)} + selectCallBack(colorItem)} onClose={() => colseCallBack(colorItem)}/> + )} + + )} + + ) +}) + +export default kindeList \ No newline at end of file diff --git a/src/pages/applyAfterSales/components/kindList/index.tsx b/src/pages/applyAfterSales/components/kindList/index.tsx index 3a26d92..e4a032b 100644 --- a/src/pages/applyAfterSales/components/kindList/index.tsx +++ b/src/pages/applyAfterSales/components/kindList/index.tsx @@ -19,13 +19,12 @@ type OrderParam = { type Param = { order: OrderParam, onNumChange?: (val:any) => void - onSelectChange?: (val: {color_id:number, length: number, status: true|false}) => void } -const kindeList:FC = memo(({order, onNumChange, onSelectChange}) => { +const kindeList:FC = memo(({order, onNumChange}) => { //对应数量 const formatCount = useCallback((item) => { - return (order?.sale_mode == 0? item.roll : Number(item.length / 100)) + order?.unit + return (item.roll - item.return_roll) + order?.unit! }, [order]) //计步器失返回值 @@ -35,32 +34,28 @@ const kindeList:FC = memo(({order, onNumChange, onSelectChange}) => { } }, []) - //checkbox选中回调 - const selectCallBack = (colorItem) => { - console.log('colorItem::',colorItem) - onSelectChange?.({color_id:colorItem.id, length:colorItem.length, status: true}) - } - - //checkbox关闭回调 - const colseCallBack = (colorItem) => { - onSelectChange?.({color_id:colorItem.id, length:colorItem.length, status: false}) + //判断该面料下的颜色都退完了 + const colorNum = (item) => { + let res = item.product_colors.some(val => { + return val.return_roll < val.roll + }) + return res } return ( - {order?.list?.map(item => + {order?.list?.map(item => (colorNum(item))&& {order.sale_mode_name} {formatHashTag(item.code, item.name)} - {item.product_colors.map(colorItem => + {item.product_colors.map(colorItem => (colorItem.return_roll < colorItem.roll)&& {colorItem.code + ' ' + colorItem.name}x {formatCount(colorItem)} - {(order.sale_mode == 0)&& - - || - selectCallBack(colorItem)} onClose={() => colseCallBack(colorItem)}/>} + + + )} )} diff --git a/src/pages/applyAfterSales/index.tsx b/src/pages/applyAfterSales/index.tsx index 7cfbc41..7d170e5 100644 --- a/src/pages/applyAfterSales/index.tsx +++ b/src/pages/applyAfterSales/index.tsx @@ -6,6 +6,7 @@ import ReasonPopup from "./components/reasonPopup"; import { 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" @@ -67,7 +68,6 @@ export default () => { unit: orderDetail.sale_mode == 0?'条':'m', //单位 list: orderDetail.product_list, status: orderDetail.status, //订单状态 - }) } @@ -101,7 +101,7 @@ export default () => { //散剪和剪板 const getSelectChange = useCallback((val) => { if(val.status) { - roll_list.current[val.color_id] = {product_color_id: val.color_id, product_roll: val.length} + roll_list.current[val.color_id] = {product_color_id: val.color_id, product_roll: val.length, sale_order_detail_id: val.sale_order_detail_id} } else { delete roll_list.current[val.color_id] } @@ -126,6 +126,7 @@ export default () => { const {fetchData: fetchDataReturnApply} = ReturnApplyOrderApi() const onSubmitData = async () => { if(submitData.roll_list.length <= 0) return alert.error('请选择退货颜色') + console.log('submitData::',submitData) let res = await fetchDataReturnApply(submitData) if(res.success) { alert.success('申请成功') @@ -157,6 +158,8 @@ export default () => { setShowReason(true) } + console.log('aaa:', 123456789) + //请求获取到的数据 const [returnGoodsInfo, setReturnGoodsInfo] = useState<{title:string, list: any[], status: 1|2|3}>({title:'', list:[], status: returnStatus.goods_status}) //售后货物状况 @@ -202,7 +205,8 @@ export default () => { {dataCount} - + {(orderDetail?.sale_mode == 0)&&|| + } 退货原因 diff --git a/src/pages/collection/components/createPopup/index.tsx b/src/pages/collection/components/createPopup/index.tsx index f86f664..48ce577 100644 --- a/src/pages/collection/components/createPopup/index.tsx +++ b/src/pages/collection/components/createPopup/index.tsx @@ -1,6 +1,6 @@ import Popup from "@/components/popup"; import { Input, ScrollView, Text, View } from "@tarojs/components"; -import { memo, useCallback, useMemo, useRef } from "react"; +import { memo, useCallback, useEffect, useMemo, useRef } from "react"; import classnames from "classnames"; import styles from './index.module.scss' import TextareaEnhance from "@/components/textareaEnhance"; @@ -11,7 +11,7 @@ import { alert } from "@/common/common"; type ReasonInfoParam = { show?: boolean, //显示 onClose?: () => void, //关闭 - onSuccess?: () => void, //成功 + onSuccess?: (val:any) => void, //成功 defaultValue?: { remark: string, name: string @@ -24,40 +24,34 @@ export default memo(({show = false, onClose, onSuccess, defaultValue}: ReasonInf "remark": '' }) - const getOtherReason = useCallback((val) => { + const getOtherReason = (val) => { submitData.current.remark = val - }, []) - - const changeInput = useCallback((val) => { - submitData.current.name = val.detail.value - }, []) - - //创建 - const {fetchData} = CreateFavoriteApi() - const onSubmit = async () => { - if(!submitData.current.name) return alert.none('请输入收藏夹名称!') - let res = await fetchData(submitData.current) - if(res.success) { - alert.success('创建成功') - onSuccess?.() - } else { - alert.error('创建失败') - } - onClose?.() } + + const changeInput = (val) => { + submitData.current.name = val.detail.value + } + + const onSubmit = () => { + onSuccess?.(submitData.current) + } + + useEffect(() => { + submitData.current = {name: defaultValue?.name!, remark: defaultValue?.remark!} + }, [defaultValue]) return ( 名称 - + 简介 - + diff --git a/src/pages/collection/index.tsx b/src/pages/collection/index.tsx index 13763a5..92bb98c 100644 --- a/src/pages/collection/index.tsx +++ b/src/pages/collection/index.tsx @@ -1,4 +1,4 @@ -import { DelFavoriteApi, FavoriteListApi } from "@/api/favorite"; +import { CreateFavoriteApi, DelFavoriteApi, FavoriteListApi, UpdateFavoriteApi } from "@/api/favorite"; import { alert } from "@/common/common"; import { getFilterData } from "@/common/util"; import Product from "@/components/product"; @@ -32,9 +32,6 @@ export default () => { let res = await fetchDataList(getFilterData({name: searchData})) setList(() => res.data.list) } - useEffect(() => { - getFavoriteList() - }, []) //创建收藏夹 const [collectioinShow, setCollectioinShow] = useState(false) @@ -42,12 +39,31 @@ export default () => { setCollectioinShow(false) }, []) - //创建成功 - const onCreatSuccess = useCallback(() => { - getFavoriteList() - }, []) + const creatShow = () => { + setCollectioinShow(true) + setInitData(() => ({ remark: '',name: '', id:0})) + } + + + //新增 + const {fetchData} = CreateFavoriteApi() + const onCreate = async (submitData) => { + if(!submitData.name) return alert.none('请输入收藏夹名称!') + let res = await fetchData({...submitData}) + if(res.success) { + alert.success('创建成功') + getFavoriteList() + } else { + alert.error('创建失败') + } + } //更多编辑 + const [initData, setInitData] = useState({ + remark: '', + name: '', + id:0 + }) const selectInfo = useRef(null) const [updateShow, setUpdateShow] = useState(false) const closeUpdate = useCallback(() => { @@ -56,6 +72,8 @@ export default () => { const moreUpdate = (item,e) => { e.stopPropagation() selectInfo.current = item + console.log('item:::', item) + setInitData((e) =>({ ...e, remark:item.remark , name: item.name, id: item.id})) setUpdateShow(true) } @@ -84,15 +102,37 @@ export default () => { }, []) //编辑 - const onUpdate = useCallback(() => { - + const {fetchData: updateFavoriteFetchData} = UpdateFavoriteApi() + const onUpdateShow = useCallback(() => { + setCollectioinShow(true) }, []) + const onUpdate = async (submitData) => { + if(!submitData.name) return alert.none('请输入收藏夹名称!') + let res = await updateFavoriteFetchData({...submitData}) + if(res.success) { + alert.success('编辑成功') + getFavoriteList() + } else { + alert.error('编辑失败') + } + } + + //操作文件夹 + const onCreatSuccess = (submitData) => { + if (!initData.id) { + onCreate(submitData) + } else { + onUpdate({...submitData, id: initData.id}) + } + setCollectioinShow(false) + } + return ( - setCollectioinShow(true)}> + {list?.map((item:any) => @@ -104,12 +144,12 @@ export default () => { moreUpdate(item,e)}>更多 - + )} - - + + ) } \ No newline at end of file diff --git a/src/pages/details/index.tsx b/src/pages/details/index.tsx index 87903c5..5b2fbc0 100644 --- a/src/pages/details/index.tsx +++ b/src/pages/details/index.tsx @@ -7,7 +7,7 @@ import OrderCount from './components/orderCount'; import ShopCart from '@/components/shopCart'; import Preview,{colorItem} from './components/preview'; import styles from './index.module.scss' -import { useEffect, useMemo, useRef, useState } from 'react'; +import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import {formatHashTag, formatImgUrl} from '@/common/fotmat' import {GetProductDetailApi} from '@/api/material' import useLogin from '@/use/useLogin'; @@ -16,6 +16,8 @@ import { SHARE_SCENE } from '@/common/enum'; import useUserInfo from '@/use/useUserInfo'; import LabAndImg from '@/components/LabAndImg'; import { alert } from '@/common/common'; +import AddCollection from '@/components/addCollection'; +import { AddFavoriteApi } from '@/api/favorite'; type item = {title:string, img:string, url:string, id:number} @@ -100,11 +102,7 @@ export default (props:Params) => { const [collectStatus, setCollectStatus] = useState(false) const changeCollect = () => { setCollectStatus(!collectStatus) - Taro.showToast({ - title: '收藏成功', - icon: 'success', - duration: 2000 - }) + setCollectionShow(true) } const {setSortCode, userInfo : userObj } = useUserInfo() @@ -134,6 +132,19 @@ export default (props:Params) => { setShowOrderCount(true) } + //加入收藏夹 + const [collectionShow, setCollectionShow] = useState(false) + const {fetchData: addFavoritefetchData} = AddFavoriteApi() + const onAdd = useCallback(async (val) => { + let res = await addFavoritefetchData({favorite_id: val.id, product_id: Number(params.id)}) + if(res.success) { + alert.success('添加成功') + } else { + alert.none(res.msg) + } + setCollectionShow(false) + }, [params]) + //页面下拉刷新 usePullDownRefresh(() => { @@ -202,6 +213,7 @@ export default (props:Params) => { setShowCart(false)}/> setShowPreview(false)}/> + ) diff --git a/src/pages/order/components/applyRefund/index.tsx b/src/pages/order/components/applyRefund/index.tsx index 3f6311e..b64db9d 100644 --- a/src/pages/order/components/applyRefund/index.tsx +++ b/src/pages/order/components/applyRefund/index.tsx @@ -5,7 +5,7 @@ import { memo, useCallback, useEffect, useRef, useState } from "react"; import ReasonPopup from "../reasonPopup"; import styles from './index.module.scss' import classnames from "classnames"; -import { ApplyRefundApi } from "@/api/salesAfterOrder"; +import { ApplyRefundApi, RefundExplainApi } from "@/api/salesAfterOrder"; import { alert } from "@/common/common"; type Param = { @@ -17,21 +17,24 @@ export default memo(({show, onClose, orderId}:Param) => { //提交的数据 const submitData = useRef({ - return_explain: 1, + return_explain: 0, sale_order_id: 0, reason_describe: '' }) useEffect(() => { - if(orderId) + if(orderId) { submitData.current.sale_order_id = orderId + refundExplain() + } + }, [orderId]) //申请退款 const {fetchData} = ApplyRefundApi() const getApplyRefund = async () => { - let res = await fetchData(submitData.current) if(!submitData.current.return_explain) return alert.error('请选择说明原因') + let res = await fetchData(submitData.current) if(res.success) { alert.error('申请成功') } else { @@ -42,6 +45,17 @@ export default memo(({show, onClose, orderId}:Param) => { //获取说明数据 const [list, setList] = useState([]) + const {fetchData: refundExplainFetchdata} = RefundExplainApi() + const refundExplain = async () => { + let res = await refundExplainFetchdata() + setList(res.data.list) + } + const [reason, setReason] = useState({id:0, name:''}) + const reasonSelect = useCallback((e) => { + setReason({...reason, name:e.name, id:e.id}) + submitData.current.return_explain = e.id + closeReason() + }, []) //备注 @@ -71,8 +85,6 @@ export default memo(({show, onClose, orderId}:Param) => { } } - - return ( <> @@ -80,7 +92,7 @@ export default memo(({show, onClose, orderId}:Param) => { 退款说明 setShowReason(true)}> - 请选择 + {reason.name||'请选择'} @@ -93,7 +105,7 @@ export default memo(({show, onClose, orderId}:Param) => { - + ) }) \ No newline at end of file diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index 022c164..132c00c 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -268,9 +268,9 @@ import styles from './index.module.scss' {formatDateTime(orderDetail?.create_time)} - - {formatDateTime(orderDetail?.create_time)} - + {(orderDetail?.payment_time)&& + {formatDateTime(orderDetail?.payment_time)} + } setShowDesc(true)}> 订单备注 diff --git a/src/pages/salesAfter/components/kindList/index.tsx b/src/pages/salesAfter/components/kindList/index.tsx index 2cc8d3a..a6a0bf4 100644 --- a/src/pages/salesAfter/components/kindList/index.tsx +++ b/src/pages/salesAfter/components/kindList/index.tsx @@ -45,18 +45,7 @@ export default memo(({order, comfirm = false}:Param) => { return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${order?.total_number}${order?.unit}` }, [order]) - // const { - // SaleOrderStatusBooking, // 待接单 - // SaleOrderStatusArranging, // 配布中 - // SaleOrderStatusArranged, // 已配布 - // SaleOrderStatusWaitingPayment, // 待付款 - // SaleOrderStatusWaitingDelivery, // 待发货 - // SaleOrderStatusWaitingReceipt, // 待收货 - // SaleOrderStatusAlreadyReceipt, // 已收货 - // SaleOrderStatusComplete, // 已完成 - // SaleOrderStatusRefund, // 已退款 - // SaleOrderStatusCancel, // 已取消 - // } = ORDER_STATUS + //金额列表枚举 const priceList = [ diff --git a/src/pages/salesAfter/index.tsx b/src/pages/salesAfter/index.tsx index b6f3e05..3a31486 100644 --- a/src/pages/salesAfter/index.tsx +++ b/src/pages/salesAfter/index.tsx @@ -1,14 +1,8 @@ -import { - GetSaleOrderDetailApi, - EditSaleOrderRemarkApi, -} from "@/api/order"; -import { GetOrderPayApi } from "@/api/orderPay"; + import { SaleOrderOrderDetailApi } from "@/api/salesAfterOrder"; -import { alert, goLink } from "@/common/common"; import { AFTER_ORDER_STATUS, ORDER_STATUS } from "@/common/enum"; import { formatDateTime, formatImgUrl, formatPriceDiv } from "@/common/fotmat"; import AfterOrderBtns from "@/components/afterOrderBtns"; -import OrderBtns from "@/components/orderBtns"; import SearchInput from "@/components/searchInput"; import { Image, Text, Textarea, View } from "@tarojs/components" import Taro, {useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro"; @@ -121,7 +115,6 @@ import styles from './index.module.scss' }, []) //物流成功上传 const logisticsSuccess = useCallback(() => { - console.log('12312132121113') setLogisticsShow(false) getSaleOrderPreView() }, []) @@ -129,8 +122,6 @@ import styles from './index.module.scss' //显示生气记录 const [applyRecord, setApplyRecord] = useState(false) - //货 - return ( diff --git a/src/pages/userEdit/index.tsx b/src/pages/userEdit/index.tsx index f4bb132..1372fc7 100644 --- a/src/pages/userEdit/index.tsx +++ b/src/pages/userEdit/index.tsx @@ -12,6 +12,7 @@ import useLogin from "@/use/useLogin"; import { useSelector } from "@/reducers/hooks"; import useUploadCDNImg from "@/use/useUploadImage"; import { IMG_CND_Prefix } from "@/common/constant"; +import useUserInfo from "@/use/useUserInfo"; export default () => { const { getPhoneNumber, getAdminUserInfo } = useLogin(); @@ -141,6 +142,14 @@ export default () => { } } + const {removeToken, removeSessionKey, removeUserInfo} = useUserInfo() + const outLogin = () => { + removeToken() + removeSessionKey() + removeUserInfo() + goLink('/pages/index/index',{}, 'switchTab') + } + return ( @@ -174,7 +183,7 @@ export default () => { - {/* */} + handleTextareaSave(value, "Ickname")} /> handleTextareaSave(value, "companyName")} /> diff --git a/src/use/useHttp.ts b/src/use/useHttp.ts index 2a2227d..3930f57 100644 --- a/src/use/useHttp.ts +++ b/src/use/useHttp.ts @@ -171,6 +171,13 @@ export const useRequest = (options:option = { stateRef.current.msg = msg stateRef.current.data = data stateRef.current.total = data?.list ? data?.total : 0 + if(code !== 0) { + Taro.showToast({ + title: `${msg}`, + icon: 'none' + }) + console.log('错误::',msg) + } }else{ if (statusCode === 401) { removeToken() @@ -189,6 +196,7 @@ export const useRequest = (options:option = { stateRef.current.success = false stateRef.current.error = true stateRef.current.msg = e.errMsg + console.log('后台错误信息::',e.errMsg) } stateRef.current.error = false From 1027add14f1d3ae17964d7abe9bc7816ac4d52cb Mon Sep 17 00:00:00 2001 From: Haiyi <1021441632@qq.com> Date: Fri, 1 Jul 2022 17:26:22 +0800 Subject: [PATCH 04/12] =?UTF-8?q?=E5=85=AC=E5=8F=B8=E8=AE=A4=E8=AF=81?= =?UTF-8?q?=E5=8A=A0=E5=A4=9A=E4=B8=AA=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/certification/index.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pages/certification/index.tsx b/src/pages/certification/index.tsx index da5912b..bc53251 100644 --- a/src/pages/certification/index.tsx +++ b/src/pages/certification/index.tsx @@ -36,7 +36,7 @@ export default () => { business_license_url: "", legal_person: "", legal_person_identity: "", - businessLicense: '', + business_license: '', legal_person_identity_url: [], name: "" }); @@ -47,6 +47,9 @@ export default () => { name: [{ message: "请输入企业名称" }], + business_license: [{ + message: "请输入企业营业执照" + }], business_license_url: [{ message: "请上传营业执照" }], @@ -132,7 +135,7 @@ export default () => { setFormData({ ...formData, name: ev.detail.value })} value={formData["name"]} label="企业名称" placeholder="请输入营业执照上的企业名称" required /> {/* */} - setFormData({ ...formData, businessLicense: ev.detail.value })} value={formData["businessLicense"]} style={{ border: "0" }} label="企业营业执照" placeholder="注册号、统一社会信用代码、组织机构代码" required /> + setFormData({ ...formData, business_license: ev.detail.value })} value={formData["business_license"]} style={{ border: "0" }} label="企业营业执照" placeholder="注册号、统一社会信用代码、组织机构代码" required /> handleUploadImage("business_license_url")} className="certification-upload"> {(formData as any)?.business_license_url ? <> From b2f17afe50abd6b3284cee588a7bd8712ba22817 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Fri, 1 Jul 2022 20:28:45 +0800 Subject: [PATCH 05/12] =?UTF-8?q?=E5=94=AE=E5=90=8E=E5=9F=BA=E6=9C=AC?= =?UTF-8?q?=E5=AF=B9=E5=AE=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/user.ts | 13 +- src/common/constant.js | 4 +- src/components/afterOrderBtns/index.tsx | 56 +++-- src/components/orderBtns/index.tsx | 1 - .../components/kindList/index.tsx | 2 +- src/pages/applyAfterSales/index.tsx | 2 +- src/pages/order/comfirm.tsx | 4 +- .../components/addressInfoDetail/index.tsx | 26 ++- .../orderList/components/order/index.tsx | 2 + .../components/addressInfoDetail/index.tsx | 13 +- .../components/applyRecord/index.module.scss | 5 + .../components/applyRecord/index.tsx | 5 +- .../components/cutlKindList/index.module.scss | 131 ++++++++++++ .../components/cutlKindList/index.tsx | 192 ++++++++++++++++++ .../components/kindList/index.module.scss | 5 + .../salesAfter/components/kindList/index.tsx | 93 ++++++--- .../modelKindList/index.module.scss | 131 ++++++++++++ .../components/modelKindList/index.tsx | 168 +++++++++++++++ src/pages/salesAfter/index.tsx | 14 +- .../salesAfterList/components/order/index.tsx | 6 +- 20 files changed, 780 insertions(+), 93 deletions(-) create mode 100644 src/pages/salesAfter/components/cutlKindList/index.module.scss create mode 100644 src/pages/salesAfter/components/cutlKindList/index.tsx create mode 100644 src/pages/salesAfter/components/modelKindList/index.module.scss create mode 100644 src/pages/salesAfter/components/modelKindList/index.tsx diff --git a/src/api/user.ts b/src/api/user.ts index aa29919..ee51fc1 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -78,4 +78,15 @@ import { useRequest } from "@/use/useHttp" url: `/v1/mall/orderAccess/apply`, method: "post", }) -} \ No newline at end of file +} + +/** + * 订阅模板id + */ + export const SubscriptionMessageApi = () => { + return useRequest({ + url: `/v1/mall/subscriptionMessage`, + method: "post", + }) +} + diff --git a/src/common/constant.js b/src/common/constant.js index 9eb3a66..3dc9ec4 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -10,8 +10,8 @@ // 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.42:50001/lymarket` // 杰 +// export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添 +export const BASE_URL = `http://192.168.1.42:50001/lymarket` // 杰 // CDN // 生成密钥 diff --git a/src/components/afterOrderBtns/index.tsx b/src/components/afterOrderBtns/index.tsx index 3fdacbe..5d0bec8 100644 --- a/src/components/afterOrderBtns/index.tsx +++ b/src/components/afterOrderBtns/index.tsx @@ -39,68 +39,64 @@ export default memo(({orderInfo, onClick, onBtnNull}:Param) => { //售后按钮按售后状态归类, value是该订单状态,可能该按钮会出现 const orderBtnsList = useRef([ + { + id: 8, + big_value: [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value], + cut_value: [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value ], + model_value: [], + label: '申请记录' + }, { id: 1, - value: [ReturnStageApplying.value, ReturnStageWaitCheck.value], + big_value: [ReturnStageApplying.value, ReturnStageWaitCheck.value], + cut_value: [], + model_value: [], label: '取消退货' }, { id: 2, - value: [ReturnStageWaitCheck.value], + big_value: [ReturnStageWaitCheck.value], + cut_value: [], + model_value: [], label: '退货物流' }, - // { - // id: 3, - // value: [ReturnStageChecked.value, ReturnStageQualityCheckPendingRefund.value], - // label: '查看物流' - // }, { id: 4, - value: [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value], + big_value: [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value], + cut_value: [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value], + model_value: [], label: '质检结果' }, - // { - // id: 5, - // value: [ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value], - // label: '退货码单' - // }, { id: 6, - value: [ReturnStageApplying.value, ReturnStageServiceOrderPendingRefund.value], + big_value: [ReturnStageApplying.value, ReturnStageServiceOrderPendingRefund.value], + cut_value: [ReturnStageWaitCheck.value, ReturnStageApplying.value], + model_value: [ReturnStageApplying.value], label: '取消退款' }, - // { - // id: 7, - // value: [ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value], - // label: '退款码单' - // }, - { - id: 8, - value: [], - label: '申请记录' - }, + ]) //判断是否显示该按钮 const orderBtnsShow = (item) => { - if(!orderInfo) return false + let key = ['big_value', 'model_value', 'cut_value'] if(item.id == 1) { //取消退货 - return (orderInfo.type == 1)&&item.value.includes(orderInfo.stage) + return (orderInfo.type == 1)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage) } else if (item.id == 6) { //取消退款 - return (orderInfo.type == 2)&&item.value.includes(orderInfo.stage) + return (orderInfo.type == 2)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage) } else if (item.id == 4) { //质检结果 - return (orderInfo?.type == 1)&&item.value.includes(orderInfo.stage) //退货才有 + return (orderInfo?.type == 1)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage) //退货才有 } else { - return item.value.includes(orderInfo.stage) + return item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage) } } //显示的按钮数组 - const orderBtnsShowList: {id: number, value: any, label: string}[] = useMemo(() => { + const orderBtnsShowList: any[] = useMemo(() => { return orderBtnsList.current.filter(item => { return orderBtnsShow(item) }) diff --git a/src/components/orderBtns/index.tsx b/src/components/orderBtns/index.tsx index b0d4ce6..dce9a65 100644 --- a/src/components/orderBtns/index.tsx +++ b/src/components/orderBtns/index.tsx @@ -168,7 +168,6 @@ export default memo(({orderInfo, onClick}:Param) => { //确认订单 const {fetchData: receiveOrderFetchData} = ReceiveOrderApi() const receiveOrder = async () => { - console.log('123456') Taro.showModal({ title: '确定收货?', success: async function (res) { diff --git a/src/pages/applyAfterSales/components/kindList/index.tsx b/src/pages/applyAfterSales/components/kindList/index.tsx index e4a032b..9b7492e 100644 --- a/src/pages/applyAfterSales/components/kindList/index.tsx +++ b/src/pages/applyAfterSales/components/kindList/index.tsx @@ -30,7 +30,7 @@ const kindeList:FC = memo(({order, onNumChange}) => { //计步器失返回值 const getCounterChange = useCallback((colorItem) => { return (number) => { - onNumChange?.({number, color_id: colorItem.id}) + onNumChange?.({number, color_id: colorItem.id, sale_order_detail_id:colorItem.sale_order_detail_id}) } }, []) diff --git a/src/pages/applyAfterSales/index.tsx b/src/pages/applyAfterSales/index.tsx index 7d170e5..7d320eb 100644 --- a/src/pages/applyAfterSales/index.tsx +++ b/src/pages/applyAfterSales/index.tsx @@ -86,7 +86,7 @@ export default () => { //大货时获取计步器数据 const getNumChange = useCallback((val) => { if(parseInt(val.number) > 0) { - roll_list.current[val.color_id] = {product_color_id: val.color_id, product_roll: val.number} + roll_list.current[val.color_id] = {product_color_id: val.color_id, product_roll: val.number, sale_order_detail_id: val.sale_order_detail_id} } else { delete roll_list.current[val.color_id] } diff --git a/src/pages/order/comfirm.tsx b/src/pages/order/comfirm.tsx index 52371dc..e89ba97 100644 --- a/src/pages/order/comfirm.tsx +++ b/src/pages/order/comfirm.tsx @@ -89,7 +89,9 @@ import AddressInfoDetail from "./components/addressInfoDetail"; id: address?.id, name: address?.name, phone: address?.phone, - shipment_mode: address?.shipment_mode + shipment_mode: address?.shipment_mode, + take_goods_address: address?.take_goods_address, + take_goods_phone: address?.take_goods_phone, } }, [preViewOrder]) diff --git a/src/pages/order/components/addressInfoDetail/index.tsx b/src/pages/order/components/addressInfoDetail/index.tsx index f7194be..89b8216 100644 --- a/src/pages/order/components/addressInfoDetail/index.tsx +++ b/src/pages/order/components/addressInfoDetail/index.tsx @@ -31,7 +31,9 @@ type Param = { province_name: string, city_name: string, district_name: string, - address_detail: string + address_detail: string, + take_goods_address: string, + take_goods_phone: string } } @@ -46,14 +48,7 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat }, [orderInfo]) - //地址格式 - const formatAddress = useMemo(() => { - if(addressInfo?.province_name) { - return addressInfo.province_name + addressInfo.city_name + addressInfo.district_name + addressInfo.address_detail - } else { - return '' - } - }, [addressInfo]) + //打开地址列表 const [showAddressList, setShowAddressList] = useState(false) @@ -134,6 +129,15 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat return logisticsShowList.includes(orderInfo?.status as number) }, [orderInfo]) + //地址格式 + const formatAddress = useMemo(() => { + if(receivingStatus == 2) { + return addressInfo?.province_name?addressInfo.province_name + addressInfo.city_name + addressInfo.district_name + addressInfo.address_detail:'' + } else { + return addressInfo?.take_goods_address + } + }, [addressInfo, receivingStatus]) + return ( changeShow()}> @@ -144,8 +148,8 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat {(receivingStatus == 2 && !logisticsShow)&&} - {addressInfo?.name} - {addressInfo?.phone} + {receivingStatus == 1?'管理员':addressInfo?.name} + {receivingStatus == 1?addressInfo?.take_goods_phone: addressInfo?.phone} {!logisticsShow&& diff --git a/src/pages/orderList/components/order/index.tsx b/src/pages/orderList/components/order/index.tsx index 5dbb13c..b21c722 100644 --- a/src/pages/orderList/components/order/index.tsx +++ b/src/pages/orderList/components/order/index.tsx @@ -29,6 +29,7 @@ type Param = { actual_amount: number, //实付金额 wait_pay_amount: number, //待付金额 should_collect_order_id: number, //应付单id + av_return_roll: number }, onClickBtn?: (val:{status:number, orderInfo:Param['value']}) => void } @@ -56,6 +57,7 @@ export default memo(({value, onClickBtn}: Param) => { actual_amount: value?.actual_amount, //实付金额 wait_pay_amount: value?.wait_pay_amount, //待付金额 sale_mode: value?.sale_mode, //订单类型 + av_return_roll: value?.av_return_roll //可退条数 } }, [value]) diff --git a/src/pages/salesAfter/components/addressInfoDetail/index.tsx b/src/pages/salesAfter/components/addressInfoDetail/index.tsx index db4d5f3..ef9438c 100644 --- a/src/pages/salesAfter/components/addressInfoDetail/index.tsx +++ b/src/pages/salesAfter/components/addressInfoDetail/index.tsx @@ -8,7 +8,7 @@ type Param = { return_address?:string, return_phone?: string, onLogistics?: (val: number) => void, - stage?: number + stage?: number, } export default memo(({return_address = '', return_phone = '', onLogistics, stage}:Param) => { const { @@ -30,12 +30,7 @@ export default memo(({return_address = '', return_phone = '', onLogistics, stage //上传物流 const upLogistics = useMemo(() => { return stage == ReturnStageWaitCheck.value - }, [stage]) - - //查看物流 - const showLogistics = useMemo(() => { - return (stage == ReturnStageChecked.value || stage == ReturnStageQualityCheckPendingRefund.value) - }, [stage]) + }, [stage]) return ( @@ -56,8 +51,8 @@ export default memo(({return_address = '', return_phone = '', onLogistics, stage {return_phone} {upLogistics&& onLogistics?.(1)}> 上传物流 - } - {showLogistics&& onLogistics?.(2)}> + + || onLogistics?.(2)}> 查看物流 } diff --git a/src/pages/salesAfter/components/applyRecord/index.module.scss b/src/pages/salesAfter/components/applyRecord/index.module.scss index ad1916d..b9603f6 100644 --- a/src/pages/salesAfter/components/applyRecord/index.module.scss +++ b/src/pages/salesAfter/components/applyRecord/index.module.scss @@ -89,6 +89,11 @@ .order_list_item_price{ font-size: 26px; color: $color_font_three; + text{ + &:nth-child(1) { + margin-right: 10px; + } + } } } .order_list_item_count{ diff --git a/src/pages/salesAfter/components/applyRecord/index.tsx b/src/pages/salesAfter/components/applyRecord/index.tsx index 2d48da6..d631ac3 100644 --- a/src/pages/salesAfter/components/applyRecord/index.tsx +++ b/src/pages/salesAfter/components/applyRecord/index.tsx @@ -98,7 +98,10 @@ export default memo(({show, onClose, onSubmit, id}:Param) => { {colorItem.code + ' ' + colorItem.name} - ¥{standardPrice(colorItem.sale_price)} + + ¥{standardPrice(colorItem.sale_price)} + 总重{standardPrice(colorItem.estimate_weight)} + ×{formatCount(colorItem)}{formatDetailOrder.unit} diff --git a/src/pages/salesAfter/components/cutlKindList/index.module.scss b/src/pages/salesAfter/components/cutlKindList/index.module.scss new file mode 100644 index 0000000..e713a98 --- /dev/null +++ b/src/pages/salesAfter/components/cutlKindList/index.module.scss @@ -0,0 +1,131 @@ + +.kindsList_main{ + margin-top: 20px; +} +.orders_list_con{ + + background-color: #fff; + border-radius: 20px; + padding: 20px; + .orders_return_title{ + font-size: 28px; + font-weight: 700; + padding-bottom: 20px; + } + .order_list{ + &:nth-child(n+2) { + margin-top: 30px; + } + .order_list_title{ + display: flex; + align-items: center; + .tag{ + font-size: $font_size_min; + background-color: #CDE5FF; + padding: 5px 10px; + border-radius: 6px; + color: $color_main; + } + .title{ + font-weight: 700; + font-size: $font_size; + margin-left: 20px; + flex:1; + } + .num{ + color: $color_font_two; + font-size: $font_size_min; + } + } + } + .order_list_scroll{ + margin-top: 30px; + + .order_list_item { + display: flex; + &:nth-child(2) { + margin-top: 30px; + } + .order_list_item_img{ + width: 126px; + height: 126px; + border-radius: 20px; + } + .order_list_item_con{ + display: flex; + width: 100%; + flex:1; + border-bottom: 1px solid #f0f0f0; + height: 150px; + padding-top: 20px; + box-sizing: border-box; + } + .order_list_item_des{ + flex:1; + box-sizing: border-box; + padding-left: 30px; + .order_list_item_title{ + font-weight: 700; + font-size: $font_size; + margin-bottom: 15px; + } + .order_list_item_price{ + font-size: 26px; + color: $color_font_three; + text{ + &:nth-child(n+1) { + margin-right: 20px; + } + } + } + } + .order_list_item_count{ + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-end; + .count_num{ + color: $color_main; + font-size: $font_size; + margin-bottom: 15px; + font-weight: 400; + text{ + font-size: $font_size_min; + } + } + .count_price { + font-size: $font_size; + font-weight: 700; + text{ + font-size: $font_size_min; + } + } + } + } + } + .order_total{ + padding-top: 20px; + display: flex; + justify-content: space-between; + text{ + &:nth-child(1) { + font-size: 28px; + font-weight: 700; + } + &:nth-child(2) { + font-size: 24px; + font-weight: 700; + } + } + } + .order_estimated_amount{ + display: flex; + align-items: flex-end; + flex-direction: column; + padding: 30px 0; + .order_price_des{ + font-size: $font_size_medium; + color: $color_font_two; + } + } +} diff --git a/src/pages/salesAfter/components/cutlKindList/index.tsx b/src/pages/salesAfter/components/cutlKindList/index.tsx new file mode 100644 index 0000000..ca0caf5 --- /dev/null +++ b/src/pages/salesAfter/components/cutlKindList/index.tsx @@ -0,0 +1,192 @@ +import { AFTER_ORDER_STATUS, ORDER_STATUS } from "@/common/enum" +import { formatHashTag, formatPriceDiv, formatWeightDiv } from "@/common/fotmat" +import LabAndImg from "@/components/LabAndImg" +import { Text, View } from "@tarojs/components" +import { memo, useCallback, useMemo } from "react" +import EstimatedAmount from "../estimatedAmount" +import styles from './index.module.scss' + +type OrderParam = { + estimate_amount: number, //预估金额 + list: any[], + sale_mode: number, + sale_mode_name: string, + unit: string, + total_colors: number, + total_fabrics: number, + total_number: number, + stage: number, //订单状态 + type: 1|2, //1退货, 2退款 + total_sale_price: number, //销售金额 + total_should_collect_money: number, //应收金额 + total_weight_error_discount: number, //空差优惠 + the_previous_status: number, //取消订单时的订单状态 + actual_amount: number //实付金额 +} + +type Param = { + order: OrderParam, + comfirm?: boolean //是否是确认订单页面使用 +} + +export default memo(({order, comfirm = false}:Param) => { + //对应数量 + const formatCount = useCallback((item) => { + return order?.sale_mode == 0? item.roll : Number(item.length / 100) + }, [order]) + //对应单价 + const standardPrice = useCallback(price => { + return formatPriceDiv(price).toLocaleString() + '/' + (order?.sale_mode == 1?'m':'kg') + }, [order]) + + //数量格式 + const numText = useMemo(() => { + if(order) + return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${order?.total_number}${order?.unit}` + }, [order]) + + //售后单状态枚举 + const { + ReturnStageApplying, // 申请中 + ReturnStageWaitCheck, // 退货中 + ReturnStageChecked, // 待验布 + ReturnStageReturned, // 已退款 + ReturnStageCancel, // 已取消 + ReturnStageQualityCheckPendingRefund, // 已验布 + ReturnStageServiceOrderPendingRefund, // 待退款 + ReturnStageRejected, // 已拒绝 + } = AFTER_ORDER_STATUS + + + //金额列表枚举 + const priceList = [ + { + id:1, + value:[], + label:'退货条数', + field: '' + }, + { + id:2, + value:[ + ReturnStageServiceOrderPendingRefund.value, + ReturnStageReturned.value + ], + label:'扣款金额', + field: 'total_sale_price' + }, + { + id:3, + value:[ + ReturnStageServiceOrderPendingRefund.value, + ReturnStageReturned.value + ], + label:'其他扣款', + field: 'total_weight_error_discount' + }, + { + id:4, + value:[ + ReturnStageServiceOrderPendingRefund.value, + ReturnStageReturned.value + ], + label:'应退金额', + field: 'total_should_collect_money' + }, + { + id:5, + value:[ReturnStageReturned.value], + label:'退款金额', + field: 'total_should_collect_money' + }, + { + id:6, + value:[ReturnStageReturned.value], + label:'退款去向', + field: 'actual_amount' + }, + { + id:7, + value:[ReturnStageQualityCheckPendingRefund.value], + label:'合计金额', + field: 'actual_amount' + }, + ] + + //是否显示价格 + const showPrice = useCallback((priceInfo) => { + if(priceInfo.value == 8) { + //合计金额 + + } + return priceInfo.value.includes(order?.stage) + }, [order]) + + const priceConDom = useMemo(() => { + if(!order) return + return ( + <> + { + priceList.map(item => { + return <>{showPrice(item)&&} + }) + } + + ) + }, [order]) + + //整理颜色 + const labAndRgbAndUrl = useCallback((item) => { + return {lab:{...item?.lab}, rgb:{...item?.rgb}, texturl_url: item?.texturl_url} + }, []) + + //单价显示判断 + const sale_price_show = useMemo(() => { + return order?.stage != ReturnStageServiceOrderPendingRefund.value && order?.stage != ReturnStageQualityCheckPendingRefund.value + }, [order]) + + return ( + + + {order?.type == 1?'退货信息':'退款信息'} + { + order?.list?.map(item => { + return + + {order.sale_mode_name} + {formatHashTag(item.code, item.name)} + 共{item?.product_colors?.length}种 + + + {item?.product_colors?.map(colorItem => { + return + + + + + + {colorItem.code + ' ' + colorItem.name} + + {sale_price_show&&¥{standardPrice(colorItem.sale_price)}} + 总重{formatWeightDiv(colorItem.estimate_weight)}kg + + + + ×{formatCount(colorItem)}{order.unit} + ¥{formatPriceDiv(colorItem.estimate_amount).toLocaleString()} + + + + })} + + + }) + } + 合计{numText} + + {priceConDom} + + + + ) +}) \ No newline at end of file diff --git a/src/pages/salesAfter/components/kindList/index.module.scss b/src/pages/salesAfter/components/kindList/index.module.scss index de1171e..e713a98 100644 --- a/src/pages/salesAfter/components/kindList/index.module.scss +++ b/src/pages/salesAfter/components/kindList/index.module.scss @@ -72,6 +72,11 @@ .order_list_item_price{ font-size: 26px; color: $color_font_three; + text{ + &:nth-child(n+1) { + margin-right: 20px; + } + } } } .order_list_item_count{ diff --git a/src/pages/salesAfter/components/kindList/index.tsx b/src/pages/salesAfter/components/kindList/index.tsx index a6a0bf4..16d4321 100644 --- a/src/pages/salesAfter/components/kindList/index.tsx +++ b/src/pages/salesAfter/components/kindList/index.tsx @@ -1,5 +1,5 @@ -import { ORDER_STATUS } from "@/common/enum" -import { formatHashTag, formatPriceDiv } from "@/common/fotmat" +import { AFTER_ORDER_STATUS, ORDER_STATUS } from "@/common/enum" +import { formatHashTag, formatPriceDiv, formatWeightDiv } from "@/common/fotmat" import LabAndImg from "@/components/LabAndImg" import { Text, View } from "@tarojs/components" import { memo, useCallback, useMemo } from "react" @@ -45,57 +45,88 @@ export default memo(({order, comfirm = false}:Param) => { return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${order?.total_number}${order?.unit}` }, [order]) - + //售后单状态枚举 + const { + ReturnStageApplying, // 申请中 + ReturnStageWaitCheck, // 退货中 + ReturnStageChecked, // 待验布 + ReturnStageReturned, // 已退款 + ReturnStageCancel, // 已取消 + ReturnStageQualityCheckPendingRefund, // 已验布 + ReturnStageServiceOrderPendingRefund, // 待退款 + ReturnStageRejected, // 已拒绝 + } = AFTER_ORDER_STATUS + //金额列表枚举 const priceList = [ + { id:1, - value:[], - label:'退货条数', - field: 'estimate_amount' - }, - { - id:2, - value:[], + big_value:[ + ReturnStageServiceOrderPendingRefund.value, + ReturnStageReturned.value + ], + cut_value: [ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value], + model_value: [], label:'扣款金额', field: 'total_sale_price' }, { - id:3, - value:[], + id:2, + big_value:[ + ReturnStageServiceOrderPendingRefund.value, + ReturnStageReturned.value + ], + cut_value: [], + model_value: [], label:'其他扣款', field: 'total_weight_error_discount' }, { - id:4, - value:[], + id:3, + big_value:[ + ReturnStageServiceOrderPendingRefund.value, + ReturnStageReturned.value + ], + cut_value: [ReturnStageServiceOrderPendingRefund.value], + model_value: [ + ReturnStageQualityCheckPendingRefund.value, + ReturnStageServiceOrderPendingRefund.value + ], label:'应退金额', field: 'total_should_collect_money' }, { - id:5, - value:[], + id:4, + big_value:[ReturnStageReturned.value], + cut_value: [ReturnStageReturned.value], + model_value: [ReturnStageReturned.value], label:'退款金额', field: 'total_should_collect_money' }, { - id:6, - value:[], + id:5, + big_value:[ReturnStageReturned.value], + cut_value: [ReturnStageReturned.value], + model_value: [ReturnStageReturned.value], label:'退款去向', field: 'actual_amount' }, { - id:7, - value:[], - label:'实付金额', + id:6, + big_value:[ReturnStageQualityCheckPendingRefund.value], + cut_value: [ReturnStageRejected.value, ReturnStageApplying.value, ReturnStageWaitCheck.value, ReturnStageChecked.value, ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value], + model_value: [ReturnStageApplying.value], + label:'合计金额', field: 'actual_amount' - } + }, ] //是否显示价格 - const showPrice = useCallback((priceInfo, status) => { - return priceInfo.value.includes(status) + const showPrice = useCallback((priceInfo) => { + let key = ['big_value', 'model_value', 'cut_value'] + return priceInfo[key[order?.sale_mode]].includes(order?.stage) }, [order]) const priceConDom = useMemo(() => { @@ -104,7 +135,7 @@ export default memo(({order, comfirm = false}:Param) => { <> { priceList.map(item => { - return <>{showPrice(item, order?.stage)&&} + return <>{showPrice(item)&&} }) } @@ -115,6 +146,11 @@ export default memo(({order, comfirm = false}:Param) => { const labAndRgbAndUrl = useCallback((item) => { return {lab:{...item?.lab}, rgb:{...item?.rgb}, texturl_url: item?.texturl_url} }, []) + + //单价显示判断 + const sale_price_show = useMemo(() => { + return order?.stage != ReturnStageServiceOrderPendingRefund.value && order?.stage != ReturnStageQualityCheckPendingRefund.value + }, [order]) return ( @@ -126,7 +162,7 @@ export default memo(({order, comfirm = false}:Param) => { {order.sale_mode_name} {formatHashTag(item.code, item.name)} - 共{item?.product_colors.length}种 + 共{item?.product_colors?.length}种 {item?.product_colors?.map(colorItem => { @@ -137,7 +173,10 @@ export default memo(({order, comfirm = false}:Param) => { {colorItem.code + ' ' + colorItem.name} - ¥{standardPrice(colorItem.sale_price)} + + {sale_price_show&&¥{standardPrice(colorItem.sale_price)}} + 总重{formatWeightDiv(colorItem.estimate_weight)}kg + ×{formatCount(colorItem)}{order.unit} diff --git a/src/pages/salesAfter/components/modelKindList/index.module.scss b/src/pages/salesAfter/components/modelKindList/index.module.scss new file mode 100644 index 0000000..e713a98 --- /dev/null +++ b/src/pages/salesAfter/components/modelKindList/index.module.scss @@ -0,0 +1,131 @@ + +.kindsList_main{ + margin-top: 20px; +} +.orders_list_con{ + + background-color: #fff; + border-radius: 20px; + padding: 20px; + .orders_return_title{ + font-size: 28px; + font-weight: 700; + padding-bottom: 20px; + } + .order_list{ + &:nth-child(n+2) { + margin-top: 30px; + } + .order_list_title{ + display: flex; + align-items: center; + .tag{ + font-size: $font_size_min; + background-color: #CDE5FF; + padding: 5px 10px; + border-radius: 6px; + color: $color_main; + } + .title{ + font-weight: 700; + font-size: $font_size; + margin-left: 20px; + flex:1; + } + .num{ + color: $color_font_two; + font-size: $font_size_min; + } + } + } + .order_list_scroll{ + margin-top: 30px; + + .order_list_item { + display: flex; + &:nth-child(2) { + margin-top: 30px; + } + .order_list_item_img{ + width: 126px; + height: 126px; + border-radius: 20px; + } + .order_list_item_con{ + display: flex; + width: 100%; + flex:1; + border-bottom: 1px solid #f0f0f0; + height: 150px; + padding-top: 20px; + box-sizing: border-box; + } + .order_list_item_des{ + flex:1; + box-sizing: border-box; + padding-left: 30px; + .order_list_item_title{ + font-weight: 700; + font-size: $font_size; + margin-bottom: 15px; + } + .order_list_item_price{ + font-size: 26px; + color: $color_font_three; + text{ + &:nth-child(n+1) { + margin-right: 20px; + } + } + } + } + .order_list_item_count{ + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-end; + .count_num{ + color: $color_main; + font-size: $font_size; + margin-bottom: 15px; + font-weight: 400; + text{ + font-size: $font_size_min; + } + } + .count_price { + font-size: $font_size; + font-weight: 700; + text{ + font-size: $font_size_min; + } + } + } + } + } + .order_total{ + padding-top: 20px; + display: flex; + justify-content: space-between; + text{ + &:nth-child(1) { + font-size: 28px; + font-weight: 700; + } + &:nth-child(2) { + font-size: 24px; + font-weight: 700; + } + } + } + .order_estimated_amount{ + display: flex; + align-items: flex-end; + flex-direction: column; + padding: 30px 0; + .order_price_des{ + font-size: $font_size_medium; + color: $color_font_two; + } + } +} diff --git a/src/pages/salesAfter/components/modelKindList/index.tsx b/src/pages/salesAfter/components/modelKindList/index.tsx new file mode 100644 index 0000000..d33bf66 --- /dev/null +++ b/src/pages/salesAfter/components/modelKindList/index.tsx @@ -0,0 +1,168 @@ +import { AFTER_ORDER_STATUS, ORDER_STATUS } from "@/common/enum" +import { formatHashTag, formatPriceDiv, formatWeightDiv } from "@/common/fotmat" +import LabAndImg from "@/components/LabAndImg" +import { Text, View } from "@tarojs/components" +import { memo, useCallback, useMemo } from "react" +import EstimatedAmount from "../estimatedAmount" +import styles from './index.module.scss' + +type OrderParam = { + estimate_amount: number, //预估金额 + list: any[], + sale_mode: number, + sale_mode_name: string, + unit: string, + total_colors: number, + total_fabrics: number, + total_number: number, + stage: number, //订单状态 + type: 1|2, //1退货, 2退款 + total_sale_price: number, //销售金额 + total_should_collect_money: number, //应收金额 + total_weight_error_discount: number, //空差优惠 + the_previous_status: number, //取消订单时的订单状态 + actual_amount: number //实付金额 +} + +type Param = { + order: OrderParam, + comfirm?: boolean //是否是确认订单页面使用 +} + +export default memo(({order, comfirm = false}:Param) => { + //对应数量 + const formatCount = useCallback((item) => { + return order?.sale_mode == 0? item.roll : Number(item.length / 100) + }, [order]) + //对应单价 + const standardPrice = useCallback(price => { + return formatPriceDiv(price).toLocaleString() + '/' + (order?.sale_mode == 1?'m':'kg') + }, [order]) + + //数量格式 + const numText = useMemo(() => { + if(order) + return `${order?.total_fabrics}种面料,${order?.total_colors}种颜色,共${order?.total_number}${order?.unit}` + }, [order]) + + //售后单状态枚举 + const { + ReturnStageApplying, // 申请中 + ReturnStageWaitCheck, // 退货中 + ReturnStageChecked, // 待验布 + ReturnStageReturned, // 已退款 + ReturnStageCancel, // 已取消 + ReturnStageQualityCheckPendingRefund, // 已验布 + ReturnStageServiceOrderPendingRefund, // 待退款 + ReturnStageRejected, // 已拒绝 + } = AFTER_ORDER_STATUS + + + //金额列表枚举 + const priceList = [ + { + id:1, + value:[ + ReturnStageServiceOrderPendingRefund.value, + ReturnStageReturned.value + ], + label:'应退金额', + field: 'total_should_collect_money' + }, + { + id:2, + value:[ReturnStageReturned.value], + label:'退款金额', + field: 'total_should_collect_money' + }, + { + id:3, + value:[ReturnStageReturned.value], + label:'退款去向', + field: 'actual_amount' + }, + { + id:4, + value:[ReturnStageQualityCheckPendingRefund.value], + label:'合计金额', + field: 'actual_amount' + }, + ] + + //是否显示价格 + const showPrice = useCallback((priceInfo) => { + if(priceInfo.value == 8) { + //合计金额 + + } + return priceInfo.value.includes(order?.stage) + }, [order]) + + const priceConDom = useMemo(() => { + if(!order) return + return ( + <> + { + priceList.map(item => { + return <>{showPrice(item)&&} + }) + } + + ) + }, [order]) + + //整理颜色 + const labAndRgbAndUrl = useCallback((item) => { + return {lab:{...item?.lab}, rgb:{...item?.rgb}, texturl_url: item?.texturl_url} + }, []) + + //单价显示判断 + const sale_price_show = useMemo(() => { + return order?.stage != ReturnStageServiceOrderPendingRefund.value && order?.stage != ReturnStageQualityCheckPendingRefund.value + }, [order]) + + return ( + + + {order?.type == 1?'退货信息':'退款信息'} + { + order?.list?.map(item => { + return + + {order.sale_mode_name} + {formatHashTag(item.code, item.name)} + 共{item?.product_colors?.length}种 + + + {item?.product_colors?.map(colorItem => { + return + + + + + + {colorItem.code + ' ' + colorItem.name} + + {sale_price_show&&¥{standardPrice(colorItem.sale_price)}} + 总重{formatWeightDiv(colorItem.estimate_weight)}kg + + + + ×{formatCount(colorItem)}{order.unit} + ¥{formatPriceDiv(colorItem.estimate_amount).toLocaleString()} + + + + })} + + + }) + } + 合计{numText} + + {priceConDom} + + + + ) +}) \ No newline at end of file diff --git a/src/pages/salesAfter/index.tsx b/src/pages/salesAfter/index.tsx index 3a31486..0a41aca 100644 --- a/src/pages/salesAfter/index.tsx +++ b/src/pages/salesAfter/index.tsx @@ -52,7 +52,7 @@ import styles from './index.module.scss' total_number: orderDetail.total_number, //总数量 total_fabrics: orderDetail.total_fabrics, //面料数量 unit: orderDetail.sale_mode == 0?'条':'m', //单位 - list: orderDetail.product_list, + list: orderDetail.quality_check_pass_product, stage: orderDetail.stage, //订单状态 type: orderDetail.type, //退货or退款 total_sale_price: orderDetail.total_sale_price, //销售金额 @@ -69,7 +69,10 @@ import styles from './index.module.scss' //获取底部按钮点击, 获取按钮状态 const orderStateClick = useCallback((val) => { - + if(val == 8) { + //申请记录 + setApplyRecord(true) + } }, [orderDetail]) //页面下拉刷新 @@ -85,7 +88,7 @@ import styles from './index.module.scss' orderId: orderDetail?.id, settle_mode: orderDetail?.settle_mode, type: orderDetail?.type, //退货or退款 - sale_mode: orderDetail?.sale_model, //订单类型 + sale_mode: orderDetail?.sale_mode, //订单类型 return_apply_order_id: orderDetail?.return_apply_order_id } }, [orderDetail]) @@ -119,13 +122,14 @@ import styles from './index.module.scss' getSaleOrderPreView() }, []) - //显示生气记录 + //显示记录 const [applyRecord, setApplyRecord] = useState(false) + return ( - + diff --git a/src/pages/salesAfterList/components/order/index.tsx b/src/pages/salesAfterList/components/order/index.tsx index 749d956..8170c64 100644 --- a/src/pages/salesAfterList/components/order/index.tsx +++ b/src/pages/salesAfterList/components/order/index.tsx @@ -77,16 +77,16 @@ export default memo(({value, onClickBtn}: Param) => { goLink('/pages/salesAfter/index', {id: value?.id})}> {value?.sale_mode_name} - {formatHashTag(value?.product_list[0].code, value?.product_list[0].name)} + {formatHashTag(value?.product_list?.[0].code, value?.product_list?.[0].name)} {value?.stage_name} - {value?.product_list[0].product_colors[0].code} + {value?.product_list?.[0].product_colors?.[0].code} - {value?.product_list[0].product_colors.map((itemColor, index) => { + {value?.product_list?.[0].product_colors.map((itemColor, index) => { return ( (index <= 1)&& {formatHashTag(itemColor.code, itemColor.name)} From 06aeda9e6b1b2e072beeff1f21a5060a6e32bc0e Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Sat, 2 Jul 2022 19:10:53 +0800 Subject: [PATCH 06/12] =?UTF-8?q?=E7=94=B5=E5=AD=90=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=89=88v3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/user.ts | 2 +- src/common/constant.js | 4 +- src/common/enum.ts | 7 + src/components/orderBtns/index.tsx | 17 ++- src/components/shopCart/index.tsx | 7 +- src/pages/order/comfirm.tsx | 36 +++-- src/pages/order/components/payment/index.tsx | 54 ++++---- src/pages/order/components/scanPay/index.tsx | 132 +++++++++++-------- src/pages/order/index.tsx | 3 +- src/use/useCommonData.ts | 31 +++++ 10 files changed, 185 insertions(+), 108 deletions(-) diff --git a/src/api/user.ts b/src/api/user.ts index ee51fc1..0eaf833 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -86,7 +86,7 @@ import { useRequest } from "@/use/useHttp" export const SubscriptionMessageApi = () => { return useRequest({ url: `/v1/mall/subscriptionMessage`, - method: "post", + method: "get", }) } diff --git a/src/common/constant.js b/src/common/constant.js index 3dc9ec4..d13b4bf 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -9,9 +9,9 @@ // export const BASE_URL = `http://192.168.1.30:50001/lymarket` // 发 // export const BASE_URL = `https://dev.zzfzyc.com/lymarket` // 开发环境 // export const BASE_URL = `https://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.42:50001/lymarket` // 杰 +// export const BASE_URL = `http://192.168.1.42:50001/lymarket` // 杰 // CDN // 生成密钥 diff --git a/src/common/enum.ts b/src/common/enum.ts index 51d35a0..a3a8877 100644 --- a/src/common/enum.ts +++ b/src/common/enum.ts @@ -50,3 +50,10 @@ export const SHARE_SCENE = { ShareDetail: {value:1, label:'详情分享'}, SharePage : {value:2, label:'页面分享'}, } + +//订阅消息 +export const SUBSCRIPTION_MESSAGE_SCENE = { + SubmitOrder: {value:1, label:'确认下单'}, + ToPay : {value:2, label:'去付款'}, + ApplyGoods: {value:3, label: '申请退款'} +} \ No newline at end of file diff --git a/src/components/orderBtns/index.tsx b/src/components/orderBtns/index.tsx index dce9a65..1ed060d 100644 --- a/src/components/orderBtns/index.tsx +++ b/src/components/orderBtns/index.tsx @@ -1,6 +1,6 @@ import { CancelOrderApi, ReceiveOrderApi } from "@/api/order" import { alert, goLink } from "@/common/common" -import { ORDER_STATUS, SALE_MODE } from "@/common/enum" +import { ORDER_STATUS, SALE_MODE, SUBSCRIPTION_MESSAGE_SCENE } from "@/common/enum" import {Text, View } from "@tarojs/components" import Taro from "@tarojs/taro" import {useRef, memo, useState, useMemo } from "react" @@ -8,6 +8,7 @@ import classnames from "classnames"; import styles from './index.module.scss' import { AddShoppingCartApi } from "@/api/shopCart" import { ApplyRefundApi } from "@/api/salesAfterOrder" +import { UseSubscriptionMessage } from "@/use/useCommonData" type Param = { orderInfo: { @@ -126,22 +127,29 @@ export default memo(({orderInfo, onClick}:Param) => { }) }, [orderInfo]) - + //订阅消息 + const {ApplyGoods} = SUBSCRIPTION_MESSAGE_SCENE + const {openSubscriptionMessage} = UseSubscriptionMessage() //点击按钮操作 - const submitBtns = (val, index) => { + const submitBtns = async (val, index) => { if (val == 1) { cancelOrder() } else if (val == 6) { receiveOrder() } else if(val == 5) { if(!orderInfo?.av_return_roll) return alert.none('该订单没有可退条数') - goLink('/pages/applyAfterSales/index',{id:orderInfo?.orderId}) + await openSubscriptionMessage({orderId: orderInfo?.orderId, scenes: ApplyGoods.value}) + goLink('/pages/applyAfterSales/index',{id:orderInfo?.orderId}) + } else if (val == 3) { + await openSubscriptionMessage({orderId: orderInfo?.orderId, scenes: ApplyGoods.value}) + onClick?.(val) } else if(val == 8) { applyRefund() } else { onClick?.(val) } + } //取消订单 @@ -194,6 +202,7 @@ export default memo(({orderInfo, onClick}:Param) => { title: '确定退款?', success: async function async (res) { if(res.confirm) { + await openSubscriptionMessage({orderId: orderInfo?.orderId, scenes: ApplyGoods.value}) let res = await fetchDataApplyRefund({sale_order_id: orderInfo?.orderId}) if(res.success) { alert.success('申请成功') diff --git a/src/components/shopCart/index.tsx b/src/components/shopCart/index.tsx index 91a3c82..7ea4d1c 100644 --- a/src/components/shopCart/index.tsx +++ b/src/components/shopCart/index.tsx @@ -13,7 +13,7 @@ import { formatHashTag, formatImgUrl, formatPriceDiv } from "@/common/fotmat"; import { setParam } from "@/common/system"; import { debounce } from "@/common/util"; import Counter from "../counter"; -import { ApplyOrderAccessApi, GetAdminUserInfoApi } from "@/api/user"; +import { ApplyOrderAccessApi, GetAdminUserInfoApi, SubscriptionMessageApi } from "@/api/user"; type param = { show?: true|false, @@ -213,9 +213,11 @@ export default ({show = false, onClose}: param) => { //去结算 const {fetchData: useFetchData} = GetAdminUserInfoApi() + const {fetchData: applyOrderAccessFetchData} = ApplyOrderAccessApi() const orderDetail = debounce( async () => { let res = await useFetchData() if(res.data.order_access_status !== 3) { + if(res.data.order_access_status == 1) applyOrderAccessFetchData() Taro.showModal({ title: '提示', content: '暂未开通下单权限功能,稍后有客服联系您,请注意接受电话。', @@ -223,7 +225,6 @@ export default ({show = false, onClose}: param) => { confirmText: '我知道', success: function (res) { if (res.confirm) { - } else if (res.cancel) { console.log('用户点击取消') } @@ -256,7 +257,7 @@ export default ({show = false, onClose}: param) => { getShoppingCart() } }, 300) - + return ( closePopup()} > diff --git a/src/pages/order/comfirm.tsx b/src/pages/order/comfirm.tsx index e89ba97..586b157 100644 --- a/src/pages/order/comfirm.tsx +++ b/src/pages/order/comfirm.tsx @@ -5,16 +5,16 @@ import { View } from "@tarojs/components" import Taro, { useDidShow, usePullDownRefresh} from "@tarojs/taro"; import classnames from "classnames"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; -import AddressInfo from "./components/addressInfo"; import KindList from "./components/kindList"; import Remark from "./components/remark"; import styles from './comfirm.module.scss' import { getParam } from "@/common/system"; -import useLogin from "@/use/useLogin"; import { alert, goLink } from "@/common/common"; -import ShipmentMode from "../editOrder/components/shipmentMode"; import SubmitOrderBtn from "./components/submitOrderBtn"; import AddressInfoDetail from "./components/addressInfoDetail"; +import { SubscriptionMessageApi } from "@/api/user"; +import { SUBSCRIPTION_MESSAGE_SCENE } from "@/common/enum"; +import { UseSubscriptionMessage } from "@/use/useCommonData"; export default () => { @@ -134,9 +134,13 @@ import AddressInfoDetail from "./components/addressInfoDetail"; } }, [formatPreViewOrder]) + //订阅消息 + const {SubmitOrder} = SUBSCRIPTION_MESSAGE_SCENE + const {openSubscriptionMessage} = UseSubscriptionMessage() + //提交订单 const {fetchData: saleOrderFetchData} = SaleOrderApi() - const submitOrderEven = () => { + const submitOrderEven = async () => { if(!submitOrderData?.shipment_mode) { alert.error('请选择收货方式') return false @@ -145,28 +149,20 @@ import AddressInfoDetail from "./components/addressInfoDetail"; alert.error('请选择地址') return false } - - Taro.showModal({ - title: '确定提交?', - success: async function (res) { - if (res.confirm) { - const res = await saleOrderFetchData(submitOrderData) - if(res.success) { - goLink('/pages/order/index',{id: res.data.id}, 'redirectTo') - } else { - alert.none(res.msg) - } - } else if (res.cancel) { - console.log('用户点击取消') - } - } - }) + await openSubscriptionMessage({scenes: SubmitOrder.value}) + const res = await saleOrderFetchData(submitOrderData) + if(res.success) { + goLink('/pages/order/index',{id: res.data.id}, 'redirectTo') + } else { + alert.none(res.msg) + } } //页面下拉刷新 usePullDownRefresh(() => { getSaleOrderPreView() }) + return ( diff --git a/src/pages/order/components/payment/index.tsx b/src/pages/order/components/payment/index.tsx index 7476080..befa8cc 100644 --- a/src/pages/order/components/payment/index.tsx +++ b/src/pages/order/components/payment/index.tsx @@ -11,7 +11,8 @@ import ScanPay from "../scanPay"; import { GetOrderPayApi, SubmitOrderPayApi, GetPrepayOrderPayApi, SubmitPrepayOrderPayApi } from "@/api/orderPay"; import { formatPriceDiv } from "@/common/fotmat"; import {alert} from "@/common/common" -import { ORDER_STATUS, PAYMENT_METHOD, PAYMENT_METHOD_PARAM } from "@/common/enum"; +import { ORDER_STATUS, PAYMENT_METHOD, PAYMENT_METHOD_PARAM, SUBSCRIPTION_MESSAGE_SCENE } from "@/common/enum"; +import { UseSubscriptionMessage } from "@/use/useCommonData"; type Param = { show?: true|false, @@ -21,11 +22,13 @@ type Param = { } type OrderInfo = { + id?: number, //销售单id should_collect_order_id?: number, //应付单id pre_collect_order_id?: number, //预付单id status?: number, //订单状态 payment_method?: 0|PAYMENT_METHOD_PARAM //支付方式 - sale_mode?: number //订单类型 0:大货 1剪板 2散剪 + sale_mode?: number, //订单类型 0:大货 1剪板 2散剪 + [val: string]: any } type PayStatus = 1|2|3|4|5|null //1:预存款, 2:账期,3:线下汇款, 4:扫码支付, 5:货到付款 @@ -88,28 +91,36 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) const periodSelectData = (val) => { setSubmitData((e) => ({...e, payment_method:val})) } + + //订阅消息 + const {ToPay} = SUBSCRIPTION_MESSAGE_SCENE + const {openSubscriptionMessage} = UseSubscriptionMessage() //提交支付 const {fetchData: submitFetchData} = SubmitOrderPayApi() //应收单提交 const {fetchData: submitPrepayOrderFetchData} = SubmitPrepayOrderPayApi() //预付单提交 const submitPay = async () => { - if(submitData.payment_method === null) { - alert.error('请选择支付方式') - return false - } - alert.loading('正在支付') - let res:any = null - if(orderInfo?.should_collect_order_id) { - res = await submitFetchData(submitData) - } else { - res = await submitPrepayOrderFetchData(submitData) - } - if(res.success) { - alert.success('支付成功') - onSubmitSuccess?.() - } else { - alert.none(res.msg) - } + if(submitData.payment_method === null) { + alert.error('请选择支付方式') + return false + } + //账期支付,或预付款并且不是剪板才会订阅 + if((submitData.payment_method == PaymentMethodAccountPeriod.value || orderInfo?.status == SaleorderstatusWaitingPrePayment.value)&& orderInfo?.sale_mode != 1) { + await openSubscriptionMessage({orderId: orderInfo?.id, scenes: ToPay.value}) + } + alert.loading('正在支付') + let res:any = null + if(orderInfo?.should_collect_order_id) { + res = await submitFetchData(submitData) + } else { + res = await submitPrepayOrderFetchData(submitData) + } + if(res.success) { + alert.success('支付成功') + onSubmitSuccess?.() + } else { + alert.none(res.msg) + } } //预付款 @@ -122,7 +133,6 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) //是否显示七天账期 const show_account_payment = useMemo(() => { - console.log('orderInfo?.status::123',orderInfo) //剪板合散剪不显示 if(orderInfo?.sale_mode != 0) return false //支付方式是账期支付,不显示 @@ -151,7 +161,7 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) - 订单支付 + 待支付款项 @@ -215,7 +225,7 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) setofflinePayShow(false)} offlineInfo={payInfo?.offline_remittance_information}/> - setScanPayShow(false)}/> + setScanPayShow(false)} /> ) diff --git a/src/pages/order/components/scanPay/index.tsx b/src/pages/order/components/scanPay/index.tsx index d6fb06e..ba3554b 100644 --- a/src/pages/order/components/scanPay/index.tsx +++ b/src/pages/order/components/scanPay/index.tsx @@ -5,7 +5,7 @@ import styles from './index.module.scss' import Popup from "@/components/popup"; import Taro from "@tarojs/taro"; import { alert } from "@/common/common"; -import { formatImgUrl } from "@/common/fotmat"; +import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from "@/common/fotmat"; import useCheckAuthorize from "@/use/useCheckAuthorize"; import { GetPayCode } from "@/api/onlinePay"; import LoadingCard from "@/components/loadingCard"; @@ -13,45 +13,91 @@ import LoadingCard from "@/components/loadingCard"; type Param = { show?: true|false, - onClose?: () => void + onClose?: () => void, + company?: string, + qrcode?: string, + orderInfo?: any, + } - - -type Item = { +type ListParam = { product_code: string, product_name: string, product_color_code: string, product_color_name: string, num: string, weight: string, + length: string, sale_price: string, total_price: string } -type CodeParam = { - title: string, - company: string, - order_type: string, - sale_user: string, - order_created_time: string, - order_no: string, - department: string, - shipment_mode: string, - target_user_name: string, - target_address: string, - target_description: string, - pay_account: string, - bank_account_name: string, - bank_name: string, - pay_type: string, - client: string, - phone: string, - order_total_length: string, - order_total_price: string, - qrcode: string, - order_total_weight: string, - list: Item[] -} -export default memo(({show = true, onClose}:Param) => { +export default memo(({show = true, onClose, company, orderInfo}:Param) => { + const [detail, setDetail] = useState() + + useEffect(() => { + if(orderInfo) { + console.log('orderInfo::',orderInfo) + let lists:ListParam[] = [] + orderInfo.product_list?.map(pitem => { + pitem?.product_colors?.map(citem => { + lists.push({ + product_code: formatHashTag(pitem.code, '', 'name')!, + product_name: pitem.name, + product_color_code: formatHashTag(citem.code)!, + product_color_name: citem.name, + num: citem.roll + '', + length: (citem.length/100) + '', + weight: formatWeightDiv(citem.estimate_weight) + '', + sale_price: formatPriceDiv(citem.sale_price) + '', + total_price: formatPriceDiv(citem.estimate_amount) + '', + }) + }) + }) + setDetail(() => ({ + title: "面料销售电子确认单", + company: orderInfo.company_name, //后端公司 + order_type: orderInfo.sale_mode_name, //类型:大货 + sale_user: orderInfo.sale_user_name, //业务员 + order_created_time: formatDateTime(orderInfo.create_time), + order_no: orderInfo.order_no, + shipment_mode: orderInfo.shipment_mode_name, //发货方式 + target_user_name: userName(orderInfo), //收件人 + target_address: address(orderInfo), //收货地址 + target_description: orderInfo.remark, //发货备注 + pay_account:"1234567890123450001", //专属收款账号 + bank_account_name:"佛山市浩川长盛科技有限公司", //账户名称 + bank_name:"招商银行佛山分行禅城支行", //开户银行 + pay_type:"", //支付方式, 可不传 + client: orderInfo.purchaser_name, //客户名称 + phone: userPhone(orderInfo), //收货手机号码 + order_total_length: (orderInfo.total_number/100) + '', //订单布匹长度 + order_total_price: formatPriceDiv(orderInfo.total_sale_price) + '', //订单价格 + order_total_num: orderInfo.total_number + '', + qrcode:"", //跳转链接 + order_total_weight: formatWeightDiv(orderInfo.total_estimate_weight) + '', //订单布匹重量 + list: lists + })) + } + }, [orderInfo]) + + //收货地址 + const address = (addressInfo) => { + if(addressInfo?.shipment_mode == 2) { + return addressInfo?.province_name?addressInfo.province_name + addressInfo.city_name + addressInfo.district_name + addressInfo.address_detail:'' + } else { + return addressInfo?.take_goods_address + } + } + + //收件人 + const userName = (addressInfo) => { + return addressInfo?.shipment_mode == 2? orderInfo.target_user_name: '' + } + + //手机号 + const userPhone = (addressInfo) => { + return addressInfo?.shipment_mode == 2? orderInfo.target_user_phone : orderInfo.take_goods_phone + } + //获取支付二维码 const [payCodeImage, setPayCodeImage] = useState('') @@ -61,30 +107,7 @@ export default memo(({show = true, onClose}:Param) => { }) const {fetchData, state} = GetPayCode() const getCore = async () => { - let res = await fetchData({ - title: "面料销售电子确认单", - company: "什么什么公司123", - order_type: "散剪", - sale_user: "小崔", - order_created_time:"2022/02/01 12:32:13", - order_no:"XS-211005888", - department:"嘻嘻嘻", - shipment_mode:"自提", - target_user_name:"大崔", - target_address:"阿斯顿发斯蒂芬", - target_description:"无", - pay_account:"1234567890123450001", - bank_account_name:"佛山市浩川长盛科技有限公司", - bank_name:"招商银行佛山分行禅城支行", - pay_type:"现结", - client:"客户名称", - phone:"15818085802", - order_total_length:"12", - order_total_price:"63000", - qrcode:"https://www.zzfzyc.com/checkorder/XS-211005888", - order_total_weight:"300.00", - list: [{product_code:'5215',product_name:'26S双纱亲水滑爽棉',product_color_code:'053',product_color_name:'洋红',num:'4',weight:'123.23',sale_price:'43',total_price:'4510.7'}] - }) + let res = await fetchData(detail) const base64 = res.data.base64 setPayCodeImage(() => base64) const time = new Date().valueOf() @@ -98,7 +121,6 @@ export default memo(({show = true, onClose}:Param) => { data: fileData.current.base64, encoding: 'base64', }) - } useEffect(() => { if(show) diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index 132c00c..241b857 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -5,8 +5,9 @@ import { } from "@/api/order"; import { GetOrderPayApi } from "@/api/orderPay"; import { AddShoppingCartApi } from "@/api/shopCart"; +import { SubscriptionMessageApi } from "@/api/user"; import { alert, goLink } from "@/common/common"; -import { ORDER_STATUS } from "@/common/enum"; +import { ORDER_STATUS, SUBSCRIPTION_MESSAGE_SCENE } from "@/common/enum"; import { formatDateTime, formatImgUrl, formatPriceDiv } from "@/common/fotmat"; import OrderBtns from "@/components/orderBtns"; import Popup from "@/components/popup"; diff --git a/src/use/useCommonData.ts b/src/use/useCommonData.ts index ee36c61..a0efae5 100644 --- a/src/use/useCommonData.ts +++ b/src/use/useCommonData.ts @@ -1,3 +1,5 @@ +import { SubscriptionMessageApi } from "@/api/user" +import Taro from "@tarojs/taro" import dayjs from "dayjs" import { useEffect, useRef, useState } from "react" @@ -58,3 +60,32 @@ export const useTimeCountDown = () => { timeStatus } } + + +//订阅消息hook +export const UseSubscriptionMessage = () => { + const {fetchData: fetchDataMessage} = SubscriptionMessageApi() + const openSubscriptionMessage = ({orderId = 0, scenes = 0}:{orderId?: number, scenes: number}) => { + return new Promise(async (resolve) => { + let params:{sale_order_id?: number, scenes?: number} = {} + orderId&&(params.sale_order_id = orderId) + params.scenes = scenes + let res = await fetchDataMessage(params) + if(res.success&&res.data.TemplateID&&res.data.TemplateID.length > 0) { + Taro.requestSubscribeMessage({ + tmplIds: res.data.TemplateID, + complete: function (res) { + resolve(res) + } + }) + } else { + resolve(true) + } + }) + } + + return { + openSubscriptionMessage + } + +} From 8ec073a085d85923934dc8365a1ee998276469dc Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Mon, 4 Jul 2022 11:30:22 +0800 Subject: [PATCH 07/12] =?UTF-8?q?=E7=94=B5=E5=AD=90=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=89=88v3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/constant.js | 4 ++-- src/components/product/index.module.scss | 9 +++---- .../components/kindList/index.module.scss | 1 - src/pages/order/components/kindList/index.tsx | 1 - src/pages/order/components/payment/index.tsx | 8 ++++++- src/pages/order/components/scanPay/index.tsx | 24 +++++++++---------- .../orderList/components/order/index.tsx | 4 ++-- 7 files changed, 28 insertions(+), 23 deletions(-) diff --git a/src/common/constant.js b/src/common/constant.js index d13b4bf..3dc9ec4 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -9,9 +9,9 @@ // export const BASE_URL = `http://192.168.1.30:50001/lymarket` // 发 // export const BASE_URL = `https://dev.zzfzyc.com/lymarket` // 开发环境 // export const BASE_URL = `https://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.42:50001/lymarket` // 杰 +export const BASE_URL = `http://192.168.1.42:50001/lymarket` // 杰 // CDN // 生成密钥 diff --git a/src/components/product/index.module.scss b/src/components/product/index.module.scss index 35f7693..793b028 100644 --- a/src/components/product/index.module.scss +++ b/src/components/product/index.module.scss @@ -51,15 +51,16 @@ .tag_list{ display: flex; margin-top: 16px; + flex-wrap: wrap; .tag, .tag_g{ + max-width: 150rpx; padding: 3px 10px; background-color: #CDE5FF; font-size: $font_size_min; border-radius: 5px; color: $color_main; - &:nth-child(2) { - margin-left: 10px; - } + margin-right: 10px; + margin-bottom: 10px; } .tag_g{ background-color: #FFE6CE; @@ -69,7 +70,7 @@ .introduce{ font-size: $font_size_medium; color: $color_font_two; - margin-top: 16px; + } .des{ font-size:$font_size_medium; diff --git a/src/pages/order/components/kindList/index.module.scss b/src/pages/order/components/kindList/index.module.scss index 64b65b8..052a8b5 100644 --- a/src/pages/order/components/kindList/index.module.scss +++ b/src/pages/order/components/kindList/index.module.scss @@ -90,7 +90,6 @@ .order_list_item_count{ display: flex; flex-direction: column; - justify-content: center; align-items: flex-end; .count_num{ color: $color_main; diff --git a/src/pages/order/components/kindList/index.tsx b/src/pages/order/components/kindList/index.tsx index ce8e4b6..b2c2288 100644 --- a/src/pages/order/components/kindList/index.tsx +++ b/src/pages/order/components/kindList/index.tsx @@ -173,7 +173,6 @@ export default memo(({order, comfirm = false}:Param) => { ¥{standardPrice(colorItem.sale_price)} {aboutWeight(colorItem.estimate_weight)} - ×{formatCount(colorItem)}{order.unit} diff --git a/src/pages/order/components/payment/index.tsx b/src/pages/order/components/payment/index.tsx index befa8cc..a452a89 100644 --- a/src/pages/order/components/payment/index.tsx +++ b/src/pages/order/components/payment/index.tsx @@ -156,6 +156,12 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) const changeSelect = () => { } + //在线支付所需数据 + const onlinePayData = useMemo(() => { + return {...orderInfo, offline_remittance_information: payInfo?.offline_remittance_information} + + }, [orderInfo, payInfo]) + return ( @@ -225,7 +231,7 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) setofflinePayShow(false)} offlineInfo={payInfo?.offline_remittance_information}/> - setScanPayShow(false)} /> + setScanPayShow(false)} /> ) diff --git a/src/pages/order/components/scanPay/index.tsx b/src/pages/order/components/scanPay/index.tsx index ba3554b..4b78bcf 100644 --- a/src/pages/order/components/scanPay/index.tsx +++ b/src/pages/order/components/scanPay/index.tsx @@ -44,11 +44,11 @@ export default memo(({show = true, onClose, company, orderInfo}:Param) => { product_name: pitem.name, product_color_code: formatHashTag(citem.code)!, product_color_name: citem.name, - num: citem.roll + '', - length: (citem.length/100) + '', - weight: formatWeightDiv(citem.estimate_weight) + '', - sale_price: formatPriceDiv(citem.sale_price) + '', - total_price: formatPriceDiv(citem.estimate_amount) + '', + num: citem.roll.toString(), + length: (citem.length/100).toString(), + weight: formatWeightDiv(citem.estimate_weight).toString(), + sale_price: formatPriceDiv(citem.sale_price).toString(), + total_price: formatPriceDiv(citem.estimate_amount).toString(), }) }) }) @@ -63,17 +63,17 @@ export default memo(({show = true, onClose, company, orderInfo}:Param) => { target_user_name: userName(orderInfo), //收件人 target_address: address(orderInfo), //收货地址 target_description: orderInfo.remark, //发货备注 - pay_account:"1234567890123450001", //专属收款账号 - bank_account_name:"佛山市浩川长盛科技有限公司", //账户名称 - bank_name:"招商银行佛山分行禅城支行", //开户银行 + pay_account: orderInfo.offline_remittance_information?.transfer_remittance_account, //专属收款账号 + bank_account_name: orderInfo.offline_remittance_information?.account_name, //账户名称 + bank_name: orderInfo.offline_remittance_information?.bank_of_deposit, //开户银行 pay_type:"", //支付方式, 可不传 client: orderInfo.purchaser_name, //客户名称 phone: userPhone(orderInfo), //收货手机号码 - order_total_length: (orderInfo.total_number/100) + '', //订单布匹长度 - order_total_price: formatPriceDiv(orderInfo.total_sale_price) + '', //订单价格 - order_total_num: orderInfo.total_number + '', + order_total_length: (orderInfo.total_number/100).toString(), //订单布匹长度 + order_total_price: formatPriceDiv(orderInfo.total_sale_price).toString(), //订单价格 + order_total_num: (orderInfo.total_number) + '', qrcode:"", //跳转链接 - order_total_weight: formatWeightDiv(orderInfo.total_estimate_weight) + '', //订单布匹重量 + order_total_weight: formatWeightDiv(orderInfo.total_estimate_weight).toString(), //订单布匹重量 list: lists })) } diff --git a/src/pages/orderList/components/order/index.tsx b/src/pages/orderList/components/order/index.tsx index b21c722..aff2e02 100644 --- a/src/pages/orderList/components/order/index.tsx +++ b/src/pages/orderList/components/order/index.tsx @@ -70,8 +70,8 @@ export default memo(({value, onClickBtn}: Param) => { goLink('/pages/order/index', {id: value?.id})}> - - {userInfo?.adminUserInfo?.user_name} + + {userInfo?.adminUserInfo?.user_name} 订单号:{value?.order_no} From 0a7747319338eb6b954d4a5e3e63f8cecdddec01 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Mon, 4 Jul 2022 20:33:39 +0800 Subject: [PATCH 08/12] =?UTF-8?q?=E7=94=B5=E5=AD=90=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=89=88v4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.config.ts | 1 + src/common/constant.js | 4 +- src/common/util.ts | 4 +- src/components/checkbox/index.module.scss | 1 + src/components/product/index.module.scss | 2 +- src/components/uploadImage/index.tsx | 12 ++- .../components/cutKindList/index.tsx | 7 +- .../components/kindList/index.tsx | 6 +- .../collectionClass/index.config.ts | 4 + .../collectionClass/index.module.scss | 47 ++++++++++ .../collection/collectionClass/index.tsx | 65 ++++++++++++++ .../components/product/index.module.scss | 89 +++++++++++++++++++ .../collection/components/product/index.tsx | 58 ++++++++++++ src/pages/collection/index.tsx | 3 +- src/pages/details/index.module.scss | 2 +- src/pages/details/index.tsx | 28 +++--- src/pages/order/components/kindList/index.tsx | 1 + .../components/payment/index.module.scss | 9 +- src/pages/order/components/payment/index.tsx | 1 + src/pages/order/index.tsx | 26 +++++- .../components/order/index.module.scss | 66 ++++++++------ .../orderList/components/order/index.tsx | 20 +++-- .../components/orderStatusList/index.tsx | 3 +- src/pages/orderList/index.tsx | 24 +++-- src/pages/user/index.tsx | 4 +- src/use/useUploadImage.ts | 13 +-- 26 files changed, 419 insertions(+), 81 deletions(-) create mode 100644 src/pages/collection/collectionClass/index.config.ts create mode 100644 src/pages/collection/collectionClass/index.module.scss create mode 100644 src/pages/collection/collectionClass/index.tsx create mode 100644 src/pages/collection/components/product/index.module.scss create mode 100644 src/pages/collection/components/product/index.tsx diff --git a/src/app.config.ts b/src/app.config.ts index 0d19c18..66e2c08 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -176,6 +176,7 @@ export default { root: "pages/collection", pages: [ "index", + "collectionClass/index" ] }, { diff --git a/src/common/constant.js b/src/common/constant.js index 3dc9ec4..9eb3a66 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -10,8 +10,8 @@ // 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.42:50001/lymarket` // 杰 +export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添 +// export const BASE_URL = `http://192.168.1.42:50001/lymarket` // 杰 // CDN // 生成密钥 diff --git a/src/common/util.ts b/src/common/util.ts index 15f5d6b..e136a9a 100644 --- a/src/common/util.ts +++ b/src/common/util.ts @@ -43,11 +43,11 @@ export const throttle = (fn, delay) => { let res = {} for(let key in val) { if(val[key]!==undefined&&val[key]!==null&&val[key]!==''&&(!arr.includes(key))){ - if(val[key] instanceof Number){ + if(typeof val[key] == 'number'){ if(!isNaN(val[key])) { res[key] = val[key] } - }else{ + } else{ res[key] = val[key] } } diff --git a/src/components/checkbox/index.module.scss b/src/components/checkbox/index.module.scss index b50f17d..8224c9a 100644 --- a/src/components/checkbox/index.module.scss +++ b/src/components/checkbox/index.module.scss @@ -12,6 +12,7 @@ border-radius: 50%; text-align: center; line-height: 40px; + background-color: #fff; } .no_checkbox_item{ border:0; diff --git a/src/components/product/index.module.scss b/src/components/product/index.module.scss index 793b028..3b62f33 100644 --- a/src/components/product/index.module.scss +++ b/src/components/product/index.module.scss @@ -53,7 +53,7 @@ margin-top: 16px; flex-wrap: wrap; .tag, .tag_g{ - max-width: 150rpx; + max-width: 260rpx; padding: 3px 10px; background-color: #CDE5FF; font-size: $font_size_min; diff --git a/src/components/uploadImage/index.tsx b/src/components/uploadImage/index.tsx index 9fe4775..25aa9cd 100644 --- a/src/components/uploadImage/index.tsx +++ b/src/components/uploadImage/index.tsx @@ -21,10 +21,14 @@ const PictureItem:FC = memo(({onChange, defaultList}) => { //上传图片 const uploadImage = async () => { - let res:any = await getWxPhoto('after-sale') - if(res.code == 200) { - setImageLise([...imageList, res.url]) - } + let list:any = await getWxPhoto('after-sale', 5) + let images:any[] = [] + console.log('item22:::', list.length) + list?.map(item => { + console.log('item:::', item) + images.push(item.url) + }) + setImageLise([...imageList, ...images]) } //删除图片 const delImage = (index) => { diff --git a/src/pages/applyAfterSales/components/cutKindList/index.tsx b/src/pages/applyAfterSales/components/cutKindList/index.tsx index 826ef66..2af3855 100644 --- a/src/pages/applyAfterSales/components/cutKindList/index.tsx +++ b/src/pages/applyAfterSales/components/cutKindList/index.tsx @@ -41,10 +41,9 @@ const kindeList:FC = memo(({order, onSelectChange}) => { //判断该面料下的颜色都退完了 const colorNum = (item) => { - let res = item.product_colors.some(val => { - return val.return_roll == 0 + return item.product_colors.some(val => { + return val.return_roll + val.apply_return_roll == 0 }) - return res } return ( @@ -55,7 +54,7 @@ const kindeList:FC = memo(({order, onSelectChange}) => { {formatHashTag(item.code, item.name)} - {item.product_colors.map(colorItem => (colorItem.return_roll == 0)&& + {item.product_colors.map(colorItem => ((colorItem.return_roll + colorItem.apply_return_roll) == 0)&& {colorItem.code + ' ' + colorItem.name}x {formatCount(colorItem)} selectCallBack(colorItem)} onClose={() => colseCallBack(colorItem)}/> diff --git a/src/pages/applyAfterSales/components/kindList/index.tsx b/src/pages/applyAfterSales/components/kindList/index.tsx index 9b7492e..f046edb 100644 --- a/src/pages/applyAfterSales/components/kindList/index.tsx +++ b/src/pages/applyAfterSales/components/kindList/index.tsx @@ -24,7 +24,7 @@ type Param = { const kindeList:FC = memo(({order, onNumChange}) => { //对应数量 const formatCount = useCallback((item) => { - return (item.roll - item.return_roll) + order?.unit! + return (item.roll - item.return_roll - item.apply_return_roll) + order?.unit! }, [order]) //计步器失返回值 @@ -50,11 +50,11 @@ const kindeList:FC = memo(({order, onNumChange}) => { {formatHashTag(item.code, item.name)} - {item.product_colors.map(colorItem => (colorItem.return_roll < colorItem.roll)&& + {item.product_colors.map(colorItem => ((colorItem.return_roll + colorItem.apply_return_roll) < colorItem.roll)&& {colorItem.code + ' ' + colorItem.name}x {formatCount(colorItem)} - + )} diff --git a/src/pages/collection/collectionClass/index.config.ts b/src/pages/collection/collectionClass/index.config.ts new file mode 100644 index 0000000..42b7aff --- /dev/null +++ b/src/pages/collection/collectionClass/index.config.ts @@ -0,0 +1,4 @@ +export default { + navigationBarTitleText: '我的收藏a', + enableShareAppMessage: true, +} diff --git a/src/pages/collection/collectionClass/index.module.scss b/src/pages/collection/collectionClass/index.module.scss new file mode 100644 index 0000000..7762701 --- /dev/null +++ b/src/pages/collection/collectionClass/index.module.scss @@ -0,0 +1,47 @@ + +.collection_main { + padding: 0 20px; + min-height: 100%; + background-color: #F8F8F8; + .search { + display: flex; + align-items: center; + .miconfont_con{ + padding: 0 20px; + } + .miconfont{ + font-size: 30px; + color: #007AFF; + border: 1px solid #007AFF; + border-radius: 50%; + } + } + .operation{ + display: flex; + justify-content: space-between; + align-items: center; + padding: 20px 20px 0 20px; + font-size: 26px; + color: #707070; + .operation_check{ + display: flex; + align-items: center; + Text{ + margin-left: 15px; + height: 100%; + display: inline-block; + + } + } + } + .operation_check_right{ + Text{ + color: #CCCCCC; + margin-right: 20px; + } + } + .class_list{ + margin-top: 30px; + + } +} \ No newline at end of file diff --git a/src/pages/collection/collectionClass/index.tsx b/src/pages/collection/collectionClass/index.tsx new file mode 100644 index 0000000..b19f63d --- /dev/null +++ b/src/pages/collection/collectionClass/index.tsx @@ -0,0 +1,65 @@ +import { CreateFavoriteApi, DelFavoriteApi, FavoriteListApi, UpdateFavoriteApi } from "@/api/favorite"; +import { alert } from "@/common/common"; +import { getFilterData } from "@/common/util"; +import Product from "../components/product"; +import Search from "@/components/search" +import { Text, View } from "@tarojs/components" +import Taro from "@tarojs/taro"; +import classnames from "classnames"; +import { useCallback, useEffect, useRef, useState } from "react"; +import CreatePopup from "../components/createPopup"; +import UpdatePopup from "../components/updatePopup"; +import styles from './index.module.scss' +import MCheckbox from "@/components/checkbox"; + + +export default () => { + + //获取收藏夹面料 + const [list, setList] = useState([]) + const getFavoriteInfo = () => { + let arr:any[] = [] + new Array(10).fill("").map((item, index) => { + arr.push({code: index}) + }) + setList(arr) + } + + //获取搜索数据 + const [searchData, setSearchData] = useState('') + const onSearch = useCallback((e) => { + setSearchData(() => e) + }, []) + useEffect(() => { + getFavoriteInfo() + }, [searchData]) + + const selectCallBack = useCallback(() => { + + }, []) + + const colseCallBack = useCallback(() => { + + }, []) + + return ( + + + + + + + selectCallBack()} onClose={() => colseCallBack()}/> + 全选 + + + 移动到 + 取消收藏 + + + + + + + ) + } \ No newline at end of file diff --git a/src/pages/collection/components/product/index.module.scss b/src/pages/collection/components/product/index.module.scss new file mode 100644 index 0000000..691077d --- /dev/null +++ b/src/pages/collection/components/product/index.module.scss @@ -0,0 +1,89 @@ + +.products_list{ + padding: 0 20px 20px 20px; + box-sizing: border-box; + height: 100%; +} +.products_item{ + width: 100%; + background-color: #fff; + border-radius: 20px; + padding: 20px; + box-sizing: border-box; + display: flex; + justify-content: space-between; + position: relative; + &:nth-child(n+2){ + margin-top: 16px; + } + .checkbox{ + position: absolute; + left: 10px; + top: 10px; + z-index: 999; + } + .item_img{ + width: 198px; + height: 198px; + position: relative; + image{ + width: 100%; + height: 100%; + border-radius: 10px; + } + .num{ + padding: 5px 10px 5px 20px; + font-size: $font_size_min; + position: absolute; + right:0; + bottom: 0; + background: rgba($color: #000, $alpha: 0.3); + border-radius: 36px 0px 10px 0px; + color: #fff; + text-align: center; + } + } + .item_con{ + padding-left: 20px; + font-size: $font_size; + flex:1; + .title{ + font-size: $font_size; + color: #707070; + text{ + color: $color_font_one; + font-weight: bold; + } + } + .tag_list{ + display: flex; + margin-top: 16px; + flex-wrap: wrap; + .tag, .tag_g{ + max-width: 260rpx; + padding: 3px 10px; + background-color: #CDE5FF; + font-size: $font_size_min; + border-radius: 5px; + color: $color_main; + margin-right: 10px; + margin-bottom: 10px; + } + .tag_g{ + background-color: #FFE6CE; + color: #EE7500; + } + } + .introduce{ + font-size: $font_size_medium; + color: $color_font_two; + + } + .des{ + font-size:$font_size_medium; + color: #707070; + margin-top: 16px; + @include common_ellipsis($params:2); + } + } +} diff --git a/src/pages/collection/components/product/index.tsx b/src/pages/collection/components/product/index.tsx new file mode 100644 index 0000000..bca82bd --- /dev/null +++ b/src/pages/collection/components/product/index.tsx @@ -0,0 +1,58 @@ +import { Image, View } from "@tarojs/components" +import Taro from "@tarojs/taro" +import { goLink } from "@/common/common" +import styles from './index.module.scss' +import { formatHashTag, formatImgUrl } from "@/common/fotmat" +import LabAndImg from "@/components/LabAndImg" +import MCheckbox from "@/components/checkbox"; +import { useCallback, useEffect, useState } from "react" + +type Params = { + desStatus?: true|false, + productList?: any[] +} +export default ({desStatus = true, productList = []}:Params) => { + const [list, setList] = useState([]) + useEffect(() => { + console.log('productList::', productList) + setList(() => [...productList]) + },[productList]) + + + + const onSelect = (item, e) => { + console.log('e:::', e) + item.check = true + setList(() => ([...list])) + } + + const onClose = (item, e) => { + item.check = false + setList(() => ([...list])) + } + + return ( + + {list?.map(item => { + return goLink(`/pages/details/index?id=${item.id}`)}> + + onSelect(item, e)} onClose={() => onClose(item, e)}/> + + + + {item.product_color_count}色 + + + {formatHashTag(item.product_code, '')} {item.product_name} + + {item.width} + {item.weight_density} + + {item.component} + {desStatus&&{item.describe}} + + + })} + + ) +} diff --git a/src/pages/collection/index.tsx b/src/pages/collection/index.tsx index 92bb98c..88ad54e 100644 --- a/src/pages/collection/index.tsx +++ b/src/pages/collection/index.tsx @@ -1,7 +1,7 @@ import { CreateFavoriteApi, DelFavoriteApi, FavoriteListApi, UpdateFavoriteApi } from "@/api/favorite"; import { alert } from "@/common/common"; import { getFilterData } from "@/common/util"; -import Product from "@/components/product"; +import Product from "./components/product"; import Search from "@/components/search" import { Text, View } from "@tarojs/components" import Taro from "@tarojs/taro"; @@ -127,7 +127,6 @@ export default () => { setCollectioinShow(false) } - return ( diff --git a/src/pages/details/index.module.scss b/src/pages/details/index.module.scss index 750aefa..ed14ea5 100644 --- a/src/pages/details/index.module.scss +++ b/src/pages/details/index.module.scss @@ -43,7 +43,7 @@ opacity: 0; } .miconfont{ - font-size: 36px; + font-size: 45px; } .collected{ color: #FFC300; diff --git a/src/pages/details/index.tsx b/src/pages/details/index.tsx index 5b2fbc0..00c1c17 100644 --- a/src/pages/details/index.tsx +++ b/src/pages/details/index.tsx @@ -71,7 +71,10 @@ export default (props:Params) => { } useEffect(() => { - if(productInfo.code) getShortCode() + if(productInfo.code) { + getShortCode() + setCollectStatus(() => productInfo.is_favorite) + } }, [productInfo]) @@ -98,12 +101,7 @@ export default (props:Params) => { setShowPreview(true) } - //收藏功能 - const [collectStatus, setCollectStatus] = useState(false) - const changeCollect = () => { - setCollectStatus(!collectStatus) - setCollectionShow(true) - } + const {setSortCode, userInfo : userObj } = useUserInfo() //详情页获取分享短码 @@ -132,20 +130,28 @@ export default (props:Params) => { setShowOrderCount(true) } - //加入收藏夹 + //收藏功能 + const [collectStatus, setCollectStatus] = useState(false) const [collectionShow, setCollectionShow] = useState(false) const {fetchData: addFavoritefetchData} = AddFavoriteApi() const onAdd = useCallback(async (val) => { let res = await addFavoritefetchData({favorite_id: val.id, product_id: Number(params.id)}) if(res.success) { alert.success('添加成功') + setCollectStatus(true) } else { alert.none(res.msg) } + setCollectionShow(false) }, [params]) + const closeCollection = useCallback(() => { + setCollectionShow(false) + }, []) + + //页面下拉刷新 usePullDownRefresh(() => { getProductDetail() @@ -165,8 +171,8 @@ export default (props:Params) => { 分享 - - changeCollect()}> + setCollectionShow(true)}> + 收藏 @@ -213,7 +219,7 @@ export default (props:Params) => { setShowCart(false)}/> setShowPreview(false)}/> - + ) diff --git a/src/pages/order/components/kindList/index.tsx b/src/pages/order/components/kindList/index.tsx index b2c2288..0696239 100644 --- a/src/pages/order/components/kindList/index.tsx +++ b/src/pages/order/components/kindList/index.tsx @@ -168,6 +168,7 @@ export default memo(({order, comfirm = false}:Param) => { {colorItem.code + ' ' + colorItem.name} {colorItem?.return_roll&&{`已退${colorItem?.return_roll}条`}} + {colorItem?.apply_return_roll&&{`待退${colorItem?.apply_return_roll}条`}} ¥{standardPrice(colorItem.sale_price)} diff --git a/src/pages/order/components/payment/index.module.scss b/src/pages/order/components/payment/index.module.scss index ade0ca3..f2828c7 100644 --- a/src/pages/order/components/payment/index.module.scss +++ b/src/pages/order/components/payment/index.module.scss @@ -27,6 +27,13 @@ $top:190px; text-align: center; padding: 25px 0; } + .playMode{ + width: 100%; + padding-bottom: 20px; + font-size: 26px; + text-align: center; + color: #707070; + } .payment_list{ background-color: #fff; @@ -44,7 +51,7 @@ $top:190px; position: absolute; border-bottom: 3px dashed #ccc; top: $top; - width: calc(100% - 100px); + width: calc(100% - 50px); left:0; right: 0; margin: auto; diff --git a/src/pages/order/components/payment/index.tsx b/src/pages/order/components/payment/index.tsx index a452a89..acb049f 100644 --- a/src/pages/order/components/payment/index.tsx +++ b/src/pages/order/components/payment/index.tsx @@ -171,6 +171,7 @@ export default memo(({show = false, onClose, orderInfo, onSubmitSuccess}:Param) + {(payInfo?.delivery_payment_name)&&已使用{payInfo?.delivery_payment_name}方式付款} diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index 241b857..fb72266 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -35,6 +35,16 @@ import styles from './index.module.scss' getSaleOrderPreView() }) + //订单状态枚举 + const { + SaleOrderStatusWaitingReceipt, // 待收货 + SaleOrderStatusAlreadyReceipt, // 已收货 + SaleOrderStatusComplete, // 已完成 + SaleOrderStatusRefund, // 已退款 + SaleOrderStatusCancel, // 已取消 + SaleorderstatusWaitingPrePayment, // 预付款 + } = ORDER_STATUS + //获取订单详情 const [orderDetail, setOrderDetail] = useState() //获取到的原始数据 const {fetchData: getOrderFetchData} = GetSaleOrderDetailApi() @@ -123,6 +133,17 @@ import styles from './index.module.scss' } setShowDesc(() => false) }, []) + const noCanOpenDescList = useRef([ + SaleOrderStatusWaitingReceipt.value, // 待收货 + SaleOrderStatusAlreadyReceipt.value, // 已收货 + SaleOrderStatusComplete.value, // 已完成 + SaleOrderStatusRefund.value, // 已退款 + SaleOrderStatusCancel.value, // 已取消 + ]) + const descOpen = () => { + if(noCanOpenDescList.current.includes(orderDetail?.status)) return false + setShowDesc(() => true) + } //去付款 const [payMentShow, setPayMentShow] = useState(false) @@ -192,8 +213,7 @@ import styles from './index.module.scss' } }, [orderDetail]) - //订单状态枚举 - const {SaleOrderStatusCancel, SaleorderstatusWaitingPrePayment} = ORDER_STATUS + //刷新页面 const refresh = useCallback(() => { @@ -273,7 +293,7 @@ import styles from './index.module.scss' {formatDateTime(orderDetail?.payment_time)} } - setShowDesc(true)}> + 订单备注 { orderRemark&&{orderDetail?.remark}|| diff --git a/src/pages/orderList/components/order/index.module.scss b/src/pages/orderList/components/order/index.module.scss index d63a621..edbaba9 100644 --- a/src/pages/orderList/components/order/index.module.scss +++ b/src/pages/orderList/components/order/index.module.scss @@ -9,38 +9,46 @@ .user{ display: flex; align-items: center; - .name { - color: #000; - font-weight: 700; - margin-left: 15px; - font-size: $font_size; - } + image{ width: 70px; height: 70px; border-radius: 50%; } } - .order_num { - flex: 1; - font-size: $font_size_medium; - color: $color_font_one; - text-align: right; - padding-right: 30px; - display: flex; - justify-content: flex-end; - align-items: center; - .miconfont { - font-size: 20px; + .order_con { + padding-left: 15px; + width: 100%; + .name { + color: #000; + font-weight: 700; + font-size: $font_size; + } + .order_num { + font-size: $font_size_medium; + padding-right: 30px; + display: flex; + justify-content: flex-start; + align-items: center; + width: 100%; + .order_num_con{ + flex:1; + } + .miconfont { + font-size: 20px; + } + .order_no{ + + } + } } - .tag{ - font-size: $font_size_min; - padding: 5px 15px; - background-color: $color_main; - color: #fff; - border-radius: 0px 20px 0px 20px; + .product_status{ + font-size: $font_size; + color: $color_main; + font-weight: 700; } + } .product_con{ margin-bottom: 20px; @@ -63,9 +71,15 @@ padding: 0 20px; @include common_ellipsis() } - .product_status{ - font-size: $font_size; - color: $color_main; + + .tag{ + font-size: $font_size_min; + padding: 5px 15px; + background-color: $color_main; + color: #fff; + border-radius: 0px 20px 0px 20px; + position:relative; + right: 0; } } .product_list{ diff --git a/src/pages/orderList/components/order/index.tsx b/src/pages/orderList/components/order/index.tsx index aff2e02..960f734 100644 --- a/src/pages/orderList/components/order/index.tsx +++ b/src/pages/orderList/components/order/index.tsx @@ -5,6 +5,7 @@ import OrderBtns from "@/components/orderBtns"; import Payment from "@/pages/order/components/payment"; import { useSelector } from "@/reducers/hooks"; import { Image, Text, View } from "@tarojs/components" +import { useRouter } from "@tarojs/taro"; import classnames from "classnames"; import { memo, useCallback, useMemo, useRef, useState } from "react"; import styles from './index.module.scss' @@ -34,6 +35,7 @@ type Param = { onClickBtn?: (val:{status:number, orderInfo:Param['value']}) => void } export default memo(({value, onClickBtn}: Param) => { + const userInfo = useSelector(state => state.userInfo) //对应数量 const formatCount = useCallback((item, sale_mode) => { @@ -71,19 +73,25 @@ export default memo(({value, onClickBtn}: Param) => { goLink('/pages/order/index', {id: value?.id})}> + + {userInfo?.adminUserInfo?.user_name} + + + 订单号:{value?.order_no} + + + {value?.status_name} + - - 订单号:{value?.order_no} - - - {value?.shipment_mode_name} + + goLink('/pages/order/index', {id: value?.id})}> {value?.sale_mode_name} {formatHashTag(value?.product_list[0].code, value?.product_list[0].name)} - {value?.status_name} + {value?.shipment_mode_name} diff --git a/src/pages/orderList/components/orderStatusList/index.tsx b/src/pages/orderList/components/orderStatusList/index.tsx index 3e12f6f..1257330 100644 --- a/src/pages/orderList/components/orderStatusList/index.tsx +++ b/src/pages/orderList/components/orderStatusList/index.tsx @@ -15,8 +15,8 @@ export default memo(({list = [], defaultId = null, onSelect}: Param) => { }) useEffect(() => { if(defaultId) { + console.log('defaultId:::', defaultId) const index = list?.findIndex(item => { - console.log(item.id, defaultId) return item.id == defaultId }) if(index !== -1) { @@ -24,6 +24,7 @@ export default memo(({list = [], defaultId = null, onSelect}: Param) => { setSelectInfo((e) => ({...e, tabId:list[num].id.toString()})) } } + setSelectInfo((e) => ({...e, selected: defaultId||-1})) }, [defaultId]) const clickEvent = ({item, index}: {item:any, index:number}) => { const num = index > 0?( index - 1) : 0 diff --git a/src/pages/orderList/index.tsx b/src/pages/orderList/index.tsx index 10a3d57..42adcc6 100644 --- a/src/pages/orderList/index.tsx +++ b/src/pages/orderList/index.tsx @@ -14,6 +14,7 @@ import { AddShoppingCartApi } from "@/api/shopCart" import ShopCart from "@/components/shopCart" import ApplyRefund from "./components/applyRefund" import { alert } from "@/common/common" +import { useRouter } from "@tarojs/runtime" export default () => { const {checkLogin} = useLogin() @@ -21,12 +22,22 @@ export default () => { await checkLogin() }) + //传递过来的参数 + const router = useRouter() + useEffect(() => { + if(router?.params.status != undefined && router?.params.status !== '') { + setSearchField((e) => ({...e, status: router?.params.status as number})) + } else { + setSearchField((e) => ({...e, status:-1})) + } + }, [router]) + //搜索参数 - const [searchField, setSearchField] = useState({ - status: -1, + const [searchField, setSearchField] = useState<{status: number|null, page: number, size: number, name: string}>({ + status: null, page : 1, size : 10, - Name:'' + name:'' }) //获取订单状态 @@ -45,14 +56,13 @@ export default () => { const [orderData, setOrderData] = useState<{list:any[], total:number}>({list:[], total:0}) const getOrderList = async () => { let res = await listFetchData(getFilterData(searchField)) - setOrderData({list: res.data.list, total: res.data.total}) + setOrderData((e) => ({...e, list: res.data.list, total: res.data.total})) setRefresherTriggeredStatus(() => false) } - //监听筛选条件变化 useEffect(() => { - getOrderList() + if(searchField.status != null) getOrderList() }, [searchField]) //上拉加载数据 @@ -173,7 +183,7 @@ export default () => { - + diff --git a/src/pages/user/index.tsx b/src/pages/user/index.tsx index be206a9..f578118 100644 --- a/src/pages/user/index.tsx +++ b/src/pages/user/index.tsx @@ -97,8 +97,8 @@ const Modal = memo((props: any) => { const Header = memo((props: any) => { const { data } = props; console.log(props, 'propsprops') - let menu = [{ text: "待配布", icon: "icon-daipeibu", url: "/pages/orderList/index" }, { text: "待付款", icon: "icon-daifukuan", url: "/pages/orderList/index" }, - { text: "待发货", icon: "icon-daifahuo", url: "/pages/orderList/index" }, { text: "已发货", icon: "icon-yifahuo", url: "/pages/orderList/index" }, + let menu = [{ text: "待配布", icon: "icon-daipeibu", url: "/pages/orderList/index?status=0" }, { text: "待付款", icon: "icon-daifukuan", url: "/pages/orderList/index?status=1" }, + { text: "待发货", icon: "icon-daifahuo", url: "/pages/orderList/index?status=2" }, { text: "已发货", icon: "icon-yifahuo", url: "/pages/orderList/index?status=3" }, { text: "退款/售后", icon: "icon-a-tuikuanshouhou", url: "/pages/salesAfterList/index" }]; const { getPhoneNumber } = useLogin(); const mGetPhoneNumber = (ev) => { diff --git a/src/use/useUploadImage.ts b/src/use/useUploadImage.ts index 86c698e..53be2f3 100644 --- a/src/use/useUploadImage.ts +++ b/src/use/useUploadImage.ts @@ -123,17 +123,20 @@ export default () => { // mall 电子商城相关的 全平台 // logistics 物流(发货、提货)相关的、图片、视频 全平台 type cdn_upload_type_Param = 'product'|'after-sale'|'mall'|'logistics' - const getWxPhoto = (cdn_upload_type: cdn_upload_type_Param) => { + const getWxPhoto = (cdn_upload_type: cdn_upload_type_Param, count: number = 1) => { return new Promise((resolve, reject) => { + let list:any[] = [] Taro.chooseImage({ - count: 1, + count: count, sizeType: ['original', 'compressed'], sourceType: ['album', 'camera'], success: async function (res) { - const file = res.tempFiles[0] try { - let data = await uploadCDNImg(file, cdn_upload_type, cdn_upload_type) - resolve(data) + for(let i = 0; i < res.tempFiles.length; i++) { + let data = await uploadCDNImg(res.tempFiles[i], cdn_upload_type, cdn_upload_type) + list.push(data) + } + resolve(list) } catch(res) { reject(res) } From 29090350eff3c648a45568bcd35883f2619cadb2 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Tue, 5 Jul 2022 10:43:47 +0800 Subject: [PATCH 09/12] =?UTF-8?q?=E7=94=B5=E5=AD=90=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=89=88v4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/shopCart/index.tsx | 13 +++++++++- src/components/uploadImage/index.tsx | 2 -- src/pages/order/components/kindList/index.tsx | 4 +-- src/use/useUploadImage.ts | 26 +++++++++++++------ 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/src/components/shopCart/index.tsx b/src/components/shopCart/index.tsx index 7ea4d1c..9297d36 100644 --- a/src/components/shopCart/index.tsx +++ b/src/components/shopCart/index.tsx @@ -36,6 +36,8 @@ export default ({show = false, onClose}: param) => { setSelectStatus(true) }, [selectIndex]) + + //重置勾选数据 const resetList = () => { list?.map(item => { @@ -56,16 +58,25 @@ export default ({show = false, onClose}: param) => { const {data} = await fetchData() let color_list = data.color_list||[] initList(color_list) - setList(color_list) setLoading(false) } + //初始化勾选数据 + const [selectData, setSelectData] = useState<{id: number, checked: true|false}[]>([]) + const initSelectData = (data:{id:number}[] = []) => { + let res = data?.map(item => { + return {id: item.id, checked: true} + }) + setSelectData(() => res) + } + //初始化全部数据 const initList = (color_list) => { color_list?.map(item => { if(selectIndex == item.sale_mode) item.select = true item.count = formatCount(item) }) + setList(color_list) } //显示是展示数据 diff --git a/src/components/uploadImage/index.tsx b/src/components/uploadImage/index.tsx index 25aa9cd..864d8ef 100644 --- a/src/components/uploadImage/index.tsx +++ b/src/components/uploadImage/index.tsx @@ -23,9 +23,7 @@ const PictureItem:FC = memo(({onChange, defaultList}) => { const uploadImage = async () => { let list:any = await getWxPhoto('after-sale', 5) let images:any[] = [] - console.log('item22:::', list.length) list?.map(item => { - console.log('item:::', item) images.push(item.url) }) setImageLise([...imageList, ...images]) diff --git a/src/pages/order/components/kindList/index.tsx b/src/pages/order/components/kindList/index.tsx index 0696239..fc32cc1 100644 --- a/src/pages/order/components/kindList/index.tsx +++ b/src/pages/order/components/kindList/index.tsx @@ -167,8 +167,8 @@ export default memo(({order, comfirm = false}:Param) => { {colorItem.code + ' ' + colorItem.name} - {colorItem?.return_roll&&{`已退${colorItem?.return_roll}条`}} - {colorItem?.apply_return_roll&&{`待退${colorItem?.apply_return_roll}条`}} + {(colorItem?.return_roll > 0)&&{`已退${colorItem?.return_roll}条`}} + {(colorItem?.apply_return_roll > 0)&&{`待退${colorItem?.apply_return_roll}条`}} ¥{standardPrice(colorItem.sale_price)} diff --git a/src/use/useUploadImage.ts b/src/use/useUploadImage.ts index 53be2f3..5c05e3c 100644 --- a/src/use/useUploadImage.ts +++ b/src/use/useUploadImage.ts @@ -114,15 +114,18 @@ export default () => { }) } - /** - * 上传手机图片 - * @param cdn_upload_type //CDN 文件上传场景值 - */ + // product 产品相关,图片、纹理图等 全平台 // after-sale 售后(申请退货、退款)相关的、图片、视频 全平台 // mall 电子商城相关的 全平台 // logistics 物流(发货、提货)相关的、图片、视频 全平台 type cdn_upload_type_Param = 'product'|'after-sale'|'mall'|'logistics' + /** + * 上传手机图片 + * @param cdn_upload_type 场景值 + * @param count // 1时返回一张图片信息, 大于1时返回图片数组 + * @returns + */ const getWxPhoto = (cdn_upload_type: cdn_upload_type_Param, count: number = 1) => { return new Promise((resolve, reject) => { let list:any[] = [] @@ -132,11 +135,18 @@ export default () => { sourceType: ['album', 'camera'], success: async function (res) { try { - for(let i = 0; i < res.tempFiles.length; i++) { - let data = await uploadCDNImg(res.tempFiles[i], cdn_upload_type, cdn_upload_type) - list.push(data) + if(count > 1) { + for(let i = 0; i < res.tempFiles.length; i++) { + let data = await uploadCDNImg(res.tempFiles[i], cdn_upload_type, cdn_upload_type) + list.push(data) + } + resolve(list) + } else { + //兼容以前上传一张的情况 + let data = await uploadCDNImg(res.tempFiles[0], cdn_upload_type, cdn_upload_type) + resolve(data) } - resolve(list) + } catch(res) { reject(res) } From 7a2dc0006f15f723e1e661b9cc797189cd8bc6d1 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Tue, 5 Jul 2022 20:32:37 +0800 Subject: [PATCH 10/12] =?UTF-8?q?=E7=94=B5=E5=AD=90=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=89=88v4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/constant.js | 4 +- src/common/enum.ts | 8 + src/common/util.ts | 2 +- .../afterOrderBtns/index.module.scss | 37 ++ src/components/afterOrderBtns/index.tsx | 53 ++- src/components/moveBtn/index.module.scss | 16 +- src/components/moveBtn/index.tsx | 15 + src/components/shopCart/index copy.tsx | 352 ++++++++++++++++++ src/components/shopCart/index.tsx | 58 ++- .../collectionClass/index.module.scss | 11 +- .../collection/collectionClass/index.tsx | 68 ++-- .../collection/components/product/index.tsx | 63 +++- src/pages/collection/index.tsx | 2 +- src/pages/order/index.tsx | 1 + .../addressInfoDetail/index.module.scss | 4 +- .../salesAfter/components/kindList/index.tsx | 101 ++--- src/pages/salesAfter/index.tsx | 13 +- .../salesAfterList/components/order/index.tsx | 6 +- src/use/useCommonData.ts | 3 +- 19 files changed, 649 insertions(+), 168 deletions(-) create mode 100644 src/components/shopCart/index copy.tsx diff --git a/src/common/constant.js b/src/common/constant.js index 9eb3a66..3dc9ec4 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -10,8 +10,8 @@ // 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.42:50001/lymarket` // 杰 +// export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添 +export const BASE_URL = `http://192.168.1.42:50001/lymarket` // 杰 // CDN // 生成密钥 diff --git a/src/common/enum.ts b/src/common/enum.ts index a3a8877..0016360 100644 --- a/src/common/enum.ts +++ b/src/common/enum.ts @@ -56,4 +56,12 @@ export const SUBSCRIPTION_MESSAGE_SCENE = { SubmitOrder: {value:1, label:'确认下单'}, ToPay : {value:2, label:'去付款'}, ApplyGoods: {value:3, label: '申请退款'} +} + +//退款状态枚举 +export const REFUND_STATUS = { + ShouldCollectOrderRefundTypeUnknown: {value:0, label:'未知退款'}, + ShouldCollectOrderRefundTypeAdvanceReceiptRefund: {value:1, label:'预收退款'}, + ShouldCollectOrderRefundTypeReturnForRefund: {value:2, label:'退货退款'}, + ShouldCollectOrderRefundTypeSalesRefund: {value:3, label:'销售退款'}, } \ No newline at end of file diff --git a/src/common/util.ts b/src/common/util.ts index e136a9a..bd14ea0 100644 --- a/src/common/util.ts +++ b/src/common/util.ts @@ -39,7 +39,7 @@ export const throttle = (fn, delay) => { * @param {Array} arr 排除过滤的属性 * @returns */ - export const getFilterData = (val = {}, arr = []) => { + export const getFilterData = (val = {}, arr: string[] = []) => { let res = {} for(let key in val) { if(val[key]!==undefined&&val[key]!==null&&val[key]!==''&&(!arr.includes(key))){ diff --git a/src/components/afterOrderBtns/index.module.scss b/src/components/afterOrderBtns/index.module.scss index 252b22e..d57e7b0 100644 --- a/src/components/afterOrderBtns/index.module.scss +++ b/src/components/afterOrderBtns/index.module.scss @@ -1,3 +1,40 @@ +.submit_order{ + display: flex; + position: fixed; + bottom: 0; + left: 0; + justify-content: flex-end; + width: 100%; + height: 175px; + align-items: center; + background-color: #fff; + box-shadow: 6px 0px 12px 0px rgba(0,0,0,0.16); + padding: 20px 20px; + box-sizing: border-box; + padding-bottom: constant(safe-area-inset-bottom); + padding-bottom: env(safe-area-inset-bottom); + .order_btn { + width: 152px; + height: 72px; + border: 2px solid #dddddd; + border-radius: 46px; + display: flex; + justify-content: center; + align-items: center; + color: $color_font_three; + &:nth-child(n+2) { + margin-left: 34px; + } + } + .order_btn_select{ + color: $color_main; + border: 2px solid $color_main; + } + .order_number_desc{ + font-size: $font_size_medium; + color: $color_font_two; + } +} .btns_list{ width: 100%; // margin-top: 30px; diff --git a/src/components/afterOrderBtns/index.tsx b/src/components/afterOrderBtns/index.tsx index 5d0bec8..7519615 100644 --- a/src/components/afterOrderBtns/index.tsx +++ b/src/components/afterOrderBtns/index.tsx @@ -17,10 +17,11 @@ type Param = { return_apply_order_id: number //售后申请单 }, onClick?: (val: number) => void, //点击后触发的事件,返回订单状态 - onBtnNull?: () => void //所有按钮都为空 + fixedBottom?: true|false, //是否固定在底部 + } -export default memo(({orderInfo, onClick, onBtnNull}:Param) => { +export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => { //售后订单状态 const { ReturnStageApplying, @@ -53,13 +54,6 @@ export default memo(({orderInfo, onClick, onBtnNull}:Param) => { model_value: [], label: '取消退货' }, - { - id: 2, - big_value: [ReturnStageWaitCheck.value], - cut_value: [], - model_value: [], - label: '退货物流' - }, { id: 4, big_value: [ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value], @@ -143,25 +137,28 @@ export default memo(({orderInfo, onClick, onBtnNull}:Param) => { }, [orderBtnsShowList]) return ( - - {(orderBtnsShowList.length > 3)&& - setShowMore(true)}>更多 - {showMore&& - - {orderBtnsShowList.map((item, index) => { - return ((index >= 3) && submitBtns(item.id, index)}>{item.label}) - })} - - setShowMore(false)}> - } - } + <> + {(orderBtnsShowList.length > 0)&& + + {(orderBtnsShowList.length > 3)&& + setShowMore(true)}>更多 + {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} - )} - - - + + {orderBtnsShowList.map((item, index) => + (index < 3)&& submitBtns(item.id, index)}>{item.label} + )} + + + } + ) }) \ No newline at end of file diff --git a/src/components/moveBtn/index.module.scss b/src/components/moveBtn/index.module.scss index f04d5be..d7f4fe7 100644 --- a/src/components/moveBtn/index.module.scss +++ b/src/components/moveBtn/index.module.scss @@ -14,7 +14,21 @@ align-items: center; z-index:999; .shop_icon{ - font-size: 50px; + font-size: 70px; color: $color_main; } + .product_num{ + position: absolute; + font-size: 23px; + background-color: red; + color: #fff; + height: 36px; + line-height: 36px; + padding: 0 6px; + border-radius: 72px; + min-width: 25px; + text-align: center; + top: 0; + right: 0; + } } \ No newline at end of file diff --git a/src/components/moveBtn/index.tsx b/src/components/moveBtn/index.tsx index e30e888..23e5b53 100644 --- a/src/components/moveBtn/index.tsx +++ b/src/components/moveBtn/index.tsx @@ -3,6 +3,7 @@ import Taro, { useReady } from "@tarojs/taro" import { ReactElement, useEffect, useRef, useState } from "react" import classnames from "classnames"; import styles from './index.module.scss' +import { GetShoppingCartApi } from "@/api/shopCart"; type param = { children?: ReactElement|null, @@ -22,6 +23,19 @@ export default ({children = null, onClick}:param) => { setShowMoveBtn(true) }) + //获取数据 + const [list, setList] = useState([]) + const {fetchData} = GetShoppingCartApi() + const getShoppingCart = async () => { + const {data} = await fetchData() + let color_list = data.color_list||[] + setList(color_list) + } + + useEffect(() => { + getShoppingCart() + }, []) + const dragEnd = (e) => { } @@ -31,6 +45,7 @@ export default ({children = null, onClick}:param) => { {children} {showMoveBtn&& dragEnd(e)}> + {(list.length > 0)&&{list.length > 99?'99+':list.length}} } ) diff --git a/src/components/shopCart/index copy.tsx b/src/components/shopCart/index copy.tsx new file mode 100644 index 0000000..9297d36 --- /dev/null +++ b/src/components/shopCart/index copy.tsx @@ -0,0 +1,352 @@ +import {Image, ScrollView, View } from "@tarojs/components" +import Popup from "@/components/popup" +import classnames from "classnames"; +import MCheckbox from "@/components/checkbox"; +import LoadingCard from "@/components/loadingCard"; +import InfiniteScroll from "@/components/infiniteScroll"; +import styles from "./index.module.scss" +import { useCallback, useEffect, useMemo, useRef, useState } from "react"; +import Taro from "@tarojs/taro"; +import { alert, goLink } from "@/common/common"; +import {GetShoppingCartApi, DelShoppingCartApi, UpdateShoppingCartApi} from "@/api/shopCart" +import { formatHashTag, formatImgUrl, formatPriceDiv } from "@/common/fotmat"; +import { setParam } from "@/common/system"; +import { debounce } from "@/common/util"; +import Counter from "../counter"; +import { ApplyOrderAccessApi, GetAdminUserInfoApi, SubscriptionMessageApi } from "@/api/user"; + +type param = { + show?: true|false, + onClose?: () => void +} +export default ({show = false, onClose}: param) => { + const selectList = [ + {value:0, title:'大货', unit:'条', eunit:'kg', step:1, digits:0, minNum:1, maxNum:100000, defaultNum:1}, + {value:1,title:'剪板', unit:'米', eunit:'m', step:1, digits:2, minNum:0.5, maxNum:9.99, defaultNum:1}, + {value:2,title:'散剪', unit:'米', eunit:'kg', step:1, digits:2, minNum:5, maxNum:100000, defaultNum:10}, + ] + + const [selectIndex, setSelectIndex] = useState(0) + const selectProduct = (index:number) => { + setSelectIndex(index) + } + + useEffect(() => { + resetList() + setSelectStatus(true) + }, [selectIndex]) + + + + //重置勾选数据 + const resetList = () => { + list?.map(item => { + if(selectIndex == item.sale_mode || selectIndex == -1) { + item.select = true + } else { + item.select = false + } + }) + setList([...list]) + } + + //获取数据 + const [list, setList] = useState([]) + const [loading, setLoading] = useState(false) + const {fetchData} = GetShoppingCartApi() + const getShoppingCart = async () => { + const {data} = await fetchData() + let color_list = data.color_list||[] + initList(color_list) + setLoading(false) + } + + //初始化勾选数据 + const [selectData, setSelectData] = useState<{id: number, checked: true|false}[]>([]) + const initSelectData = (data:{id:number}[] = []) => { + let res = data?.map(item => { + return {id: item.id, checked: true} + }) + setSelectData(() => res) + } + + //初始化全部数据 + const initList = (color_list) => { + color_list?.map(item => { + if(selectIndex == item.sale_mode) item.select = true + item.count = formatCount(item) + }) + setList(color_list) + } + + //显示是展示数据 + useEffect(() => { + if(!show) { + setList([]) + setSelectIndex(0) + } else { + setLoading(true) + getShoppingCart() + } + }, [show]) + + useEffect(() => { + return () => { + setList([]) + } + }, []) + + const [showPopup, setShowPopup] = useState(false) + useEffect(() => { + setShowPopup(show) + }, [show]) + + //全选反选 + const [selectStatus, setSelectStatus] = useState(false) + const selectAll = () => { + list.map(item => { + if(selectIndex == item.sale_mode || selectIndex == -1) + item.select = !selectStatus + }) + setSelectStatus(!selectStatus) + setList([...list]) + } + + //checkbox选中回调 + const selectCallBack = (item) => { + item.select = true + checkSelect() + setList([...list]) + } + + //checkbox选中判断是否全部选中,全部选中后是全选,否则反选 + const checkSelect = () => { + let list_count = 0 + let select_count = 0 + list?.map(item => { + if(selectIndex == -1 || selectIndex == item.sale_mode) { + list_count ++ + if(item.select) select_count++ + } + }) + setSelectStatus(select_count == list_count) + } + + //checkbox关闭回调 + const colseCallBack = (item) => { + item.select = false + checkSelect() + setList([...list]) + } + + //popup关闭 + const closePopup = () => { + onClose?.() + setShowPopup(false) + } + + //删除购物车内容 + const {fetchData:delShopFetchData} = DelShoppingCartApi() + const delSelect = () => { + getSelectId() + if(selectIds.current.length <= 0) return alert.none('请选择要删除的面料!') + Taro.showModal({ + content: '删除所选商品?', + success: async function (res) { + if (res.confirm) { + + const res = await delShopFetchData({id:selectIds.current}) + if(res.success) { + getShoppingCart() + Taro.showToast({ + title: '成功', + icon: 'success', + }) + } else { + Taro.showToast({ + title: res.msg, + icon: 'none', + }) + } + + } else if (res.cancel) { + console.log('用户点击取消') + } + } + }) + } + + //获取面料选中的id + const selectIds = useRef([]) + const getSelectId = () => { + selectIds.current = [] + list?.map(item => { + if(selectIndex == -1 || selectIndex == item.sale_mode) { + item.select&&selectIds.current.push(item.id) + } + }) + } + + //格式化金额 + const formatPirce = useCallback((price) => { + return Number(formatPriceDiv(price)) + }, []) + + //格式化数量 + const formatCount = useCallback((item) => { + console.log('item:::',item) + return item.sale_mode == 0? item.roll : (item.length/100) + }, []) + + //格式化单位 + const formatUnit = useCallback((item) => { + return item.sale_mode == 0? '条':'米' + }, []) + + //预估金额和总条数 + const estimatePrice = useMemo(() => { + let estimate_amount = 0 + let product_list = new Set() //面料 + let color_count = 0 //颜色数量 + let all_count = 0 //总数量 + list.map(item => { + if(item.select) { + estimate_amount += item.estimate_amount + product_list.add(item.product_id) + color_count++ + all_count += item.sale_mode == 0?item.roll: (item.length) + } + }) + let all_count_text = selectIndex == 0?all_count + '条': (all_count/100) + '米' + return {price: Number(formatPriceDiv(estimate_amount)).toFixed(2), countText: `已选${product_list.size}种面料,${color_count}个颜色,共${all_count_text}`, color_count} + },[list]) + + + //去结算 + const {fetchData: useFetchData} = GetAdminUserInfoApi() + const {fetchData: applyOrderAccessFetchData} = ApplyOrderAccessApi() + const orderDetail = debounce( async () => { + let res = await useFetchData() + if(res.data.order_access_status !== 3) { + if(res.data.order_access_status == 1) applyOrderAccessFetchData() + Taro.showModal({ + title: '提示', + content: '暂未开通下单权限功能,稍后有客服联系您,请注意接受电话。', + cancelText: '联系客服', + confirmText: '我知道', + success: function (res) { + if (res.confirm) { + } else if (res.cancel) { + console.log('用户点击取消') + } + } + }) + return false + } + getSelectId() + if(selectIds.current.length == 0) { + alert.error('请选择面料') + } else { + let ids = selectIds.current.join('-') + setParam({ids, sale_mode:selectIndex}) //临时存储 + closePopup() + goLink('/pages/order/comfirm') + } + }, 500) + + + //计数组件-当后端修改完成才修改前端显示 + const {fetchData: fetchDataUpdateShoppingCart} = UpdateShoppingCartApi() + const [UpdateShoppingCartLoading, setUpdateShoppingCartLoading] = useState(false) + const getInputValue = debounce(async (num, item) => { + let roll = item.sale_mode == 0?parseFloat(num):0 + let length = item.sale_mode != 0?(parseFloat(num)*100):0 + setUpdateShoppingCartLoading(() => true) + let res = await fetchDataUpdateShoppingCart({id: item.id, roll, length}) + setUpdateShoppingCartLoading(() => false) + if(res.success) { + getShoppingCart() + } + }, 300) + + return ( + + closePopup()} > + + + {!selectStatus?'全选':'反选'} + + + 删除所选 + + + {estimatePrice.countText} + + {selectList.map((item) => { + return selectProduct(item.value)} className={classnames(styles.search_item, (selectIndex==item.value)&&styles.search_item_select)}>{item.title} + })} + + + {loading&&} + {!loading&&list?.length > 0&& + + {list?.map((item, index) => { + return + + selectCallBack(item)} onClose={() => colseCallBack(item)}/> + + + + + + {formatHashTag(item.product_code, item.product_name)} + {item.product_color_code +' ' + item.product_color_name} + {item.sale_mode_name} + + + {formatPirce(item.sale_price)}/{selectList[selectIndex].eunit} + {/* ×{formatCount(item)}{selectList[selectIndex].unit} */} + + getInputValue(e, item)} + defaultNum={item.count} + step={selectList[selectIndex].step} + digits={selectList[selectIndex].digits} + onClickBtn={(e) => getInputValue(e, item)} + unit={formatUnit(item)} + minNum={selectList[selectIndex].minNum} + maxNum={selectList[selectIndex].maxNum} + disable={UpdateShoppingCartLoading} + /> + + + + })} + + } + {!loading&&list?.length == 0 && + 暂未选择商品 + 去选购 + } + + + + + + + + + {estimatePrice.price} + 预估金额 + + orderDetail()}> + 去结算({estimatePrice.color_count}) + + + + + + + ) +} + diff --git a/src/components/shopCart/index.tsx b/src/components/shopCart/index.tsx index 9297d36..e58684f 100644 --- a/src/components/shopCart/index.tsx +++ b/src/components/shopCart/index.tsx @@ -26,6 +26,7 @@ export default ({show = false, onClose}: param) => { {value:2,title:'散剪', unit:'米', eunit:'kg', step:1, digits:2, minNum:5, maxNum:100000, defaultNum:10}, ] + //切换面料类型 const [selectIndex, setSelectIndex] = useState(0) const selectProduct = (index:number) => { setSelectIndex(index) @@ -42,12 +43,12 @@ export default ({show = false, onClose}: param) => { const resetList = () => { list?.map(item => { if(selectIndex == item.sale_mode || selectIndex == -1) { - item.select = true + checkboxData[item.id] = true } else { - item.select = false + checkboxData[item.id] = false } }) - setList([...list]) + setCheckboxData(() => ({...checkboxData})) } //获取数据 @@ -58,25 +59,21 @@ export default ({show = false, onClose}: param) => { const {data} = await fetchData() let color_list = data.color_list||[] initList(color_list) + setList(color_list) setLoading(false) } - //初始化勾选数据 - const [selectData, setSelectData] = useState<{id: number, checked: true|false}[]>([]) - const initSelectData = (data:{id:number}[] = []) => { - let res = data?.map(item => { - return {id: item.id, checked: true} - }) - setSelectData(() => res) - } - - //初始化全部数据 + //初始化全部数据默认勾选 + const [checkboxData, setCheckboxData] = useState<{[index:number]:true|false}>({}) + const initStatus = useRef(false) const initList = (color_list) => { - color_list?.map(item => { - if(selectIndex == item.sale_mode) item.select = true - item.count = formatCount(item) - }) - setList(color_list) + if(initStatus.current) { + color_list?.map(item => { + if(selectIndex == item.sale_mode) checkboxData[item.id] = true + }) + initStatus.current = false + } + setCheckboxData(() => checkboxData) } //显示是展示数据 @@ -86,6 +83,7 @@ export default ({show = false, onClose}: param) => { setSelectIndex(0) } else { setLoading(true) + initStatus.current = true getShoppingCart() } }, [show]) @@ -106,17 +104,17 @@ export default ({show = false, onClose}: param) => { const selectAll = () => { list.map(item => { if(selectIndex == item.sale_mode || selectIndex == -1) - item.select = !selectStatus + checkboxData[item.id] = !selectStatus }) setSelectStatus(!selectStatus) - setList([...list]) + setCheckboxData(() => ({...checkboxData})) } //checkbox选中回调 const selectCallBack = (item) => { - item.select = true + checkboxData[item.id] = true checkSelect() - setList([...list]) + setCheckboxData(() => ({...checkboxData})) } //checkbox选中判断是否全部选中,全部选中后是全选,否则反选 @@ -126,7 +124,7 @@ export default ({show = false, onClose}: param) => { list?.map(item => { if(selectIndex == -1 || selectIndex == item.sale_mode) { list_count ++ - if(item.select) select_count++ + if(checkboxData[item.id]) select_count++ } }) setSelectStatus(select_count == list_count) @@ -134,9 +132,9 @@ export default ({show = false, onClose}: param) => { //checkbox关闭回调 const colseCallBack = (item) => { - item.select = false + checkboxData[item.id] = false checkSelect() - setList([...list]) + setCheckboxData(() => ({...checkboxData})) } //popup关闭 @@ -182,7 +180,7 @@ export default ({show = false, onClose}: param) => { selectIds.current = [] list?.map(item => { if(selectIndex == -1 || selectIndex == item.sale_mode) { - item.select&&selectIds.current.push(item.id) + checkboxData[item.id]&&selectIds.current.push(item.id) } }) } @@ -210,7 +208,7 @@ export default ({show = false, onClose}: param) => { let color_count = 0 //颜色数量 let all_count = 0 //总数量 list.map(item => { - if(item.select) { + if(checkboxData[item.id]) { estimate_amount += item.estimate_amount product_list.add(item.product_id) color_count++ @@ -219,7 +217,7 @@ export default ({show = false, onClose}: param) => { }) let all_count_text = selectIndex == 0?all_count + '条': (all_count/100) + '米' return {price: Number(formatPriceDiv(estimate_amount)).toFixed(2), countText: `已选${product_list.size}种面料,${color_count}个颜色,共${all_count_text}`, color_count} - },[list]) + },[list, checkboxData]) //去结算 @@ -293,7 +291,7 @@ export default ({show = false, onClose}: param) => { {list?.map((item, index) => { return - selectCallBack(item)} onClose={() => colseCallBack(item)}/> + selectCallBack(item)} onClose={() => colseCallBack(item)}/> @@ -309,7 +307,7 @@ export default ({show = false, onClose}: param) => { getInputValue(e, item)} - defaultNum={item.count} + defaultNum={formatCount(item)} step={selectList[selectIndex].step} digits={selectList[selectIndex].digits} onClickBtn={(e) => getInputValue(e, item)} diff --git a/src/pages/collection/collectionClass/index.module.scss b/src/pages/collection/collectionClass/index.module.scss index 7762701..51ba4ab 100644 --- a/src/pages/collection/collectionClass/index.module.scss +++ b/src/pages/collection/collectionClass/index.module.scss @@ -20,7 +20,7 @@ display: flex; justify-content: space-between; align-items: center; - padding: 20px 20px 0 20px; + padding: 20px 30px 0 30px; font-size: 26px; color: #707070; .operation_check{ @@ -35,9 +35,12 @@ } } .operation_check_right{ - Text{ - color: #CCCCCC; - margin-right: 20px; + .operation_check_move{ + color: #707070; + margin-right: 30px; + } + .operation_check_cancel{ + color: #007AFF; } } .class_list{ diff --git a/src/pages/collection/collectionClass/index.tsx b/src/pages/collection/collectionClass/index.tsx index b19f63d..c097b2f 100644 --- a/src/pages/collection/collectionClass/index.tsx +++ b/src/pages/collection/collectionClass/index.tsx @@ -11,6 +11,7 @@ import CreatePopup from "../components/createPopup"; import UpdatePopup from "../components/updatePopup"; import styles from './index.module.scss' import MCheckbox from "@/components/checkbox"; +import AddCollection from "@/components/addCollection"; export default () => { @@ -20,7 +21,7 @@ export default () => { const getFavoriteInfo = () => { let arr:any[] = [] new Array(10).fill("").map((item, index) => { - arr.push({code: index}) + arr.push({id:index, code: index}) }) setList(arr) } @@ -34,32 +35,53 @@ export default () => { getFavoriteInfo() }, [searchData]) + + //获取选中的id + const [ids, setIds] = useState([]) + const getSelectIds = useCallback((val) => { + setIds(() => val) + }, []) + + //全选反选 + const [selectStatus, setSelectStatus] = useState(false) const selectCallBack = useCallback(() => { - + setSelectStatus(() => true) }, []) - const colseCallBack = useCallback(() => { - + setSelectStatus(() => false) + }, []) + // useEffect(() => { + // if(list.length) + // setSelectStatus(ids.length == list.length) + // }, [ids, list]) + const [collectionShow, setCollectionShow] = useState(false) + const closeCollection = useCallback(() => { + setCollectionShow(false) }, []) - return ( - - - - - - - selectCallBack()} onClose={() => colseCallBack()}/> - 全选 - - - 移动到 - 取消收藏 - - - - - + const onAdd = () => { + + } + + return ( + + + - ) + + + selectCallBack()} onClose={() => colseCallBack()}/> + 全选 + + + setCollectionShow(true)}>移动到 + 取消收藏 + + + + + + + + ) } \ No newline at end of file diff --git a/src/pages/collection/components/product/index.tsx b/src/pages/collection/components/product/index.tsx index bca82bd..cfab59b 100644 --- a/src/pages/collection/components/product/index.tsx +++ b/src/pages/collection/components/product/index.tsx @@ -5,54 +5,77 @@ import styles from './index.module.scss' import { formatHashTag, formatImgUrl } from "@/common/fotmat" import LabAndImg from "@/components/LabAndImg" import MCheckbox from "@/components/checkbox"; -import { useCallback, useEffect, useState } from "react" +import { useCallback, useEffect, useRef, useState } from "react" type Params = { - desStatus?: true|false, - productList?: any[] + productList?: any[], + onSelectIds?: (val: number[]) => void + selectStatus?: false|true } -export default ({desStatus = true, productList = []}:Params) => { +export default ({productList = [], onSelectIds, selectStatus = false}:Params) => { const [list, setList] = useState([]) useEffect(() => { - console.log('productList::', productList) setList(() => [...productList]) },[productList]) - + useEffect(() => { + if(list.length) { + list.map(item => { + item.check = selectStatus + }) + } + setList(() => [...list]) + }, [selectStatus]) - const onSelect = (item, e) => { - console.log('e:::', e) + const onChangeSelect = (item) => { + if(item.check) { + onClose(item) + } else { + onSelect(item) + } + } + + //选中和取消选中 + const onSelect = (item) => { item.check = true setList(() => ([...list])) } - - const onClose = (item, e) => { + const onClose = (item) => { item.check = false setList(() => ([...list])) } + //监听数据变化 + useEffect(() => { + let ids: number[] = [] + list.map(item => { + if(item.check) ids.push(item.id) + }) + onSelectIds?.(ids) + }, [list]) + return ( {list?.map(item => { - return goLink(`/pages/details/index?id=${item.id}`)}> - - onSelect(item, e)} onClose={() => onClose(item, e)}/> + return onChangeSelect(item)}> + e.stopPropagation()}> + onSelect(item)} onClose={() => onClose(item)}/> {item.product_color_count}色 - {formatHashTag(item.product_code, '')} {item.product_name} - - {item.width} - {item.weight_density} - - {item.component} - {desStatus&&{item.describe}} + {formatHashTag(item.product_code, '')} {item.product_name} + + {item.width} + {item.weight_density} + + {item.component} })} + ) } diff --git a/src/pages/collection/index.tsx b/src/pages/collection/index.tsx index 88ad54e..08e5e49 100644 --- a/src/pages/collection/index.tsx +++ b/src/pages/collection/index.tsx @@ -143,7 +143,7 @@ export default () => { moreUpdate(item,e)}>更多 - + )} diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index fb72266..c75665b 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -53,6 +53,7 @@ import styles from './index.module.scss' let res = await getOrderFetchData({id: orderId.current}) setOrderDetail(res.data) setOrderRemark(res.data.remark) + if(res.data.status == SaleorderstatusWaitingPrePayment.value) toPay() } Taro.stopPullDownRefresh() Taro.hideToast() diff --git a/src/pages/salesAfter/components/addressInfoDetail/index.module.scss b/src/pages/salesAfter/components/addressInfoDetail/index.module.scss index 82159da..907e73f 100644 --- a/src/pages/salesAfter/components/addressInfoDetail/index.module.scss +++ b/src/pages/salesAfter/components/addressInfoDetail/index.module.scss @@ -78,9 +78,9 @@ width:152px; font-size: 28px; height: 60px; - color: $color_font_two; + color:#007AFF; z-index: 999; - border: 2px solid #dddddd; + border: 2px solid #007AFF; border-radius: 36px; text-align: center; line-height: 60px; diff --git a/src/pages/salesAfter/components/kindList/index.tsx b/src/pages/salesAfter/components/kindList/index.tsx index 16d4321..7a2dd69 100644 --- a/src/pages/salesAfter/components/kindList/index.tsx +++ b/src/pages/salesAfter/components/kindList/index.tsx @@ -1,4 +1,4 @@ -import { AFTER_ORDER_STATUS, ORDER_STATUS } from "@/common/enum" +import { AFTER_ORDER_STATUS, ORDER_STATUS, REFUND_STATUS } from "@/common/enum" import { formatHashTag, formatPriceDiv, formatWeightDiv } from "@/common/fotmat" import LabAndImg from "@/components/LabAndImg" import { Text, View } from "@tarojs/components" @@ -17,6 +17,7 @@ type OrderParam = { total_number: number, stage: number, //订单状态 type: 1|2, //1退货, 2退款 + refund_type: number, //退款状态 total_sale_price: number, //销售金额 total_should_collect_money: number, //应收金额 total_weight_error_discount: number, //空差优惠 @@ -57,76 +58,80 @@ export default memo(({order, comfirm = false}:Param) => { ReturnStageRejected, // 已拒绝 } = AFTER_ORDER_STATUS + //退款状态枚举 + const { + ShouldCollectOrderRefundTypeUnknown, + ShouldCollectOrderRefundTypeAdvanceReceiptRefund, + ShouldCollectOrderRefundTypeReturnForRefund, + ShouldCollectOrderRefundTypeSalesRefund, + } = REFUND_STATUS //金额列表枚举 const priceList = [ - + { + id:5, + big_value:[ + ReturnStageQualityCheckPendingRefund.value, + ReturnStageServiceOrderPendingRefund.value, + ReturnStageReturned.value, + ], + cut_value: [ReturnStageRejected.value, + ReturnStageApplying.value, + ReturnStageWaitCheck.value, + ReturnStageChecked.value, + ReturnStageQualityCheckPendingRefund.value, + ReturnStageServiceOrderPendingRefund.value, + ReturnStageReturned.value, + ReturnStageCancel.value + ], + model_value: [ + ReturnStageApplying.value, + ReturnStageWaitCheck.value, + ReturnStageChecked.value, + ReturnStageQualityCheckPendingRefund.value, + ReturnStageServiceOrderPendingRefund.value, + ReturnStageReturned.value, + ReturnStageCancel.value + ], + label:'合计金额', + field: 'total_refund_amount' + }, { id:1, - big_value:[ - ReturnStageServiceOrderPendingRefund.value, - ReturnStageReturned.value - ], + big_value:[ReturnStageReturned.value], cut_value: [ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value], model_value: [], label:'扣款金额', - field: 'total_sale_price' - }, - { - id:2, - big_value:[ - ReturnStageServiceOrderPendingRefund.value, - ReturnStageReturned.value - ], - cut_value: [], - model_value: [], - label:'其他扣款', - field: 'total_weight_error_discount' + field: 'other_deduction_amount' }, { id:3, - big_value:[ - ReturnStageServiceOrderPendingRefund.value, - ReturnStageReturned.value - ], - cut_value: [ReturnStageServiceOrderPendingRefund.value], - model_value: [ - ReturnStageQualityCheckPendingRefund.value, - ReturnStageServiceOrderPendingRefund.value - ], - label:'应退金额', - field: 'total_should_collect_money' + big_value:[ReturnStageReturned.value], + cut_value: [ReturnStageReturned.value], + model_value: [ReturnStageReturned.value], + label:'退款金额', + field: 'refund_amount' }, { id:4, big_value:[ReturnStageReturned.value], cut_value: [ReturnStageReturned.value], model_value: [ReturnStageReturned.value], - label:'退款金额', - field: 'total_should_collect_money' - }, - { - id:5, - big_value:[ReturnStageReturned.value], - cut_value: [ReturnStageReturned.value], - model_value: [ReturnStageReturned.value], label:'退款去向', field: 'actual_amount' }, - { - id:6, - big_value:[ReturnStageQualityCheckPendingRefund.value], - cut_value: [ReturnStageRejected.value, ReturnStageApplying.value, ReturnStageWaitCheck.value, ReturnStageChecked.value, ReturnStageQualityCheckPendingRefund.value, ReturnStageServiceOrderPendingRefund.value, ReturnStageReturned.value], - model_value: [ReturnStageApplying.value], - label:'合计金额', - field: 'actual_amount' - }, - ] + + ] //是否显示价格 const showPrice = useCallback((priceInfo) => { let key = ['big_value', 'model_value', 'cut_value'] - return priceInfo[key[order?.sale_mode]].includes(order?.stage) + if(priceInfo.id == 5) { + return priceInfo[key[order?.sale_mode]].includes(order?.stage)||(order.refund_type == ShouldCollectOrderRefundTypeSalesRefund.value) + } else { + return priceInfo[key[order?.sale_mode]].includes(order?.stage) + } + }, [order]) const priceConDom = useMemo(() => { @@ -175,7 +180,7 @@ export default memo(({order, comfirm = false}:Param) => { {colorItem.code + ' ' + colorItem.name} {sale_price_show&&¥{standardPrice(colorItem.sale_price)}} - 总重{formatWeightDiv(colorItem.estimate_weight)}kg + {(order?.stage == ReturnStageReturned.value)&&总重{formatWeightDiv(colorItem.estimate_weight)}kg} diff --git a/src/pages/salesAfter/index.tsx b/src/pages/salesAfter/index.tsx index 0a41aca..90cb0e7 100644 --- a/src/pages/salesAfter/index.tsx +++ b/src/pages/salesAfter/index.tsx @@ -60,6 +60,11 @@ import styles from './index.module.scss' total_weight_error_discount: orderDetail.total_weight_error_discount, //空差优惠 actual_amount: orderDetail.actual_amount, //实付金额 the_previous_status: orderDetail.the_previous_status, //取消订单时的订单状态 + other_deduction_amount: orderDetail.other_deduction_amount, //其他扣除金额 + total_refund_amount: orderDetail.total_refund_amount, //合计金额 + refund_amount: orderDetail.refund_amount, //退款金额 + refund_type: orderDetail.refund_type //退款状态 + }) } const formatPreViewOrderMemo = useMemo(() => { @@ -104,7 +109,7 @@ import styles from './index.module.scss' if(val == 1) { setLogisticsShow(true) } else { - const list = orderDetail?.fabric_piece_accessory_url.map(item => { + const list = orderDetail?.accessory_url.map(item => { return formatImgUrl(item) }) Taro.previewImage({ @@ -132,9 +137,7 @@ import styles from './index.module.scss' - - - + setApplyRecord(false)}/> @@ -194,7 +197,7 @@ import styles from './index.module.scss' const showList = useMemo(() => { let res = urls.map(item => { - return formatImgUrl(item) + return formatImgUrl(item, "!w800") }) return res }, [urls]) diff --git a/src/pages/salesAfterList/components/order/index.tsx b/src/pages/salesAfterList/components/order/index.tsx index 8170c64..9be4b5d 100644 --- a/src/pages/salesAfterList/components/order/index.tsx +++ b/src/pages/salesAfterList/components/order/index.tsx @@ -27,6 +27,7 @@ type Param = { rgb: {r:number, g:number, b:number}, texturl_url: string, type: number //1 退货 2退款 + return_apply_order_id: number //退款申请单 }, onClickBtn?: (val:{status:number, orderInfo:Param['value']}) => void } @@ -52,7 +53,8 @@ export default memo(({value, onClickBtn}: Param) => { stage: value?.stage, //订单状态 orderId: value?.id, sale_mode: value?.sale_mode, //订单类型 - type: value?.type //退货or退款 + type: value?.type, //退货or退款 + return_apply_order_id: value?.return_apply_order_id //退款申请单 } }, [value]) @@ -109,7 +111,7 @@ export default memo(({value, onClickBtn}: Param) => { 订单号:{value?.order_no} - + ) }) diff --git a/src/use/useCommonData.ts b/src/use/useCommonData.ts index a0efae5..0b6c366 100644 --- a/src/use/useCommonData.ts +++ b/src/use/useCommonData.ts @@ -15,6 +15,7 @@ export const useTimeCountDown = () => { const timeObj:any = useRef() const endTime = useRef('') const onStart = (val = '') => { + console.log('time:::', val) endTime.current = val if(endTime.current) { clearInterval(timeObj.current) @@ -51,7 +52,7 @@ export const useTimeCountDown = () => { var HH = ('00'+hh).slice(-2); var MM = ('00'+mm).slice(-2); var SS = ('00'+ss).slice(-2); - // console.log('endTime::', `${DD}-${HH}-${MM}-${SS}`) + console.log('endTime::', `${DD}-${HH}-${MM}-${SS}`) setShowTime((e) => ({...e, DD, HH, MM, SS})) } return { From f05389ced77235101c2e913c7137ccf692ee0c5b Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Wed, 6 Jul 2022 20:29:48 +0800 Subject: [PATCH 11/12] =?UTF-8?q?=E7=94=B5=E5=AD=90=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=89=88v4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/user.ts | 1 - src/common/constant.js | 5 +- src/common/enum.ts | 21 +- src/common/util.ts | 1 - src/components/afterOrderBtns/index.tsx | 33 +- src/components/orderBtns/index.tsx | 22 +- src/components/shopCart/index copy.tsx | 352 ------------------ src/components/shopCart/index.tsx | 2 +- src/components/textareaEnhance/index.tsx | 7 +- src/components/uploadImage/index.tsx | 11 +- src/pages/addressAdd/index.tsx | 2 + src/pages/addressManager/index.tsx | 3 +- src/pages/applyAfterSales/index.tsx | 3 +- src/pages/classList/index.tsx | 2 + .../collection/collectionClass/index.tsx | 40 +- .../collection/components/product/index.tsx | 22 +- src/pages/collection/index.tsx | 11 +- src/pages/company/index.tsx | 2 + src/pages/creditLine/index.tsx | 3 +- src/pages/creditUsed/index.tsx | 2 + src/pages/depositBeforehand/index.tsx | 2 + src/pages/depositBeforehandDetail/index.tsx | 3 +- src/pages/depositList/index.tsx | 2 + .../components/preview/index.module.scss | 5 +- .../details/components/preview/index.tsx | 7 +- src/pages/details/index.module.scss | 17 + src/pages/details/index.tsx | 21 +- src/pages/editOrder/index.tsx | 3 +- src/pages/index/index.tsx | 15 +- .../components/addressInfoDetail/index.tsx | 39 +- src/pages/order/index.tsx | 19 +- .../components/addressInfoDetail/index.tsx | 2 +- .../salesAfter/components/kindList/index.tsx | 2 +- .../components/returnLogistics/index.tsx | 13 +- src/pages/salesAfter/index.tsx | 39 +- .../salesAfterList/components/order/index.tsx | 13 +- .../components/orderStatusTag/index.tsx | 12 +- src/pages/salesAfterList/index.tsx | 11 +- src/pages/search/index.tsx | 2 + src/pages/searchList/hightSearchList.tsx | 5 +- src/pages/searchList/search.tsx | 5 +- src/pages/searchList/searchList.tsx | 5 +- src/pages/user/index.tsx | 83 +++-- src/pages/weightList/index.tsx | 2 + src/pages/weightListAdd/index.tsx | 2 + src/use/useHttp.ts | 8 +- src/use/useLogin.ts | 9 +- src/use/useLoginRequest.ts | 12 +- 48 files changed, 358 insertions(+), 545 deletions(-) delete mode 100644 src/components/shopCart/index copy.tsx diff --git a/src/api/user.ts b/src/api/user.ts index 0eaf833..abdc9c9 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -1,5 +1,4 @@ import { useRequest } from "@/use/useHttp" - /** * 解密用户微信信息 */ diff --git a/src/common/constant.js b/src/common/constant.js index 3dc9ec4..7ac4281 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -6,12 +6,13 @@ // export const BASE_URL = `http://192.168.1.165:40001/lymarket` // 王霞 // export const BASE_URL = `https://test.zzfzyc.com/lymarket` // 测试环境 // export const BASE_URL = `http://192.168.1.9:40001/lymarket` // 发 +// export const BASE_URL = `http://192.168.1.9:50005/lymarket` // 发 // export const BASE_URL = `http://192.168.1.30:50001/lymarket` // 发 // export const BASE_URL = `https://dev.zzfzyc.com/lymarket` // 开发环境 // export const BASE_URL = `https://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.42:50001/lymarket` // 杰 +export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添 +// export const BASE_URL = `http://192.168.1.42:50001/lymarket` // 杰 // CDN // 生成密钥 diff --git a/src/common/enum.ts b/src/common/enum.ts index 0016360..3a57fb1 100644 --- a/src/common/enum.ts +++ b/src/common/enum.ts @@ -29,13 +29,13 @@ export const AFTER_ORDER_STATUS = { //支付方式 export const PAYMENT_METHOD = { - PaymentMethodPreDeposit: {value:1, label:'预存款'}, - PaymentMethodAccountPeriod : {value:2, label:'账期'}, - PaymentMethodofflineRemittance: {value:0, label:'线下汇款'}, - PaymentMethodScanCodeToPay: {value:3, label:'扫码支付'}, - PaymentMethodCashOnDelivery: {value:4, label:'货到付款'}, + PaymentMethodPreDeposit: {value:2, label:'预存款'}, + PaymentMethodAccountPeriod : {value:3, label:'账期'}, + PaymentMethodofflineRemittance: {value:1, label:'线下汇款'}, + PaymentMethodScanCodeToPay: {value:4, label:'扫码支付'}, + PaymentMethodCashOnDelivery: {value:5, label:'货到付款'}, } -export type PAYMENT_METHOD_PARAM = 0|1|2|3|4 +export type PAYMENT_METHOD_PARAM = 1|2|3|4|5 //订单类型 @@ -58,10 +58,17 @@ export const SUBSCRIPTION_MESSAGE_SCENE = { ApplyGoods: {value:3, label: '申请退款'} } -//退款状态枚举 +//应收单退款状态枚举 export const REFUND_STATUS = { ShouldCollectOrderRefundTypeUnknown: {value:0, label:'未知退款'}, ShouldCollectOrderRefundTypeAdvanceReceiptRefund: {value:1, label:'预收退款'}, ShouldCollectOrderRefundTypeReturnForRefund: {value:2, label:'退货退款'}, ShouldCollectOrderRefundTypeSalesRefund: {value:3, label:'销售退款'}, +} + +//申请单退款状态枚举 +export const REFUND_STATUS_ORDER = { + ReturnApplyOrderTypeAdvanceReceiptRefund: {value:1, label:'预收退款'}, // 预收退款 + ReturnApplyOrderTypeReturnForRefund: {value:2, label:'退货退款'}, // 退货退款 + ReturnApplyOrderTypeSalesRefund: {value:3, label:'销售退款'}, // 销售退款 } \ No newline at end of file diff --git a/src/common/util.ts b/src/common/util.ts index bd14ea0..4bb0803 100644 --- a/src/common/util.ts +++ b/src/common/util.ts @@ -24,7 +24,6 @@ export const throttle = (fn, delay) => { let pre = 0; return (...params) => { let now = new Date().getTime(); - console.log('相差:',now-pre) if (now - pre > delay) { fn(...params); pre = now; diff --git a/src/components/afterOrderBtns/index.tsx b/src/components/afterOrderBtns/index.tsx index 7519615..2f730a6 100644 --- a/src/components/afterOrderBtns/index.tsx +++ b/src/components/afterOrderBtns/index.tsx @@ -1,12 +1,13 @@ import { CancelOrderApi, ReceiveOrderApi } from "@/api/order" import { alert } from "@/common/common" -import { AFTER_ORDER_STATUS, ORDER_STATUS, 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 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: { @@ -31,6 +32,12 @@ export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => { ReturnStageServiceOrderPendingRefund, } = AFTER_ORDER_STATUS + const { + ReturnApplyOrderTypeAdvanceReceiptRefund, // 预收退款 + ReturnApplyOrderTypeReturnForRefund, // 退货退款 + ReturnApplyOrderTypeSalesRefund // 销售退款 + } = REFUND_STATUS_ORDER + //订单类型 // const { // SaLeModeBulk, @@ -50,7 +57,7 @@ export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => { { id: 1, big_value: [ReturnStageApplying.value, ReturnStageWaitCheck.value], - cut_value: [], + cut_value: [ReturnStageApplying.value, ReturnStageWaitCheck.value, ], model_value: [], label: '取消退货' }, @@ -77,13 +84,17 @@ export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => { let key = ['big_value', 'model_value', 'cut_value'] if(item.id == 1) { //取消退货 - return (orderInfo.type == 1)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage) + return (orderInfo.type == ReturnApplyOrderTypeReturnForRefund.value)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage) } else if (item.id == 6) { //取消退款 - return (orderInfo.type == 2)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage) + if(orderInfo?.sale_mode == 0) { + return (orderInfo.type != ReturnApplyOrderTypeReturnForRefund.value)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage) + } else { + return item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage) + } } else if (item.id == 4) { //质检结果 - return (orderInfo?.type == 1)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage) //退货才有 + return (orderInfo?.type == ReturnApplyOrderTypeReturnForRefund.value)&&item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage) //退货才有 } else { return item[key[orderInfo?.sale_mode]]?.includes(orderInfo.stage) } @@ -99,19 +110,19 @@ export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => { //点击按钮操作 - const submitBtns = (val, index) => { + const submitBtns = throttle((val, index) => { if (val == 1) { - cancelOrder({title:'要取消退货吗?'}) + cancelOrder({title:'要取消退货吗?', val}) } else if (val == 6) { - cancelOrder({title:'要取消退款吗?'}) + cancelOrder({title:'要取消退款吗?', val}) } else { onClick?.(val) } - } + }, 600) //取消退货/退款 const {fetchData: returnApplyOrderCancelFetchData} = ReturnApplyOrderCancelApi() - const cancelOrder = ({title = ''}) => { + const cancelOrder = ({title = '', val}) => { Taro.showModal({ title, success: async function (res) { @@ -119,7 +130,7 @@ export default memo(({orderInfo, onClick, fixedBottom = true}:Param) => { let res = await returnApplyOrderCancelFetchData({id: orderInfo?.return_apply_order_id}) if(res.success) { alert.success('取消成功') - onClick?.(1) + onClick?.(val) } else { alert.none(res.msg) } diff --git a/src/components/orderBtns/index.tsx b/src/components/orderBtns/index.tsx index 1ed060d..aaef418 100644 --- a/src/components/orderBtns/index.tsx +++ b/src/components/orderBtns/index.tsx @@ -9,6 +9,7 @@ import styles from './index.module.scss' import { AddShoppingCartApi } from "@/api/shopCart" import { ApplyRefundApi } from "@/api/salesAfterOrder" import { UseSubscriptionMessage } from "@/use/useCommonData" +import { throttle } from "@/common/util" type Param = { orderInfo: { @@ -132,7 +133,7 @@ export default memo(({orderInfo, onClick}:Param) => { const {openSubscriptionMessage} = UseSubscriptionMessage() //点击按钮操作 - const submitBtns = async (val, index) => { + const submitBtns = throttle(async (val, index) => { if (val == 1) { cancelOrder() } else if (val == 6) { @@ -142,14 +143,27 @@ export default memo(({orderInfo, onClick}:Param) => { await openSubscriptionMessage({orderId: orderInfo?.orderId, scenes: ApplyGoods.value}) goLink('/pages/applyAfterSales/index',{id:orderInfo?.orderId}) } else if (val == 3) { - await openSubscriptionMessage({orderId: orderInfo?.orderId, scenes: ApplyGoods.value}) - onClick?.(val) + bigApplyRefurn() } else if(val == 8) { applyRefund() } else { onClick?.(val) } - + }, 600) + + //大货申请退款 + const bigApplyRefurn = () => { + Taro.showModal({ + title: '要申请退款吗?', + success: async function (res) { + if(res.confirm) { + await openSubscriptionMessage({orderId: orderInfo?.orderId, scenes: ApplyGoods.value}) + onClick?.(3) + } else { + console.log('用户点击取消') + } + } + }) } //取消订单 diff --git a/src/components/shopCart/index copy.tsx b/src/components/shopCart/index copy.tsx deleted file mode 100644 index 9297d36..0000000 --- a/src/components/shopCart/index copy.tsx +++ /dev/null @@ -1,352 +0,0 @@ -import {Image, ScrollView, View } from "@tarojs/components" -import Popup from "@/components/popup" -import classnames from "classnames"; -import MCheckbox from "@/components/checkbox"; -import LoadingCard from "@/components/loadingCard"; -import InfiniteScroll from "@/components/infiniteScroll"; -import styles from "./index.module.scss" -import { useCallback, useEffect, useMemo, useRef, useState } from "react"; -import Taro from "@tarojs/taro"; -import { alert, goLink } from "@/common/common"; -import {GetShoppingCartApi, DelShoppingCartApi, UpdateShoppingCartApi} from "@/api/shopCart" -import { formatHashTag, formatImgUrl, formatPriceDiv } from "@/common/fotmat"; -import { setParam } from "@/common/system"; -import { debounce } from "@/common/util"; -import Counter from "../counter"; -import { ApplyOrderAccessApi, GetAdminUserInfoApi, SubscriptionMessageApi } from "@/api/user"; - -type param = { - show?: true|false, - onClose?: () => void -} -export default ({show = false, onClose}: param) => { - const selectList = [ - {value:0, title:'大货', unit:'条', eunit:'kg', step:1, digits:0, minNum:1, maxNum:100000, defaultNum:1}, - {value:1,title:'剪板', unit:'米', eunit:'m', step:1, digits:2, minNum:0.5, maxNum:9.99, defaultNum:1}, - {value:2,title:'散剪', unit:'米', eunit:'kg', step:1, digits:2, minNum:5, maxNum:100000, defaultNum:10}, - ] - - const [selectIndex, setSelectIndex] = useState(0) - const selectProduct = (index:number) => { - setSelectIndex(index) - } - - useEffect(() => { - resetList() - setSelectStatus(true) - }, [selectIndex]) - - - - //重置勾选数据 - const resetList = () => { - list?.map(item => { - if(selectIndex == item.sale_mode || selectIndex == -1) { - item.select = true - } else { - item.select = false - } - }) - setList([...list]) - } - - //获取数据 - const [list, setList] = useState([]) - const [loading, setLoading] = useState(false) - const {fetchData} = GetShoppingCartApi() - const getShoppingCart = async () => { - const {data} = await fetchData() - let color_list = data.color_list||[] - initList(color_list) - setLoading(false) - } - - //初始化勾选数据 - const [selectData, setSelectData] = useState<{id: number, checked: true|false}[]>([]) - const initSelectData = (data:{id:number}[] = []) => { - let res = data?.map(item => { - return {id: item.id, checked: true} - }) - setSelectData(() => res) - } - - //初始化全部数据 - const initList = (color_list) => { - color_list?.map(item => { - if(selectIndex == item.sale_mode) item.select = true - item.count = formatCount(item) - }) - setList(color_list) - } - - //显示是展示数据 - useEffect(() => { - if(!show) { - setList([]) - setSelectIndex(0) - } else { - setLoading(true) - getShoppingCart() - } - }, [show]) - - useEffect(() => { - return () => { - setList([]) - } - }, []) - - const [showPopup, setShowPopup] = useState(false) - useEffect(() => { - setShowPopup(show) - }, [show]) - - //全选反选 - const [selectStatus, setSelectStatus] = useState(false) - const selectAll = () => { - list.map(item => { - if(selectIndex == item.sale_mode || selectIndex == -1) - item.select = !selectStatus - }) - setSelectStatus(!selectStatus) - setList([...list]) - } - - //checkbox选中回调 - const selectCallBack = (item) => { - item.select = true - checkSelect() - setList([...list]) - } - - //checkbox选中判断是否全部选中,全部选中后是全选,否则反选 - const checkSelect = () => { - let list_count = 0 - let select_count = 0 - list?.map(item => { - if(selectIndex == -1 || selectIndex == item.sale_mode) { - list_count ++ - if(item.select) select_count++ - } - }) - setSelectStatus(select_count == list_count) - } - - //checkbox关闭回调 - const colseCallBack = (item) => { - item.select = false - checkSelect() - setList([...list]) - } - - //popup关闭 - const closePopup = () => { - onClose?.() - setShowPopup(false) - } - - //删除购物车内容 - const {fetchData:delShopFetchData} = DelShoppingCartApi() - const delSelect = () => { - getSelectId() - if(selectIds.current.length <= 0) return alert.none('请选择要删除的面料!') - Taro.showModal({ - content: '删除所选商品?', - success: async function (res) { - if (res.confirm) { - - const res = await delShopFetchData({id:selectIds.current}) - if(res.success) { - getShoppingCart() - Taro.showToast({ - title: '成功', - icon: 'success', - }) - } else { - Taro.showToast({ - title: res.msg, - icon: 'none', - }) - } - - } else if (res.cancel) { - console.log('用户点击取消') - } - } - }) - } - - //获取面料选中的id - const selectIds = useRef([]) - const getSelectId = () => { - selectIds.current = [] - list?.map(item => { - if(selectIndex == -1 || selectIndex == item.sale_mode) { - item.select&&selectIds.current.push(item.id) - } - }) - } - - //格式化金额 - const formatPirce = useCallback((price) => { - return Number(formatPriceDiv(price)) - }, []) - - //格式化数量 - const formatCount = useCallback((item) => { - console.log('item:::',item) - return item.sale_mode == 0? item.roll : (item.length/100) - }, []) - - //格式化单位 - const formatUnit = useCallback((item) => { - return item.sale_mode == 0? '条':'米' - }, []) - - //预估金额和总条数 - const estimatePrice = useMemo(() => { - let estimate_amount = 0 - let product_list = new Set() //面料 - let color_count = 0 //颜色数量 - let all_count = 0 //总数量 - list.map(item => { - if(item.select) { - estimate_amount += item.estimate_amount - product_list.add(item.product_id) - color_count++ - all_count += item.sale_mode == 0?item.roll: (item.length) - } - }) - let all_count_text = selectIndex == 0?all_count + '条': (all_count/100) + '米' - return {price: Number(formatPriceDiv(estimate_amount)).toFixed(2), countText: `已选${product_list.size}种面料,${color_count}个颜色,共${all_count_text}`, color_count} - },[list]) - - - //去结算 - const {fetchData: useFetchData} = GetAdminUserInfoApi() - const {fetchData: applyOrderAccessFetchData} = ApplyOrderAccessApi() - const orderDetail = debounce( async () => { - let res = await useFetchData() - if(res.data.order_access_status !== 3) { - if(res.data.order_access_status == 1) applyOrderAccessFetchData() - Taro.showModal({ - title: '提示', - content: '暂未开通下单权限功能,稍后有客服联系您,请注意接受电话。', - cancelText: '联系客服', - confirmText: '我知道', - success: function (res) { - if (res.confirm) { - } else if (res.cancel) { - console.log('用户点击取消') - } - } - }) - return false - } - getSelectId() - if(selectIds.current.length == 0) { - alert.error('请选择面料') - } else { - let ids = selectIds.current.join('-') - setParam({ids, sale_mode:selectIndex}) //临时存储 - closePopup() - goLink('/pages/order/comfirm') - } - }, 500) - - - //计数组件-当后端修改完成才修改前端显示 - const {fetchData: fetchDataUpdateShoppingCart} = UpdateShoppingCartApi() - const [UpdateShoppingCartLoading, setUpdateShoppingCartLoading] = useState(false) - const getInputValue = debounce(async (num, item) => { - let roll = item.sale_mode == 0?parseFloat(num):0 - let length = item.sale_mode != 0?(parseFloat(num)*100):0 - setUpdateShoppingCartLoading(() => true) - let res = await fetchDataUpdateShoppingCart({id: item.id, roll, length}) - setUpdateShoppingCartLoading(() => false) - if(res.success) { - getShoppingCart() - } - }, 300) - - return ( - - closePopup()} > - - - {!selectStatus?'全选':'反选'} - - - 删除所选 - - - {estimatePrice.countText} - - {selectList.map((item) => { - return selectProduct(item.value)} className={classnames(styles.search_item, (selectIndex==item.value)&&styles.search_item_select)}>{item.title} - })} - - - {loading&&} - {!loading&&list?.length > 0&& - - {list?.map((item, index) => { - return - - selectCallBack(item)} onClose={() => colseCallBack(item)}/> - - - - - - {formatHashTag(item.product_code, item.product_name)} - {item.product_color_code +' ' + item.product_color_name} - {item.sale_mode_name} - - - {formatPirce(item.sale_price)}/{selectList[selectIndex].eunit} - {/* ×{formatCount(item)}{selectList[selectIndex].unit} */} - - getInputValue(e, item)} - defaultNum={item.count} - step={selectList[selectIndex].step} - digits={selectList[selectIndex].digits} - onClickBtn={(e) => getInputValue(e, item)} - unit={formatUnit(item)} - minNum={selectList[selectIndex].minNum} - maxNum={selectList[selectIndex].maxNum} - disable={UpdateShoppingCartLoading} - /> - - - - })} - - } - {!loading&&list?.length == 0 && - 暂未选择商品 - 去选购 - } - - - - - - - - - {estimatePrice.price} - 预估金额 - - orderDetail()}> - 去结算({estimatePrice.color_count}) - - - - - - - ) -} - diff --git a/src/components/shopCart/index.tsx b/src/components/shopCart/index.tsx index e58684f..a8b51fe 100644 --- a/src/components/shopCart/index.tsx +++ b/src/components/shopCart/index.tsx @@ -302,7 +302,7 @@ export default ({show = false, onClose}: param) => { {item.sale_mode_name} - {formatPirce(item.sale_price)}/{selectList[selectIndex].eunit} + {formatPirce(item.sale_price)}/{selectList[item.sale_mode].eunit} {/* ×{formatCount(item)}{selectList[selectIndex].unit} */} void, placeholder?: string, - defaultValue?: string + defaultValue?: string, + onlyRead?: false|true } -export default memo(({onChange, title = '', placeholder = '请输入', defaultValue}:Param) => { +export default memo(({onChange, title = '', placeholder = '请输入', defaultValue, onlyRead = false}:Param) => { const [descData, setDescData] = useState({ number: 0, value: '', @@ -37,7 +38,7 @@ export default memo(({onChange, title = '', placeholder = '请输入', defaultVa {title} - {descData.show&&|| + {(descData.show && !onlyRead)&&|| toggleShowRealTextarea(true)}>{descData.value||placeholder} } {descData.number +'/'+ descData.count} diff --git a/src/components/uploadImage/index.tsx b/src/components/uploadImage/index.tsx index 864d8ef..53502c7 100644 --- a/src/components/uploadImage/index.tsx +++ b/src/components/uploadImage/index.tsx @@ -9,9 +9,10 @@ import styles from './index.module.scss' //图片列表 type ImageParam = { onChange?:(val: string[]) => void, - defaultList?: string[] + defaultList?: string[], + onlyRead?: false|true } -const PictureItem:FC = memo(({onChange, defaultList}) => { +const PictureItem:FC = memo(({onChange, defaultList, onlyRead = false}) => { const {getWxPhoto} = useUploadCDNImg() const [imageList, setImageLise] = useState([]) @@ -54,12 +55,12 @@ const PictureItem:FC = memo(({onChange, defaultList}) => { {imageList.map((item, index) => - delImage(index)} className={classnames(styles.miconfont_close, 'iconfont icon-qingkong')}> + {!onlyRead && delImage(index)} className={classnames(styles.miconfont_close, 'iconfont icon-qingkong')}>} )} - + {!onlyRead && 上传照片 - + } ) }) diff --git a/src/pages/addressAdd/index.tsx b/src/pages/addressAdd/index.tsx index cf9ac26..a9a106a 100644 --- a/src/pages/addressAdd/index.tsx +++ b/src/pages/addressAdd/index.tsx @@ -7,8 +7,10 @@ import Taro, { setNavigationBarTitle, useRouter } from "@tarojs/taro" import { useEffect, useState } from "react" import "./index.scss" import {addressAddApi, addressDetailApi,addressEditApi} from "@/api/addressManager" +import useLogin from "@/use/useLogin" export default ()=>{ + useLogin() const [showSiteModal, setShowSiteModal] = useState(false); const {type,id} = useRouter().params; useEffect(()=>{ diff --git a/src/pages/addressManager/index.tsx b/src/pages/addressManager/index.tsx index 081d0bc..427553e 100644 --- a/src/pages/addressManager/index.tsx +++ b/src/pages/addressManager/index.tsx @@ -1,12 +1,13 @@ import AddressList from "@/components/AddressList" +import useLogin from "@/use/useLogin" import { Button, ScrollView, Text, View } from "@tarojs/components" import { stopPullDownRefresh, usePullDownRefresh } from "@tarojs/taro" import { useState } from "react" import "./index.scss" export default ()=>{ - + useLogin() return ( diff --git a/src/pages/applyAfterSales/index.tsx b/src/pages/applyAfterSales/index.tsx index 7d320eb..fd06f1d 100644 --- a/src/pages/applyAfterSales/index.tsx +++ b/src/pages/applyAfterSales/index.tsx @@ -11,6 +11,7 @@ import { ReturnApplyOrderApi, ReturnExplainApi, ReturnGoodsStatusApi, ReturnReas import { alert, goLink } from "@/common/common"; import UploadImage from "@/components/uploadImage" import TextareaEnhance from "@/components/textareaEnhance"; +import useLogin from "@/use/useLogin"; enum returnStatus { return_reason = 1, //原因 @@ -19,7 +20,7 @@ enum returnStatus { } export default () => { - + useLogin() useDidShow(() => { getSaleOrderPreView() }) diff --git a/src/pages/classList/index.tsx b/src/pages/classList/index.tsx index c2a46c9..6538ab8 100644 --- a/src/pages/classList/index.tsx +++ b/src/pages/classList/index.tsx @@ -12,8 +12,10 @@ import {GetProductListApi} from '@/api/material' import { useRouter } from "@tarojs/taro"; import { dataLoadingStatus, getFilterData } from "@/common/util"; import LoadingCard from "@/components/loadingCard"; +import useLogin from "@/use/useLogin"; export default () => { + useLogin() const [showPopup, setShowPopup] = useState(false) const router = useRouter() diff --git a/src/pages/collection/collectionClass/index.tsx b/src/pages/collection/collectionClass/index.tsx index c097b2f..16a0447 100644 --- a/src/pages/collection/collectionClass/index.tsx +++ b/src/pages/collection/collectionClass/index.tsx @@ -4,7 +4,7 @@ import { getFilterData } from "@/common/util"; import Product from "../components/product"; import Search from "@/components/search" import { Text, View } from "@tarojs/components" -import Taro from "@tarojs/taro"; +import Taro, { useRouter } from "@tarojs/taro"; import classnames from "classnames"; import { useCallback, useEffect, useRef, useState } from "react"; import CreatePopup from "../components/createPopup"; @@ -16,6 +16,8 @@ import AddCollection from "@/components/addCollection"; export default () => { + const router = useRouter() + //获取收藏夹面料 const [list, setList] = useState([]) const getFavoriteInfo = () => { @@ -43,24 +45,40 @@ export default () => { }, []) //全选反选 - const [selectStatus, setSelectStatus] = useState(false) + const [allSelectStatus, setAllSelectStatus] = useState(false) const selectCallBack = useCallback(() => { - setSelectStatus(() => true) + setAllSelectStatus(() => true) + setSelectStatus(1) }, []) const colseCallBack = useCallback(() => { - setSelectStatus(() => false) + setAllSelectStatus(() => false) + setSelectStatus(3) }, []) - // useEffect(() => { - // if(list.length) - // setSelectStatus(ids.length == list.length) - // }, [ids, list]) + + const [selectStatus, setSelectStatus] = useState<1|2|3>(3) + useEffect(() => { + if(list.length) { + if(ids.length == list.length) { + setSelectStatus(1) + setAllSelectStatus(true) + } else if ( 0 < ids.length && ids.length < list.length){ + setSelectStatus(2) + setAllSelectStatus(false) + } else { + setSelectStatus(3) + setAllSelectStatus(false) + } + } + }, [ids, list]) + + const [collectionShow, setCollectionShow] = useState(false) const closeCollection = useCallback(() => { setCollectionShow(false) }, []) const onAdd = () => { - + } return ( @@ -70,7 +88,7 @@ export default () => { - selectCallBack()} onClose={() => colseCallBack()}/> + selectCallBack()} onClose={() => colseCallBack()}/> 全选 @@ -79,7 +97,7 @@ export default () => { - + diff --git a/src/pages/collection/components/product/index.tsx b/src/pages/collection/components/product/index.tsx index cfab59b..1e48ba7 100644 --- a/src/pages/collection/components/product/index.tsx +++ b/src/pages/collection/components/product/index.tsx @@ -9,22 +9,24 @@ import { useCallback, useEffect, useRef, useState } from "react" type Params = { productList?: any[], - onSelectIds?: (val: number[]) => void - selectStatus?: false|true + onSelectIds?: (val: number[]) => void, + selectStatus?: 1|2|3, //1全选,2不做处理,3全清空 + openCheckBox?: true|false //是否开启选择 } -export default ({productList = [], onSelectIds, selectStatus = false}:Params) => { +export default ({productList = [], onSelectIds, selectStatus = 2, openCheckBox = false}:Params) => { const [list, setList] = useState([]) useEffect(() => { setList(() => [...productList]) },[productList]) useEffect(() => { - if(list.length) { + if(list.length && selectStatus != 2) { list.map(item => { - item.check = selectStatus + item.check = (selectStatus == 1) }) + setList(() => [...list]) } - setList(() => [...list]) + }, [selectStatus]) const onChangeSelect = (item) => { @@ -57,13 +59,13 @@ export default ({productList = [], onSelectIds, selectStatus = false}:Params) => return ( {list?.map(item => { - return onChangeSelect(item)}> - e.stopPropagation()}> + return openCheckBox?onChangeSelect(item):goLink(`/pages/details/index?id=${item.product_id}`)}> + {openCheckBox&& e.stopPropagation()}> onSelect(item)} onClose={() => onClose(item)}/> - + } - {item.product_color_count}色 + {item.enable_product_color_count}色 {formatHashTag(item.product_code, '')} {item.product_name} diff --git a/src/pages/collection/index.tsx b/src/pages/collection/index.tsx index 08e5e49..c78a1ac 100644 --- a/src/pages/collection/index.tsx +++ b/src/pages/collection/index.tsx @@ -1,5 +1,5 @@ import { CreateFavoriteApi, DelFavoriteApi, FavoriteListApi, UpdateFavoriteApi } from "@/api/favorite"; -import { alert } from "@/common/common"; +import { alert, goLink } from "@/common/common"; import { getFilterData } from "@/common/util"; import Product from "./components/product"; import Search from "@/components/search" @@ -10,8 +10,9 @@ import { useCallback, useEffect, useRef, useState } from "react"; import CreatePopup from "./components/createPopup"; import UpdatePopup from "./components/updatePopup"; import styles from './index.module.scss' +import useLogin from "@/use/useLogin"; export default () => { - + useLogin() const changeOpenCon = (item) => { item.openStatus = !item.openStatus setList((e) => [...e]) @@ -117,6 +118,10 @@ export default () => { } } + const onBatchManagement = useCallback(() => { + // goLink('pages/collection/collectionClass/index', {id: }) + }, []) + //操作文件夹 const onCreatSuccess = (submitData) => { if (!initData.id) { @@ -147,7 +152,7 @@ export default () => { )} - + ) diff --git a/src/pages/company/index.tsx b/src/pages/company/index.tsx index 0472783..e2b9845 100644 --- a/src/pages/company/index.tsx +++ b/src/pages/company/index.tsx @@ -7,8 +7,10 @@ import { useEffect, useState } from "react" import { alert, retrieval } from "@/common/common"; import { companyDetailApi, companyUpdateApi } from "@/api/company" import "./index.scss" +import useLogin from "@/use/useLogin" export default ()=>{ + useLogin() const [showSiteModal, setShowSiteModal] = useState(false); const handleSelectSite = ()=>{ setShowSiteModal(true); diff --git a/src/pages/creditLine/index.tsx b/src/pages/creditLine/index.tsx index 6a9d4e9..c56062e 100644 --- a/src/pages/creditLine/index.tsx +++ b/src/pages/creditLine/index.tsx @@ -8,9 +8,10 @@ import "./index.scss" import { useSelector } from "@/reducers/hooks"; import { formatDateTime, formatPriceDiv } from "@/common/fotmat" import Message from "@/components/Message" +import useLogin from "@/use/useLogin" export default ()=>{ - + useLogin() const userInfo = useSelector(state => state.userInfo); useEffect(()=>{ getData() diff --git a/src/pages/creditUsed/index.tsx b/src/pages/creditUsed/index.tsx index 11cdbd8..f2f5eed 100644 --- a/src/pages/creditUsed/index.tsx +++ b/src/pages/creditUsed/index.tsx @@ -6,8 +6,10 @@ import {creditListApi} from "@/api/creditLine" import "./index.scss" import { formatDateTime, formatPriceDiv, toDecimal2 } from "@/common/fotmat" import { dataLoadingStatus, getFilterData } from "@/common/util"; +import useLogin from "@/use/useLogin" export default ()=>{ + useLogin() const {fetchData, state} = creditListApi(); // 渲染(数据) const [data, setData] = useState({ diff --git a/src/pages/depositBeforehand/index.tsx b/src/pages/depositBeforehand/index.tsx index 9636d30..6232afc 100644 --- a/src/pages/depositBeforehand/index.tsx +++ b/src/pages/depositBeforehand/index.tsx @@ -7,8 +7,10 @@ import { useEffect } from "react"; import { formatPriceDiv, toDecimal2 } from "@/common/fotmat"; import { setClipboardData } from "@tarojs/taro"; import Message from "@/components/Message"; +import useLogin from "@/use/useLogin"; export default ()=>{ + useLogin() const {fetchData, state} = depositInfoApi(); const getData = async ()=>{ fetchData(); diff --git a/src/pages/depositBeforehandDetail/index.tsx b/src/pages/depositBeforehandDetail/index.tsx index 7d5f73e..11abfb0 100644 --- a/src/pages/depositBeforehandDetail/index.tsx +++ b/src/pages/depositBeforehandDetail/index.tsx @@ -6,9 +6,10 @@ import Taro, { useReady } from "@tarojs/taro" import { useEffect, useState } from "react" import {creditListApi} from "@/api/creditLine" import "./index.scss" +import useLogin from "@/use/useLogin" export default ()=>{ - + useLogin() return ( diff --git a/src/pages/depositList/index.tsx b/src/pages/depositList/index.tsx index eb9077c..3ef5918 100644 --- a/src/pages/depositList/index.tsx +++ b/src/pages/depositList/index.tsx @@ -7,8 +7,10 @@ import { useCallback, useEffect, useState } from "react" import { depositListApi } from "@/api/deposit" import "./index.scss" import { formatDateTime, formatPriceDiv } from "@/common/fotmat" +import useLogin from "@/use/useLogin" export default ()=>{ + useLogin() const {fetchData, state} = depositListApi(); // 渲染(数据) const [data, setData] = useState({ diff --git a/src/pages/details/components/preview/index.module.scss b/src/pages/details/components/preview/index.module.scss index cab4ce5..9db49ae 100644 --- a/src/pages/details/components/preview/index.module.scss +++ b/src/pages/details/components/preview/index.module.scss @@ -14,7 +14,10 @@ align-items: center; flex-direction: column; width: 100%; - margin-top: 200px; + height: 60vh; + margin-top: 100px; + padding: 20px; + box-sizing: border-box; image{ width:100%; border-radius: 10px; diff --git a/src/pages/details/components/preview/index.tsx b/src/pages/details/components/preview/index.tsx index 8b3488a..ff86ecf 100644 --- a/src/pages/details/components/preview/index.tsx +++ b/src/pages/details/components/preview/index.tsx @@ -1,9 +1,12 @@ +import LabAndImg from "@/components/LabAndImg" import { Image, View } from "@tarojs/components" import styles from './index.module.scss' export type colorItem = { title: string, - img: string + lab: {l:number, a:number, b:number}, + rgb: {r:number, g:number, b:number}, + texture_url: string } export type colorParams = { value?: colorItem, @@ -15,7 +18,7 @@ export default ({value, show = false, onClose}: colorParams) => { <> {show&& onClose?.()}> - + {value?.title} } diff --git a/src/pages/details/index.module.scss b/src/pages/details/index.module.scss index ed14ea5..ec682c6 100644 --- a/src/pages/details/index.module.scss +++ b/src/pages/details/index.module.scss @@ -125,16 +125,33 @@ background-color: #fff; padding-bottom: constant(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom); + + .buy_cart{ width: 150px; color: $color_font_three; text-align: center; + position: relative; .text{ font-size: $font_size_min; } .miconfont{ font-size: 36px; } + .product_num{ + position: absolute; + font-size: 23px; + background-color: red; + color: #fff; + height: 36px; + line-height: 36px; + padding: 0 6px; + border-radius: 72px; + min-width: 25px; + text-align: center; + top: 0; + right: 20px; + } } .buy_btn{ display: flex; diff --git a/src/pages/details/index.tsx b/src/pages/details/index.tsx index 00c1c17..5e20e56 100644 --- a/src/pages/details/index.tsx +++ b/src/pages/details/index.tsx @@ -18,6 +18,7 @@ import LabAndImg from '@/components/LabAndImg'; import { alert } from '@/common/common'; import AddCollection from '@/components/addCollection'; import { AddFavoriteApi } from '@/api/favorite'; +import { GetShoppingCartApi } from '@/api/shopCart'; type item = {title:string, img:string, url:string, id:number} @@ -27,7 +28,7 @@ type Params = { style?: Object } export default (props:Params) => { - const {checkLogin, getPhoneNumber, userInfo} = useLogin() + const {getPhoneNumber, userInfo} = useLogin() //获取参数(有两种参数:1.商品id, 2.页面分享) const router = useRouter() @@ -50,9 +51,9 @@ export default (props:Params) => { } useDidShow(() => { - checkLogin() judgeParam() setShowCart(false) + getShoppingCart() }) useEffect(() => { @@ -96,7 +97,9 @@ export default (props:Params) => { const getColorItem = (item) => { setColorInfo({ title: item.code, - img: item.texture_url, + texture_url: item.texture_url, + lab: item.lab, + rgb: item.rgb }) setShowPreview(true) } @@ -149,7 +152,14 @@ export default (props:Params) => { setCollectionShow(false) }, []) - + //获取购物车数据数量 + const [shopCount, setShopCount] = useState(0) + const {fetchData: fetchDataShopCount} = GetShoppingCartApi() + const getShoppingCart = async () => { + const {data} = await fetchDataShopCount() + let color_list = data.color_list||[] + setShopCount(color_list.length) + } //页面下拉刷新 @@ -163,7 +173,7 @@ export default (props:Params) => { - {productName} + {productInfo.code&&{productName}} {productInfo.describe} @@ -205,6 +215,7 @@ export default (props:Params) => { setShowCart(true)}> 购物车 + {(shopCount > 0)&&{shopCount > 99?'99+':shopCount}} { (!userInfo.adminUserInfo?.is_authorize_phone)&& diff --git a/src/pages/editOrder/index.tsx b/src/pages/editOrder/index.tsx index 627165c..1ce0acf 100644 --- a/src/pages/editOrder/index.tsx +++ b/src/pages/editOrder/index.tsx @@ -8,9 +8,10 @@ import { alert, goLink } from "@/common/common"; import { getParam } from "@/common/system"; import {EditSaleOrderAddressApi, EditSaleOrderShipmentModeApi} from "@/api/order"; import Taro from "@tarojs/taro"; +import useLogin from "@/use/useLogin"; export default () => { - + useLogin() //获取临时传递的数据 const params = getParam() const [paramsData, setParamsData] = useState(params) diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index eafe883..9aea20a 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -15,11 +15,7 @@ import { dataLoadingStatus } from '@/common/util' export default () => { - const { checkLogin } = useLogin() - useDidShow(async () => { - await checkLogin() - }) - + useLogin() useEffect(() => { categoryList() }, []) @@ -87,21 +83,12 @@ export default () => { setRefresherTriggeredStatus(true) } - - //页面下拉刷新 - // const res = useManualPullDownRefresh() - // usePullDownRefresh(() => { - // console.log('123') - // }) - //数据加载状态 const statusMore = useMemo(() => { return dataLoadingStatus({ list: productData.list, total: productData.total, status: productState.loading }) }, [productData, productState.loading]) - - return ( setShowShopCart(!showShopCart)}> diff --git a/src/pages/order/components/addressInfoDetail/index.tsx b/src/pages/order/components/addressInfoDetail/index.tsx index 89b8216..8ec72ac 100644 --- a/src/pages/order/components/addressInfoDetail/index.tsx +++ b/src/pages/order/components/addressInfoDetail/index.tsx @@ -37,6 +37,20 @@ type Param = { } } +//订单状态 +const { + SaleorderstatusWaitingPrePayment, + SaleOrderStatusBooking, + SaleOrderStatusArranging, + SaleOrderStatusArranged, + SaleOrderStatusWaitingPayment, + SaleOrderStatusWaitingReceipt, + SaleOrderStatusAlreadyReceipt, + SaleOrderStatusComplete, + SaleOrderStatusRefund, + SaleOrderStatusCancel, +} = ORDER_STATUS + export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, status = 2, disabled = false, onLogistics}: Param, ref) => { const [addressInfo, setAddressInfo] = useState() @@ -53,7 +67,7 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat //打开地址列表 const [showAddressList, setShowAddressList] = useState(false) const changeShow = () => { - if(receivingStatus == 2 && !logisticsShow) + if(receivingStatus == 2 && !logisticsShow && limitEdit()) setShowAddressList(() => true) } @@ -67,7 +81,8 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat const {fetchData: shipmentModeFetchData} = EditSaleOrderShipmentModeApi() const onReceivingStatus = (value, e) => { e.stopPropagation() - changeReceivingStatus(value) + if(limitEdit()) changeReceivingStatus(value) + } const changeReceivingStatus = debounce(async (value) => { if(!orderInfo) return false @@ -112,14 +127,18 @@ export default memo(forwardRef(({onSelect, onChangeShipmentMode, orderInfo, stat } } - //订单状态 - const { - SaleOrderStatusWaitingReceipt, - SaleOrderStatusAlreadyReceipt, - SaleOrderStatusComplete, - SaleOrderStatusRefund, - SaleOrderStatusCancel, - } = ORDER_STATUS + //根据订单状态判断是否可用修改 + const limitEdit = () => { + 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 + } //根据订单状态判断是否显示物流 diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index c75665b..1af69a7 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -13,6 +13,7 @@ import OrderBtns from "@/components/orderBtns"; import Popup from "@/components/popup"; import SearchInput from "@/components/searchInput"; import ShopCart from "@/components/shopCart"; +import useLogin from "@/use/useLogin"; import { Text, Textarea, View } from "@tarojs/components" import Taro, { useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro"; import classnames from "classnames"; @@ -28,6 +29,7 @@ import Remark from "./components/remark"; import styles from './index.module.scss' export default () => { + useLogin() const [showDesc, setShowDesc] = useState(false) const router = useRouter() const orderId = useRef(Number(router.params.id)) @@ -37,6 +39,8 @@ import styles from './index.module.scss' //订单状态枚举 const { + SaleOrderStatusTaking, + SaleOrderStatusWaitingDelivery, SaleOrderStatusWaitingReceipt, // 待收货 SaleOrderStatusAlreadyReceipt, // 已收货 SaleOrderStatusComplete, // 已完成 @@ -46,6 +50,7 @@ import styles from './index.module.scss' } = ORDER_STATUS //获取订单详情 + const firstOpen = useRef(true) const [orderDetail, setOrderDetail] = useState() //获取到的原始数据 const {fetchData: getOrderFetchData} = GetSaleOrderDetailApi() const getSaleOrderPreView = async () => { @@ -53,7 +58,10 @@ import styles from './index.module.scss' let res = await getOrderFetchData({id: orderId.current}) setOrderDetail(res.data) setOrderRemark(res.data.remark) - if(res.data.status == SaleorderstatusWaitingPrePayment.value) toPay() + if(firstOpen.current) { + firstOpen.current = false + toPay() + } } Taro.stopPullDownRefresh() Taro.hideToast() @@ -115,7 +123,9 @@ import styles from './index.module.scss' shipment_mode: orderDetail?.shipment_mode, id: orderDetail?.id, sale_mode: orderDetail?.sale_mode, - status: orderDetail?.status + status: orderDetail?.status, + take_goods_address: orderDetail?.take_goods_address, + take_goods_phone: orderDetail?.take_goods_phone } }, [orderDetail]) @@ -135,6 +145,8 @@ import styles from './index.module.scss' setShowDesc(() => false) }, []) const noCanOpenDescList = useRef([ + SaleOrderStatusTaking.value, //提货中 + SaleOrderStatusWaitingDelivery.value, //待发货 SaleOrderStatusWaitingReceipt.value, // 待收货 SaleOrderStatusAlreadyReceipt.value, // 已收货 SaleOrderStatusComplete.value, // 已完成 @@ -142,7 +154,7 @@ import styles from './index.module.scss' SaleOrderStatusCancel.value, // 已取消 ]) const descOpen = () => { - if(noCanOpenDescList.current.includes(orderDetail?.status)) return false + if(noCanOpenDescList.current.includes(orderDetail?.status)) return alert.none('该订单状态不能修改备注') setShowDesc(() => true) } @@ -167,7 +179,6 @@ import styles from './index.module.scss' //获取底部按钮点击, 获取按钮状态 const orderStateClick = useCallback((val) => { - console.log('123456789',val) if(val == 1 || val == 6) { //取消订单 getSaleOrderPreView() diff --git a/src/pages/salesAfter/components/addressInfoDetail/index.tsx b/src/pages/salesAfter/components/addressInfoDetail/index.tsx index ef9438c..d219d4d 100644 --- a/src/pages/salesAfter/components/addressInfoDetail/index.tsx +++ b/src/pages/salesAfter/components/addressInfoDetail/index.tsx @@ -7,7 +7,7 @@ import styles from './index.module.scss' type Param = { return_address?:string, return_phone?: string, - onLogistics?: (val: number) => void, + onLogistics?: (val: 1|2) => void, //1 上传物流 2 查看物流 stage?: number, } export default memo(({return_address = '', return_phone = '', onLogistics, stage}:Param) => { diff --git a/src/pages/salesAfter/components/kindList/index.tsx b/src/pages/salesAfter/components/kindList/index.tsx index 7a2dd69..9e9ee6f 100644 --- a/src/pages/salesAfter/components/kindList/index.tsx +++ b/src/pages/salesAfter/components/kindList/index.tsx @@ -118,7 +118,7 @@ export default memo(({order, comfirm = false}:Param) => { cut_value: [ReturnStageReturned.value], model_value: [ReturnStageReturned.value], label:'退款去向', - field: 'actual_amount' + field: 'refund_flow_name' }, ] diff --git a/src/pages/salesAfter/components/returnLogistics/index.tsx b/src/pages/salesAfter/components/returnLogistics/index.tsx index e49f04c..61b034b 100644 --- a/src/pages/salesAfter/components/returnLogistics/index.tsx +++ b/src/pages/salesAfter/components/returnLogistics/index.tsx @@ -14,8 +14,9 @@ type Param = { id?: number, //订单id images: string[], //图片列表 descValue?: string, //描述 + onlyRead?: false|true //true 只读 } -export default memo(({show = false, onClose, onSubmit, id = 0, images = [], descValue = ''}: Param) => { +export default memo(({show = false, onClose, onSubmit, id = 0, images = [], descValue = '', onlyRead = false}: Param) => { //需要提交的数据 const submitData = useRef({ accessory_url: [], @@ -52,20 +53,20 @@ export default memo(({show = false, onClose, onSubmit, id = 0, images = [], desc return ( <> - + 上传附件: - + - + - + {!onlyRead&& onSubmitEven()}>保存 - + } diff --git a/src/pages/salesAfter/index.tsx b/src/pages/salesAfter/index.tsx index 90cb0e7..0122f35 100644 --- a/src/pages/salesAfter/index.tsx +++ b/src/pages/salesAfter/index.tsx @@ -4,6 +4,7 @@ import { AFTER_ORDER_STATUS, ORDER_STATUS } from "@/common/enum"; import { formatDateTime, formatImgUrl, formatPriceDiv } from "@/common/fotmat"; import AfterOrderBtns from "@/components/afterOrderBtns"; import SearchInput from "@/components/searchInput"; +import useLogin from "@/use/useLogin"; import { Image, Text, Textarea, View } from "@tarojs/components" import Taro, {useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro"; import classnames from "classnames"; @@ -17,7 +18,7 @@ import ReturnLogistics from "./components/returnLogistics"; import styles from './index.module.scss' export default () => { - + useLogin() const router = useRouter() const orderId = useRef(Number(router.params.id)) useDidShow(() => { @@ -63,7 +64,8 @@ import styles from './index.module.scss' other_deduction_amount: orderDetail.other_deduction_amount, //其他扣除金额 total_refund_amount: orderDetail.total_refund_amount, //合计金额 refund_amount: orderDetail.refund_amount, //退款金额 - refund_type: orderDetail.refund_type //退款状态 + refund_type: orderDetail.refund_type, //退款状态 + refund_flow_name: orderDetail.refund_flow_name //退款去向 }) } @@ -74,7 +76,9 @@ import styles from './index.module.scss' //获取底部按钮点击, 获取按钮状态 const orderStateClick = useCallback((val) => { - if(val == 8) { + if(val == 1 || val == 6) { + getSaleOrderPreView() + } else if(val == 8) { //申请记录 setApplyRecord(true) } @@ -105,19 +109,22 @@ import styles from './index.module.scss' //物流显示 const [logisticsShow, setLogisticsShow] = useState(false) + const [logistics, setLogistics] = useState(false) const onShowLogistics = useCallback((val) => { - if(val == 1) { - setLogisticsShow(true) - } else { - const list = orderDetail?.accessory_url.map(item => { - return formatImgUrl(item) - }) - Taro.previewImage({ - current: list[0], // 当前显示 - urls: list // 需要预览的图片http链接列表 - }) - } - }, [orderDetail]) + setLogisticsShow(true) + if(val != 1) setLogistics(true) + // if(val == 1) { + // setLogisticsShow(true) + // } else { + // const list = orderDetail?.accessory_url.map(item => { + // return formatImgUrl(item) + // }) + // Taro.previewImage({ + // current: list[0], // 当前显示 + // urls: list // 需要预览的图片http链接列表 + // }) + // } + }, []) const onCloseLogistics = useCallback(() => { setLogisticsShow(false) }, []) @@ -139,7 +146,7 @@ import styles from './index.module.scss' - + setApplyRecord(false)}/> diff --git a/src/pages/salesAfterList/components/order/index.tsx b/src/pages/salesAfterList/components/order/index.tsx index 9be4b5d..29b88e1 100644 --- a/src/pages/salesAfterList/components/order/index.tsx +++ b/src/pages/salesAfterList/components/order/index.tsx @@ -1,4 +1,5 @@ import { goLink } from "@/common/common"; +import { REFUND_STATUS_ORDER } from "@/common/enum"; import { formatHashTag, formatImgUrl, formatPriceDiv } from "@/common/fotmat"; import AfterOrderBtns from "@/components/afterOrderBtns"; import LabAndImg from "@/components/LabAndImg"; @@ -26,7 +27,7 @@ type Param = { lab: {l:number, a:number, b:number}, rgb: {r:number, g:number, b:number}, texturl_url: string, - type: number //1 退货 2退款 + type: number //2 退货 1 预收退款 3 销售 return_apply_order_id: number //退款申请单 }, onClickBtn?: (val:{status:number, orderInfo:Param['value']}) => void @@ -63,6 +64,10 @@ export default memo(({value, onClickBtn}: Param) => { return {lab:{...value?.lab}, rgb:{...value?.rgb}, texturl_url: value?.texturl_url} }, [value]) + const { + ReturnApplyOrderTypeReturnForRefund, // 退货退款 + } = REFUND_STATUS_ORDER + return ( goLink('/pages/salesAfter/index', {id: value?.id})}> @@ -71,8 +76,8 @@ export default memo(({value, onClickBtn}: Param) => { {userInfo?.adminUserInfo?.user_name} - 售后单号:{value?.return_order_no} - + 售后单号:{value?.return_order_no} + @@ -107,7 +112,7 @@ export default memo(({value, onClickBtn}: Param) => { {`${value?.total_fabrics}种面料,${value?.total_colors}种颜色,共${value?.total_number}条`} - {value?.type == 1?'已申请退货':'已申请退款'} + {value?.type == ReturnApplyOrderTypeReturnForRefund.value?'已申请退货':'已申请退款'} 订单号:{value?.order_no} diff --git a/src/pages/salesAfterList/components/orderStatusTag/index.tsx b/src/pages/salesAfterList/components/orderStatusTag/index.tsx index c72373e..968fe99 100644 --- a/src/pages/salesAfterList/components/orderStatusTag/index.tsx +++ b/src/pages/salesAfterList/components/orderStatusTag/index.tsx @@ -2,17 +2,23 @@ import { Text, View } from "@tarojs/components" import { memo } from "react" import classnames from "classnames"; import styles from './index.module.scss' +import { REFUND_STATUS_ORDER } from "@/common/enum"; type Param = { - status?: number //0默认不处理, 1退货,2退款 + status?: number } export default memo(({status = 0}:Param) => { + const { + ReturnApplyOrderTypeAdvanceReceiptRefund, // 预收退款 + ReturnApplyOrderTypeReturnForRefund, // 退货退款 + ReturnApplyOrderTypeSalesRefund // 销售退款 + } = REFUND_STATUS_ORDER return ( <> - {(status !== 0)&& + {(status !== 0)&& - { status == 1?'退货':'退款'} + { status == ReturnApplyOrderTypeReturnForRefund.value?'退货':'退款'} } ) diff --git a/src/pages/salesAfterList/index.tsx b/src/pages/salesAfterList/index.tsx index 2d64951..8256d9e 100644 --- a/src/pages/salesAfterList/index.tsx +++ b/src/pages/salesAfterList/index.tsx @@ -14,9 +14,9 @@ import { GetSaleOrderListApi, RefundOrderSatausApi } from "@/api/salesAfterOrder import ReturnLogistics from "./components/returnLogistics" export default () => { - const {checkLogin} = useLogin() - useDidShow(async () => { - await checkLogin() + useLogin() + useDidShow(() => { + getOrderList() }) //搜索参数 @@ -94,9 +94,8 @@ export default () => { //监听点击的按钮 const clickOrderBtn = useCallback(({status, orderInfo}) => { - if(status == 2) { - //退货物流 - + if(status == 1 || status == 6) { + getOrderList() } }, [orderData]) diff --git a/src/pages/search/index.tsx b/src/pages/search/index.tsx index d342443..dbdc018 100644 --- a/src/pages/search/index.tsx +++ b/src/pages/search/index.tsx @@ -5,8 +5,10 @@ import { goLink } from '@/common/common'; import classnames from "classnames"; import styles from './index.module.scss' import { useEffect } from 'react'; +import useLogin from '@/use/useLogin'; export default () => { + useLogin() return ( diff --git a/src/pages/searchList/hightSearchList.tsx b/src/pages/searchList/hightSearchList.tsx index 9496028..7a696e0 100644 --- a/src/pages/searchList/hightSearchList.tsx +++ b/src/pages/searchList/hightSearchList.tsx @@ -20,10 +20,7 @@ import SelectData, {ListProps} from "./components/selectData"; import LabAndImg from "@/components/LabAndImg"; export default () => { - const {checkLogin} = useLogin() - useDidShow(async () => { - await checkLogin() - }) + useLogin() const [showFilter, setShowFilter] = useState(false) diff --git a/src/pages/searchList/search.tsx b/src/pages/searchList/search.tsx index dd80f20..46616cf 100644 --- a/src/pages/searchList/search.tsx +++ b/src/pages/searchList/search.tsx @@ -12,10 +12,7 @@ import Taro, { useDidShow, useShareAppMessage } from '@tarojs/taro'; type searchDataParam = {'search_key':''} export default () => { - const {checkLogin} = useLogin() - useDidShow(async () => { - await checkLogin() - }) + useLogin() const [searchData, setSearchData] = useState<{hotField: searchDataParam[], historyField: searchDataParam[]}>({ hotField: [], diff --git a/src/pages/searchList/searchList.tsx b/src/pages/searchList/searchList.tsx index 53e50f4..13b5309 100644 --- a/src/pages/searchList/searchList.tsx +++ b/src/pages/searchList/searchList.tsx @@ -16,10 +16,7 @@ import useLogin from "@/use/useLogin"; import LabAndImg from "@/components/LabAndImg"; export default () => { - const {checkLogin} = useLogin() - useDidShow(async () => { - await checkLogin() - }) + useLogin() const [showFilter, setShowFilter] = useState(false) const router = useRouter() diff --git a/src/pages/user/index.tsx b/src/pages/user/index.tsx index f578118..b41bdc9 100644 --- a/src/pages/user/index.tsx +++ b/src/pages/user/index.tsx @@ -10,7 +10,17 @@ import Taro from "@tarojs/taro"; import { userassets, userorderStatistics } from "@/api/mine" import { formatPriceDiv } from "@/common/fotmat" import { useDidShow, } from '@tarojs/taro' +import { GetAdminUserInfoApi } from "@/api/user"; export default () => { + //重新获取用户信息 + const {fetchData: useFetchData} = GetAdminUserInfoApi() + const [userDataAgain, setUserDataAgain] = useState({}) + const getUserData = async () => { + let res = await useFetchData() + setUserDataAgain(res.data) + } + + // 用户信息 const { getSelfUserInfo } = useLogin(); const { adminUserInfo } = useSelector(state => state.userInfo); @@ -31,6 +41,7 @@ export default () => { }, []) useDidShow(() => { ApigetTotal() + getUserData() }) const checkGo = () => { if (adminUserInfo?.authentication_status === 0 || adminUserInfo?.authentication_status === 1 || adminUserInfo?.authentication_status === 2 || adminUserInfo?.authentication_status === 3) { @@ -55,13 +66,13 @@ export default () => { } return ( -
- checkGo()} /> +
+ checkGo()} userInfo={userDataAgain}/>
{/* {(adminUserInfo as any)?.authentication_status==1&&} */} {/* 测试暂时添加 */} {BASE_URL} - {!adminUserInfo.is_authorize_name && } + {!userDataAgain?.is_authorize_name && } ) } @@ -143,7 +154,7 @@ const Header = memo((props: any) => { - {(data?.authentication_status == 0 || data?.authentication_status == 1) && + {((data?.authentication_status == 0 || data?.authentication_status == 1) && data?.order_access_status == 3) && navTo()}> @@ -156,7 +167,7 @@ const Header = memo((props: any) => { } - {(data?.authentication_status == 3) && + {(data?.authentication_status == 3 && data?.order_access_status == 3) && navTo()}> @@ -169,7 +180,7 @@ const Header = memo((props: any) => { } - {data?.authentication_status == 2 && + {(data?.authentication_status == 2 && data?.order_access_status == 3) && navTo()}> @@ -182,7 +193,7 @@ const Header = memo((props: any) => { } - {data?.authentication_status == 4 && + {(data?.authentication_status == 4 && data?.order_access_status == 3) && navTo()}> @@ -274,34 +285,36 @@ const Header = memo((props: any) => { // 我的资产 const Assets = (props: any) => { return ( - - 我的资产 - - - - ¥ - {formatPriceDiv(props.data.data.wallet_money || 0)} - {/* {props.wallet_money || 0} */} - - 预存款 - - {/* - - {props.data.data.coupon_count || 0} - - - 优惠券 - */} - props.checkShow()}> - - ¥ - {formatPriceDiv(props.data.data.credit_line || 0)} - {/* .-00 */} - - 授信额度 - - - + <> + {(props.userInfo.order_access_status == 3) && + 我的资产 + + + + ¥ + {formatPriceDiv(props.data.data.wallet_money || 0)} + {/* {props.wallet_money || 0} */} + + 预存款 + + {/* + + {props.data.data.coupon_count || 0} + + + 优惠券 + */} + props.checkShow()}> + + ¥ + {formatPriceDiv(props.data.data.credit_line || 0)} + {/* .-00 */} + + 授信额度 + + + ||} + ) }; diff --git a/src/pages/weightList/index.tsx b/src/pages/weightList/index.tsx index 9c67547..00a8a69 100644 --- a/src/pages/weightList/index.tsx +++ b/src/pages/weightList/index.tsx @@ -5,7 +5,9 @@ import {weightListApi,weightDeleteApi} from "@/api/weightList" import "./index.scss" import Taro, { showModal } from "@tarojs/taro" import { alert } from "@/common/common" +import useLogin from "@/use/useLogin" const weightListManager = ()=>{ + useLogin() return( diff --git a/src/pages/weightListAdd/index.tsx b/src/pages/weightListAdd/index.tsx index 19241c7..ecd060e 100644 --- a/src/pages/weightListAdd/index.tsx +++ b/src/pages/weightListAdd/index.tsx @@ -6,8 +6,10 @@ import {weightAddApi, weightDetailApi,weightEditApi} from "@/api/weightList" import { useEffect, useState } from "react" import { alert, retrieval } from "@/common/common" import "./index.scss" +import useLogin from "@/use/useLogin" export default ()=>{ + useLogin() const {type,id} = useRouter().params; useEffect(()=>{ if(type=="add"){ diff --git a/src/use/useHttp.ts b/src/use/useHttp.ts index 3930f57..0403c1b 100644 --- a/src/use/useHttp.ts +++ b/src/use/useHttp.ts @@ -122,14 +122,12 @@ export const useRequest = (options:option = { const stateRef = useRef({...params}) const [state, setState] = useState({...stateRef.current}) - const {removeToken, removeSessionKey} = useUserInfo() + const {removeToken, removeSessionKey, removeUserInfo} = useUserInfo() const {login} = useLoginRequest() - useEffect(() => { - console.log('变化1::', state.loading) - }, [state.loading]) // 请求函数 const fetchData = async (sub_options?:any) => { + stateRef.current.loading = true setState((e) => ({...e, loading:true})) stateRef.current.query = { @@ -179,9 +177,11 @@ export const useRequest = (options:option = { console.log('错误::',msg) } }else{ + if (statusCode === 401) { removeToken() removeSessionKey() + removeUserInfo() login() //todo 登录数据刷新次数问题 } else { diff --git a/src/use/useLogin.ts b/src/use/useLogin.ts index 7435b02..698aed8 100644 --- a/src/use/useLogin.ts +++ b/src/use/useLogin.ts @@ -1,19 +1,22 @@ import useUserInfo from "./useUserInfo" -import Taro, { useRouter } from "@tarojs/taro" +import Taro, { useDidShow, useRouter } from "@tarojs/taro" import { GetWxUserInfoApi, GetAdminUserInfoApi, GetPhoneNumberApi, BindingCompanyApi } from "@/api/user" import useLoginRequest from "./useLoginRequest" import { SHARE_SCENE } from "@/common/enum" import { GetShortCodeApi } from "@/api/share" import { alert } from "@/common/common" +import { LoginApi } from "@/api/login" export default () => { const {setUserInfo, setAdminUserInfo, setSortCode, userInfo} = useUserInfo() - //登录请求 (调用这个就不能再useHttp中使用,当前这个hook, 否则会死循环内存溢出) - // const {fetchData} = LoginApi() + useDidShow(() => { + checkLogin() + }) //登录请求 const {login} = useLoginRequest() + // const {fetchData:login} = LoginApi() const wxLogin = async () => { try { await login() diff --git a/src/use/useLoginRequest.ts b/src/use/useLoginRequest.ts index dc7d55e..d4db5de 100644 --- a/src/use/useLoginRequest.ts +++ b/src/use/useLoginRequest.ts @@ -3,11 +3,15 @@ import Taro, { useRouter } from "@tarojs/taro" import { useRef, useState } from "react" import qs from 'qs' import useUserInfo from "./useUserInfo" +import useLogin from "./useLogin" //开这个hook 主要是为了让useHttp 能够调用 type Param = {success: true|false, data: any, msg: string, code: null|number, loading: false|true} +let loginStatus = false //登录状态,true登录中 +console.log('你不要过来啊') export default () => { + let initData = { success: false, data: null, @@ -19,7 +23,7 @@ export default () => { const {setToken, setSessionKey} = useUserInfo() const router = useRouter() //微信登录请求v2 - const fetchData = async (login_code) => { + const fetchDataLogin = async (login_code) => { const q = { url: BASE_URL + '/v1/mall/login', header: { @@ -57,11 +61,13 @@ export default () => { //微信登录 const login = () => { + if(loginStatus) return false + loginStatus = true return new Promise((reslove, reject) => { Taro.login({ success: async (res) => { if (res.code) { - const {data, success, msg} = await fetchData(res.code) + const {data, success, msg} = await fetchDataLogin(res.code) if(success) { setToken(data.token) setSessionKey(data.session_key) @@ -88,10 +94,12 @@ export default () => { console.log('登录失败!' + res.errMsg) reject(res.errMsg) } + loginStatus = false }, fail: function(e) { console.log('登录失败!::',e) reject(e) + loginStatus = false } }) }) From 5dffe5ca13c88c35f5532843a8a1c0b1c6a08a48 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Thu, 7 Jul 2022 10:27:57 +0800 Subject: [PATCH 12/12] =?UTF-8?q?=E7=94=B5=E5=AD=90=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=89=88v4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/constant.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/constant.js b/src/common/constant.js index 7ac4281..6d6ce4d 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -4,14 +4,14 @@ // export const BASE_URL = `http://10.0.0.5:50001/lymarket` // export const BASE_URL = `http://192.168.0.89:40001/lymarket` // export const BASE_URL = `http://192.168.1.165:40001/lymarket` // 王霞 -// export const BASE_URL = `https://test.zzfzyc.com/lymarket` // 测试环境 +export const BASE_URL = `https://test.zzfzyc.com/lymarket` // 测试环境 // export const BASE_URL = `http://192.168.1.9:40001/lymarket` // 发 // export const BASE_URL = `http://192.168.1.9:50005/lymarket` // 发 // export const BASE_URL = `http://192.168.1.30:50001/lymarket` // 发 // export const BASE_URL = `https://dev.zzfzyc.com/lymarket` // 开发环境 // export const BASE_URL = `https://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:50002/lymarket` // 添 // export const BASE_URL = `http://192.168.1.42:50001/lymarket` // 杰 // CDN