Commit 3c15fa64 authored by Mac's avatar Mac

币种

parent 61239cc9
......@@ -14,10 +14,13 @@
"axios": "^0.18.1",
"core-js": "^3.6.5",
"element-ui": "^2.14.1",
"js-md5": "^0.7.3",
"lockr": "^0.8.5",
"quasar": "^1.0.0",
"vue-easytable": "^1.7.2",
"vue-i18n": "^8.0.0",
"xlsx": "^0.16.8"
"xlsx": "^0.16.8",
"xlsx-style": "^0.8.13"
},
"devDependencies": {
"@quasar/app": "^2.0.0",
......
......@@ -5,8 +5,11 @@ import Erpindex from '../utils/erpindex'
import axios from 'axios'
import 'vue-easytable/libs/themes-base/index.css'
import {VTable,VPagination} from 'vue-easytable'
import commonUtils from '../pages/financial/utils/commonUtils'
Vue.http = Vue.prototype.$http = axios
Vue.commonUtils = Vue.prototype.$commonUtils=commonUtils
Vue.use(ElementUI)
Vue.use(Erpindex)
......
......@@ -1860,16 +1860,16 @@
if(this.msg.LineId==-5){
this.msg.DataType="6";
}
let userInfo = this.getLocalStorage();
if((","+userInfo.ActionMenuCode+",").indexOf(',F_Query_TicketTeamRevenueReport,')!=-1){
this.isShowType = false;
this.msg.DataType='2';
}else{
if((","+userInfo.ActionMenuCode+",").indexOf(',F_Query_LocalTeamRevenueReport,')!==-1){
this.isShowGrounding = false;
this.msg.DataType='6';
}
}
// let userInfo = this.getLocalStorage();
// if((","+userInfo.ActionMenuCode+",").indexOf(',F_Query_TicketTeamRevenueReport,')!=-1){
// this.isShowType = false;
// this.msg.DataType='2';
// }else{
// if((","+userInfo.ActionMenuCode+",").indexOf(',F_Query_LocalTeamRevenueReport,')!==-1){
// this.isShowGrounding = false;
// this.msg.DataType='6';
// }
// }
},
components: {},
......@@ -1881,13 +1881,13 @@
cH = allH - 350 - 52;
this.msg.pageSize = parseInt(cH / 30) - 1;
let userInfo = this.getLocalStorage();
this.getCompanyMsg.RB_Group_Id = userInfo.RB_Group_id; //集团ID
this.userId = userInfo.EmployeeId;
this.getCompanyMsg.RB_Group_Id = userInfo.Group_Id; //集团ID
this.userId = userInfo.Id;
this.getCompanyList();
this.getLineList();
this.getStartList1();
this.getPageList();
this.GetSupperOrderEditAuth();
// this.GetSupperOrderEditAuth();
},
methods: {
GetSupperOrderEditAuth() {
......
<style scoped>
.currentManage .addCompany {width: 440px;height: 100%}
/* 币种管理 */
.cm_content{padding:0;overflow-x: auto;}
.cmc_item{float: left;width:212px;height: 195px;background:rgba(255,255,255,1);border-radius:4px;overflow: hidden;margin-right: 12px;margin-bottom: 15px;border: 1px solid #ebebeb}
.cmci_top{background-color: #3AD892;padding: 14px 20px;font-size: 14px;color: #009251}
.cmci_top p span:nth-child(2){display: inline-block;padding: 2px 5px;font-size: 12px;color: #FFFFFF;background-color: #02AE62;border-radius:4px;margin-left: 5px;vertical-align:top;}
.cmci_cen{padding: 14px 20px;color: #666666;font-size: 12px}
.cmci_cen p{padding: 4px 0;}
.cmci_cen p .fr{font-weight: bold;font-family: "PingFangSC-fine";color: #333333}
.cmci_cen p .icon-shuaxin{background-color: #E7E7E7;color: #999999;display: inline-block;margin-left: 5px;border-radius: 50%;font-size: 12px;transform: rotate(60deg);cursor: pointer;transition: all linear 0.2s;width: 12px;height: 12px;line-height: 12px;}
.cmci_cen p .icon-shuaxin:hover{background-color: #E95252;color: white;}
.fc_green{color: #47BF8C !important}
.fc_red{color: #E95252 !important}
.cmci_bot{padding:0 20px 20px 20px;font-size: 12px !important;text-align: center}
.cmci_bot .el-button-group .el-button{padding: 4px;}
.cmci_bot .el-button{font-size: 12px !important}
.cmc_item:hover{box-shadow:0px 0px 20px rgba(191,191,191,1);transition: all linear 0.5s;}
._benwei{background-color: #2AAEF2!important;color: #0877B0!important}
._benweiA{background-color: #0F80BA!important}
._underline{text-decoration: underline;cursor: pointer;}
.currentManage ._vMG_edit{overflow: auto;display: none;position:absolute;font-family: 'PingFangSc-Fine';bottom:0;left: 0;border-top:1px solid #d1d1d1;background-color:#FFFFFF;padding: 10px;width: 100%;}
.currentManage ._vMG_edit ._tit{padding-left: 10px;border-left: 3px solid #E95252; font-size: 16px;color: #000000}
.currentManage ._vMG_edit ._tit span{color: #666666;font-size: 14px;}
._edHeight{height:740px;}
.edHeight{display: block !important;height: 230px;}
._scrollbar::-webkit-scrollbar{width: 4px;height: 8px;}
._scrollbar::-webkit-scrollbar-thumb{border-radius: 4px;box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.2);background: #c9c9c9;}
._scrollbar::-webkit-scrollbar-track{box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.2);border-radius: 4px;background: #EDEDED;}
.currentManage ._info_box ul{margin-top: 15px}
.currentManage ._info_box ul li{float: left; width: 250px;}
._max_width{max-width: 100px; overflow:hidden;text-overflow: ellipsis;white-space: nowrap;display: inline-block;vertical-align:top;}
._yingkui{height: 40px;line-height: 40px;font-size: 12px;color: #666666}
._tips{font-size: 12px;color: #666666;padding: 15px 0}
.currentManage .po_content{
border-collapse: collapse;
}
.currentManage .po_content{
width: 100%;
}
.currentManage .po_content tr:first-child{
font-size: 12px;
color: #666666;
background-color: #DCDCDC;
}
.currentManage .po_content tr th,.currentManage .po_content tr td{
padding: 10px 20px;
text-align: left;
}
.currentManage .po_content tr td{
color: #333333;
font-size: 14px;
border:1px solid #E6E6E6;
}
.currentManage .po_content tr td .iconfont{
font-size: 14px;
padding: 4px;
}
.currentManage .query-box .iconfont{
cursor: pointer;
background-color: #E95252;
color: white;
width: 30px;
height: 30px;
display: inline-block;
text-align: center;
line-height: 30px;
border-radius: 50%;
margin-left: 10px;
}
.currentManage ._yuan{
width:12px;
height:12px;
background:rgba(233,82,82,1);
border-radius:50%;
display: inline-block;
}
.currentManage ._yuan._yuan_red{
background:#47BF8C;
}
._flex_rete{
cursor: pointer;
}
.display_none{
opacity: 0;
}
._flex_rete .icon-qiehuan{
background-color: #E5E5E5;
color: white;
height: 20px;
width: 20px;
border-radius: 50%;
text-align: center;
font-size: 12px;
padding: 0 !important;
line-height: 20px;
float: right;
}
._flex_rete .icon-qiehuan:hover{
background-color: rgba(233,82,82,1);
color: white;
}
</style>
<template>
<div class="flexOne currentManage">
<div class="query-box">
<ul>
<li>
<span>
<em>{{$t('system.table_currencyName')}}</em>
<el-input placeholder="" class="w210" v-model="msg.Name"></el-input>
</span>
</li>
<li>
<span>
<em>{{$t('system.table_currencyCode')}}</em>
<el-input placeholder="" class="w210" v-model="msg.Code"></el-input>
</span>
</li>
<li>
<button class="hollowFixedBtn" @click="resetPageIndex(),initTableInfo()">{{$t('pub.searchBtn')}}</button>
<button class="normalBtn" @click="addShow=true,addCuren=true" >{{$t('system.btn_addCoin')}}</button>
<el-tooltip class="item" effect="dark" :content="$t('fnc.qhpaiban')" placement="top-end">
<i v-if="transitionShow" class="iconfont icon-biaoge" @click="switchMethod(1)"></i>
<i v-if="transitionShow2" class="iconfont icon-icon-ssan" @click="switchMethod(2)"></i>
</el-tooltip>
</li>
</ul>
</div>
<div class="cm_content _scrollbar" :class="addShow==true?'_edHeight':''">
<p class="_tips">{{$t('tips.sxhuilv')}}</p>
<div class="clearfix" v-if="transitionShow" v-loading="loading2">
<div class="cmc_item" v-for="(item,index) in tableInfo">
<div class="cmci_top" :class="item.IsStandardCurrency==1?'':'_benwei'">
<p>
<el-tooltip class="item" effect="dark" :content="item.Name+item.Code" placement="top-start">
<span class="_max_width">{{item.Name}}{{item.Code}}</span>
</el-tooltip>
<span :class="item.IsStandardCurrency==1?'':'_benweiA'">{{item.StandardCurrency}}</span>
</p>
</div>
<div class="cmci_cen">
<p class="clearfix"><span class="fl">{{$t('fnc.benqihuilv')}}</span><span class="fr">{{item.Rate}}</span></p>
<p class="clearfix"><span class="fl">{{$t('fnc.danqgianhuilv')}} <i class="iconfont icon-shuaxin" v-if="item.IsStandardCurrency!=1" @click="getCurrentRate(item.ID,index)"></i></span><span class="fr fc_green">{{item.CurrentRate}}</span></p>
<p class="clearfix"><span class="fl">{{$t('fnc.zjinyue')}}</span><span class="fr _underline" @click="goUrl('FineBalance',item.ID,item.Name)">{{item.Money}}</span></p>
</div>
<div class="cmci_bot">
<el-button-group>
<el-button type="primary" @click="editCurency(item.ID)">{{$t('pub.updateMsg')}}</el-button>
<el-button type="danger" @click="financeinfoRemove(item.ID,item.Name)">{{$t('system.table_delete')}}</el-button>
<el-button type="warning" v-if="item.IsStandardCurrency!=1" @click="setStandardTips(item.ID,item.Name)">{{$t('fnc.benwei')}}</el-button>
</el-button-group>
</div>
</div>
</div>
<table class="po_content singeRowTable" style="border:1px solid #E6E6E6;" cellspacing="0" cellpadding="0" v-if="transitionShow2" v-loading="loading2">
<tr>
<th>{{$t('system.table_currencyName')}}</th>
<th>{{$t('system.table_currencyCode')}}</th>
<th>{{$t('fnc.sfbenweibi')}}</th>
<th>{{$t('fnc.chushihuilv')}}</th>
<th>{{$t('fnc.benqihuilv')}}</th>
<th>现钞卖出价</th>
<!-- <th>现汇买入价</th> -->
<th>现钞买入价</th>
<!-- <th>现汇卖出价</th> -->
<th>上调汇率</th>
<th>{{$t('fnc.zjjiner')}}</th>
<th>{{$t('system.table_operation')}}</th>
</tr>
<tr v-for="(item,index) in tableInfo" :key="index">
<td>{{item.Name}}</td>
<td>{{item.Code}}</td>
<td>
<span class="_yuan" :class="item.IsStandardCurrency==1?'':'_yuan_red'" v-if="item.Type!=1"></span>
</td>
<td >
{{item.Rate}}
</td>
<td>{{item.CurrentRate}}</td>
<td class="_flex_rete">
<span>{{item.CurrentRate}}</span>
<span :class="item.IsStandardCurrency!=1?'':'display_none'" @click="getCurrentRate(item.ID,index)" class="iconfont icon-qiehuan"></span>
</td>
<!-- <td>{{item.InCashRate}}</td> -->
<td>{{item.OutCashRate}}</td>
<!-- <td>{{item.OutRemitRate}}</td> -->
<td>{{item.ExchangeRates}}</td>
<td><span class="_underline" @click="goUrl('FineBalance',item.ID,item.Name)">{{item.Money}}</span></td>
<td>
<el-button-group size='mini'>
<el-tooltip class="item" effect="dark" :content="$t('system.table_edit')" placement="top-start">
<el-button type="primary" class="iconfont icon-bianji-smal" @click="editCurency(item.ID),text=$t('system.table_edit')"></el-button>
</el-tooltip>
<el-tooltip class="item" effect="dark" :content="$t('system.table_delete')" placement="top-start">
<el-button type="danger" class="iconfont icon-img_delete_small" @click="financeinfoRemove(item.ID,item.Name)"></el-button>
</el-tooltip>
<el-tooltip class="item" effect="dark" :content="$t('fnc.szbweibi')" placement="top-start">
<el-button type="warning" class="iconfont" v-if="item.IsStandardCurrency!=1" @click="setStandardTips(item.ID,item.Name)">{{$t('Airticket.Air_ben')}}</el-button>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="历史汇率" placement="top-start">
<el-button type="warning" class="iconfont" @click="GoUrlHis('HistoryRateQuery',item)"></el-button>
</el-tooltip>
</el-button-group>
</td>
</tr>
</table>
<div class="noData" v-show="noData">
{{$t('system.content_noData')}}
</div>
<div>
<el-pagination
background
@current-change="handleCurrentChange"
:current-page.sync="currentPage"
layout="total,prev, pager, next, jumper"
:page-size=msg.pageSize
:total=total>
</el-pagination>
</div>
</div>
<div class="_vMG_edit" :class="addShow==true?'edHeight':''">
<p class="_tit">新增</p>
<el-form class="_info_box clearfix" :model="addMsg" ref="addMsg" :rules="rules" label-width="100px">
<ul class="clearfix" >
<li>
<el-form-item :label="$t('fnc.b_hbmingcheng')" prop="Name">
<el-input v-model="addMsg.Name" class="w135"></el-input>
</el-form-item>
</li>
<li>
<el-form-item :label="$t('fnc.b_hbdaima')" prop="Code">
<el-input v-model="addMsg.Code" class="w135"></el-input>
</el-form-item>
</li>
<li v-if="ed==false">
<el-form-item :label="$t('fnc.b_cshuilv')" prop="Rate">
<el-input v-model="addMsg.Rate" class="w135"></el-input>
</el-form-item>
</li>
<li v-else>
<el-form-item :label="$t('fnc.b_cshuilv')" prop="Rate">
<el-input v-model="addMsg.Rate" disabled class="w135"></el-input>
</el-form-item>
</li>
<li>
<el-form-item label="上调汇率" prop="ExchangeRates">
<el-input v-model="addMsg.ExchangeRates" class="w135"></el-input>
</el-form-item>
</li>
<li>
<el-form-item :label="$t('fnc.sfbenweibi')+ ':'">
<el-switch v-model="addMsg.IsStandardCurrency"
active-value='1'
inactive-value='0'
active-color="#4BCA81"
size=mini></el-switch>
</el-form-item>
</li>
</ul>
</el-form>
<div>
<ul class="clearfix" style="text-align: right;">
<li class="_add_saveBtn" style="float: initial;" >
<button type="button" class="normalBtn" @click="submitForm('addMsg',1)">{{$t('pub.saveBtn')}}</button>
<button class="hollowFixedBtn" type="button" @click="cancelEdit(),resetForm('addMsg')">{{$t('pub.cancelBtn')}}</button>
</li>
</ul>
</div>
</div>
<div class="_vMG_edit" :class="addCuren==false?'edHeight':''">
<p class="_tit">{{$t('fnc.qmtiaohui')}}</p>
<el-form class="_info_box clearfix" :model="SetProfitLossMsg" ref="SetProfitLossMsg" :rules="rules" label-width="100px">
<ul class="clearfix">
<li>
<el-form-item :label="$t('fnc.b_qchuilv')">
<el-input v-model="SetProfitLossMsg.initRate" disabled="" class="w135"></el-input>
</el-form-item>
</li>
<li>
<el-form-item :label="$t('fnc.qmhuilv')" prop="EndRate">
<el-input v-model="SetProfitLossMsg.EndRate" @change="Calculation()" class="w135"></el-input>
</el-form-item>
</li>
<li>
<el-form-item :label="$t('fnc.xzqishu')" prop="TermNum">
<el-date-picker
class="w135"
:picker-options="pickerOptions1"
v-model="SetProfitLossMsg.TermNum"
value-format="yyyy-MM-dd"
type="month"
:laceholder="$t('admin.admin_choDate')">
</el-date-picker>
</el-form-item>
</li>
<li class="_yingkui">
<p v-if="moneyDate.ProfitLoss<0">{{$t('fnc.yingkui')}}<span class="fc_red">{{moneyDate.ProfitLoss}}</span></p>
<p v-if="moneyDate.ProfitLoss>0">{{$t('fnc.yingli')}}<span class="fc_green">{{moneyDate.ProfitLoss}}</span></p>
<p v-if="moneyDate.ProfitLoss==0">{{$t('fnc.yingkui')}}<span class="fc_green">0</span></p>
</li>
</ul>
</el-form>
<div>
<ul class="clearfix" style="text-align: right;">
<li class="_add_saveBtn" style="float: initial;" >
<button type="button" class="normalBtn" @click="submitForm('SetProfitLossMsg',2)">{{$t('fnc.qrtijiao')}}</button>
<button class="hollowFixedBtn" type="button" @click="cancelEdit(),resetForm('SetProfitLossMsg')">{{$t('pub.cancelBtn')}}</button>
</li>
</ul>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
msg:{
pageIndex:1,
pageSize:14,
Name:'',
Code:''
},
addMsg:{
ID:0,
Name:'',
IsStandardCurrency:'0',
Code:'',
Rate:'',
ExchangeRates:''
},
SetProfitLossMsg:{
ID:0,
AccountID:0,
EndRate:'',
TermNum:'',
CurrencyId:'',
initRate:'',
Money:'',
ProfitLoss:0,
},
moneyDate:{
Money : 0,
LastR : 0,
currentR : 0,
LastM : 0,
currentM : 0,
ProfitLoss : 0
},
total:0,
currentPage: 1,
loading2:true,
airlineList:'',
tableInfo:'',
addShow:false,
addCuren:true,
ed:false,
noData:false,
dialogTitle: '',
deleteID:'',
ProfitLossList:[],
pickerOptions1:{
disabledDate(time) {
// return time.getTime()==time.getTime();
}
},
rules: {//表单必填验证
Name: [
{ required: true, message: this.$t('rule.qtxhbmingcheng'), trigger: 'blur' }
],
Code: [
{ required: true, message: this.$t('rule.qtxhbdaima'), trigger: 'blur' }
],
Rate:[
{ required: true, message: this.$t('rule.qsrhuilv'), trigger: 'blur' }
],
TermNum:[
{ required: true, message: this.$t('rule.qxzqishu'), trigger: 'blur' }
],
EndRate:[
{ required: true, message: this.$t('rule.qtxqmhuilv'), trigger: 'blur' }
]
},
transitionShow:false,
transitionShow2:true,
contenWidth:0,
contenHeight:0,
tableSize:0,
blockSize:0,
}
},created(){
let allH,allW,cH,cW;
allH = document.documentElement.clientHeight;
allW = document.documentElement.clientWidth;
cW = allW-90;
cH = allH-260; // = 50 40 75 46 49
this.contenWidth = cW;
this.contenHeight = cH;
console.log(cW,cH)
this.tableSize = this.msg.pageSize = parseInt(cH/45);
},
methods: {
GoUrlHis(path,item){
this.$router.push({
name: path,
query: {
blank: "y",
CurrencyId: item.ID
}
});
},
switchMethod(t){
this.msg.pageIndex = 1;
if(t===1){
this.transitionShow = false;
this.transitionShow2 = true;
this.msg.pageSize = this.tableSize;
this.initTableInfo();
}else if(t===2){
this.transitionShow = true;
this.transitionShow2 = false;
// 宽 220 高 153
let cont = parseInt(this.contenWidth/220) * parseInt(this.contenHeight/153);
this.msg.pageSize = cont-1;
this.initTableInfo();
}
},
getProfitLossList(id){// 获取禁用时间
this.apipost('FinanceInfo_post_GetProfitLossList',{CurrencyId:id}, res => {
if(res.data.resultCode == 1) {
this.ProfitLossList = res.data.data
// new Date(this.ProfitLossList[0].TermNum).getTime()
} else {
this.tips(res.data.message,'error');
}
}, err => {})
},
regNum(n,t){ // 判断数字 n 值 t 类型
let reg = /^\d+(\.\d{0,6})?$/
if(!n)return 0
if(t==2){
if(reg.test(n)){
return Number(n)
}
return 0;
}else if(t==1){
if(reg.test(n)){
return Number(n)
}
return 0
}
},
Calculation(){ // 计算盈亏
this.moneyDate.Money = this.regNum(this.SetProfitLossMsg.Money,1),
this.moneyDate.LastR = this.regNum(this.SetProfitLossMsg.initRate,1),
this.moneyDate.currentR = this.regNum(this.SetProfitLossMsg.EndRate,2),
this.moneyDate.LastM = 0,
this.moneyDate.currentM = 0,
this.moneyDate.ProfitLoss = ((this.moneyDate.currentR-this.moneyDate.LastR)*this.moneyDate.Money).toFixed(2);
},
financeinfoRemove(id,text){ // 删除货币
this.$confirm(this.$t('tips.qrsc')+text+this.$t('tips.huobi'), this.$t('tips.tips'), {
confirmButtonText: this.$t('pub.sureBtn'),
cancelButtonText: this.$t('pub.cancelBtn'),
type: 'warning'
}).then(() => {
this.apipost('financeinfo_post_Remove',{ID:id}, res => {
if(res.data.resultCode == 1) {
this.initTableInfo()
this.tips(res.data.message,'success');
} else {
this.tips(res.data.message,'error');
}
}, err => {})
}).catch(() => {
this.$message({
type: 'info',
message: this.$t('hotel.hotel_HasBeenCancelled')
});
});
},
editCurency(id){ // 修改货币信息
this.apipost('financeinfo_post_Get',{ID:id}, res => {
if(res.data.resultCode == 1) {
this.addMsg = res.data.data
this.addMsg.IsStandardCurrency = this.addMsg.IsStandardCurrency.toString()
this.addShow = true
this.ed = true
} else {
this.tips(res.data.message,'error');
}
}, err => {})
},
cancelEdit(t){ // 取消修改、新增
this.addMsg = {
ID:0,
Name:'',
IsStandardCurrency:0,
Code:'',
Rate:''
}
this.SetProfitLossMsg={
ID:0,
EndRate:'',
TermNum:'',
CurrencyId:'',
initRate:'',
Money:''
}
if(!t){
this.addShow=false
this.ed = false
this.addCuren = true
}
},
setStandardTips(id,text){ // 设置本位币提示
this.$confirm(this.$t('tips.qrszwbwbb')+text, this.$t('tips.tips'), {
confirmButtonText: this.$t('pub.sureBtn'),
cancelButtonText: this.$t('pub.cancelBtn'),
type: 'warning'
}).then(() => {
this.setStandard(id)
}).catch(() => {
this.$message({
type: 'info',
message: this.$t('hotel.hotel_HasBeenCancelled')
});
});
},
setStandard(id){ //设置本位币
this.apipost('financeinfo_post_SetStandard',{ID:id}, res => {
if(res.data.resultCode == 1) {
this.tips(res.data.message,'success');
this.initTableInfo();
} else {
this.tips(res.data.message,'error');
}
}, err => {})
},
getCurrentRate(id,index){// 更新汇率
this.apipost('financeinfo_post_GetCurrentRate',{ID:id}, res => {
if(res.data.resultCode == 1) {
this.tips(res.data.message,'success');
this.initTableInfo()
} else {
this.tips(res.data.message,'error');
}
}, err => {})
},
initTableInfo(){
this.tableInfo = [];
this.loading2 = true;
this.apipost('financeinfo_post_GetPageList',this.msg, res => {
if(res.data.resultCode == 1) {
let data = res.data.data.pageData;
this.total = res.data.data.count;
this.loading2 = false;
if(this.total>0){
this.noData =false;
}else{
this.noData =true;
}
data.forEach(x=>{
x.YMoney = x.Money
x.Money = this.$commonUtils.addCommas(x.Money.toFixed(2))
if(x.ProfitLossMoney>0)
x.ProfitLossMoneyS = this.$commonUtils.addCommas(x.ProfitLossMoney.toFixed(2))
})
this.tableInfo = data
} else {
this.tips(res.data.message,'error');
}
}, err => {this.loading2 = false;})
},
handleCurrentChange(val) {
this.msg.pageIndex = val;
this.initTableInfo();
},
resetPageIndex(){
this.msg.pageIndex=1;
this.currentPage = 1
},
SetProfitLoss(){ //币种调汇
this.apipost('FinanceInfo_post_SetProfitLoss',this.SetProfitLossMsg, res => {
if(res.data.resultCode == 1) {
this.tips(res.data.message,'success');
this.initTableInfo();
this.addShow =false
this.addCuren = true
this.ed =0
} else {
this.tips(res.data.message,'error');
}
}, err => {})
},
addFlightmodule(){ //添加币种
this.apipost('financeinfo_post_Set',this.addMsg, res => {
if(res.data.resultCode == 1) {
this.tips(res.data.message,'success');
this.initTableInfo();
this.addShow =false
this.ed =false
this.cancelEdit()
} else {
this.tips(res.data.message,'error');
}
}, err => {})
},
updateInfo(ID){ //修改模板信息
let msg = {
ID:ID
}
this.apipost('currency_get_Get', msg, res => {
if(res.data.resultCode == 1) {
this.addMsg = res.data.data;
} else {
}
}, err => {})
},
isdelete(ID){
this.deleteID = ID;
this.$confirm(this.$t('tips.shifoushanchu'), this.$t('tips.tips'), {
confirmButtonText: this.$t('pub.sureBtn'),
cancelButtonText: this.$t('pub.cancelBtn'),
type: 'warning'
}).then(() => {
this.$message({
type: 'success',
message: this.$t('tips.shanchuchenggong')
});
this.delInfo();
}).catch(() => {
this.$message({
type: 'info',
message: this.$t('hotel.hotel_HasBeenCancelled')
});
});
},
delInfo(){
let msg = {
ID:this.deleteID
}
this.apipost('currency_post_Remove', msg, res => {
if(res.data.resultCode == 1) {
this.tips(this.$t('tips.shanchuchenggong'),'success');
this.innerVisible = false;
this.initTableInfo();
} else {
this.tips(this.$t('tips.shanchushibai'),'success');
}
}, err => {})
},
submitForm(addMsg,type) {//提交创建、修改表单
let that = this;
that.$refs[addMsg].validate((valid) => {
if (valid) {
if(type==1){
that.addFlightmodule()
}else{
that.SetProfitLoss()
}
} else {
return false;
}
});
},
resetForm(formName) {//弹出框取消 初始化谈框内表单
this.$refs[formName].resetFields();
},
tips(msg,type) {
this.$message({
message: msg,
duration:2000,
type: type
});
},
goUrl (path,id,name) {
this.$router.push({ name: path,query:{"id":id,'name':name} })
}
},
mounted(){
this.initTableInfo();
}
}
</script>
var commonUtils = {
//json数组求和
CaluJsonArraySum: function (arr, filed, num) {
var sum = 0;
arr.forEach(item => {
if (item.hasOwnProperty(filed)) {
sum += Number(item[filed]);
}
});
return sum.toFixed(num);
},
//截取阿里返回文件路径
GetALiFileUrl: function (str) {
var newStr = str;
if (newStr.indexOf("?") != -1) {
newStr = newStr.split("?")[0];
}
return newStr;
},
/*正则表达式*/
Regex: {
isInteger: /[^\d]/g, //输入验证只能为整
el_isInteger: /^[\d]+$/, //element自带验证为整
el_Isdecimal: /^\d+(\.\d{0,2})?$/, //验证只能输入2位小数
el_IsdecimalTrr: /^\d+(\.\d{0,8})?$/, //验证只能输入8位小数
el_IsdecimalAll: /^[0-9]+([.]{1}[0-9]+){0,1}$/, //验证不限小数的
el_ISphone: /^((0\d{2,3}-\d{7,8})|(1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}))$/, //最新验证输入手机号 包括电话号码
el_IsFax: /^[+]{0,1}(\d){1,3}[ ]?([-]?((\d)|[ ]){1,12})+$/, //验证传真号
el_IsInventer: /^(\-|\+?)\d+(\.\d+)?$/, //可以输入带正负号整数
el_IsIDnumber: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/, //验证身份证号
el_IsEnglish: /^[a-zA-Z]/, //只能输入英文
el_IsChinese: /^[\u4E00-\u9FA5]{1,5}$/, //只能输入中文
el_IsNumEn: /^[a-zA-Z0-9]+$/ //输入数字或者字母
},
//文件上传对象
FileObject: function () {
return {
Url: "",
Name: "",
VideoPath: "",
FileType: "", //文件类型
}
},
//实现每三位一个逗号分隔并且保留两位小数
addCommas: function (nStr) {
nStr += '';
let x = nStr.split('.');
let x1 = x[0];
let x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
},
formatMsgTime: function (qdateTime) {
var dateTimeStamp = Date.parse(qdateTime.replace(/-/gi, "/"));
var minute = 1000 * 60;
var hour = minute * 60;
var day = hour * 24;
var month = day * 30;
var now = new Date().getTime();
var diffValue = now - dateTimeStamp;
if (diffValue < 0) {
return;
}
var monthC = diffValue / month;
var weekC = diffValue / (7 * day);
var dayC = diffValue / day;
var hourC = diffValue / hour;
var minC = diffValue / minute;
var result = "";
if (monthC >= 1) {
result = "" + parseInt(monthC) + "月前";
} else if (weekC >= 1) {
result = "" + parseInt(weekC) + "周前";
} else if (dayC >= 1) {
result = "" + parseInt(dayC) + "天前";
} else if (hourC >= 1) {
result = "" + parseInt(hourC) + "小时前";
} else if (minC >= 1) {
result = "" + parseInt(minC) + "分钟前";
} else
result = "刚刚";
return result;
},
formatMsgTime2: function (qdateTime, qdateTime2) {
var dateTimeStamp = Date.parse(qdateTime.replace(/-/gi, "/"));
var minute = 1000 * 60;
var hour = minute * 60;
var day = hour * 24;
var month = day * 30;
var now = new Date(qdateTime2.replace(/-/gi, "/")).getTime();
var diffValue = now - dateTimeStamp;
if (diffValue < 0) {
return;
}
var monthC = diffValue / month;
var weekC = diffValue / (7 * day);
var dayC = diffValue / day;
var hourC = diffValue / hour;
var minC = diffValue / minute;
var result = "";
if (monthC >= 1) {
result = "" + parseInt(monthC) + "月前";
} else if (weekC >= 1) {
result = "" + parseInt(weekC) + "周前";
} else if (dayC >= 1) {
result = "" + parseInt(dayC) + "天前";
} else if (hourC >= 1) {
result = "" + parseInt(hourC) + "小时前";
} else if (minC >= 1) {
result = "" + parseInt(minC) + "分钟前";
} else
result = "刚刚";
return result;
},
changeMoneyToChinese(Num) { // 数字转中文大写
if (!Num) {
return '零'
}
var isNegative = false; // 是否负数
if (Num < 0) {
Num = -Num;
isNegative = true;
}
if (typeof Num == 'number') {
Num = Num.toString();
}
for (var i = Num.length - 1; i >= 0; i--) {
Num = Num.replace(",", ""); // 替换money中的“,”
Num = Num.replace(" ", ""); // 替换money中的空格
}
Num = Num.replace("¥", ""); // 替换掉可能出现的¥字符
if (isNaN(Num)) { // 验证输入的字符是否为数字
return;
}
// ---字符处理完毕,开始转换,转换采用前后两部分分别转换---//
let part = String(Num).split(".");
let newchar = "";
// 小数点前进行转化
for (var i = part[0].length - 1; i >= 0; i--) {
if (part[0].length > 10) {
// alertWarning("位数过大,无法计算");
return "";
} // 若数量超过拾亿单位,提示
let tmpnewchar = "";
let perchar = part[0].charAt(i);
switch (perchar) {
case "0":
tmpnewchar = "零" + tmpnewchar;
break;
case "1":
tmpnewchar = "壹" + tmpnewchar;
break;
case "2":
tmpnewchar = "贰" + tmpnewchar;
break;
case "3":
tmpnewchar = "叁" + tmpnewchar;
break;
case "4":
tmpnewchar = "肆" + tmpnewchar;
break;
case "5":
tmpnewchar = "伍" + tmpnewchar;
break;
case "6":
tmpnewchar = "陆" + tmpnewchar;
break;
case "7":
tmpnewchar = "柒" + tmpnewchar;
break;
case "8":
tmpnewchar = "捌" + tmpnewchar;
break;
case "9":
tmpnewchar = "玖" + tmpnewchar;
break;
}
switch (part[0].length - i - 1) {
case 0:
tmpnewchar = tmpnewchar + "元";
break;
case 1:
if (perchar != 0)
tmpnewchar = tmpnewchar + "拾";
break;
case 2:
if (perchar != 0)
tmpnewchar = tmpnewchar + "佰";
break;
case 3:
if (perchar != 0)
tmpnewchar = tmpnewchar + "仟";
break;
case 4:
tmpnewchar = tmpnewchar + "万";
break;
case 5:
if (perchar != 0)
tmpnewchar = tmpnewchar + "拾";
break;
case 6:
if (perchar != 0)
tmpnewchar = tmpnewchar + "佰";
break;
case 7:
if (perchar != 0)
tmpnewchar = tmpnewchar + "仟";
break;
case 8:
tmpnewchar = tmpnewchar + "亿";
break;
case 9:
tmpnewchar = tmpnewchar + "拾";
break;
}
newchar = tmpnewchar + newchar;
}
// 小数点之后进行转化
if (Num.indexOf(".") != -1) {
if (part[1].length > 2) {
// alertWarning("小数点之后只能保留两位,系统将自动截段");
part[1] = part[1].substr(0, 2);
}
for (var i = 0; i < part[1].length; i++) {
let tmpnewchar = "";
let perchar = part[1].charAt(i);
switch (perchar) {
case "0":
tmpnewchar = "零" + tmpnewchar;
break;
case "1":
tmpnewchar = "壹" + tmpnewchar;
break;
case "2":
tmpnewchar = "贰" + tmpnewchar;
break;
case "3":
tmpnewchar = "叁" + tmpnewchar;
break;
case "4":
tmpnewchar = "肆" + tmpnewchar;
break;
case "5":
tmpnewchar = "伍" + tmpnewchar;
break;
case "6":
tmpnewchar = "陆" + tmpnewchar;
break;
case "7":
tmpnewchar = "柒" + tmpnewchar;
break;
case "8":
tmpnewchar = "捌" + tmpnewchar;
break;
case "9":
tmpnewchar = "玖" + tmpnewchar;
break;
}
if (i == 0)
tmpnewchar = tmpnewchar + "角";
if (i == 1)
tmpnewchar = tmpnewchar + "分";
newchar = newchar + tmpnewchar;
}
}
// 替换所有无用汉字
while (newchar.search("零零") != -1)
newchar = newchar.replace("零零", "零");
newchar = newchar.replace("零亿", "亿");
newchar = newchar.replace("亿万", "亿");
newchar = newchar.replace("零万", "万");
newchar = newchar.replace("零元", "元");
newchar = newchar.replace("零角", "");
newchar = newchar.replace("零分", "");
if (newchar.charAt(newchar.length - 1) == "元" || newchar.charAt(newchar.length - 1) == "角") {
newchar = newchar + "整";
}
if (isNegative) {
newchar = '负' + newchar;
}
return newchar;
},
createComprisonFunction(propertyName) {
return function (object1, object2) {
var value1 = object1[propertyName];
var value2 = object2[propertyName];
if (value1 < value2) {
return -1;
} else if (value1 > value2) {
return 1;
} else {
return 0;
}
};
},
//价格转换器
getConvertMoney(value) {
if (value === "" || value === undefined || value === null) {
value = 0.0
}
return parseFloat(value)
},
//两个日期比较大小 返回值大于0:date1>date2,返回值等于0:date1=date2,返回值小于0:date1<date2
CompareDate(date1, date2) {
var oDate1 = new Date(date1);
var oDate2 = new Date(date2);
if (oDate1.getTime() > oDate2.getTime()) {
return 1
} else if (oDate1.getTime() == oDate2.getTime()) {
return 0;
} else {
return -1;
}
},
//判断值是否为空
isNullOrEmpty: function (value) {
if (value === null || value === "" || value === undefined) {
return true;
} else {
return false;
}
},
//NULL转字符串
getStrValue: function (value) {
if (value == null) {
value = "";
}
return value;
},
//获取后面的字符串
getCaption: function (obj, splitStr) {
var index = obj.lastIndexOf(splitStr);
obj = obj.substring(index + 1, obj.length);
return obj;
},
//公用去掉域名
removeDomain: function (val) {
var reg = /^http(s)?:\/\/(.*?)\//;
return val.replace(reg, '');
},
//获取当前日期
getCurrentDate() {
var myDate = new Date();
//返回年月日
return myDate.getFullYear() + '-' + parseInt(myDate.getMonth() + 1) + "-" + myDate.getDate()
},
//格式化日期
getFormatDate(dateStr) {
var myDate = new Date(dateStr);
//返回年月日
return myDate.getFullYear() + '-' + parseInt(myDate.getMonth() + 1) + "-" + myDate.getDate()
},
//判断字符串是否为数字
isNumber: function (val) {
var regPos = /^\d+(\.\d+)?$/; //非负浮点数
var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数
if (regPos.test(val) || regNeg.test(val)) {
return true;
} else {
return false;
}
},
//去掉图片的https
replaceHttps: function (val) {
return val.replace("https", "http");
},
//计算两日期时间间隔
getDateTimeInterval: function (startDate, endDate) {
var diff = endDate.getTime() - startDate.getTime(); //时间差的毫秒数
//计算出相差天数
var days = Math.floor(diff / (24 * 3600 * 1000));
//计算出小时数
var leave1 = diff % (24 * 3600 * 1000); //计算天数后剩余的毫秒数
var hours = Math.floor(leave1 / (3600 * 1000));
//计算相差分钟数
var leave2 = leave1 % (3600 * 1000); //计算小时数后剩余的毫秒数
var minutes = Math.floor(leave2 / (60 * 1000));
//计算相差秒数
var leave3 = leave2 % (60 * 1000); //计算分钟数后剩余的毫秒数
var seconds = Math.round(leave3 / 1000);
var returnStr = seconds + "秒";
if (minutes > 0) {
returnStr = minutes + "分" + returnStr;
}
if (hours > 0) {
returnStr = hours + "小时" + returnStr;
}
if (days > 0) {
returnStr = days + "天" + returnStr;
}
return returnStr;
},
//将yyyy年mm月dd日 hh:mm:ss 转换为 yyyy-mm-dd hh:mm:ss
getDateStr(date) {
let dateStr = "";
if (date != "") {
let dateArr = date.split(' ');
let str = dateArr[0].replace(/[^\d]/g, '-');
dateStr = str.substr(0, str.length - 1) + ' ' + dateArr[1];
}
return dateStr;
},
/**
* 增加减少天数
* date:可以不传
* day:正数
*/
AddDay(date, day) {
var myDate = "";
if (date) {
myDate = new Date(date);
} else {
myDate = new Date();
}
myDate = myDate.setDate(myDate.getDate() + day);
myDate = new Date(myDate);
var seperator1 = "-";
var year = myDate.getFullYear();
var month = myDate.getMonth() + 1;
var strDate = myDate.getDate();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
var currentdate = year + seperator1 + month + seperator1 + strDate;
return currentdate;
}
}
export default commonUtils
......@@ -92,6 +92,11 @@ const routes = [{
component: () =>
import("pages/financial/institutionsManagement.vue")
},
{
path: "/financial/currencyManagement", //币种管理
component: () =>
import("pages/financial/currencyManagement.vue")
},
{
path: "/test", //API测试
component: () =>
......
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