家庭积分
This commit is contained in:
@@ -192,17 +192,11 @@ export default {
|
||||
})
|
||||
},
|
||||
scan() {
|
||||
wx.scanQRCode({
|
||||
needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
|
||||
scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
|
||||
success: (res)=> {
|
||||
// var result = res.resultStr; // 当 needResult 为 1 时,扫码返回的结果
|
||||
// var resultArr = result.split(','); // 扫描结果以逗号分割数组(一维码)
|
||||
// var codeContent = resultArr[resultArr.length - 1]; // 获取数组最后一个元素,也就是最终的内容
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log("调用wx.scanQRCode扫码失败");
|
||||
},
|
||||
uni.scanCode({
|
||||
success: (res) => {
|
||||
var info = JSON.parse(res.result)
|
||||
uni.navigateTo({url: `./addFamily?avatarUrl=${info.avatarUrl}&nickName=${info.nickName}&openId=${info.openId}`})
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
84
src/project/fengdu/AppMine/addFamily.vue
Normal file
84
src/project/fengdu/AppMine/addFamily.vue
Normal file
@@ -0,0 +1,84 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<div class="content">
|
||||
<img :src="familyInfo.avatarUrl" alt="">
|
||||
<p class="user-name">{{familyInfo.nickName}}</p>
|
||||
<div class="btn" @click="add">加为家人</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {mapState} from 'vuex'
|
||||
|
||||
export default {
|
||||
appName: "加家人",
|
||||
computed: {
|
||||
...mapState(['user', 'token'])
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
familyInfo: {}
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
this.familyInfo = {...options}
|
||||
},
|
||||
methods: {
|
||||
add() {
|
||||
this.$instance.post(`/app/appwechatuserrelation/addRelation?openId=${this.familyInfo.openId}`).then(res=> {
|
||||
if(res.code == 0) {
|
||||
this.$u.toast('添加成功')
|
||||
setTimeout(() => uni.navigateBack({}), 1500)
|
||||
}
|
||||
}).catch(err => {
|
||||
this.$u.toast(err)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
@import "~dvcp-wui/common";
|
||||
.page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
height: 100vh;
|
||||
padding: 32px 32px 96px 32px;
|
||||
box-sizing: border-box;
|
||||
background-color: #f3f6f9;
|
||||
.content {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
text-align: center;
|
||||
img {
|
||||
width: 176px;
|
||||
height: 176px;
|
||||
border-radius: 88px;
|
||||
margin: 160px auto 24px auto;
|
||||
}
|
||||
.user-name {
|
||||
margin-bottom: 100px;
|
||||
line-height: 42px;
|
||||
font-family: PingFangSC-Regular;
|
||||
font-weight: 400;
|
||||
font-size: 36px;
|
||||
color: #333;
|
||||
}
|
||||
.btn {
|
||||
width: 400px;
|
||||
height: 80px;
|
||||
text-align: center;
|
||||
line-height: 80px;
|
||||
background: #4181FF;
|
||||
border-radius: 44px;
|
||||
font-family: PingFangSC-Medium;
|
||||
font-weight: 500;
|
||||
font-size: 34px;
|
||||
color: #FFF;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -19,7 +19,9 @@
|
||||
<div class="header-content" v-if="userInfo.length">
|
||||
<div class="item">
|
||||
<span class="item-num">{{ inx + 1 }}</span>
|
||||
<image :src="userInfo[0].avatar_url" alt="" class="user-img mar-b4" v-if="userInfo[0].avatar_url" />
|
||||
<div class="user-img-content" v-if="userInfo[0].avatar_url">
|
||||
<image :src="userInfo[0].avatar_url" alt="" class="user-img mar-b4" />
|
||||
</div>
|
||||
<div class="user-name-bg mar-b4 mar-r24" v-else>{{ formatName(userInfo[0].name) }}</div>
|
||||
<span class="item-name">{{ userInfo[0].name }}</span>
|
||||
<span class="item-point">{{ userInfo[0].integral }}</span>
|
||||
@@ -207,6 +209,7 @@ export default {
|
||||
padding: 0 64px;
|
||||
box-sizing: border-box;
|
||||
// border: 4px solid #2d7dffff;
|
||||
display: flex;
|
||||
|
||||
.item-num {
|
||||
display: inline-block;
|
||||
@@ -218,10 +221,15 @@ export default {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
|
||||
.user-img {
|
||||
margin-right: 24px;
|
||||
vertical-align: middle;
|
||||
.user-img-content {
|
||||
display: inline-block;
|
||||
width: 92px;
|
||||
height: 92px;
|
||||
padding: 4px;
|
||||
box-sizing: border-box;
|
||||
border-radius: 50%;
|
||||
border: 1px solid #2D7DFF;
|
||||
margin: 14px 24px 0 0;
|
||||
}
|
||||
|
||||
.item-name {
|
||||
@@ -233,7 +241,7 @@ export default {
|
||||
|
||||
.item-point {
|
||||
display: inline-block;
|
||||
width: calc(100% - 420px);
|
||||
width: calc(100% - 430px);
|
||||
text-align: right;
|
||||
font-size: 30px;
|
||||
font-family: PingFangSC-Medium, PingFang SC;
|
||||
|
||||
@@ -1,31 +1,21 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<div class="user-list">
|
||||
<div class="item">
|
||||
<div class="user-list" v-if="list.length">
|
||||
<div class="item" v-for="(item, index) in list" :key="index">
|
||||
<div class="item-left">
|
||||
<img src="https://cdn.cunwuyun.cn/wxmp/mine/wodejiating.png" alt="">
|
||||
<img :src="item.avatarUrl" alt="">
|
||||
<div class="user-info">
|
||||
<h3>代玲昌</h3>
|
||||
<p>积玉桥社区</p>
|
||||
<h3>{{item.nickName}}</h3>
|
||||
<p>{{item.girdName || ''}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-right">
|
||||
<div @click="toTransfer">转积分</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="item-left">
|
||||
<img src="https://cdn.cunwuyun.cn/wxmp/mine/wodejiating.png" alt="">
|
||||
<div class="user-info">
|
||||
<h3>代玲昌</h3>
|
||||
<p>积玉桥社区</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-right">
|
||||
<div>转积分</div>
|
||||
<div @click="toTransfer(item)">转积分</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<AiEmpty v-else/>
|
||||
<p class="bottom-text">如果绑定错误,请联系网格员解绑!</p>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@@ -38,28 +28,24 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
info: {}
|
||||
list: []
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.$dict.load('householdRelation').then(() => {
|
||||
this.$nextTick(() => {
|
||||
this.getUser()
|
||||
})
|
||||
})
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
getUser() {
|
||||
// this.$instance.post(`/app/appresident/detailForWx?id=${this.user.residentId}`).then(res => {
|
||||
// if (res.code === 0) {
|
||||
// this.info = res.data
|
||||
// }
|
||||
// })
|
||||
getList() {
|
||||
this.$instance.post(`/app/appwechatuserrelation/list`).then(res => {
|
||||
if (res.code === 0 && res.data) {
|
||||
this.list = res.data
|
||||
}
|
||||
})
|
||||
},
|
||||
toTransfer() {
|
||||
uni.navigateTo({url: `./transferIntrgral`})
|
||||
toTransfer(row) {
|
||||
uni.navigateTo({url: `./transferIntrgral?openId=${row.openId}&nickName=${row.nickName}&avatarUrl=${row.avatarUrl}`})
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
@@ -67,10 +53,13 @@ export default {
|
||||
|
||||
.page {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
background-color: #f3f6f9;
|
||||
|
||||
.user-list {
|
||||
padding: 32px 32px 0;
|
||||
height: calc(100% - 180px);
|
||||
overflow-y: scroll;
|
||||
.item {
|
||||
padding: 26px;
|
||||
background-color: #fff;
|
||||
@@ -119,5 +108,15 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bottom-text {
|
||||
line-height: 34px;
|
||||
font-family: PingFangSC-Regular;
|
||||
font-size: 24px;
|
||||
color: #999;
|
||||
position: fixed;
|
||||
bottom: 92px;
|
||||
left: 180px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
<div class="page">
|
||||
<div class="content">
|
||||
<p class="text">积分收入方</p>
|
||||
<img src="https://cdn.cunwuyun.cn/wxmp/mine/wodejiating.png" alt="">
|
||||
<p class="user-name">代玲昌</p>
|
||||
<img :src="userInfo.avatarUrl" alt="">
|
||||
<p class="user-name">{{userInfo.nickName}}</p>
|
||||
<u-input v-model="num" type="number" placeholder="请输入积分数量" :maxlength="11" :border="true" input-align="center" border-color="#ddd" height="76" class="input-num" />
|
||||
<p class="num-text">剩余积分余额:567</p>
|
||||
<div class="btn">确认转出</div>
|
||||
<p class="num-text">剩余积分余额:{{total}}</p>
|
||||
<div class="btn" @click="confirm">确认转出</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -20,23 +20,45 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
num: ''
|
||||
num: '',
|
||||
total: '',
|
||||
userInfo: {}
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.$dict.load('householdRelation').then(() => {
|
||||
this.$nextTick(() => {
|
||||
this.getUser()
|
||||
})
|
||||
})
|
||||
onLoad(options) {
|
||||
this.userInfo = {...options}
|
||||
this.getIntegral()
|
||||
},
|
||||
methods: {
|
||||
getUser() {
|
||||
// this.$instance.post(`/app/appresident/detailForWx?id=${this.user.residentId}`).then(res => {
|
||||
// if (res.code === 0) {
|
||||
// this.info = res.data
|
||||
// }
|
||||
// })
|
||||
getIntegral() {
|
||||
this.$instance.post(`/app/appintegraluser/girdDetail?id=${this.user.openId}`).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.total = res.data.integral || 0
|
||||
}
|
||||
})
|
||||
},
|
||||
confirm() {
|
||||
if (!/^[0-9]*[1-9][0-9]*$/g.test(this.num)) {
|
||||
this.num = ''
|
||||
return this.$u.toast('积分数量请输入正整数')
|
||||
}
|
||||
if (this.num > this.total) {
|
||||
return this.$u.toast('转出积分不能大于剩余积分')
|
||||
}
|
||||
this.$instance.post(`/app/appintegraluser/transferIntegral`,{
|
||||
fromId: this.user.openId,
|
||||
ids: [this.userInfo.openId],
|
||||
integral: this.num,
|
||||
integralUserType: '3',
|
||||
integralCalcType: '1'
|
||||
}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.$u.toast('积分转出成功!')
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 600)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user