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] =?UTF-8?q?=E7=94=B5=E5=AD=90=E5=95=86=E5=9F=8E=E6=B5=8B?=
=?UTF-8?q?=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