优化代码

This commit is contained in:
java110 2023-09-06 16:20:12 +08:00
parent bf02f5affa
commit c2ff5abf58
2 changed files with 88 additions and 16 deletions

View File

@ -104,7 +104,6 @@
if (_item.payOnline == 'Y') { if (_item.payOnline == 'Y') {
_item.selected = "1"; _item.selected = "1";
_that.feeIds.push(_item.feeId); _that.feeIds.push(_item.feeId);
} }
}) })
_that.computeAmount(); _that.computeAmount();
@ -131,7 +130,7 @@
uni.setStorageSync('doing_cashier',_objData); uni.setStorageSync('doing_cashier',_objData);
uni.navigateTo({ uni.navigateTo({
url:'/pages/fee/cashier?money='+this.receivableAmount+"&business=oweFee" url:'/pages/fee/cashier?money='+this.receivableAmount+"&business=oweFee&communityId="+this.communityId
}) })
}, },

View File

@ -1,45 +1,118 @@
<template> <template>
<view> <view>
<view class="bg-white money-info"> <view class="bg-white money-info text-center">
<view class="money-black"></view>
<view class="money-title">订单金额</view> <view class="money-title">订单金额</view>
<view class="money-title">{{money}}</view> <view class="money-value">{{money}}</view>
</view> </view>
<view class="cu-bar btn-group" style="margin-top: 30px;"> <view class="cu-bar btn-group" style="margin-top: 30px;">
<button @click="_submit" class="cu-btn bg-blue shadow-blur round lg">确认支付</button> <button @click="_submit" class="cu-btn bg-blue shadow-blur round lg">确认支付</button>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import {
isNotNull
} from '../../lib/java110/utils/StringUtil.js';
import {
refreshUserOpenId,
getOpenIdFromAliPay
} from '../../api/user/userApi.js';
import {
isWxOrAli
} from '../../lib/java110/utils/EnvUtil.js';
export default { export default {
data() { data() {
return { return {
money:0.0, communityId: '',
business:'', money: 0.0,
data:{} business: '',
openId: '',
data: {}
} }
}, },
mounted() {
// #ifdef H5
if (isWxOrAli() == "ALIPAY") {
const oScript = document.createElement('script');
oScript.type = 'text/javascript';
oScript.src = 'https://gw.alipayobjects.com/as/g/h5-lib/alipayjsapi/3.1.1/alipayjsapi.min.js';
document.body.appendChild(oScript);
}
// #endif
},
onLoad(options) { onLoad(options) {
this.openId = options.openId;
this.communityId = options.communityId;
if (!isNotNull(this.openId)) {
// openId
// #ifdef H5
if (isWxOrAli() == 'ALIPAY') {
this._refreshAliPayOpenId();
return;
}
//todo h5
this._refreshWechatOpenId();
return;
// #endif
// #ifdef MP-WEIXIN
this.openId = this._refreshWechatMiniOpenId();
// #endif
}
this.money = options.money; this.money = options.money;
this.business = options.business; this.business = options.business;
this.data = uni.getStorageSync('doing_cashier'); this.data = uni.getStorageSync('doing_cashier');
}, },
methods: { methods: {
_refreshWechatOpenId: function() {
_submit:function(){ let _redirectUrl = window.location.href;
refreshUserOpenId({
redirectUrl: _redirectUrl,
communityId: this.communityId,
}).then(_data => {
console.log(_data, 123)
if (_data.code == 0) {
window.location.href = _data.data.openUrl;
return;
}
});
},
_refreshWechatMiniOpenId:function(){
},
_submit: function() {
} }
} }
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.money-info{ .money-info {
height: 200upx; height: 400upx;
margin:20upx margin: 20upx;
.money-black {
height: 120upx;
}
.money-title {
font-size: 32upx;
}
.money-value {
color: #e54d42;
margin-top: 20upx;
font-size: 64upx;
}
} }
</style> </style>