|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <view class="container cashier" @touchmove.stop.prevent="discard" @tap="hideKeyboard" v-show="isRepuest">
|
|
|
+ <view class="container cashier" v-show="isRepuest">
|
|
|
<cu-custom :navbar-data='nvabarData' @navigateBack="hanldNavigateBack"></cu-custom>
|
|
|
<view class="container-cash clearfix" :style="{marginTop:CustomBar+'px'}">
|
|
|
<view class="container-wrapper">
|
|
@@ -7,16 +7,16 @@
|
|
|
<view class="pay-top">
|
|
|
<view class="pay-paid">
|
|
|
<text class="txt-m">待付金额</text>
|
|
|
- <text class="txt-b"><text class="small">¥</text>{{payableAmount.toFixed(2)}}</text>
|
|
|
+ <text class="txt-b"><text class="small">¥</text>{{payableAmount | NumFormat}}</text>
|
|
|
</view>
|
|
|
<view class="pay-payd">
|
|
|
<view class="pay-paids">
|
|
|
<text class="txt-m">应付总额</text>
|
|
|
- <text class="txt-b">¥{{payTotalFee.toFixed(2)}}</text>
|
|
|
+ <text class="txt-b">¥{{payableAmount | NumFormat}}</text>
|
|
|
</view>
|
|
|
<view class="pay-paids">
|
|
|
<text class="txt-m">已支付金额</text>
|
|
|
- <text class="txt-b">¥{{receiptAmount.toFixed(2)}}</text>
|
|
|
+ <text class="txt-b">¥{{receiptAmount | NumFormat}}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -30,23 +30,23 @@
|
|
|
</view> -->
|
|
|
<input class="input"
|
|
|
type="digit"
|
|
|
- v-model="payAmount"
|
|
|
- @focus="focusInput"
|
|
|
- @blur="blurInput"
|
|
|
+ v-model="payAmount"
|
|
|
+ @focus="focusInput"
|
|
|
+ @blur="blurInput"
|
|
|
placeholder="输入金额不能大于待付金额"
|
|
|
placeholder-class="placeholder"/>
|
|
|
</view>
|
|
|
<view class="bot-resid">
|
|
|
- <text>应付剩余¥{{balanceAmount.toFixed(2)}}</text>
|
|
|
+ <text>应付剩余¥{{balanceAmount|NumFormat}}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="pay-record">
|
|
|
+ <view class="pay-record" :style="{paddingBottom:isIphoneX ? '156rpx' : '112rpx'}">
|
|
|
<view class="record-title"><text>支付记录</text></view>
|
|
|
<view class="record-list">
|
|
|
<view class="list-main" v-if="discernReceipt.length>0">
|
|
|
<view class="list-item" v-for="(item,index) in discernReceipt" :key="index">
|
|
|
- <text class="text row-1">¥{{item.receiptAmount}}</text>
|
|
|
+ <text class="text row-1">¥{{item.receiptAmount | NumFormat}}</text>
|
|
|
<text class="text row-2">{{payTypeText(item.payType)}}</text>
|
|
|
<text class="text row-3">{{item.receiptDate}}</text>
|
|
|
</view>
|
|
@@ -55,7 +55,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="pay-button">
|
|
|
+ <view class="pay-button" :style="{paddingBottom:isIphoneX ? '68rpx' : '24rpx'}">
|
|
|
<view class="btn" @click.stop="buttonSubMit" :style="{'background':btnColor}">{{buttonText}}</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -64,7 +64,7 @@
|
|
|
<view class="freight-alert" @tap="hideTips">
|
|
|
<view class="content">
|
|
|
<view class="title">
|
|
|
- <text>生成链接</text>
|
|
|
+ <text>支付链接</text>
|
|
|
<text class="iconfont icon-iconfontguanbi" @click.stop="hideTips"></text>
|
|
|
</view>
|
|
|
<view class="text-content">
|
|
@@ -77,10 +77,10 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 数字键盘 -->
|
|
|
-<!-- <keyboard v-if="showDigitKeyboard"
|
|
|
- @confirmEvent="confirmEvent"
|
|
|
- :money.sync="payAmount"
|
|
|
- btn-color='linear-gradient(135deg,rgba(242,143,49,1) 0%,rgba(225,86,22,1) 100%)'
|
|
|
+<!-- <keyboard v-if="showDigitKeyboard"
|
|
|
+ @confirmEvent="confirmEvent"
|
|
|
+ :money.sync="payAmount"
|
|
|
+ btn-color='linear-gradient(135deg,rgba(242,143,49,1) 0%,rgba(225,86,22,1) 100%)'
|
|
|
title="完成">
|
|
|
</keyboard> -->
|
|
|
</view>
|
|
@@ -98,6 +98,7 @@
|
|
|
return{
|
|
|
orderID:'',
|
|
|
payType:'',
|
|
|
+ payWay:'',
|
|
|
isRepuest:false,
|
|
|
payableAmount:0,
|
|
|
receiptAmount:0,
|
|
@@ -126,6 +127,28 @@
|
|
|
onLoad(option) {
|
|
|
this.initData(option)
|
|
|
},
|
|
|
+ filters: {
|
|
|
+ NumFormat(value) {
|
|
|
+ if(!value) return '0.00';
|
|
|
+ /*原来用的是Number(value).toFixed(0),这样取整时有问题,例如0.51取整之后为1,感谢Nils指正*/
|
|
|
+ /*后来改成了 Number(value)|0,但是输入超过十一位就为负数了,具体见评论 */
|
|
|
+ var intPart = Number(value) - Number(value)%1; //获取整数部分(这里是windy93的方法)
|
|
|
+ var intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'); //将整数部分逢三一断
|
|
|
+ var floatPart = ".00"; //预定义小数部分
|
|
|
+ var value2Array = value.toString().split(".");
|
|
|
+ //=2表示数据有小数位
|
|
|
+ if(value2Array.length == 2) {
|
|
|
+ floatPart = value2Array[1].toString(); //拿到小数部分
|
|
|
+ if(floatPart.length == 1) { //补0,实际上用不着
|
|
|
+ return intPartFormat + "." + floatPart + '0';
|
|
|
+ } else {
|
|
|
+ return intPartFormat + "." + floatPart;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return intPartFormat + floatPart;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
methods:{
|
|
|
initData(e){
|
|
|
this.payType = e.type
|
|
@@ -133,10 +156,12 @@
|
|
|
this.orderID = e.orderID
|
|
|
switch(this.payType){
|
|
|
case '0':
|
|
|
+ this.payWay = 'WEIXIN'
|
|
|
this.btnColor="#09BB07"
|
|
|
this.buttonText = '去支付'
|
|
|
break;
|
|
|
case '1':
|
|
|
+ this.payWay = 'UNIONPAY'
|
|
|
this.btnColor="#034582"
|
|
|
this.buttonText = '生成支付链接'
|
|
|
break;
|
|
@@ -147,10 +172,10 @@
|
|
|
this.PayService.PayOrderCheckoutCounter({orderId:this.orderID}).then(response =>{
|
|
|
this.isRepuest = true
|
|
|
this.discernReceipt = response.data.discernReceipt //支付记录
|
|
|
- this.payTotalFee = response.data.order.payTotalFee //已付金额
|
|
|
+ this.payTotalFee = response.data.order.payTotalFee //订单总额
|
|
|
this.receiptAmount = response.data.order.receiptAmount //已付金额
|
|
|
- this.payableAmount = response.data.order.payableAmount - this.receiptAmount //待付金额
|
|
|
- this.payAmount = this.payableAmount.toFixed(2) //自定义金额
|
|
|
+ this.payableAmount = response.data.order.payableAmount - this.receiptAmount//已付金额
|
|
|
+ this.payAmount = this.toFixedFn(this.payableAmount) //自定义金额
|
|
|
this.balanceAmount = this.payableAmount - this.payAmount// 计算剩余支付金额
|
|
|
}).catch(error =>{
|
|
|
this.$util.msg(error.msg,2000)
|
|
@@ -167,6 +192,10 @@
|
|
|
}
|
|
|
},
|
|
|
BuildCatenate(){
|
|
|
+ if(this.payAmount == 0){
|
|
|
+ this.$util.msg("请输入本次支付的金额",2000)
|
|
|
+ return
|
|
|
+ }
|
|
|
if(this.payAmount <=10){
|
|
|
this.$util.msg("企业网银支付的金额必须大于¥10.00",2000)
|
|
|
return
|
|
@@ -177,8 +206,11 @@
|
|
|
})
|
|
|
},
|
|
|
MiniWxPayFor(){
|
|
|
- let self = this
|
|
|
authorize.getCode('weixin').then(wechatcode =>{
|
|
|
+ if(this.payAmount > 50000){
|
|
|
+ this.$util.modal('','本次支付金额已超出微信支付限额,请输入小于5万的金额进行支付','知道了','',false,() =>{})
|
|
|
+ return
|
|
|
+ }
|
|
|
if(this.payAmount == 0){
|
|
|
this.$util.msg("请输入本次支付的金额",2000)
|
|
|
return
|
|
@@ -202,6 +234,7 @@
|
|
|
})
|
|
|
},
|
|
|
WxRequestPayment(data){
|
|
|
+ let self = this
|
|
|
wx.requestPayment({
|
|
|
'timeStamp': data.timeStamp,
|
|
|
'nonceStr': data.nonceStr,
|
|
@@ -212,10 +245,10 @@
|
|
|
wx.reLaunch({url: '/pages/tabBar/user/user'});
|
|
|
},
|
|
|
'fail':function(res){
|
|
|
- self.$util.msg('订单支付已取消')
|
|
|
+ self.$util.msg('用户取消支付~')
|
|
|
},
|
|
|
'complete':function(res){
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -233,15 +266,19 @@
|
|
|
this.showDigitKeyboard = false
|
|
|
},
|
|
|
chechValue(value){
|
|
|
- if(value == 0){
|
|
|
- this.payAmount = this.payableAmount.toFixed(2)
|
|
|
- this.balanceAmount = this.payableAmount-this.payAmount
|
|
|
- }else if(parseInt(value)>this.payableAmount){
|
|
|
- this.payAmount = this.payableAmount.toFixed(2)
|
|
|
- this.balanceAmount = this.payableAmount - this.payAmount
|
|
|
+ let patern = /\d+\.\d+/g;
|
|
|
+ if(value && value.split('.').length > 2) {
|
|
|
+ value= patern.exec(value);
|
|
|
+ }
|
|
|
+ if(value == "" || value <0 ){
|
|
|
+ this.payAmount = '';
|
|
|
+ this.balanceAmount = this.payableAmount;
|
|
|
+ }else if( value > this.payableAmount){
|
|
|
+ this.payAmount = this.toFixedFn(this.payableAmount)
|
|
|
+ this.balanceAmount = this.toFixedFn(this.payableAmount - this.payAmount)
|
|
|
}else{
|
|
|
- this.payAmount =Number(value).toFixed(2)
|
|
|
- this.balanceAmount = this.payableAmount - this.payAmount
|
|
|
+ this.payAmount = this.toFixedFn(value)
|
|
|
+ this.balanceAmount = this.toFixedFn(this.payableAmount - this.payAmount)
|
|
|
}
|
|
|
},
|
|
|
hanldNavigateBack(){//页面返回
|
|
@@ -252,9 +289,9 @@
|
|
|
payTypeText (state){//处理支付记录文字
|
|
|
let stateText = '',
|
|
|
stateTextObject={
|
|
|
- 12:'网银支付',
|
|
|
+ 12:'企业网银',
|
|
|
13:'微信支付',
|
|
|
- 14:'支付宝支付',
|
|
|
+ 14:'支付宝',
|
|
|
15:'微信支付',
|
|
|
16:'余额抵扣',
|
|
|
}
|
|
@@ -268,15 +305,20 @@
|
|
|
hideTips(){//隐藏弹窗
|
|
|
this.isShowTip = false
|
|
|
},
|
|
|
+ toFixedFn(text){//处理小数点后两位数
|
|
|
+ return Number(text).toFixed(2);
|
|
|
+ },
|
|
|
clipboard(data) {//复制链接
|
|
|
thorui.getClipboardData(data, (res) => {
|
|
|
- // #ifdef H5
|
|
|
if (res) {
|
|
|
- this.$util.msg("复制成功",2000);
|
|
|
+ this.isShowTip = false;
|
|
|
+ this.$util.msg("复制成功",2000,true,'success');
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.$api.navigateTo(`/pages/user/order/order-details?state=0&orderID=${this.orderID}`)
|
|
|
+ },2000)
|
|
|
} else {
|
|
|
- this.$util.msg("复制失败",2000);
|
|
|
+ this.$util.msg("复制失败",2000,true,'none');
|
|
|
}
|
|
|
- // #endif
|
|
|
})
|
|
|
},
|
|
|
discard(){
|
|
@@ -284,7 +326,7 @@
|
|
|
}
|
|
|
},
|
|
|
onShow() {
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -300,7 +342,7 @@
|
|
|
width: 662rpx;
|
|
|
height: 420rpx;
|
|
|
padding: 64rpx 44rpx 0 44rpx;
|
|
|
- background: url(https://admin-b.caimei365.com/userfiles/1/images/photo/2020/07/icon-kdnakdj.png) no-repeat;
|
|
|
+ background: url(https://img.caimei365.com/group1/M00/03/BD/Cmis218elN6AY6VeAAqw4n3n4nw186.png) no-repeat;
|
|
|
background-size: cover;
|
|
|
float: left;
|
|
|
position: relative;
|
|
@@ -461,6 +503,7 @@
|
|
|
&.row-3{
|
|
|
flex: 4;
|
|
|
text-align: right;
|
|
|
+ color: #999999;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -470,8 +513,11 @@
|
|
|
}
|
|
|
.pay-button{
|
|
|
width: 100%;
|
|
|
+ background-color: #FFFFFF;
|
|
|
position: fixed;
|
|
|
- bottom: 80rpx;
|
|
|
+ height: 88rpx;
|
|
|
+ padding-top: 24rpx;
|
|
|
+ bottom: 0;
|
|
|
.btn{
|
|
|
width: 702rpx;
|
|
|
height: 88rpx;
|
|
@@ -495,7 +541,7 @@
|
|
|
z-index: 8888;
|
|
|
transition: all 0.4s;
|
|
|
&.none{
|
|
|
- display: none;
|
|
|
+ display: none;
|
|
|
}
|
|
|
&.show{
|
|
|
display: block;
|