商城测试版v8

This commit is contained in:
czm 2022-07-26 18:36:47 +08:00
parent 341c5c2eed
commit 3009b65e00
17 changed files with 106 additions and 90 deletions

View File

@ -11,7 +11,7 @@ export const BASE_URL = `https://test.zzfzyc.com/lymarket` // 测试环境
// export const BASE_URL = `https://dev.zzfzyc.com/lymarket` // 开发环境 // export const BASE_URL = `https://dev.zzfzyc.com/lymarket` // 开发环境
// export const BASE_URL = `https://www.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:50001/lymarket` // 添=[A14578YY] // 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 // CDN

View File

@ -31,23 +31,21 @@
grid-template-columns: repeat(3, 165.75px); grid-template-columns: repeat(3, 165.75px);
justify-content: space-between; justify-content: space-between;
.btn_item{ .btn_item{
// width: 165.75px;
height: 69.2px; height: 69.2px;
background: #f0f0f0; background: #f0f0f0;
border-radius: 34px; border-radius: 34px;
text-align: center;
line-height: 69.2px; line-height: 69.2px;
text-align: center;
font-size: $font_size_medium; font-size: $font_size_medium;
color: $color_font_one; color: $color_font_one;
margin-bottom: 20px; margin-bottom: 20px;
@include common_ellipsis();
} }
.select_btn_item{ .select_btn_item{
color: $color_main; color: $color_main;
background: #ecf5ff; background: #ecf5ff;
border: 2px solid #007aff; border: 2px solid #007aff;
box-sizing: border-box; box-sizing: border-box;
width: 161.75px;
height: 65.2px;
} }
} }
.btn_list_input{ .btn_list_input{

View File

@ -85,7 +85,7 @@ export default memo(({orderInfo, showStatus = 'detail', onClick}:Param) => {
SaleOrderStatusAlreadyReceipt.value, SaleOrderStatusAlreadyReceipt.value,
SaleOrderStatusComplete.value SaleOrderStatusComplete.value
] ]
return orderInfo.wait_pay_amount != 0 && orderStatus.includes(orderInfo.status) return orderInfo.wait_pay_amount > 0 && orderStatus.includes(orderInfo.status)
} }
}, },
{ {
@ -98,7 +98,7 @@ export default memo(({orderInfo, showStatus = 'detail', onClick}:Param) => {
SaleOrderStatusWaitingDelivery.value, SaleOrderStatusWaitingDelivery.value,
SaleOrderStatusTaking.value SaleOrderStatusTaking.value
] ]
return orderInfo.sale_mode == SaLeModeBulk.value && orderInfo.actual_amount != 0 && orderInfo.av_return_roll && orderStatus.includes(orderInfo.status) return orderInfo.sale_mode == SaLeModeBulk.value && orderInfo.actual_amount > 0 && orderInfo.av_return_roll && orderStatus.includes(orderInfo.status)
} }
}, },
{ {
@ -141,7 +141,7 @@ export default memo(({orderInfo, showStatus = 'detail', onClick}:Param) => {
let orderStatus = [ let orderStatus = [
SaleOrderStatusBooking.value SaleOrderStatusBooking.value
] ]
return orderInfo.sale_mode != SaLeModeBulk.value && orderInfo.actual_amount != 0 && orderStatus.includes(orderInfo.status) return orderInfo.sale_mode != SaLeModeBulk.value && orderInfo.actual_amount > 0 && orderStatus.includes(orderInfo.status)
} }
}, },
{ {

View File

@ -43,6 +43,7 @@
.title{ .title{
font-size: $font_size; font-size: $font_size;
color: #707070; color: #707070;
@include common_ellipsis(2);
text{ text{
color: $color_font_one; color: $color_font_one;
font-weight: bold; font-weight: bold;

View File

@ -49,7 +49,6 @@ export default () => {
//上拉加载数据 //上拉加载数据
const pageNum = useRef({size: searchField.size, page: searchField.page}) const pageNum = useRef({size: searchField.size, page: searchField.page})
const [hasMore, setHasMore] = useState(true)
const getScrolltolower = () => { const getScrolltolower = () => {
if(categoryList.list.length < categoryList.total) { if(categoryList.list.length < categoryList.total) {
pageNum.current.page++ pageNum.current.page++
@ -61,11 +60,12 @@ export default () => {
//数据加载状态 //数据加载状态
const statusMore = useMemo(() => { const statusMore = useMemo(() => {
return dataLoadingStatus({list:categoryList.list, total: categoryList.total, status: state.loading}) return dataLoadingStatus({list:categoryList.list, total: categoryList.total, status: state.loading})
}, [categoryList]) }, [categoryList, state])
//获取筛选条件 //获取筛选条件
const getFiltr = (e) => { const getFiltr = (e) => {
pageNum.current.page = 1 pageNum.current.page = 1
setCategoryList(() => ({list:[], total:0}))
const {data} = e const {data} = e
setSearchField({ setSearchField({
...searchField, ...searchField,
@ -97,7 +97,19 @@ export default () => {
setSearchField((val) => ({...val, code_or_name:e, size:10})) setSearchField((val) => ({...val, code_or_name:e, size:10}))
}, []) }, [])
//排序
type sortParam = 'none'|'top'|'bottom'
const sortComprehensiveRef = useRef<any>(null)
const [sortStatus, setSortStatus] = useState<{comprehensive:sortParam}>({
comprehensive: 'none'
})
const changeSort = () => {
setCategoryList(() => ({list:[], total:0}))
const {status, value} = sortComprehensiveRef.current.changeSort()
setSortStatus((e) => ({...e, comprehensive: status, collection: 'none'}))
setSearchField((e) => ({...e, abstract_sort_key: value, size:10, page:1}))
pageNum.current = {size: 10, page: 1}
}
return ( return (
<View className={styles.main}> <View className={styles.main}>
@ -106,9 +118,9 @@ export default () => {
</View> </View>
<View className={styles.filter}> <View className={styles.filter}>
<View className={styles.filter_all}> <View className={styles.filter_all}>
<View className={styles.text_one}> <View className={styles.text_one} onClick={() => changeSort()}>
<Text></Text> <Text></Text>
<SortBtn status="top"/> <SortBtn status={sortStatus.comprehensive} ref={sortComprehensiveRef} sortValue={{desc: '1', asc: '-1'}}/>
</View> </View>
<View className={styles.text_two} onClick={() => setShowPopup(true)}> <View className={styles.text_two} onClick={() => setShowPopup(true)}>
<Text></Text> <Text></Text>

View File

@ -4,7 +4,7 @@ import { getFilterData } from "@/common/util";
import Product from "./components/product"; import Product from "./components/product";
import Search from "@/components/search" import Search from "@/components/search"
import { Text, View } from "@tarojs/components" import { Text, View } from "@tarojs/components"
import Taro from "@tarojs/taro"; import Taro, { useDidHide, useDidShow } from "@tarojs/taro";
import classnames from "classnames"; import classnames from "classnames";
import { useCallback, useEffect, useRef, useState } from "react"; import { useCallback, useEffect, useRef, useState } from "react";
import CreatePopup from "./components/createPopup"; import CreatePopup from "./components/createPopup";
@ -17,6 +17,9 @@ export default () => {
item.openStatus = !item.openStatus item.openStatus = !item.openStatus
setList((e) => [...e]) setList((e) => [...e])
} }
useDidShow(() => {
getFavoriteList()
})
//获取搜索数据 //获取搜索数据
const [searchData, setSearchData] = useState('') const [searchData, setSearchData] = useState('')
const onSearch = useCallback((e) => { const onSearch = useCallback((e) => {

View File

@ -1,18 +0,0 @@
.order_flow_state{
display: flex;
align-items: center;
padding: 0 30px;
height: 116px;
background-color: #fff;
border-radius: 20px;
.order_flow_state_text{
color: $color_main;
font-size:$font_size;
font-weight: 700;
}
.order_flow_state_desc{
color: $color_font_three;
font-size: $font_size_medium;
margin-left: 50px;
}
}

View File

@ -1,14 +0,0 @@
import { View } from "@tarojs/components"
import styles from './index.module.scss'
export default ({
state = '',
desc = ''
}) => {
return (
<View className={styles.order_flow_state}>
<View className={styles.order_flow_state_text}>{state}</View>
<View className={styles.order_flow_state_desc}>{desc}</View>
</View>
)
}

View File

@ -0,0 +1,21 @@
.tag{
font-size: $font_size_min;
padding: 5px 15px;
background-color: $color_main;
color: #fff;
border-radius: 0px 20px 0px 20px;
display: flex;
align-items: center;
.miconfont{
font-size: 30px;
}
}
.saleReturn_tag{
background-color: #E4E4FF;
color: #1818B4;
}
.refund_tag {
background-color: #FFE6CE;
color: #EE7500;
}

View File

@ -0,0 +1,25 @@
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
}
export default memo(({status = 0}:Param) => {
const {
ReturnApplyOrderTypeAdvanceReceiptRefund, // 预收退款
ReturnApplyOrderTypeReturnForRefund, // 退货退款
ReturnApplyOrderTypeSalesRefund // 销售退款
} = REFUND_STATUS_ORDER
return (
<>
{(status !== 0)&&<View className={classnames(styles.tag, status != ReturnApplyOrderTypeReturnForRefund.value?styles.refund_tag :styles.saleReturn_tag)}>
<View className={classnames(styles.miconfont, 'iconfont icon-yucunkuan')}></View>
<Text>{ status == ReturnApplyOrderTypeReturnForRefund.value?'退货':'退款'}</Text>
</View>}
</>
)
})

View File

@ -5,13 +5,13 @@ import { dataLoadingStatus, getFilterData } from "@/common/util";
import InfiniteScroll from "@/components/infiniteScroll"; import InfiniteScroll from "@/components/infiniteScroll";
import LabAndImg from "@/components/LabAndImg"; import LabAndImg from "@/components/LabAndImg";
import Popup from "@/components/popup"; import Popup from "@/components/popup";
import OrderStatusTag from "@/pages/salesAfterList/components/orderStatusTag";
import { useSelector } from "@/reducers/hooks"; import { useSelector } from "@/reducers/hooks";
import { Image, Text, View } from "@tarojs/components"; import { Image, Text, View } from "@tarojs/components";
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react"; import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
import classnames from "classnames"; import classnames from "classnames";
import styles from './index.module.scss' import styles from './index.module.scss'
import { REFUND_STATUS_ORDER } from "@/common/enum"; import { REFUND_STATUS_ORDER } from "@/common/enum";
import OrderStatusTag from "../orderStatusTag";
type Param = { type Param = {
show?: true|false, show?: true|false,

View File

@ -23,7 +23,6 @@ export default memo(() => {
} else { } else {
setLinkStatus(2) setLinkStatus(2)
} }
console.log('aaa:::', state.connected)
}, [state.available, state.connected]) }, [state.available, state.connected])
const linkName = useMemo(() => { const linkName = useMemo(() => {

View File

@ -22,7 +22,10 @@ export default () => {
one?: any, one?: any,
two?: any two?: any
} }
const [colorList, setColorList] = useState<ColorList>() const [colorList, setColorList] = useState<ColorList>({
one: null,
two: null
})
const { state: colorState, measureAndGetLab } = useBluetooth() const { state: colorState, measureAndGetLab } = useBluetooth()
const getLab = async (val) => { const getLab = async (val) => {
@ -58,14 +61,14 @@ export default () => {
if (colorState.deviceLab) { if (colorState.deviceLab) {
if ((colorList as any).one?.constructor === Object) { 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]) 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]})`) setBlueToothColor(`rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`)
setTime(getNowTime()) setTime(getNowTime())
setSearchField({ ...searchField, l1: rgb[0], a1: rgb[1], b1: rgb[2] }) setSearchField({ ...searchField, l1: rgb[0], a1: rgb[1], b1: rgb[2] })
} }
if ((colorList as any).two?.constructor === Object) { 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]) 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]})`) setBlueToothColorTwo(`rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`)
setTimeTwo(getNowTime()) setTimeTwo(getNowTime())
setSearchField({ ...searchField, l2: rgb[0], a2: rgb[1], b2: rgb[2] }) setSearchField({ ...searchField, l2: rgb[0], a2: rgb[1], b2: rgb[2] })

View File

@ -143,7 +143,7 @@
} }
.list_num_shadow { .list_num_shadow {
box-shadow: 0px 5px 5px #ccc; box-shadow: 0px 3px 5px #ccc;
} }
.scroll{ .scroll{
height: 100%; height: 100%;
@ -159,7 +159,7 @@
background-color: #fff; background-color: #fff;
border-radius: 20px; border-radius: 20px;
margin-bottom: 20px; margin-bottom: 20px;
box-shadow: 0px 3px 10px 0px rgba(0,0,0,0.1) ; box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.1) ;
.product_img{ .product_img{
width: 100%; width: 100%;
height: 224px; height: 224px;

View File

@ -13,15 +13,15 @@ import Taro, { useDidShow, usePullDownRefresh, useReady } from "@tarojs/taro";
import {GetLabProductApi} from "@/api/material" import {GetLabProductApi} from "@/api/material"
import { dataLoadingStatus, getFilterData } from "@/common/util"; import { dataLoadingStatus, getFilterData } from "@/common/util";
import { formatHashTag, formatImgUrl } from "@/common/fotmat"; import { formatHashTag, formatImgUrl } from "@/common/fotmat";
import LoadingCard from "@/components/loadingCard";
import useLogin from "@/use/useLogin"; import useLogin from "@/use/useLogin";
import { goLink } from "@/common/common"; import { goLink } from "@/common/common";
import SelectData, {ListProps} from "./components/selectData"; import SelectData, {ListProps} from "./components/selectData";
import LabAndImg from "@/components/LabAndImg"; import LabAndImg from "@/components/LabAndImg";
import useCheckAuthorize from "@/use/useCheckAuthorize";
export default () => { export default () => {
useLogin() useLogin()
const firstOpen = useRef(true)
const [showFilter, setShowFilter] = useState(false) const [showFilter, setShowFilter] = useState(false)
//搜索参数 //搜索参数
const [searchField, setSearchField] = useState({ const [searchField, setSearchField] = useState({
@ -44,6 +44,7 @@ export default () => {
let {data} = await materialFetchData(getFilterData(searchField)) let {data} = await materialFetchData(getFilterData(searchField))
setMaterialList({list:data.list, total:data.total}) setMaterialList({list:data.list, total:data.total})
Taro.stopPullDownRefresh() Taro.stopPullDownRefresh()
firstOpen.current = false
} }
//监听筛选条件变化 //监听筛选条件变化
@ -61,20 +62,10 @@ export default () => {
} }
} }
//数据加载状态 //数据加载状态
const statusMore = useMemo(() => { const statusMore = useMemo(() => {
return dataLoadingStatus({list:materialList.list, total: materialList.total, status: materialState.loading}) return dataLoadingStatus({list:materialList.list, total: materialList.total, status: materialState.loading})
}, [materialList]) }, [materialList, materialState])
const [scrollStatus, setScrollStatus] = useState(false)
const onscroll = useCallback((e) => {
if(e.detail.scrollTop > 20) {
setScrollStatus(true)
} else {
setScrollStatus(false)
}
},[])
const {state: colorState, measureAndGetLab} = useBluetooth() const {state: colorState, measureAndGetLab} = useBluetooth()
const getLab = () => { const getLab = () => {
@ -91,10 +82,12 @@ export default () => {
//监听lab数据变化 //监听lab数据变化
const [blueToothColor, setBlueToothColor] = useState('') const [blueToothColor, setBlueToothColor] = useState('')
useEffect(() => { useEffect(() => {
if(colorState.deviceLab) { if(colorState.deviceLab && !firstOpen.current) {
const rgb = toRgb([colorState.deviceLab.L, colorState.deviceLab.a, colorState.deviceLab.b]) const rgb = toRgb([colorState.deviceLab.L, colorState.deviceLab.a, colorState.deviceLab.b])
setBlueToothColor(`rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`) setBlueToothColor(`rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`)
setSearchField({...searchField, l:rgb[0], a:rgb[1], b:rgb[2], size:10}) setSearchField({...searchField, l:rgb[0], a:rgb[1], b:rgb[2], size:10, page:1})
setMaterialList(() => ({list:[], total:0}))
pageNum.current = {size: 10, page: 1}
} }
}, [colorState.deviceLab]) }, [colorState.deviceLab])
@ -104,6 +97,7 @@ export default () => {
//获取筛选条件 //获取筛选条件
const getFiltr = (e) => { const getFiltr = (e) => {
pageNum.current.page = 1
setMaterialList(() => ({list:[], total:0})) setMaterialList(() => ({list:[], total:0}))
const {data} = e const {data} = e
setSearchField({ setSearchField({
@ -143,15 +137,17 @@ export default () => {
collection: 'none' collection: 'none'
}) })
const changeSort = (val) => { const changeSort = (val) => {
setMaterialList(() => ({list:[], total:0}))
if(val == 1) { if(val == 1) {
const {status, value} = sortComprehensiveRef.current.changeSort() const {status, value} = sortComprehensiveRef.current.changeSort()
setSortStatus((e) => ({...e, comprehensive: status, collection: 'none'})) setSortStatus((e) => ({...e, comprehensive: status, collection: 'none'}))
setSearchField((e) => ({...e, abstract_sort_key: value})) setSearchField((e) => ({...e, abstract_sort_key: value, size:10, page:1}))
} else { } else {
const {status, value} = sortCollectionRef.current.changeSort() const {status, value} = sortCollectionRef.current.changeSort()
setSortStatus((e) => ({...e, collection: status, comprehensive: 'none'})) setSortStatus((e) => ({...e, collection: status, comprehensive: 'none'}))
setSearchField((e) => ({...e, abstract_sort_key: value})) setSearchField((e) => ({...e, abstract_sort_key: value, size:10, page:1}))
} }
pageNum.current = {size: 10, page: 1}
} }
const labAndImgObj = useCallback((item) => { const labAndImgObj = useCallback((item) => {
@ -195,11 +191,10 @@ export default () => {
</View> </View>
</View> </View>
<View className={styles.list}> <View className={styles.list}>
<View className={classnames(styles.list_num, scrollStatus&&styles.list_num_shadow)}> ({materialList.total})</View> <View className={classnames(styles.list_num, styles.list_num_shadow)}> ({materialList.total})</View>
<View className={styles.scroll}> <View className={styles.scroll}>
<InfiniteScroll <InfiniteScroll
selfonScrollToLower={getScrolltolower} selfonScrollToLower={getScrolltolower}
selfOnScroll={(e) => onscroll(e)}
statusMore={statusMore} statusMore={statusMore}
> >
<View className={styles.product_list}> <View className={styles.product_list}>

View File

@ -126,7 +126,7 @@
} }
.list_num_shadow { .list_num_shadow {
box-shadow: 0px 5px 5px #ccc; box-shadow: 0px 3px 5px #ccc;
} }
.scroll{ .scroll{
height: 100%; height: 100%;
@ -142,7 +142,7 @@
background-color: #fff; background-color: #fff;
border-radius: 20px; border-radius: 20px;
margin-bottom: 20px; margin-bottom: 20px;
box-shadow: 0px 3px 10px 0px rgba(0,0,0,0.1) ; box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.1) ;
.product_img{ .product_img{
width: 100%; width: 100%;
height: 224px; height: 224px;

View File

@ -68,6 +68,7 @@ export default () => {
pageNum.current.page = 1 pageNum.current.page = 1
setMaterialList(() => ({list:[], total:0})) setMaterialList(() => ({list:[], total:0}))
setSearchField((val) => ({...val, code_or_name:e, size:10})) setSearchField((val) => ({...val, code_or_name:e, size:10}))
pageNum.current = {size: 10, page: 1}
}, []) }, [])
const goLinkPage = (item) => { const goLinkPage = (item) => {
@ -79,16 +80,6 @@ export default () => {
setSearchField({...searchField ,size : 10}) setSearchField({...searchField ,size : 10})
}) })
//监听滚动
const [scrollStatus, setScrollStatus] = useState(false)
const onscroll = useCallback((e) => {
if(e.detail.scrollTop > 20) {
setScrollStatus(true)
} else {
setScrollStatus(false)
}
},[])
//获取筛选条件 //获取筛选条件
const getFiltr = (e) => { const getFiltr = (e) => {
pageNum.current.page = 1 pageNum.current.page = 1
@ -129,12 +120,13 @@ export default () => {
if(val == 1) { if(val == 1) {
const {status, value} = sortComprehensiveRef.current.changeSort() const {status, value} = sortComprehensiveRef.current.changeSort()
setSortStatus((e) => ({...e, comprehensive: status, collection: 'none'})) setSortStatus((e) => ({...e, comprehensive: status, collection: 'none'}))
setSearchField((e) => ({...e, abstract_sort_key: value})) setSearchField((e) => ({...e, abstract_sort_key: value, size:10, page:1}))
} else { } else {
const {status, value} = sortCollectionRef.current.changeSort() const {status, value} = sortCollectionRef.current.changeSort()
setSortStatus((e) => ({...e, collection: status, comprehensive: 'none'})) setSortStatus((e) => ({...e, collection: status, comprehensive: 'none'}))
setSearchField((e) => ({...e, abstract_sort_key: value})) setSearchField((e) => ({...e, abstract_sort_key: value, size:10, page:1}))
} }
pageNum.current = {size: 10, page: 1}
} }
const labAndImgObj = useCallback((item) => { const labAndImgObj = useCallback((item) => {
@ -173,11 +165,10 @@ export default () => {
</View> </View>
</View> </View>
<View className={styles.list}> <View className={styles.list}>
<View className={classnames(styles.list_num, scrollStatus&&styles.list_num_shadow)}> ({materialList.total})</View> <View className={classnames(styles.list_num, styles.list_num_shadow)}> ({materialList.total})</View>
<View className={styles.scroll}> <View className={styles.scroll}>
<InfiniteScroll <InfiniteScroll
selfonScrollToLower={getScrolltolower} selfonScrollToLower={getScrolltolower}
selfOnScroll={onscroll}
statusMore={statusMore} statusMore={statusMore}
> >
<View className={styles.product_list}> <View className={styles.product_list}>