mirror of
https://gitee.com/java110/WechatOwnerService.git
synced 2026-02-23 21:36:38 +08:00
业主端加入积分功能
This commit is contained in:
parent
b1207889b4
commit
36d5588401
49
components/owner/tips.vue
Normal file
49
components/owner/tips.vue
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="cu-modal" :class="showTips==true?'show':''">
|
||||||
|
<view class="cu-dialog">
|
||||||
|
<view class="cu-bar bg-white justify-end">
|
||||||
|
<view class="content">{{title}}</view>
|
||||||
|
<view class="action" @tap="_cancleTip()">
|
||||||
|
<text class="cuIcon-close text-red"></text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="padding-xl">
|
||||||
|
<view >{{content}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="cu-bar bg-white justify-end">
|
||||||
|
<view class="action margin-0 flex-sub solid-left" @tap="_cancleTip()">关闭</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name:"tips",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
showTips:false,
|
||||||
|
title:'',
|
||||||
|
content:''
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
openTip:function(_title,_content){
|
||||||
|
|
||||||
|
this.title = _title;
|
||||||
|
this.content = _content;
|
||||||
|
this.showTips = true;
|
||||||
|
console.log('openTip',this.showTips)
|
||||||
|
},
|
||||||
|
_cancleTip:function(){
|
||||||
|
this.showTips = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@ -15,7 +15,7 @@ const baseUrl = '/';
|
|||||||
|
|
||||||
// #ifndef H5
|
// #ifndef H5
|
||||||
//服务器域名 小程序 或者 app 时 后端地址
|
//服务器域名 小程序 或者 app 时 后端地址
|
||||||
const baseUrl = 'http://demo.homecommunity.cn/';
|
const baseUrl = 'http://127.0.0.1:8008/';
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
let commonBaseUrl = 'http://demo.homecommunity.cn/';
|
let commonBaseUrl = 'http://demo.homecommunity.cn/';
|
||||||
|
|||||||
@ -7,6 +7,29 @@
|
|||||||
<view class="money-value">{{money}}</view>
|
<view class="money-value">{{money}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<view class="padding-sm">
|
||||||
|
<view class="block__title">使用积分</view>
|
||||||
|
<checkbox-group @change="_checkIntegral" >
|
||||||
|
<view class="cu-list menu">
|
||||||
|
<view class="cu-item ">
|
||||||
|
<view class="content padding-tb-sm">
|
||||||
|
<view>
|
||||||
|
<view class="text-cut" style="width:220px">
|
||||||
|
<!---->
|
||||||
|
<checkbox value="Y" v-if="integral <=0" disabled="true"/>
|
||||||
|
<checkbox value="Y" v-else/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="action">
|
||||||
|
<text class="text-grey text-sm">{{integral}}个积分</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</checkbox-group>
|
||||||
|
<view class="text-right" @click="_viewGetIntegral()">如何获取积分?</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="cu-bar btn-group" style="margin-top: 30px;" v-if="!appId">
|
<view class="cu-bar btn-group" style="margin-top: 30px;" v-if="!appId">
|
||||||
<button disabled="disabled" class="cu-btn bg-blue shadow-blur round lg">确认支付</button>
|
<button disabled="disabled" class="cu-btn bg-blue shadow-blur round lg">确认支付</button>
|
||||||
</view>
|
</view>
|
||||||
@ -14,6 +37,8 @@
|
|||||||
<button @click="_submit" class="cu-btn bg-blue shadow-blur round lg" :disabled="banButton">确认支付</button>
|
<button @click="_submit" class="cu-btn bg-blue shadow-blur round lg" :disabled="banButton">确认支付</button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<tips ref="tipRef"></tips>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -35,18 +60,31 @@
|
|||||||
cashierPayFee
|
cashierPayFee
|
||||||
} from '../../api/fee/feeApi.js';
|
} 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 {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
communityId: '',
|
communityId: '',
|
||||||
|
orgMoney:0.0,
|
||||||
money: 0.0,
|
money: 0.0,
|
||||||
business: '',
|
business: '',
|
||||||
openId: '',
|
openId: '',
|
||||||
appId:'',
|
appId: '',
|
||||||
data: {},
|
data: {},
|
||||||
appId:'',
|
appId: '',
|
||||||
cashierUserId:'',
|
cashierUserId: '',
|
||||||
banButton: false, // 禁用支付按钮
|
banButton: false, // 禁用支付按钮
|
||||||
|
useIntegral:'N',
|
||||||
|
integral: 0,
|
||||||
|
integralMoney:0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -63,8 +101,8 @@
|
|||||||
this.openId = options.openId;
|
this.openId = options.openId;
|
||||||
this.communityId = options.communityId;
|
this.communityId = options.communityId;
|
||||||
this.cashierUserId = options.cashierUserId;
|
this.cashierUserId = options.cashierUserId;
|
||||||
let _that =this;
|
let _that = this;
|
||||||
this._loadAppId(function(){
|
this._loadAppId(function() {
|
||||||
if (!isNotNull(_that.openId)) {
|
if (!isNotNull(_that.openId)) {
|
||||||
//刷新 openId
|
//刷新 openId
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
@ -85,12 +123,22 @@
|
|||||||
|
|
||||||
|
|
||||||
this.money = options.money;
|
this.money = options.money;
|
||||||
|
this.orgMoney = options.money;
|
||||||
this.business = options.business;
|
this.business = options.business;
|
||||||
this.data = uni.getStorageSync('doing_cashier');
|
this.data = uni.getStorageSync('doing_cashier');
|
||||||
|
|
||||||
|
if (hasLogin()) {
|
||||||
|
//todo 如果登录了查询用户积分
|
||||||
|
this._loadUserIntegral();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
tips
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
_loadAppId:function(_call){
|
_loadAppId: function(_call) {
|
||||||
let _objType = "1100"; // todo public
|
let _objType = "1100"; // todo public
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
_objType = "1000";
|
_objType = "1000";
|
||||||
@ -98,9 +146,9 @@
|
|||||||
|
|
||||||
let _that = this;
|
let _that = this;
|
||||||
getCommunityWechatAppId({
|
getCommunityWechatAppId({
|
||||||
communityId:this.communityId,
|
communityId: this.communityId,
|
||||||
objType:_objType
|
objType: _objType
|
||||||
}).then(_data =>{
|
}).then(_data => {
|
||||||
_that.appId = _data.data;
|
_that.appId = _data.data;
|
||||||
_call();
|
_call();
|
||||||
})
|
})
|
||||||
@ -111,15 +159,14 @@
|
|||||||
redirectUrl: _redirectUrl,
|
redirectUrl: _redirectUrl,
|
||||||
wAppId: this.appId,
|
wAppId: this.appId,
|
||||||
}).then(_data => {
|
}).then(_data => {
|
||||||
console.log(_data, 123)
|
|
||||||
if (_data.code == 0) {
|
if (_data.code == 0) {
|
||||||
window.location.href = _data.data.openUrl;
|
window.location.href = _data.data.openUrl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
_refreshWechatMiniOpenId:function(){
|
_refreshWechatMiniOpenId: function() {
|
||||||
let _that =this;
|
let _that = this;
|
||||||
wx.login({
|
wx.login({
|
||||||
success: function(loginRes) {
|
success: function(loginRes) {
|
||||||
if (!loginRes.code) {
|
if (!loginRes.code) {
|
||||||
@ -128,13 +175,13 @@
|
|||||||
let accountInfo = uni.getAccountInfoSync();
|
let accountInfo = uni.getAccountInfoSync();
|
||||||
let appId = accountInfo.miniProgram.appId;
|
let appId = accountInfo.miniProgram.appId;
|
||||||
getWechatMiniOpenId({
|
getWechatMiniOpenId({
|
||||||
code:loginRes.code,
|
code: loginRes.code,
|
||||||
appId:appId,
|
appId: appId,
|
||||||
}).then(_data =>{
|
}).then(_data => {
|
||||||
if(_data.code != 0){
|
if (_data.code != 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon:'none',
|
icon: 'none',
|
||||||
title:_data.msg
|
title: _data.msg
|
||||||
})
|
})
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -150,10 +197,10 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
_submit: function() {
|
_submit: function() {
|
||||||
if(!this.appId){
|
if (!this.appId) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon:'none',
|
icon: 'none',
|
||||||
title:'小区未配置支付信息'
|
title: '小区未配置支付信息'
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -164,15 +211,51 @@
|
|||||||
_data.appId = this.appId;
|
_data.appId = this.appId;
|
||||||
_data.cashierUserId = this.cashierUserId;
|
_data.cashierUserId = this.cashierUserId;
|
||||||
_data.openId = this.openId;
|
_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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
.block__title {
|
||||||
|
margin: 0;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 14px;
|
||||||
|
color: rgba(69, 90, 100, .6);
|
||||||
|
padding: 0rpx 30rpx 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.money-info {
|
.money-info {
|
||||||
height: 400upx;
|
height: 400upx;
|
||||||
margin: 20upx;
|
margin: 20upx;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user