From 0ef88a4490c9eeab0dc283c0b0e0484976a88c2d Mon Sep 17 00:00:00 2001 From: Haiyi <1021441632@qq.com> Date: Wed, 14 Sep 2022 11:57:35 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=F0=9F=A6=84=20refactor:=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=AF=B9=E6=8E=A5100%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/order.ts | 63 ++- src/components/BottomBtns/index.module.scss | 2 + src/components/BottomBtns/index.tsx | 12 +- src/components/shoppingCart/index.module.scss | 16 +- src/components/shoppingCart/index.tsx | 36 +- src/custom-tab-bar/index.module.scss | 2 +- src/pages/index/index.tsx | 2 +- .../components/PayPopup/index.module.scss | 172 +++++++++ src/pages/order/components/PayPopup/index.tsx | 174 +++++++++ .../components/itemList/index.module.scss | 9 +- src/pages/order/components/itemList/index.tsx | 71 ++-- src/pages/order/index.module.scss | 9 +- src/pages/order/index.tsx | 360 +++++++++++++++++- src/pages/searchPage/index.module.scss | 4 + src/styles/iconfont.scss | 15 +- src/styles/iconfont.ttf | Bin 12328 -> 13312 bytes 16 files changed, 878 insertions(+), 69 deletions(-) create mode 100644 src/pages/order/components/PayPopup/index.module.scss create mode 100644 src/pages/order/components/PayPopup/index.tsx diff --git a/src/api/order.ts b/src/api/order.ts index a05a8b1..03ba67b 100644 --- a/src/api/order.ts +++ b/src/api/order.ts @@ -1,4 +1,6 @@ import { useRequest } from "@/use/useHttp" +import { CAP_HTML_TO_IMAGE_BASE_URL } from '@/common/constant' + export const mpenumsaleorderstatus = () => { return useRequest({ url: `/v1/mp/enum/sale/order/status`, @@ -12,7 +14,7 @@ export const mpenumsaleorderstatus = () => { */ export const OrderListApi = () => { return useRequest({ - url: `/v1/mp/saleOrder/list`, + url: `/v2/mp/saleOrder/list`, method: "get", }) } @@ -48,3 +50,62 @@ export const mpenumsaleUserlist = () => { method: "get" }) } +//订单详情 +export const mpsaleOrder = () => { + return useRequest({ + url: `/v2/mp/saleOrder`, + method: "get" + }) +} +//取消订单 +export const mpsaleOrdercancel = () => { + return useRequest({ + url: `/v1/mp/saleOrder/cancel`, + method: "put", + }) +} +//再次购买 +export const mpshoppingCartproductColorlist = () => { + return useRequest({ + url: `/v1/mp/shoppingCart/productColor/list`, + method: "post", + }) +} +//获取账期付款 +export const orderPaymentorderPaymentMethodInfo = () => { + return useRequest({ + url: `/v1/mp/orderPayment/orderPaymentMethodInfo`, + method: "get", + }) +} +//预收单获取接口信息 +export const orderPaymentpreCollectOrderorderPaymentMethodInfo = () => { + return useRequest({ + url: `/v1/mp/orderPayment/preCollectOrder/orderPaymentMethodInfo`, + method: "get", + }) +} +//确认交易 +export const orderPaymentorderPaymentSubmission = () => { + return useRequest({ + url: `/v1/mp/orderPayment/orderPaymentSubmission`, + method: "put", + }) +} +//订单预支付提交 +export const orderPaymentpreCollectOrderorderPaymentSubmission = () => { + return useRequest({ + url: `/v1/mp/orderPayment/preCollectOrder/orderPaymentSubmission`, + method: "put", + }) +} +/** + * 获取在线支付二维码 + */ + export const GetPayCode = () => { + return useRequest({ + url: `/xima-caphtml/caphtml`, + base_url: CAP_HTML_TO_IMAGE_BASE_URL, + method: 'post', + }) + } \ No newline at end of file diff --git a/src/components/BottomBtns/index.module.scss b/src/components/BottomBtns/index.module.scss index 96b645b..6902cd1 100644 --- a/src/components/BottomBtns/index.module.scss +++ b/src/components/BottomBtns/index.module.scss @@ -44,5 +44,7 @@ font-family: PingFangSC-Regular, PingFang SC; font-weight: 400; color: #4581FF; + text-align: center; + line-height: 72px; } } \ No newline at end of file diff --git a/src/components/BottomBtns/index.tsx b/src/components/BottomBtns/index.tsx index 8ab2891..d3cb210 100644 --- a/src/components/BottomBtns/index.tsx +++ b/src/components/BottomBtns/index.tsx @@ -8,9 +8,9 @@ interface prosObj { status?: Number, payment_method?: Number } - cancle?: () => void, - nextBuy?: () => void, - toPay?: () => void, + cancle?: (any) => void, + nextBuy?: (any) => void, + toPay?: (any) => void, } export default memo((props: prosObj) => { @@ -67,13 +67,13 @@ export default memo((props: prosObj) => { return ( { - showCancel && cancle?.()}>取消订单 + showCancel && cancle?.(e)}>取消订单 } { - showBuy && nextBuy?.()}>再次购买 + showBuy && nextBuy?.(e)}>再次购买 } { - canBuy && toPay?.()}>去付款 + canBuy && toPay?.(e)}>去付款 } diff --git a/src/components/shoppingCart/index.module.scss b/src/components/shoppingCart/index.module.scss index 926948b..55a0782 100644 --- a/src/components/shoppingCart/index.module.scss +++ b/src/components/shoppingCart/index.module.scss @@ -116,11 +116,21 @@ } } - .kongOne { - height: 100px; - } + } + .kongOne { + height: 200px; + } + + .loading_more { + height: 300px; + padding-bottom: 200px; + display: flex; + align-items: center; + width: 100%; + justify-content: center; + } .posBox { width: 100%; diff --git a/src/components/shoppingCart/index.tsx b/src/components/shoppingCart/index.tsx index ebe817c..48be533 100644 --- a/src/components/shoppingCart/index.tsx +++ b/src/components/shoppingCart/index.tsx @@ -7,6 +7,7 @@ import Popup from '@/components/popup' import Goods from "@/components/goodsItem" import BottomCustomer from "@/components/BottomCustomer" import VirtualList from '@tarojs/components/virtual-list' +import DotLoading from "@/components/dotLoading" interface prosObj { showPopup?: false | true, @@ -125,21 +126,30 @@ export default memo(forwardRef((props: prosObj, ref) => { - - - {rows} - - - + { + goodList.length > 0 && <> + + + {rows} + + + + + } + { + goodList.length === 0 && <> + 加载中 + + } 0 && clientName !== '' ? false : true} handSure={() => { handSure() }}> diff --git a/src/custom-tab-bar/index.module.scss b/src/custom-tab-bar/index.module.scss index 3075c58..2585e25 100644 --- a/src/custom-tab-bar/index.module.scss +++ b/src/custom-tab-bar/index.module.scss @@ -8,7 +8,7 @@ flex-flow: row nowrap; padding-bottom: env(safe-area-inset-bottom); background-color: #fff; - z-index: 9999; + z-index: 98; box-shadow: 0 11px 7px 8px #c2c2c2; &-line { position: absolute; diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index dd843ce..234eb31 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -98,7 +98,7 @@ export default () => { return it }) setTypeList([...typeList]) - + setGoodlist([]) } const [goodList, setGoodlist] = useState([]) const { fetchData: colorlistFetch } = mpproductcolorlist() diff --git a/src/pages/order/components/PayPopup/index.module.scss b/src/pages/order/components/PayPopup/index.module.scss new file mode 100644 index 0000000..c195f1f --- /dev/null +++ b/src/pages/order/components/PayPopup/index.module.scss @@ -0,0 +1,172 @@ +.popupBox { + position: relative; + z-index: 99999; + background: #f7f7f7; + bottom: 0; + + .contBox { + width: 670px; + padding-bottom: 30px; + // height: 739px; + background: #FFFFFF; + margin-top: 32px; + margin-left: 40px; + overflow: hidden; + + .topMoney { + font-size: 48px; + font-family: PingFangSC-Medium, PingFang SC; + font-weight: 500; + color: #337FFF; + width: 100%; + text-align: center; + margin-bottom: 60px; + } + + .itemMoney { + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 32px; + + .leftFont { + font-size: 28px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #000000; + margin-left: 40px; + } + + .rightFont { + margin-right: 40px; + font-size: 28px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #000000; + } + } + + .line { + width: 590px; + height: 1px; + background: #000000; + opacity: 0.1; + margin-left: 40px; + margin-bottom: 32px; + } + + .itemBox { + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 64px; + + .leftItem { + margin-left: 40px; + display: flex; + align-items: center; + + .leftCrile { + display: flex; + align-items: center; + justify-content: center; + width: 56px; + height: 56px; + border-radius: 50%; + background: #4a7fff; + + .lujing { + color: #FFFFFF; + font-size: 35px; + } + } + + .rightLeft { + margin-left: 30px; + + + .title { + font-size: 28px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #000000; + } + + .nums { + font-size: 22px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #000000; + } + } + } + + .checkYuan { + width: 40px; + height: 40px; + border: 2px solid #D5D5D5; + margin-right: 40px; + border-radius: 50%; + display: flex; + justify-content: center; + align-items: center; + + .gou { + font-size: 20px; + color: #FFFFFF; + } + + } + + .activeChecked { + background: #337fff; + width: 40px; + height: 40px; + border: 2px solid #337fff; + margin-right: 40px; + border-radius: 50%; + display: flex; + justify-content: center; + align-items: center; + + .gou { + font-size: 20px; + color: #FFFFFF; + } + } + + .chakanquanbukehu { + margin-right: 40px; + color: #000000; + font-size: 50px; + } + } + + + } + + + +} + +.sure { + margin-top: 35px; + margin-left: 40px; + width: 670px; + height: 80px; + background: #337FFF; + border-radius: 44px; + font-size: 28px; + font-family: PingFangSC-Medium, PingFang SC; + font-weight: 500; + color: #FFFFFF; + text-align: center; + line-height: 80px; +} + +.pic { + width: 702px; + height: 1500px; + border-radius: 16px; + border: 1px solid #f7f7f7; +} \ No newline at end of file diff --git a/src/pages/order/components/PayPopup/index.tsx b/src/pages/order/components/PayPopup/index.tsx new file mode 100644 index 0000000..232d526 --- /dev/null +++ b/src/pages/order/components/PayPopup/index.tsx @@ -0,0 +1,174 @@ + +import { ScrollView, View, Image } from '@tarojs/components' +import { memo, useCallback, useEffect, useMemo, useState, useRef } from 'react' +import styles from './index.module.scss' +import classnames from 'classnames' +import BottomBtns from '@/components/BottomBtns' +import { formatPriceDiv, formatImgUrl } from '@/common/fotmat' +import Taro from '@tarojs/taro' +import Popup from '@/components/popup' +import useCheckAuthorize from '@/use/useCheckAuthorize' +import { alert } from '@/common/common' + +interface Props { + showPopup: true | false, + popupClose?: () => void, + obj: { + wait_pay_amount?: number | string, + actual_amount?: number | string, + total_sale_price?: number | string, + should_collect_order_id?: number | string, + pre_collect_order_id?: number | string, + status?: number | string, + }, + showSide?: boolean, + list?: any[], + clickItem?: (any) => void, + handsurePay?: (any) => void, + title: string, + picUrl?: string +} + +export default memo((props: Props) => { + const { + showSide = true, + showPopup = false, + popupClose, + obj = { + wait_pay_amount: '', + actual_amount: '', + total_sale_price: '' + }, + clickItem, + handsurePay, + list = [], + title = '待支付款项', + picUrl = '' + } = props + + const fileData = useRef({ + filePath: '', + base64: '', + }) + + //预览图片 + const showImage = () => { + const time = new Date().valueOf() + const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(picUrl) || [] + let filePath = Taro.env.USER_DATA_PATH + '/img' + time + '.' + format + fileData.current.filePath = filePath + fileData.current.base64 = bodyData + const save = Taro.getFileSystemManager() + save.writeFile({ + filePath: fileData.current.filePath, + data: fileData.current.base64, + encoding: 'base64', + }) + Taro.previewImage({ + current: fileData.current.filePath, // 当前显示 + urls: [fileData.current.filePath], // 需要预览的图片http链接列表 + }) + } + + + //检查是否开启保存图片权限 + const { check } = useCheckAuthorize({ scope: 'scope.writePhotosAlbum', msg: '您没授权,无法保存图片' }) + const saveImageCheck = async () => { + const res = await check() + res && saveImage() + } + + //保存图片 + const saveImage = () => { + alert.loading('正在保存图片') + Taro.saveImageToPhotosAlbum({ + filePath: fileData.current.filePath, + success: function () { + alert.success('图片保存成功') + }, + fail: function (err) { + console.log('err::', err) + }, + }) + } + + return ( + + popupClose?.()}> + { + showSide && + + + ¥{formatPriceDiv(obj.wait_pay_amount)} + + + + 订单金额 + + + ¥{formatPriceDiv(obj.total_sale_price)} + + + + + 已付金额 + + + ¥{formatPriceDiv(obj.actual_amount)} + + + + { + list.map((item, index) => { + return ( + clickItem?.(item)}> + + + + + + {item.name} + { + item.fonts && {item.fonts}{ + item.money !== "" ? "¥" : "" + }{item.money} + } + + + { + item.name !== '扫码支付' && + + + + } + { + item.name === '扫码支付' && + + } + + ) + }) + } + + + + } + { + showSide && handsurePay?.(props?.obj)}>确认交易 + } + { + !showSide && + + + showImage()}> + + + + } + { + !showSide && saveImageCheck()}>保存图片 + } + + + ) +}) \ No newline at end of file diff --git a/src/pages/order/components/itemList/index.module.scss b/src/pages/order/components/itemList/index.module.scss index 9670dbd..8695091 100644 --- a/src/pages/order/components/itemList/index.module.scss +++ b/src/pages/order/components/itemList/index.module.scss @@ -2,7 +2,7 @@ margin-top: 38px; overflow: hidden; width: 702px; - height: 536px; + height: 560px; background: #FFFFFF; border-radius: 16px; margin-left: 24px; @@ -14,11 +14,13 @@ margin-top: 24px; .orderNo { + font-size: 28px; font-family: PingFangSC-Medium, PingFang SC; font-weight: 500; color: #000000; margin-left: 32px; + } .status { @@ -93,6 +95,11 @@ align-items: center; .productName { + width: 285px; + height: 34px; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; margin-right: 8px; font-size: 28px; font-family: PingFangSC-Regular, PingFang SC; diff --git a/src/pages/order/components/itemList/index.tsx b/src/pages/order/components/itemList/index.tsx index 8d20f2b..733f357 100644 --- a/src/pages/order/components/itemList/index.tsx +++ b/src/pages/order/components/itemList/index.tsx @@ -3,73 +3,78 @@ import { memo, useCallback, useEffect, useMemo, useState } from 'react' import styles from './index.module.scss' import classnames from 'classnames' import BottomBtns from '@/components/BottomBtns' +import { formatPriceDiv } from '@/common/fotmat' +import Taro from '@tarojs/taro' interface propsObj { - obj: object + obj: any, + cancle?: (arg: any, obj: any) => void, + nextBuy?: (arg: any, obj: any) => void, + toPay?: (arg: any, obj: any) => void } export default memo((props: propsObj) => { - - const { - obj = {} - } = props - - const cancle = (item) => { - - } - const nextBuy = (item) => { - + const navTo = (e) => { + Taro.navigateTo({ + url: '/pages/orderDetails/index?id=' + props?.obj?.id + }) } - const toPay = (item) => { - - } return ( - + navTo(e)}> - 单号:XS-LY-2208220092 - 待接单 + 单号:{props?.obj?.order_no} + {props?.obj?.status_name} - 钟雨乔JENNIEEEEE + {props?.obj?.purchaser_name} - - 颜色 (1) + + 颜色 ({props?.obj?.total_colors}) - 9265# 26S全棉双卫衣 - 大货 + {props?.obj?.product_list[0]?.code} {props?.obj?.product_list[0]?.name} + {props?.obj?.sale_mode === 0 ? '大货' : props?.obj?.sale_mode === 1 ? '剪版' : '散剪'} - 物流 + {props?.obj?.shipment_mode_name} - 051# 花灰白 - x5m - ¥ 37.50/kg + {props?.obj?.product_list[0]?.product_colors[0]?.code} {props?.obj?.product_list[0]?.product_colors[0]?.name} + x{props?.obj?.sale_mode === 0 ? props?.obj?.product_list[0]?.product_colors[0]?.roll : props?.obj?.product_list[0]?.product_colors[0]?.length / 100} {props?.obj?.sale_mode === 0 ? '条' : 'm'} + ¥ {props?.obj?.product_list[0]?.product_colors[0]?.sale_price / 100}/kg + { + props?.obj?.product_list[0]?.product_colors?.length > 1 && <> + + {props?.obj?.product_list[0]?.product_colors[1]?.code} {props?.obj?.product_list[0]?.product_colors[1]?.name} + x{props?.obj?.sale_mode === 0 ? props?.obj?.product_list[0]?.product_colors[1]?.roll : props?.obj?.product_list[0]?.product_colors[1]?.length / 100} {props?.obj?.sale_mode === 0 ? '条' : 'm'} + ¥ {props?.obj?.product_list[0]?.product_colors[1]?.sale_price / 100}/kg + + + } 布料信息: - 2 种面料,4 种颜色,共 5 米 + {props?.obj?.total_fabrics} 种面料,{props?.obj?.total_colors} 种颜色,共 {props?.obj?.sale_mode === 0 ? props?.obj?.total_number : props?.obj?.total_number / 100} {props?.obj?.sale_mode === 0 ? '条' : 'm'} 预估金额: - ¥3564.00 + ¥{formatPriceDiv(props?.obj?.estimate_amount)} cancle(obj)} - nextBuy={() => nextBuy(obj)} - toPay={() => toPay(obj)} + obj={props?.obj} + cancle={(e) => props?.cancle?.(e, props?.obj)} + nextBuy={(e) => props?.nextBuy?.(e, props?.obj)} + toPay={(e) => props?.toPay?.(e, props?.obj)} > - + ) }) \ No newline at end of file diff --git a/src/pages/order/index.module.scss b/src/pages/order/index.module.scss index 9e49602..14d39ae 100644 --- a/src/pages/order/index.module.scss +++ b/src/pages/order/index.module.scss @@ -34,6 +34,8 @@ } .popupBox { + padding-bottom: calc($customTabBarHeight + env(safe-area-inset-bottom)); + .topBox { display: flex; padding-left: 48px; @@ -193,7 +195,7 @@ height: 160px; background: #FFFFFF; position: fixed; - bottom: 0; + bottom: calc($customTabBarHeight + env(safe-area-inset-bottom)); z-index: 99; display: flex; padding-top: 16px; @@ -241,6 +243,11 @@ line-height: 80px; } } + + // .areaBox { + // height: calc($customTabBarHeight + env(safe-area-inset-bottom)); + // width: 100%; + // } } diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index 0d672cc..907e626 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -8,8 +8,19 @@ import styles from "./index.module.scss" import classnames from "classnames"; import Popup from '@/components/popup' import InfiniteScroll from '@/components/infiniteScroll' -import Taro, { useDidShow } from '@tarojs/taro' +import Taro, { faceVerifyForPay, useDidShow } from '@tarojs/taro' import ItemList from './components/itemList' +import { + mpsaleOrdercancel, + mpshoppingCartproductColorlist, + orderPaymentorderPaymentMethodInfo, + orderPaymentpreCollectOrderorderPaymentMethodInfo, + orderPaymentorderPaymentSubmission, + orderPaymentpreCollectOrderorderPaymentSubmission, + GetPayCode +} from '@/api/order' +import PayPopup from './components/PayPopup' +import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/fotmat' export default () => { //页码和页数 @@ -227,6 +238,331 @@ export default () => { useEffect(() => { getOrderStatusList() }, []) + + const { fetchData: cancelFetch } = mpsaleOrdercancel() + //取消订单 + const cancle = async (e, item) => { + e.stopPropagation(); + Taro.showModal({ + content: "确定要取消吗?", + confirmText: "确认", + cancelText: "取消", + success: async function (res) { + if (res.confirm) { + Taro.showLoading({ + title: '请稍等...', + mask: true + }) + const res = await cancelFetch({ id: item.id }) + if (res.msg === 'success') { + Taro.showToast({ + title: '取消成功' + }) + Taro.hideLoading() + getOrderList() + } else { + Taro.showToast({ + title: res.msg, + icon: 'error' + }) + } + } + } + }) + } + //再次购买 + const { fetchData: buyFetch } = mpshoppingCartproductColorlist() + const nextBuy = async (e, item) => { + e.stopPropagation(); + Taro.showLoading({ + title: '请稍等...', + mask: true + }) + let arr: any = [] + item.product_list.forEach(item => { + item.product_colors.forEach(it => { + arr.push({ + length: it.length, + roll: it.roll, + product_color_id: it.id + }) + }) + }) + let query = { + purchaser_id: item.purchaser_id, + sale_mode: item.sale_mode, + color_list: arr + } + const res = await buyFetch(query) + if (res.msg === 'success') { + Taro.showToast({ + title: '加入购物车成功!' + }) + Taro.hideLoading() + getOrderList() + } else { + Taro.showToast({ + title: res.msg, + icon: 'error' + }) + } + } + //去支付逻辑 + const { fetchData: infoOneFetch } = orderPaymentorderPaymentMethodInfo() + const { fetchData: infoTwoFetch } = orderPaymentpreCollectOrderorderPaymentMethodInfo() + const [itemObj, setItemObj] = useState({}) + const [payList, setPayList] = useState([ + { + id: 2, + iconfont: "icon-xianxiahuizong", + name: "预存款", + fonts: "可用额度 ", + money: "", + isCheck: false, + }, + { + id: 5, + iconfont: "icon-xianxiahuizong", + name: "货到付款", + fonts: "发货后3天内付款", + isCheck: false, + money: "", + }, + { + id: 3, + iconfont: "icon-xianxiahuizong", + name: "x天账期", + fonts: "可用额度 ", + money: "", + isCheck: false, + }, + { + iconfont: "icon-saomiao", + name: "扫码支付", + }, + ]) + const toPay = async (e, item) => { + e.stopPropagation(); + + setItemObj(item) + if (item.status !== 10) { + let res = await infoOneFetch({ id: item.should_collect_order_id }) + payList.map((item) => { + if (item.id === 3) { + item.name = `${res.data.account_period}天账期`; + item.fonts = `可用额度${formatPriceDiv( + res.data.account_period_credit_available_line + ).toLocaleString()}`; + } + if (item.id === 2) { + item.fonts = `可用额度${formatPriceDiv( + res.data.advance_deposit_balance + ).toLocaleString()}`; + } + return item; + }); + setPayList([...payList]) + if (item.is_shipper_picks_up) { + const obj = payList.filter((item) => { + return item.id === 6; + }); + console.log(obj, "456456"); + if (obj.length === 0) { + payList.unshift({ + id: 6, + iconfont: "icon-xianxiahuizong", + name: "货主自提", + fonts: "", + money: "", + isCheck: false, + }); + setPayList([...payList]) + } + } + } else { + let res = await infoTwoFetch({ id: item.pre_collect_order_id }) + const arr: any = []; + arr.push( + { + id: 2, + iconfont: "icon-xianxiahuizong", + name: "预存款", + fonts: `可用额度${formatPriceDiv( + res.data.advance_deposit_balance + ).toLocaleString()}`, + money: "", + isCheck: false, + }, + { + iconfont: "icon-saomiao", + name: "扫码支付", + } + ); + if (item.is_shipper_picks_up) { + const obj = arr.filter((item) => { + return item.id === 6; + }); + if (obj.length === 0) { + arr.unshift({ + id: 6, + iconfont: "icon-xianxiahuizong", + name: "货主自提", + fonts: "", + money: "", + isCheck: false, + }); + } + } + setPayList([...arr]) + } + setShowSide(true) + setShowPay(true) + } + + //选择支付方式 + const clickItem = (item) => { + if (item.name === '扫码支付') { handScanpay() } + payList.map(it => { + if (item.id === it.id) { + it.checked = true + } else { + it.checked = false + } + return it + }) + setPayList([...payList]) + } + + + //扫码支付 + const [showSide, setShowSide] = useState(true) + const [title, setTitle] = useState('') + const [picUrl, setPicUrl] = useState('') + const { fetchData: payFetch } = GetPayCode() + const handScanpay = async () => { + const list: any = []; + itemObj.product_list.forEach((item) => { + item.product_colors.forEach((it) => { + list.push({ + product_code: item.code, + product_name: item.name, + product_color_code: it.product_color_code, + product_color_name: it.product_color_name, + num: it.roll.toString(), + weight: formatWeightDiv(it.actual_weight).toString(), + sale_price: (it.sale_price / 100).toString(), + total_price: + it.actual_amount !== 0 + ? (it.actual_amount / 100).toString() + : (it.estimate_amount / 100).toString(), + length: (it.length / 100).toString(), + weight_error: formatWeightDiv(it.weight_error).toString(), + }); + }); + }); + const query = { + list: list, + title: "面料销售电子确认单", + show_qrcode: true, + show_barcode: true, + show_wait_pay_amount: true, + order_type: itemObj.sale_mode_name, + shipment_mode: itemObj.shipment_mode_name, + company: itemObj.title_purchaser_name, + sale_user: itemObj.sale_user_name, + order_created_time: formatDateTime(itemObj.create_time), + order_no: itemObj.order_no, + target_user_name: itemObj.target_user_name, + target_address: itemObj.address_detail, + target_description: itemObj.remark, + pay_account: itemObj.transfer_remittance_account, + bank_account_name: itemObj.account_name, + bank_name: itemObj.bank_of_deposit, + pay_type: itemObj.settle_mode_name, + client: itemObj.purchaser_name, + phone: itemObj.target_user_phone, + order_total_length: (itemObj.total_number / 100).toString(), + order_total_price: ( + itemObj.bill_total_sale_price / 100 + ).toString(), + total_weight_error_discount: ( + itemObj.total_weight_error_discount / 100 + ).toString(), + order_total_num: itemObj.total_number.toString(), + qrcode: "", + order_total_weight: (itemObj.total_weight / 1000).toString(), + estimate_amount: (itemObj.estimate_amount / 100).toString(), + total_sale_price: (itemObj.total_sale_price / 100).toString(), + show_total_sale_price: true, + show_total_weight_error_discount: true, + actual_amount: (itemObj.payment_amount / 100).toString(), + wait_pay_amount: (itemObj.wait_pay_amount / 100).toString(), + order_total_weight_error: ( + itemObj.total_weight_error / 1000 + ).toString(), + }; + const res = await payFetch(query) + if (res.data) { + console.log(res.data.base64) + setShowSide(false) + setTitle('查看销售码单') + setPicUrl(res.data.base64) + } + } + + + //确认交易 + const { fetchData: payOneFetch } = orderPaymentorderPaymentSubmission() + const { fetchData: payTwoFetch } = orderPaymentpreCollectOrderorderPaymentSubmission() + const handsurePay = (obj) => { + let arr: any = [] + // if (obj.status !== 10) { + arr = payList.filter(item => { + return item.checked + }) + if (!arr.length) { + Taro.showToast({ + title: '请选择后再提交', + icon: 'error' + }) + return false + } + + Taro.showModal({ + content: "确定交易吗?", + confirmText: "确认", + cancelText: "取消", + success: async function (res) { + if (res.confirm) { + Taro.showLoading({ + title: '请稍等...', + mask: true + }) + const restult = await obj.status !== 10 ? payOneFetch({ id: Number(obj.should_collect_order_id), payment_method: Number(arr[0]?.id) }) : payTwoFetch({ id: Number(obj.pre_collect_order_id), payment_method: Number(arr[0]?.id) }) + if (restult?.msg === 'success') { + Taro.showToast({ + title: '交易成功' + }) + Taro.hideLoading() + setShowPay(false) + getOrderList() + } else { + Taro.showToast({ + title: restult?.msg, + icon: 'error' + }) + } + } + + } + }) + + // } + } + + //显示支付 + const [showPay, setShowPay] = useState(false) + return ( @@ -250,7 +586,13 @@ export default () => { {orderData?.list?.map((item, index) => { return ( - + cancle(e, item)} + nextBuy={(e, item) => nextBuy(e, item)} + toPay={(e, item) => toPay(e, item)} + > ) })} @@ -314,8 +656,20 @@ export default () => { + {/* */} - + setShowPay(false)} + clickItem={(item) => clickItem(item)} + handsurePay={(obj) => handsurePay(obj)} + showSide={showSide} + title={title} + picUrl={picUrl} + > + ) } diff --git a/src/pages/searchPage/index.module.scss b/src/pages/searchPage/index.module.scss index e1d5389..c3b0862 100644 --- a/src/pages/searchPage/index.module.scss +++ b/src/pages/searchPage/index.module.scss @@ -1,3 +1,7 @@ +page { + background: #ffff; +} + .main { background: #ffff; diff --git a/src/styles/iconfont.scss b/src/styles/iconfont.scss index 5da1113..0525f3a 100644 --- a/src/styles/iconfont.scss +++ b/src/styles/iconfont.scss @@ -1,9 +1,9 @@ /* CDN 服务仅供平台体验和调试使用,平台不承诺服务的稳定性,企业客户需下载字体包自行发布使用并做好备份。 */ @font-face { - font-family: 'iconfont'; /* Project id 3619513 */ - src: url('//at.alicdn.com/t/c/font_3619513_g8r6ax9bp1n.woff2?t=1662609560991') format('woff2'), - url('//at.alicdn.com/t/c/font_3619513_g8r6ax9bp1n.woff?t=1662609560991') format('woff'), - url('//at.alicdn.com/t/c/font_3619513_g8r6ax9bp1n.ttf?t=1662609560991') format('truetype'); + font-family: 'iconfont'; + /* Project id 3619513 */ + src: url('iconfont.ttf?t=1663065236955') format('truetype'); + } .iconfont { @@ -14,6 +14,10 @@ -moz-osx-font-smoothing: grayscale; } +.icon-lujing:before { + content: "\e63e"; +} + .icon-yewuyuanqizi:before { content: "\e639"; } @@ -228,5 +232,4 @@ .icon-gouwu:before { content: "\e607"; -} - +} \ No newline at end of file diff --git a/src/styles/iconfont.ttf b/src/styles/iconfont.ttf index baa548bbf299b381a5628f7fd7315cccdd538a58..049f955e0709f9957fdc3b9ada042b3f7975c69c 100644 GIT binary patch delta 2213 zcmY+EU2GIp6vxk**_r8dcV>3CyR$8|yWMTO)6(tdZg=_EZRI0;ly5W?un}r0-6Ach zfK?NBH3XB!5Ns2}1DY6+7=xz5i!nSHo_HZ4kq0D1Fq(NlqG%v$0=u5GLu#1zH|O5D z=bn4_KmWO3>@DU`MGK48hXC+H0N6V^Idb^7YEKS8xDDVsGk)-`{hwXA{|kWf5Fmao zKQ^+jX~)YglzW#*=jnkuBaKn}GSQr$JTm=Pd$~mQ?o9DSGMwmp8kDWjP5bAkHGD!B-~k}1-QYH<`$$2;(OGs0--WYd!U$wxdJj0`WF*A`kz630#yn!O>MDpj@7NfH!9a*W6X1X8qNt6Rv<*X(cFDQ0Qyl!VN0H*K#iFKqbMJ9H=$q0761AEGT&Vi%_yTJjH6vGa{DnuOk_1TRMz$!!? zfK^}x2+#`DU~}lsz~7-wM-4;Y3Vj(4m9K|R z8`upeuochXMZ77j6J|uOcuc(IGF^kNS6nwFT{%6<^bu>k8<8d`K(mcujAq zM^EVm@wi7=)S^EgCO7c!DxVW?i^J6Ru+%llXm8LLXo|-Ad?~3P!>FK+UD%2J7{QiV zVRm-*$<(aym9{wUahHD7di-|{Y)JU##g}-16MptrhZfhARtFU0j<=9#6t#I4t^BEL zT-?uwp;}=y5OpEmg-=VPI3L`wGU%5|;BIQQyh^E9FC;gG73>iE8hx$nV^vSUXUc9( z#$x@ZrE;BI`hngssZn%c<>;)Vb0P<8U>A(SB&`w+gu++|nZ22Q%%oFRCtC5CqN5^9 zy`fH_DW+pE5HdqbCS)diGjWTAw0g~e9E+#Y3g5URr8<#Q17W13kd@A)EgnnqU~-`) zKnYr{lf!$i?-@R6wJtOZR;zGG^{6ZM_GR~HYt43Zlh#(Nx@Ao6SmiN{x?u3677W%I z23}7M^`v$rlRHvoBIj!knE$Gprc%yim9AHLyapEY&lZ2Wjt>)S+h|&c)e>GA7gP+@ zc5my-8dS8dU}TJ1FEuZ=4<-_WLmS%N(M)}$X+Zbs3;z`#Tob<$pQqDu6>KK)dc!1+ ztb{RSQf$X`Uq!&4rnr@C>c_qmy}D;}$TM-PFU4Ya(s)1CC~^b~X72!|EnzgZGr4xj z#&=@PZ4FzbX!OW>^!Wr~^-!eY^W1oDX!Z8v@pyOa$&F|?#^cAguO6bO-GUU6{DdI< zliHOU7!ByVR;=3C(54yN2G@>6G%Q1+#M}I;IA2DK5k1n8h5(2ag_@m>O3POuU^xIyo^p;vVT( hXnWoqo0y)M+BY^ee(RA3L^`<8-J?iKY{sY8#zsmps delta 1245 zcmY+DOGs2v7{~wj-g&<@D=i=6tA}YeJsbs5XjKRi644^a@sU!F4k=|KTxrqD#neE! zNC?`rkO+)$5mFE#Ev!|GkaG1cB9s;eL16!Hju6f8JNKM(&pF@s|9|Jsjy&tj*SZzw zgMc*$pl=|X$@%VV4FUEl;JG|JdiVOL-bV|7KM&N8jtpf6YZq?!aP0Q#q>#5BR>EJzUR}xU<;#*QARxoQ;M1C$7aiw-GjLzjar%>N4}( zdE$X{k;4G&-OYMZ8ig7wXQ7a{x~n>hq2R1zmaqN~WIwdG+?CzQWjMuNGoK-@Tw!8r zpof2Mla8GowjOOc)^twcG|r$6tvG=cPNE9cs6i67s6#y((1=4gj3YRTCLBXET5z2E zyzs%#jDw64Mx-$4)H)9ArN>U(a_4!h{@OH@fngwC0|P>Q28M?C4aM~V_6gI0u=)xU zgHVjZ6d_>)lZ8YKOdAq4xKsd%8K?ykH&7KMVW2)piGfNXr3Pw->@iS1q|87cAbSmT z1hUUSZy@^(bO}-pR~yhUNQHscK@J#bBIKZfc0wu*G!~*N2rY)F2%<$26+vh_Bxzs) zAS!~e6c80b5OCR16@>MHs0yO@K~x1{%^<3RKrK`i1ZttGAW#QY1c5rJA_&w$6+xg5 zst5vgP(`?GpcbkM0<}=^?nhk zgJ}b=JzQz$fav!m9fsZSLxXl=5u4Ve^~LV8r|swVd#ByG<*a$mdVYB?c<*`FeD{6J z{!0I(UjqGsxxi{L6zmPY3bd^{ANiLWHe j5;qdTH;K)Xu9BIOS4+*|?M5qIs7sAmSo)Ys+05uKpvvjv From b328419b96c0bfb224bc65688d1a7665557e3fa2 Mon Sep 17 00:00:00 2001 From: xuan Date: Tue, 13 Sep 2022 15:37:37 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=F0=9F=8E=88=20perf(=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2):=20=E5=AE=8C=E5=96=84=E7=99=BB=E9=99=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.tsx | 10 +- src/pages/login/index.tsx | 1 + src/pages/user/index.tsx | 2 +- src/use/useHttp.ts | 9 +- src/use/useLoginRequest.ts | 203 ++++++++++++++++++------------------- 5 files changed, 117 insertions(+), 108 deletions(-) diff --git a/src/app.tsx b/src/app.tsx index 9636423..039f54b 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -6,8 +6,14 @@ import './app.scss' import Taro, { onAppShow, useDidShow } from '@tarojs/taro' import { shareShop } from './common/util' +type ParamsType = { + children?: React.ReactNode +} + const store = configStore() -const App: FC = (params) => { +const App: FC = (params) => { + const { children } = params + Taro.showShareMenu({ withShareTicket: true, }) @@ -41,7 +47,7 @@ const App: FC = (params) => { return ( - {params.children} + {children} ) } diff --git a/src/pages/login/index.tsx b/src/pages/login/index.tsx index efb0c12..12079c6 100644 --- a/src/pages/login/index.tsx +++ b/src/pages/login/index.tsx @@ -76,6 +76,7 @@ const Login: FC = () => { } } + return ( diff --git a/src/pages/user/index.tsx b/src/pages/user/index.tsx index 1564ce4..92cbdd2 100644 --- a/src/pages/user/index.tsx +++ b/src/pages/user/index.tsx @@ -140,7 +140,7 @@ const UserInfo: FC = () => { - IT部门 + {userInfo.userInfo.department_name} IT-开发总监 diff --git a/src/use/useHttp.ts b/src/use/useHttp.ts index 5ff8104..c21dc07 100644 --- a/src/use/useHttp.ts +++ b/src/use/useHttp.ts @@ -181,7 +181,14 @@ export const useRequest = ( removeToken() // removeSessionKey() removeUserInfo() - login() + // 跳转回登录页面 + login().catch((err)=>{ + if (err){ + Taro.reLaunch({ + url: '/pages/login/index', + }) + } + }) } else { Taro.showToast({ title: `错误:${showStatus(statusCode)}`, diff --git a/src/use/useLoginRequest.ts b/src/use/useLoginRequest.ts index 9bf6122..f6da249 100644 --- a/src/use/useLoginRequest.ts +++ b/src/use/useLoginRequest.ts @@ -1,113 +1,108 @@ -import {BASE_URL, WX_APPID } from "@/common/constant" -import Taro, { useRouter } from "@tarojs/taro" -import { useRef, useState } from "react" -import qs from 'qs' -import useUserInfo from "./useUserInfo" -import useLogin from "./useLogin" +import { BASE_URL, WX_APPID } from '@/common/constant' +import Taro, { useRouter } from '@tarojs/taro' +import { useRef, useState } from 'react' +import qs from 'qs' +import useUserInfo from './useUserInfo' +import useLogin from './useLogin' //开这个hook 主要是为了让useHttp 能够调用 -type Param = {success: true|false, data: any, msg: string, code: null|number, loading: false|true} +type Param = { success: boolean; data: any; msg: string; code: null | number; loading: boolean } let loginStatus = false //登录状态,true登录中 export default () => { - - let initData = { - success: false, - data: null, - msg: '', - code: null, - loading: false - } - let loginData = useRef(initData) - const {setToken, setSessionKey} = useUserInfo() - const router = useRouter() - //微信登录请求v2 - const fetchDataLogin = async (login_code) => { - const q = { - url: BASE_URL + '/v1/mall/login', - header: { - "Platform": 3, - "Appid": WX_APPID, - }, - method: 'post', - data:{js_code: login_code} - } - try{ - const result = await Taro.request(q as any) - const {code, data, msg} = result.data - if(result.statusCode === 200) { - loginData.current.success = (code === 0 ? true : false) - loginData.current.code = code - loginData.current.msg = msg - loginData.current.data = data - } else { - Taro.showToast({ - title: `错误:登录失败`, - icon: 'none' - }) - console.log('登录错误:', result.errMsg) - - } - }catch(e) { - Taro.showToast({ - title: `错误:登录失败`, - icon: 'none' + let initData = { + success: false, + data: null, + msg: '', + code: null, + loading: false, + } + let loginData = useRef(initData) + const { setToken, setSessionKey } = useUserInfo() + const router = useRouter() + //微信登录请求v2 + const fetchDataLogin = async (login_code) => { + const q = { + url: BASE_URL + '/v1/mall/login', + header: { + Platform: 3, + Appid: WX_APPID, + }, + method: 'post', + data: { js_code: login_code }, + } + try { + const result = await Taro.request(q as any) + const { code, data, msg } = result.data + if (result.statusCode === 200) { + loginData.current.success = code === 0 ? true : false + loginData.current.code = code + loginData.current.msg = msg + loginData.current.data = data + } else { + Taro.showToast({ + title: `错误:登录失败`, + icon: 'none', + }) + console.log('登录错误:', result.errMsg) + } + } catch (e) { + Taro.showToast({ + title: `错误:登录失败`, + icon: 'none', + }) + console.log('登录错误:', e.errMsg) + } + return loginData.current + } + + //微信登录 + const login = () => { + return new Promise((resolve, reject) => { + if (loginStatus) return reject(false) + loginStatus = true + Taro.login({ + success: async (res) => { + if (res.code) { + const { data, success, msg } = await fetchDataLogin(res.code) + if (success) { + setToken(data.token) + setSessionKey(data.session_key) + resolve(data) + let params = router.params + delete params.$taroTimestamp + if (router.path === '/pages/index/index' || router.path === '/pages/user/index') { + Taro.reLaunch({ + url: router.path + '?' + qs.stringify(params), }) - console.log('登录错误:', e.errMsg) - } - return loginData.current - } - - //微信登录 - const login = () => { - if(loginStatus) return false - loginStatus = true - return new Promise((reslove, reject) => { - Taro.login({ - success: async (res) => { - if (res.code) { - const {data, success, msg} = await fetchDataLogin(res.code) - if(success) { - setToken(data.token) - setSessionKey(data.session_key) - reslove(data) - let params = router.params - delete params.$taroTimestamp - if(router.path === '/pages/index/index' || router.path === '/pages/user/index') { - Taro.reLaunch({ - url: router.path +'?' + qs.stringify(params) - }) - } else { - Taro.redirectTo({ - url: router.path +'?' + qs.stringify(params) - }) - } - } else { - Taro.showToast({ - title:'登录失败', - icon:"none" - }) - reject(msg) - } - } else { - console.log('登录失败!' + res.errMsg) - reject(res.errMsg) - } - loginStatus = false - }, - fail: function(e) { - console.log('登录失败!::',e) - reject(e) - loginStatus = false - } + } else { + Taro.redirectTo({ + url: router.path + '?' + qs.stringify(params), }) - }) - - } - - return { - login - } + } + } else { + Taro.showToast({ + title: '登录失败', + icon: 'none', + }) + reject(msg) + } + } else { + console.log('登录失败!' + res.errMsg) + reject(res.errMsg) + } + loginStatus = false + }, + fail: function (e) { + console.log('登录失败!::', e) + reject(e) + loginStatus = false + }, + }) + }) + } + return { + login, + } } - From 48e59860606bd7b32644dd236feb2908187af7b9 Mon Sep 17 00:00:00 2001 From: xuan Date: Tue, 13 Sep 2022 14:52:04 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E2=9C=A8=20feat(=E6=A0=B7=E5=93=81?= =?UTF-8?q?=E5=AF=B9=E6=AF=94):=20=E5=B7=B2=E7=A7=BB=E6=A4=8DEShop?= =?UTF-8?q?=E7=9A=84=E6=A0=B7=E5=93=81=E5=AF=B9=E6=AF=94=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.ts | 1 + src/api/product/index.ts | 1 + src/api/product/product.ts | 9 + src/app.config.ts | 7 +- src/components/iconCard/index.tsx | 9 +- .../compoents/bluetooth/LinkBlueTooth.tsx | 82 ++++++ .../compoents/bluetooth/Popup.tsx | 79 ++++++ .../css/linkBlueTooth.module.scss | 42 +++ .../sampleComparison/css/popup.module.scss | 90 +++++++ src/pages/sampleComparison/index.config.ts | 4 + src/pages/sampleComparison/index.module.scss | 251 ++++++++++++++++++ src/pages/sampleComparison/index.tsx | 186 +++++++++++++ src/pages/user/index.tsx | 181 ++++++------- 13 files changed, 848 insertions(+), 94 deletions(-) create mode 100644 src/api/product/index.ts create mode 100644 src/api/product/product.ts create mode 100644 src/pages/sampleComparison/compoents/bluetooth/LinkBlueTooth.tsx create mode 100644 src/pages/sampleComparison/compoents/bluetooth/Popup.tsx create mode 100644 src/pages/sampleComparison/css/linkBlueTooth.module.scss create mode 100644 src/pages/sampleComparison/css/popup.module.scss create mode 100644 src/pages/sampleComparison/index.config.ts create mode 100644 src/pages/sampleComparison/index.module.scss create mode 100644 src/pages/sampleComparison/index.tsx diff --git a/src/api/index.ts b/src/api/index.ts index 8068a8b..f8f41e4 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,6 +1,7 @@ export {LoginApi} from './login/index' +export { productabsorbcontrast } from './product/index' import { useRequest } from "@/use/useHttp" /** diff --git a/src/api/product/index.ts b/src/api/product/index.ts new file mode 100644 index 0000000..c256c79 --- /dev/null +++ b/src/api/product/index.ts @@ -0,0 +1 @@ +export { productabsorbcontrast } from './product' diff --git a/src/api/product/product.ts b/src/api/product/product.ts new file mode 100644 index 0000000..6d8354a --- /dev/null +++ b/src/api/product/product.ts @@ -0,0 +1,9 @@ +import { useRequest } from "@/use/useHttp" + +//取色对比 +export const productabsorbcontrast = () => { + return useRequest({ + url: `/v1/mall/product/color/absorb/contrast`, + method: 'get', + }) +} diff --git a/src/app.config.ts b/src/app.config.ts index f2eaed8..0a10a57 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -49,5 +49,10 @@ export default defineAppConfig({ 'custom-wrapper': '/custom-wrapper', ...useGlobalIconFont(), }, - subPackages: [], + subPackages: [ + { + root: 'pages/sampleComparison', + pages: ['index'], + }, + ], }) diff --git a/src/components/iconCard/index.tsx b/src/components/iconCard/index.tsx index 4c834a4..8008228 100644 --- a/src/components/iconCard/index.tsx +++ b/src/components/iconCard/index.tsx @@ -1,6 +1,6 @@ -import { View } from "@tarojs/components" -import { FC, ReactNode } from "react" -import IconFont from "../iconfont" +import { View } from '@tarojs/components' +import { FC, ReactNode } from 'react' +import IconFont from '../iconfont' import styles from './index.module.scss' import classname from 'classnames' @@ -16,8 +16,9 @@ interface PropsType { iconSize?: number } const IconCard: FC = (props) => { - const { iconName, title, onClick, customClass = '', iconSize=72 } = props + const { iconName, title, onClick, customClass = '', iconSize = 72 } = props const handleClick = (event) => { + console.log(event) onClick && onClick(event) } return ( diff --git a/src/pages/sampleComparison/compoents/bluetooth/LinkBlueTooth.tsx b/src/pages/sampleComparison/compoents/bluetooth/LinkBlueTooth.tsx new file mode 100644 index 0000000..a2c1478 --- /dev/null +++ b/src/pages/sampleComparison/compoents/bluetooth/LinkBlueTooth.tsx @@ -0,0 +1,82 @@ +import { View } from '@tarojs/components' +import { memo, useEffect, useMemo, useState } from 'react' +import Taro from '@tarojs/taro' +import { useBluetooth } from '@/use/contextBlueTooth' +import SearchInput from '@/components/searchInput' +import Popup from './Popup' +import classnames from 'classnames' +import styles from '../../css/linkBlueTooth.module.scss' + +export default memo(() => { + const { state, init, startScan, connect, disconnect } = useBluetooth() + + useEffect(() => { + init() + }, []) + + const [linkStatus, setLinkStatus] = useState(1) + useEffect(() => { + if (!state.available) { + setLinkStatus(1) + } else if (state.available && state.connected?.name) { + setLinkStatus(3) + } else { + setLinkStatus(2) + } + }, [state.available, state.connected]) + + const linkName = useMemo(() => { + return state.connected?.localName || '' + }, [state.connected]) + + //链接设备 + const onLinkListen = (item) => { + if (!state.connected && !state.connecting) connect(item) + } + + const [popupShow, setPopupShow] = useState(false) + //显示设备列表 + const onFindDevice = () => { + if (linkStatus == 1) { + Taro.showToast({ + title: '请打开蓝牙', + icon: 'none', + }) + } else { + setPopupShow(true) + onFindEven() + } + } + const onFindEven = () => { + if (!state.discovering && !state.connected && !state.connecting) startScan() + } + + //断开链接 + const onDisconnect = () => { + disconnect() + setPopupShow(false) + } + + return ( + <> + + + + + {(linkStatus == 1 && 请开启蓝牙) || + (linkStatus == 2 && 未连接设备) || + (linkStatus == 3 && {linkName})} + + + setPopupShow(false)} + onLink={(item) => onLinkListen(item)} + onOff={onDisconnect} + onFind={onFindEven} + /> + + + ) +}) diff --git a/src/pages/sampleComparison/compoents/bluetooth/Popup.tsx b/src/pages/sampleComparison/compoents/bluetooth/Popup.tsx new file mode 100644 index 0000000..ad81e1f --- /dev/null +++ b/src/pages/sampleComparison/compoents/bluetooth/Popup.tsx @@ -0,0 +1,79 @@ +import { ScrollView, View } from '@tarojs/components' +import { memo, useEffect, useState } from 'react' +import Loading from '@/components/loading' +import style from '../../css/popup.module.scss' + +interface params { + state: any + show: Boolean + onClose: (Boolean) => void + onLink: (any) => void + children?: React.ReactNode + onOff: () => void + onFind: () => void +} + +export default memo(({ state, show = false, onClose, onLink, onOff, onFind }: params) => { + const [popupShow, setPopupShow] = useState(show) + useEffect(() => { + setPopupShow(show) + }, [show]) + const onCloseListener = () => { + onClose(false) + } + + return ( + <> + {popupShow && ( + + + 搜索设备 + + + {(state.devices && + state.devices.length > 0 && + state?.devices.map((item) => { + return ( + onLink(item)}> + {item.name} + {(!state.connecting && !state.connected && 链接) || + (state.connecting && item.deviceId == state.connecting.deviceId && 正在链接...) || + (state.connected && item.deviceId == state.connected.deviceId && 链接成功)} + + ) + })) || ( + + {(!state.discovering && ( + <> + 暂无设备,请按以下条件检查 + 1.请确保取色仪处于激活状态 + 2.请确保取色仪没有链接其他设备 + 3.请打开手机定位 + + )) || 设备搜索中} + + )} + + + {(state.connected && ( + + 断开链接 + + )) || + (!state.connected && state.discovering && ( + + 搜索中 + + + )) || ( + + 重新搜索 + + )} + + + + )} + + ) +}) diff --git a/src/pages/sampleComparison/css/linkBlueTooth.module.scss b/src/pages/sampleComparison/css/linkBlueTooth.module.scss new file mode 100644 index 0000000..0714b46 --- /dev/null +++ b/src/pages/sampleComparison/css/linkBlueTooth.module.scss @@ -0,0 +1,42 @@ +.main { + width: 690px; + height: 86px; + background: #ffffff; + border-radius: 10px; + margin-top: 24px; + margin-left: 30px; + + .bluetooth_link { + display: flex; + align-items: center; + + .link_status { + width: 12px; + height: 12px; + background: #f02409; + border-radius: 50%; + } + + .link_statused { + background: #07C160; + } + + .link_statused_no { + background: #f0ec09; + } + + .link_name { + font-size: $font_size; + margin-left: 20px; + + } + + .link_name_no { + color: #f02409; + } + + .link_name_no_link { + color: #f0ec09; + } + } +} \ No newline at end of file diff --git a/src/pages/sampleComparison/css/popup.module.scss b/src/pages/sampleComparison/css/popup.module.scss new file mode 100644 index 0000000..d6c273f --- /dev/null +++ b/src/pages/sampleComparison/css/popup.module.scss @@ -0,0 +1,90 @@ +.popup{ + width: 100vw; + height: 100vh; + position: absolute; + top: 0; + left: 0; + .mask{ + width: 100%; + height: 100%; + background-color: rgba(0,0,0,0.5); + position: fixed; + top:0; + left:0; + z-index: 9; + } + .content{ + z-index: 99; + background-color: #fff; + width: 75vw; + height: 600px; + position: fixed; + top: 50%; + left: 50%; + border-radius: 20px; + transform: translateX(-50%) translateY(-50%); + display: flex; + flex-direction: column; + font-size: 28px; + .title{ + text-align: center; + margin: 20px; + } + .list{ + height: 480px; + padding: 0 20px; + .scroll{ + height: 100%; + } + .item{ + margin-bottom: 20px; + display: flex; + justify-content: space-between; + border-bottom: 1px dashed #ccc; + padding: 15px 0; + color: #3b3b3b; + @mixin link{ + font-size: 25px; + } + .link_success{ + @include link; + color: green; + } + .link_ing { + color: orange; + } + } + .noDevice{ + height: 100%; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + color: #a8a8a8; + .n_item{ + width: 100%; + text-align: left; + margin-top: 20px; + padding: 0 30px; + box-sizing: border-box; + } + } + + } + .footer{ + text-align: center; + padding: 20px 0; + background-color: #f1f1f1; + border-radius: 0 0 10px 10px; + display: flex; + justify-content: center; + align-items: center; + } + .finding{ + color: orange; + } + .footer_off{ + color: red; + } + } +} diff --git a/src/pages/sampleComparison/index.config.ts b/src/pages/sampleComparison/index.config.ts new file mode 100644 index 0000000..cfc4a8a --- /dev/null +++ b/src/pages/sampleComparison/index.config.ts @@ -0,0 +1,4 @@ +export default { + navigationBarTitleText: '样品对比', + enableShareAppMessage: false, +} diff --git a/src/pages/sampleComparison/index.module.scss b/src/pages/sampleComparison/index.module.scss new file mode 100644 index 0000000..52207f9 --- /dev/null +++ b/src/pages/sampleComparison/index.module.scss @@ -0,0 +1,251 @@ +page { + background: #f3f3f3; + overflow: hidden; +} + +.body { + overflow: hidden; + + .topBox { + margin-top: 24px; + margin-left: 30px; + width: 690px; + height: 86px; + background: #ffffff; + border-radius: 10px; + display: flex; + align-items: center; + justify-content: space-between; + + .leftBox { + display: flex; + align-items: center; + padding-left: 19px; + + .leftFont { + font-size: 28px; + font-family: Microsoft YaHei, Microsoft YaHei-Regular; + font-weight: 400; + text-align: left; + color: #707070; + margin-right: 14px; + } + + .borderBox { + width: 0px; + height: 62px; + border: 2px solid #f3f3f3; + margin-right: 39px; + } + + .cricleBox { + width: 12px; + height: 12px; + background: #cccccc; + border-radius: 50%; + margin-right: 12px; + } + + .notNet { + font-size: 28px; + font-family: Microsoft YaHei, Microsoft YaHei-Regular; + font-weight: 400; + color: #aaaaaa; + } + } + + .iconMore { + margin-right: 30px; + font-size: 30px; + } + } + + .contBox { + margin-top: 53px; + display: flex; + padding-left: 56px; + + .firstBox { + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + + .firstLeftName { + font-size: 26px; + font-family: Microsoft YaHei, Microsoft YaHei-Regular; + font-weight: 400; + color: #707070; + } + + .firstLeftbox { + width: 290px; + height: 290px; + background: #dddddd; + margin-top: 13px; + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + border-radius: 50%; + + .clickFont { + font-size: 28px; + font-family: Microsoft YaHei, Microsoft YaHei-Regular; + font-weight: 400; + color: #707070; + } + } + + .color_bock { + width: 290px; + height: 290px; + border-radius: 50%; + } + + .color_bocktwo { + width: 290px; + height: 290px; + border-radius: 50%; + } + + .nameColor { + font-size: 24px; + font-family: Microsoft YaHei, Microsoft YaHei-Regular; + font-weight: 400; + color: #707070; + margin-top: 30px; + } + } + } + + .reslutBox { + width: 692px; + height: 180px; + background: #ffffff; + margin-top: 30px; + margin-left: 29px; + border-radius: 20px; + overflow: hidden; + } + + .reslutTitle { + overflow: hidden; + width: 100%; + margin-top: 41px; + display: flex; + align-items: center; + justify-content: space-between; + + .titleLeft { + margin-left: 48px; + font-size: 26px; + font-family: Microsoft YaHei, Microsoft YaHei-Bold; + font-weight: 700; + color: #707070; + } + + .titleRiht { + margin-right: 37px; + width: 136px; + height: 46px; + background: #ffd9d9; + border-radius: 10px; + font-size: 28px; + font-family: Microsoft YaHei, Microsoft YaHei-Regular; + font-weight: 400; + text-align: center; + color: #ff4a4a; + line-height: 46px; + } + + .titleRiht1 { + background: #cdf3df; + margin-right: 37px; + width: 136px; + height: 46px; + border-radius: 10px; + font-size: 28px; + font-family: Microsoft YaHei, Microsoft YaHei-Regular; + font-weight: 400; + text-align: center; + line-height: 46px; + color: #07c160; + } + } + + .notResult { + width: 100%; + text-align: center; + font-size: 26px; + font-family: Microsoft YaHei, Microsoft YaHei-Regular; + font-weight: 400; + color: #ababab; + margin-top: 14px; + } + + .notBox { + margin-top: 32px; + display: flex; + align-items: center; + justify-content: space-between; + overflow: hidden; + + .notLeft { + font-size: 26px; + font-family: Microsoft YaHei, Microsoft YaHei-Regular; + font-weight: 400; + color: #707070; + margin-left: 40px; + } + + .notright { + font-size: 26px; + font-family: Microsoft YaHei, Microsoft YaHei-Regular; + font-weight: 400; + color: #707070; + 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; + } + } +} diff --git a/src/pages/sampleComparison/index.tsx b/src/pages/sampleComparison/index.tsx new file mode 100644 index 0000000..c0f6885 --- /dev/null +++ b/src/pages/sampleComparison/index.tsx @@ -0,0 +1,186 @@ +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 classnames from 'classnames' +import LinkBlueTooth from './compoents/bluetooth/LinkBlueTooth' +import { toRgb } from '../../common/bluetooth/color/colorSpace' +import styles from './index.module.scss' +import { productabsorbcontrast } from '@/api/index' +export default () => { + //搜索参数 + const [searchField, setSearchField] = useState({ + l1: '', + a1: '', + b1: '', + l2: '', + a2: '', + b2: '', + }) + type ColorList = { + one?: any + two?: any + } + const [colorList, setColorList] = useState({ + one: null, + two: null, + }) + const { state: colorState, measureAndGetLab } = useBluetooth() + + const getLab = async (val) => { + if (colorState.connected) { + let res = await measureAndGetLab() + if (val === 1) { + setColorList({ ...colorList, one: res }) + } else { + setColorList({ ...colorList, two: res }) + } + } else { + Taro.showToast({ + title: '请链接设备', + icon: 'none', + }) + } + } + 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) { + 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]) + setBlueToothColor(`rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`) + setTime(getNowTime()) + setSearchField({ ...searchField, l1: rgb[0], a1: rgb[1], b1: rgb[2] }) + } + 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]) + setBlueToothColorTwo(`rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`) + setTimeTwo(getNowTime()) + setSearchField({ ...searchField, l2: rgb[0], a2: rgb[1], b2: rgb[2] }) + } + } + }, [colorList]) + const reset = () => { + setColorList({}) + setBlueToothColor('') + setBlueToothColorTwo('') + setTime('') + setTimeTwo('') + setData('') + setResult('') + } + const [data, setData] = useState('') + const [result, setResult] = 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) { + setData(res.data) + let diffarray = [ + res.data.reddish && '偏红', + res.data.yellowish && '偏黄', + res.data.greenish && '偏绿', + res.data.bluish && '偏蓝', + res.data.whitish && '偏亮', + res.data.darker && '偏暗', + ] + let resCont = diffarray.filter((item) => item).join(',') + setResult(resCont) + } + } + return ( + + {/* + + 蓝牙设备 + + + + + + */} + + + + 基础样品 + {blueToothColor === '' && ( + getLab(1)}> + 点击取色 + + )} + {blueToothColor && getLab(1)} style={{ background: blueToothColor }}>} + {time === '' && --} + {time && {time}} + + + 对比样品 + {blueToothColorTwo === '' && ( + getLab(2)}> + 点击取色 + + )} + {blueToothColorTwo && getLab(2)} style={{ background: blueToothColorTwo }}>} + {timeTwo === '' && --} + {timeTwo && {timeTwo}} + + + + + 测量结果 + {(data as any).ciede_2000 >= 1 && 不合格} + {(data as any).ciede_2000 <= 1 && 合格} + + {data === '' && 暂无数据} + {data && ( + + 色差值: {(data as any).ciede_2000} + {!(data as any).reddish && + !(data as any).yellowish && + !(data as any).greenish && + !(data as any).bluish && + !(data as any).whitish && + !(data as any).darker && 无明显色差} + {result && {result}} + + )} + + + reset()}> + 重置 + + handTake()}> + 提交 + + + + ) +} diff --git a/src/pages/user/index.tsx b/src/pages/user/index.tsx index 92cbdd2..c12e407 100644 --- a/src/pages/user/index.tsx +++ b/src/pages/user/index.tsx @@ -13,11 +13,95 @@ import { goLink } from '@/common/common' type IconfontName = Parameters['0']['name'] type IconCardType = { - iconName: IconfontName, - name: string, + iconName: IconfontName + name: string path: string } +const feature: IconCardType[] = [ + { + iconName: 'icon-lingquseka', + name: '领取色卡', + path: '', + }, + { + iconName: 'icon-pandiansaoma', + name: '盘点扫码', + path: '', + }, + { + iconName: 'icon-fahuoliebiao', + name: '发货列表', + path: '', + }, + { + iconName: 'icon-yaoqingma', + name: '邀请码', + path: '', + }, + { + iconName: 'icon-tihuoliebiao', + name: '提货列表', + path: '', + }, + { + iconName: 'icon-shouhouzhongxin', + name: '退货退款', + path: '', + }, + { + iconName: 'icon-shoukuanliebiao', + name: '收款列表', + path: '', + }, + { + iconName: 'icon-kehuxinxi', + name: '客户列表', + path: '', + }, +] + +const fabric: IconCardType[] = [ + { + iconName: 'icon-yansequyang', + name: '颜色取样', + path: '', + }, + { + iconName: 'icon-qusechazhao', + name: '取色查找', + path: '', + }, + { + iconName: 'icon-yangpinduibi', + name: '样品对比', + path: '/pages/sampleComparison/index', + }, +] + +const statisticAnalysis: IconCardType[] = [ + { + iconName: 'icon-xiaoshou', + name: '销售', + path: '', + }, + { + iconName: 'icon-duizhang', + name: '对账', + path: '', + }, + { + iconName: 'icon-yuncangkucun', + name: '云仓库存', + path: '', + }, + { + iconName: 'icon-qianzhicangkucun', + name: '前置仓库存', + path: '', + }, +] + // 用户信息 const UserInfo: FC = () => { const { removeToken, removeUserInfo, userInfo } = useUserInfo() @@ -27,92 +111,6 @@ const UserInfo: FC = () => { // username: '', // userno: '', // }) - - - const feature: IconCardType[] = [ - { - iconName: 'icon-lingquseka', - name: '领取色卡', - path: '', - }, - { - iconName: 'icon-pandiansaoma', - name: '盘点扫码', - path: '', - }, - { - iconName: 'icon-fahuoliebiao', - name: '发货列表', - path: '', - }, - { - iconName: 'icon-yaoqingma', - name: '邀请码', - path: '', - }, - { - iconName: 'icon-tihuoliebiao', - name: '提货列表', - path: '', - }, - { - iconName: 'icon-shouhouzhongxin', - name: '退货退款', - path: '', - }, - { - iconName: 'icon-shoukuanliebiao', - name: '收款列表', - path: '', - }, - { - iconName: 'icon-kehuxinxi', - name: '客户列表', - path: '', - }, - ] - - const fabric: IconCardType[] = [ - { - iconName: 'icon-yansequyang', - name: '颜色取样', - path: '', - }, - { - iconName: 'icon-qusechazhao', - name: '取色查找', - path: '', - }, - { - iconName: 'icon-yangpinduibi', - name: '样品对比', - path: '', - }, - ] - - const statisticAnalysis: IconCardType[] = [ - { - iconName: 'icon-xiaoshou', - name: '销售', - path: '', - }, - { - iconName: 'icon-duizhang', - name: '对账', - path: '', - }, - { - iconName: 'icon-yuncangkucun', - name: '云仓库存', - path: '', - }, - { - iconName: 'icon-qianzhicangkucun', - name: '前置仓库存', - path: '', - }, - ] - // 退出登录 const handleLogout = () => { @@ -121,6 +119,11 @@ const UserInfo: FC = () => { goLink('/pages/login/index', {}, 'reLaunch') } + const handleClickIconCard = (item: IconCardType) => { + console.log('item==>', item) + goLink(item.path, {}, 'navigateTo') + } + return ( <> @@ -158,7 +161,7 @@ const UserInfo: FC = () => { 布料取色 {fabric.map((item) => { - return + return handleClickIconCard(item)}> })} From 03e7377485a8e056b9ae1074384deefeefa65bba Mon Sep 17 00:00:00 2001 From: xuan Date: Wed, 14 Sep 2022 13:08:17 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E2=9C=A8=20feat(=E9=A2=9C=E8=89=B2?= =?UTF-8?q?=E5=8F=96=E6=A0=B7|=E5=8F=96=E8=89=B2=E6=9F=A5=E6=89=BE|?= =?UTF-8?q?=E6=A0=B7=E5=93=81=E5=AF=B9=E6=AF=94):=20=E7=A7=BB=E6=A4=8D?= =?UTF-8?q?=E5=86=85=E9=83=A8=E7=89=88=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.ts | 36 +- src/api/product/findColor.ts | 11 + src/api/product/index.ts | 4 +- src/api/product/product.ts | 13 +- src/api/product/takeColor.ts | 45 +++ src/app.config.ts | 8 +- src/common/{fotmat.js => format.js} | 366 +++++++++--------- src/common/util.ts | 2 +- src/components/LabAndImg/index.tsx | 2 +- src/components/LabAndImgShow/index.tsx | 113 +++--- src/components/amountShow/index.tsx | 44 +-- src/components/banner/index.tsx | 2 +- src/components/bindSalesmanPopup/index.tsx | 97 ++--- src/components/product/index.tsx | 75 ++-- .../selectProduct/index.module.scss | 82 ++++ src/components/selectProduct/index.tsx | 112 ++++++ src/components/shopCart/index.tsx | 2 +- src/components/uploadImage/index.tsx | 2 +- .../components}/bluetooth/LinkBlueTooth.tsx | 2 +- .../components}/bluetooth/Popup.tsx | 2 +- .../components}/css/linkBlueTooth.module.scss | 7 +- .../components}/css/popup.module.scss | 0 .../components/DrawerCenter/index.module.scss | 46 +++ .../components/DrawerCenter/index.tsx | 30 ++ .../components/HistoryColor/index.module.scss | 113 ++++++ .../components/HistoryColor/index.tsx | 89 +++++ .../components/LabColor/index.module.scss | 46 +++ .../findColor/components/LabColor/index.tsx | 54 +++ .../RecommendColor/index.module.scss | 121 ++++++ .../components/RecommendColor/index.tsx | 83 ++++ .../colorRelated/findColor/index.config.ts | 4 + .../colorRelated/findColor/index.module.scss | 94 +++++ src/pages/colorRelated/findColor/index.tsx | 140 +++++++ .../sampleComparison/index.config.ts | 0 .../sampleComparison/index.module.scss | 0 .../sampleComparison/index.tsx | 19 +- .../components/ColorCard/index.module.scss | 184 +++++++++ .../takeColor/components/ColorCard/index.tsx | 78 ++++ .../components/Texture/index.module.scss | 68 ++++ .../takeColor/components/Texture/index.tsx | 48 +++ .../components/Upload/index.module.scss | 68 ++++ .../takeColor/components/Upload/index.tsx | 62 +++ .../colorRelated/takeColor/index.config.ts | 4 + .../colorRelated/takeColor/index.module.scss | 148 +++++++ src/pages/colorRelated/takeColor/index.tsx | 136 +++++++ .../components/advanceOrderState/index.tsx | 119 +++--- .../empty/index.module.scss | 0 .../{compoents => components}/empty/index.tsx | 0 .../goods/index.module.scss | 0 .../{compoents => components}/goods/index.tsx | 0 src/pages/searchPage/index.tsx | 6 +- src/pages/user/index.tsx | 6 +- src/styles/common.scss | 15 + src/use/useHttp.ts | 3 - 54 files changed, 2353 insertions(+), 458 deletions(-) create mode 100644 src/api/product/findColor.ts create mode 100644 src/api/product/takeColor.ts rename src/common/{fotmat.js => format.js} (95%) create mode 100644 src/components/selectProduct/index.module.scss create mode 100644 src/components/selectProduct/index.tsx rename src/pages/{sampleComparison/compoents => colorRelated/components}/bluetooth/LinkBlueTooth.tsx (97%) rename src/pages/{sampleComparison/compoents => colorRelated/components}/bluetooth/Popup.tsx (98%) rename src/pages/{sampleComparison => colorRelated/components}/css/linkBlueTooth.module.scss (88%) rename src/pages/{sampleComparison => colorRelated/components}/css/popup.module.scss (100%) create mode 100644 src/pages/colorRelated/findColor/components/DrawerCenter/index.module.scss create mode 100644 src/pages/colorRelated/findColor/components/DrawerCenter/index.tsx create mode 100644 src/pages/colorRelated/findColor/components/HistoryColor/index.module.scss create mode 100644 src/pages/colorRelated/findColor/components/HistoryColor/index.tsx create mode 100644 src/pages/colorRelated/findColor/components/LabColor/index.module.scss create mode 100644 src/pages/colorRelated/findColor/components/LabColor/index.tsx create mode 100644 src/pages/colorRelated/findColor/components/RecommendColor/index.module.scss create mode 100644 src/pages/colorRelated/findColor/components/RecommendColor/index.tsx create mode 100644 src/pages/colorRelated/findColor/index.config.ts create mode 100644 src/pages/colorRelated/findColor/index.module.scss create mode 100644 src/pages/colorRelated/findColor/index.tsx rename src/pages/{ => colorRelated}/sampleComparison/index.config.ts (100%) rename src/pages/{ => colorRelated}/sampleComparison/index.module.scss (100%) rename src/pages/{ => colorRelated}/sampleComparison/index.tsx (90%) create mode 100644 src/pages/colorRelated/takeColor/components/ColorCard/index.module.scss create mode 100644 src/pages/colorRelated/takeColor/components/ColorCard/index.tsx create mode 100644 src/pages/colorRelated/takeColor/components/Texture/index.module.scss create mode 100644 src/pages/colorRelated/takeColor/components/Texture/index.tsx create mode 100644 src/pages/colorRelated/takeColor/components/Upload/index.module.scss create mode 100644 src/pages/colorRelated/takeColor/components/Upload/index.tsx create mode 100644 src/pages/colorRelated/takeColor/index.config.ts create mode 100644 src/pages/colorRelated/takeColor/index.module.scss create mode 100644 src/pages/colorRelated/takeColor/index.tsx rename src/pages/searchPage/{compoents => components}/empty/index.module.scss (100%) rename src/pages/searchPage/{compoents => components}/empty/index.tsx (100%) rename src/pages/searchPage/{compoents => components}/goods/index.module.scss (100%) rename src/pages/searchPage/{compoents => components}/goods/index.tsx (100%) diff --git a/src/api/index.ts b/src/api/index.ts index f8f41e4..b0e6c06 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,27 +1,33 @@ +export { LoginApi } from './login/index' +export { + productabsorbcontrast, + SelectProductListApi, + ColorListApi, + ColorDetailedApi, + ColorSamplingSaveApi, + TextureSaveApi, + FindColorListApi, +} from './product/index' - -export {LoginApi} from './login/index' -export { productabsorbcontrast } from './product/index' - -import { useRequest } from "@/use/useHttp" +import { useRequest } from '@/use/useHttp' /** * 系列列表 - * @returns + * @returns */ export const kindListApi = () => { - return useRequest({ - url: `/v1/mp/product/kind/list`, - method: "get", - }) + return useRequest({ + url: `/v1/mp/product/kind/list`, + method: 'get', + }) } /** * 面料列表 - * @returns + * @returns */ export const ProductListApi = () => { - return useRequest({ - url: `/v1/mp/product/list`, - method: "get", - }) + return useRequest({ + url: `/v1/mp/product/list`, + method: 'get', + }) } diff --git a/src/api/product/findColor.ts b/src/api/product/findColor.ts new file mode 100644 index 0000000..19b3386 --- /dev/null +++ b/src/api/product/findColor.ts @@ -0,0 +1,11 @@ +import { useRequest } from "@/use/useHttp" +/** + * 颜色列表 + * @returns + */ +export const FindColorListApi = () => { + return useRequest({ + url: `/v1/mp/product/color/absorb/match`, + method: 'get', + }) +} diff --git a/src/api/product/index.ts b/src/api/product/index.ts index c256c79..0e1fb14 100644 --- a/src/api/product/index.ts +++ b/src/api/product/index.ts @@ -1 +1,3 @@ -export { productabsorbcontrast } from './product' +export { productabsorbcontrast, SelectProductListApi } from './product' +export { ColorListApi, ColorDetailedApi, ColorSamplingSaveApi, TextureSaveApi } from './takeColor' +export { FindColorListApi } from './findColor' diff --git a/src/api/product/product.ts b/src/api/product/product.ts index 6d8354a..2e1e927 100644 --- a/src/api/product/product.ts +++ b/src/api/product/product.ts @@ -1,4 +1,4 @@ -import { useRequest } from "@/use/useHttp" +import { useRequest } from '@/use/useHttp' //取色对比 export const productabsorbcontrast = () => { @@ -7,3 +7,14 @@ export const productabsorbcontrast = () => { method: 'get', }) } + +/** + * 面料列表(下拉选择) + * @returns + */ +export const SelectProductListApi = () => { + return useRequest({ + url: `/v1/mp/enum/product/list`, + method: 'get', + }) +} diff --git a/src/api/product/takeColor.ts b/src/api/product/takeColor.ts new file mode 100644 index 0000000..03bc2f6 --- /dev/null +++ b/src/api/product/takeColor.ts @@ -0,0 +1,45 @@ +import { useRequest } from '@/use/useHttp' + +/** + * 颜色列表 + * @returns + */ +export const ColorListApi = () => { + return useRequest({ + url: `/v1/mp/product/color/absorb/list`, + method: 'get', + }) +} + +/** + * 颜色详细 + * @returns + */ +export const ColorDetailedApi = () => { + return useRequest({ + url: `/v1/mp/product/texture`, + method: 'get', + }) +} + +/** + * 取色存储 + * @returns + */ +export const ColorSamplingSaveApi = () => { + return useRequest({ + url: `/v1/mp/product/color/absorb`, + method: 'put', + }) +} + +/** + * 保存纹理 + * @returns + */ +export const TextureSaveApi = () => { + return useRequest({ + url: `/v1/mp/product/texture`, + method: 'put', + }) +} diff --git a/src/app.config.ts b/src/app.config.ts index 0a10a57..be9bc84 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -51,8 +51,12 @@ export default defineAppConfig({ }, subPackages: [ { - root: 'pages/sampleComparison', - pages: ['index'], + root: 'pages/colorRelated', + pages: [ + 'sampleComparison/index', + 'takeColor/index', + 'findColor/index' + ], }, ], }) diff --git a/src/common/fotmat.js b/src/common/format.js similarity index 95% rename from src/common/fotmat.js rename to src/common/format.js index 7a1acf0..0b3f074 100644 --- a/src/common/fotmat.js +++ b/src/common/format.js @@ -1,183 +1,183 @@ -import { IMG_CND_Prefix } from './constant' - -/** - * 移除井号 - * @param {String} val code 编码 - * @returns - */ -export const formatRemoveHashTag = (val = '') => { - // console.log('移除标签',val,val.endsWith("#")); - return val.endsWith('#') ? val.replace('#', '') : val -} - -/** - * 格式化编码+名称显示方式 - * @param {String} code 编码 - * @param {String} name 名称 - * @param {*} mode 模式 both:code + 名称 name: 仅显示名称 - * @returns - */ -export const formatHashTag = (code = '', name = '', mode = 'both') => { - if (mode == 'both') { - return `${formatRemoveHashTag(code)}# ${name}` - } else if (mode == 'name') { - return `${name}` - } -} - -const Digit = 10 * 10 - -/** - * 重量 进退位 单位 - */ -export const weightDigit = 1000 - -/** - * 除以 - * @param {*} val - * @param {*} digit - * @param {*} priceStatus //是否显示千位分割 - * @returns - */ -export const formatPriceDiv = (val, digit = Digit, priceStatus = false) => { - let res = strip(Number(val / digit)) || 0 - return priceStatus ? numberWithCommas({ number: res }) : res -} -/** - * 乘以 - * @param {*} val - * @param {*} digit - * @returns - */ -export const formatPriceMul = (val, digit = Digit) => { - return strip(Number(val * digit)) || 0 -} - -/** - * 格式化重量单位 (乘以) - * @param {Number} val - * @returns - */ -export const formatWeightMul = (val, digit = weightDigit) => { - return strip(Number(val * digit)) || 0 -} - -/** - * 格式化重量单位 (除以) - * @param {*} val - */ -export const formatWeightDiv = (val, digit = weightDigit) => { - return strip(Number(val / digit)) || 0 -} - -export const formatDateTime = (val, fmt = 'YYYY-MM-DD HH:mm:ss') => { - if (val) { - let time = new Date(val) - let Y = time.getFullYear() - let M = time.getMonth() + 1 - let d = time.getDate() - let h = time.getHours() - let m = time.getMinutes() - let s = time.getSeconds() - - fmt = fmt - .replace('YYYY', Y) - .replace('MM', M.toString().padStart(2, '0')) - .replace('DD', d.toString().padStart(2, '0')) - .replace('HH', h.toString().padStart(2, '0')) - .replace('mm', m.toString().padStart(2, '0')) - .replace('ss', s.toString().padStart(2, '0')) - - return fmt - } else { - return val - } -} - -/** - * 精度 - * @param {*} num - * @param {*} precision - * @returns - */ -export const strip = (num, precision = 12) => { - return +parseFloat(num.toPrecision(precision)) -} - -/** - * 转换金额单位 - * @param {*} num 金额 / 数值 - * @param {*} digit 转换单位 - * @returns - */ -export const formatMillionYuan = (num, digit = 10000) => { - return num / digit > 1 ? { num: toDecimal2(num / digit), million: true } : { num, million: false } -} - -/** - * 数值保留两位小数 - * @param {*} x - * @returns - */ -export const toDecimal2 = (x) => { - var f = parseFloat(x) - if (isNaN(f)) { - return 0 - } - f = f + '' - let index = f.lastIndexOf('.') - if (index >= 0) { - let decimal = f.substring(index + 1) - if (decimal.length == 1) { - f = f.substring(0, index + 1) + decimal + '0' - } else { - f = f.substring(0, index + 1) + decimal.substring(0, 2) - } - } - return f -} - -/** - * 格式化图片路径 - * @param {*} url - * @status true|false - * @returns - */ -export const formatImgUrl = (url, suffix = '!w200') => { - if (url) { - return url.includes('http') ? url + suffix : IMG_CND_Prefix + url + suffix - } else { - return IMG_CND_Prefix + '/mall/no_img.png' - } -} - -/** - * - * @param {纹理图} imgurl - * @param {rgb} rgb - * @param {} suffix - * @returns 1 有纹理图,2 有rgb 3默认图 - */ -export const isLabImage = (imgurl, rgb, suffix = '!w200') => { - if (imgurl) { - return { status: 1, value: IMG_CND_Prefix + '/' + imgurl + suffix } - } else if (rgb.r != 0 || rgb.g != 0 || rgb.b != 0) { - return { status: 2, value: rgb } - } else { - return { status: 3, value: IMG_CND_Prefix + '/mall/no_img.png' } - } -} - -/** - * - * @param {千位分割付} number - * @returns - */ -export const numberWithCommas = ({ number = 0, digit = 2 }) => { - if (!isNaN(Number(number))) { - // return parseFloat(number).toFixed(digit).replace(/^\B(? { + // console.log('移除标签',val,val.endsWith("#")); + return val.endsWith('#') ? val.replace('#', '') : val +} + +/** + * 格式化编码+名称显示方式 + * @param {String} code 编码 + * @param {String} name 名称 + * @param {*} mode 模式 both:code + 名称 name: 仅显示名称 + * @returns + */ +export const formatHashTag = (code = '', name = '', mode = 'both') => { + if (mode == 'both') { + return `${formatRemoveHashTag(code)}# ${name}` + } else if (mode == 'name') { + return `${name}` + } +} + +const Digit = 10 * 10 + +/** + * 重量 进退位 单位 + */ +export const weightDigit = 1000 + +/** + * 除以 + * @param {*} val + * @param {*} digit + * @param {*} priceStatus //是否显示千位分割 + * @returns + */ +export const formatPriceDiv = (val, digit = Digit, priceStatus = false) => { + let res = strip(Number(val / digit)) || 0 + return priceStatus ? numberWithCommas({ number: res }) : res +} +/** + * 乘以 + * @param {*} val + * @param {*} digit + * @returns + */ +export const formatPriceMul = (val, digit = Digit) => { + return strip(Number(val * digit)) || 0 +} + +/** + * 格式化重量单位 (乘以) + * @param {Number} val + * @returns + */ +export const formatWeightMul = (val, digit = weightDigit) => { + return strip(Number(val * digit)) || 0 +} + +/** + * 格式化重量单位 (除以) + * @param {*} val + */ +export const formatWeightDiv = (val, digit = weightDigit) => { + return strip(Number(val / digit)) || 0 +} + +export const formatDateTime = (val, fmt = 'YYYY-MM-DD HH:mm:ss') => { + if (val) { + let time = new Date(val) + let Y = time.getFullYear() + let M = time.getMonth() + 1 + let d = time.getDate() + let h = time.getHours() + let m = time.getMinutes() + let s = time.getSeconds() + + fmt = fmt + .replace('YYYY', Y) + .replace('MM', M.toString().padStart(2, '0')) + .replace('DD', d.toString().padStart(2, '0')) + .replace('HH', h.toString().padStart(2, '0')) + .replace('mm', m.toString().padStart(2, '0')) + .replace('ss', s.toString().padStart(2, '0')) + + return fmt + } else { + return val + } +} + +/** + * 精度 + * @param {*} num + * @param {*} precision + * @returns + */ +export const strip = (num, precision = 12) => { + return +parseFloat(num.toPrecision(precision)) +} + +/** + * 转换金额单位 + * @param {*} num 金额 / 数值 + * @param {*} digit 转换单位 + * @returns + */ +export const formatMillionYuan = (num, digit = 10000) => { + return num / digit > 1 ? { num: toDecimal2(num / digit), million: true } : { num, million: false } +} + +/** + * 数值保留两位小数 + * @param {*} x + * @returns + */ +export const toDecimal2 = (x) => { + var f = parseFloat(x) + if (isNaN(f)) { + return 0 + } + f = f + '' + let index = f.lastIndexOf('.') + if (index >= 0) { + let decimal = f.substring(index + 1) + if (decimal.length == 1) { + f = f.substring(0, index + 1) + decimal + '0' + } else { + f = f.substring(0, index + 1) + decimal.substring(0, 2) + } + } + return f +} + +/** + * 格式化图片路径 + * @param {*} url + * @status true|false + * @returns + */ +export const formatImgUrl = (url, suffix = '!w200') => { + if (url) { + return url.includes('http') ? url + suffix : IMG_CND_Prefix + url + suffix + } else { + return IMG_CND_Prefix + '/mall/no_img.png' + } +} + +/** + * + * @param {纹理图} imgurl + * @param {rgb} rgb + * @param {} suffix + * @returns 1 有纹理图,2 有rgb 3默认图 + */ +export const isLabImage = (imgurl, rgb, suffix = '!w200') => { + if (imgurl) { + return { status: 1, value: IMG_CND_Prefix + '/' + imgurl + suffix } + } else if (rgb.r != 0 || rgb.g != 0 || rgb.b != 0) { + return { status: 2, value: rgb } + } else { + return { status: 3, value: IMG_CND_Prefix + '/mall/no_img.png' } + } +} + +/** + * + * @param {千位分割付} number + * @returns + */ +export const numberWithCommas = ({ number = 0, digit = 2 }) => { + if (!isNaN(Number(number))) { + // return parseFloat(number).toFixed(digit).replace(/^\B(? void, - showNumber?: number, //图片显示张数,0不限制 + value?: { + texture_url?: string //纹理图路径 + lab?: { l: number; a: number; b: number } //lab + rgb?: { r: number; g: number; b: number } //rgb + title?: string //标题 + } + show?: false | true + onClose?: () => void + showNumber?: number //图片显示张数,0不限制 } -export default ({value, show = false, onClose, showNumber = 1}: colorParams) => { +export default ({ value, show = false, onClose, showNumber = 1 }: colorParams) => { + useEffect(() => { + if (show && rgbStyle) setLabShow(() => true) + if (show && value?.texture_url) onShowImage() + if (!show) setLabShow(() => false) + }, [show]) - useEffect(() => { - if(show&&rgbStyle) setLabShow(() => true) - if(show&&value?.texture_url) onShowImage() - if(!show) setLabShow(() => false) - }, [show]) - - //显示颜色 - const [labShow, setLabShow] = useState(false) - //lab是否都是0 - const rgbStyle = useMemo(() => { - if(value?.lab&&(value.lab.l||value.lab.a||value.lab.b)) { - return {'backgroundColor':`rgb(${value.rgb?.r} ${value.rgb?.g} ${value.rgb?.b})`} - } else { - return null - } - }, [value]) - - - //显示图片 - const onShowImage = () => { - onClose?.() - let res: string[] = [] - if(value?.texture_url) { - res = value?.texture_url?.split(',').map(item => { - return formatImgUrl(item) - }) - } - let n_res = showNumber == 0? res : res?.splice(0, showNumber) - Taro.previewImage({ - current: n_res[0], - urls: n_res - }) + //显示颜色 + const [labShow, setLabShow] = useState(false) + //lab是否都是0 + const rgbStyle = useMemo(() => { + if (value?.lab && (value.lab.l || value.lab.a || value.lab.b)) { + return { backgroundColor: `rgb(${value.rgb?.r} ${value.rgb?.g} ${value.rgb?.b})` } + } else { + return null } + }, [value]) - return ( - <> - {labShow&& onClose?.()}> - - - {value?.title} - - } - - ) -} \ No newline at end of file + //显示图片 + const onShowImage = () => { + onClose?.() + let res: string[] = [] + if (value?.texture_url) { + res = value?.texture_url?.split(',').map((item) => { + return formatImgUrl(item) + }) + } + let n_res = showNumber == 0 ? res : res?.splice(0, showNumber) + Taro.previewImage({ + current: n_res[0], + urls: n_res, + }) + } + + return ( + <> + {labShow && ( + onClose?.()}> + + + {value?.title} + + + )} + + ) +} diff --git a/src/components/amountShow/index.tsx b/src/components/amountShow/index.tsx index efd3a2a..e875c48 100644 --- a/src/components/amountShow/index.tsx +++ b/src/components/amountShow/index.tsx @@ -1,29 +1,25 @@ -import { Text, View } from "@tarojs/components"; -import { memo, useCallback } from "react"; -import styles from './index.module.scss' -import classnames from "classnames"; -import { numberWithCommas } from "@/common/fotmat"; +import { Text, View } from '@tarojs/components' +import { memo, useCallback } from 'react' +import styles from './index.module.scss' +import classnames from 'classnames' +import { numberWithCommas } from '@/common/format' type Param = { - number: number, //数字 - status: 0|1|2 //0 小型,1中型,2大 + number: number //数字 + status: 0 | 1 | 2 //0 小型,1中型,2大 } -export default memo(({number = 0, status = 1}:Param) => { - const priceDom = useCallback(() => { - let res = number.toFixed(2).split('.') - let int_num = parseInt(res[0]) + '' - let decimals_num = res[1] - return ( - <> - ¥ - {numberWithCommas({number:int_num, digit:0})} - .{decimals_num} - - ) - }, [number]) +export default memo(({ number = 0, status = 1 }: Param) => { + const priceDom = useCallback(() => { + let res = number.toFixed(2).split('.') + let int_num = parseInt(res[0]) + '' + let decimals_num = res[1] return ( - - {priceDom()} - + <> + ¥ + {numberWithCommas({ number: int_num, digit: 0 })} + .{decimals_num} + ) -}) \ No newline at end of file + }, [number]) + return {priceDom()} +}) diff --git a/src/components/banner/index.tsx b/src/components/banner/index.tsx index b38c592..49afae7 100644 --- a/src/components/banner/index.tsx +++ b/src/components/banner/index.tsx @@ -3,7 +3,7 @@ import { goLink } from '@/common/common' import { GetBannerList } from '@/api/banner' import styles from './index.module.scss' import { useEffect, useState } from 'react' -import { formatImgUrl } from '@/common/fotmat' +import { formatImgUrl } from '@/common/format' type item = { title: string; img: string; url: string; id: number } diff --git a/src/components/bindSalesmanPopup/index.tsx b/src/components/bindSalesmanPopup/index.tsx index cab8af9..7074833 100644 --- a/src/components/bindSalesmanPopup/index.tsx +++ b/src/components/bindSalesmanPopup/index.tsx @@ -1,51 +1,56 @@ -import { Image, Swiper, SwiperItem, Text, View } from "@tarojs/components" -import styles from './index.module.scss' -import { formatImgUrl } from "@/common/fotmat" -import Taro from "@tarojs/taro"; -import { goLink } from "@/common/common"; +import { Image, Swiper, SwiperItem, Text, View } from '@tarojs/components' +import styles from './index.module.scss' +import { formatImgUrl } from '@/common/format' +import Taro from '@tarojs/taro' +import { goLink } from '@/common/common' type params = { - show?: true|false, - onClose?: () => void + show?: true | false + onClose?: () => void } -export default ({show, onClose}:params) => { - const onCustomer = async () => { - let res = await Taro.showModal({ - title: '是否拨打服务热线', - confirmText: '拨打', - content: '(0757) 8270 6695', - cancelText: '取消', - }) - if(res.confirm) { - Taro.makePhoneCall({ - phoneNumber: '(0757)82706695' - }) - } +export default ({ show, onClose }: params) => { + const onCustomer = async () => { + let res = await Taro.showModal({ + title: '是否拨打服务热线', + confirmText: '拨打', + content: '(0757) 8270 6695', + cancelText: '取消', + }) + if (res.confirm) { + Taro.makePhoneCall({ + phoneNumber: '(0757)82706695', + }) } + } - const onConfirm = () => { - onClose?.() - goLink('/pages/bindSalesman/index') - } - return ( - <> - {show&& - - - - - - 提示 - 暂未开通下单权限功能,稍后有客服联系您,请注意接收电话。 - - - onConfirm()}>输入邀请码 - onCustomer()}>联系客服 - - - - } - - ) - -} \ No newline at end of file + const onConfirm = () => { + onClose?.() + goLink('/pages/bindSalesman/index') + } + return ( + <> + {show && ( + + + + + + + 提示 + 暂未开通下单权限功能,稍后有客服联系您,请注意接收电话。 + + + onConfirm()}> + 输入邀请码 + + onCustomer()}> + 联系客服 + + + + + + )} + + ) +} diff --git a/src/components/product/index.tsx b/src/components/product/index.tsx index 193c2e5..9209dea 100644 --- a/src/components/product/index.tsx +++ b/src/components/product/index.tsx @@ -1,40 +1,47 @@ -import { Image, View } from "@tarojs/components" -import Taro from "@tarojs/taro" -import { goLink } from "@/common/common" +import { Image, View } from '@tarojs/components' +import Taro from '@tarojs/taro' +import { goLink } from '@/common/common' import styles from './index.module.scss' -import { formatHashTag, formatImgUrl } from "@/common/fotmat" -import LabAndImg from "../LabAndImg" -import { useCallback, useMemo } from "react" +import { formatHashTag, formatImgUrl } from '@/common/format' +import LabAndImg from '../LabAndImg' +import { useCallback, useMemo } from 'react' type Params = { - desStatus?: true | false, - productList?: any[], - popupShow?: (any) => void + desStatus?: true | false + productList?: any[] + popupShow?: (any) => void } export default ({ desStatus = true, productList = [], popupShow }: Params) => { - - const labAndImgObj = useCallback((item) => { - return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url } - }, [productList]) - return ( - - {productList?.map(item => { - return popupShow?.(item)}> - - - {item.product_color_count}色 - - - {formatHashTag(item.code, '')} {item.name} - - {item.width} - {item.weight_density} - - {item.component} - {desStatus && {item.describe}} - - - })} - - ) + const labAndImgObj = useCallback( + (item) => { + return { lab: item.lab, rgb: item.rgb, texture_url: item.texture_url } + }, + [productList], + ) + return ( + + {productList?.map((item) => { + return ( + popupShow?.(item)}> + + + {item.product_color_count}色 + + + + {formatHashTag(item.code, '')} + {item.name} + + + {item.width} + {item.weight_density} + + {item.component} + {desStatus && {item.describe}} + + + ) + })} + + ) } diff --git a/src/components/selectProduct/index.module.scss b/src/components/selectProduct/index.module.scss new file mode 100644 index 0000000..71db5a2 --- /dev/null +++ b/src/components/selectProduct/index.module.scss @@ -0,0 +1,82 @@ + +.select_input{ + width: 100%; +} +.stock_ipnut_des{ + border-bottom: 1rpx solid #F0F0F0; + padding: 20rpx 0 10rpx 10rpx !important; + .con_input{ + display: flex; + align-items: center; + display: flex; + .label{ + width: 120px; + font-size: 27px; + height: 60px; + display: flex; + align-items: center; + padding-left: 10px; + color: #707070; + font-weight: 700; + border-right: 2px solid #F3F3F3 ; + } + .input_con{ + flex:1; + } + .input_type{ + padding-left: 50px; + font-size: 28px; + @include common_ellipsis(); + max-width: 430px; + } + .noCon{ + color: #cccccc; + } + .iconfont{ + color: #cccccc; + font-size: 30px; + } + } +} +.stock_disabled{ + background: #f7f7f7; + border-radius: 10px; + .label{ + color: #cccccc !important; + } +} + +.drawer { + top:0; + position:fixed; +} +.selectCon{ + width:100%; + .selectInput{ + width:100%; + padding: 0 20px 20px 20px; + border-bottom: 2px solid #F3F3F3; + box-sizing: border-box; + } + .selectList{ + .selectList-scroll-view{ + height: 600px; + padding-top: 22px; + .selectItem{ + font-size: 28px; + color: #707070; + padding: 22px 30px; + } + .selected{ + color: #3287EC; + font-weight: 700; + } + } + } +} +.flexBox { + display: flex; + width: 200px; + align-items: center; + justify-content: flex-end; +} diff --git a/src/components/selectProduct/index.tsx b/src/components/selectProduct/index.tsx new file mode 100644 index 0000000..bb91f40 --- /dev/null +++ b/src/components/selectProduct/index.tsx @@ -0,0 +1,112 @@ +import styles from './index.module.scss' +import { Image, Text, ScrollView, View } from '@tarojs/components' +import React, { FC, useCallback, useEffect, useMemo, useState } from 'react' +import classnames from 'classnames' +import Search from '../search' +import Popup from '../popup' +import { SelectProductListApi } from '@/api/index' + + +type PropsType = { + selectColorId: number + noAll?: boolean + onSelect?: Function + children?: React.ReactNode +} + +const SelectProduct:FC = (params) => { + const { selectColorId, noAll, onSelect } = params + + const [selectId, setSelectId] = useState(0) + + useEffect(()=>{ + setSelectId(selectColorId) + }, [selectColorId]) + + const {fetchData, state} = SelectProductListApi() + + const [selectValue, setSelectValue] = useState() + + const [productList, setProductList] = useState([{id:1}]) + + const clickEvent = () => {} + + const getSelectData = (item) => { + setSelectId(item.id) + setSelectValue(changeName(item)) + setShowPopup(false) + onSelect && onSelect(item) + } + + const changeName = (item) => { + if (item.id) { + return item.code.includes('#') ? item.code + ' ' + item.name : item.code + '# ' + item.name + } else { + return item.name + } + } + + useEffect(() => { + getProductList() + }, []) + + const getProductList = async () => { + let res = await fetchData() + !noAll && res.data.list?.unshift({ name: '全部', id: 0 }) + setProductList(res.data.list) + } + + + const list = useMemo(() => { + console.log('state', state) + return state.data.list || [{ id: 1 }] + }, [productList]) + + const [showPopup, setShowPopup] = useState(false) + + const closeEven = () => {} + + //输入了搜索关键字 + const getSearchData = useCallback((e) => { + // pageNum.current.page = 1 + // setOrderData(() => ({ list: [], total: 0 })) + // setSearchField((val) => ({ ...val, name: e, size: 10 })) + }, []) + + useEffect(() => { + setSelectId(selectColorId) + const res = productList.find((item) => item.id == selectColorId) + setSelectValue(changeName(res)) + }, [selectColorId]) + + return ( + <> + + + + 面料名称 + + {selectValue ? selectValue : '请选择'} + + + + + + + + + + {list.map((item) => { + return ( + getSelectData(item)}> + {/* {changeName(item)} */} + + ) + })} + + + + + ) +} +export default SelectProduct diff --git a/src/components/shopCart/index.tsx b/src/components/shopCart/index.tsx index 5db1201..ecf23c2 100644 --- a/src/components/shopCart/index.tsx +++ b/src/components/shopCart/index.tsx @@ -9,7 +9,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react' import Taro from '@tarojs/taro' import { alert, goLink } from '@/common/common' import { GetShoppingCartApi, DelShoppingCartApi, UpdateShoppingCartApi } from '@/api/shopCart' -import { formatHashTag, formatImgUrl, formatPriceDiv } from '@/common/fotmat' +import { formatHashTag, formatImgUrl, formatPriceDiv } from '@/common/format' import { setParam } from '@/common/system' import { debounce, throttle } from '@/common/util' import Counter from '../counter' diff --git a/src/components/uploadImage/index.tsx b/src/components/uploadImage/index.tsx index f427e02..aaf6964 100644 --- a/src/components/uploadImage/index.tsx +++ b/src/components/uploadImage/index.tsx @@ -2,7 +2,7 @@ import Taro, { FC } from '@tarojs/taro' import { memo, useEffect, useState } from 'react' import useUploadCDNImg from '@/use/useUploadImage' import { Image, Text, View } from '@tarojs/components' -import { formatImgUrl } from '@/common/fotmat' +import { formatImgUrl } from '@/common/format' import classnames from 'classnames' import styles from './index.module.scss' diff --git a/src/pages/sampleComparison/compoents/bluetooth/LinkBlueTooth.tsx b/src/pages/colorRelated/components/bluetooth/LinkBlueTooth.tsx similarity index 97% rename from src/pages/sampleComparison/compoents/bluetooth/LinkBlueTooth.tsx rename to src/pages/colorRelated/components/bluetooth/LinkBlueTooth.tsx index a2c1478..04b9dc2 100644 --- a/src/pages/sampleComparison/compoents/bluetooth/LinkBlueTooth.tsx +++ b/src/pages/colorRelated/components/bluetooth/LinkBlueTooth.tsx @@ -5,7 +5,7 @@ import { useBluetooth } from '@/use/contextBlueTooth' import SearchInput from '@/components/searchInput' import Popup from './Popup' import classnames from 'classnames' -import styles from '../../css/linkBlueTooth.module.scss' +import styles from '../css/linkBlueTooth.module.scss' export default memo(() => { const { state, init, startScan, connect, disconnect } = useBluetooth() diff --git a/src/pages/sampleComparison/compoents/bluetooth/Popup.tsx b/src/pages/colorRelated/components/bluetooth/Popup.tsx similarity index 98% rename from src/pages/sampleComparison/compoents/bluetooth/Popup.tsx rename to src/pages/colorRelated/components/bluetooth/Popup.tsx index ad81e1f..1e23885 100644 --- a/src/pages/sampleComparison/compoents/bluetooth/Popup.tsx +++ b/src/pages/colorRelated/components/bluetooth/Popup.tsx @@ -1,7 +1,7 @@ import { ScrollView, View } from '@tarojs/components' import { memo, useEffect, useState } from 'react' import Loading from '@/components/loading' -import style from '../../css/popup.module.scss' +import style from '../css/popup.module.scss' interface params { state: any diff --git a/src/pages/sampleComparison/css/linkBlueTooth.module.scss b/src/pages/colorRelated/components/css/linkBlueTooth.module.scss similarity index 88% rename from src/pages/sampleComparison/css/linkBlueTooth.module.scss rename to src/pages/colorRelated/components/css/linkBlueTooth.module.scss index 0714b46..9b5de05 100644 --- a/src/pages/sampleComparison/css/linkBlueTooth.module.scss +++ b/src/pages/colorRelated/components/css/linkBlueTooth.module.scss @@ -1,10 +1,7 @@ .main { - width: 690px; - height: 86px; + width: 100%; background: #ffffff; border-radius: 10px; - margin-top: 24px; - margin-left: 30px; .bluetooth_link { display: flex; @@ -39,4 +36,4 @@ color: #f0ec09; } } -} \ No newline at end of file +} diff --git a/src/pages/sampleComparison/css/popup.module.scss b/src/pages/colorRelated/components/css/popup.module.scss similarity index 100% rename from src/pages/sampleComparison/css/popup.module.scss rename to src/pages/colorRelated/components/css/popup.module.scss diff --git a/src/pages/colorRelated/findColor/components/DrawerCenter/index.module.scss b/src/pages/colorRelated/findColor/components/DrawerCenter/index.module.scss new file mode 100644 index 0000000..2fe9efc --- /dev/null +++ b/src/pages/colorRelated/findColor/components/DrawerCenter/index.module.scss @@ -0,0 +1,46 @@ +.popups { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100vh; + .cover { + position: fixed; + height: 100vh; + width: 100vw; + top: 0; + left: 0; + background: rgba(0, 0, 0, 0.5); + z-index: 10; + } + .popcoms { + z-index: 100; + position: fixed; + top: 50%; + left: 50%; + border-radius: 20px; + transform: translateX(-50%) translateY(-50%); + .con { + width: 500px; + height: 100%; + display: flex; + flex-direction: column; + align-items: center; + } + .showRgb { + width: 100%; + height: 550px; + background-color: #fff; + border-radius: 20px; + } + .name { + width: 100%; + text-align: center; + color: #fff; + padding: 20px 0; + font-size: 26px; + background: rgba(0, 0, 0, 0.5); + border-radius: 20px; + } + } +} diff --git a/src/pages/colorRelated/findColor/components/DrawerCenter/index.tsx b/src/pages/colorRelated/findColor/components/DrawerCenter/index.tsx new file mode 100644 index 0000000..d1093b7 --- /dev/null +++ b/src/pages/colorRelated/findColor/components/DrawerCenter/index.tsx @@ -0,0 +1,30 @@ +import { View } from "@tarojs/components" +import React, { FC, memo, useEffect, useState } from "react" +import styles from './index.module.scss' + +type PropsType = { + showModal: boolean + children?: React.ReactNode +} + +const DrawerCenter: FC = memo((props) => { + const { children, showModal } = props + + const [show, setShow] = useState(false) + + useEffect(() => { + setShow(showModal) + }, [showModal]) + // 关闭 + const close = () => { + setShow(false) + } + + return show ? ( + + {children} + + + ) : null +}) +export default DrawerCenter diff --git a/src/pages/colorRelated/findColor/components/HistoryColor/index.module.scss b/src/pages/colorRelated/findColor/components/HistoryColor/index.module.scss new file mode 100644 index 0000000..753d211 --- /dev/null +++ b/src/pages/colorRelated/findColor/components/HistoryColor/index.module.scss @@ -0,0 +1,113 @@ + +.history_color { + .selectCon { + display: flex; + flex-direction: column; + align-items: center; + height: 100%; + .selectList { + width: 692px; + height: 230px; + background: #ffffff; + border-radius: 30px; + margin-bottom: 20px; + display: flex; + align-items: center; + padding: 20px 0; + box-sizing: border-box; + .rgbColor { + width: 161px; + height: 161px; + background: red; + border-radius: 50%; + margin-left: 30px; + box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.6); + } + .product_con { + display: flex; + flex-direction: column; + justify-content: center; + margin-left: 32px; + font-size: 26px; + height: 100%; + width: 300px; + color: #505050; + .product_name { + @include common_ellipsis(); + font-size: 28px; + color: #5f5f5f; + font-weight: 700; + margin-bottom: 46px; + } + .product_color { + @include common_ellipsis(); + margin-bottom: 15px; + } + .contrast { + display: flex; + margin-bottom: 20px; + .g_num { + @include common_ellipsis(); + } + .num { + color: #00499f; + background: #c9e4ff; + padding: 3px 10px; + border-radius: 7px; + margin-left: 18px; + } + } + .date { + background: rgba(0, 0, 0, 0.3); + color: #fff; + padding: 3px 10px; + border-radius: 10px; + width: 258px; + } + } + .labColor { + flex: 1; + // height: 100%; + display: flex; + flex-direction: column; + align-items: center; + font-size: 27px; + color: #707070; + .labColor_btn { + width: 47px; + height: 47px; + background: #007aff; + color: #fff; + text-align: center; + line-height: 47px; + border-radius: 50%; + font-size: 39px; + margin-bottom: 20px; + } + .labColor_con { + flex: 1; + .L, + .a { + margin-bottom: 10px; + } + } + } + } + .noData { + display: flex; + justify-content: center; + align-items: center; + color: #707070; + height: 100%; + width: 100%; + font-size: 26px; + } + } + .selectList-scroll-color { + height: 70vh; + width: 100%; + } + .drawer-container { + background: #f0f0f0; + } +} diff --git a/src/pages/colorRelated/findColor/components/HistoryColor/index.tsx b/src/pages/colorRelated/findColor/components/HistoryColor/index.tsx new file mode 100644 index 0000000..1335fcb --- /dev/null +++ b/src/pages/colorRelated/findColor/components/HistoryColor/index.tsx @@ -0,0 +1,89 @@ +import Popup from "@/components/popup" +import { ScrollView, View } from "@tarojs/components" +import { FC, useEffect, useState } from "react" +import styles from './index.module.scss' +import { formatDateTime} from "@/common/format"; +import {toRgb} from '@/common/bluetooth/color/colorSpace' +import Taro from "@tarojs/taro"; + +type PropsType = { + showModal: boolean + onColor?:Function +} + +const HistoryColor: FC = (props) => { + + + const { onColor, showModal } = props + const [show, setShow] = useState(false) + + + useEffect(() => { + setShow(showModal) + }, [showModal]) + + + const closeEven = () => { + setShow(false) + } + + const [list, setList] = useState([ + { + p_time: 0, + lab: [], + code: '', + name: '' + } + ]) + + //保留1位小数 + const noScale = (val, num = 1) => { + return val?.toFixed(num) + } + //rgb转换字符串 + const labRoRgb = (val) => { + const rgb = toRgb(val) + return `rgb(${rgb[0]},${rgb[1]},${rgb[2]})` + } + + const getInfo = (item) => { + onColor && onColor(item) + } + + + + return ( + + + + + {!!list?.length ? ( + list.map((item, index) => { + return ( + getInfo(item)}> + + + {item.code + ' ' + item.name} + {formatDateTime(item.p_time)} + + + + + + L*:{noScale(item.lab[0])} + a*:{noScale(item.lab[1])} + b*:{noScale(item.lab[2])} + + + + ) + }) + ) : ( + 暂无数据 + )} + + + + + ) +} +export default HistoryColor diff --git a/src/pages/colorRelated/findColor/components/LabColor/index.module.scss b/src/pages/colorRelated/findColor/components/LabColor/index.module.scss new file mode 100644 index 0000000..22da60f --- /dev/null +++ b/src/pages/colorRelated/findColor/components/LabColor/index.module.scss @@ -0,0 +1,46 @@ +.lab_color_main { + display: flex; + justify-content: space-between; + padding: 20px 0; + font-size: 28px; + .btnColor { + width: 264px; + height: 264px; + background: #dddddd; + border-radius: 50%; + text-align: center; + line-height: 264px; + color: #707070; + box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.6); + } + .labCon { + display: flex; + flex-direction: column; + justify-content: center; + padding: 20px 0 20px 20px; + color: #707070; + .lab { + color: #707070; + display: flex; + margin-bottom: 20px; + text { + display: flex; + &:nth-child(1) { + font-weight: 700; + } + &:nth-child(n + 2) { + background-color: #fff; + margin-left: 17px; + padding: 3px 15px; + border-radius: 10px; + width: 73px; + display: flex; + justify-content: center; + } + } + } + .date { + font-size: 26px; + } + } +} diff --git a/src/pages/colorRelated/findColor/components/LabColor/index.tsx b/src/pages/colorRelated/findColor/components/LabColor/index.tsx new file mode 100644 index 0000000..077fc22 --- /dev/null +++ b/src/pages/colorRelated/findColor/components/LabColor/index.tsx @@ -0,0 +1,54 @@ +import { View, Text } from '@tarojs/components' +import { FC, useMemo } from 'react' +import { toRgb } from '@/common/bluetooth/color/colorSpace' +import styles from './index.module.scss' +import { formatDateTime } from '@/common/format' + +type PropsType = { + lab?: Array + time?: any + onLab?: Function +} + +const LabColor: FC = (props) => { + const { lab = [], time, onLab } = props + const noScale = (val, num = 1) => { + return val.toFixed(num) + } + + const labObj = useMemo(() => { + if (lab.length <= 0) return { lab: [], rgb: '' } + const rgb = toRgb(lab) + return { + lab: [noScale(lab[0]), noScale(lab[1]), noScale(lab[2])], + rgb: `rgb(${rgb[0]},${rgb[1]},${rgb[2]})`, + } + }, [lab]) + + const labTime = useMemo(() => { + if (time.length <= 0) return '' + return formatDateTime(time) + }, [time]) + + const onLabEven = () => { + onLab && onLab() + } + + return ( + + + {!!labObj.lab.length ? '' : '点击取色'} + + + + L*a*b*: + {labObj.lab[0]} + {labObj.lab[1]} + {labObj.lab[2]} + + {labTime && 取样时间: {labTime}} + + + ) +} +export default LabColor diff --git a/src/pages/colorRelated/findColor/components/RecommendColor/index.module.scss b/src/pages/colorRelated/findColor/components/RecommendColor/index.module.scss new file mode 100644 index 0000000..0b1633a --- /dev/null +++ b/src/pages/colorRelated/findColor/components/RecommendColor/index.module.scss @@ -0,0 +1,121 @@ +.RecommendColor_main { + width: 100%; + .RecommendColor_list { + display: flex; + flex-wrap: wrap; + .RecommendColor_item { + background: #fff; + width: 48.5%; + height: 356px; + border-radius: 30px; + margin-bottom: 20px; + &:nth-child(2n) { + margin-left: 3%; + } + .rgbColor { + width: 100%; + height: 188px; + background: rgb(0, 195, 255); + border-radius: 30px 30px 0 0; + position: relative; + .lab { + width: 90px; + height: 100%; + background: rgba(0, 0, 0, 0.3); + position: absolute; + right: 0; + top: 0; + border-radius: 0 30px 0 0; + color: #fff; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: 26px; + text { + &:nth-child(1) { + font-weight: 700; + margin-bottom: 10px; + } + } + } + } + .product_con { + display: flex; + flex-direction: column; + font-size: 26px; + padding: 10px 15px 15px 15px; + box-sizing: border-box; + .product_color { + color: #505050; + @include common_ellipsis(); + } + .product_title { + display: flex; + justify-content: space-between; + .product_name { + @include common_ellipsis(); + color: #0c68c5; + font-weight: 700; + font-size: 28px; + flex: 1; + margin-right: 10px; + } + .product_num { + background: #c9e4ff; + color: #00499f; + padding: 3px 6px; + font-size: 26px; + border-radius: 5px; + margin-bottom: 13px; + } + } + .date { + margin-top: 15px; + color: #808080; + display: flex; + align-items: center; + justify-content: space-between; + .labColor_btn { + width: 47px; + height: 47px; + background: #007aff; + color: #fff; + text-align: center; + line-height: 47px; + border-radius: 50%; + font-size: 39px; + margin-right: 10px; + } + .g_num { + flex: 1; + margin-right: 10px; + @include common_ellipsis(); + } + } + } + } + } + .con { + width: 500px; + height: 100%; + display: flex; + flex-direction: column; + align-items: center; + .showRgb { + width: 100%; + height: 550px; + background-color: #fff; + border-radius: 20px; + } + .name { + width: 100%; + text-align: center; + color: #fff; + padding: 20px 0; + font-size: 26px; + background: rgba(0, 0, 0, 0.5); + border-radius: 20px; + } + } +} diff --git a/src/pages/colorRelated/findColor/components/RecommendColor/index.tsx b/src/pages/colorRelated/findColor/components/RecommendColor/index.tsx new file mode 100644 index 0000000..2e2bc10 --- /dev/null +++ b/src/pages/colorRelated/findColor/components/RecommendColor/index.tsx @@ -0,0 +1,83 @@ +import { FC, useState } from 'react' +import { View, Text } from '@tarojs/components' +import { toRgb } from '@/common/bluetooth/color/colorSpace' +import styles from './index.module.scss' +import { formatDateTime } from '@/common/format' +import classnames from 'classnames' +import DrawerCenter from '../DrawerCenter' + +type PropsType = { + list?: Array + customStyle?: React.CSSProperties +} + +const RecommendColor: FC = (props) => { + + const { list, customStyle = {} } = props + + //rgb转换字符串 + const labRoRgb = (val) => { + const lab = val ? [val.l, val.a, val.b] : [] + const rgb = toRgb(lab) + return `rgb(${rgb[0]},${rgb[1]},${rgb[2]})` + } + + //保留1位小数 + const noScale = (val, num = 1) => { + return val.toFixed(num) + } + + const [show, setShow] = useState(false) + const [selectObj, setSelectObj] = useState({ + rgb: '', + product_color_code: '', + product_color_name: '' + }) + + const openShow = (val) => { + setShow(true) + setSelectObj(val) + setSelectObj({ ...val, rgb: labRoRgb(val.lab) }) + } + + + return ( + + + {list?.map((item) => { + return ( + openShow(item)}> + + + L*a*b* + {noScale(item.lab.l)} + {noScale(item.lab.a)} + {noScale(item.lab.b)} + + + + + {item.product_code + '# ' + item.product_name} + {noScale(item.match_rate_percent, 1)}% + + {item.product_color_code + ' ' + item.product_color_name} + + {item.dyelot_number} + + + + + + ) + })} + + + + + + {selectObj.product_color_code + ' ' + selectObj.product_color_name} + + + + ) +} +export default RecommendColor diff --git a/src/pages/colorRelated/findColor/index.config.ts b/src/pages/colorRelated/findColor/index.config.ts new file mode 100644 index 0000000..f3418f1 --- /dev/null +++ b/src/pages/colorRelated/findColor/index.config.ts @@ -0,0 +1,4 @@ +export default { + navigationBarTitleText: '取色查找', + enableShareAppMessage: false, +} diff --git a/src/pages/colorRelated/findColor/index.module.scss b/src/pages/colorRelated/findColor/index.module.scss new file mode 100644 index 0000000..a9abbf6 --- /dev/null +++ b/src/pages/colorRelated/findColor/index.module.scss @@ -0,0 +1,94 @@ +page { + height: 100vh; +} +.findColor_main { + display: flex; + flex-direction: column; + align-items: center; + padding: 20px; + min-height: 100%; + background: #f3f3f3; + box-sizing: border-box; + .findColor_main_search { + background: #fff; + width: 100%; + padding: 0 20rpx; + border-radius: 20rpx; + box-sizing: border-box; + } + .findColor_main_title { + width: 100%; + .RecommendColor_title { + display: flex; + justify-content: space-between; + font-size: 28px; + margin-bottom: 20px; + padding: 10px 20px; + box-sizing: border-box; + color: #707070; + font-weight: bold; + border-bottom: 1px dashed #e4e4e4; + width: 100%; + text { + &:nth-child(2) { + color: #007aff; + } + } + } + } + .noList { + flex: 1; + width: 100%; + display: flex; + justify-content: center; + align-items: center; + color: #707070; + font-size: 26px; + } + .list { + display: flex; + padding: 20px; + box-sizing: border-box; + border: 1px solid #ccc; + width: 100%; + justify-content: space-between; + border-radius: 10px; + font-size: 25px; + margin-top: 20px; + } + .measure { + width: 100%; + .list { + justify-content: center; + } + .content { + width: 100%; + } + .diff { + text-align: center; + } + } + .color { + margin-top: 20px; + } + .labAndRgb { + display: flex; + width: 100%; + justify-content: center; + margin-top: 30px; + .item { + margin-top: 20px; + font-size: 28px; + } + } + .color_list { + margin-top: 30px; + margin-bottom: 30px; + display: flex; + justify-content: center; + .color_item { + width: 250px; + height: 250px; + } + } +} diff --git a/src/pages/colorRelated/findColor/index.tsx b/src/pages/colorRelated/findColor/index.tsx new file mode 100644 index 0000000..344022a --- /dev/null +++ b/src/pages/colorRelated/findColor/index.tsx @@ -0,0 +1,140 @@ +import { View, Text } from '@tarojs/components' +import { FC, useEffect, useState } from 'react' +import styles from './index.module.scss' +import LineBluetooth from '../components/bluetooth/LinkBlueTooth' +import HistoryColor from './components/HistoryColor' +import LabColor from './components/LabColor' +import SelectProduct from '@/components/selectProduct' +import { useBluetooth } from '@/use/contextBlueTooth' +import RecommendColor from './components/RecommendColor' +import { FindColorListApi } from '@/api/index' +import Loading from '@/components/loading' +import Taro from '@tarojs/taro' +import { throttle } from '@/common/util' + +const FindColor: FC = () => { + const { measureAndGetLab, disconnect, connected, deviceLab } = useBluetooth() + const { state: colorState, fetchData: ApiFindColorList } = FindColorListApi() + + const [list, setList] = useState([]) + const [product, setProduct] = useState>({}) + + //获取数据 + const getData = async () => { + setList([]) + await ApiFindColorList({ + product_id: product.id, + l: labArray[0], + a: labArray[1], + b: labArray[2], + }) + setList(colorState.data.list) + } + + const [labArray, setlabArray] = useState>([]) + const [labtime, setLabtime] = useState(+new Date()) + //点击获取lab按钮 + const labEven = throttle(async () => { + if (!connected) { + Taro.showToast({ title: '请先链接设备', icon: 'none' }) + return + } + if (!product) { + Taro.showToast({ title: '请选择面料', icon: 'none' }) + return + } + await measureAndGetLab() + }, 500) + const selectInput = (val) => { + setProduct(val) + setLabtime('') + setlabArray([]) + setList([]) + } + + const getColor = (val) => { + setList([]) + setlabArray(val.lab) + setLabtime(val.p_time) + setProduct({ + code: val.code, + default: val.default, + id: val.id, + name: val.name, + }) + getData() + } + + const [listLoading, setListLoading] = useState(false) + + useEffect(() => { + setListLoading(colorState.loading) + }, [colorState]) + + const [showHistory, setShowHistory] = useState(false) + + const ResultContainer = () => { + if (!listLoading && list?.length > 0) { + return + } else if (!listLoading && labArray.length == 0) { + return -请取色- + } else if (!listLoading && labArray.length > 0 && list?.length == 0) { + return -暂无数据- + } else if (listLoading) { + return + } + } + + //历史取样 + const historyShowEven = () => { + setShowHistory(true) + } + + useEffect(() => { + if (!product) { + Taro.showToast({ title: '请选择面料', icon: 'none' }) + return + } + if (deviceLab) { + setLabtime(+new Date()) + setlabArray([deviceLab.L, deviceLab.a, deviceLab.b]) + // console.log('state.labArray::',state.labArray) + localSave() + getData() + } + }, [deviceLab]) + + //本地存储取色记录(无差别存储版本) + const localSave = () => { + let historyColorList = Taro.getStorageSync('historyColor') || [] + let obj = { + ...product, + p_time: labtime, + lab: labArray, + } + historyColorList.unshift(obj) + if (historyColorList.length > 30) historyColorList.pop() + Taro.setStorageSync('historyColor', historyColorList) + } + + return ( + + + + + + + + + 推荐数 ({list?.length}) + 历史取样 + + + + {ResultContainer()} + + + ) +} + +export default FindColor diff --git a/src/pages/sampleComparison/index.config.ts b/src/pages/colorRelated/sampleComparison/index.config.ts similarity index 100% rename from src/pages/sampleComparison/index.config.ts rename to src/pages/colorRelated/sampleComparison/index.config.ts diff --git a/src/pages/sampleComparison/index.module.scss b/src/pages/colorRelated/sampleComparison/index.module.scss similarity index 100% rename from src/pages/sampleComparison/index.module.scss rename to src/pages/colorRelated/sampleComparison/index.module.scss diff --git a/src/pages/sampleComparison/index.tsx b/src/pages/colorRelated/sampleComparison/index.tsx similarity index 90% rename from src/pages/sampleComparison/index.tsx rename to src/pages/colorRelated/sampleComparison/index.tsx index c0f6885..471c377 100644 --- a/src/pages/sampleComparison/index.tsx +++ b/src/pages/colorRelated/sampleComparison/index.tsx @@ -1,10 +1,10 @@ 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 { useBluetooth } from '@/use/contextBlueTooth' import classnames from 'classnames' -import LinkBlueTooth from './compoents/bluetooth/LinkBlueTooth' -import { toRgb } from '../../common/bluetooth/color/colorSpace' +import LinkBlueTooth from '../components/bluetooth/LinkBlueTooth' +import { toRgb } from '@/common/bluetooth/color/colorSpace' import styles from './index.module.scss' import { productabsorbcontrast } from '@/api/index' export default () => { @@ -119,16 +119,9 @@ export default () => { } return ( - {/* - - 蓝牙设备 - - - - - - */} - + + + 基础样品 diff --git a/src/pages/colorRelated/takeColor/components/ColorCard/index.module.scss b/src/pages/colorRelated/takeColor/components/ColorCard/index.module.scss new file mode 100644 index 0000000..df46437 --- /dev/null +++ b/src/pages/colorRelated/takeColor/components/ColorCard/index.module.scss @@ -0,0 +1,184 @@ + +@mixin flex-center { + display: flex; + justify-content: center; + align-items: center; +} +@mixin flex-vertical-center { + display: flex; + align-items: center; +} +@mixin ellipsis { + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + display: inline-block; +} +.color-list { + @include flex-vertical-center; + justify-content: space-between; + width: 690px; + background: #ffffff; + opacity: 1; + padding: 30px; + box-sizing: border-box; + margin: 20px auto 0; + border-radius: 35px; + z-index: 0; + position: relative; + border: 4px solid transparent; +} +.vertical { + position: absolute; + width: 0; + height: 105%; + z-index: -1; + overflow: hidden; + top: 50%; + left: 50%; + border-radius: 35px; + transform: translate(-50%, -50%); +} +.vertical view { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + width: 690px; + height: 95%; + border-radius: 35px; + border: 4px solid #007aff; + // border-bottom: 3px solid #007AFF; +} +.move-vertical { + width: 700px; + animation: moveVertical 0.3s ease; +} +@keyframes moveVertical { + from { + width: 0; + } + to { + width: 700px; + } +} +.horizontal { + position: absolute; + width: 100%; + height: 100%; + z-index: -1; + overflow: hidden; + top: 50%; + left: 50%; + border-radius: 35px; + transform: translate(-50%, -50%); +} +.move-horizontal { + height: 0; + animation: moveHorizontal 0.3s ease 0.3s; +} +@keyframes moveHorizontal { + from { + height: 100%; + } + to { + height: 0; + } +} +.flash { + animation-name: KFlash; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-direction: alternate; + animation-iteration-count: infinite; +} +@keyframes KFlash { + to { + border: 4px solid #999; + } +} +.c-image { + width: 161px; + height: 161px; + background: rgba(0, 0, 0, 0); + overflow: hidden; + border-radius: 50%; + position: relative; +} +.c-image text { + font-size: 25px; + color: white; + position: absolute; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); +} +.c-image image { + width: 100%; + height: 100%; +} +.c-info { + width: 296px; + margin-left: 25px; + margin-right: 25px; + overflow: hidden; + line-height: 34px; +} +.c-info text { + @include ellipsis; + width: 100%; + font-size: 26px; + font-weight: 400; + line-height: 34px; + color: #707070; +} +.c-i-title { + @include ellipsis; + width: 100%; + font-size: 28px; + font-weight: bold; + line-height: 38px; + color: #707070; + margin: 5px 0; +} +.c-i-date { + @include flex-center; + width: 268px; + height: 38px; + background: rgba(0, 0, 0, 0.3); + border-radius: 6px; + font-size: 24px; + font-weight: 400; + color: #ffffff; + margin-top: 17px; +} +.c-lab { + height: 100%; + justify-self: flex-end; + @include flex-vertical-center; + flex-direction: column; +} +.c-lab .c-lab-button { + @include flex-center; + height: 48px; + min-width: 96px; + background: #007aff; + border-radius: 50px; + font-size: 24px; + font-weight: 400; + line-height: 32px; + color: #ffffff; + margin-bottom: 12px; + padding: 0 15px; +} +.c-lab .c-lab-button.again { + background: #f0f0f0; + color: #007aff; +} +.c-lab .c-lab-text { + font-size: 24px; + font-weight: 400; + line-height: 36px; + color: #707070; + margin-top: 25px; +} diff --git a/src/pages/colorRelated/takeColor/components/ColorCard/index.tsx b/src/pages/colorRelated/takeColor/components/ColorCard/index.tsx new file mode 100644 index 0000000..0a18dbd --- /dev/null +++ b/src/pages/colorRelated/takeColor/components/ColorCard/index.tsx @@ -0,0 +1,78 @@ +import { View, Text } from '@tarojs/components' +import React, { FC } from 'react' +import classnames from 'classnames' +import styles from './index.module.scss' +import { formatHashTag } from '@/common/format' +import dayjs from 'dayjs' + +type PropsType = { + item?: Record + key?: any + index?: number + onPreviewRgb?: Function + onTakeColor?: Function +} + +const ColorCard: FC = (params) => { + const { item = {}, index, onTakeColor, onPreviewRgb, key } = params + + const truncation = (ev) => { + if (ev) { + ev += '' + let index = ev.lastIndexOf('.') + let suffix = ev.substr(index + 1) + if (suffix.length > 2) { + suffix = suffix.substr(0, 1) + ev = ev.substr(0, index) + '.' + suffix + } + return ev + } else { + return 0 + } + } + + const handleTakeColor = () => { + onTakeColor && onTakeColor(index) + } + + const handlePreviewRgb = () => { + onPreviewRgb && onPreviewRgb() + } + + return ( + + + + + + + {!item.sampling && 末取样} + + + {formatHashTag(item.product_code, item.product_name)} + {formatHashTag(item.product_color_code, item.product_color_name)} + {item.absorb_lab_time && dayjs(item.absorb_lab_time).format('YYYY-MM-DD HH:mm:ss')} + + + + {item.sampling ? '重新取样' : '取样'} + + + L*: {truncation(item?.currentLab?.l)} + a*: {truncation(item?.currentLab?.a)} + b*: {truncation(item?.currentLab?.b)} + + + + ) +} +export default ColorCard diff --git a/src/pages/colorRelated/takeColor/components/Texture/index.module.scss b/src/pages/colorRelated/takeColor/components/Texture/index.module.scss new file mode 100644 index 0000000..1052c3c --- /dev/null +++ b/src/pages/colorRelated/takeColor/components/Texture/index.module.scss @@ -0,0 +1,68 @@ + + @mixin flex-center{ + display: flex; + justify-content: center; + align-items: center; + } + @mixin flex-vertical-center{ + display: flex; + align-items: center; + } + .tc-info{ + @include flex-vertical-center; + justify-content: space-between; + margin: 15px 30px; + } + .tc-i-upload{ + width: 264px; + height: 264px; + background: #DDDDDD; + border-radius: 264px; + position: relative; + z-index: 1; + overflow: hidden; + } + .tc-i-upload image{ + width: 100%; + height: 100%; + } + .tc-i-u-box{ + @include flex-center; + flex-direction: column; + position: absolute; + z-index: -1; + width: 100%; + height: 100%; + color: #707070; + font-size: 26px; + } + .tc-i-u-box text{ + margin-bottom: 15px; + font-size: 50px; + } + .tc-i-num{ + @include flex-vertical-center; + font-size: 44px; + font-weight: 400; + line-height: 58px; + } + .tc-i-num>view{ + padding: 0 48px; + position: relative; + text-align: center; + } + .tc-i-num>view:first-child::after{ + content: " "; + width: 0px; + height: 64px; + border: 2px solid #DDDDDD; + position: absolute; + right: 0;top: 50%; + transform: translateY(-50%); + } + .tc-i-num text{ + font-size: 26px; + font-weight: 400; + line-height: 34px; + color: #707070; + } diff --git a/src/pages/colorRelated/takeColor/components/Texture/index.tsx b/src/pages/colorRelated/takeColor/components/Texture/index.tsx new file mode 100644 index 0000000..ce2e466 --- /dev/null +++ b/src/pages/colorRelated/takeColor/components/Texture/index.tsx @@ -0,0 +1,48 @@ +import { View, Text,Image } from '@tarojs/components' +import styles from './index.module.scss' +import classnames from 'classnames' +import { FC, useRef, useState } from "react" +import Upload from '../Upload' +import {screenshot} from '@/common/util' + + +type PropsType = { + onUploadConfirm?: Function +} + +const Texture:FC = (params) => { + const {onUploadConfirm} = params + + const handleUploadConfirm = () => { + onUploadConfirm && onUploadConfirm() + } + + const uploadEl = useRef() + + return ( + + + + {detail.texture_url && } + + + + 上传纹理 + + + + + {(data?.list?.length ?? 0) - calcNoSampling} + 已取样 + + + {calcNoSampling} + 未取样 + + + + + + ) +} +export default Texture diff --git a/src/pages/colorRelated/takeColor/components/Upload/index.module.scss b/src/pages/colorRelated/takeColor/components/Upload/index.module.scss new file mode 100644 index 0000000..67f90fc --- /dev/null +++ b/src/pages/colorRelated/takeColor/components/Upload/index.module.scss @@ -0,0 +1,68 @@ + + @mixin flex-center{ + display: flex; + justify-content: center; + align-items: center; + } + @mixin flex-vertical-center{ + display: flex; + align-items: center; + } + .upload-container .drawer{ + position: fixed; + top: 0; + z-index: 10; + } + .u-content{ + @include flex-center; + flex-direction: column; + width: 100%; + padding: 65px 0; + } + .u-image{ + width: 422px; + height: 422px; + background: #F0F0F0; + border-radius: 50%; + overflow: hidden; + position: relative; + z-index: 0; + } + .u-image view{ + width: 100%; + height: 100%; + @include flex-center; + font-size: 28px; + font-weight: 400; + color: #707070; + position: absolute; + top: 0;left: 0; + z-index: 1; + } + .u-image .update-statu{ + color: white; + background-color: rgba(0, 0, 0, 0.5); + } + .u-image image{ + width: 100%; + height: 100%; + } + .u-button{ + display: flex; + margin-top: 76px; + } + .u-button view{ + width: 264px; + height: 82px; + background: #F0F0F0; + border-radius: 82px; + @include flex-center; + font-size: 32px; + font-weight: 400; + color: #007AFF; + margin: 0 15px; + } + .u-button .confirm{ + background: #007AFF; + color: white; + } diff --git a/src/pages/colorRelated/takeColor/components/Upload/index.tsx b/src/pages/colorRelated/takeColor/components/Upload/index.tsx new file mode 100644 index 0000000..fd3207f --- /dev/null +++ b/src/pages/colorRelated/takeColor/components/Upload/index.tsx @@ -0,0 +1,62 @@ +import Popup from "@/components/popup" +import { FC, useState } from "react" +import { View, Text,Image } from '@tarojs/components' +import styles from './index.module.scss' +import classnames from 'classnames' +import Taro from "@tarojs/taro" + +type PropsType = { + onUploadConfirm?: Function +} + +const UploadColor: FC = (params) => { + const { onUploadConfirm } = params + const [showModal, setShowModal] = useState(false) + const [filePath, setFilePath] = useState('') + const [file, setFile] = useState({}) + + const handleUpload = async () => { + Taro.chooseMedia({ + count: 1, + mediaType: ['image'], + sourceType: ['album'], + success(ev) { + setFilePath(ev.tempFiles[0].tempFilePath) + setFile(ev.tempFiles[0]) + }, + }) + } + + const handleTriggerUploadModal = (bool: boolean) => { + setShowModal(bool) + } + + const handleClear = () => { + setFilePath('') + } + const handleUploadConfirm = () => { + onUploadConfirm && onUploadConfirm(file) + } + + + return ( + + handleTriggerUploadModal(false)}> + + + {filePath && } + + {filePath ? '点击修改' : '点击上传'} + + + 清除 + + 确定 + + + + + + ) +} +export default UploadColor diff --git a/src/pages/colorRelated/takeColor/index.config.ts b/src/pages/colorRelated/takeColor/index.config.ts new file mode 100644 index 0000000..6168a81 --- /dev/null +++ b/src/pages/colorRelated/takeColor/index.config.ts @@ -0,0 +1,4 @@ +export default { + navigationBarTitleText: '颜色取样', + enableShareAppMessage: false, +} diff --git a/src/pages/colorRelated/takeColor/index.module.scss b/src/pages/colorRelated/takeColor/index.module.scss new file mode 100644 index 0000000..276923e --- /dev/null +++ b/src/pages/colorRelated/takeColor/index.module.scss @@ -0,0 +1,148 @@ +@mixin flex-center { + display: flex; + justify-content: center; + align-items: center; +} +@mixin flex-vertical-center { + display: flex; + align-items: center; +} +page { + background: #f3f3f3; +} +.card { + background: #fff; + padding: 0 20px; + border-radius: 20px; + box-sizing: border-box; + margin: 26px 30px; +} +.list-box { + padding-bottom: 220px; +} +.lb-title { + font-size: 28px; + font-weight: 400; + line-height: 38px; + color: #707070; + border-top: 1px dashed #e4e4e4; + padding: 26px 46px; + box-sizing: border-box; + display: flex; + justify-content: space-between; + align-items: center; +} +.lb-t-serach { + @include flex-vertical-center; + height: 100px; +} +.lb-t-serach .icon-a-sousuo1 { + font-size: 38px; + color: #cccccc; +} +.lb-t-serach .lb-t-search-content { + display: flex; + justify-content: flex-end; +} +.lb-t-serach .lb-t-search-content > text { + padding: 10px 0; + color: #707070; + font-size: 24px; +} +.lb-t-search-content > view { + @include flex-vertical-center; + width: 280px; + height: 66px; + background-color: #e7e7e7; + border-radius: 30px; + margin-right: 10px; + font-size: 28px; + padding-left: 20px; + padding-right: 10px; + overflow: hidden; +} +.lb-title input { + width: 80%; + height: 66px; + background-color: #e7e7e7; + font-size: 26px; +} +.lb-t-search-content text { + color: #fff; + font-size: 30px; +} +.lb-t-sc-clear { + width: 66px; + height: 66px; + text-align: center; + line-height: 66px; +} +.lb-t-sc-clear .icon-a-cuowuwrong { + width: 43px; + height: 43px; + text-align: center; + line-height: 43px; + border-radius: 50%; + background: #c7c7c7; + display: inline-block; +} +.not-list { + font-size: 28px; + font-weight: 400; + line-height: 38px; + color: #707070; + margin-top: 180px; + text-align: center; +} + +.lab-view { + position: fixed; + left: 0; + top: 0; + width: 100%; + height: 100%; + z-index: 100; + background-color: rgba(0, 0, 0, 1); +} +.lab-view view { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + width: 100%; + height: 0; + padding-bottom: 100%; +} + +.fixedBottom-container { + position: fixed; + bottom: 0; + left: 0; + right: 0; + display: flex; + justify-content: space-between; + width: 750px; + height: 182px; + background: #f3f3f3; + box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.16); + padding: 35px 68px; + box-sizing: border-box; +} +.fixedBottom-container view { + width: 264px; + height: 82px; + background: #ffffff; + opacity: 1; + border-radius: 50px; + display: flex; + justify-content: center; + align-items: center; + font-size: 32px; + font-weight: 400; + line-height: 42px; + color: #007aff; +} +.fixedBottom-container .fb-confirm { + background-color: #007aff; + color: white; +} diff --git a/src/pages/colorRelated/takeColor/index.tsx b/src/pages/colorRelated/takeColor/index.tsx new file mode 100644 index 0000000..4940017 --- /dev/null +++ b/src/pages/colorRelated/takeColor/index.tsx @@ -0,0 +1,136 @@ +import { View, Input, Text } from '@tarojs/components' +import { FC, useMemo, useState } from 'react' +import LinkBlueTooth from '../components/bluetooth/LinkBlueTooth' +import SelectProduct from '@/components/selectProduct/index' +import styles from './index.module.scss' +import ColorCard from './components/ColorCard' +import IconFont from '@/components/iconfont' +import { ColorListApi, ColorDetailedApi, TextureSaveApi, ColorSamplingSaveApi } from '@/api/index' +import { formatHashTag } from '@/common/format' +// 颜色取样 +const TakeColor: FC = () => { + const { state, fetchData } = ColorListApi() + const { state: detail, fetchData: detailFetchData } = ColorDetailedApi() + const { state: textureSaveData, fetchData: textureSaveFetchData } = TextureSaveApi() + const { state: saveData, fetchData: saveFetchData, success: saveSuccess } = ColorSamplingSaveApi() + + const [searchValue, setSearchValue] = useState('') + + const selectInput = async (event) => { + // if (event) { + // selectedProduct.value = event + // await fetchData({ id: event.id }) + // data.value?.list.map((item, index) => { + // item.currnetRgb = item.rgb + // item.currentLab = item.lab + // item.sampling = !(item.currentLab?.l == 0 && item.currentLab?.a == 0 && item.currentLab?.b == 0) + // item.moveBorder = 0 + // item.key = index + // }) + // detailFetchData({ id: event.id }) + // } else { + // data.value.list = [] + // } + } + const clearSearchValue = () => { + setSearchValue('') + } + + const handleTransfSearch = (bool: boolean) => { + setShowScreen(bool) + } + const handlePrViewRgb = (event) => { + setLabPreview(event) + setShowLabPreview(true) + } + const handleTakeColor = () => {} + + const listData = useMemo(() => { + return state.data?.list?.filter((item) => { + if (searchValue) { + return formatHashTag(item.product_color_name, item.product_color_code)!.includes(searchValue) + } + return true + }) + }, [state]) + + const [showScreen, setShowScreen] = useState(false) + + const onSearchInput = (event) => { + const current = event.detail.value + setSearchValue(current) + } + // 重置 + const handleReset = () => {} + + // 提交 + const handleSubmit = () => {} + + const [labPreview, setLabPreview] = useState({ + currnetRgb: { + r: 0, + g: 0, + b: 0, + }, + }) + + const [showLabPreview, setShowLabPreview] = useState(false) + + return ( + <> + + + + + + + 颜色列表({listData?.length ?? 0}) + + {showScreen ? ( + + + + + {searchValue.length > 0 && } + + + handleTransfSearch(false)}>取消 + + ) : ( + handleTransfSearch(true)}> + + + )} + + + {listData ? ( + listData.map((item, index) => { + return + }) + ) : ( + -请取色- + )} + + + 重置 + + 提交 + + + {showLabPreview && ( + setShowLabPreview(false)} className={styles['lab-view']}> + + + )} + + ) +} + +export default TakeColor diff --git a/src/pages/orderDetails/components/advanceOrderState/index.tsx b/src/pages/orderDetails/components/advanceOrderState/index.tsx index d500c56..8a28d85 100644 --- a/src/pages/orderDetails/components/advanceOrderState/index.tsx +++ b/src/pages/orderDetails/components/advanceOrderState/index.tsx @@ -1,74 +1,71 @@ -import { formatImgUrl } from "@/common/fotmat"; -import { Image, Text, View } from "@tarojs/components"; -import { memo, useEffect, useMemo, useRef, useState } from "react"; -import classnames from "classnames"; -import styles from './index.module.scss' -import dayjs from "dayjs"; -import { useTimeCountDown } from "@/use/useCommon"; -import { ORDER_STATUS, PAYMENT_METHOD } from "@/common/enum"; +import { formatImgUrl } from '@/common/format' +import { Image, Text, View } from '@tarojs/components' +import { memo, useEffect, useMemo, useRef, useState } from 'react' +import classnames from 'classnames' +import styles from './index.module.scss' +import dayjs from 'dayjs' +import { useTimeCountDown } from '@/use/useCommon' +import { ORDER_STATUS, PAYMENT_METHOD } from '@/common/enum' type List = { - status: string, - time: string, - tag: string, - desc: string, - expire_time: string + status: string + time: string + tag: string + desc: string + expire_time: string } type Param = { - onRefresh?: () => void, - orderInfo?: { - logistics_details:List[], //订单状态列表 - payment_method: number, //支付方式 - status: number, //订单状态 - } + onRefresh?: () => void + orderInfo?: { + logistics_details: List[] //订单状态列表 + payment_method: number //支付方式 + status: number //订单状态 + } } +export default memo(({ orderInfo, onRefresh }: Param) => { + const { showTime, onStart, timeStatus } = useTimeCountDown() -export default memo(({orderInfo, onRefresh}:Param) => { + //订单状态枚举 + const { SaleorderstatusWaitingPrePayment } = ORDER_STATUS - const {showTime, onStart, timeStatus} = useTimeCountDown() + //获取预付款最后时间 + const endTime = useMemo(() => { + if (orderInfo?.status == SaleorderstatusWaitingPrePayment.value && orderInfo.logistics_details.length > 0) { + return orderInfo.logistics_details[0].expire_time + } + return '' + }, [orderInfo]) - //订单状态枚举 - const {SaleorderstatusWaitingPrePayment} = ORDER_STATUS + useEffect(() => { + if (endTime) onStart(endTime) + }, [endTime]) - //获取预付款最后时间 - const endTime = useMemo(() => { - if(orderInfo?.status == SaleorderstatusWaitingPrePayment.value && orderInfo.logistics_details.length > 0) { - return orderInfo.logistics_details[0].expire_time - } - return '' - }, [orderInfo]) + useEffect(() => { + if (timeStatus == 2) onRefresh?.() + }, [timeStatus]) - useEffect(() => { - if(endTime) onStart(endTime) - }, [endTime]) - - useEffect(() => { - if(timeStatus == 2) onRefresh?.() - }, [timeStatus]) - - - return ( - - - - - {showTime.HH} - : - {showTime.MM} - : - {showTime.SS} - - 支付关闭,订单自动取消 - - - - - onRefresh?.()}> - - 刷新 - + return ( + + + + + {showTime.HH} + : + {showTime.MM} + : + {showTime.SS} - ) -}) \ No newline at end of file + 支付关闭,订单自动取消 + + + + + onRefresh?.()}> + + 刷新 + + + ) +}) diff --git a/src/pages/searchPage/compoents/empty/index.module.scss b/src/pages/searchPage/components/empty/index.module.scss similarity index 100% rename from src/pages/searchPage/compoents/empty/index.module.scss rename to src/pages/searchPage/components/empty/index.module.scss diff --git a/src/pages/searchPage/compoents/empty/index.tsx b/src/pages/searchPage/components/empty/index.tsx similarity index 100% rename from src/pages/searchPage/compoents/empty/index.tsx rename to src/pages/searchPage/components/empty/index.tsx diff --git a/src/pages/searchPage/compoents/goods/index.module.scss b/src/pages/searchPage/components/goods/index.module.scss similarity index 100% rename from src/pages/searchPage/compoents/goods/index.module.scss rename to src/pages/searchPage/components/goods/index.module.scss diff --git a/src/pages/searchPage/compoents/goods/index.tsx b/src/pages/searchPage/components/goods/index.tsx similarity index 100% rename from src/pages/searchPage/compoents/goods/index.tsx rename to src/pages/searchPage/components/goods/index.tsx diff --git a/src/pages/searchPage/index.tsx b/src/pages/searchPage/index.tsx index 0e5b5b9..ebde3c4 100644 --- a/src/pages/searchPage/index.tsx +++ b/src/pages/searchPage/index.tsx @@ -3,9 +3,9 @@ import React, { useCallback, memo, useEffect, useMemo, useRef, useState } from ' import Search from '@/components/search' import styles from "./index.module.scss" import classnames from "classnames"; -import Empty from './compoents/empty' +import Empty from './components/empty' import Taro from '@tarojs/taro'; -import Goods from './compoents/goods' +import Goods from './components/goods' import { mpproductlist } from "@/api/search" export default memo(() => { @@ -95,4 +95,4 @@ export default memo(() => { ) -}) \ No newline at end of file +}) diff --git a/src/pages/user/index.tsx b/src/pages/user/index.tsx index c12e407..82db81f 100644 --- a/src/pages/user/index.tsx +++ b/src/pages/user/index.tsx @@ -65,17 +65,17 @@ const fabric: IconCardType[] = [ { iconName: 'icon-yansequyang', name: '颜色取样', - path: '', + path: '/pages/colorRelated/takeColor/index', }, { iconName: 'icon-qusechazhao', name: '取色查找', - path: '', + path: '/pages/colorRelated/findColor/index', }, { iconName: 'icon-yangpinduibi', name: '样品对比', - path: '/pages/sampleComparison/index', + path: '/pages/colorRelated/sampleComparison/index', }, ] diff --git a/src/styles/common.scss b/src/styles/common.scss index 9f2f08b..2e6c669 100644 --- a/src/styles/common.scss +++ b/src/styles/common.scss @@ -42,3 +42,18 @@ $customTabBarHeight: 100px; height: 100%; } +.color-blue{ + color: #3287EC; +} +.color-yellow{ + color: #FF9100; +} +.color-green{ + color: #00B837; +} +.color-grey{ + color: #707070; +} +.color-white{ + color: white; +} diff --git a/src/use/useHttp.ts b/src/use/useHttp.ts index c21dc07..3a6cf56 100644 --- a/src/use/useHttp.ts +++ b/src/use/useHttp.ts @@ -122,7 +122,6 @@ export const useRequest = ( } const stateRef = useRef({ ...params }) - console.log('stateRef==>', stateRef) const [state, setState] = useState({ ...stateRef.current }) const { removeToken, removeSessionKey, removeUserInfo } = useUserInfo() const { login } = useLoginRequest() @@ -205,8 +204,6 @@ export const useRequest = ( stateRef.current.error = false stateRef.current.loading = false setState(() => ({...stateRef.current})) - console.log('request result stateRef', stateRef.current) - console.log('request result state', state) return stateRef.current } return { From 6743d6bb21c2e45451bebac12ec86b43d727fc3d Mon Sep 17 00:00:00 2001 From: xuan Date: Wed, 14 Sep 2022 14:02:26 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=F0=9F=90=9E=20fix(iconfont=E6=96=87?= =?UTF-8?q?=E4=BB=B6):=20=E5=BC=95=E7=94=A8=E7=9A=84=20ttf=20=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E4=BD=BF=E7=94=A8=E7=9B=B8=E5=AF=B9=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iconfont.json | 4 +- .../{IconAJizhumima.js => IconAJizhumima.tsx} | 12 +- .../h5/{IconBianji.js => IconBianji.tsx} | 12 +- .../h5/{IconBiyan.js => IconBiyan.tsx} | 12 +- .../h5/{IconCangku.js => IconCangku.tsx} | 12 +- ...quanbukehu.js => IconChakanquanbukehu.tsx} | 12 +- .../h5/{IconDaikuan.js => IconDaikuan.tsx} | 12 +- .../h5/{IconDingdan.js => IconDingdan.tsx} | 12 +- .../h5/{IconDingdan1.js => IconDingdan1.tsx} | 12 +- .../h5/{IconDingwei.js => IconDingwei.tsx} | 12 +- .../h5/{IconDizhi.js => IconDizhi.tsx} | 12 +- .../h5/{IconDuizhang.js => IconDuizhang.tsx} | 12 +- ...onFahuoliebiao.js => IconFahuoliebiao.tsx} | 12 +- ...Gerenzhongxin.js => IconGerenzhongxin.tsx} | 12 +- ...renzhongxin1.js => IconGerenzhongxin1.tsx} | 12 +- .../h5/{IconGouwu.js => IconGouwu.tsx} | 12 +- .../h5/{IconGouwu1.js => IconGouwu1.tsx} | 12 +- .../h5/{IconGuanbi.js => IconGuanbi.tsx} | 12 +- ...Guanlidingdan.js => IconGuanlidingdan.tsx} | 12 +- .../h5/{IconJianshao.js => IconJianshao.tsx} | 12 +- .../{IconJizhumima.js => IconJizhumima.tsx} | 12 +- .../{IconKehuxinxi.js => IconKehuxinxi.tsx} | 12 +- .../{IconLingquseka.js => IconLingquseka.tsx} | 12 +- src/components/iconfont/h5/IconLujing.tsx | 33 ++ ...IconMadanguanli.js => IconMadanguanli.tsx} | 12 +- .../iconfont/h5/{IconMima.js => IconMima.tsx} | 12 +- .../h5/{IconPaiming.js => IconPaiming.tsx} | 12 +- ...onPandiansaoma.js => IconPandiansaoma.tsx} | 12 +- .../h5/{IconPeihuo.js => IconPeihuo.tsx} | 12 +- ...icangkucun.js => IconQianzhicangkucun.tsx} | 12 +- ...IconQusechazhao.js => IconQusechazhao.tsx} | 12 +- .../h5/{IconSaomiao.js => IconSaomiao.tsx} | 12 +- .../h5/{IconShaixuan.js => IconShaixuan.tsx} | 12 +- ...suoxinxi.js => IconShanchusousuoxinxi.tsx} | 12 +- .../h5/{IconShijian.js => IconShijian.tsx} | 12 +- .../h5/{IconShouhou.js => IconShouhou.tsx} | 12 +- ...houzhongxin.js => IconShouhouzhongxin.tsx} | 12 +- ...kuanliebiao.js => IconShoukuanliebiao.tsx} | 12 +- .../h5/{IconShouye.js => IconShouye.tsx} | 12 +- .../h5/{IconShouye1.js => IconShouye1.tsx} | 12 +- .../h5/{IconSousuo.js => IconSousuo.tsx} | 12 +- ...onSousuofanhui.js => IconSousuofanhui.tsx} | 12 +- ...Sousuoshanchu.js => IconSousuoshanchu.tsx} | 12 +- ...onTihuoliebiao.js => IconTihuoliebiao.tsx} | 12 +- .../h5/{IconTishi.js => IconTishi.tsx} | 12 +- .../h5/{IconTuikuan.js => IconTuikuan.tsx} | 12 +- ...onWeixindenglu.js => IconWeixindenglu.tsx} | 12 +- .../h5/{IconWodekefu.js => IconWodekefu.tsx} | 12 +- ...onWodeshoucang.js => IconWodeshoucang.tsx} | 12 +- ...anxiahuizong.js => IconXianxiahuizong.tsx} | 12 +- .../h5/{IconXiaoshou.js => IconXiaoshou.tsx} | 12 +- .../h5/{IconXinzeng.js => IconXinzeng.tsx} | 12 +- ...onYangpinduibi.js => IconYangpinduibi.tsx} | 12 +- .../h5/{IconYanjing.js => IconYanjing.tsx} | 12 +- ...IconYansequyang.js => IconYansequyang.tsx} | 12 +- .../{IconYaoqingma.js => IconYaoqingma.tsx} | 12 +- ...onYewuyuanqizi.js => IconYewuyuanqizi.tsx} | 12 +- .../{IconYonghuming.js => IconYonghuming.tsx} | 12 +- .../h5/{IconYufukuan.js => IconYufukuan.tsx} | 12 +- ...onYuncangkucun.js => IconYuncangkucun.tsx} | 12 +- src/components/iconfont/h5/helper.js | 17 - src/components/iconfont/h5/helper.ts | 12 + .../iconfont/h5/{index.js => index.tsx} | 17 +- src/components/iconfont/index.d.ts | 13 - src/components/iconfont/index.h5.js | 17 - src/components/iconfont/index.h5.tsx | 27 ++ src/components/iconfont/index.js | 7 - src/components/iconfont/index.tsx | 19 + src/components/iconfont/index.weapp.js | 16 - src/components/iconfont/index.weapp.tsx | 27 ++ src/components/iconfont/weapp/weapp.js | 2 +- src/components/iconfont/weapp/weapp.wxml | 3 + src/pages/order/components/PayPopup/index.tsx | 290 +++++++-------- src/pages/order/components/itemList/index.tsx | 156 ++++---- src/pages/order/index.tsx | 344 ++++++++++-------- src/styles/iconfont.scss | 26 +- src/styles/iconfont.ttf | Bin 13312 -> 13312 bytes 77 files changed, 1092 insertions(+), 634 deletions(-) rename src/components/iconfont/h5/{IconAJizhumima.js => IconAJizhumima.tsx} (64%) rename src/components/iconfont/h5/{IconBianji.js => IconBianji.tsx} (67%) rename src/components/iconfont/h5/{IconBiyan.js => IconBiyan.tsx} (78%) rename src/components/iconfont/h5/{IconCangku.js => IconCangku.tsx} (76%) rename src/components/iconfont/h5/{IconChakanquanbukehu.js => IconChakanquanbukehu.tsx} (66%) rename src/components/iconfont/h5/{IconDaikuan.js => IconDaikuan.tsx} (78%) rename src/components/iconfont/h5/{IconDingdan.js => IconDingdan.tsx} (67%) rename src/components/iconfont/h5/{IconDingdan1.js => IconDingdan1.tsx} (67%) rename src/components/iconfont/h5/{IconDingwei.js => IconDingwei.tsx} (83%) rename src/components/iconfont/h5/{IconDizhi.js => IconDizhi.tsx} (80%) rename src/components/iconfont/h5/{IconDuizhang.js => IconDuizhang.tsx} (73%) rename src/components/iconfont/h5/{IconFahuoliebiao.js => IconFahuoliebiao.tsx} (73%) rename src/components/iconfont/h5/{IconGerenzhongxin.js => IconGerenzhongxin.tsx} (63%) rename src/components/iconfont/h5/{IconGerenzhongxin1.js => IconGerenzhongxin1.tsx} (71%) rename src/components/iconfont/h5/{IconGouwu.js => IconGouwu.tsx} (68%) rename src/components/iconfont/h5/{IconGouwu1.js => IconGouwu1.tsx} (69%) rename src/components/iconfont/h5/{IconGuanbi.js => IconGuanbi.tsx} (68%) rename src/components/iconfont/h5/{IconGuanlidingdan.js => IconGuanlidingdan.tsx} (69%) rename src/components/iconfont/h5/{IconJianshao.js => IconJianshao.tsx} (60%) rename src/components/iconfont/h5/{IconJizhumima.js => IconJizhumima.tsx} (75%) rename src/components/iconfont/h5/{IconKehuxinxi.js => IconKehuxinxi.tsx} (80%) rename src/components/iconfont/h5/{IconLingquseka.js => IconLingquseka.tsx} (76%) create mode 100644 src/components/iconfont/h5/IconLujing.tsx rename src/components/iconfont/h5/{IconMadanguanli.js => IconMadanguanli.tsx} (77%) rename src/components/iconfont/h5/{IconMima.js => IconMima.tsx} (68%) rename src/components/iconfont/h5/{IconPaiming.js => IconPaiming.tsx} (84%) rename src/components/iconfont/h5/{IconPandiansaoma.js => IconPandiansaoma.tsx} (71%) rename src/components/iconfont/h5/{IconPeihuo.js => IconPeihuo.tsx} (72%) rename src/components/iconfont/h5/{IconQianzhicangkucun.js => IconQianzhicangkucun.tsx} (80%) rename src/components/iconfont/h5/{IconQusechazhao.js => IconQusechazhao.tsx} (77%) rename src/components/iconfont/h5/{IconSaomiao.js => IconSaomiao.tsx} (66%) rename src/components/iconfont/h5/{IconShaixuan.js => IconShaixuan.tsx} (75%) rename src/components/iconfont/h5/{IconShanchusousuoxinxi.js => IconShanchusousuoxinxi.tsx} (70%) rename src/components/iconfont/h5/{IconShijian.js => IconShijian.tsx} (64%) rename src/components/iconfont/h5/{IconShouhou.js => IconShouhou.tsx} (80%) rename src/components/iconfont/h5/{IconShouhouzhongxin.js => IconShouhouzhongxin.tsx} (74%) rename src/components/iconfont/h5/{IconShoukuanliebiao.js => IconShoukuanliebiao.tsx} (75%) rename src/components/iconfont/h5/{IconShouye.js => IconShouye.tsx} (73%) rename src/components/iconfont/h5/{IconShouye1.js => IconShouye1.tsx} (78%) rename src/components/iconfont/h5/{IconSousuo.js => IconSousuo.tsx} (72%) rename src/components/iconfont/h5/{IconSousuofanhui.js => IconSousuofanhui.tsx} (67%) rename src/components/iconfont/h5/{IconSousuoshanchu.js => IconSousuoshanchu.tsx} (71%) rename src/components/iconfont/h5/{IconTihuoliebiao.js => IconTihuoliebiao.tsx} (73%) rename src/components/iconfont/h5/{IconTishi.js => IconTishi.tsx} (79%) rename src/components/iconfont/h5/{IconTuikuan.js => IconTuikuan.tsx} (73%) rename src/components/iconfont/h5/{IconWeixindenglu.js => IconWeixindenglu.tsx} (86%) rename src/components/iconfont/h5/{IconWodekefu.js => IconWodekefu.tsx} (77%) rename src/components/iconfont/h5/{IconWodeshoucang.js => IconWodeshoucang.tsx} (78%) rename src/components/iconfont/h5/{IconXianxiahuizong.js => IconXianxiahuizong.tsx} (72%) rename src/components/iconfont/h5/{IconXiaoshou.js => IconXiaoshou.tsx} (72%) rename src/components/iconfont/h5/{IconXinzeng.js => IconXinzeng.tsx} (63%) rename src/components/iconfont/h5/{IconYangpinduibi.js => IconYangpinduibi.tsx} (68%) rename src/components/iconfont/h5/{IconYanjing.js => IconYanjing.tsx} (70%) rename src/components/iconfont/h5/{IconYansequyang.js => IconYansequyang.tsx} (73%) rename src/components/iconfont/h5/{IconYaoqingma.js => IconYaoqingma.tsx} (73%) rename src/components/iconfont/h5/{IconYewuyuanqizi.js => IconYewuyuanqizi.tsx} (62%) rename src/components/iconfont/h5/{IconYonghuming.js => IconYonghuming.tsx} (68%) rename src/components/iconfont/h5/{IconYufukuan.js => IconYufukuan.tsx} (69%) rename src/components/iconfont/h5/{IconYuncangkucun.js => IconYuncangkucun.tsx} (75%) delete mode 100644 src/components/iconfont/h5/helper.js create mode 100644 src/components/iconfont/h5/helper.ts rename src/components/iconfont/h5/{index.js => index.tsx} (86%) delete mode 100644 src/components/iconfont/index.d.ts delete mode 100644 src/components/iconfont/index.h5.js create mode 100644 src/components/iconfont/index.h5.tsx delete mode 100644 src/components/iconfont/index.js create mode 100644 src/components/iconfont/index.tsx delete mode 100644 src/components/iconfont/index.weapp.js create mode 100644 src/components/iconfont/index.weapp.tsx diff --git a/iconfont.json b/iconfont.json index 66a7022..a759b0f 100644 --- a/iconfont.json +++ b/iconfont.json @@ -1,7 +1,7 @@ { - "symbol_url": "//at.alicdn.com/t/c/font_3619513_i9fjrthdbsd.js", + "symbol_url": "//at.alicdn.com/t/c/font_3619513_pecprurprt.js", "save_dir": "./src/components/iconfont", - "use_typescript": false, + "use_typescript": true, "platforms": ["weapp","h5"], "use_rpx": true, "trim_icon_prefix": "", diff --git a/src/components/iconfont/h5/IconAJizhumima.js b/src/components/iconfont/h5/IconAJizhumima.tsx similarity index 64% rename from src/components/iconfont/h5/IconAJizhumima.js rename to src/components/iconfont/h5/IconAJizhumima.tsx index 8743883..1eb32b2 100644 --- a/src/components/iconfont/h5/IconAJizhumima.js +++ b/src/components/iconfont/h5/IconAJizhumima.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconAJizhumima = ({ size, color, style: _style, ...rest }) => { +const IconAJizhumima: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconBianji.js b/src/components/iconfont/h5/IconBianji.tsx similarity index 67% rename from src/components/iconfont/h5/IconBianji.js rename to src/components/iconfont/h5/IconBianji.tsx index e0188ba..f9b628a 100644 --- a/src/components/iconfont/h5/IconBianji.js +++ b/src/components/iconfont/h5/IconBianji.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconBianji = ({ size, color, style: _style, ...rest }) => { +const IconBianji: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconBiyan.js b/src/components/iconfont/h5/IconBiyan.tsx similarity index 78% rename from src/components/iconfont/h5/IconBiyan.js rename to src/components/iconfont/h5/IconBiyan.tsx index 31cc5a0..fb2d71b 100644 --- a/src/components/iconfont/h5/IconBiyan.js +++ b/src/components/iconfont/h5/IconBiyan.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconBiyan = ({ size, color, style: _style, ...rest }) => { +const IconBiyan: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconCangku.js b/src/components/iconfont/h5/IconCangku.tsx similarity index 76% rename from src/components/iconfont/h5/IconCangku.js rename to src/components/iconfont/h5/IconCangku.tsx index df4d192..def2b99 100644 --- a/src/components/iconfont/h5/IconCangku.js +++ b/src/components/iconfont/h5/IconCangku.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconCangku = ({ size, color, style: _style, ...rest }) => { +const IconCangku: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconChakanquanbukehu.js b/src/components/iconfont/h5/IconChakanquanbukehu.tsx similarity index 66% rename from src/components/iconfont/h5/IconChakanquanbukehu.js rename to src/components/iconfont/h5/IconChakanquanbukehu.tsx index 7059887..38a4d03 100644 --- a/src/components/iconfont/h5/IconChakanquanbukehu.js +++ b/src/components/iconfont/h5/IconChakanquanbukehu.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconChakanquanbukehu = ({ size, color, style: _style, ...rest }) => { +const IconChakanquanbukehu: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconDaikuan.js b/src/components/iconfont/h5/IconDaikuan.tsx similarity index 78% rename from src/components/iconfont/h5/IconDaikuan.js rename to src/components/iconfont/h5/IconDaikuan.tsx index eda3f8b..946d9c6 100644 --- a/src/components/iconfont/h5/IconDaikuan.js +++ b/src/components/iconfont/h5/IconDaikuan.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconDaikuan = ({ size, color, style: _style, ...rest }) => { +const IconDaikuan: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconDingdan.js b/src/components/iconfont/h5/IconDingdan.tsx similarity index 67% rename from src/components/iconfont/h5/IconDingdan.js rename to src/components/iconfont/h5/IconDingdan.tsx index ed26299..78cd78b 100644 --- a/src/components/iconfont/h5/IconDingdan.js +++ b/src/components/iconfont/h5/IconDingdan.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconDingdan = ({ size, color, style: _style, ...rest }) => { +const IconDingdan: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconDingdan1.js b/src/components/iconfont/h5/IconDingdan1.tsx similarity index 67% rename from src/components/iconfont/h5/IconDingdan1.js rename to src/components/iconfont/h5/IconDingdan1.tsx index 6646be2..db146fb 100644 --- a/src/components/iconfont/h5/IconDingdan1.js +++ b/src/components/iconfont/h5/IconDingdan1.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconDingdan1 = ({ size, color, style: _style, ...rest }) => { +const IconDingdan1: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconDingwei.js b/src/components/iconfont/h5/IconDingwei.tsx similarity index 83% rename from src/components/iconfont/h5/IconDingwei.js rename to src/components/iconfont/h5/IconDingwei.tsx index c6bb39e..3a6950b 100644 --- a/src/components/iconfont/h5/IconDingwei.js +++ b/src/components/iconfont/h5/IconDingwei.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconDingwei = ({ size, color, style: _style, ...rest }) => { +const IconDingwei: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconDizhi.js b/src/components/iconfont/h5/IconDizhi.tsx similarity index 80% rename from src/components/iconfont/h5/IconDizhi.js rename to src/components/iconfont/h5/IconDizhi.tsx index d13f9ac..ae072ad 100644 --- a/src/components/iconfont/h5/IconDizhi.js +++ b/src/components/iconfont/h5/IconDizhi.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconDizhi = ({ size, color, style: _style, ...rest }) => { +const IconDizhi: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconDuizhang.js b/src/components/iconfont/h5/IconDuizhang.tsx similarity index 73% rename from src/components/iconfont/h5/IconDuizhang.js rename to src/components/iconfont/h5/IconDuizhang.tsx index 1c054ec..f00fc98 100644 --- a/src/components/iconfont/h5/IconDuizhang.js +++ b/src/components/iconfont/h5/IconDuizhang.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconDuizhang = ({ size, color, style: _style, ...rest }) => { +const IconDuizhang: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconFahuoliebiao.js b/src/components/iconfont/h5/IconFahuoliebiao.tsx similarity index 73% rename from src/components/iconfont/h5/IconFahuoliebiao.js rename to src/components/iconfont/h5/IconFahuoliebiao.tsx index 6186db7..b8f8b57 100644 --- a/src/components/iconfont/h5/IconFahuoliebiao.js +++ b/src/components/iconfont/h5/IconFahuoliebiao.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconFahuoliebiao = ({ size, color, style: _style, ...rest }) => { +const IconFahuoliebiao: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconGerenzhongxin.js b/src/components/iconfont/h5/IconGerenzhongxin.tsx similarity index 63% rename from src/components/iconfont/h5/IconGerenzhongxin.js rename to src/components/iconfont/h5/IconGerenzhongxin.tsx index 0e0396a..df960b6 100644 --- a/src/components/iconfont/h5/IconGerenzhongxin.js +++ b/src/components/iconfont/h5/IconGerenzhongxin.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconGerenzhongxin = ({ size, color, style: _style, ...rest }) => { +const IconGerenzhongxin: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconGerenzhongxin1.js b/src/components/iconfont/h5/IconGerenzhongxin1.tsx similarity index 71% rename from src/components/iconfont/h5/IconGerenzhongxin1.js rename to src/components/iconfont/h5/IconGerenzhongxin1.tsx index e2048e9..28b153c 100644 --- a/src/components/iconfont/h5/IconGerenzhongxin1.js +++ b/src/components/iconfont/h5/IconGerenzhongxin1.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconGerenzhongxin1 = ({ size, color, style: _style, ...rest }) => { +const IconGerenzhongxin1: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconGouwu.js b/src/components/iconfont/h5/IconGouwu.tsx similarity index 68% rename from src/components/iconfont/h5/IconGouwu.js rename to src/components/iconfont/h5/IconGouwu.tsx index acd351f..c75b358 100644 --- a/src/components/iconfont/h5/IconGouwu.js +++ b/src/components/iconfont/h5/IconGouwu.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconGouwu = ({ size, color, style: _style, ...rest }) => { +const IconGouwu: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconGouwu1.js b/src/components/iconfont/h5/IconGouwu1.tsx similarity index 69% rename from src/components/iconfont/h5/IconGouwu1.js rename to src/components/iconfont/h5/IconGouwu1.tsx index 710069f..c45c635 100644 --- a/src/components/iconfont/h5/IconGouwu1.js +++ b/src/components/iconfont/h5/IconGouwu1.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconGouwu1 = ({ size, color, style: _style, ...rest }) => { +const IconGouwu1: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconGuanbi.js b/src/components/iconfont/h5/IconGuanbi.tsx similarity index 68% rename from src/components/iconfont/h5/IconGuanbi.js rename to src/components/iconfont/h5/IconGuanbi.tsx index d256124..d301ffb 100644 --- a/src/components/iconfont/h5/IconGuanbi.js +++ b/src/components/iconfont/h5/IconGuanbi.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconGuanbi = ({ size, color, style: _style, ...rest }) => { +const IconGuanbi: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconGuanlidingdan.js b/src/components/iconfont/h5/IconGuanlidingdan.tsx similarity index 69% rename from src/components/iconfont/h5/IconGuanlidingdan.js rename to src/components/iconfont/h5/IconGuanlidingdan.tsx index d7ad8f1..15b2b82 100644 --- a/src/components/iconfont/h5/IconGuanlidingdan.js +++ b/src/components/iconfont/h5/IconGuanlidingdan.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconGuanlidingdan = ({ size, color, style: _style, ...rest }) => { +const IconGuanlidingdan: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconJianshao.js b/src/components/iconfont/h5/IconJianshao.tsx similarity index 60% rename from src/components/iconfont/h5/IconJianshao.js rename to src/components/iconfont/h5/IconJianshao.tsx index c285021..c65a0ae 100644 --- a/src/components/iconfont/h5/IconJianshao.js +++ b/src/components/iconfont/h5/IconJianshao.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconJianshao = ({ size, color, style: _style, ...rest }) => { +const IconJianshao: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconJizhumima.js b/src/components/iconfont/h5/IconJizhumima.tsx similarity index 75% rename from src/components/iconfont/h5/IconJizhumima.js rename to src/components/iconfont/h5/IconJizhumima.tsx index 77d653c..28d79ed 100644 --- a/src/components/iconfont/h5/IconJizhumima.js +++ b/src/components/iconfont/h5/IconJizhumima.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconJizhumima = ({ size, color, style: _style, ...rest }) => { +const IconJizhumima: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconKehuxinxi.js b/src/components/iconfont/h5/IconKehuxinxi.tsx similarity index 80% rename from src/components/iconfont/h5/IconKehuxinxi.js rename to src/components/iconfont/h5/IconKehuxinxi.tsx index 07c5fbb..38aff7e 100644 --- a/src/components/iconfont/h5/IconKehuxinxi.js +++ b/src/components/iconfont/h5/IconKehuxinxi.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconKehuxinxi = ({ size, color, style: _style, ...rest }) => { +const IconKehuxinxi: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconLingquseka.js b/src/components/iconfont/h5/IconLingquseka.tsx similarity index 76% rename from src/components/iconfont/h5/IconLingquseka.js rename to src/components/iconfont/h5/IconLingquseka.tsx index a910c42..e3a6347 100644 --- a/src/components/iconfont/h5/IconLingquseka.js +++ b/src/components/iconfont/h5/IconLingquseka.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconLingquseka = ({ size, color, style: _style, ...rest }) => { +const IconLingquseka: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconLujing.tsx b/src/components/iconfont/h5/IconLujing.tsx new file mode 100644 index 0000000..9e1b6eb --- /dev/null +++ b/src/components/iconfont/h5/IconLujing.tsx @@ -0,0 +1,33 @@ +/* tslint:disable */ +/* eslint-disable */ + +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; +import { getIconColor } from './helper'; + +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { + display: 'block', +}; + +const IconLujing: FunctionComponent = ({ size, color, style: _style, ...rest }) => { + const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; + + return ( + + + + ); +}; + +IconLujing.defaultProps = { + size: 18, +}; + +export default IconLujing; diff --git a/src/components/iconfont/h5/IconMadanguanli.js b/src/components/iconfont/h5/IconMadanguanli.tsx similarity index 77% rename from src/components/iconfont/h5/IconMadanguanli.js rename to src/components/iconfont/h5/IconMadanguanli.tsx index 03d55ed..6207a40 100644 --- a/src/components/iconfont/h5/IconMadanguanli.js +++ b/src/components/iconfont/h5/IconMadanguanli.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconMadanguanli = ({ size, color, style: _style, ...rest }) => { +const IconMadanguanli: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconMima.js b/src/components/iconfont/h5/IconMima.tsx similarity index 68% rename from src/components/iconfont/h5/IconMima.js rename to src/components/iconfont/h5/IconMima.tsx index b8d402e..802a604 100644 --- a/src/components/iconfont/h5/IconMima.js +++ b/src/components/iconfont/h5/IconMima.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconMima = ({ size, color, style: _style, ...rest }) => { +const IconMima: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconPaiming.js b/src/components/iconfont/h5/IconPaiming.tsx similarity index 84% rename from src/components/iconfont/h5/IconPaiming.js rename to src/components/iconfont/h5/IconPaiming.tsx index e67379a..3a82537 100644 --- a/src/components/iconfont/h5/IconPaiming.js +++ b/src/components/iconfont/h5/IconPaiming.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconPaiming = ({ size, color, style: _style, ...rest }) => { +const IconPaiming: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconPandiansaoma.js b/src/components/iconfont/h5/IconPandiansaoma.tsx similarity index 71% rename from src/components/iconfont/h5/IconPandiansaoma.js rename to src/components/iconfont/h5/IconPandiansaoma.tsx index cedaa00..34b6855 100644 --- a/src/components/iconfont/h5/IconPandiansaoma.js +++ b/src/components/iconfont/h5/IconPandiansaoma.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconPandiansaoma = ({ size, color, style: _style, ...rest }) => { +const IconPandiansaoma: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconPeihuo.js b/src/components/iconfont/h5/IconPeihuo.tsx similarity index 72% rename from src/components/iconfont/h5/IconPeihuo.js rename to src/components/iconfont/h5/IconPeihuo.tsx index e74196a..6dff214 100644 --- a/src/components/iconfont/h5/IconPeihuo.js +++ b/src/components/iconfont/h5/IconPeihuo.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconPeihuo = ({ size, color, style: _style, ...rest }) => { +const IconPeihuo: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconQianzhicangkucun.js b/src/components/iconfont/h5/IconQianzhicangkucun.tsx similarity index 80% rename from src/components/iconfont/h5/IconQianzhicangkucun.js rename to src/components/iconfont/h5/IconQianzhicangkucun.tsx index 6f58e2d..c3dfbf1 100644 --- a/src/components/iconfont/h5/IconQianzhicangkucun.js +++ b/src/components/iconfont/h5/IconQianzhicangkucun.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconQianzhicangkucun = ({ size, color, style: _style, ...rest }) => { +const IconQianzhicangkucun: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconQusechazhao.js b/src/components/iconfont/h5/IconQusechazhao.tsx similarity index 77% rename from src/components/iconfont/h5/IconQusechazhao.js rename to src/components/iconfont/h5/IconQusechazhao.tsx index 95db3db..26bea3a 100644 --- a/src/components/iconfont/h5/IconQusechazhao.js +++ b/src/components/iconfont/h5/IconQusechazhao.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconQusechazhao = ({ size, color, style: _style, ...rest }) => { +const IconQusechazhao: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconSaomiao.js b/src/components/iconfont/h5/IconSaomiao.tsx similarity index 66% rename from src/components/iconfont/h5/IconSaomiao.js rename to src/components/iconfont/h5/IconSaomiao.tsx index ebb4447..4f32e97 100644 --- a/src/components/iconfont/h5/IconSaomiao.js +++ b/src/components/iconfont/h5/IconSaomiao.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconSaomiao = ({ size, color, style: _style, ...rest }) => { +const IconSaomiao: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconShaixuan.js b/src/components/iconfont/h5/IconShaixuan.tsx similarity index 75% rename from src/components/iconfont/h5/IconShaixuan.js rename to src/components/iconfont/h5/IconShaixuan.tsx index cc79608..bc0652b 100644 --- a/src/components/iconfont/h5/IconShaixuan.js +++ b/src/components/iconfont/h5/IconShaixuan.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconShaixuan = ({ size, color, style: _style, ...rest }) => { +const IconShaixuan: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconShanchusousuoxinxi.js b/src/components/iconfont/h5/IconShanchusousuoxinxi.tsx similarity index 70% rename from src/components/iconfont/h5/IconShanchusousuoxinxi.js rename to src/components/iconfont/h5/IconShanchusousuoxinxi.tsx index b67f566..8deb648 100644 --- a/src/components/iconfont/h5/IconShanchusousuoxinxi.js +++ b/src/components/iconfont/h5/IconShanchusousuoxinxi.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconShanchusousuoxinxi = ({ size, color, style: _style, ...rest }) => { +const IconShanchusousuoxinxi: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconShijian.js b/src/components/iconfont/h5/IconShijian.tsx similarity index 64% rename from src/components/iconfont/h5/IconShijian.js rename to src/components/iconfont/h5/IconShijian.tsx index fbb9408..05b5941 100644 --- a/src/components/iconfont/h5/IconShijian.js +++ b/src/components/iconfont/h5/IconShijian.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconShijian = ({ size, color, style: _style, ...rest }) => { +const IconShijian: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconShouhou.js b/src/components/iconfont/h5/IconShouhou.tsx similarity index 80% rename from src/components/iconfont/h5/IconShouhou.js rename to src/components/iconfont/h5/IconShouhou.tsx index fad885e..ae64641 100644 --- a/src/components/iconfont/h5/IconShouhou.js +++ b/src/components/iconfont/h5/IconShouhou.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconShouhou = ({ size, color, style: _style, ...rest }) => { +const IconShouhou: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconShouhouzhongxin.js b/src/components/iconfont/h5/IconShouhouzhongxin.tsx similarity index 74% rename from src/components/iconfont/h5/IconShouhouzhongxin.js rename to src/components/iconfont/h5/IconShouhouzhongxin.tsx index 097a48a..ef1ba7e 100644 --- a/src/components/iconfont/h5/IconShouhouzhongxin.js +++ b/src/components/iconfont/h5/IconShouhouzhongxin.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconShouhouzhongxin = ({ size, color, style: _style, ...rest }) => { +const IconShouhouzhongxin: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconShoukuanliebiao.js b/src/components/iconfont/h5/IconShoukuanliebiao.tsx similarity index 75% rename from src/components/iconfont/h5/IconShoukuanliebiao.js rename to src/components/iconfont/h5/IconShoukuanliebiao.tsx index 58aee55..b75733e 100644 --- a/src/components/iconfont/h5/IconShoukuanliebiao.js +++ b/src/components/iconfont/h5/IconShoukuanliebiao.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconShoukuanliebiao = ({ size, color, style: _style, ...rest }) => { +const IconShoukuanliebiao: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconShouye.js b/src/components/iconfont/h5/IconShouye.tsx similarity index 73% rename from src/components/iconfont/h5/IconShouye.js rename to src/components/iconfont/h5/IconShouye.tsx index eab00c2..ac89078 100644 --- a/src/components/iconfont/h5/IconShouye.js +++ b/src/components/iconfont/h5/IconShouye.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconShouye = ({ size, color, style: _style, ...rest }) => { +const IconShouye: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconShouye1.js b/src/components/iconfont/h5/IconShouye1.tsx similarity index 78% rename from src/components/iconfont/h5/IconShouye1.js rename to src/components/iconfont/h5/IconShouye1.tsx index ccceea2..8936e20 100644 --- a/src/components/iconfont/h5/IconShouye1.js +++ b/src/components/iconfont/h5/IconShouye1.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconShouye1 = ({ size, color, style: _style, ...rest }) => { +const IconShouye1: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconSousuo.js b/src/components/iconfont/h5/IconSousuo.tsx similarity index 72% rename from src/components/iconfont/h5/IconSousuo.js rename to src/components/iconfont/h5/IconSousuo.tsx index 995e4b1..2584f8e 100644 --- a/src/components/iconfont/h5/IconSousuo.js +++ b/src/components/iconfont/h5/IconSousuo.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconSousuo = ({ size, color, style: _style, ...rest }) => { +const IconSousuo: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconSousuofanhui.js b/src/components/iconfont/h5/IconSousuofanhui.tsx similarity index 67% rename from src/components/iconfont/h5/IconSousuofanhui.js rename to src/components/iconfont/h5/IconSousuofanhui.tsx index c6b9d4f..ec4c84f 100644 --- a/src/components/iconfont/h5/IconSousuofanhui.js +++ b/src/components/iconfont/h5/IconSousuofanhui.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconSousuofanhui = ({ size, color, style: _style, ...rest }) => { +const IconSousuofanhui: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconSousuoshanchu.js b/src/components/iconfont/h5/IconSousuoshanchu.tsx similarity index 71% rename from src/components/iconfont/h5/IconSousuoshanchu.js rename to src/components/iconfont/h5/IconSousuoshanchu.tsx index 36f4528..211ee07 100644 --- a/src/components/iconfont/h5/IconSousuoshanchu.js +++ b/src/components/iconfont/h5/IconSousuoshanchu.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconSousuoshanchu = ({ size, color, style: _style, ...rest }) => { +const IconSousuoshanchu: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconTihuoliebiao.js b/src/components/iconfont/h5/IconTihuoliebiao.tsx similarity index 73% rename from src/components/iconfont/h5/IconTihuoliebiao.js rename to src/components/iconfont/h5/IconTihuoliebiao.tsx index e406a31..3514e5b 100644 --- a/src/components/iconfont/h5/IconTihuoliebiao.js +++ b/src/components/iconfont/h5/IconTihuoliebiao.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconTihuoliebiao = ({ size, color, style: _style, ...rest }) => { +const IconTihuoliebiao: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconTishi.js b/src/components/iconfont/h5/IconTishi.tsx similarity index 79% rename from src/components/iconfont/h5/IconTishi.js rename to src/components/iconfont/h5/IconTishi.tsx index b83a12e..d9a5c2d 100644 --- a/src/components/iconfont/h5/IconTishi.js +++ b/src/components/iconfont/h5/IconTishi.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconTishi = ({ size, color, style: _style, ...rest }) => { +const IconTishi: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconTuikuan.js b/src/components/iconfont/h5/IconTuikuan.tsx similarity index 73% rename from src/components/iconfont/h5/IconTuikuan.js rename to src/components/iconfont/h5/IconTuikuan.tsx index 681871a..d172782 100644 --- a/src/components/iconfont/h5/IconTuikuan.js +++ b/src/components/iconfont/h5/IconTuikuan.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconTuikuan = ({ size, color, style: _style, ...rest }) => { +const IconTuikuan: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconWeixindenglu.js b/src/components/iconfont/h5/IconWeixindenglu.tsx similarity index 86% rename from src/components/iconfont/h5/IconWeixindenglu.js rename to src/components/iconfont/h5/IconWeixindenglu.tsx index 56f4657..823f524 100644 --- a/src/components/iconfont/h5/IconWeixindenglu.js +++ b/src/components/iconfont/h5/IconWeixindenglu.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconWeixindenglu = ({ size, color, style: _style, ...rest }) => { +const IconWeixindenglu: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconWodekefu.js b/src/components/iconfont/h5/IconWodekefu.tsx similarity index 77% rename from src/components/iconfont/h5/IconWodekefu.js rename to src/components/iconfont/h5/IconWodekefu.tsx index 2b23a1f..4bc158e 100644 --- a/src/components/iconfont/h5/IconWodekefu.js +++ b/src/components/iconfont/h5/IconWodekefu.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconWodekefu = ({ size, color, style: _style, ...rest }) => { +const IconWodekefu: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconWodeshoucang.js b/src/components/iconfont/h5/IconWodeshoucang.tsx similarity index 78% rename from src/components/iconfont/h5/IconWodeshoucang.js rename to src/components/iconfont/h5/IconWodeshoucang.tsx index 4c13ed5..6731198 100644 --- a/src/components/iconfont/h5/IconWodeshoucang.js +++ b/src/components/iconfont/h5/IconWodeshoucang.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconWodeshoucang = ({ size, color, style: _style, ...rest }) => { +const IconWodeshoucang: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconXianxiahuizong.js b/src/components/iconfont/h5/IconXianxiahuizong.tsx similarity index 72% rename from src/components/iconfont/h5/IconXianxiahuizong.js rename to src/components/iconfont/h5/IconXianxiahuizong.tsx index 3a6cc3c..e724484 100644 --- a/src/components/iconfont/h5/IconXianxiahuizong.js +++ b/src/components/iconfont/h5/IconXianxiahuizong.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconXianxiahuizong = ({ size, color, style: _style, ...rest }) => { +const IconXianxiahuizong: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconXiaoshou.js b/src/components/iconfont/h5/IconXiaoshou.tsx similarity index 72% rename from src/components/iconfont/h5/IconXiaoshou.js rename to src/components/iconfont/h5/IconXiaoshou.tsx index cdd6508..cd5490f 100644 --- a/src/components/iconfont/h5/IconXiaoshou.js +++ b/src/components/iconfont/h5/IconXiaoshou.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconXiaoshou = ({ size, color, style: _style, ...rest }) => { +const IconXiaoshou: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconXinzeng.js b/src/components/iconfont/h5/IconXinzeng.tsx similarity index 63% rename from src/components/iconfont/h5/IconXinzeng.js rename to src/components/iconfont/h5/IconXinzeng.tsx index fa37e05..a68b63d 100644 --- a/src/components/iconfont/h5/IconXinzeng.js +++ b/src/components/iconfont/h5/IconXinzeng.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconXinzeng = ({ size, color, style: _style, ...rest }) => { +const IconXinzeng: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconYangpinduibi.js b/src/components/iconfont/h5/IconYangpinduibi.tsx similarity index 68% rename from src/components/iconfont/h5/IconYangpinduibi.js rename to src/components/iconfont/h5/IconYangpinduibi.tsx index 6844d9f..64087cf 100644 --- a/src/components/iconfont/h5/IconYangpinduibi.js +++ b/src/components/iconfont/h5/IconYangpinduibi.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconYangpinduibi = ({ size, color, style: _style, ...rest }) => { +const IconYangpinduibi: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconYanjing.js b/src/components/iconfont/h5/IconYanjing.tsx similarity index 70% rename from src/components/iconfont/h5/IconYanjing.js rename to src/components/iconfont/h5/IconYanjing.tsx index 85c7c22..5e317ee 100644 --- a/src/components/iconfont/h5/IconYanjing.js +++ b/src/components/iconfont/h5/IconYanjing.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconYanjing = ({ size, color, style: _style, ...rest }) => { +const IconYanjing: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconYansequyang.js b/src/components/iconfont/h5/IconYansequyang.tsx similarity index 73% rename from src/components/iconfont/h5/IconYansequyang.js rename to src/components/iconfont/h5/IconYansequyang.tsx index 4139fe7..a31cd59 100644 --- a/src/components/iconfont/h5/IconYansequyang.js +++ b/src/components/iconfont/h5/IconYansequyang.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconYansequyang = ({ size, color, style: _style, ...rest }) => { +const IconYansequyang: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconYaoqingma.js b/src/components/iconfont/h5/IconYaoqingma.tsx similarity index 73% rename from src/components/iconfont/h5/IconYaoqingma.js rename to src/components/iconfont/h5/IconYaoqingma.tsx index aadc7cf..4cf056c 100644 --- a/src/components/iconfont/h5/IconYaoqingma.js +++ b/src/components/iconfont/h5/IconYaoqingma.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconYaoqingma = ({ size, color, style: _style, ...rest }) => { +const IconYaoqingma: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconYewuyuanqizi.js b/src/components/iconfont/h5/IconYewuyuanqizi.tsx similarity index 62% rename from src/components/iconfont/h5/IconYewuyuanqizi.js rename to src/components/iconfont/h5/IconYewuyuanqizi.tsx index f9925dd..0d556cc 100644 --- a/src/components/iconfont/h5/IconYewuyuanqizi.js +++ b/src/components/iconfont/h5/IconYewuyuanqizi.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconYewuyuanqizi = ({ size, color, style: _style, ...rest }) => { +const IconYewuyuanqizi: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconYonghuming.js b/src/components/iconfont/h5/IconYonghuming.tsx similarity index 68% rename from src/components/iconfont/h5/IconYonghuming.js rename to src/components/iconfont/h5/IconYonghuming.tsx index 272f2c6..2a5f6d1 100644 --- a/src/components/iconfont/h5/IconYonghuming.js +++ b/src/components/iconfont/h5/IconYonghuming.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconYonghuming = ({ size, color, style: _style, ...rest }) => { +const IconYonghuming: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconYufukuan.js b/src/components/iconfont/h5/IconYufukuan.tsx similarity index 69% rename from src/components/iconfont/h5/IconYufukuan.js rename to src/components/iconfont/h5/IconYufukuan.tsx index 7f7177a..84bd059 100644 --- a/src/components/iconfont/h5/IconYufukuan.js +++ b/src/components/iconfont/h5/IconYufukuan.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconYufukuan = ({ size, color, style: _style, ...rest }) => { +const IconYufukuan: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/IconYuncangkucun.js b/src/components/iconfont/h5/IconYuncangkucun.tsx similarity index 75% rename from src/components/iconfont/h5/IconYuncangkucun.js rename to src/components/iconfont/h5/IconYuncangkucun.tsx index 25db8f7..e7ba6c3 100644 --- a/src/components/iconfont/h5/IconYuncangkucun.js +++ b/src/components/iconfont/h5/IconYuncangkucun.tsx @@ -1,13 +1,19 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { CSSProperties, SVGAttributes, FunctionComponent } from 'react'; import { getIconColor } from './helper'; -const DEFAULT_STYLE = { +interface Props extends Omit, 'color'> { + size?: number; + color?: string | string[]; +} + +const DEFAULT_STYLE: CSSProperties = { display: 'block', }; -const IconYuncangkucun = ({ size, color, style: _style, ...rest }) => { +const IconYuncangkucun: FunctionComponent = ({ size, color, style: _style, ...rest }) => { const style = _style ? { ...DEFAULT_STYLE, ..._style } : DEFAULT_STYLE; return ( diff --git a/src/components/iconfont/h5/helper.js b/src/components/iconfont/h5/helper.js deleted file mode 100644 index b566c4c..0000000 --- a/src/components/iconfont/h5/helper.js +++ /dev/null @@ -1,17 +0,0 @@ -/* eslint-disable */ - -/** - * @param {string | string[] | undefined} color - * @param {number} index - * @param {string} defaultColor - * @return {string} - */ -export const getIconColor = (color, index, defaultColor) => { - return color - ? ( - typeof color === 'string' - ? color - : color[index] || defaultColor - ) - : defaultColor; -}; diff --git a/src/components/iconfont/h5/helper.ts b/src/components/iconfont/h5/helper.ts new file mode 100644 index 0000000..60d6d71 --- /dev/null +++ b/src/components/iconfont/h5/helper.ts @@ -0,0 +1,12 @@ +/* tslint:disable */ +/* eslint-disable */ + +export const getIconColor = (color: string | string[] | undefined, index: number, defaultColor: string) => { + return color + ? ( + typeof color === 'string' + ? color + : color[index] || defaultColor + ) + : defaultColor; +}; diff --git a/src/components/iconfont/h5/index.js b/src/components/iconfont/h5/index.tsx similarity index 86% rename from src/components/iconfont/h5/index.js rename to src/components/iconfont/h5/index.tsx index 20c4858..470110e 100644 --- a/src/components/iconfont/h5/index.js +++ b/src/components/iconfont/h5/index.tsx @@ -1,6 +1,8 @@ +/* tslint:disable */ /* eslint-disable */ -import React from 'react'; +import React, { SVGAttributes, FunctionComponent } from 'react'; +import IconLujing from './IconLujing'; import IconJizhumima from './IconJizhumima'; import IconAJizhumima from './IconAJizhumima'; import IconWeixindenglu from './IconWeixindenglu'; @@ -59,6 +61,7 @@ import IconGerenzhongxin from './IconGerenzhongxin'; import IconDingdan from './IconDingdan'; import IconShouye from './IconShouye'; import IconGouwu from './IconGouwu'; +export { default as IconLujing } from './IconLujing'; export { default as IconJizhumima } from './IconJizhumima'; export { default as IconAJizhumima } from './IconAJizhumima'; export { default as IconWeixindenglu } from './IconWeixindenglu'; @@ -118,8 +121,18 @@ export { default as IconDingdan } from './IconDingdan'; export { default as IconShouye } from './IconShouye'; export { default as IconGouwu } from './IconGouwu'; -const IconFont = ({ name, ...rest }) => { +export type IconNames = 'icon-lujing' | 'icon-jizhumima' | 'icon-a-jizhumima' | 'icon-weixindenglu' | 'icon-kehuxinxi' | 'icon-yewuyuanqizi' | 'icon-chakanquanbukehu' | 'icon-biyan' | 'icon-bianji' | 'icon-daikuan' | 'icon-cangku' | 'icon-guanlidingdan' | 'icon-mima' | 'icon-guanbi' | 'icon-jianshao' | 'icon-dingwei' | 'icon-saomiao' | 'icon-peihuo' | 'icon-shaixuan' | 'icon-paiming' | 'icon-shanchusousuoxinxi' | 'icon-shijian' | 'icon-sousuo' | 'icon-shouhou' | 'icon-sousuofanhui' | 'icon-sousuoshanchu' | 'icon-tuikuan' | 'icon-tishi' | 'icon-xianxiahuizong' | 'icon-xinzeng' | 'icon-yonghuming' | 'icon-yanjing' | 'icon-yufukuan' | 'icon-wodekefu' | 'icon-dizhi' | 'icon-shouhouzhongxin' | 'icon-wodeshoucang' | 'icon-shoukuanliebiao' | 'icon-madanguanli' | 'icon-qusechazhao' | 'icon-pandiansaoma' | 'icon-yaoqingma' | 'icon-duizhang' | 'icon-tihuoliebiao' | 'icon-yangpinduibi' | 'icon-yansequyang' | 'icon-fahuoliebiao' | 'icon-yuncangkucun' | 'icon-xiaoshou' | 'icon-qianzhicangkucun' | 'icon-lingquseka' | 'icon-gouwu1' | 'icon-dingdan1' | 'icon-gerenzhongxin1' | 'icon-shouye1' | 'icon-gerenzhongxin' | 'icon-dingdan' | 'icon-shouye' | 'icon-gouwu'; + +interface Props extends Omit, 'color'> { + name: IconNames; + size?: number; + color?: string | string[]; +} + +const IconFont: FunctionComponent = ({ name, ...rest }) => { switch (name) { + case 'icon-lujing': + return ; case 'icon-jizhumima': return ; case 'icon-a-jizhumima': diff --git a/src/components/iconfont/index.d.ts b/src/components/iconfont/index.d.ts deleted file mode 100644 index a92822f..0000000 --- a/src/components/iconfont/index.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* eslint-disable */ -import React, { FunctionComponent } from 'react'; - -interface Props { - name: 'icon-jizhumima' | 'icon-a-jizhumima' | 'icon-weixindenglu' | 'icon-kehuxinxi' | 'icon-yewuyuanqizi' | 'icon-chakanquanbukehu' | 'icon-biyan' | 'icon-bianji' | 'icon-daikuan' | 'icon-cangku' | 'icon-guanlidingdan' | 'icon-mima' | 'icon-guanbi' | 'icon-jianshao' | 'icon-dingwei' | 'icon-saomiao' | 'icon-peihuo' | 'icon-shaixuan' | 'icon-paiming' | 'icon-shanchusousuoxinxi' | 'icon-shijian' | 'icon-sousuo' | 'icon-shouhou' | 'icon-sousuofanhui' | 'icon-sousuoshanchu' | 'icon-tuikuan' | 'icon-tishi' | 'icon-xianxiahuizong' | 'icon-xinzeng' | 'icon-yonghuming' | 'icon-yanjing' | 'icon-yufukuan' | 'icon-wodekefu' | 'icon-dizhi' | 'icon-shouhouzhongxin' | 'icon-wodeshoucang' | 'icon-shoukuanliebiao' | 'icon-madanguanli' | 'icon-qusechazhao' | 'icon-pandiansaoma' | 'icon-yaoqingma' | 'icon-duizhang' | 'icon-tihuoliebiao' | 'icon-yangpinduibi' | 'icon-yansequyang' | 'icon-fahuoliebiao' | 'icon-yuncangkucun' | 'icon-xiaoshou' | 'icon-qianzhicangkucun' | 'icon-lingquseka' | 'icon-gouwu1' | 'icon-dingdan1' | 'icon-gerenzhongxin1' | 'icon-shouye1' | 'icon-gerenzhongxin' | 'icon-dingdan' | 'icon-shouye' | 'icon-gouwu'; - size?: number; - color?: string | string[]; - style?: React.CSSProperties; -} - -declare const IconFont: FunctionComponent; - -export default IconFont; diff --git a/src/components/iconfont/index.h5.js b/src/components/iconfont/index.h5.js deleted file mode 100644 index 80b208b..0000000 --- a/src/components/iconfont/index.h5.js +++ /dev/null @@ -1,17 +0,0 @@ -/* eslint-disable */ - -import React from 'react'; -import Taro from '@tarojs/taro'; -import Icon from './h5'; - -const IconFont = (props) => { - const { name, size, color, style } = props; - - return ; -}; - -IconFont.defaultProps = { - size: 18, -}; - -export default IconFont; diff --git a/src/components/iconfont/index.h5.tsx b/src/components/iconfont/index.h5.tsx new file mode 100644 index 0000000..6afdfe2 --- /dev/null +++ b/src/components/iconfont/index.h5.tsx @@ -0,0 +1,27 @@ +/* tslint:disable */ +/* eslint-disable */ + +import React, { FunctionComponent } from 'react'; +import Taro from '@tarojs/taro'; +import Icon from './h5'; + +export type IconNames = 'icon-lujing' | 'icon-jizhumima' | 'icon-a-jizhumima' | 'icon-weixindenglu' | 'icon-kehuxinxi' | 'icon-yewuyuanqizi' | 'icon-chakanquanbukehu' | 'icon-biyan' | 'icon-bianji' | 'icon-daikuan' | 'icon-cangku' | 'icon-guanlidingdan' | 'icon-mima' | 'icon-guanbi' | 'icon-jianshao' | 'icon-dingwei' | 'icon-saomiao' | 'icon-peihuo' | 'icon-shaixuan' | 'icon-paiming' | 'icon-shanchusousuoxinxi' | 'icon-shijian' | 'icon-sousuo' | 'icon-shouhou' | 'icon-sousuofanhui' | 'icon-sousuoshanchu' | 'icon-tuikuan' | 'icon-tishi' | 'icon-xianxiahuizong' | 'icon-xinzeng' | 'icon-yonghuming' | 'icon-yanjing' | 'icon-yufukuan' | 'icon-wodekefu' | 'icon-dizhi' | 'icon-shouhouzhongxin' | 'icon-wodeshoucang' | 'icon-shoukuanliebiao' | 'icon-madanguanli' | 'icon-qusechazhao' | 'icon-pandiansaoma' | 'icon-yaoqingma' | 'icon-duizhang' | 'icon-tihuoliebiao' | 'icon-yangpinduibi' | 'icon-yansequyang' | 'icon-fahuoliebiao' | 'icon-yuncangkucun' | 'icon-xiaoshou' | 'icon-qianzhicangkucun' | 'icon-lingquseka' | 'icon-gouwu1' | 'icon-dingdan1' | 'icon-gerenzhongxin1' | 'icon-shouye1' | 'icon-gerenzhongxin' | 'icon-dingdan' | 'icon-shouye' | 'icon-gouwu'; + +interface Props { + name: IconNames; + size?: number; + color?: string | string[]; + style?: React.CSSProperties; +} + +const IconFont: FunctionComponent = (props) => { + const { name, size, color, style } = props; + + return ; +}; + +IconFont.defaultProps = { + size: 18, +}; + +export default IconFont; diff --git a/src/components/iconfont/index.js b/src/components/iconfont/index.js deleted file mode 100644 index 9236f4b..0000000 --- a/src/components/iconfont/index.js +++ /dev/null @@ -1,7 +0,0 @@ -/* eslint-disable */ - -const IconFont = () => { - return null; -}; - -export default IconFont; diff --git a/src/components/iconfont/index.tsx b/src/components/iconfont/index.tsx new file mode 100644 index 0000000..36e3baf --- /dev/null +++ b/src/components/iconfont/index.tsx @@ -0,0 +1,19 @@ +/* tslint:disable */ +/* eslint-disable */ + +import React, { FunctionComponent } from 'react'; + +export type IconNames = 'icon-lujing' | 'icon-jizhumima' | 'icon-a-jizhumima' | 'icon-weixindenglu' | 'icon-kehuxinxi' | 'icon-yewuyuanqizi' | 'icon-chakanquanbukehu' | 'icon-biyan' | 'icon-bianji' | 'icon-daikuan' | 'icon-cangku' | 'icon-guanlidingdan' | 'icon-mima' | 'icon-guanbi' | 'icon-jianshao' | 'icon-dingwei' | 'icon-saomiao' | 'icon-peihuo' | 'icon-shaixuan' | 'icon-paiming' | 'icon-shanchusousuoxinxi' | 'icon-shijian' | 'icon-sousuo' | 'icon-shouhou' | 'icon-sousuofanhui' | 'icon-sousuoshanchu' | 'icon-tuikuan' | 'icon-tishi' | 'icon-xianxiahuizong' | 'icon-xinzeng' | 'icon-yonghuming' | 'icon-yanjing' | 'icon-yufukuan' | 'icon-wodekefu' | 'icon-dizhi' | 'icon-shouhouzhongxin' | 'icon-wodeshoucang' | 'icon-shoukuanliebiao' | 'icon-madanguanli' | 'icon-qusechazhao' | 'icon-pandiansaoma' | 'icon-yaoqingma' | 'icon-duizhang' | 'icon-tihuoliebiao' | 'icon-yangpinduibi' | 'icon-yansequyang' | 'icon-fahuoliebiao' | 'icon-yuncangkucun' | 'icon-xiaoshou' | 'icon-qianzhicangkucun' | 'icon-lingquseka' | 'icon-gouwu1' | 'icon-dingdan1' | 'icon-gerenzhongxin1' | 'icon-shouye1' | 'icon-gerenzhongxin' | 'icon-dingdan' | 'icon-shouye' | 'icon-gouwu'; + +export interface IconProps { + name: IconNames; + size?: number; + color?: string | string[]; + style?: React.CSSProperties; +} + +const IconFont: FunctionComponent = () => { + return null; +}; + +export default IconFont; diff --git a/src/components/iconfont/index.weapp.js b/src/components/iconfont/index.weapp.js deleted file mode 100644 index 731305b..0000000 --- a/src/components/iconfont/index.weapp.js +++ /dev/null @@ -1,16 +0,0 @@ -/* eslint-disable */ - -import React from 'react'; -import Taro from '@tarojs/taro'; - -const IconFont = (props) => { - const { name, size, color, style } = props; - - return ; -}; - -IconFont.defaultProps = { - size: 18, -}; - -export default IconFont; diff --git a/src/components/iconfont/index.weapp.tsx b/src/components/iconfont/index.weapp.tsx new file mode 100644 index 0000000..e6284d0 --- /dev/null +++ b/src/components/iconfont/index.weapp.tsx @@ -0,0 +1,27 @@ +/* tslint:disable */ +/* eslint-disable */ + +import React, { FunctionComponent } from 'react'; +import Taro from '@tarojs/taro'; + +export type IconNames = 'icon-lujing' | 'icon-jizhumima' | 'icon-a-jizhumima' | 'icon-weixindenglu' | 'icon-kehuxinxi' | 'icon-yewuyuanqizi' | 'icon-chakanquanbukehu' | 'icon-biyan' | 'icon-bianji' | 'icon-daikuan' | 'icon-cangku' | 'icon-guanlidingdan' | 'icon-mima' | 'icon-guanbi' | 'icon-jianshao' | 'icon-dingwei' | 'icon-saomiao' | 'icon-peihuo' | 'icon-shaixuan' | 'icon-paiming' | 'icon-shanchusousuoxinxi' | 'icon-shijian' | 'icon-sousuo' | 'icon-shouhou' | 'icon-sousuofanhui' | 'icon-sousuoshanchu' | 'icon-tuikuan' | 'icon-tishi' | 'icon-xianxiahuizong' | 'icon-xinzeng' | 'icon-yonghuming' | 'icon-yanjing' | 'icon-yufukuan' | 'icon-wodekefu' | 'icon-dizhi' | 'icon-shouhouzhongxin' | 'icon-wodeshoucang' | 'icon-shoukuanliebiao' | 'icon-madanguanli' | 'icon-qusechazhao' | 'icon-pandiansaoma' | 'icon-yaoqingma' | 'icon-duizhang' | 'icon-tihuoliebiao' | 'icon-yangpinduibi' | 'icon-yansequyang' | 'icon-fahuoliebiao' | 'icon-yuncangkucun' | 'icon-xiaoshou' | 'icon-qianzhicangkucun' | 'icon-lingquseka' | 'icon-gouwu1' | 'icon-dingdan1' | 'icon-gerenzhongxin1' | 'icon-shouye1' | 'icon-gerenzhongxin' | 'icon-dingdan' | 'icon-shouye' | 'icon-gouwu'; + +interface Props { + name: IconNames; + size?: number; + color?: string | string[]; + style?: React.CSSProperties; +} + +const IconFont: FunctionComponent = (props) => { + const { name, size, color, style } = props; + + // @ts-ignore + return ; +}; + +IconFont.defaultProps = { + size: 18, +}; + +export default IconFont; diff --git a/src/components/iconfont/weapp/weapp.js b/src/components/iconfont/weapp/weapp.js index 5217936..4a356cf 100644 --- a/src/components/iconfont/weapp/weapp.js +++ b/src/components/iconfont/weapp/weapp.js @@ -1,6 +1,6 @@ Component({ properties: { - // icon-jizhumima | icon-a-jizhumima | icon-weixindenglu | icon-kehuxinxi | icon-yewuyuanqizi | icon-chakanquanbukehu | icon-biyan | icon-bianji | icon-daikuan | icon-cangku | icon-guanlidingdan | icon-mima | icon-guanbi | icon-jianshao | icon-dingwei | icon-saomiao | icon-peihuo | icon-shaixuan | icon-paiming | icon-shanchusousuoxinxi | icon-shijian | icon-sousuo | icon-shouhou | icon-sousuofanhui | icon-sousuoshanchu | icon-tuikuan | icon-tishi | icon-xianxiahuizong | icon-xinzeng | icon-yonghuming | icon-yanjing | icon-yufukuan | icon-wodekefu | icon-dizhi | icon-shouhouzhongxin | icon-wodeshoucang | icon-shoukuanliebiao | icon-madanguanli | icon-qusechazhao | icon-pandiansaoma | icon-yaoqingma | icon-duizhang | icon-tihuoliebiao | icon-yangpinduibi | icon-yansequyang | icon-fahuoliebiao | icon-yuncangkucun | icon-xiaoshou | icon-qianzhicangkucun | icon-lingquseka | icon-gouwu1 | icon-dingdan1 | icon-gerenzhongxin1 | icon-shouye1 | icon-gerenzhongxin | icon-dingdan | icon-shouye | icon-gouwu + // icon-lujing | icon-jizhumima | icon-a-jizhumima | icon-weixindenglu | icon-kehuxinxi | icon-yewuyuanqizi | icon-chakanquanbukehu | icon-biyan | icon-bianji | icon-daikuan | icon-cangku | icon-guanlidingdan | icon-mima | icon-guanbi | icon-jianshao | icon-dingwei | icon-saomiao | icon-peihuo | icon-shaixuan | icon-paiming | icon-shanchusousuoxinxi | icon-shijian | icon-sousuo | icon-shouhou | icon-sousuofanhui | icon-sousuoshanchu | icon-tuikuan | icon-tishi | icon-xianxiahuizong | icon-xinzeng | icon-yonghuming | icon-yanjing | icon-yufukuan | icon-wodekefu | icon-dizhi | icon-shouhouzhongxin | icon-wodeshoucang | icon-shoukuanliebiao | icon-madanguanli | icon-qusechazhao | icon-pandiansaoma | icon-yaoqingma | icon-duizhang | icon-tihuoliebiao | icon-yangpinduibi | icon-yansequyang | icon-fahuoliebiao | icon-yuncangkucun | icon-xiaoshou | icon-qianzhicangkucun | icon-lingquseka | icon-gouwu1 | icon-dingdan1 | icon-gerenzhongxin1 | icon-shouye1 | icon-gerenzhongxin | icon-dingdan | icon-shouye | icon-gouwu name: { type: String, }, diff --git a/src/components/iconfont/weapp/weapp.wxml b/src/components/iconfont/weapp/weapp.wxml index e28ef75..9df2807 100644 --- a/src/components/iconfont/weapp/weapp.wxml +++ b/src/components/iconfont/weapp/weapp.wxml @@ -1,3 +1,6 @@ + + + diff --git a/src/pages/order/components/PayPopup/index.tsx b/src/pages/order/components/PayPopup/index.tsx index 232d526..1b005f4 100644 --- a/src/pages/order/components/PayPopup/index.tsx +++ b/src/pages/order/components/PayPopup/index.tsx @@ -1,174 +1,156 @@ - import { ScrollView, View, Image } from '@tarojs/components' import { memo, useCallback, useEffect, useMemo, useState, useRef } from 'react' import styles from './index.module.scss' import classnames from 'classnames' -import BottomBtns from '@/components/BottomBtns' -import { formatPriceDiv, formatImgUrl } from '@/common/fotmat' +import { formatPriceDiv, formatImgUrl } from '@/common/format' import Taro from '@tarojs/taro' import Popup from '@/components/popup' import useCheckAuthorize from '@/use/useCheckAuthorize' import { alert } from '@/common/common' interface Props { - showPopup: true | false, - popupClose?: () => void, - obj: { - wait_pay_amount?: number | string, - actual_amount?: number | string, - total_sale_price?: number | string, - should_collect_order_id?: number | string, - pre_collect_order_id?: number | string, - status?: number | string, - }, - showSide?: boolean, - list?: any[], - clickItem?: (any) => void, - handsurePay?: (any) => void, - title: string, - picUrl?: string + showPopup: true | false + popupClose?: () => void + obj: { + wait_pay_amount?: number | string + actual_amount?: number | string + total_sale_price?: number | string + should_collect_order_id?: number | string + pre_collect_order_id?: number | string + status?: number | string + } + showSide?: boolean + list?: any[] + clickItem?: (any) => void + handsurePay?: (any) => void + title: string + picUrl?: string } export default memo((props: Props) => { - const { - showSide = true, - showPopup = false, - popupClose, - obj = { - wait_pay_amount: '', - actual_amount: '', - total_sale_price: '' - }, - clickItem, - handsurePay, - list = [], - title = '待支付款项', - picUrl = '' - } = props + const { + showSide = true, + showPopup = false, + popupClose, + obj = { + wait_pay_amount: '', + actual_amount: '', + total_sale_price: '', + }, + clickItem, + handsurePay, + list = [], + title = '待支付款项', + picUrl = '', + } = props - const fileData = useRef({ - filePath: '', - base64: '', + const fileData = useRef({ + filePath: '', + base64: '', + }) + + //预览图片 + const showImage = () => { + const time = new Date().valueOf() + const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(picUrl) || [] + let filePath = Taro.env.USER_DATA_PATH + '/img' + time + '.' + format + fileData.current.filePath = filePath + fileData.current.base64 = bodyData + const save = Taro.getFileSystemManager() + save.writeFile({ + filePath: fileData.current.filePath, + data: fileData.current.base64, + encoding: 'base64', }) + Taro.previewImage({ + current: fileData.current.filePath, // 当前显示 + urls: [fileData.current.filePath], // 需要预览的图片http链接列表 + }) + } - //预览图片 - const showImage = () => { - const time = new Date().valueOf() - const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(picUrl) || [] - let filePath = Taro.env.USER_DATA_PATH + '/img' + time + '.' + format - fileData.current.filePath = filePath - fileData.current.base64 = bodyData - const save = Taro.getFileSystemManager() - save.writeFile({ - filePath: fileData.current.filePath, - data: fileData.current.base64, - encoding: 'base64', - }) - Taro.previewImage({ - current: fileData.current.filePath, // 当前显示 - urls: [fileData.current.filePath], // 需要预览的图片http链接列表 - }) - } + //检查是否开启保存图片权限 + const { check } = useCheckAuthorize({ scope: 'scope.writePhotosAlbum', msg: '您没授权,无法保存图片' }) + const saveImageCheck = async () => { + const res = await check() + res && saveImage() + } + //保存图片 + const saveImage = () => { + alert.loading('正在保存图片') + Taro.saveImageToPhotosAlbum({ + filePath: fileData.current.filePath, + success: function () { + alert.success('图片保存成功') + }, + fail: function (err) { + console.log('err::', err) + }, + }) + } - //检查是否开启保存图片权限 - const { check } = useCheckAuthorize({ scope: 'scope.writePhotosAlbum', msg: '您没授权,无法保存图片' }) - const saveImageCheck = async () => { - const res = await check() - res && saveImage() - } - - //保存图片 - const saveImage = () => { - alert.loading('正在保存图片') - Taro.saveImageToPhotosAlbum({ - filePath: fileData.current.filePath, - success: function () { - alert.success('图片保存成功') - }, - fail: function (err) { - console.log('err::', err) - }, - }) - } - - return ( - - popupClose?.()}> - { - showSide && - - - ¥{formatPriceDiv(obj.wait_pay_amount)} - - - - 订单金额 - - - ¥{formatPriceDiv(obj.total_sale_price)} - - - - - 已付金额 - - - ¥{formatPriceDiv(obj.actual_amount)} - - - - { - list.map((item, index) => { - return ( - clickItem?.(item)}> - - - - - - {item.name} - { - item.fonts && {item.fonts}{ - item.money !== "" ? "¥" : "" - }{item.money} - } - - - { - item.name !== '扫码支付' && - - - - } - { - item.name === '扫码支付' && - - } - - ) - }) - } - + return ( + + popupClose?.()}> + {showSide && ( + + ¥{formatPriceDiv(obj.wait_pay_amount)} + + 订单金额 + ¥{formatPriceDiv(obj.total_sale_price)} + + + 已付金额 + ¥{formatPriceDiv(obj.actual_amount)} + + + {list.map((item, index) => { + return ( + clickItem?.(item)}> + + + - - } - { - showSide && handsurePay?.(props?.obj)}>确认交易 - } - { - !showSide && - - - showImage()}> + + {item.name} + {item.fonts && ( + + {item.fonts} + {item.money !== '' ? '¥' : ''} + {item.money} - - - } - { - !showSide && saveImageCheck()}>保存图片 - } - - - ) -}) \ No newline at end of file + )} + + + {item.name !== '扫码支付' && ( + + + + )} + {item.name === '扫码支付' && } + + ) + })} + + )} + {showSide && ( + handsurePay?.(props?.obj)}> + 确认交易 + + )} + {!showSide && ( + + + showImage()}> + + + )} + {!showSide && ( + saveImageCheck()}> + 保存图片 + + )} + + + ) +}) diff --git a/src/pages/order/components/itemList/index.tsx b/src/pages/order/components/itemList/index.tsx index 733f357..22695f1 100644 --- a/src/pages/order/components/itemList/index.tsx +++ b/src/pages/order/components/itemList/index.tsx @@ -3,78 +3,100 @@ import { memo, useCallback, useEffect, useMemo, useState } from 'react' import styles from './index.module.scss' import classnames from 'classnames' import BottomBtns from '@/components/BottomBtns' -import { formatPriceDiv } from '@/common/fotmat' +import { formatPriceDiv } from '@/common/format' import Taro from '@tarojs/taro' interface propsObj { - obj: any, - cancle?: (arg: any, obj: any) => void, - nextBuy?: (arg: any, obj: any) => void, - toPay?: (arg: any, obj: any) => void + obj: any + cancle?: (arg: any, obj: any) => void + nextBuy?: (arg: any, obj: any) => void + toPay?: (arg: any, obj: any) => void } - export default memo((props: propsObj) => { - const navTo = (e) => { - Taro.navigateTo({ - url: '/pages/orderDetails/index?id=' + props?.obj?.id - }) - } + const navTo = (e) => { + Taro.navigateTo({ + url: '/pages/orderDetails/index?id=' + props?.obj?.id, + }) + } - - return ( - navTo(e)}> - - 单号:{props?.obj?.order_no} - {props?.obj?.status_name} - - {props?.obj?.purchaser_name} - - - - 颜色 ({props?.obj?.total_colors}) - - - - - {props?.obj?.product_list[0]?.code} {props?.obj?.product_list[0]?.name} - {props?.obj?.sale_mode === 0 ? '大货' : props?.obj?.sale_mode === 1 ? '剪版' : '散剪'} - - {props?.obj?.shipment_mode_name} - - - {props?.obj?.product_list[0]?.product_colors[0]?.code} {props?.obj?.product_list[0]?.product_colors[0]?.name} - x{props?.obj?.sale_mode === 0 ? props?.obj?.product_list[0]?.product_colors[0]?.roll : props?.obj?.product_list[0]?.product_colors[0]?.length / 100} {props?.obj?.sale_mode === 0 ? '条' : 'm'} - ¥ {props?.obj?.product_list[0]?.product_colors[0]?.sale_price / 100}/kg - - { - props?.obj?.product_list[0]?.product_colors?.length > 1 && <> - - {props?.obj?.product_list[0]?.product_colors[1]?.code} {props?.obj?.product_list[0]?.product_colors[1]?.name} - x{props?.obj?.sale_mode === 0 ? props?.obj?.product_list[0]?.product_colors[1]?.roll : props?.obj?.product_list[0]?.product_colors[1]?.length / 100} {props?.obj?.sale_mode === 0 ? '条' : 'm'} - ¥ {props?.obj?.product_list[0]?.product_colors[1]?.sale_price / 100}/kg - - - } - - - - - 布料信息: - {props?.obj?.total_fabrics} 种面料,{props?.obj?.total_colors} 种颜色,共 {props?.obj?.sale_mode === 0 ? props?.obj?.total_number : props?.obj?.total_number / 100} {props?.obj?.sale_mode === 0 ? '条' : 'm'} - - - 预估金额: - ¥{formatPriceDiv(props?.obj?.estimate_amount)} - - - props?.cancle?.(e, props?.obj)} - nextBuy={(e) => props?.nextBuy?.(e, props?.obj)} - toPay={(e) => props?.toPay?.(e, props?.obj)} - > - + return ( + navTo(e)}> + + 单号:{props?.obj?.order_no} + {props?.obj?.status_name} + + {props?.obj?.purchaser_name} + + + + 颜色 ({props?.obj?.total_colors}) - ) -}) \ No newline at end of file + + + + + {props?.obj?.product_list[0]?.code} {props?.obj?.product_list[0]?.name} + + {props?.obj?.sale_mode === 0 ? '大货' : props?.obj?.sale_mode === 1 ? '剪版' : '散剪'} + + {props?.obj?.shipment_mode_name} + + + + {props?.obj?.product_list[0]?.product_colors[0]?.code} {props?.obj?.product_list[0]?.product_colors[0]?.name} + + + x + {props?.obj?.sale_mode === 0 + ? props?.obj?.product_list[0]?.product_colors[0]?.roll + : props?.obj?.product_list[0]?.product_colors[0]?.length / 100}{' '} + {props?.obj?.sale_mode === 0 ? '条' : 'm'} + + ¥ {props?.obj?.product_list[0]?.product_colors[0]?.sale_price / 100}/kg + + {props?.obj?.product_list[0]?.product_colors?.length > 1 && ( + <> + + + {props?.obj?.product_list[0]?.product_colors[1]?.code} {props?.obj?.product_list[0]?.product_colors[1]?.name} + + + x + {props?.obj?.sale_mode === 0 + ? props?.obj?.product_list[0]?.product_colors[1]?.roll + : props?.obj?.product_list[0]?.product_colors[1]?.length / 100}{' '} + {props?.obj?.sale_mode === 0 ? '条' : 'm'} + + ¥ {props?.obj?.product_list[0]?.product_colors[1]?.sale_price / 100}/kg + + + )} + + + + + 布料信息: + + {props?.obj?.total_fabrics} 种面料,{props?.obj?.total_colors} 种颜色,共{' '} + {props?.obj?.sale_mode === 0 ? props?.obj?.total_number : props?.obj?.total_number / 100} {props?.obj?.sale_mode === 0 ? '条' : 'm'} + + + + 预估金额: + ¥{formatPriceDiv(props?.obj?.estimate_amount)} + + + props?.cancle?.(e, props?.obj)} + nextBuy={(e) => props?.nextBuy?.(e, props?.obj)} + toPay={(e) => props?.toPay?.(e, props?.obj)}> + + + ) +}) diff --git a/src/pages/order/index.tsx b/src/pages/order/index.tsx index 907e626..4e97588 100644 --- a/src/pages/order/index.tsx +++ b/src/pages/order/index.tsx @@ -1,11 +1,11 @@ import { View, Input, Button } from '@tarojs/components' -import { useCallback, useEffect, useMemo, useRef, useState, } from 'react' +import { useCallback, useEffect, useMemo, useRef, useState } from 'react' import { mpenumsaleorderstatus, OrderListApi } from '@/api/order' import OrderStatusList from './components/orderStatusList' import Search from '@/components/search' import { dataLoadingStatus, getFilterData } from '@/common/util' -import styles from "./index.module.scss" -import classnames from "classnames"; +import styles from './index.module.scss' +import classnames from 'classnames' import Popup from '@/components/popup' import InfiniteScroll from '@/components/infiniteScroll' import Taro, { faceVerifyForPay, useDidShow } from '@tarojs/taro' @@ -17,10 +17,10 @@ import { orderPaymentpreCollectOrderorderPaymentMethodInfo, orderPaymentorderPaymentSubmission, orderPaymentpreCollectOrderorderPaymentSubmission, - GetPayCode + GetPayCode, } from '@/api/order' import PayPopup from './components/PayPopup' -import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/fotmat' +import { formatDateTime, formatHashTag, formatImgUrl, formatPriceDiv, formatWeightDiv } from '@/common/format' export default () => { //页码和页数 @@ -37,16 +37,13 @@ export default () => { const getOrderList = async () => { let res = await listFetchData({ ...getFilterData(searchField), - ...getFilterData(searchObj) + ...getFilterData(searchObj), }) setOrderData((e) => ({ ...e, list: res.data?.list, total: res.data?.total })) setshowPopup(false) setRefresherTriggeredStatus(() => false) } - - - //列表下拉刷新 const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false) const getRefresherRefresh = async () => { @@ -56,7 +53,10 @@ export default () => { } //数据加载状态 const statusMore = useMemo(() => { - console.log({ list: orderData.list, total: orderData.total, status: orderState.loading }, '{ list: orderData.list, total: orderData.total, status: orderState.loading }') + console.log( + { list: orderData.list, total: orderData.total, status: orderState.loading }, + '{ list: orderData.list, total: orderData.total, status: orderState.loading }', + ) return dataLoadingStatus({ list: orderData.list, total: orderData.total, status: orderState.loading }) }, [orderData, orderState]) @@ -108,12 +108,10 @@ export default () => { setshowPopup(false) } - useDidShow(() => { - //获取选择的客户 - let pages = Taro.getCurrentPages(); - let currPage = pages[pages.length - 1]; // 获取当前页面 + let pages = Taro.getCurrentPages() + let currPage = pages[pages.length - 1] // 获取当前页面 console.log(currPage.data, '8888') setsearchObj((e) => ({ @@ -126,12 +124,12 @@ export default () => { }) interface filterObj { - purchaser_id?: string | number, - clientName?: string, - sale_user_id?: string | number, - saleuserName?: string, - orderNo?: string | undefined, - sale_mode?: Number | undefined, + purchaser_id?: string | number + clientName?: string + sale_user_id?: string | number + saleuserName?: string + orderNo?: string | undefined + sale_mode?: Number | undefined shipment_mode?: Number | undefined } @@ -143,17 +141,17 @@ export default () => { saleuserName: '', orderNo: '', sale_mode: undefined, - shipment_mode: undefined + shipment_mode: undefined, }) // 跳转选择客户 const navTo = (index) => { if (index === 1) { Taro.navigateTo({ - url: '/pages/customerPage/index?clientId=' + searchObj?.purchaser_id + url: '/pages/customerPage/index?clientId=' + searchObj?.purchaser_id, }) } else { Taro.navigateTo({ - url: '/pages/saleuserPage/index?saleuserId=' + searchObj?.sale_user_id + url: '/pages/saleuserPage/index?saleuserId=' + searchObj?.sale_user_id, }) } } @@ -163,10 +161,15 @@ export default () => { } //订单类型 - const [modeList, setModeList] = useState([{ id: -1, name: '不限' }, { id: 0, name: '大货' }, { id: 1, name: '剪版' }, { id: 2, name: '散剪' }]) + const [modeList, setModeList] = useState([ + { id: -1, name: '不限' }, + { id: 0, name: '大货' }, + { id: 1, name: '剪版' }, + { id: 2, name: '散剪' }, + ]) //选择订单类型 const handCheckMode = (item) => { - modeList.map(it => { + modeList.map((it) => { if (it.id === item.id) { it.checked = true } else { @@ -179,10 +182,14 @@ export default () => { } ///发货方式类型 - const [deliveryList, setdeliveryList] = useState([{ id: -1, name: '不限' }, { id: 1, name: '自提' }, { id: 2, name: '物流' }]) + const [deliveryList, setdeliveryList] = useState([ + { id: -1, name: '不限' }, + { id: 1, name: '自提' }, + { id: 2, name: '物流' }, + ]) //选择发货方式类型 const handCheckDelivery = (item) => { - deliveryList.map(it => { + deliveryList.map((it) => { if (it.id === item.id) { it.checked = true } else { @@ -195,7 +202,8 @@ export default () => { } //是否不允许确认筛选 const isDisabled = useMemo(() => { - if (searchObj.clientName !== '' || + if ( + searchObj.clientName !== '' || searchObj.orderNo !== '' || searchObj.saleuserName !== '' || searchObj.sale_mode !== undefined || @@ -216,7 +224,7 @@ export default () => { saleuserName: '', orderNo: '', sale_mode: undefined, - shipment_mode: undefined + shipment_mode: undefined, }) } //确认筛选 @@ -230,9 +238,9 @@ export default () => { setsearchObj((e) => ({ ...e, orderNo: res.result })) }, fail(res) { - console.log(res); + console.log(res) }, - }); + }) } useEffect(() => { @@ -242,68 +250,68 @@ export default () => { const { fetchData: cancelFetch } = mpsaleOrdercancel() //取消订单 const cancle = async (e, item) => { - e.stopPropagation(); + e.stopPropagation() Taro.showModal({ - content: "确定要取消吗?", - confirmText: "确认", - cancelText: "取消", + content: '确定要取消吗?', + confirmText: '确认', + cancelText: '取消', success: async function (res) { if (res.confirm) { Taro.showLoading({ title: '请稍等...', - mask: true + mask: true, }) const res = await cancelFetch({ id: item.id }) if (res.msg === 'success') { Taro.showToast({ - title: '取消成功' + title: '取消成功', }) Taro.hideLoading() getOrderList() } else { Taro.showToast({ title: res.msg, - icon: 'error' + icon: 'error', }) } } - } + }, }) } //再次购买 const { fetchData: buyFetch } = mpshoppingCartproductColorlist() const nextBuy = async (e, item) => { - e.stopPropagation(); + e.stopPropagation() Taro.showLoading({ title: '请稍等...', - mask: true + mask: true, }) let arr: any = [] - item.product_list.forEach(item => { - item.product_colors.forEach(it => { + item.product_list.forEach((item) => { + item.product_colors.forEach((it) => { arr.push({ length: it.length, roll: it.roll, - product_color_id: it.id + product_color_id: it.id, }) }) }) let query = { purchaser_id: item.purchaser_id, sale_mode: item.sale_mode, - color_list: arr + color_list: arr, } const res = await buyFetch(query) if (res.msg === 'success') { Taro.showToast({ - title: '加入购物车成功!' + title: '加入购物车成功!', }) Taro.hideLoading() getOrderList() } else { Taro.showToast({ title: res.msg, - icon: 'error' + icon: 'error', }) } } @@ -314,103 +322,97 @@ export default () => { const [payList, setPayList] = useState([ { id: 2, - iconfont: "icon-xianxiahuizong", - name: "预存款", - fonts: "可用额度 ", - money: "", + iconfont: 'icon-xianxiahuizong', + name: '预存款', + fonts: '可用额度 ', + money: '', isCheck: false, }, { id: 5, - iconfont: "icon-xianxiahuizong", - name: "货到付款", - fonts: "发货后3天内付款", + iconfont: 'icon-xianxiahuizong', + name: '货到付款', + fonts: '发货后3天内付款', isCheck: false, - money: "", + money: '', }, { id: 3, - iconfont: "icon-xianxiahuizong", - name: "x天账期", - fonts: "可用额度 ", - money: "", + iconfont: 'icon-xianxiahuizong', + name: 'x天账期', + fonts: '可用额度 ', + money: '', isCheck: false, }, { - iconfont: "icon-saomiao", - name: "扫码支付", + iconfont: 'icon-saomiao', + name: '扫码支付', }, ]) const toPay = async (e, item) => { - e.stopPropagation(); + e.stopPropagation() setItemObj(item) if (item.status !== 10) { let res = await infoOneFetch({ id: item.should_collect_order_id }) payList.map((item) => { if (item.id === 3) { - item.name = `${res.data.account_period}天账期`; - item.fonts = `可用额度${formatPriceDiv( - res.data.account_period_credit_available_line - ).toLocaleString()}`; + item.name = `${res.data.account_period}天账期` + item.fonts = `可用额度${formatPriceDiv(res.data.account_period_credit_available_line).toLocaleString()}` } if (item.id === 2) { - item.fonts = `可用额度${formatPriceDiv( - res.data.advance_deposit_balance - ).toLocaleString()}`; + item.fonts = `可用额度${formatPriceDiv(res.data.advance_deposit_balance).toLocaleString()}` } - return item; - }); + return item + }) setPayList([...payList]) if (item.is_shipper_picks_up) { const obj = payList.filter((item) => { - return item.id === 6; - }); - console.log(obj, "456456"); + return item.id === 6 + }) + console.log(obj, '456456') if (obj.length === 0) { payList.unshift({ id: 6, - iconfont: "icon-xianxiahuizong", - name: "货主自提", - fonts: "", - money: "", + iconfont: 'icon-xianxiahuizong', + name: '货主自提', + fonts: '', + money: '', isCheck: false, - }); + }) setPayList([...payList]) } } } else { let res = await infoTwoFetch({ id: item.pre_collect_order_id }) - const arr: any = []; + const arr: any = [] arr.push( { id: 2, - iconfont: "icon-xianxiahuizong", - name: "预存款", - fonts: `可用额度${formatPriceDiv( - res.data.advance_deposit_balance - ).toLocaleString()}`, - money: "", + iconfont: 'icon-xianxiahuizong', + name: '预存款', + fonts: `可用额度${formatPriceDiv(res.data.advance_deposit_balance).toLocaleString()}`, + money: '', isCheck: false, }, { - iconfont: "icon-saomiao", - name: "扫码支付", - } - ); + iconfont: 'icon-saomiao', + name: '扫码支付', + }, + ) if (item.is_shipper_picks_up) { const obj = arr.filter((item) => { - return item.id === 6; - }); + return item.id === 6 + }) if (obj.length === 0) { arr.unshift({ id: 6, - iconfont: "icon-xianxiahuizong", - name: "货主自提", - fonts: "", - money: "", + iconfont: 'icon-xianxiahuizong', + name: '货主自提', + fonts: '', + money: '', isCheck: false, - }); + }) } } setPayList([...arr]) @@ -421,8 +423,10 @@ export default () => { //选择支付方式 const clickItem = (item) => { - if (item.name === '扫码支付') { handScanpay() } - payList.map(it => { + if (item.name === '扫码支付') { + handScanpay() + } + payList.map((it) => { if (item.id === it.id) { it.checked = true } else { @@ -433,14 +437,13 @@ export default () => { setPayList([...payList]) } - //扫码支付 const [showSide, setShowSide] = useState(true) const [title, setTitle] = useState('') const [picUrl, setPicUrl] = useState('') const { fetchData: payFetch } = GetPayCode() const handScanpay = async () => { - const list: any = []; + const list: any = [] itemObj.product_list.forEach((item) => { item.product_colors.forEach((it) => { list.push({ @@ -451,18 +454,15 @@ export default () => { num: it.roll.toString(), weight: formatWeightDiv(it.actual_weight).toString(), sale_price: (it.sale_price / 100).toString(), - total_price: - it.actual_amount !== 0 - ? (it.actual_amount / 100).toString() - : (it.estimate_amount / 100).toString(), + total_price: it.actual_amount !== 0 ? (it.actual_amount / 100).toString() : (it.estimate_amount / 100).toString(), length: (it.length / 100).toString(), weight_error: formatWeightDiv(it.weight_error).toString(), - }); - }); - }); + }) + }) + }) const query = { list: list, - title: "面料销售电子确认单", + title: '面料销售电子确认单', show_qrcode: true, show_barcode: true, show_wait_pay_amount: true, @@ -482,14 +482,10 @@ export default () => { client: itemObj.purchaser_name, phone: itemObj.target_user_phone, order_total_length: (itemObj.total_number / 100).toString(), - order_total_price: ( - itemObj.bill_total_sale_price / 100 - ).toString(), - total_weight_error_discount: ( - itemObj.total_weight_error_discount / 100 - ).toString(), + order_total_price: (itemObj.bill_total_sale_price / 100).toString(), + total_weight_error_discount: (itemObj.total_weight_error_discount / 100).toString(), order_total_num: itemObj.total_number.toString(), - qrcode: "", + qrcode: '', order_total_weight: (itemObj.total_weight / 1000).toString(), estimate_amount: (itemObj.estimate_amount / 100).toString(), total_sale_price: (itemObj.total_sale_price / 100).toString(), @@ -497,10 +493,8 @@ export default () => { show_total_weight_error_discount: true, actual_amount: (itemObj.payment_amount / 100).toString(), wait_pay_amount: (itemObj.wait_pay_amount / 100).toString(), - order_total_weight_error: ( - itemObj.total_weight_error / 1000 - ).toString(), - }; + order_total_weight_error: (itemObj.total_weight_error / 1000).toString(), + } const res = await payFetch(query) if (res.data) { console.log(res.data.base64) @@ -510,38 +504,40 @@ export default () => { } } - //确认交易 const { fetchData: payOneFetch } = orderPaymentorderPaymentSubmission() const { fetchData: payTwoFetch } = orderPaymentpreCollectOrderorderPaymentSubmission() const handsurePay = (obj) => { let arr: any = [] // if (obj.status !== 10) { - arr = payList.filter(item => { + arr = payList.filter((item) => { return item.checked }) if (!arr.length) { Taro.showToast({ title: '请选择后再提交', - icon: 'error' + icon: 'error', }) return false } Taro.showModal({ - content: "确定交易吗?", - confirmText: "确认", - cancelText: "取消", + content: '确定交易吗?', + confirmText: '确认', + cancelText: '取消', success: async function (res) { if (res.confirm) { Taro.showLoading({ title: '请稍等...', - mask: true + mask: true, }) - const restult = await obj.status !== 10 ? payOneFetch({ id: Number(obj.should_collect_order_id), payment_method: Number(arr[0]?.id) }) : payTwoFetch({ id: Number(obj.pre_collect_order_id), payment_method: Number(arr[0]?.id) }) + const restult = + (await obj.status) !== 10 + ? payOneFetch({ id: Number(obj.should_collect_order_id), payment_method: Number(arr[0]?.id) }) + : payTwoFetch({ id: Number(obj.pre_collect_order_id), payment_method: Number(arr[0]?.id) }) if (restult?.msg === 'success') { Taro.showToast({ - title: '交易成功' + title: '交易成功', }) Taro.hideLoading() setShowPay(false) @@ -549,12 +545,11 @@ export default () => { } else { Taro.showToast({ title: restult?.msg, - icon: 'error' + icon: 'error', }) } } - - } + }, }) // } @@ -566,14 +561,14 @@ export default () => { return ( - + showSelctPopup()}> 筛选 - + @@ -591,8 +586,7 @@ export default () => { key={index} cancle={(e, item) => cancle(e, item)} nextBuy={(e, item) => nextBuy(e, item)} - toPay={(e, item) => toPay(e, item)} - > + toPay={(e, item) => toPay(e, item)}> ) })} @@ -620,41 +614,76 @@ export default () => { 订单单号 - { handInput(e) }} placeholderStyle='color:#000000; font-size:26rpx' className={styles.orderInput} value={searchObj.orderNo} placeholder={'请输入或扫描条形码'}> - { handScan() }}> + { + handInput(e) + }} + placeholderStyle='color:#000000; font-size:26rpx' + className={styles.orderInput} + value={searchObj.orderNo} + placeholder={'请输入或扫描条形码'}> + { + handScan() + }}> 订单类型 - { - modeList.map((item, index) => { - return ( - { handCheckMode(item) }} className={classnames(item.checked ? styles.activemodeBox : styles.modeBox)} key={index}>{item.name} - ) - }) - } + {modeList.map((item, index) => { + return ( + { + handCheckMode(item) + }} + className={classnames(item.checked ? styles.activemodeBox : styles.modeBox)} + key={index}> + {item.name} + + ) + })} 发货方式 - { - deliveryList.map((item, index) => { - return ( - { handCheckDelivery(item) }} className={classnames(item.checked ? styles.activemodeBox : styles.modeBox)} key={index}>{item.name} - ) - }) - } + {deliveryList.map((item, index) => { + return ( + { + handCheckDelivery(item) + }} + className={classnames(item.checked ? styles.activemodeBox : styles.modeBox)} + key={index}> + {item.name} + + ) + })} {isDisabled} - - - + + {/* */} @@ -668,8 +697,7 @@ export default () => { handsurePay={(obj) => handsurePay(obj)} showSide={showSide} title={title} - picUrl={picUrl} - > - + picUrl={picUrl}> + ) } diff --git a/src/styles/iconfont.scss b/src/styles/iconfont.scss index 0525f3a..c49b106 100644 --- a/src/styles/iconfont.scss +++ b/src/styles/iconfont.scss @@ -1,9 +1,6 @@ -/* CDN 服务仅供平台体验和调试使用,平台不承诺服务的稳定性,企业客户需下载字体包自行发布使用并做好备份。 */ @font-face { - font-family: 'iconfont'; - /* Project id 3619513 */ - src: url('iconfont.ttf?t=1663065236955') format('truetype'); - + font-family: "iconfont"; /* Project id 3619513 */ + src: url('/src/styles/iconfont.ttf?t=1663134774880') format('truetype'); } .iconfont { @@ -18,6 +15,22 @@ content: "\e63e"; } +.icon-jizhumima:before { + content: "\e63c"; +} + +.icon-a-jizhumima:before { + content: "\e63d"; +} + +.icon-weixindenglu:before { + content: "\e63b"; +} + +.icon-kehuxinxi:before { + content: "\e63a"; +} + .icon-yewuyuanqizi:before { content: "\e639"; } @@ -232,4 +245,5 @@ .icon-gouwu:before { content: "\e607"; -} \ No newline at end of file +} + diff --git a/src/styles/iconfont.ttf b/src/styles/iconfont.ttf index 049f955e0709f9957fdc3b9ada042b3f7975c69c..3363df12c7d249595cd5683e58eacaaaa92d2987 100644 GIT binary patch delta 46 tcmZq3Xvmll$Q)6dIWc6a^yDKm Date: Wed, 14 Sep 2022 15:52:58 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=F0=9F=90=9E=20fix(=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2):=20=E4=BF=AE=E5=A4=8D=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + src/pages/login/index.tsx | 9 ++------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 2cea3ef..08827c7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ dist/ +build/ deploy_versions/ .temp/ .rn_temp/ diff --git a/src/pages/login/index.tsx b/src/pages/login/index.tsx index 12079c6..2ea164f 100644 --- a/src/pages/login/index.tsx +++ b/src/pages/login/index.tsx @@ -68,7 +68,7 @@ const Login: FC = () => { setToken(res.data.token) setUserInfo({ ...res.data }) - Taro.redirectTo({ + Taro.switchTab({ url: '/pages/index/index', }) } else { @@ -93,12 +93,7 @@ const Login: FC = () => { - + {!eyesStatus ? (