Commit 3ddc9ecd authored by 14699's avatar 14699

'fix-功能完善'

parent 0b79104d
......@@ -58,23 +58,23 @@
</template>
<Popup v-model:show="typeShow" position="bottom" :style="{ height: '45%' }">
<Popup v-model:show="typeShow" @close="typeOnCancel" position="bottom" :style="{ height: '45%' }">
<Picker title="请选择" show-toolbar :columns="typeColumns" @confirm="typeOnConfirm($event, 'picker')"
@cancel="typeOnCancel" />
</Popup>
<Popup v-model:show="typeShowDate" position="bottom">
<Popup v-model:show="typeShowDate" @close="typeOnCancel" position="bottom">
<DatetimePicker v-model="currentDate" type="date" title="选择年月日" @confirm="typeOnConfirm($event, 'date')"
@cancel="typeOnCancel" />
</Popup>
<Popup v-model:show="typeShowCascader" position="bottom">
<Popup v-model:show="typeShowCascader" @close="typeOnCancel" position="bottom">
<Cascader v-model="cascaderValue" title="请选择" :options="typeColumns" @close="typeOnCancel"
@finish="typeOnConfirm($event, 'cascader')" />
</Popup>
<Popup v-model:show="typeShowArea" position="bottom">
<Area title="请选择" :area-list="typeColumns" @confirm="typeOnConfirm($event, 'area')" />
<Popup v-model:show="typeShowArea" @close="typeOnCancel" position="bottom">
<Area title="请选择" :area-list="typeColumnsObject" @confirm="typeOnConfirm($event, 'area')" @cancel="typeOnCancel"/>
</Popup>
</div>
</template>
......@@ -117,6 +117,7 @@ const typeShowDate = ref(false)
const typeShowCascader = ref(false)
const typeShowArea = ref(false)
const typeColumns = ref([])
const typeColumnsObject = ref([])
const currentDate = ref(new Date())
const cascaderValue = ref('')
......@@ -148,7 +149,7 @@ function placeHolder(value, type, item = {}) {
function chooser(formItem) {
if (formItem.disabled) return
nowItem.value = formItem
console.log(Object.prototype.toString.call(formItem.select) === '[object Object]');
// console.log(Object.prototype.toString.call(formItem.select) === '[object Object]');
if (formItem.select === 'date') {
typeShowDate.value = true
......@@ -156,7 +157,7 @@ function chooser(formItem) {
formItem.select()
} else if (Object.prototype.toString.call(formItem.select) === '[object Object]') {
typeShowArea.value = true
typeColumns.value = formItem.select
typeColumnsObject.value = formItem.select
} else if (formItem.select[0].hasOwnProperty('children')) {
typeShowCascader.value = true
typeColumns.value = formItem.select
......@@ -192,7 +193,8 @@ function isObject(obj) {
return Object.prototype.toString.call(obj) === '[object Object]'
}
function typeOnCancel() {
typeShow.value = typeShowDate.value = false
typeShow.value = false
typeShowDate.value = false
typeShowCascader.value = false;
typeShowArea.value = false;
}
......
......@@ -88,8 +88,7 @@ table {
color: gray;
}
td,
th {
td, th {
text-align: center;
height: 25px;
line-height: 20px;
......@@ -115,6 +114,13 @@ table.more_four tr>th {
text-align: left;
}
table.more_four td:last-child {
text-align: right !important;
}
table.more_four th:last-child {
text-align: right !important;
}
.swipe {
box-sizing: border-box;
background-color: white;
......
......@@ -70,7 +70,7 @@ const formConfigArr = [
title: '合同利率',
propName: 'contractRate',
type: 'rate',
value: '6',
value: '',
isRequired: true,
},
]
......@@ -116,7 +116,7 @@ const updateForm = async () => {
} else if (['firstRentDay'].includes(item.propName)) {
item.value = '';
} else if (item.propName === "contractRate") {
item.value = '6'
item.value = ''
}
else if (item.propName === "repayment") {
item.value = '均等还款'
......@@ -136,10 +136,13 @@ const checkValues = (values) => {
if (+values.priceOfItem <= 0) {
Toast({ message: '请输入正确的物件价格', position: 'top' });
return false;
} else if (+values.term <= 0) {
Toast({ message: '请输入正确的融资租期(月)', position: 'top' });
return false;
} else if (values.firstGoldRatio > 1 || isNaN(+values.firstGoldRatio) || +values.firstGoldRatio < 0) {
Toast({ message: '请输入正确首付款比例', position: 'top' });
Toast({ message: '请输入正确首付款比例', position: 'top' });
return false;
} else if (isNaN(+values.contractRate) || +values.contractRate < 0) {
} else if (isNaN(+values.contractRate) || +values.contractRate <= 0) {
Toast({ message: '请输入正确的合同利率', position: 'top' });
return false;
}
......@@ -148,7 +151,7 @@ const checkValues = (values) => {
const getResult = (formValueObj) => {
let { priceOfItem, term, firstGoldRatio, firstRentDay, contractRate } = formValueObj
let firstGold = (priceOfItem * firstGoldRatio).toFixed(0);
let firstGold = +firstGoldRatio > 0?(priceOfItem * firstGoldRatio).toFixed(0) : 0;
let financeAmount = priceOfItem - firstGold;
let monthRate = contractRate / 12;
......@@ -160,7 +163,7 @@ const getResult = (formValueObj) => {
let interest = (financeAmount * monthRate * (temp ** term - temp ** (i - 1)) / (temp ** term - 1)).toFixed(2)
let principal = (financeAmount * monthRate * temp ** (i - 1) / (temp ** term - 1)).toFixed(2)
let dueAmount = (financeAmount * monthRate * temp ** term / (temp ** term - 1)).toFixed(2)
let chargeDueDate = moment(firstRentDay).add(i, 'month').format('YYYY-MM-DD')
let chargeDueDate = moment(firstRentDay).add(i-1, 'month').format('YYYY-MM-DD')
cashflow.push({ interest, principal, dueAmount, times: i + "", chargeDueDate })
}
......
<template>
<RepayPlan navTitle="还款计划" :currencyObj="currencyObj" @onLeftClick="backToLast">
<template #list>
<div class="repay_list" v-if="currencyObj.times && plan.financeAmount">
<div class="left">
<div class="times-box" v-for="i in currencyObj.times">
<div class="times">{{ i }}</div>
</div>
</div>
<div class="right">
<div class="item" v-for="item in plan.cashflow">
<div class="item-head">
<span>租金</span>
<span>{{ currency(item.dueAmount) }}</span>
<span>{{ item.chargeDueDate }}</span>
<div class="repay_list" v-if="plan.financeAmount">
<div class="repay_content" v-for="item in plan.cashflow">
<div class="left">
<div class="times-box">
<div class="times">{{ item.times }}</div>
</div>
<div class="item-foot">
<span>本金</span>
<span>{{ currency(item.principal) }}</span>
<span>利息</span>
<span>{{ currency(item.interest) }}</span>
</div>
<div class="right">
<div class="item">
<div class="item-head">
<span>租金</span>
<span>{{ currency(item.dueAmount) }}</span>
<span>{{ item.chargeDueDate }}</span>
</div>
<div class="item-foot">
<span>本金</span>
<span>{{ currency(item.principal) }}</span>
<span>利息</span>
<span>{{ currency(item.interest) }}</span>
</div>
</div>
</div>
</div>
......@@ -51,7 +53,7 @@ const getPlan = () => {
financingCurrency: currency(plan.financeAmount) ,
headerCurrency: currency(plan.firstGold),
fristCurrency: currency(plan.cashflow[0].dueAmount),
times: plan.cashflow.length
times: plan.term
}
}
......@@ -78,7 +80,7 @@ const save = async () => {
}
const backToLast = () => {
router.replace({ name: 'calculator-views-detail' })
router.replace({ name: 'calculator-views' })
}
</script>
......@@ -86,7 +88,7 @@ const backToLast = () => {
@lineColr: #dcdddf;
.repay_list {
display: flex;
/*display: flex;*/
width: 100%;
height: 98%;
overflow-y: auto;
......@@ -99,6 +101,11 @@ const backToLast = () => {
/* Chrome Safari */
}
.repay_content {
display: flex;
width: 100%;
}
@leftW: 45px;
.left {
......@@ -121,7 +128,7 @@ const backToLast = () => {
.times-box:nth-child(1) {
margin-top: 25px;
/*margin-top: 25px;*/
height: 70px;
justify-content: flex-start;
}
......@@ -174,7 +181,7 @@ const backToLast = () => {
color: gray;
display: flex;
flex-direction: row;
justify-content: flex-end;
justify-content: inherit;
span {
margin-right: 5px;
......
......@@ -63,7 +63,7 @@ const formConfig = $ref(new AuFormClass([
title: '联系方式',
propName: 'userPhoneNumber',
type: 'input',
value: '',
value: window.localStorage.getItem('phone'),
isRequired: true
}
]))
......@@ -104,9 +104,11 @@ const save = async () => {
p {
// margin-top: 10px;
background-color: #fff;
padding: 10px 30px;
padding: 10px 10px;
line-height: 25px;
margin: 0 10px 0;
font-weight: 600;
font-size: 14px;
}
p:nth-child(1) {
......
......@@ -7,15 +7,9 @@ const api = {
contextQuery(data = {}) {
return post(`${baseURL}/app/api/app/sign/context/query`, data)
},
// 业务经办保存
saveInfo(data = {}) {
return post(`${baseURL}/app/api/hls/payment/info/save`, data)
// {
// paymentReqId: '',
// oppositeFinancialContact: '对方财务联系人',
// contactInformation: '联系方式',
// receivets: ’时间戳‘
// }
// 已签署合同文本查询
preListQuery(data = {}) {
return post(`${baseURL}/app/api/app/sign/context/file`, data)
}
};
......
......@@ -17,7 +17,6 @@ const router = useRouter();
let iframeUrl = $ref(route.query.url)
console.log('hahhhah', iframeUrl);
let toLastPage = () => {
router.replace({ name: 'contractSign-views' })
}
......
......@@ -4,13 +4,13 @@
<section class="list">
<Tabs v-model:active="active" title-active-color="#0277bc" color="#0277bc" @change="TabChange">
<Search v-model="searchValue" placeholder="请输入合同编号/代理店" />
<Search v-model="searchValue" placeholder="请输入合同编号/代理店" @search="onSearch"/>
<Tab title="未签署">
<Notice detail="只对已关联的项目发送合同签约链接" />
<PullRefresh v-model="refreshing" @refresh="onRefresh" class="scroll">
<List :finished="finished" finished-text="没有更多了" @load="loadApproval">
<List v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="loadApproval">
<SignListItem v-for="item in notList" :sdata="item" @click="eSign(item.signUrl)" />
</List>
</PullRefresh>
......@@ -18,8 +18,8 @@
<Tab title="已签署">
<PullRefresh v-model="refreshing" @refresh="onRefresh" class="scroll">
<List :finished="finished" finished-text="没有更多了" @load="loadApproval">
<SignListItem v-for="item in alreadyList" :sdata="item" @click="pdfPre" />
<List v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="loadApproval">
<SignListItem v-for="item in alreadyList" :sdata="item" @click="pdfPre(item)" />
</List>
</PullRefresh>
</Tab>
......@@ -41,15 +41,20 @@ let notList = $ref([])
let alreadyList = $ref([])
const active = $ref(0)
const searchValue = $ref('')
let searchValue = $ref('')
let refreshing = $ref(false);
let finished = $ref(false);
let loading = $ref(false);
let pager = {
page: 1,
pageSize: 10
}
const onSearch = () => {
queryList()
}
let queryList = async () => {
refreshing = true
let res = await api.contextQuery({
......@@ -59,8 +64,8 @@ let queryList = async () => {
projectNumber: searchValue,
...pager
})
if (res.success && res.total > 0) {
loading = true
if (res.success && res.rows.length > 0) {
res.rows.forEach(item => {
let temp = {
...item,
......@@ -80,6 +85,7 @@ let queryList = async () => {
finished = true
// Toast.fail('获取列表失败!');
}
refreshing = false
}
......@@ -91,6 +97,7 @@ const onRefresh = () => {
alreadyList = []
}
finished = false
refreshing = false
pager.page = 1;
pager.pageSize = 10;
queryList()
......@@ -109,8 +116,9 @@ const loadApproval = () => {
const router = useRouter();
const pdfPre = () => {
router.push({ name: 'contractSign-views-pdfPre' })
const pdfPre = (item) => {
// router.push({ name: 'contractSign-views-pdfPre' })
router.push({ name: 'contractSign-views-pdfPreList', item: item })
}
let eSign = (eUrl) => {
......
<template>
<div class="container">
<NavBar title="合同预览列表" left-arrow @click-left="goBack" />
<section class="list">
<ListItem v-for="item in preList" :values="item.documentName" @click="jump(item.intentionId)" />
</section>
</div>
</template>
<script setup>
import { goBack } from "@/utils/globalFun"
import { NavBar, List, PullRefresh, Empty } from "vant";
import ListItem from '@/components/ListItem.vue'
import api from "../api";
import { useRouter } from "vue-router";
import { useIntention } from '../store/index'
const route = useRoute();
const router = useRouter();
const esignFlowId = $ref(route.item.esignFlowId);
let preList = $ref([]);
const getDailyLiquidatedDetail = async () => {
const res = await api.preListQuery({"esignFlowId": esignFlowId})
if(res.success){
preList = res.rows
} else {
Toast.fail('请求失败,请联系管理员!');
}
};
getDailyLiquidatedDetail();
</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-top: 8px;
padding-bottom: 10px;
}
.scroll {
box-sizing: border-box;
height: 100%;
overflow-y: auto;
}
</style>
This diff is collapsed.
......@@ -25,10 +25,10 @@ import { useInfoChange } from '../store/index'
const infoChangeStore = useInfoChange()
const refreshing = $ref(false);
let refreshing = $ref(false);
const finished = $ref(true);
const infos = $ref([])
let infos = $ref([])
let queryList = async () => {
refreshing = true
......@@ -54,7 +54,7 @@ const onRefresh = () => {
const loadApproval = () => {
queryList()
}
};
const router = useRouter();
......@@ -69,20 +69,23 @@ const getDetail = async (item) => {
Toast.fail('获取信息详情失败')
return {}
}
}
};
const jump = async (item) => {
// 申请中/审批通过时申请页面为只读
// 审批退回时可再次维护并重新提交
if (item.reqStatus && item.reqStatus === 'RETURN') {
infoChangeStore.data = await getDetail(item)
infoChangeStore.data.bpObj = item;
if (infoChangeStore.data.hlsBpMasterAddress)
router.push({ path: '/infochange/views/changeform', query: { isReturn: true } })
} else if (item.reqStatus && item.reqStatus !== 'RETURN') {
infoChangeStore.data = await getDetail(item)
infoChangeStore.data.bpObj = item;
if (infoChangeStore.data.hlsBpMasterAddress)
router.push({ path: '/infochange/views/changeform', query: { isReturn: false } })
} else {
infoChangeStore.data.bpObj = item;
router.push({ path: '/infochange/views/changeform', query: {} })
}
}
......
......@@ -22,12 +22,13 @@ import { NavBar, Button, Field, Toast } from "vant";
import AuForm from '@/components/AuForm.vue';
import AuFormClass from "@/components/useAuForm";
import { useLocation } from "@/utils/location"
import { phoneReg } from "@/utils/Reg"
import { phoneReg, cellPhoneReg } from "@/utils/Reg"
import { useRouter } from "vue-router";
import { useIntention } from '../store/index'
import { unref } from "vue";
import api from "../api";
import { areaList } from '@vant/area-data';
import { currency } from "@/utils/textFormat";
const formStore = useIntention()
let location = useLocation()
......@@ -90,7 +91,7 @@ const formRaw = [
type: 'input',
value: '',
isRequired: true,
reg: phoneReg
reg: cellPhoneReg
},
{
title: '联系地址',
......@@ -134,7 +135,7 @@ const save = async () => {
}, 2000);
}
} else {
Toast({ message: '请将信息填写完整', position: 'top' });
Toast({ message: '请正确填写完整信息', position: 'top' });
}
};
......@@ -206,7 +207,7 @@ const handleAgent = async () => {
let firstGoldRatio = formValueObj.firstGoldRatio;
if(+firstGoldRatio > 0 && +financeAmount > 0){
let firstGold = (financeAmount * firstGoldRatio).toFixed(2)
formConfig.setFormValue("firstGold", "value", +firstGold)
formConfig.setFormValue("firstGold", "value", currency(firstGold))
}
});
getFormVal();
......
......@@ -111,8 +111,8 @@
</template>
<script setup>
import { Popup, NavBar, Field, Cell,RadioGroup, Radio,CellGroup, Button, NumberKeyboard, Dialog, PasswordInput } from 'vant';
import {ref, reactive} from "vue";
import { Toast, Popup, NavBar, Field, Cell,RadioGroup, Radio,CellGroup, Button, NumberKeyboard, Dialog, PasswordInput } from 'vant';
import {ref, watchEffect, reactive} from "vue";
import { pay } from '@/utils/pay';
import api from "../api";
import { Base } from '@hips/plugin-vue-jssdk';
......@@ -135,15 +135,18 @@ const emit = defineEmits(['payMoneyClick', 'closePage'])
// });
const showDialog = ref(false);
const show = ref(false);
const checked = ref(null);
const orderAmount = ref(props.payInfoObj.payAmount);
const checked = ref('ALI_PAY');
const orderAmount = ref();
const showModeFlag = ref(true);
const password = ref([]);
const showKeyboard = ref(true);
const checkArray = {UNION_PAY:'云闪付(银行卡)',WECHAT_PAY:'微信支付',ALI_PAY:'支付宝'};
watchEffect(() => {
orderAmount.value = props.payInfoObj.payAmount
})
const cancel = () => {
console.log('canecel')
emit('closePage', false);
}
......@@ -166,17 +169,22 @@ const payMoney = () => {
// // on close
// });
// emit('closePage', false);
const info = {
// payAmount: orderAmount.value,
payAmount: '0.01',
payType: checked.value,
cashflowId: props.payInfoObj.cashflowId
if(!checked.value){
Toast.fail('请先选择支付方式!')
}
console.log(info)
//emit('payMoneyClick', info);
goPayApp(info)
}
else if(+orderAmount <= 0 || +orderAmount > +props.payInfoObj.payAmount){
Toast.fail('请输入正确的支付金额!')
} else {
const info = {
// payAmount: orderAmount.value,
payAmount: '0.01',
payType: checked.value,
cashflowId: props.payInfoObj.cashflowId
}
//emit('payMoneyClick', info);
goPayApp(info)
}
};
const goPayApp = async (param) => {
// 下拉重置参数,重新加载
......@@ -215,12 +223,20 @@ const handleFinishAmount = () => {
.van-cell {
width: 75%;
margin-left: 50px;
padding: 10px;
}
.pay-money-content{
display: flex;
width: 100%;
}
.pay-money-update{
float: left;
margin-top: -40px;
margin-right: 15px;
/*float: left;*/
/*margin-top: -40px;*/
/*margin-right: 15px;*/
color: #1989fa;
margin-top: 15px;
height: 40px;
line-height: 40px;
}
.van-cell-mode {
position: relative;
......@@ -276,6 +292,8 @@ const handleFinishAmount = () => {
border: 1px solid antiquewhite;
background: antiquewhite;
height: 40px;
line-height: 40px;
padding-left: 5px;
}
:deep(.van-password-input__security){
width: 90%;
......
......@@ -7,13 +7,3 @@ export const useMakeRepayment = defineStore('makeRepaymentStore', () => {
const contractId = ref('')
return { makeRepayPlanData, contractId }
})
// export const useCounterStore = defineStore('counter', () => {
// const count = ref(0)
// const doubleCount = computed(() => count.value * 2)
// function increment() {
// count.value++
// }
//
// return { count, doubleCount, increment }
// })
......@@ -25,6 +25,7 @@ import ListItem from '@/components/ListItem.vue'
import api from "../api";
import { useRouter } from "vue-router";
import { useMakeRepayment } from '../store/index'
import {currency} from '@/utils/textFormat'
const makeRepaymentStore = useMakeRepayment()
......@@ -43,7 +44,7 @@ const getList = async () => {
...item,
title: item.contractNumber,
other_title: item.applyDate?.split(' ')[0],
values: [["剩余应还金额", "状态", "融资金额"], [item.residueAmount, item.contractStatusN, item.financeAmount]]
values: [["剩余应还金额", "状态", "融资金额"], [currency(item.residueAmount), item.contractStatusN, currency(item.financeAmount)]]
}))
}else {
list = [];
......
<template>
<NavBar title="违约金明细" left-arrow @click-left="goBack" />
<NavBar title="罚息明细" left-arrow @click-left="goBack" />
<Collapse v-model="activeNames" v-for="(item, index) of damageDetailInfo">
<CollapseItem :title="item.periods" :name="index+1" :value="item.amount">
<CellGroup v-for="(k) of item.detail">
......@@ -13,44 +13,67 @@
import { Collapse, CollapseItem, Cell, CellGroup, NavBar } from 'vant';
import {ref, reactive} from "vue";
import api from "../api";
import {goBack} from '../../../utils/globalFun';
import { useMakeRepayment } from '../store/index';
import { currency } from "@/utils/textFormat";
const makeRepaymentStore = useMakeRepayment()
let damageDetailInfo = $ref([
// {
// periods: '第一期',
// amount: '4300.88',
// detail: [
// {
// name: '违约金1',
// debait: '2300',
// date: '2022-12-08',
// },
// {
// name: '违约金2',
// debait: '2300.88',
// date: '2022-12-08',
// }
// ]
// },
// {
// periods: '第二期',
// amount: '4300.88',
// detail: [
// {
// name: '违约金1',
// debait: '2300',
// date: '2022-12-08',
// },
// {
// name: '违约金2',
// debait: '2300.88',
// date: '2022-12-08',
// }
// ]
// }
]);
const damageDetailInfo = ref([
{
periods: '第一期',
amount: '4300.88',
detail: [
{
name: '违约金1',
debait: '2300',
date: '2022-12-08',
},
{
name: '违约金2',
debait: '2300.88',
date: '2022-12-08',
}
]
},
{
periods: '第二期',
amount: '4300.88',
detail: [
{
name: '违约金1',
debait: '2300',
date: '2022-12-08',
},
{
name: '违约金2',
debait: '2300.88',
date: '2022-12-08',
}
]
}
])
const activeNames = ref([]);
const getDailyLiquidatedDetail = async () => {
const res = await api.getLiquidatedDetail({"contractId": makeRepaymentStore.contractId})
if(res.success){
damageDetailInfo = res.rows.map(items => ({
...items,
periods: `第${items.times}期`,
amount: currency(items.dueAmount),
detail: items.file.map(item => ({
...item,
name: `罚息`,
debait: currency(item.dueAmount),
date: item.creationDate?.split(' ')[0]
}))
}))
} else {
Toast.fail('请求失败,请联系管理员!');
}
};
getDailyLiquidatedDetail();
</script>
......
<template>
<RepayPlan navTitle="还款计划" :currencyObj="currencyObj" @onLeftClick="goBack" navText="违约金明细" @onClickRight="goDamagesDetail">
<RepayPlan navTitle="还款计划" :currencyObj="currencyObj" @onLeftClick="goBack" navText="罚息明细" @onClickRight="goDamagesDetail">
<template #list>
<div class="repay_list">
<div class="left">
<div class="times-box" v-for="i in currencyObj.times">
<div class="times">{{ i }}</div>
<div class="repay_content" v-for="(item, index) in cashflow">
<div class="left">
<div class="times-box">
<div class="times">{{ item.times }}</div>
</div>
</div>
<div class="right">
<div class="item">
<div class="left-item">
<span>{{ item.cfItemN }}</span>
<span>{{ item.dueDate}}</span>
</div>
<div class="center-item">
<p>
<span>应付</span>
<span>{{ currency(item.dueAmount) }}</span>
</p>
<p>
<span>待付</span>
<span>{{ currency(item.obligation) }}</span>
</p>
</div>
<div class="right-item">
<span></span>
<span class="flag-button paid" v-if="item.writeOffFlag == 'FULL'">
<Icon name="passed" style="margin-right: 1px;" />{{item.writeOffFlagN}}
</span>
<span v-else-if="checkCashflow(item,index)" class="flag-button payment" @click="handleClick(item)">
支付
</span>
<span v-else class="flag-button paying">
<Icon name="clock-o" style="margin-right: 1px;" />{{item.writeOffFlagN}}
</span>
</div>
</div>
</div>
</div>
</div>
<div class="right">
<div class="item" v-for="item in cashflow">
<div class="left-item">
<span>租金</span>
<span>{{item.chargeDueDate}}</span>
</div>
<div class="center-item">
<p>
<span>应付金额</span>
<span>{{item.dueAmount}}</span>
</p>
<p>
<span>待付金额</span>
<span>{{item.obligation}}</span>
</p>
</div>
<div class="right-item">
<span></span>
<span class="flag-button payment" @click="handleClick(item)">
支付
</span>
</div>
</div>
</div>
</div>
<Pay :visible="showModal" :payInfoObj="payInfo" @payMoneyClick="pay" @closePage="handleColse"/>
<!-- <Dialog v-model:show="showDialog" title="标题" show-cancel-button z-index="2022">-->
<!-- <div>jhahha</div>-->
<!-- &lt;!&ndash; <img src="https://fastly.jsdelivr.net/npm/@vant/assets/apple-3.jpeg" />&ndash;&gt;-->
<!-- </Dialog>-->
</template>
<template #footer>
</template>
</RepayPlan>
</template>
......@@ -52,25 +55,14 @@ import {goBack} from '../../../utils/globalFun';
import {ref} from "vue";
import { useRoute, useRouter } from "vue-router";
import api from "../api";
import { useMakeRepayment } from '../store/index'
import { useMakeRepayment } from '../store/index';
import { currency } from "@/utils/textFormat";
const makeRepaymentStore = useMakeRepayment()
const showDialog = ref(false);
let currencyObj = $ref({
financingCurrency: '200,000.00',
headerCurrency: '5,000.00',
fristCurrency: '10,000.00',
times: '12'
})
let cashflow = [
{
chargeDueDate: '2022-12-28',
dueAmount: '2000',
obligation: '3200',
}
]
let payInfo = ref({});
let currencyObj = $ref()
let cashflow = []
let payInfo = $ref({});
let showModal = ref(false);
const route = useRoute()
......@@ -98,26 +90,36 @@ const goDamagesDetail = () => {
const getRepayPlanInfo = async () => {
const result = await api.getRepayPlanDetail({"contractId": makeRepaymentStore.contractId})
if(result.message === '请求成功'){
if(result.success){
const rows = result.rows[0];
currencyObj = {
financingCurrency: rows.financeAmount,
headerCurrency: rows.firstGold,
fristCurrency: rows.firstRentGold,
times: rows.cashflow.length
financingCurrency: currency(rows.financeAmount),
headerCurrency: currency(rows.firstGold),
fristCurrency: currency(rows.firstRental),
times: rows.leaseTerm
}
rows.cashflow = rows.cashflow.map(item => { item.calcDate = item.calcDate?.split(" ")[0]; return item })
rows.cashflow = rows.cashflow.map(item => { item.dueDate = item.dueDate?.split(" ")[0]; return item })
cashflow = rows.cashflow
console.log(cashflow);
}
}
getRepayPlanInfo()
const getLiquidatedDamagesInfo = async () => {
const result = await api.getLiquidatedDetail({contractId: makeRepaymentStore.contractId})
getRepayPlanInfo();
const checkCashflow = (listItem, curIndex) => {
// cashflow.find((item, index)=>{
//
// })
for(var i = 0; i< curIndex; i++) {
if(cashflow[i].writeOffFlag != 'FULL'){
return false
}
}
// cashflow.forEach((item,index) => {
// if(item.writeOffFlag != 'FULL'){
// return false
// }
// })
return true
}
getLiquidatedDamagesInfo()
</script>
......@@ -125,7 +127,7 @@ getLiquidatedDamagesInfo()
@lineColr: #dcdddf;
.repay_list {
display: flex;
/*display: flex;*/
width: 100%;
height: 98%;
overflow-y: auto;
......@@ -138,6 +140,11 @@ getLiquidatedDamagesInfo()
/* Chrome Safari */
}
.repay_content {
display: flex;
width: 100%;
}
@leftW: 45px;
.left {
......@@ -160,7 +167,7 @@ getLiquidatedDamagesInfo()
.times-box:nth-child(1) {
margin-top: 25px;
/*margin-top: 25px;*/
height: 70px;
justify-content: flex-start;
}
......@@ -265,6 +272,7 @@ getLiquidatedDamagesInfo()
height: 40%;
border-radius: 10px;
font-size: 12px;
margin-top: 15px;
}
.overtime {
......
......@@ -28,13 +28,6 @@ import { useRouter } from "vue-router";
import { useProjectList } from "../store";
const formStore = useProjectList()
// const listValue = $ref([
// {
// title: '2204-DB001-001',
// other_title: "2022-07-18",
// values: [["机型", "状态", "代理店"], ["HB2015-1MO", "正常", "江苏-宁隆"]]
// }
// ])
let refreshing = $ref(true);
const finished = $ref(true);
......@@ -56,7 +49,7 @@ const getList = async (param) => {
list = res.rows.map(item => ({
...item,
title: item.itemProjectNumber,
other_title: item.creationDate?.split(' ')[0],
other_title: item.applyDate?.split(' ')[0],
values: [["机型", "状态", "代理店"], [item.model, item.contractStatusN, item.agencyBpName]]
}))
}else {
......
<template>
<RepayPlan navTitle="还款计划" :currencyObj="currencyObj" @leftClick="backToLast">
<RepayPlan navTitle="还款计划" :currencyObj="currencyObj" @onLeftClick="backToLast">
<template #list>
<div class="repay_list">
<div class="left">
<div class="times-box" v-for="i in currencyObj.times">
<div class="times">{{ i }}</div>
</div>
</div>
<div class="right">
<div class="item" v-for="item in cashflow">
<div class="left-item">
<span>租金</span>
<!-- <span>{{ item.chargeDueDate}}</span> 这个是实际字段-->
<span>{{ item.calcDate}}</span>
<div class="repay_content" v-for="item in cashflow">
<div class="left">
<div class="times-box">
<div class="times">{{ item.times }}</div>
</div>
<div class="center-item">
<p>
<!-- <span>应付金额</span>-->
<span>{{item.dueAmount}}</span>
</p>
<p>
<!-- <span>待付金额</span>-->
<!-- <span>¥0.00</span>-->
</p>
</div>
<div class="right-item">
<span>明细</span>
<span class="flag-button paying" v-if="item.writeOffFlag === 'NOT'">
<Icon name="clock-o" style="margin-right: 1px;" />{{item.writeOffFlagN}}
</span>
<span class="flag-button paid" v-else-if="item.writeOffFlag === 'FULL'">
<Icon name="passed" style="margin-right: 1px;" />{{item.writeOffFlagN}}
</span>
<span class="flag-button overtime" v-else>
<Icon style="margin-right: 1px;" name="info-o" />{{item.writeOffFlagN}}
</span>
</div>
<div class="right">
<div class="item">
<div class="left-item">
<span>{{ item.cfItemN }}</span>
<span>{{ item.dueDate}}</span>
</div>
<div class="center-item">
<p>
<span>应付</span>
<span>{{ currency(item.dueAmount) }}</span>
</p>
<p>
<span>待付</span>
<span>{{ currency(item.obligation) }}</span>
</p>
</div>
<div class="right-item">
<span></span>
<span class="flag-button paying" v-if="item.writeOffFlag === 'NOT'">
<Icon name="clock-o" style="margin-right: 1px;" />{{item.writeOffFlagN}}
</span>
<span class="flag-button paid" v-else-if="item.writeOffFlag === 'FULL'">
<Icon name="passed" style="margin-right: 1px;" />{{item.writeOffFlagN}}
</span>
<span class="flag-button overtime" v-else>
<Icon style="margin-right: 1px;" name="info-o" />{{item.writeOffFlagN}}
</span>
</div>
</div>
</div>
</div>
......@@ -52,31 +53,25 @@ import { Icon } from 'vant'
import {useRouter} from 'vue-router'
import api from "../api";
import { useProjectList } from "../store";
import { currency } from "@/utils/textFormat"
const router = useRouter()
const formStore = useProjectList()
let currencyObj = $ref({
// financingCurrency: '200,000.00',
// headerCurrency: '5,000.00',
// fristCurrency: '10,000.00',
// times: '12'
})
let currencyObj = $ref({})
let cashflow = []
const getRepayPlanInfo = async () => {
// "contractId": "777"
const result = await api.getRepaymentDetails({"contractId": formStore.contractId})
if(result.message === '请求成功'){
if(result.success){
const rows = result.rows[0];
currencyObj = {
financingCurrency: rows.financeAmount,
headerCurrency: rows.firstGold,
fristCurrency: rows.firstRentGold,
times: rows.cashflow.length
financingCurrency: currency(rows.financeAmount),
headerCurrency: currency(rows.firstGold),
fristCurrency: currency(rows.firstRental),
times: rows.leaseTerm
}
rows.cashflow = rows.cashflow.map(item => { item.calcDate = item.calcDate?.split(" ")[0]; return item })
rows.cashflow = rows.cashflow.map(item => { item.dueDate = item.dueDate?.split(" ")[0]; return item })
cashflow = rows.cashflow
console.log(cashflow);
}
}
getRepayPlanInfo()
......@@ -92,7 +87,7 @@ const backToLast = () => {
@lineColr: #dcdddf;
.repay_list {
display: flex;
/*display: flex;*/
width: 100%;
height: 98%;
overflow-y: auto;
......@@ -104,6 +99,10 @@ const backToLast = () => {
display: none;
/* Chrome Safari */
}
.repay_content {
display: flex;
width: 100%;
}
@leftW: 45px;
......@@ -127,7 +126,7 @@ const backToLast = () => {
.times-box:nth-child(1) {
margin-top: 25px;
/*margin-top: 25px;*/
height: 70px;
justify-content: flex-start;
}
......
......@@ -9,7 +9,6 @@
<AuForm v-model="formBillingInfoConfig" :key="form" moduleName="开票信息"/>
<AuForm v-model="formleaseInfoConfig" :key="form" moduleName="租赁物信息"/>
<Cell title="还款计划" is-link class="cell-title" @click="gotoRepayPlan"/>
<!-- to="/repayplan/views/plan"/-->
</section>
</div>
</div>
......@@ -49,7 +48,7 @@ const formBaseConfigArr = [
},
{
title: '代理店',
propName: 'decryptAgencyBpName',
propName: 'agencyBpName',
type: 'input',
value: '',
isRequired: false,
......@@ -73,7 +72,7 @@ const formBaseConfigArr = [
},
{
title: '物件属性',
propName: 'leaseProperties',
propName: 'leasePropertiesN',
type: 'input',
value: '',
isRequired: false,
......@@ -107,7 +106,7 @@ const formBaseConfigArr = [
const formBillingInfoArr = [
{
title: '纳税人类型',
propName: 'taxpayerType',
propName: 'taxpayerTypeN',
type: 'input',
value: '',
isRequired: false,
......@@ -173,20 +172,20 @@ const formleaseInfoArr = [
},
{
title: '测算方式',
propName: 'calculationMethod',
propName: 'calculationMethodN',
type: 'input',
value: '',
isRequired: false,
disabled: true,
},
{
title: '租赁物分类',
propName: 'leaseTypeN',
type: 'input',
value: '',
isRequired: false,
disabled: true
},
// {
// title: '租赁物分类',
// propName: 'leaseTypeN',
// type: 'input',
// value: '',
// isRequired: false,
// disabled: true
// },
{
title: '物件名称',
propName: 'fullName',
......@@ -214,76 +213,20 @@ const formleaseInfoArr = [
{
title: '物件价格',
propName: 'leaseValue',
type: 'input',
type: 'currency',
value: '',
isRequired: false,
disabled: true
}
]
];
const form = $ref();
let listArr = $ref([
// {
// sortId: '序号',
// bpName: '担保方名称'
// },
// {
// sortId: 1,
// bpName: '李某某'
// },
// {
// sortId: 2,
// bpName: '担保人2'
// },
])
const formBaseConfig = $ref(new AuFormClass(formBaseConfigArr))
const formGuarantorConfig = $ref(new AuFormClass([
{
title: '纳税人类别',
propName: 'paymentReqDate',
type: 'input',
value: '啊哈哈哈',
isRequired: false,
disabled: true,
},
{
title: '纳税人识别',
propName: 'paymentReqDat3e',
type: 'input',
value: '1000',
isRequired: false,
disabled: true,
},
{
title: '发票抬头',
propName: 'paymentReqDat3e',
type: 'input',
value: '23456567X',
isRequired: false,
disabled: true
},
{
title: '发票电话',
propName: 'paymentReqDat3e',
type: 'input',
value: '',
isRequired: false,
disabled: true
},
{
title: '发票地址',
propName: 'paymentReqDat3e',
type: 'input',
value: '',
isRequired: false,
disabled: true
},
]))
const formBillingInfoConfig = $ref(new AuFormClass(formBillingInfoArr))
const formleaseInfoConfig = $ref(new AuFormClass(formleaseInfoArr))
let contractId = $ref(null);
let listArr = $ref([]);
const formBaseConfig = $ref(new AuFormClass(formBaseConfigArr));
const formBillingInfoConfig = $ref(new AuFormClass(formBillingInfoArr));
const formleaseInfoConfig = $ref(new AuFormClass(formleaseInfoArr));
let contractId = $ref(formStore.contractId);
const projectInfoDetail = async () => {
console.log('url', formStore.contractId);
let result = await api.getProjectDetail({"contractId": formStore.contractId});
if(result.success) {
let rows = result.rows;
......@@ -311,7 +254,6 @@ const projectInfoDetail = async () => {
bpName: '担保方名称'
})
}
if(rows[0]?.billingInformationList.length !== 0){
billingInfo = rows[0].billingInformationList[0];
formBillingInfoConfig.replace(formBillingInfoArr.map(item => {
......@@ -319,7 +261,6 @@ const projectInfoDetail = async () => {
return item
}))
}
if(rows[0]?.leaseInformationList.length !== 0){
leaseInfo = rows[0].leaseInformationList[0]
formleaseInfoConfig.replace(formleaseInfoArr.map(item => {
......@@ -327,9 +268,7 @@ const projectInfoDetail = async () => {
return item
}))
}
}
};
projectInfoDetail();
......
......@@ -40,7 +40,7 @@ const queryList = async () => {
refreshing = true
let res = await api.contractQueryAll({ receivets: + new Date() + '', ...pager })
if (res.success && res.total > 0) {
if (res.success && res.rows.length > 0) {
res.rows.forEach(item => {
let temp = {
...item,
......
......@@ -71,7 +71,7 @@ const secondFormConfig = $ref({})
const lastFormConfig = $ref(new AuFormClass([
{
title: '项目编号',
propName: 'contractId',
propName: 'contractNumber',
type: 'input',
value: '',
isRequired: true,
......@@ -79,7 +79,7 @@ const lastFormConfig = $ref(new AuFormClass([
},
{
title: '机型',
propName: 'machineNumber',
propName: 'model',
type: 'input',
value: '',
isRequired: true,
......@@ -103,7 +103,7 @@ const lastFormConfig = $ref(new AuFormClass([
},
{
title: '代理店名称',
propName: 'agencyBpName',
propName: 'agencyName',
type: 'input',
value: '',
isRequired: true,
......@@ -137,8 +137,8 @@ let checkPrj = async () => {
let res = await api.contractQuery({ ...firstFormConfig.getValues(), receivets: + new Date() + '' })
if (res.success && res.total > 0) {
lastFormConfig.fillValues(res.rows[0])
if(!res.rows[0].contractId) return false
shouldSaveContractId = res.rows[0].contractId
if(!res.rows[0].projectLeaseItemId) return false
shouldSaveContractId = res.rows[0].projectLeaseItemId
return true
} else {
Toast.fail('未找到该项目')
......@@ -155,7 +155,7 @@ let queryContractInfo = async () => {
if (res.success && res.total > 0) {
lastFormConfig.fillValues(res.rows[0])
shouldSaveContractId = res.rows[0].contractId
shouldSaveContractId = res.rows[0].projectLeaseItemId
} else {
Toast.fail('未找到该项目')
}
......@@ -169,7 +169,7 @@ const nextStep = async () => {
step++
}else {
Toast.fail('未查询到该关联项目')
};
}
} else if (step === 2 && secondFormConfig.sms && secondFormConfig.tel) {
if (checkSms()) {
queryContractInfo()
......@@ -183,12 +183,15 @@ let buttonValues = $ref('获取验证码')
const getSms = async () => {
if (phoneReg.test(secondFormConfig.tel)) {
let res = await api.phoneValid({
contractId: shouldSaveContractId,
projectLeaseItemId: shouldSaveContractId.toString(),
phone: secondFormConfig.tel,
receivets: + new Date() + ''
})
if (res.success) {
if (res.success && res.rows[0]) {
Toast.success('短信发送成功,请注意查收!')
CountDown()
} else {
Toast.fail("短信验证码发送失败!")
}
} else {
Toast.fail("请将手机号输入正确")
......@@ -218,18 +221,17 @@ const lastStep = () => {
const router = useRouter()
const submit = async () => {
let res = await api.contractBind({
contractId: shouldSaveContractId,
projectLeaseItemId: shouldSaveContractId.toString(),
receivets: + new Date() + ''
})
if (res.success && res.total > 0 && res.rows[0]?.associationId) {
Toast.success('绑定成功')
setTimeout(() => {
goBack()
}, 1000);
} else {
Toast.fail('绑定失败,请稍后重试。')
let message = res.message?res.message:'绑定失败,请稍后重试!'
Toast.fail(message)
}
}
</script>
......
......@@ -4,6 +4,6 @@ import { defineStore } from 'pinia'
export const useIntention = defineStore('formStore', () => {
const repayPlanData = ref({})
return { repayPlanData }
const contractId = ref('')
return { repayPlanData, contractId }
})
<template>
<div class="container">
<NavBar title="还款计划" left-arrow @click-left="goBack" />
<NavBar title="还款计划查询" left-arrow @click-left="goBack" />
<section class="list">
<Search v-model="searchVal" placeholder="请输入项目编号/融资金额" />
......@@ -10,7 +10,7 @@
<PullRefresh v-model="refreshing" @refresh="getList" 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" />
@click="jump(item)" />
</List>
</PullRefresh>
</section>
......@@ -25,21 +25,11 @@ import ListItem from '@/components/ListItem.vue'
import api from "../api";
import { useRouter } from "vue-router";
import {currency} from '@/utils/textFormat'
import { useIntention } from "../store";
const searchVal = $ref('');
let 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 formStore = useIntention();
let listValue = $ref([]);
let refreshing = $ref(true);
const finished = $ref(true);
......@@ -53,7 +43,7 @@ const getList = async () => {
...item,
title: item.contractNumber,
other_title: item.applyDate?.split(' ')[0],
values: [["剩余应还金额", "状态", "融资金额"], [currency(item.residueAmount),item.contractStatusN, currency(item.financeAmount)]]
values: [["剩余应还金额", "合同状态", "融资金额"], [currency(item.residueAmount),item.contractStatusN, currency(item.financeAmount)]]
}))
}else {
list = [];
......@@ -65,12 +55,12 @@ const getList = async () => {
getList();
const loadApproval = () => {
}
const router = useRouter();
const jump = () => {
const jump = (item) => {
formStore.contractId = item.contractId;
router.push({ name: 'repayPlan-views-plan' })
}
</script>
......
......@@ -2,34 +2,42 @@
<RepayPlan navTitle="还款计划" :currencyObj="currencyObj" @onLeftClick="goBack" >
<template #list>
<div class="repay_list">
<div class="left">
<div class="times-box" v-for="i in currencyObj.times">
<div class="times">{{ i }}</div>
</div>
</div>
<div class="right">
<div class="item" v-for="item in cashflow">
<div class="left-item">
<span>租金</span>
<span>{{ item.chargeDueDate}}</span>
</div>
<div class="center-item">
<p>
<span>应付</span>
<span>¥9,000.00</span>
</p>
<p>
<span>待付</span>
<span>¥0.00</span>
</p>
<div class="repay_content" v-for="item in cashflow">
<div class="left">
<div class="times-box">
<div class="times">{{ item.times }}</div>
</div>
</div>
<div class="right-item">
<span>明细</span>
<span class="flag-button overtime">
<Icon style="margin-right: 1px;" name="info-o" />{{item.writeOffFlagN}}
</span>
<div class="right">
<div class="item">
<div class="left-item">
<span>{{ item.cfItemN }}</span>
<span>{{ item.dueDate}}</span>
</div>
<div class="center-item">
<p>
<span>应付</span>
<span>{{ currency(item.dueAmount) }}</span>
</p>
<p>
<span>待付</span>
<span>{{ currency(item.obligation) }}</span>
</p>
</div>
<div class="right-item">
<span>明细</span>
<span class="flag-button paying" v-if="item.writeOffFlag === 'NOT'">
<Icon name="clock-o" style="margin-right: 1px;" />{{item.writeOffFlagN}}
</span>
<span class="flag-button paid" v-else-if="item.writeOffFlag === 'FULL'">
<Icon name="passed" style="margin-right: 1px;" />{{item.writeOffFlagN}}
</span>
<span class="flag-button overtime" v-else>
<Icon style="margin-right: 1px;" name="info-o" />{{item.writeOffFlagN}}
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
......@@ -45,31 +53,26 @@ import { goBack } from "@/utils/globalFun"
import { Icon } from 'vant'
import {useRoute} from 'vue-router'
import api from "../api";
import { currency } from "@/utils/textFormat"
import { useIntention } from "../store";
let currencyObj = $ref({
// financingCurrency: '200,000.00',
// headerCurrency: '5,000.00',
// fristCurrency: '10,000.00',
// times: '12'
})
const formStore = useIntention()
let currencyObj = $ref({})
let cashflow = []
//writeOffFlag: "NOT"
// writeOffFlagN: "待付"
const getRepayPlanInfo = async () => {
const result = await api.getRepaymentDetails({"contractId": "777"})
const result = await api.getRepaymentDetails({"contractId": formStore.contractId})
if(result.message === '请求成功'){
const rows = result.rows[0];
currencyObj = {
financingCurrency: rows.financeAmount,
headerCurrency: rows.firstGold,
fristCurrency: rows.firstRentGold,
times: rows.cashflow.length
financingCurrency: currency(rows.financeAmount),
headerCurrency: currency(rows.firstGold),
fristCurrency: currency(rows.firstRental),
times: rows.leaseTerm
}
// rows.cashflow = rows.cashflow.map(item => { item.chargeDueDate = item.chargeDueDate.split(" ")[0]; return item })
rows.cashflow = rows.cashflow.map(item => { item.dueDate = item.dueDate.split(" ")[0]; return item })
cashflow = rows.cashflow
console.log(cashflow);
}
}
getRepayPlanInfo()
......@@ -79,7 +82,7 @@ getRepayPlanInfo()
@lineColr: #dcdddf;
.repay_list {
display: flex;
/*display: flex;*/
width: 100%;
height: 98%;
overflow-y: auto;
......@@ -91,6 +94,10 @@ getRepayPlanInfo()
display: none;
/* Chrome Safari */
}
.repay_content {
display: flex;
width: 100%;
}
@leftW: 45px;
......@@ -114,7 +121,7 @@ getRepayPlanInfo()
.times-box:nth-child(1) {
margin-top: 25px;
// margin-top: 25px;
height: 70px;
justify-content: flex-start;
}
......@@ -219,6 +226,7 @@ getRepayPlanInfo()
height: 40%;
border-radius: 10px;
font-size: 12px;
/*margin-top: 15px;*/
}
.overtime {
......
let phoneReg = /^1[3-9]\d{9}$/
let cellReg = /^(0\d{2,3})-?(\d{7,8})$/
let cellPhoneReg = /^(1[3-9]\d{9})|(0\d{2,3})-?(\d{7,8})$/
// 带 400 的电话
// let cellPhoneReg = /^([^0-9](0[0-9]{2,3}\-[2-9][0-9]{6,7}|1[3-9][0-9]{9}|400-[0-9]{3}-[0-9]{4})[^0-9])$/
let idCardReg = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/
//社会信用代码校验
let creditCodeReg = /^[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/
//校验身份证信息
function IdentityCodeValid(code) {
var city = {
11: "北京",
12: "天津",
13: "河北",
14: "山西",
15: "内蒙古",
21: "辽宁",
22: "吉林",
23: "黑龙江 ",
31: "上海",
32: "江苏",
33: "浙江",
34: "安徽",
35: "福建",
36: "江西",
37: "山东",
41: "河南",
42: "湖北 ",
43: "湖南",
44: "广东",
45: "广西",
46: "海南",
50: "重庆",
51: "四川",
52: "贵州",
53: "云南",
54: "西藏 ",
61: "陕西",
62: "甘肃",
63: "青海",
64: "宁夏",
65: "新疆",
71: "台湾",
81: "香港",
82: "澳门",
91: "国外 "
};
var tip = "";
var pass = true;
if (!code || !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(code)) {
tip = "身份证号格式错误";
pass = false;
} else if (!city[code.substr(0, 2)]) {
tip = "地址编码错误";
pass = false;
} else {
//18位身份证需要验证最后一位校验位
if (code.length == 18) {
code = code.split('');
//∑(ai×Wi)(mod 11)
//加权因子
var factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
//校验位
var parity = [1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2];
var sum = 0;
var ai = 0;
var wi = 0;
for (var i = 0; i < 17; i++) {
ai = code[i];
wi = factor[i];
sum += ai * wi;
}
var last = parity[sum % 11];
if (parity[sum % 11] != code[17]) {
tip = "校验位错误";
pass = false;
}
}
}
return pass
}
let emailReg = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/;
let zipcodeReg = /^[0-9]{6}$/;
export {
phoneReg,
cellReg,
cellPhoneReg,
idCardReg,
creditCodeReg
}
\ No newline at end of file
creditCodeReg,
IdentityCodeValid,
emailReg,
zipcodeReg
}
......@@ -65,3 +65,58 @@ export function detectOS() {
return 'other'
}
}
//身份证号获取出生年月
export function getBirthdayByIdNO (id_card_no){
var date_of_birth = "";
if (id_card_no.length==18) {
date_of_birth = id_card_no.substr(6,8);
return date_of_birth.replace(/(.{4})(.{2})/,"$1-$2-");
}else if(id_card_no.length==15){
date_of_birth = "19"+date_of_birth.substr(6,6);
return date_of_birth.replace(/(.{4})(.{2})/,"$1-$2-");
}else{
return date_of_birth;
}
}
//身份证获取性别
export function getSexByIdNO(id_card_no){
if (id_card_no.length==18) {
return id_card_no.charAt(16)%2==0?"FEMALE":"MALE";
}else if(id_card_no.length==15){
return id_card_no.charAt(14)%2==0?"FEMALE":"MALE";
}else{
return "";
}
}
// 计算年龄
export function getAge(id_card_no) {
var len = (id_card_no + "").length;
if (len == 0) {
return 0;
} else {
if ((len != 15) && (len != 18))
{
return 0;
}
}
var strBirthday = "";
if (len == 18)
{
strBirthday = id_card_no.substr(6, 4) + "/" + id_card_no.substr(10, 2) + "/" + id_card_no.substr(12, 2);
}
if (len == 15) {
strBirthday = "19" + id_card_no.substr(6, 2) + "/" + id_card_no.substr(8, 2) + "/" + id_card_no.substr(10, 2);
}
//时间字符串里,必须是“/”
var birthDate = new Date(strBirthday);
var nowDateTime = new Date();
var age = nowDateTime.getFullYear() - birthDate.getFullYear();
//再考虑月、天的因素;.getMonth()获取的是从0开始的,这里进行比较,不需要加1
if (nowDateTime.getMonth() < birthDate.getMonth() || (nowDateTime.getMonth() == birthDate.getMonth() && nowDateTime.getDate() < birthDate.getDate())) {
age--;
}
return age;
}
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