diff --git a/src/api/mine.ts b/src/api/mine.ts new file mode 100644 index 0000000..aa0ae5a --- /dev/null +++ b/src/api/mine.ts @@ -0,0 +1,12 @@ +import { useRequest } from "@/use/useHttp" + +/** + * 获取用户资产 + * @returns +*/ +export const userassets = () => { + return useRequest({ + url: `/v1/mall/user/assets`, + method: "get", + }) +} diff --git a/src/common/constant.js b/src/common/constant.js index 5e35038..89c5570 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -5,12 +5,12 @@ // export const BASE_URL = `http://192.168.0.89:40001/lymarket` // export const BASE_URL = `http://192.168.1.165:40001/lymarket` // 王霞 // export const BASE_URL = `https://test.zzfzyc.com/lymarket` // 测试环境 -export const BASE_URL = `http://192.168.1.30:40001/lymarket` // 发 -// export const BASE_URL = `http://192.168.1.30:50001/lymarket` // 发 +// export const BASE_URL = `http://192.168.1.30:40001/lymarket` // 发 +// export const BASE_URL = `http://192.168.1.9:40001/lymarket` // 发 // export const BASE_URL = `https://dev.zzfzyc.com/lymarket` // 开发环境 // export const BASE_URL = `https://www.zzfzyc.com/lymarket` // 正式环境 // export const BASE_URL = `http://192.168.1.5:40001/lymarket` // 王霞 -// export const BASE_URL = `http://192.168.1.224:50002/lymarket` // 添 +export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添 // export const BASE_URL = `http://192.168.1.15:50001/lymarket` // 杰 // CDN diff --git a/src/pages/addressAdd/index.tsx b/src/pages/addressAdd/index.tsx index fbc2b16..cf9ac26 100644 --- a/src/pages/addressAdd/index.tsx +++ b/src/pages/addressAdd/index.tsx @@ -55,9 +55,9 @@ export default ()=>{ const rules = { name: [{ message: "请输入正确收货人姓名", - validator: (value:any, rule:any)=>{ // 自定义验证,返回true表示匹配到了(错误) - return value.length>5; - } + // validator: (value:any, rule:any)=>{ // 自定义验证,返回true表示匹配到了(错误) + // return value.length>5; + // } }], phone: [{ message: "请输入正确的电话号码", regex: /^1[3|5|6|9|2|8|7]\d{9}$/ diff --git a/src/pages/certification/index.tsx b/src/pages/certification/index.tsx index 048e981..43d5463 100644 --- a/src/pages/certification/index.tsx +++ b/src/pages/certification/index.tsx @@ -2,7 +2,7 @@ import FromListCertification from "@/components/FromListCertification" import { Button, Image, Input, NavigationBar, Navigator, Text, Textarea, View } from "@tarojs/components" import Taro, { setNavigationBarTitle, useRouter } from "@tarojs/taro" -import {certificationSaveApi, certificationDetailApi} from "@/api/certification" +import { certificationSaveApi, certificationDetailApi } from "@/api/certification" import { useEffect, useRef, useState } from "react" import { alert, retrieval } from "@/common/common" import "./index.scss" @@ -13,19 +13,19 @@ import SelectEnterpriseType from "./components/SelectEnterpriseType" import { useSelector } from "@/reducers/hooks"; import useLogin from "@/use/useLogin"; -export default ()=>{ +export default () => { const { getAdminUserInfo } = useLogin(); - const {adminUserInfo} = useSelector(state => state.userInfo); - useEffect(()=>{ + const { adminUserInfo } = useSelector(state => state.userInfo); + useEffect(() => { initalFormData(); - },[]); + }, []); // 获取认证信息 - const {fetchData: getFromData} = certificationDetailApi() - const initalFormData = async ()=>{ + const { fetchData: getFromData } = certificationDetailApi() + const initalFormData = async () => { const detail = await getFromData(); setFormData({ - ...detail.data??{}, - legal_person_identity_url: detail?.data?.legal_person_identity_url??[], + ...detail.data ?? {}, + legal_person_identity_url: detail?.data?.legal_person_identity_url ?? [], // business_license_url: "https://test.cdn.zzfzyc.com/mall/827082e888860dd9da10f0fbb0ac3cf023081456.png" } as any) } @@ -36,6 +36,7 @@ export default ()=>{ business_license_url: "", legal_person: "", legal_person_identity: "", + businessLicense: '', legal_person_identity_url: [], name: "" }); @@ -54,48 +55,48 @@ export default ()=>{ }], legal_person_identity: [{ message: "请输入正确法人身份证", - regex: /^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/ + regex: /^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/ }], legal_person_identity_url: [{ message: "请上传法人身份证", - validator: (value:any, rule:any)=>{ - if(!value[0]||!value[1]){ + validator: (value: any, rule: any) => { + if (!value[0] || !value[1]) { return true; } return false; } }], } - const {fetchData} = certificationSaveApi() - const handleSave = ()=>{ - retrieval(formData, rules).then(async ()=>{ - const result = await fetchData({...formData, authentication_type: 2}) - if(result.success){ + const { fetchData } = certificationSaveApi() + const handleSave = () => { + retrieval(formData, rules).then(async () => { + const result = await fetchData({ ...formData, authentication_type: 2 }) + if (result.success) { // Taro.eventCenter.trigger("weightList:refresh"); getAdminUserInfo(); Taro.navigateBack(); alert.success("保存成功"); - }else{ + } else { alert.error(result.msg); } - }).catch((message)=>{ + }).catch((message) => { alert.none(message) }) } // 监听表单完善 const [hozon, setHozon] = useState(false); - useEffect(()=>{ - if(retrieval){ - retrieval(formData).then(()=>setHozon(true)).catch(()=>setHozon(false)) + useEffect(() => { + if (retrieval) { + retrieval(formData).then(() => setHozon(true)).catch(() => setHozon(false)) } - },[formData]) + }, [formData]) // 选择类型弹窗显示 - const selectTypeRef= useRef(null) - const handleSelectTypeModalShow = ()=>{ + const selectTypeRef = useRef(null) + const handleSelectTypeModalShow = () => { (selectTypeRef.current as any).setShow(true) } // 选择类型确定 - const handleSelectTypeConfirm = (item)=>{ + const handleSelectTypeConfirm = (item) => { setFormData({ ...formData, authentication_type: item.id, @@ -103,18 +104,18 @@ export default ()=>{ }); } // 上传图片 - const {getWxPhoto} = useUploadCDNImg(); - const handleUploadImage = async (text: any)=>{ + const { getWxPhoto } = useUploadCDNImg(); + const handleUploadImage = async (text: any) => { let result = await getWxPhoto('mall'); - if(text=="business_license_url"){ - formData.business_license_url = IMG_CND_Prefix+(result as any).url; - }else{ - formData.legal_person_identity_url[text]=IMG_CND_Prefix+(result as any).url as never; + if (text == "business_license_url") { + formData.business_license_url = IMG_CND_Prefix + (result as any).url; + } else { + formData.legal_person_identity_url[text] = IMG_CND_Prefix + (result as any).url as never; } - setFormData({...formData}); + setFormData({ ...formData }); } // 查看图片 - const handleViewImage = (event,url)=>{ + const handleViewImage = (event, url) => { event.stopPropagation(); Taro.previewImage({ current: url, @@ -124,71 +125,72 @@ export default ()=>{ return ( - {(adminUserInfo as any)?.authentication_status==3&&} + {(adminUserInfo as any)?.authentication_status == 3 && } 企业认证 {/* */} - setFormData({...formData,name:ev.detail.value})} value={formData["name"]} label="企业名称" placeholder="请输入营业执照上的企业名称" required/> - - handleUploadImage("business_license_url")} className="certification-upload"> - {(formData as any)?.business_license_url? - <> - 营业执照正面 - - handleViewImage(e,(formData as any)?.business_license_url)}>查看证件 - 重新上传 + setFormData({ ...formData, name: ev.detail.value })} value={formData["name"]} label="企业名称" placeholder="请输入营业执照上的企业名称" required /> + {/* */} + setFormData({ ...formData, businessLicense: ev.detail.value })} value={formData["businessLicense"]} style={{ border: "0" }} label="企业营业执照" placeholder="注册号、统一社会信用代码、组织机构代码" required /> + handleUploadImage("business_license_url")} className="certification-upload"> + {(formData as any)?.business_license_url ? + <> + 营业执照正面 + + handleViewImage(e, (formData as any)?.business_license_url)}>查看证件 + 重新上传 + + + : + + + + 上传营业执照正面 - - : - - + - 上传营业执照正面 - } 法人认证 - setFormData({...formData,legal_person:ev.detail.value})} value={formData["legal_person"]} label="法人代表" placeholder="填写法人名称" required/> - setFormData({...formData,legal_person_identity:ev.detail.value})} value={formData["legal_person_identity"]} label="法人身份" placeholder="填写法人代表身份证号" required/> - handleUploadImage(0)} className="certification-upload"> - {(formData as any)?.legal_person_identity_url[0]? + setFormData({ ...formData, legal_person: ev.detail.value })} value={formData["legal_person"]} label="法人代表" placeholder="填写法人名称" required /> + setFormData({ ...formData, legal_person_identity: ev.detail.value })} value={formData["legal_person_identity"]} label="法人身份" placeholder="填写法人代表身份证号" required /> + handleUploadImage(0)} className="certification-upload"> + {(formData as any)?.legal_person_identity_url[0] ? <> 营业执照正面 - handleViewImage(e,(formData as any)?.legal_person_identity_url[0])}>查看证件 + handleViewImage(e, (formData as any)?.legal_person_identity_url[0])}>查看证件 重新上传 - - : + + : + 上传身份证正面 } - handleUploadImage(1)} className="certification-upload"> - {(formData as any)?.legal_person_identity_url[1]? - <> - 营业执照正面 - - handleViewImage(e,(formData as any)?.legal_person_identity_url[1])}>查看证件 - 重新上传 - - - : - - + - 上传身份证正面 + handleUploadImage(1)} className="certification-upload"> + {(formData as any)?.legal_person_identity_url[1] ? + <> + 营业执照正面 + + handleViewImage(e, (formData as any)?.legal_person_identity_url[1])}>查看证件 + 重新上传 - } + + : + + + + 上传身份证正面 + + } 取消 - {[3,4].includes((adminUserInfo as any)?.authentication_status)?"重新认证":"提交"} + {[3, 4].includes((adminUserInfo as any)?.authentication_status) ? "重新认证" : "提交"} diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 1bde8b9..9912444 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -1,4 +1,4 @@ -import {View} from '@tarojs/components' +import { View } from '@tarojs/components' import Banner from '@/components/banner' import Search from '@/components/search' import SideBar from '@/components/sideBar' @@ -6,16 +6,17 @@ import Product from '@/components/product' import MoveBtn from '@/components/moveBtn' import ShopCart from '@/components/shopCart' import { goLink } from '@/common/common' -import styles from './index.module.scss' +import styles from './index.module.scss' import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react' -import Taro, { Events, useDidShow, usePullDownRefresh} from '@tarojs/taro' -import {GetProductKindListApi, GetProductListApi} from '@/api/material' +import { useSelector } from "@/reducers/hooks"; +import Taro, { Events, useDidShow, usePullDownRefresh } from '@tarojs/taro' +import { GetProductKindListApi, GetProductListApi } from '@/api/material' import useLogin from '@/use/useLogin' import { dataLoadingStatus } from '@/common/util' export default () => { - const {checkLogin} = useLogin() + const { checkLogin } = useLogin() useDidShow(async () => { await checkLogin() }) @@ -25,32 +26,33 @@ export default () => { }, []) //获取面料种类 - const [kindData, setKindData] = useState({list:[], defaultId:0}) - const {fetchData} = GetProductKindListApi() + const [kindData, setKindData] = useState({ list: [], defaultId: 0 }) + const { fetchData } = GetProductKindListApi() const categoryList = async () => { const res = await fetchData() - if(res.data?.list) { - setKindData({...kindData, list:res.data.list, defaultId: res.data.list[0].id}) - setFiltrate({...filtrate, product_kind_id:res.data.list[0].id}) + if (res.data?.list) { + setKindData({ ...kindData, list: res.data.list, defaultId: res.data.list[0].id }) + setFiltrate({ ...filtrate, product_kind_id: res.data.list[0].id }) } - + } //获取面料列表 - const [productData, setProductData] = useState({list:[], total:0}) + const [productData, setProductData] = useState({ list: [], total: 0 }) const [hasMore, setHasMore] = useState(true) - const [filtrate, setFiltrate] = useState({product_kind_id:0, size: 5,page: 1}) - const pageNum = useRef({size:filtrate.size, page:filtrate.page}) - const {fetchData: productFetchData, state: productState} = GetProductListApi() + const [filtrate, setFiltrate] = useState({ product_kind_id: 0, size: 5, page: 1 }) + const pageNum = useRef({ size: filtrate.size, page: filtrate.page }) + const { fetchData: productFetchData, state: productState } = GetProductListApi() //获取数据方法 const getProductList = async () => { - const {data,total} = await productFetchData(filtrate) - setProductData({...productData,list:data.list,total}) + const { data, total } = await productFetchData(filtrate) + setProductData({ ...productData, list: data.list, total }) setRefresherTriggeredStatus(() => false) } //监听查询条件 useEffect(() => { - if(filtrate.product_kind_id) + + if (filtrate.product_kind_id) getProductList() }, [filtrate]) @@ -58,30 +60,30 @@ export default () => { //点击面料类型 const getProductKindId = useCallback((e) => { pageNum.current.page = 1 - setProductData({list:[], total:0}) - setFiltrate((list) => ({...list, size:5, product_kind_id:e.id})) + setProductData({ list: [], total: 0 }) + setFiltrate((list) => ({ ...list, size: 5, product_kind_id: e.id })) // setHasMore(true) }, []) //上拉加载数据 const getScrolltolower = useCallback(() => { - if(productData.list.length >= productData.total) { + if (productData.list.length >= productData.total) { setHasMore(false) } else { pageNum.current.page++ const newSize = pageNum.current.size * pageNum.current.page - setFiltrate((e) => ({...e, size:newSize})) + setFiltrate((e) => ({ ...e, size: newSize })) } }, [productData]) const [showShopCart, setShowShopCart] = useState(false) - + //列表下拉刷新 const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false) const getRefresherRefresh = async () => { pageNum.current.page = 1 - setFiltrate({...filtrate, size:5}) + setFiltrate({ ...filtrate, size: 5 }) setHasMore(true) setRefresherTriggeredStatus(true) } @@ -95,26 +97,85 @@ export default () => { //数据加载状态 const statusMore = useMemo(() => { - return dataLoadingStatus({list:productData.list, total: productData.total, status: productState.loading}) + return dataLoadingStatus({ list: productData.list, total: productData.total, status: productState.loading }) }, [productData, productState.loading]) - + + useEffect(() => { + getShow() + }, []) + // const [time, setShow] = useState(false) + //拿状态存储的东西判断 + const { adminUserInfo } = useSelector(state => state.userInfo); + const getShow = () => { + if (adminUserInfo?.authentication_status === 0 || adminUserInfo?.authentication_status === 1 || adminUserInfo?.authentication_status === 2 || adminUserInfo?.authentication_status === 3) { + //倒计时弹出去认证 + const countTime: any = 60 + //获取倒计时的变量 + var time = parseInt(countTime); + const countDown = setInterval(() => { + if (time == 0) { + Taro.showModal({ + title: '提示', + content: '你还未认证,认证后解锁更多功能', + cancelText: '稍后认证', + confirmText: '去认证', + success: function (res) { + if (res.confirm) { + Taro.navigateTo({ url: '/pages/certification/index' }) + } else if (res.cancel) { + console.log('用户点击取消') + } + } + }) + //清除定时器 + clearInterval(countDown); + } else { + time--; + } + }, 1000) + } + } + + //检查认证是否认证 + const checkShow = () => { + if (adminUserInfo.authentication_status === 0 || adminUserInfo.authentication_status === 1 || adminUserInfo.authentication_status === 2 || adminUserInfo.authentication_status === 3) { + Taro.showModal({ + title: '提示', + content: '你还未认证,认证后解锁更多功能', + cancelText: '稍后认证', + confirmText: '去认证', + success: function (res) { + if (res.confirm) { + Taro.navigateTo({ url: '/pages/certification/index' }) + } else if (res.cancel) { + console.log('用户点击取消') + } + } + }) + } else { + setShowShopCart(!showShopCart) + } + + } + + return ( - setShowShopCart(!showShopCart)}> + checkShow()}> - + 我的收藏 goLink('/pages/searchList/search')}> - + - getRefresherRefresh()}> - - + getRefresherRefresh()}> + + - setShowShopCart(false)}/> + setShowShopCart(false)} /> ) diff --git a/src/pages/user/index.module.scss b/src/pages/user/index.module.scss index c225f98..bb82b69 100644 --- a/src/pages/user/index.module.scss +++ b/src/pages/user/index.module.scss @@ -1,73 +1,94 @@ -.main{ +.main { background-color: #F8F8F8; min-height: 100vh; display: flex; flex-direction: column; position: relative; - .header{ + + .header { background: #68b4ff; background-size: cover; height: 560px; position: relative; - .card-main{ + + .card-main { margin-top: 10px; } } - .auth-suspension{ + + .auth-suspension { position: absolute; - z-index: 1;inset: 0; + z-index: 1; + inset: 0; } - .header-card{ - position: absolute;left: 50%;bottom: -18%; + + .header-card { + position: absolute; + left: 50%; + bottom: -18%; transform: translateX(-50%); } - .crad{ - width: 702px; - background: rgba(255,255,255,0.95); - border-radius: 20px; - padding: 30px; - box-sizing: border-box; - box-shadow: 0px 6px 12px 0px rgba(0,0,0,0.05); + + .crad { + width: 702px; + background: rgba(255, 255, 255, 0.95); + border-radius: 20px; + padding: 30px; + box-sizing: border-box; + box-shadow: 0px 6px 12px 0px rgba(0, 0, 0, 0.05); } - .card-info{ - display: flex;justify-content: space-between; - position: absolute;top: -15%;left: 0;right: 0; - width: 702px; - padding: 0 30px; - box-sizing: border-box; + + .card-info { + display: flex; + justify-content: space-between; + position: absolute; + top: -15%; + left: 0; + right: 0; + width: 702px; + padding: 0 30px; + box-sizing: border-box; } - .arcd-info-left{ - display: flex;align-items: flex-end; + + .arcd-info-left { + display: flex; + align-items: flex-end; } - .arcd-info-left-portrait{ - width: 170px; - height: 170px; - background: rgba(0,0,0,0.00); - border: 4px solid #ffffff; - border-radius: 50%; - overflow: hidden; + + .arcd-info-left-portrait { + width: 170px; + height: 170px; + background: rgba(0, 0, 0, 0.00); + border: 4px solid #ffffff; + border-radius: 50%; + overflow: hidden; } - .arcd-info-left-portrait image{ - width: 100%; - height: 100%; - object-fit: cover; + + .arcd-info-left-portrait image { + width: 100%; + height: 100%; + object-fit: cover; } - .arcd-info-left-desc{ - margin-left: 24px; + + .arcd-info-left-desc { + margin-left: 24px; } - .arcd-info-left-nickname{ - font-size: 44px; - font-weight: 700; - color: #000000; - display: flex; - align-items: center; + + .arcd-info-left-nickname { + font-size: 44px; + font-weight: 700; + color: #000000; + display: flex; + align-items: center; } - .arcd-info-left-phone{ + + .arcd-info-left-phone { font-size: 24px; font-weight: 400; color: #707070; } - .arcd-info-left-phone button{ + + .arcd-info-left-phone button { padding: 0 10px; height: 42px; background: #ffffff; @@ -76,39 +97,50 @@ font-size: 22px; font-weight: 400; color: #007aff; - display: flex;align-items: center;justify-content: center; + display: flex; + align-items: center; + justify-content: center; } - .card-info-right{ - font-size: 26px; - display: flex;align-items: flex-end; + + .card-info-right { + font-size: 26px; + display: flex; + align-items: flex-end; } - .setup-icon{ + + .setup-icon { position: relative; padding-bottom: 10px; } - .icon-wrapper{ + + .icon-wrapper { font-size: 60px; } - .icon-point{ + + .icon-point { width: 8px; height: 8px; border-radius: 50%; background: #ff0000; position: absolute; - right: 0;top: 0; + right: 0; + top: 0; } - .card-main{ + .card-main { margin: 20px auto 0; } - .card-main-title{ - display: flex;justify-content: space-between; - align-items: center; - border-bottom: 2px solid #dddddd; - padding: 0 5px 15px; - box-sizing: border-box; + + .card-main-title { + display: flex; + justify-content: space-between; + align-items: center; + border-bottom: 2px solid #dddddd; + padding: 0 5px 15px; + box-sizing: border-box; } - .card-main-title text{ + + .card-main-title text { font-size: 22px; font-weight: 400; color: #ababab; @@ -116,23 +148,27 @@ text-align: right; width: 150px; } - .card-main-title-content{ - display: grid; - grid-template-columns: repeat(5,1fr); + + .card-main-title-content { + display: grid; + grid-template-columns: repeat(5, 1fr); } - .card-main-title-content-item{ - font-size: 24px; - font-weight: 400; - color: #3c3c3c; - text-align: center; - margin-top: 30px; - position: relative; + + .card-main-title-content-item { + font-size: 24px; + font-weight: 400; + color: #3c3c3c; + text-align: center; + margin-top: 30px; + position: relative; } - .card-main-title-content-item Text{ + + .card-main-title-content-item Text { font-size: 56px; color: #3C3C3C; } - .card-main-title-content-item-badge{ + + .card-main-title-content-item-badge { padding: 0 10px; height: 32px; background: #007aff; @@ -143,106 +179,140 @@ font-size: 18px; font-weight: 700; color: #ffffff; - display: flex;align-items: center;justify-content: center; - position: absolute;top: -10px;right: 0; + display: flex; + align-items: center; + justify-content: center; + position: absolute; + top: -10px; + right: 0; } - .assets-title{ + .assets-title { font-size: 28px; font-weight: 700; color: #3c3c3c; margin-bottom: 20px; } - .assets-content{ + + .assets-content { display: grid; - grid-template-columns: repeat(3,1fr); + grid-template-columns: repeat(3, 1fr); } - .assets-content>view,.assets-content>navigator{ + + .assets-content>view, + .assets-content>navigator { text-align: center; } - .assets-content-item-top{ + + .assets-content-item-top { color: #007aff; font-weight: 400; } - .assets-content-item-top-before{ + + .assets-content-item-top-before { font-size: 20px; } - .assets-content-item-top-content{ + + .assets-content-item-top-content { font-size: 36px; } - .assets-content-item-top-after{ + + .assets-content-item-top-after { font-size: 20px; } - .assets-content-item-tips{ + + .assets-content-item-tips { font-size: 24px; font-weight: 400; color: #707070; } - .main-card{ + .main-card { margin: 131px auto 0; } - .card-feature{ + + .card-feature { margin-bottom: 50px; } - .card-main-list-content-item{ - display: flex;align-items: center; + + .card-main-list-content-item { + display: flex; + align-items: center; justify-content: space-between; height: 90px; } - .card-main-list-content-item-left{ + + .card-main-list-content-item-left { font-size: 26px; font-weight: 400; text-align: left; color: #707070; - display: flex;align-items: center; + display: flex; + align-items: center; } - .card-main-list-content-item-left text{ + + .card-main-list-content-item-left text { margin-right: 35px; font-size: 56px; color: #707070; } - .card-main-list-content-item-right text{ + + .card-main-list-content-item-right text { font-size: 30px; } - .auth{ + .auth { margin-top: 115px; } - .auth-top{ - display: flex;align-items: center;justify-content: space-between; + + .auth-top { + display: flex; + align-items: center; + justify-content: space-between; } - .auth-status{ + + .auth-status { padding: 0 10px; height: 30px; background: #dddddd; border-radius: 10px 4px 0px 0px; - display: flex;align-items: center;justify-content: center; + display: flex; + align-items: center; + justify-content: center; font-size: 18px; font-weight: 400; color: #707070; } - .auth-status,.auth-status-ongoing{ + + .auth-status, + .auth-status-ongoing { color: #EE7500; background-color: #FFE6CE; } - .auth-status,.auth-status-adopt{ + + .auth-status, + .auth-status-adopt { color: #007AFF; background-color: #CDE5FF; } - .auth-tips{ + + .auth-tips { font-size: 18px; font-weight: 400; color: #007aff; text-align: right; } - .auth-tips,.auth-tips-adopt{ + + .auth-tips, + .auth-tips-adopt { color: #ABABAB; } - .auth-tips text{ + + .auth-tips text { font-size: 17px; } - .auth-company{ + + .auth-company { height: 70px; width: 100%; background: #f6f6f6; @@ -251,35 +321,46 @@ font-size: 26px; font-weight: 700; color: #707070; - display: flex;align-items: center;justify-content: center; + display: flex; + align-items: center; + justify-content: center; } - .auth-company,.auth-company-adopt{ + + .auth-company, + .auth-company-adopt { background: #ecf5ff; border: 2px solid #cde5ff; } - .tips-modal{ - background: rgba(0,0,0,0.6); - position: fixed;inset: 0; - display: flex;justify-content: center;align-items: center; + .tips-modal { + background: rgba(0, 0, 0, 0.6); + position: fixed; + inset: 0; + display: flex; + justify-content: center; + align-items: center; z-index: 2; } - .tips-modal-content{ + + .tips-modal-content { width: 598px; background: #ffffff; border-radius: 10px; animation: enlargeK 0.2s linear; overflow: hidden; } + @keyframes enlargeK { - 0%{ + 0% { transform: scale(0); } - 100%{ + + 100% { transform: scale(1); } } - .tips-modal-title{ + + .tips-modal-title { font-size: 32px; font-weight: 700; text-align: center; @@ -287,53 +368,166 @@ margin-bottom: 58px; padding-top: 48px; } - .tips-modal-letter{ + + .tips-modal-letter { font-size: 26px; font-weight: 400; color: #707070; padding: 0 30px; line-height: 50px; } - .tips-modal-letter-text{ + + .tips-modal-letter-text { text-indent: 60px; } - .tips-modal-letter-beginn{ + + .tips-modal-letter-beginn { font-size: 28px; font-weight: 400; color: #000000; margin-bottom: 25px; } - .tips-modal-letter-end{ + + .tips-modal-letter-end { font-size: 26px; font-weight: 400; text-align: right; margin-top: 61px; } - .tips-modal-button{ + + .tips-modal-button { display: flex; border-top: 1px solid #DDDDDD; margin-top: 45px; } - .tips-modal-button button, .tips-modal-button view{ - display: flex;align-items: center;justify-content: center; + + .tips-modal-button button, + .tips-modal-button view { + display: flex; + align-items: center; + justify-content: center; width: 50%; height: 90px; background-color: white; } - .tips-modal-button button{ + + .tips-modal-button button { font-size: 26px; font-weight: 400; color: #707070; border-radius: 0; border-right: 1px solid #DDDDDD; } - .tips-modal-button button::after{ + + .tips-modal-button button::after { border: 0; border-radius: 0; } - .tips-modal-button view{ + + .tips-modal-button view { font-size: 26px; font-weight: 400; color: #007aff; } + + .auth-box { + width: 614px; + height: 70px; + background: #f6f6f6; + border-radius: 10px; + display: flex; + align-items: center; + justify-content: space-between; + padding-left: 18px; + padding-right: 16px; + + .auth-left-box { + display: flex; + align-items: center; + + .auth-tag { + width: 86px; + height: 34px; + background: #dddddd; + border-radius: 10px; + font-size: 22px; + font-family: Microsoft YaHei, Microsoft YaHei-Regular; + font-weight: 400; + text-align: center; + color: #707070; + text-align: center; + line-height: 34px; + margin-right: 28px; + } + + .auth-tagone { + width: 86px; + height: 34px; + background: #ffe6ce; + border-radius: 10px; + font-size: 22px; + font-family: Microsoft YaHei, Microsoft YaHei-Regular; + font-weight: 400; + text-align: center; + color: #707070; + text-align: center; + line-height: 34px; + margin-right: 28px; + } + + .auth-tagtwo { + display: flex; + align-items: center; + overflow: hidden; + padding-left: 10px; + width: 100px; + height: 32px; + background: #cde5ff; + border-radius: 10px; + + .iconFont-color { + display: flex; + align-items: center; + font-size: 30px; + margin-right: 3px; + color: #007aff; + } + + .auth-font { + font-size: 20px; + font-family: Microsoft YaHei, Microsoft YaHei-Regular; + font-weight: 400; + color: #007aff; + } + } + + .tagthree { + display: flex; + align-items: center; + overflow: hidden; + padding-left: 10px; + width: 100px; + height: 32px; + background: rgba(255, 0, 0, 0.10); + border-radius: 10px; + color: #ff0000; + } + + .auth-cont { + margin-left: 16px; + font-size: 26px; + font-family: Microsoft YaHei, Microsoft YaHei-Bold; + font-weight: 700; + color: #ababab; + } + + .auth-contone { + margin-left: 16px; + font-size: 26px; + font-family: Microsoft YaHei, Microsoft YaHei-Bold; + font-weight: 700; + color: #3c3c3c; + } + } + } } \ No newline at end of file diff --git a/src/pages/user/index.tsx b/src/pages/user/index.tsx index eadbc77..3bf1caa 100644 --- a/src/pages/user/index.tsx +++ b/src/pages/user/index.tsx @@ -5,77 +5,87 @@ import classnames from "classnames"; import { useSelector } from "@/reducers/hooks"; import { alert, goLink } from "@/common/common"; import useLogin from '@/use/useLogin' -import {BASE_URL} from '@/common/constant' - +import { BASE_URL } from '@/common/constant' +import Taro from "@tarojs/taro"; +import { userassets } from "@/api/mine" +import { formatPriceDiv } from "@/common/fotmat" export default () => { // 用户信息 const { getSelfUserInfo } = useLogin(); - const {adminUserInfo} = useSelector(state => state.userInfo); - useEffect(()=>{ - getSelfUserInfo().then().catch(()=>{ + const { adminUserInfo } = useSelector(state => state.userInfo); + useEffect(() => { + getSelfUserInfo().then().catch(() => { alert.none("授权失败,请授权后再使用"); }); - },[]); - const handleAuth = async ()=>{ - getSelfUserInfo().then().catch(()=>{ + }, []); + const handleAuth = async () => { + getSelfUserInfo().then().catch(() => { alert.none("授权失败,请授权后再使用"); }); } - + const { fetchData, state } = userassets() + useEffect(() => { + fetchData(); + }, []) return (
- +
- {(adminUserInfo as any)?.authentication_status==1&&} + {/* {(adminUserInfo as any)?.authentication_status==1&&} */} {/* 测试暂时添加 */} - {BASE_URL} - {!adminUserInfo.is_authorize_name&&} + {BASE_URL} + {!adminUserInfo.is_authorize_name && } ) } // 提示弹窗 -const Modal = memo((props:any)=>{ - const {data} = props; - const [modalShow, setModalShow]=useState(true); - const handleouter = ()=>{ +const Modal = memo((props: any) => { + const { data } = props; + const [modalShow, setModalShow] = useState(true); + const handleouter = () => { } - return( + return ( <> - {modalShow&& - - e.stopPropagation()}> - 首次登录提醒 - - To: 万丰园纺织科技 - 尊敬的老朋友,欢迎你使用小程序商城;由于您是我们长期合作的伙伴,你的组织已自动为你生成,关联后可查看历史订单哟。 - 信息错误请联系客服 + {modalShow && + + e.stopPropagation()}> + 首次登录提醒 + + To: 万丰园纺织科技 + 尊敬的老朋友,欢迎你使用小程序商城;由于您是我们长期合作的伙伴,你的组织已自动为你生成,关联后可查看历史订单哟。 + 信息错误请联系客服 + + + + setModalShow(false)}>我知道 + + - - - setModalShow(false)}>我知道 - - - - } + } ) }) // 头部 | 订单 -const Header = memo((props:any) => { - const {data} = props; +const Header = memo((props: any) => { + const { data } = props; let menu = [{ text: "待配布", icon: "icon-daipeibu", url: "/pages/orderList/index" }, { text: "待付款", icon: "icon-daifukuan", url: "/pages/orderList/index" }, - { text: "待发货", icon: "icon-daifahuo", url: "/pages/orderList/index" }, { text: "已发货", icon: "icon-yifahuo", url: "/pages/orderList/index" }, - { text: "退款/售后", icon: "icon-a-tuikuanshouhou", url: "/pages/orderList/index" }]; + { text: "待发货", icon: "icon-daifahuo", url: "/pages/orderList/index" }, { text: "已发货", icon: "icon-yifahuo", url: "/pages/orderList/index" }, + { text: "退款/售后", icon: "icon-a-tuikuanshouhou", url: "/pages/orderList/index" }]; const { getPhoneNumber } = useLogin(); - const mGetPhoneNumber = (ev)=>{ - if(ev.detail?.code){ + const mGetPhoneNumber = (ev) => { + if (ev.detail?.code) { getPhoneNumber(ev.detail.code); - }else{ + } else { alert.none("绑定失败!"); } } + const navTo = () => { + Taro.navigateTo({ + url: '/pages/certification/index' + }) + } return ( @@ -90,7 +100,7 @@ const Header = memo((props:any) => { {data?.user_name} - {data?.phone?data?.phone?.replace(data?.phone?.substring(3,7), "****"):} + {data?.phone ? data?.phone?.replace(data?.phone?.substring(3, 7), "****") : } @@ -106,7 +116,62 @@ const Header = memo((props:any) => { - + {(data?.authentication_status == 0 || data?.authentication_status == 1) && + navTo()}> + + + 未认证 + + + 暂未加入或注册组织 + + + + + } + {(data?.authentication_status == 3) && + navTo()}> + + + 认证失败 + + + 暂未加入或注册组织 + + + + + } + {data?.authentication_status == 2 && + navTo()}> + + + 认证中 + + + 暂未加入或注册组织 + + + + + } + {data?.authentication_status == 4 && + navTo()}> + + + + + + 已认证 + + + 暂未加入或注册组织 + + + + + } + {/* 1 {data?.authentication_status==1&&"未认证"} @@ -118,13 +183,13 @@ const Header = memo((props:any) => { {data?.authentication_status==2&&1-3个工作日,审核完成 } {data?.authentication_status==3&&重新认证 } {data?.authentication_status==4&&认证通过,可以下单啦 } - - + */} + {/* {data?.authentication_status==1&&"暂未加入或注册组织"} {data?.authentication_status==2&&data?.company_name} {data?.authentication_status==3&&data?.company_name} {data?.authentication_status==4&&data?.company_name} - + */} @@ -138,7 +203,7 @@ const Header = memo((props:any) => { {item.text} - {index==2?"99+":10} + {index == 2 ? "99+" : 10} ) }) @@ -149,9 +214,9 @@ const Header = memo((props:any) => { ) }) - // 我的资产 -const Assets = () => { +const Assets = (props: any) => { + console.log(props, 'propsprops') return ( 我的资产 @@ -159,14 +224,14 @@ const Assets = () => { ¥ - 0 - .20 + {formatPriceDiv(props.data.data.wallet_money || 0)} + {/* {props.wallet_money || 0} */} 预存款 - 4 + {props.data.data.coupon_count || 0} 优惠券 @@ -174,8 +239,8 @@ const Assets = () => { ¥ - 99999 - .-00 + {formatPriceDiv(props.data.data.credit_line || 0)} + {/* .-00 */} 授信额度 @@ -186,9 +251,9 @@ const Assets = () => { // 功能 const Main = memo(() => { - let menu = [{ text: "地址管理", icon: "icon-shoucang",url: "/pages/addressManager/index" },{ text: "码单管理", icon: "icon-shoucang",url: "/pages/weightList/index" }, + let menu = [{ text: "地址管理", icon: "icon-shoucang", url: "/pages/addressManager/index" }, { text: "码单管理", icon: "icon-shoucang", url: "/pages/weightList/index" }, { text: "我的收藏", icon: "icon-shoucang" }, { text: "颜色对比", icon: "icon-yanseduibi" }, - { text: "分享推广", icon: "icon-fenxiang" }, { text: "团队邀请", icon: "icon-yaoqingtuandui" }] + { text: "分享推广", icon: "icon-fenxiang" }, { text: "团队邀请", icon: "icon-yaoqingtuandui" }] return ( diff --git a/src/pages/userEdit/index.tsx b/src/pages/userEdit/index.tsx index 4ebb0aa..f4bb132 100644 --- a/src/pages/userEdit/index.tsx +++ b/src/pages/userEdit/index.tsx @@ -13,105 +13,105 @@ import { useSelector } from "@/reducers/hooks"; import useUploadCDNImg from "@/use/useUploadImage"; import { IMG_CND_Prefix } from "@/common/constant"; -export default ()=>{ +export default () => { const { getPhoneNumber, getAdminUserInfo } = useLogin(); - const {adminUserInfo} = useSelector(state => state.userInfo); - // 用户信息 - useEffect(()=>{ + const { adminUserInfo } = useSelector(state => state.userInfo); + // 用户信息 + useEffect(() => { setFormData({ ...formData, ...adminUserInfo as any, }); }, [adminUserInfo]); - useEffect(()=>{ + useEffect(() => { setFormData({ ...adminUserInfo as any, company_type_index: 0 }); getCompanyTypeData(); - },[]) + }, []) // 表单数据 const [formData, setFormData] = useState({ user_name: "麦兜" }); // 昵称修改保存 - const { fetchData: realNameUpdateFetch } = realNameUpdateApi(); + const { fetchData: realNameUpdateFetch } = realNameUpdateApi(); const rules = { text: [{ message: "请输入" }] } - const {fetchData: saveFetch} = companyUpdateApi(); - const {fetchData: getCompanyFetch} = companyDetailApi(); - const handleTextareaSave = async (text, type)=>{ - retrieval({text},rules).then(async ()=>{ + const { fetchData: saveFetch } = companyUpdateApi(); + const { fetchData: getCompanyFetch } = companyDetailApi(); + const handleTextareaSave = async (text, type) => { + retrieval({ text }, rules).then(async () => { let result; - if(type=="Ickname"){ - result = await realNameUpdateFetch({real_name: text}); - }else{ + if (type == "Ickname") { + result = await realNameUpdateFetch({ real_name: text }); + } else { const params = await getCompanyFetch(); result = await saveFetch({ ...params.data, company_name: text }); } - if(result.success){ + if (result.success) { getAdminUserInfo(); (ModifyIcknameEl.current as any).setModalShow(false); (ModifyCompanyNameEl.current as any).setModalShow(false) alert.success("保存成功"); - }else{ + } else { alert.none(result.msg); } - }).catch(message=>{ + }).catch(message => { alert.none(message); }) } // Taro.eventCenter.on('message:detail', (message) => console.log(message)) // 面面跳转 - const onNavigate = (url:string)=>{ + const onNavigate = (url: string) => { goLink(url); } // 肖像编辑 const { fetchData: portraitUpdateFetch } = portraitUpdateApi(); - const {getWxPhoto} = useUploadCDNImg(); - const handleSelectRortrait = ()=>{ + const { getWxPhoto } = useUploadCDNImg(); + const handleSelectRortrait = () => { Taro.showModal({ title: "提示", content: "是否确定更改头像?", showCancel: true, - async success(ev){ - if(ev.confirm){ + async success(ev) { + if (ev.confirm) { let result = await getWxPhoto('mall'); const portraitUpdateResult = await portraitUpdateFetch({ - avatar_url: IMG_CND_Prefix+(result as any).url + avatar_url: IMG_CND_Prefix + (result as any).url }); - if(portraitUpdateResult.success){ + if (portraitUpdateResult.success) { getAdminUserInfo(); alert.success("保存成功"); - }else{ + } else { alert.none(portraitUpdateResult.msg); } } } }) } - const mGetPhoneNumber = (ev)=>{ - if(ev.detail?.code){ - getPhoneNumber(ev.detail.code); - }else{ - alert.none("绑定失败!"); - } - } + const mGetPhoneNumber = (ev) => { + if (ev.detail?.code) { + getPhoneNumber(ev.detail.code); + } else { + alert.none("绑定失败!"); + } + } const ModifyIcknameEl = useRef(null); const ModifyCompanyNameEl = useRef(null); // 获取企业类型 const { fetchData: companyTypeFetch, state: companyTypeData } = companyTypeApi(); - const getCompanyTypeData = async ()=>{ + const getCompanyTypeData = async () => { const reuslt = await companyTypeFetch(); - if(reuslt.success){ - reuslt.data?.list?.every((item,index)=>{ - if(item.id==(adminUserInfo as any).purchaser_type){ + if (reuslt.success) { + reuslt.data?.list?.every((item, index) => { + if (item.id == (adminUserInfo as any).purchaser_type) { setFormData({ ...adminUserInfo as any, company_type_index: index @@ -123,19 +123,19 @@ export default ()=>{ } } // 修改企业类型 - const handleCompanyType = async (ev)=>{ - const {value} = ev.detail; - const item = companyTypeData.data.list&&companyTypeData.data.list[value]; - if(item){ + const handleCompanyType = async (ev) => { + const { value } = ev.detail; + const item = companyTypeData.data.list && companyTypeData.data.list[value]; + if (item) { const params = await getCompanyFetch(); const result = await saveFetch({ ...params.data, purchaser_type: item.id }); - if(result.success){ + if (result.success) { getAdminUserInfo(); alert.success("保存成功") - }else{ + } else { alert.none(result.msg); } } @@ -144,46 +144,46 @@ export default ()=>{ return ( - + 点击编辑头像 - 个人资料 - (ModifyIcknameEl.current as any).setModalShow(true)} data={(formData as any)?.user_name} label="昵称" placeholder="请输入" icon=""/> + 个人资料 + (ModifyIcknameEl.current as any).setModalShow(true)} data={(formData as any)?.user_name} label="昵称" placeholder="请输入" icon="" /> - {((formData as any)?.phone)? + {((formData as any)?.phone) ? {(formData as any)?.phone} 已绑定 - : - + : + } - 组织资料 - (ModifyCompanyNameEl.current as any).setModalShow(true)} data={(formData as any)?.company_name} label="名称" placeholder="待绑定" icon=""/> + 组织资料 + (ModifyCompanyNameEl.current as any).setModalShow(true)} data={(formData as any)?.company_name} label="名称" placeholder="待绑定" icon="" /> - {(companyTypeData.data as any).list&&(companyTypeData.data as any).list[(formData as any)?.company_type_index].name} + {(companyTypeData.data as any).list && (companyTypeData.data as any).list[(formData as any)?.company_type_index].name} - onNavigate("/pages/certification/index")} label="我的认证" placeholder="待绑定" icon=""> - - {(formData as any)?.authentication_status==4?"已认证":"未认证"} + onNavigate("/pages/certification/index")} label="我的认证" placeholder="待绑定" icon=""> + + {(formData as any)?.authentication_status == 4 ? "已认证" : "未认证"} - + - + {/* */} - handleTextareaSave(value, "Ickname")}/> - handleTextareaSave(value, "companyName")}/> + handleTextareaSave(value, "Ickname")} /> + handleTextareaSave(value, "companyName")} /> ) } // 列表 -const UserEditList = memo((props:any)=>{ +const UserEditList = memo((props: any) => { return ( @@ -192,12 +192,15 @@ const UserEditList = memo((props:any)=>{ { - props.children?props.children: - props.data?props.data: - {props.placeholder} + props.children ? props.children : + props.data ? props.data : + {props.placeholder} } - + { + !props.useIcon && + + } ) diff --git a/src/reducers/userInfo.ts b/src/reducers/userInfo.ts index 928c4fa..b7215c1 100644 --- a/src/reducers/userInfo.ts +++ b/src/reducers/userInfo.ts @@ -40,6 +40,7 @@ export type UserAdminParam = { is_authorize_name?: false|true, is_authorize_phone?: false|true, phone?:string, + authentication_status?:number } export type SortCodeParam = {