修改部分bug
This commit is contained in:
parent
ddcae32b63
commit
8f470fa084
@ -28,7 +28,7 @@ export default memo(forwardRef(({
|
|||||||
showIcon = true, //是否显示关闭图标
|
showIcon = true, //是否显示关闭图标
|
||||||
showBtn = false, //是否显示搜索按钮
|
showBtn = false, //是否显示搜索按钮
|
||||||
btnStyle = {},
|
btnStyle = {},
|
||||||
placeIcon = 'inner',
|
placeIcon = 'inner', //搜索图标位置:inner在里面,out在外面
|
||||||
btnTitle = '搜索', //搜索文字
|
btnTitle = '搜索', //搜索文字
|
||||||
debounceTime = 0, //防抖时间,不设默认为零
|
debounceTime = 0, //防抖时间,不设默认为零
|
||||||
defaultValue = '' //默认值
|
defaultValue = '' //默认值
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 0 20px;
|
padding: 0 20px;
|
||||||
font-size: 26px;
|
font-size: 26px;
|
||||||
color: $color_font_two;
|
color: #000;
|
||||||
.input{
|
.input{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
@ -11,9 +11,9 @@ import { alert } from "@/common/common";
|
|||||||
type ReasonInfoParam = {
|
type ReasonInfoParam = {
|
||||||
show?: boolean, //显示
|
show?: boolean, //显示
|
||||||
onClose?: () => void, //关闭
|
onClose?: () => void, //关闭
|
||||||
|
onSuccess?: () => void, //成功
|
||||||
}
|
}
|
||||||
export default memo(({show = false, onClose}: ReasonInfoParam) => {
|
export default memo(({show = false, onClose, onSuccess}: ReasonInfoParam) => {
|
||||||
|
|
||||||
|
|
||||||
const submitData = useRef({
|
const submitData = useRef({
|
||||||
"name": '',
|
"name": '',
|
||||||
@ -25,14 +25,21 @@ export default memo(({show = false, onClose}: ReasonInfoParam) => {
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const changeInput = useCallback((val) => {
|
const changeInput = useCallback((val) => {
|
||||||
submitData.current.remark = val.detail.value
|
submitData.current.name = val.detail.value
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
//创建
|
//创建
|
||||||
const {fetchData} = CreateFavoriteApi()
|
const {fetchData} = CreateFavoriteApi()
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
if(submitData.current.name) return alert.error('请输入收藏夹名称')
|
if(!submitData.current.name) return alert.none('请输入收藏夹名称!')
|
||||||
let res = await fetchData(submitData.current)
|
let res = await fetchData(submitData.current)
|
||||||
|
if(res.success) {
|
||||||
|
alert.success('创建成功')
|
||||||
|
onSuccess?.()
|
||||||
|
} else {
|
||||||
|
alert.error('创建失败')
|
||||||
|
}
|
||||||
|
onClose?.()
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Popup show={show} title="新建收藏夹" onClose={onClose} >
|
<Popup show={show} title="新建收藏夹" onClose={onClose} >
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
.collection_con{
|
||||||
|
padding: 20px;
|
||||||
|
.collection_item{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
62
src/pages/collection/components/updatePopup/index.tsx
Normal file
62
src/pages/collection/components/updatePopup/index.tsx
Normal file
@ -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 (
|
||||||
|
<Popup show={show} onClose={onClose} >
|
||||||
|
<View className={styles.collection_con}>
|
||||||
|
<View className={styles.collection_item}>
|
||||||
|
<Text className={classnames(styles.miconfont, 'iconfont icon-bianji')}></Text>
|
||||||
|
<Text>编辑收藏夹</Text>
|
||||||
|
</View>
|
||||||
|
<View className={styles.collection_item}>
|
||||||
|
<Text className={classnames(styles.miconfont, 'iconfont icon-fenlei')}></Text>
|
||||||
|
<Text>批量管理</Text>
|
||||||
|
</View>
|
||||||
|
<View className={styles.collection_item}>
|
||||||
|
<Text className={classnames(styles.miconfont, 'iconfont icon-shanchu')}></Text>
|
||||||
|
<Text>删除该收藏夹</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</Popup>
|
||||||
|
)
|
||||||
|
})
|
@ -3,6 +3,19 @@
|
|||||||
padding: 0 20px;
|
padding: 0 20px;
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
background-color: #F8F8F8;
|
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{
|
.class_list{
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
.class_item{
|
.class_item{
|
||||||
@ -17,6 +30,7 @@
|
|||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
font-size: 28px;
|
font-size: 28px;
|
||||||
padding: 0 20px;
|
padding: 0 20px;
|
||||||
|
@include common_ellipsis();
|
||||||
}
|
}
|
||||||
.fg{
|
.fg{
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
|
@ -5,8 +5,10 @@ import { Text, View } from "@tarojs/components"
|
|||||||
import classnames from "classnames";
|
import classnames from "classnames";
|
||||||
import { useCallback, useEffect, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import CreatePopup from "./components/createPopup";
|
import CreatePopup from "./components/createPopup";
|
||||||
|
import UpdatePopup from "./components/updatePopup";
|
||||||
import styles from './index.module.scss'
|
import styles from './index.module.scss'
|
||||||
export default () => {
|
export default () => {
|
||||||
|
|
||||||
const changeOpenCon = (item) => {
|
const changeOpenCon = (item) => {
|
||||||
item.openStatus = !item.openStatus
|
item.openStatus = !item.openStatus
|
||||||
setList((e) => [...e])
|
setList((e) => [...e])
|
||||||
@ -17,48 +19,37 @@ export default () => {
|
|||||||
const {fetchData: fetchDataList} = FavoriteListApi()
|
const {fetchData: fetchDataList} = FavoriteListApi()
|
||||||
const getFavoriteList = async () => {
|
const getFavoriteList = async () => {
|
||||||
let res = await fetchDataList()
|
let res = await fetchDataList()
|
||||||
console.log('res::', res)
|
setList(() => res.data.list)
|
||||||
}
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getFavoriteList()
|
getFavoriteList()
|
||||||
let res:any = []
|
}, [])
|
||||||
new Array(10).fill('').map(item => {
|
|
||||||
res.push(
|
//创建收藏夹
|
||||||
{
|
const [collectioinShow, setCollectioinShow] = useState(false)
|
||||||
"create_time": "string",
|
const closeCollection = useCallback(() => {
|
||||||
"create_user_name": "string",
|
setCollectioinShow(false)
|
||||||
"creator_id": 0,
|
}, [])
|
||||||
"id": 0,
|
|
||||||
"name": `${item}- 收藏夹`,
|
//创建成功
|
||||||
"product_color_list": [
|
const onCreatSuccess = useCallback(() => {
|
||||||
{
|
getFavoriteList()
|
||||||
"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)
|
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={styles.collection_main}>
|
<View className={styles.collection_main}>
|
||||||
<View className={styles.search}>
|
<View className={styles.search}>
|
||||||
<Search style={{width: '100%'}} debounceTime={300} changeOnSearch={(e) => console.log(e)} placeholder="请输入面料关键词" placeIcon="out" showBtn={true} />
|
<Search style={{width: '100%'}} debounceTime={300} changeOnSearch={(e) => console.log(e)} placeholder="请输入面料关键词" />
|
||||||
|
<View className={styles.miconfont_con} onClick={() => setCollectioinShow(true)}><Text className={classnames(styles.miconfont, 'iconfont icon-jia')}></Text></View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.class_list}>
|
<View className={styles.class_list}>
|
||||||
{list?.map((item:any) => <View className={styles.class_item}>
|
{list?.map((item:any) => <View className={styles.class_item}>
|
||||||
<View className={styles.class_title} onClick={() => changeOpenCon(item)}>
|
<View key={item.id} className={styles.class_title} onClick={() => changeOpenCon(item)}>
|
||||||
<Text className={classnames(styles.miconfont_left, 'iconfont icon-a-moreback', item.openStatus?styles.miconfont_open:styles.miconfont_close)}></Text>
|
<Text className={classnames(styles.miconfont_left, 'iconfont icon-a-moreback', item.openStatus?styles.miconfont_open:styles.miconfont_close)}></Text>
|
||||||
<View className={styles.title}>默认收藏夹<Text className={styles.fg}>·</Text><Text className={styles.num}>11</Text></View>
|
<View className={styles.title}>{item.name}
|
||||||
|
{item.product_color_list&&<><Text className={styles.fg}>·</Text><Text className={styles.num}>{item.product_color_list.length}</Text></>}
|
||||||
|
</View>
|
||||||
<View className={styles.more} >更多</View>
|
<View className={styles.more} >更多</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={styles.class_con} style={item.openStatus?{maxHeight: 10*260 + 'rpx'}:{maxHeight: 0}} >
|
<View className={styles.class_con} style={item.openStatus?{maxHeight: 10*260 + 'rpx'}:{maxHeight: 0}} >
|
||||||
@ -66,7 +57,8 @@ export default () => {
|
|||||||
</View>
|
</View>
|
||||||
</View>)}
|
</View>)}
|
||||||
</View>
|
</View>
|
||||||
<CreatePopup show={true}/>
|
<CreatePopup show={collectioinShow} onClose={closeCollection} onSuccess={onCreatSuccess}/>
|
||||||
|
<UpdatePopup show={true} onClose={closeCollection} onSuccess={onCreatSuccess}/>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
@ -71,8 +71,8 @@ export default memo(({orderInfo = {logistics_details: [],payment_method: 0, stat
|
|||||||
<Text className={classnames('iconfont icon-a-moreback', styles.miconfonts, showMore&&styles.open_miconfonts)}></Text>
|
<Text className={classnames('iconfont icon-a-moreback', styles.miconfonts, showMore&&styles.open_miconfonts)}></Text>
|
||||||
</View>}
|
</View>}
|
||||||
<View className={styles.image_tag}>
|
<View className={styles.image_tag}>
|
||||||
{(orderInfo.payment_method == PaymentMethodCashOnDelivery.value)&&<Image mode="aspectFit" src={formatImgUrl('/mall/order_pay_status.png')} className={styles.image}/>}
|
{(orderInfo.payment_method == PaymentMethodCashOnDelivery.value)&&<Image mode="aspectFit" src={formatImgUrl('/mall/order_pay_status.png', true)} className={styles.image}/>}
|
||||||
{(orderInfo.payment_method == PaymentMethodAccountPeriod.value)&&<Image mode="aspectFit" src={formatImgUrl('/mall/order_pay_status_7day.png')} className={styles.image}/>}
|
{(orderInfo.payment_method == PaymentMethodAccountPeriod.value)&&<Image mode="aspectFit" src={formatImgUrl('/mall/order_pay_status_7day.png', true)} className={styles.image}/>}
|
||||||
</View>
|
</View>
|
||||||
{(orderInfo.status == SaleorderstatusWaitingPrePayment.value)&&<View className={styles.refresh} onClick={onRefresh}>
|
{(orderInfo.status == SaleorderstatusWaitingPrePayment.value)&&<View className={styles.refresh} onClick={onRefresh}>
|
||||||
<Text className={classnames(styles.mconfont, 'iconfont icon-xianxiahuikuan')}></Text>
|
<Text className={classnames(styles.mconfont, 'iconfont icon-xianxiahuikuan')}></Text>
|
||||||
|
@ -85,9 +85,6 @@ const showStatus = (status) => {
|
|||||||
return `${message},请检查网络或联系管理员!`
|
return `${message},请检查网络或联系管理员!`
|
||||||
}
|
}
|
||||||
|
|
||||||
//登录状态
|
|
||||||
let loginStatus: false|true = false // true:登录中
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* axios 请求状态封装,返回响应式数据 fetch(), loading, error, code, msg 等常用方法/状态
|
* axios 请求状态封装,返回响应式数据 fetch(), loading, error, code, msg 等常用方法/状态
|
||||||
* @param {Object} options 对象
|
* @param {Object} options 对象
|
||||||
@ -176,12 +173,9 @@ export const useRequest = (options:option = {
|
|||||||
stateRef.current.total = data?.list ? data?.total : 0
|
stateRef.current.total = data?.list ? data?.total : 0
|
||||||
}else{
|
}else{
|
||||||
if (statusCode === 401) {
|
if (statusCode === 401) {
|
||||||
if(!loginStatus) {
|
|
||||||
removeToken()
|
removeToken()
|
||||||
removeSessionKey()
|
removeSessionKey()
|
||||||
login()
|
login()
|
||||||
loginStatus = true
|
|
||||||
}
|
|
||||||
//todo 登录数据刷新次数问题
|
//todo 登录数据刷新次数问题
|
||||||
} else {
|
} else {
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user