Commit e0ce61ef authored by Step_by_step's avatar Step_by_step

fix: 支付模块

parent 1968262b
......@@ -3,3 +3,6 @@ VITE_DEBUG='true'
VITE_HTTP_HEADER={}
VITE_HTTP_BASE_URL='http://192.168.101.1:28080'
VITE_HTTP_NOAUTH_BASE_URL=''
VITE_Alipay='https://test-api-open.chinaums.com/v1/netpay/trade/h5-pay'
VITE_Wechat='https://test-api-open.chinaums.com/v1/netpay/wxpay/h5-pay'
VITE_Unionpay='https://test-api-open.chinaums.com/v1/netpay/uac/order'
......@@ -3,3 +3,6 @@ VITE_DEBUG='false'
VITE_HTTP_HEADER={}
VITE_HTTP_BASE_URL='https://yw.fshsfl.com/api'
VITE_HTTP_NOAUTH_BASE_URL=''
VITE_Alipay='https://api-mop.chinaums.com/v1/netpay/trade/h5-pay'
VITE_Wechat='https://api-mop.chinaums.com/v1/netpay/wxpay/h5-pay'
VITE_Unionpay='https://api-mop.chinaums.com/v1/netpay/uac/order'
\ No newline at end of file
NODE_ENV=production
VITE_DEBUG='true'
VITE_HTTP_HEADER={}
VITE_HTTP_BASE_URL='http://192.168.101.1:8001'
VITE_HTTP_NOAUTH_BASE_URL=''
VITE_Alipay='https://test-api-open.chinaums.com/v1/netpay/trade/h5-pay'
VITE_Wechat='https://test-api-open.chinaums.com/v1/netpay/wxpay/h5-pay'
VITE_Unionpay='https://test-api-open.chinaums.com/v1/netpay/uac/order'
\ No newline at end of file
NODE_ENV='testing'
VITE_DEBUG='true'
VITE_HTTP_HEADER={}
VITE_HTTP_BASE_URL='http://192.168.101.1:8001'
VITE_HTTP_NOAUTH_BASE_URL=''
\ No newline at end of file
......@@ -5,19 +5,20 @@
"dev": "vite ",
"build": "vite build",
"preview": "vite preview",
"build:selfService": "VITE_TARGET=selfService vite build",
"build:intention": "VITE_TARGET=intention vite build",
"build:calculator": "VITE_TARGET=calculator vite build",
"build:about": "VITE_TARGET=about vite build",
"build:complaint": "VITE_TARGET=complaint vite build",
"build:infoChange": "VITE_TARGET=infoChange vite build",
"build:relatedProject": "VITE_TARGET=relatedProject vite build",
"build:repayPlan": "VITE_TARGET=repayPlan vite build"
"build:selfService": "VITE_TARGET=selfService vite build --mode test",
"build:intention": "VITE_TARGET=intention vite build --mode test",
"build:calculator": "VITE_TARGET=calculator vite build --mode test",
"build:about": "VITE_TARGET=about vite build --mode test",
"build:complaint": "VITE_TARGET=complaint vite build --mode test",
"build:infoChange": "VITE_TARGET=infoChange vite build --mode test",
"build:relatedProject": "VITE_TARGET=relatedProject vite build --mode test",
"build:repayPlanCheck": "VITE_TARGET=repayPlanCheck vite build --mode test"
},
"dependencies": {
"@hips/plugin-vue-jssdk": "^1.1.2",
"@vant/area-data": "^1.3.2",
"axios": "^1.2.0",
"crypto-js": "^4.1.1",
"moment": "^2.29.4",
"pinia": "^2.0.23",
"postcss-px-to-viewport": "^1.1.1",
......
......@@ -30,12 +30,21 @@ export default {
};
},
async mounted() {
console.log('此处未报错 app.vue');
const TempAccess = import.meta.env.DEV ? '60243b9f-5f2b-41f8-8007-67984b5ae1cd' : ''
let homePage = { path: "applications", replace: true }
console.log('此处未报错 app.vue2');
if (import.meta.env.PROD) {
// 得保证 每个子应用中首页有 title
let jumRouter = await login(TempAccess);
let jumRouter;
try {
jumRouter = await login(TempAccess);
} catch (error) {
jumRouter = {}
}
if (jumRouter.path) {
// 通过消息传入跳转页面的情况
......@@ -43,7 +52,11 @@ export default {
} else {
// 一般点击进入
let index = this.$router.getRoutes().filter(route => route.meta.title);
homePage.path = index[0];
if (index[0] && index[0].path) {
homePage.path = index[0].path;
} else {
console.info('未找到路由')
}
}
}
......
......@@ -4,19 +4,21 @@ import App from './App.vue'
import router from './router'
import moment from 'moment'
import { Notify, Toast } from 'vant';
import VConsole from 'vconsole'
// import VConsole from 'vconsole'
moment.locale('zh-cn')
// if (import.meta.env.VITE_DEBUG === "true") {
const vConsole = new VConsole();
// const vConsole = new VConsole();
// }
const app = createApp(App)
console.log('此处未报错 main.js');
app.use(createPinia())
app.use(router)
app.use(Notify)
app.use(Toast)
app.use(vConsole)
// app.use(vConsole)
app.mount('#app')
<template>
<div class="container">
<NavBar title="还款计划查询" left-arrow @click-left="goBack" />
<section class="list">
<Search v-model="searchVal" placeholder="请输入项目编号/融资金额" />
<Notice detail="只可对已关联的项目还款" />
<PullRefresh v-model="refreshing" @refresh="onRefresh" class="scroll">
<List :finished="finished" finished-text="没有更多了" @load="loadApproval">
<ListItem v-for="item in listValue" :other_title="item.other_title" :title="item.title" :values="item.values"
@click="jump" />
</List>
</PullRefresh>
</section>
</div>
</template>
<script setup>
import { goBack } from "@/utils/globalFun"
import { NavBar, List, PullRefresh, Search } from "vant";
import Notice from '@/components/Notice.vue'
import ListItem from '@/components/ListItem.vue'
import api from "../api";
import { useRouter } from "vue-router";
const searchVal = $ref('');
const listValue = $ref([
{
title: '202204-DB001-001',
other_title: "2022-07-18",
values: [["剩余应还金额", "状态", "融资金额"], ["¥ 20,000.00", "正常", "¥ 20,000.00"]]
},
{
title: '202204-DB001-001',
other_title: "2022-07-18",
values: [["剩余应还金额", "状态", "融资金额"], ["¥ 20,000.00", "正常", "¥ 20,000.00"]]
},
])
const refreshing = $ref(true);
const finished = $ref(true);
const onRefresh = () => {
// 下拉重置参数,重新加载
};
const loadApproval = () => {
}
const router = useRouter();
const jump = () => {
router.push({ name: 'repayPlan-views-plan' })
}
</script>
<style scoped lang="less">
.list {
box-sizing: border-box;
height: calc(100vh - var(--van-nav-bar-height));
display: flex;
flex-direction: column;
justify-content: space-between;
padding-bottom: 10px;
}
.scroll {
box-sizing: border-box;
height: calc(100vh - 30vw);
overflow-y: auto;
}
</style>
<route>
{
meta: {
title: '还款计划查询'
}
}
</route>
<template>
<div class="container">
<NavBar title="发票明细" left-arrow @click-left="goBack">
<template #right>
<Icon name="down" size="18" color="#2c7bff" />
</template>
</NavBar>
<div class="content">
<VuePdfEmbed ref="pdfRef" :source="pdfSource" :page="page" @rendered="handleDocumentRender"></VuePdfEmbed>
</div>
<div class="foot">
<Pagination v-model="currentPage" :page-count="pageCount" mode="simple" />
</div>
</div>
</template>
<script setup>
import { goBack } from "@/utils/globalFun"
import { NavBar, Toast, Icon, Pagination } from "vant";
import VuePdfEmbed from 'vue-pdf-embed'
import { watchEffect } from 'vue'
const isLoading = $ref(true)
const page = $ref(null)
const pdfRef = $ref('')
const pageCount = $ref(12)
const pdfSource = $ref('https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/web/compressed.tracemonkey-pldi-09.pdf')
watchEffect(() => {
if (isLoading) {
Toast.loading({ message: '加载中...', forbidClick: true, overlay: true, duration: 0 });
} else {
Toast.clear()
}
})
const handleDocumentRender = (args) => {
isLoading = false
pageCount = pdfRef.pageCount
}
const currentPage = $ref(1)
</script>
<style lang="less" scoped>
.content {
height: calc(100% - var(--van-nav-bar-height) - 100px);
overflow-y: auto;
}
.foot {
box-sizing: border-box;
padding: 20px 20px 0;
height: 100px;
width: 100%;
}
.vue-pdf-embed {}
</style>
\ No newline at end of file
<template>
<RepayPlan navTitle="还款计划" :currencyObj="currencyObj">
<template #list>
<div class="repay_list">
<div class="left">
<div class="times-box" v-for="i in 30">
<div class="times">{{ i }}</div>
</div>
</div>
<div class="right">
<div class="item" v-for="i in 30" @click="jump">
<div class="left-item">
<span>租金</span>
<span>2022-06-20</span>
</div>
<div class="center-item">
<p>
<span>应付金额</span>
<span>¥9,000.00</span>
</p>
<p>
<span>待付金额</span>
<span>¥0.00</span>
</p>
</div>
<div class="right-item">
<span>明细</span>
<span class="flag-button overtime">
<Icon style="margin-right: 1px;" name="info-o" />逾期
</span>
</div>
</div>
</div>
</div>
</template>
<template #footer>
</template>
</RepayPlan>
</template>
<script setup>
import RepayPlan from '@/components/RepayPlan.vue'
import { useRouter } from "vue-router";
import { Icon } from 'vant'
const currencyObj = $ref({
financingCurrency: '200,000.00',
headerCurrency: '5,000.00',
fristCurrency: '10,000.00',
times: '12'
})
const router = useRouter();
const jump = () => {
router.push({ name: 'repayPlan-views-pdfPre' })
}
</script>
<style lang="less" scoped>
@lineColr: #dcdddf;
.repay_list {
display: flex;
width: 100%;
height: 98%;
overflow-y: auto;
scrollbar-width: none;
/* firefox */
}
.repay_list::-webkit-scrollbar {
display: none;
/* Chrome Safari */
}
@leftW: 45px;
.left {
flex: 0 1 @leftW;
}
.times-box {
display: flex;
height: 100px;
flex-direction: column;
justify-content: center;
background-image: linear-gradient(@lineColr 0%, @lineColr 16%, transparent 16%, transparent 33%, @lineColr 33%, @lineColr 83%, transparent 83%, transparent 100%);
/* 35%设置虚线点y轴上的长度 */
background-position: 50% 50%;
/* right配置右边框位置的虚线 */
background-size: 1px 20px;
/* 第一个参数设置虚线点x轴上的长度;第二个参数设置虚线点的间距 */
background-repeat: repeat-y;
}
.times-box:nth-child(1) {
margin-top: 25px;
height: 70px;
justify-content: flex-start;
}
.times-box:nth-last-child(1) {
// bottom: 80px;
height: 70px;
justify-content: flex-end;
}
.times {
height: @leftW;
width: @leftW;
display: flex;
justify-content: center;
line-height: @leftW;
color: #fff;
background-color: #019ae5;
border-radius: 5px;
}
.right {
flex: 1 0 auto;
padding-left: 20px;
}
.item {
display: flex;
justify-content: space-around;
box-sizing: border-box;
margin-top: 15px;
margin-bottom: 30px;
width: 98%;
height: 70px;
border: 1px solid #dedede;
background-color: #eef5fd;
border-radius: 5px;
padding: 10px 5px 3px 10px;
font-size: 13px;
&>div {
display: flex;
flex-direction: column;
justify-content: space-around;
}
}
.left-item {
flex: 1 0 30%;
span:nth-child(1) {
font-weight: 600;
}
span:nth-child(2) {
color: gray;
}
}
.center-item {
flex: 1 0 45%;
p {
color: gray;
display: flex;
justify-content: space-between;
span:nth-child(2) {
font-weight: 600;
}
}
&>p:nth-child(1) span:nth-child(2) {
color: #019ae5;
}
}
.right-item {
flex: 1 0 25%;
text-align: center;
span:nth-child(1) {
color: #019ae5;
}
span:nth-child(2) {
color: gray;
}
}
.flag-button {
display: flex;
justify-content: center;
align-items: center;
width: 80%;
margin: 0 auto;
height: 40%;
border-radius: 10px;
font-size: 12px;
}
.overtime {
background-color: #eeeeee;
color: orange !important;
border: 1px solid #e2e3e4;
}
.nopay {
background-color: #bec2c5;
color: white !important;
border: 1px solid #bec2c5;
}
.pay {
background-color: #f0f0f0;
color: gray !important;
border: 1px solid #eaeaea;
}
</style>
\ No newline at end of file
......@@ -68,20 +68,6 @@ export function handleSpecialCharacters(jsonStr) {
jsonArr.splice(end, 1)
jsonStr = jsonArr.join('')
obj = JSON.parse(jsonStr)
// let token=jsonStr.slice(jsonStr.indexOf('token')+'token'.length+3,jsonStr.indexOf('userId')-3)
// let userId=jsonStr.slice(jsonStr.indexOf('userId')+'userId'.length+3,jsonStr.indexOf('userIdEncrypted')-3)
// let tenantId=jsonStr.slice(jsonStr.indexOf('tenantId')+'tenantId'.length+3,jsonStr.indexOf('tenantName')-3)
// let pushExtra={path:jsonStr.slice(jsonStr.indexOf('path')+'path'.length+3,jsonStr.indexOf('&type')+6)}
// obj={
// token:token,
// userId:userId ,
// organizationId:tenantId,
// pushExtra:pushExtra
// }
}
}
return obj;
......
import { get } from '@/utils/http'
import Base64_Encode from 'crypto-js/enc-base64';
import HmacSHA256 from 'crypto-js/hmac-sha256';
import SHA256_HEX from 'crypto-js/sha256';
const AlipayBaseUrl = import.meta.env.VITE_Alipay
const WechatBaseUrl = import.meta.env.VITE_Wechat
const UnionpayBaseUrl = import.meta.env.VITE_Unionpay
// 下单
const pay = (payType = 'alipay') => {
let getBaseUrl = {
alipay: AlipayBaseUrl,
wechat: WechatBaseUrl,
unionpay: UnionpayBaseUrl
}
const appId = '10037ca75e6125aa015e9e12a89b001b';
const timestamp = getTimestamp();
const nonce = randomString();
const content = {
"requestTimestamp": getTimestamp(true), // 报文请求时间
"mid": "898201612345678", // 商户号
"tid": "88880001", // 终端号
"instMid": "YUEDANDEFAULT", // 业务类型
"totalAmount": 3, // 支付总金额
"notifyUrl": "https://qrtest2.chinaums.com/netpayportal/test/notifyUrl.do", // 支付结果通知地址
"returnUrl": "https://qrtest2.chinaums.com/netpayportal/test/returnUrl.do", // 支付结果回跳商户页面
"merOrderId": randomString(true) // 商户订单号 商户自行生成 6..32
}
const signature = Base64_Encode(HmacSHA256(appId + timestamp + nonce + SHA256_HEX(JSON.stringify(content)), AppKey))
let params = { appId, timestamp, nonce, signature, content }
return get(getBaseUrl[payType] + urlencode(addQueryString(params)));
}
function randomString(OnlyNumber = false, e) {
e = e || 32;
var t = "abcdefhijkmnprstwxyz0123456789",
t2 = "1234567890",
a = t.length,
n = "";
if (OnlyNumber) t = t2;
for (i = 0; i < e; i++) n += t.charAt(Math.floor(Math.random() * a));
return n
}
function urlencode(str) {
str = (str + '').toString();
return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').
replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+');
}
function addQueryString(params) {
var str = '';
for (var Key in params) {
str += Key + '=' + params[Key] + '&';
}
return '?' + str;
//return '?' + str.substr(0, str.length -1); 严谨一些
}
function getTimestamp(isRequestTimestamp = false) {
let now = new Date(),
y = now.getFullYear(),
M = now.getMonth() + 1,
d = now.getDate(),
h = now.getHours(),
m = now.getMinutes(),
s = now.getSeconds();
let addZero = (n) => (n < 10 ? "0" + n : n);
if (isRequestTimestamp) {
return y + '-' + addZero(M) + '-' + addZero(d) + '-' + addZero(h) + ':' + addZero(m) + ':' + addZero(s);
}
return '' + y + addZero(M) + addZero(d) + addZero(h) + addZero(m) + addZero(s);
}
export { pay }
......@@ -47,7 +47,7 @@ export default ({ mode }) => {
vue({ reactivityTransform: true }),
Pages(setRouteConfig(VITE_TARGET)),
legacy({
targets: ['defaults', 'not IE 11']
targets: ['defaults', 'since 2016']
}),
styleImport({
resolves: [VantResolve()],
......@@ -73,8 +73,15 @@ export default ({ mode }) => {
port: 5678
},
build: {
outDir: `dist/${VITE_TARGET}`
minify: 'terser',
terserOptions: {
compress: {
drop_console: false,
drop_debugger: true,
},
},
outDir: `dist/${VITE_TARGET}`,
base: './'
}
}
}
......@@ -370,6 +370,11 @@ core-js@^3.11.0, core-js@^3.26.0:
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.26.1.tgz#7a9816dabd9ee846c1c0fe0e8fcad68f3709134e"
integrity sha512-21491RRQVzUn0GGM9Z1Jrpr6PNPxPi+Za8OM9q4tksTSnlbXXGKK1nXNg/QvwFYettXvSX6zWKCtHHfjN4puyA==
crypto-js@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-4.1.1.tgz#9e485bcf03521041bd85844786b83fb7619736cf"
integrity sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==
csstype@^2.6.8:
version "2.6.21"
resolved "http://nexus.saas.hand-china.com/repository/hzero-npm-group/csstype/-/csstype-2.6.21.tgz#2efb85b7cc55c80017c66a5ad7cbd931fda3a90e"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment