From e1f7e085d689bccfa40a5ff2b3307ddaa7e43865 Mon Sep 17 00:00:00 2001 From: li tong bao <2903733959@qq.com> Date: Tue, 31 May 2022 16:14:16 +0800 Subject: [PATCH] =?UTF-8?q?--=E6=8E=88=E4=BF=A1=E9=A1=B5=E9=9D=A2=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 +- src/api/creditLine.ts | 23 +++++ src/app.config.ts | 12 +++ src/common/constant.js | 5 +- src/pages/creditLine/index.config.ts | 3 + src/pages/creditLine/index.scss | 92 +++++++++++++++++ src/pages/creditLine/index.tsx | 147 +++++++++++++++++++++++++++ src/pages/creditUsed/index.config.ts | 3 + src/pages/creditUsed/index.scss | 41 ++++++++ src/pages/creditUsed/index.tsx | 76 ++++++++++++++ src/styles/iconfont.scss | 40 ++++++++ src/styles/iconfont.ttf | Bin 9236 -> 12196 bytes yarn.lock | 5 + 13 files changed, 447 insertions(+), 3 deletions(-) create mode 100644 src/api/creditLine.ts create mode 100644 src/pages/creditLine/index.config.ts create mode 100644 src/pages/creditLine/index.scss create mode 100644 src/pages/creditLine/index.tsx create mode 100644 src/pages/creditUsed/index.config.ts create mode 100644 src/pages/creditUsed/index.scss create mode 100644 src/pages/creditUsed/index.tsx diff --git a/package.json b/package.json index 215c2f7..e401964 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,8 @@ "react-redux": "^8.0.1", "redux": "^4.2.0", "redux-logger": "^3.0.6", - "redux-thunk": "^2.4.1" + "redux-thunk": "^2.4.1", + "tarojs": "^2.1.1" }, "devDependencies": { "@babel/core": "^7.8.0", diff --git a/src/api/creditLine.ts b/src/api/creditLine.ts new file mode 100644 index 0000000..7c69511 --- /dev/null +++ b/src/api/creditLine.ts @@ -0,0 +1,23 @@ +import { useRequest } from "@/use/useHttp" + +/** + * 额度获取 + * @returns + */ + export const creditInfoApi = () => { + return useRequest({ + url: `/v1/mall/credit`, + method: "get", + }) +} + +/** + * 额度已用获取 + * @returns + */ + export const creditListApi = () => { + return useRequest({ + url: `/v1/mall/credit/list`, + method: "get", + }) +} diff --git a/src/app.config.ts b/src/app.config.ts index c9abe95..898aa9d 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -97,6 +97,18 @@ export default { pages: [ "index" ] + }, + { + root: "pages/creditLine", + pages: [ + "index" + ] + }, + { + root: "pages/creditUsed", + pages: [ + "index" + ] } ] } diff --git a/src/common/constant.js b/src/common/constant.js index b856a54..f82b8c9 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -5,11 +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: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.4:40001/lymarket` // 王霞 -// export const BASE_URL = `http://192.168.1.224:50002/lymarket` // 添 +export const BASE_URL = `http://192.168.1.224:50001/lymarket` // 添 +// export const BASE_URL = `http://192.168.1.15:50001/lymarket` // 添 // CDN // 生成密钥 diff --git a/src/pages/creditLine/index.config.ts b/src/pages/creditLine/index.config.ts new file mode 100644 index 0000000..432582a --- /dev/null +++ b/src/pages/creditLine/index.config.ts @@ -0,0 +1,3 @@ +export default { + navigationBarTitleText: '授信额度' +} diff --git a/src/pages/creditLine/index.scss b/src/pages/creditLine/index.scss new file mode 100644 index 0000000..fbbcf00 --- /dev/null +++ b/src/pages/creditLine/index.scss @@ -0,0 +1,92 @@ +.credit-line{ + height: 100vh; + background-color: #f3f3f3; + canvas{ + width: 238px; + height: 238px; + } + + .credit-line-tips{ + width: 100%; + height: 66px; + background: #ecf5ff; + border: 2px solid #cde5ff; + padding: 0 30px; + display: flex;align-items: center; + font-size: 24px; + font-weight: 400; + color: #007aff; + } + .credit-line-tips text{ + margin-right: 10px; + font-size: 30px; + } + .credit-line-card{ + width: 702px; + background: #ffffff; + border-radius: 20px; + margin: 20px auto 0; + padding: 0 30px; + box-sizing: border-box; + } + .credit-line-card-top{ + display: flex;align-items: flex-end; + padding: 30px 20px; + border-bottom: 1px solid #f6f6f6; + } + .credit-line-card-top-info{ + text-align: center; + flex: 1; + } + .credit-line-card-top-info-title{ + font-size: 24px; + font-weight: 700; + color: #000000; + margin-bottom: 16px; + } + .credit-line-card-top-info-price{ + font-size: 44px; + font-weight: 700; + color: #007aff; + margin-bottom: 48px; + } + .credit-line-card-top-info-price text{ + font-size: 20px; + } + .credit-line-card-top-info-date{ + font-size: 22px; + font-weight: 400; + color: #ababab; + } + .credit-line-card-bottom{ + padding: 30px 0; + display: grid; + grid-template-columns: repeat(2, 1fr); + text-align: center; + } + .credit-line-card-bottom-item-title{ + font-size: 24px; + font-weight: 700; + color: #000000; + display: flex; + align-items: center;justify-content: center; + margin-bottom: 15px; + line-height: 38px; + } + .credit-line-card-bottom-item-title text{ + font-size: 40px; + margin-right: 10px; + color: #007AFF; + } + .credit-line-card-bottom-item:nth-of-type(2) .credit-line-card-bottom-item-title text{ + font-size: 28px; + } + .credit-line-card-bottom-item-price{ + font-size: 40px; + font-weight: 400; + color: #ababab; + } + .credit-line-card-bottom-item-price text{ + font-size: 20px; + } +} \ No newline at end of file diff --git a/src/pages/creditLine/index.tsx b/src/pages/creditLine/index.tsx new file mode 100644 index 0000000..e41e74b --- /dev/null +++ b/src/pages/creditLine/index.tsx @@ -0,0 +1,147 @@ + +import AddressList from "@/components/AddressList" +import { Button, Canvas, ScrollView, Text, View } from "@tarojs/components" +import Taro, { useReady } from "@tarojs/taro" +import { useEffect } from "react" +import {creditInfoApi} from "@/api/creditLine" +import "./index.scss" +import { useSelector } from "@/reducers/hooks"; + +export default ()=>{ + + const {userInfo} = useSelector(state => state.userInfo); + useEffect(()=>{ + console.log(userInfo,"=="); + + // getData() + }, []) + const {fetchData, state} = creditInfoApi(); + // 获取数据 + const getData = async ()=>{ + const result = await fetchData(); + console.log(state); + + } + + + return ( + + + 暂不支持线上申请授权,请联系平台客服。 + + + + + + 已用额度 + ¥999,999.20 + 有效期: 2022-03-09至2022-05-13 + + + + + + + 总额度 + + ¥999,999.20 + + + + + 可用额度 + + ¥999,999.20 + + + + + ) +} + +const Progress = ()=>{ + const getCanvas = ()=>{ + const percentage = 100; + const query = Taro.createSelectorQuery(); + query.select("#myCanvas").fields({ node: true, size: true }).exec((res) => { + const canvas = res[0]?.node; + if(canvas){ + const ctx = canvas.getContext('2d'); + const { windowHeight, windowWidth } = Taro.getSystemInfoSync(); + const dpr = 750 / windowWidth; + canvas.width = res[0].width * dpr; + canvas.height = res[0].height * dpr; + const r = canvas.width / 2; + ctx.translate(r,r); + + // 白色大圆 + ctx.beginPath(); + ctx.fillStyle = "white"; + ctx.shadowBlur = 20; + ctx.shadowColor = "#cde5ff"; + ctx.arc(0,0,100,0,2*Math.PI, false); + ctx.fill(); + + // 刻度 + const my_minute = Math.PI*2/60; + const my_second = Math.PI*2/60; + ctx.strokeStyle="#F59F5D"; + ctx.lineWidth=2; + ctx.beginPath(); + for(let i=0;i<15;i++){ + ctx.save(); + ctx.rotate(i*4*my_minute); + ctx.moveTo(r-45,0); + ctx.lineTo(r-40,0); + ctx.stroke(); + ctx.restore(); + } + + // 白色小圆 + ctx.beginPath(); + ctx.fillStyle = "white"; + ctx.shadowBlur = 20; + ctx.shadowColor = "rgba(204,204,204,0.50)"; + ctx.arc(0,0,74,0,2*Math.PI, false); + ctx.fill(); + + // 文字 + ctx.beginPath(); + ctx.restore(); + + ctx.fillStyle = "#007aff"; + ctx.font="42px Cambria, Cambria-Bold"; + ctx.textAlign="center"; + ctx.textBaseline="middle"; + ctx.fillText(percentage+"%", 0,0); + + // 蓝色的圆 + ctx.beginPath(); + ctx.lineWidth = 25; + ctx.lineCap = "round"; + const gad = ctx.createLinearGradient(100,0,0,100); + gad.addColorStop(0, "#047CFF"); + gad.addColorStop(1, "#51A4FF"); + ctx.strokeStyle = gad; + ctx.arc(0,0,104,-Math.PI*0.5,2*Math.PI/100*((percentage<50?percentage:50)-25), false); + ctx.stroke(); + + if(percentage>50){ + ctx.beginPath(); + const gad2 = ctx.createLinearGradient(0,-100,0,0); + gad2.addColorStop(0, "#87C0FF"); + gad2.addColorStop(1, "#57A8FF"); + ctx.strokeStyle = gad2; + ctx.arc(0,0,104,Math.PI*0.5,2*Math.PI/100*(percentage-25), false); + ctx.stroke(); + } + }else{ + getCanvas(); + } + }); + } + useReady(()=>{ + getCanvas(); + }) + return +} \ No newline at end of file diff --git a/src/pages/creditUsed/index.config.ts b/src/pages/creditUsed/index.config.ts new file mode 100644 index 0000000..b58982d --- /dev/null +++ b/src/pages/creditUsed/index.config.ts @@ -0,0 +1,3 @@ +export default { + navigationBarTitleText: '已用额度' +} diff --git a/src/pages/creditUsed/index.scss b/src/pages/creditUsed/index.scss new file mode 100644 index 0000000..e208050 --- /dev/null +++ b/src/pages/creditUsed/index.scss @@ -0,0 +1,41 @@ +.credit-used{ + height: 100vh; + background-color: #f3f3f3; + .credit-used-list{ + background-color: white; + padding: 30px 25px; + border-bottom: 1px solid #f6f6f6; + } + .credit-used-list-top{ + display: flex;justify-content: space-between; + margin-bottom: 20px; + } + .credit-used-list-type{ + font-size: 26px; + font-weight: 400; + color: #000000; + } + .credit-used-list-price{ + font-size: 28px; + font-weight: 400; + } + .credit-used-list-bottom{ + display: flex;justify-content: space-between; + } + .credit-used-list-date{ + font-size: 24px; + font-weight: 400; + color: #ababab; + } + .credit-used-list-orderno{ + font-size: 20px; + font-weight: 400; + color: #ababab; + } + .green{ + color: #07C160; + } + .red{ + color: #FF0000; + } +} \ No newline at end of file diff --git a/src/pages/creditUsed/index.tsx b/src/pages/creditUsed/index.tsx new file mode 100644 index 0000000..3798a05 --- /dev/null +++ b/src/pages/creditUsed/index.tsx @@ -0,0 +1,76 @@ + +import AddressList from "@/components/AddressList" +import InfiniteScroll from "@/components/infiniteScroll" +import { Button, Canvas, ScrollView, Text, View } from "@tarojs/components" +import Taro, { useReady } from "@tarojs/taro" +import { useEffect, useState } from "react" +import {creditListApi} from "@/api/creditLine" +import "./index.scss" + +export default ()=>{ + useEffect(()=>{ + getData(); + }, []) + const {fetchData, state} = creditListApi(); + const data = Array.from({length: 10}); + const getData = async ()=>{ + fetchData(); + } + // 刷新 + const [refreshData, setRefreshData] = useState({ + refreshStatus: false, + moreStatus: false + }) + const handleRefresh = async ()=>{ + setRefreshData({ + ...refreshData, + refreshStatus: true + }) + + + setTimeout(()=>{ + setRefreshData({ + ...refreshData, + moreStatus: false + }) + }, 3000) + } + const handleMoreLoad = async ()=>{ + setRefreshData({ + ...refreshData, + moreStatus: true + }) + + setTimeout(()=>{ + setRefreshData({ + ...refreshData, + refreshStatus: false + }) + },3000) + } + + return ( + + + { + data.map((item,index)=>{ + return ( + + + 下单 + -999,999.00 + + + 2022-04-24 16:10:11 + 订单号:LY2278204399678 + + + ) + }) + } + {/* {data.length>0&&} */} + + + + ) +} diff --git a/src/styles/iconfont.scss b/src/styles/iconfont.scss index 92fec06..415e262 100644 --- a/src/styles/iconfont.scss +++ b/src/styles/iconfont.scss @@ -11,6 +11,46 @@ -moz-osx-font-smoothing: grayscale; } +.icon-yucunkuan:before { + content: "\e66c"; +} + +.icon-xianxiahuikuan:before { + content: "\e669"; +} + +.icon-xtianzhangqi:before { + content: "\e66a"; +} + +.icon-saomazhifu:before { + content: "\e66b"; +} + +.icon-fahuo:before { + content: "\e66d"; +} + +.icon-zhuyi:before { + content: "\e668"; +} + +.icon-zhushi:before { + content: "\e667"; +} + +.icon-zidingyimadan:before { + content: "\e665"; +} + +.icon-a-yuanmadanmadanguanli:before { + content: "\e666"; +} + +.icon-daohang:before { + content: "\e664"; +} + .icon-shanchu:before { content: "\e663"; } diff --git a/src/styles/icon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