From 36d55884018a03f7c8fa13698afa656738705b8a Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Tue, 11 Jun 2024 23:29:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=9A=E4=B8=BB=E7=AB=AF=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/owner/tips.vue | 49 ++++++++++++ conf/config.js | 2 +- pages/fee/cashier.vue | 157 +++++++++++++++++++++++++++++--------- 3 files changed, 170 insertions(+), 38 deletions(-) create mode 100644 components/owner/tips.vue diff --git a/components/owner/tips.vue b/components/owner/tips.vue new file mode 100644 index 0000000..beb174c --- /dev/null +++ b/components/owner/tips.vue @@ -0,0 +1,49 @@ + + + + + \ No newline at end of file diff --git a/conf/config.js b/conf/config.js index 2b472b4..30d306e 100644 --- a/conf/config.js +++ b/conf/config.js @@ -15,7 +15,7 @@ const baseUrl = '/'; // #ifndef H5 //服务器域名 小程序 或者 app 时 后端地址 -const baseUrl = 'http://demo.homecommunity.cn/'; +const baseUrl = 'http://127.0.0.1:8008/'; // #endif let commonBaseUrl = 'http://demo.homecommunity.cn/'; diff --git a/pages/fee/cashier.vue b/pages/fee/cashier.vue index 0b63a96..99ad3f3 100644 --- a/pages/fee/cashier.vue +++ b/pages/fee/cashier.vue @@ -7,6 +7,29 @@ {{money}} + + 使用积分 + + + + + + + + + + + + + + {{integral}}个积分 + + + + + 如何获取积分? + + @@ -14,6 +37,8 @@ + + @@ -30,23 +55,36 @@ import { isWxOrAli } from '../../lib/java110/utils/EnvUtil.js'; - + import { cashierPayFee } from '../../api/fee/feeApi.js'; + import tips from '@/components/owner/tips.vue'; + + import { + hasLogin + } from '../../api/user/sessionApi.js'; + import { + queryUserIntegral + } from '@/api/user/userApi.js'; + export default { data() { return { communityId: '', + orgMoney:0.0, money: 0.0, business: '', openId: '', - appId:'', + appId: '', data: {}, - appId:'', - cashierUserId:'', + appId: '', + cashierUserId: '', banButton: false, // 禁用支付按钮 + useIntegral:'N', + integral: 0, + integralMoney:0, } }, mounted() { @@ -63,8 +101,8 @@ this.openId = options.openId; this.communityId = options.communityId; this.cashierUserId = options.cashierUserId; - let _that =this; - this._loadAppId(function(){ + let _that = this; + this._loadAppId(function() { if (!isNotNull(_that.openId)) { //刷新 openId // #ifdef H5 @@ -76,31 +114,41 @@ _that._refreshWechatOpenId(); return; // #endif - + // #ifdef MP-WEIXIN _that._refreshWechatMiniOpenId(); // #endif } }); - + this.money = options.money; + this.orgMoney = options.money; this.business = options.business; this.data = uni.getStorageSync('doing_cashier'); - + + if (hasLogin()) { + //todo 如果登录了查询用户积分 + this._loadUserIntegral(); + + } + + }, + components: { + tips }, methods: { - _loadAppId:function(_call){ + _loadAppId: function(_call) { let _objType = "1100"; // todo public // #ifdef MP-WEIXIN _objType = "1000"; // #endif - + let _that = this; getCommunityWechatAppId({ - communityId:this.communityId, - objType:_objType - }).then(_data =>{ + communityId: this.communityId, + objType: _objType + }).then(_data => { _that.appId = _data.data; _call(); }) @@ -111,15 +159,14 @@ redirectUrl: _redirectUrl, wAppId: this.appId, }).then(_data => { - console.log(_data, 123) if (_data.code == 0) { window.location.href = _data.data.openUrl; return; } }); }, - _refreshWechatMiniOpenId:function(){ - let _that =this; + _refreshWechatMiniOpenId: function() { + let _that = this; wx.login({ success: function(loginRes) { if (!loginRes.code) { @@ -127,20 +174,20 @@ } let accountInfo = uni.getAccountInfoSync(); let appId = accountInfo.miniProgram.appId; - getWechatMiniOpenId({ - code:loginRes.code, - appId:appId, - }).then(_data =>{ - if(_data.code != 0){ - uni.showToast({ - icon:'none', - title:_data.msg - }) - return; - } - _that.openId = _data.data; - }) - + getWechatMiniOpenId({ + code: loginRes.code, + appId: appId, + }).then(_data => { + if (_data.code != 0) { + uni.showToast({ + icon: 'none', + title: _data.msg + }) + return; + } + _that.openId = _data.data; + }) + }, fail: function(error) { // 调用 wx.login 接口失败 @@ -150,10 +197,10 @@ }); }, _submit: function() { - if(!this.appId){ + if (!this.appId) { uni.showToast({ - icon:'none', - title:'小区未配置支付信息' + icon: 'none', + title: '小区未配置支付信息' }); return; } @@ -164,15 +211,51 @@ _data.appId = this.appId; _data.cashierUserId = this.cashierUserId; _data.openId = this.openId; - cashierPayFee(this,_data) + _data.useIntegral = this.useIntegral; + cashierPayFee(this, _data) }, - + _loadUserIntegral: function() { + let _that = this; + queryUserIntegral({ + page: 1, + row: 1, + }).then(_data=>{ + _that.integral = _data.integral; + _that.integralMoney = _data.integralMoney; + }) + }, + _checkIntegral:function(e){ + console.log(e); + + let _value = e.detail.value; + if(!_value || _value.length < 1){ + this.useIntegral = 'N'; + this.money = this.orgMoney; + return; + } + + this.useIntegral = 'N'; + this.money = parseFloat(this.orgMoney) - parseFloat(this.integralMoney); + this.money = this.money.toFixed(2); + }, + _viewGetIntegral: function() { + let _content = "您可以到商城购物或者物业缴费的方式获取积分,积分可以用来物业缴费和商城购物." + this.$refs.tipRef.openTip('如何获取积分?', _content); + } } } + \ No newline at end of file