diff --git a/src/components/search/index.tsx b/src/components/search/index.tsx index 294aec5..b50c929 100644 --- a/src/components/search/index.tsx +++ b/src/components/search/index.tsx @@ -28,7 +28,7 @@ export default memo(forwardRef(({ showIcon = true, //是否显示关闭图标 showBtn = false, //是否显示搜索按钮 btnStyle = {}, - placeIcon = 'inner', + placeIcon = 'inner', //搜索图标位置:inner在里面,out在外面 btnTitle = '搜索', //搜索文字 debounceTime = 0, //防抖时间,不设默认为零 defaultValue = '' //默认值 diff --git a/src/pages/collection/components/createPopup/index.module.scss b/src/pages/collection/components/createPopup/index.module.scss index 82a58c3..e69c52d 100644 --- a/src/pages/collection/components/createPopup/index.module.scss +++ b/src/pages/collection/components/createPopup/index.module.scss @@ -22,7 +22,7 @@ justify-content: space-between; padding: 0 20px; font-size: 26px; - color: $color_font_two; + color: #000; .input{ width: 100%; height: 100%; diff --git a/src/pages/collection/components/createPopup/index.tsx b/src/pages/collection/components/createPopup/index.tsx index 340df98..e4308be 100644 --- a/src/pages/collection/components/createPopup/index.tsx +++ b/src/pages/collection/components/createPopup/index.tsx @@ -11,10 +11,10 @@ import { alert } from "@/common/common"; type ReasonInfoParam = { show?: boolean, //显示 onClose?: () => void, //关闭 + onSuccess?: () => void, //成功 } -export default memo(({show = false, onClose}: ReasonInfoParam) => { +export default memo(({show = false, onClose, onSuccess}: ReasonInfoParam) => { - const submitData = useRef({ "name": '', "remark": '' @@ -25,14 +25,21 @@ export default memo(({show = false, onClose}: ReasonInfoParam) => { }, []) const changeInput = useCallback((val) => { - submitData.current.remark = val.detail.value + submitData.current.name = val.detail.value }, []) //创建 const {fetchData} = CreateFavoriteApi() const onSubmit = async () => { - if(submitData.current.name) return alert.error('请输入收藏夹名称') + if(!submitData.current.name) return alert.none('请输入收藏夹名称!') let res = await fetchData(submitData.current) + if(res.success) { + alert.success('创建成功') + onSuccess?.() + } else { + alert.error('创建失败') + } + onClose?.() } return ( diff --git a/src/pages/collection/components/updatePopup/index.module.scss b/src/pages/collection/components/updatePopup/index.module.scss new file mode 100644 index 0000000..332ce28 --- /dev/null +++ b/src/pages/collection/components/updatePopup/index.module.scss @@ -0,0 +1,7 @@ + +.collection_con{ + padding: 20px; + .collection_item{ + + } +} \ No newline at end of file diff --git a/src/pages/collection/components/updatePopup/index.tsx b/src/pages/collection/components/updatePopup/index.tsx new file mode 100644 index 0000000..33a9136 --- /dev/null +++ b/src/pages/collection/components/updatePopup/index.tsx @@ -0,0 +1,62 @@ +import Popup from "@/components/popup"; +import { Input, ScrollView, Text, View } from "@tarojs/components"; +import { memo, useCallback, useMemo, useRef } from "react"; +import classnames from "classnames"; +import styles from './index.module.scss' +import TextareaEnhance from "@/components/textareaEnhance"; +import { CreateFavoriteApi } from "@/api/favorite"; +import { alert } from "@/common/common"; + +//原因选择 +type ReasonInfoParam = { + show?: boolean, //显示 + onClose?: () => void, //关闭 + onSuccess?: () => void, //成功 +} +export default memo(({show = false, onClose, onSuccess}: ReasonInfoParam) => { + + const submitData = useRef({ + "name": '', + "remark": '' + }) + + const getOtherReason = useCallback((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?.() + } + return ( + + + + + 编辑收藏夹 + + + + 批量管理 + + + + 删除该收藏夹 + + + + ) +}) \ No newline at end of file diff --git a/src/pages/collection/index.module.scss b/src/pages/collection/index.module.scss index 73573d6..5b3acd8 100644 --- a/src/pages/collection/index.module.scss +++ b/src/pages/collection/index.module.scss @@ -3,6 +3,19 @@ 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%; + } + } .class_list{ margin-top: 30px; .class_item{ @@ -17,6 +30,7 @@ font-weight: 700; font-size: 28px; padding: 0 20px; + @include common_ellipsis(); } .fg{ padding: 0 10px; diff --git a/src/pages/collection/index.tsx b/src/pages/collection/index.tsx index 8544bf1..33f5f1b 100644 --- a/src/pages/collection/index.tsx +++ b/src/pages/collection/index.tsx @@ -5,8 +5,10 @@ import { Text, View } from "@tarojs/components" import classnames from "classnames"; import { useCallback, useEffect, useState } from "react"; import CreatePopup from "./components/createPopup"; +import UpdatePopup from "./components/updatePopup"; import styles from './index.module.scss' export default () => { + const changeOpenCon = (item) => { item.openStatus = !item.openStatus setList((e) => [...e]) @@ -17,56 +19,46 @@ export default () => { const {fetchData: fetchDataList} = FavoriteListApi() const getFavoriteList = async () => { let res = await fetchDataList() - console.log('res::', res) + setList(() => res.data.list) } useEffect(() => { getFavoriteList() - let res:any = [] - new Array(10).fill('').map(item => { - res.push( - { - "create_time": "string", - "create_user_name": "string", - "creator_id": 0, - "id": 0, - "name": `${item}- 收藏夹`, - "product_color_list": [ - { - "product_code": "string", - "product_id": 0, - "product_name": "string" - } - ], - "remark": "string", - "update_time": "string", - "update_user_name": "string", - "updater_id": 0 - } - ) - }) - console.log('res33::', res) - setList(res) + }, []) + + //创建收藏夹 + const [collectioinShow, setCollectioinShow] = useState(false) + const closeCollection = useCallback(() => { + setCollectioinShow(false) + }, []) + + //创建成功 + const onCreatSuccess = useCallback(() => { + getFavoriteList() }, []) return ( - console.log(e)} placeholder="请输入面料关键词" placeIcon="out" showBtn={true} /> + console.log(e)} placeholder="请输入面料关键词" /> + setCollectioinShow(true)}> {list?.map((item:any) => - changeOpenCon(item)}> + changeOpenCon(item)}> - 默认收藏夹·11 - 更多 + {item.name} + {item.product_color_list&&<>·{item.product_color_list.length}} + + 更多 )} - + + ) } \ No newline at end of file diff --git a/src/pages/order/components/orderState/index.tsx b/src/pages/order/components/orderState/index.tsx index b08861d..71b4e16 100644 --- a/src/pages/order/components/orderState/index.tsx +++ b/src/pages/order/components/orderState/index.tsx @@ -71,8 +71,8 @@ export default memo(({orderInfo = {logistics_details: [],payment_method: 0, stat } - {(orderInfo.payment_method == PaymentMethodCashOnDelivery.value)&&} - {(orderInfo.payment_method == PaymentMethodAccountPeriod.value)&&} + {(orderInfo.payment_method == PaymentMethodCashOnDelivery.value)&&} + {(orderInfo.payment_method == PaymentMethodAccountPeriod.value)&&} {(orderInfo.status == SaleorderstatusWaitingPrePayment.value)&& diff --git a/src/use/useHttp.ts b/src/use/useHttp.ts index 79a544f..2a2227d 100644 --- a/src/use/useHttp.ts +++ b/src/use/useHttp.ts @@ -85,9 +85,6 @@ const showStatus = (status) => { return `${message},请检查网络或联系管理员!` } -//登录状态 -let loginStatus: false|true = false // true:登录中 - /** * axios 请求状态封装,返回响应式数据 fetch(), loading, error, code, msg 等常用方法/状态 * @param {Object} options 对象 @@ -176,12 +173,9 @@ export const useRequest = (options:option = { stateRef.current.total = data?.list ? data?.total : 0 }else{ if (statusCode === 401) { - if(!loginStatus) { - removeToken() - removeSessionKey() - login() - loginStatus = true - } + removeToken() + removeSessionKey() + login() //todo 登录数据刷新次数问题 } else { Taro.showToast({