样品对比接口对接
This commit is contained in:
parent
eb7df4b592
commit
16e3c08f4b
@ -10,3 +10,17 @@ export const userassets = () => {
|
||||
method: "get",
|
||||
})
|
||||
}
|
||||
//取色对比
|
||||
export const productabsorbcontrast = () => {
|
||||
return useRequest({
|
||||
url: `/v1/mall/product/color/absorb/contrast`,
|
||||
method: "get",
|
||||
})
|
||||
}
|
||||
//订单统计
|
||||
export const userorderStatistics = () => {
|
||||
return useRequest({
|
||||
url: `/v1/mall/user/orderStatistics`,
|
||||
method: "get",
|
||||
})
|
||||
}
|
@ -209,4 +209,45 @@ page {
|
||||
margin-right: 37px;
|
||||
}
|
||||
}
|
||||
|
||||
.bottomBox {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 750px;
|
||||
height: 182px;
|
||||
background: #f3f3f3;
|
||||
box-shadow: 0px 0px 12px 0px rgba(0, 0, 0, 0.16);
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
|
||||
.leftBtn {
|
||||
width: 264px;
|
||||
height: 82px;
|
||||
background: #ffffff;
|
||||
border-radius: 42px;
|
||||
font-size: 32px;
|
||||
font-family: Microsoft YaHei, Microsoft YaHei-Regular;
|
||||
font-weight: 400;
|
||||
text-align: center;
|
||||
color: #007aff;
|
||||
line-height: 82px;
|
||||
margin-top: 34px;
|
||||
margin-left: 67px;
|
||||
}
|
||||
|
||||
.rightBtn {
|
||||
width: 264px;
|
||||
height: 82px;
|
||||
background: #007aff;
|
||||
border-radius: 42px;
|
||||
font-size: 32px;
|
||||
font-family: Microsoft YaHei, Microsoft YaHei-Regular;
|
||||
font-weight: 400;
|
||||
text-align: center;
|
||||
color: #ffffff;
|
||||
line-height: 82px;
|
||||
margin-top: 34px;
|
||||
margin-left: 88px;
|
||||
}
|
||||
}
|
||||
}
|
@ -2,30 +2,26 @@
|
||||
import { Image, Text, Textarea, View } from "@tarojs/components"
|
||||
import Taro, { useDidShow, usePullDownRefresh, useRouter } from "@tarojs/taro";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useBluetooth } from "@/use/contextBlueTooth"
|
||||
import { useBluetoothTwo } from "@/use/BlueToothCopy"
|
||||
import { useBluetooth } from "../../use/contextBlueTooth"
|
||||
import classnames from "classnames";
|
||||
import LinkBlueTooth from "./compoents/bluetooth/LinkBlueTooth";
|
||||
import { toRgb } from '@/common/bluetooth/color/colorSpace'
|
||||
import { toRgb } from '../../common/bluetooth/color/colorSpace'
|
||||
import styles from './index.module.scss'
|
||||
|
||||
import { productabsorbcontrast } from "@/api/mine"
|
||||
export default () => {
|
||||
//搜索参数
|
||||
const [searchField, setSearchField] = useState({
|
||||
l: '',
|
||||
a: '',
|
||||
b: '',
|
||||
page: 1,
|
||||
size: 10,
|
||||
width: '',
|
||||
weight_density: '',
|
||||
product_kind_id: '',
|
||||
component: ''
|
||||
l1: '',
|
||||
a1: '',
|
||||
b1: '',
|
||||
l2: '',
|
||||
a2: '',
|
||||
b2: '',
|
||||
})
|
||||
|
||||
const [colorList, setColorList] = useState({
|
||||
one: [],
|
||||
two: []
|
||||
one: null,
|
||||
two: null
|
||||
})
|
||||
const { state: colorState, measureAndGetLab } = useBluetooth()
|
||||
|
||||
@ -36,7 +32,6 @@ export default () => {
|
||||
setColorList({ ...colorList, one: res })
|
||||
} else {
|
||||
setColorList({ ...colorList, two: res })
|
||||
console.log('colorList',colorList)
|
||||
}
|
||||
} else {
|
||||
Taro.showToast({
|
||||
@ -45,24 +40,68 @@ export default () => {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const getNowTime = () => {
|
||||
const yy = new Date().getFullYear()
|
||||
const MM = (new Date().getMonth() + 1) < 10 ? '0' + (new Date().getMonth() + 1) : (new Date().getMonth() + 1)
|
||||
const dd = new Date().getDate() < 10 ? '0' + new Date().getDate() : new Date().getDate()
|
||||
const HH = new Date().getHours() < 10 ? '0' + new Date().getHours() : new Date().getHours()
|
||||
const mm = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes()
|
||||
const ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds()
|
||||
return yy + '-' + MM + '-' + dd + ' ' + HH + ':' + mm + ':' + ss
|
||||
}
|
||||
//监听lab数据变化
|
||||
const [blueToothColor, setBlueToothColor] = useState('')
|
||||
const [blueToothColorTwo, setBlueToothColorTwo] = useState('')
|
||||
const [time, setTime] = useState('')
|
||||
const [timeTwo, setTimeTwo] = useState('')
|
||||
useEffect(() => {
|
||||
if (colorState.deviceLab) {
|
||||
const rgb = toRgb([colorState.deviceLab.L, colorState.deviceLab.a, colorState.deviceLab.b])
|
||||
console.log(colorList, 'colorList.one.lengthcolorList.one.length')
|
||||
|
||||
if (colorList.one?.constructor === Object) {
|
||||
const rgb = toRgb([colorList.one.L, colorList.one.a, colorList.one.b])
|
||||
setBlueToothColor(`rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`)
|
||||
console.log(blueToothColor, 'blueToothColorblueToothColor')
|
||||
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])
|
||||
setBlueToothColorTwo(`rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`)
|
||||
setTimeTwo(getNowTime())
|
||||
setSearchField({ ...searchField, l2: rgb[0], a2: rgb[1], b2: rgb[2] })
|
||||
}
|
||||
// setSearchField({ ...searchField, l: rgb[0], a: rgb[1], b: rgb[2], size: 10 })
|
||||
}
|
||||
}, [colorList])
|
||||
const reset = () => {
|
||||
setBlueToothColor('')
|
||||
setBlueToothColorTwo('')
|
||||
setTime('')
|
||||
setTime('')
|
||||
}
|
||||
const [data, setData] = useState('')
|
||||
const { fetchData } = productabsorbcontrast()
|
||||
const handTake = async () => {
|
||||
if (searchField.l1 === '') {
|
||||
Taro.showToast({
|
||||
title: '请填充基础样品',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (searchField.l2 === '') {
|
||||
Taro.showToast({
|
||||
title: '请填充对比样品',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
const query = {
|
||||
...searchField
|
||||
}
|
||||
const res = await fetchData(query)
|
||||
if (res.data) {
|
||||
|
||||
}
|
||||
}
|
||||
return (
|
||||
<View className={styles.body}>
|
||||
{/* <View className={styles.topBox}>
|
||||
@ -77,17 +116,22 @@ export default () => {
|
||||
<LinkBlueTooth />
|
||||
<View className={styles.contBox} >
|
||||
<View className={styles.firstBox} style="margin-right:27px">
|
||||
<View className={styles.firstLeftName} >对比样品</View>
|
||||
<View className={styles.firstLeftName} >基础样品</View>
|
||||
{
|
||||
blueToothColor === '' &&
|
||||
<View className={styles.firstLeftbox} onClick={() => getLab(1)}>
|
||||
<View className={styles.clickFont} >点击取色</View>
|
||||
</View>
|
||||
}
|
||||
{blueToothColor && <View className={classnames(styles.color_bock)} style={{ background: blueToothColor }}></View>
|
||||
{blueToothColor && <View className={classnames(styles.color_bock)} onClick={() => getLab(1)} style={{ background: blueToothColor }}></View>
|
||||
|
||||
}
|
||||
<View className={styles.nameColor}>--</View>
|
||||
{
|
||||
time === '' && <View className={styles.nameColor}>--</View>
|
||||
}
|
||||
{
|
||||
time && <View className={styles.nameColor}>{time}</View>
|
||||
}
|
||||
</View>
|
||||
<View className={styles.firstBox}>
|
||||
<View className={styles.firstLeftName}>对比样品</View>
|
||||
@ -97,10 +141,15 @@ export default () => {
|
||||
<View className={styles.clickFont} >点击取色</View>
|
||||
</View>
|
||||
}
|
||||
{blueToothColorTwo && <View className={classnames(styles.color_bocktwo)} style={{ background: blueToothColorTwo }}></View>
|
||||
{blueToothColorTwo && <View className={classnames(styles.color_bocktwo)} onClick={() => getLab(2)} style={{ background: blueToothColorTwo }}></View>
|
||||
|
||||
}
|
||||
<View className={styles.nameColor}>--</View>
|
||||
{
|
||||
timeTwo === '' && <View className={styles.nameColor}>--</View>
|
||||
}
|
||||
{
|
||||
timeTwo && <View className={styles.nameColor}>{timeTwo}</View>
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.reslutBox}>
|
||||
@ -109,11 +158,21 @@ export default () => {
|
||||
{/* <View className={styles.titleRiht}>不合格</View> */}
|
||||
<View className={styles.titleRiht1}>合格</View>
|
||||
</View>
|
||||
{/* <View className={styles.notResult}>暂无数据</View> */}
|
||||
{
|
||||
data === '' &&
|
||||
<View className={styles.notResult}>暂无数据</View>
|
||||
}
|
||||
{
|
||||
data &&
|
||||
<View className={styles.notBox}>
|
||||
<View className={styles.notLeft}>色差值: 0.2</View>
|
||||
<View className={styles.notLeft}>色差值: {(data as any).ciede_2000}</View>
|
||||
<View className={styles.notright}>无明显色差</View>
|
||||
</View>
|
||||
}
|
||||
</View>
|
||||
<View className={styles.bottomBox}>
|
||||
<View className={styles.leftBtn} onClick={() => reset()}>重置</View>
|
||||
<View className={styles.rightBtn} onClick={() => handTake()}>提交</View>
|
||||
</View>
|
||||
</View >
|
||||
)
|
||||
|
@ -7,8 +7,9 @@ import { alert, goLink } from "@/common/common";
|
||||
import useLogin from '@/use/useLogin'
|
||||
import { BASE_URL } from '@/common/constant'
|
||||
import Taro from "@tarojs/taro";
|
||||
import { userassets } from "@/api/mine"
|
||||
import { userassets, userorderStatistics } from "@/api/mine"
|
||||
import { formatPriceDiv } from "@/common/fotmat"
|
||||
import { useDidShow, } from '@tarojs/taro'
|
||||
export default () => {
|
||||
// 用户信息
|
||||
const { getSelfUserInfo } = useLogin();
|
||||
@ -23,10 +24,14 @@ export default () => {
|
||||
alert.none("授权失败,请授权后再使用");
|
||||
});
|
||||
}
|
||||
const { fetchData, state } = userassets()
|
||||
const { fetchData: Apiassets, state } = userassets()
|
||||
const { fetchData: ApigetTotal, state: stateData } = userorderStatistics()
|
||||
useEffect(() => {
|
||||
fetchData();
|
||||
Apiassets();
|
||||
}, [])
|
||||
useDidShow(() => {
|
||||
ApigetTotal()
|
||||
})
|
||||
const checkGo = () => {
|
||||
if (adminUserInfo?.authentication_status === 0 || adminUserInfo?.authentication_status === 1 || adminUserInfo?.authentication_status === 2 || adminUserInfo?.authentication_status === 3) {
|
||||
Taro.showModal({
|
||||
@ -50,7 +55,7 @@ export default () => {
|
||||
}
|
||||
return (
|
||||
<View className={styles.main}>
|
||||
<Header data={adminUserInfo} />
|
||||
<Header data={adminUserInfo} MenuData={stateData} />
|
||||
<Assets data={state} checkShow={() => checkGo()} />
|
||||
<Main />
|
||||
{/* {(adminUserInfo as any)?.authentication_status==1&&<Modal data={adminUserInfo}/>} */}
|
||||
@ -91,6 +96,7 @@ 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" },
|
||||
{ text: "退款/售后", icon: "icon-a-tuikuanshouhou", url: "/pages/orderList/index" }];
|
||||
@ -224,7 +230,37 @@ const Header = memo((props: any) => {
|
||||
<Navigator hoverClass="none" url={item.url} className={styles['card-main-title-content-item']}>
|
||||
<Text className={`iconfont ${item.icon}`}></Text>
|
||||
<View>{item.text}</View>
|
||||
<View className={styles['card-main-title-content-item-badge']}>{index == 2 ? "99+" : 10}</View>
|
||||
{
|
||||
index == 0 && props.MenuData.data.wait_match !== 0 &&
|
||||
<View className={styles['card-main-title-content-item-badge']}>
|
||||
{props.MenuData.data.wait_match > 99 ? '99+' : props.MenuData.data.wait_match}
|
||||
</View>
|
||||
}
|
||||
{
|
||||
index == 1 && props.MenuData.data.wait_pay !== 0 &&
|
||||
<View className={styles['card-main-title-content-item-badge']}>
|
||||
{props.MenuData.data.wait_pay > 99 ? '99+' : props.MenuData.data.wait_pay}
|
||||
</View>
|
||||
}
|
||||
{
|
||||
index == 2 && props.MenuData.data.wait_shipped !== 0 &&
|
||||
<View className={styles['card-main-title-content-item-badge']}>
|
||||
{props.MenuData.data.wait_shipped > 99 ? '99+' : props.MenuData.data.wait_shipped}
|
||||
</View>
|
||||
}
|
||||
{
|
||||
index == 3 && props.MenuData.data.already_shipped !== 0 &&
|
||||
<View className={styles['card-main-title-content-item-badge']}>
|
||||
{props.MenuData.data.already_shipped > 99 ? '99+' : props.MenuData.data.already_shipped}
|
||||
</View>
|
||||
}
|
||||
{
|
||||
index == 4 && props.MenuData.data.after_return !== 0 &&
|
||||
<View className={styles['card-main-title-content-item-badge']}>
|
||||
{props.MenuData.data.after_return > 99 ? '99+' : props.MenuData.data.after_return}
|
||||
</View>
|
||||
}
|
||||
|
||||
</Navigator>
|
||||
)
|
||||
})
|
||||
@ -271,7 +307,7 @@ const Assets = (props: any) => {
|
||||
|
||||
// 功能
|
||||
const Main = memo(() => {
|
||||
let menu = [{ text: "地址管理", icon: "icon-shoucang", url: "/pages/addressManager/index" }, { text: "码单管理", icon: "icon-shoucang", url: "/pages/weightList/index" },
|
||||
let menu = [{ text: "地址管理", icon: "icon-daohang", url: "/pages/addressManager/index" }, { text: "码单管理", icon: "icon-a-yuanmadanmadanguanli", url: "/pages/weightList/index" },
|
||||
{ text: "我的收藏", icon: "icon-shoucang" }, { text: "颜色对比", icon: "icon-yanseduibi", url: "/pages/sampleComparison/index" },
|
||||
{ text: "分享推广", icon: "icon-fenxiang" }, { text: "团队邀请", icon: "icon-yaoqingtuandui" }]
|
||||
return (
|
||||
|
Loading…
x
Reference in New Issue
Block a user