123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- <template>
- <view class="">
- <view style="width: 100%;text-align: center;margin-top: 20rpx;" v-show="length==0">暂无数据</view>
- <uni-swipe-action>
- <uni-swipe-action-item :options="options" @click="onClick(item)" @change="change" v-for="(item,index) in data" :key="index">
- <view class="item">
- <view class="left" >
- <image src="../../static/youer.png" style="width:140rpx;height:140rpx;border-radius: 20rpx;" v-if="IdCard(item.cardNo)<=6"></image>
- <image src="../../static/shaonian.png" style="width:140rpx;height:140rpx;border-radius: 20rpx;" v-else-if="IdCard(item.cardNo)>=7 && IdCard(item.cardNo)<=12"></image>
- <image src="../../static/qingShao.png" style="width:140rpx;height:140rpx;border-radius: 20rpx;" v-else-if="IdCard(item.cardNo)>=13 && IdCard(item.cardNo)<=17"></image>
- <image src="../../static/young.png" style="width:140rpx;height:140rpx;border-radius: 20rpx;" v-else-if="IdCard(item.cardNo)>=18 && IdCard(item.cardNo)<=45"></image>
- <image src="../../static/zhongnian.png" style="width:140rpx;height:140rpx;border-radius: 20rpx;" v-else-if="IdCard(item.cardNo)>=46 && IdCard(item.cardNo)<=69"></image>
- <image src="../../static/old.png" style="width:140rpx;height:140rpx;border-radius: 20rpx;" v-else-if="IdCard(item.cardNo)>69"></image>
- </view>
- <view class="right">
- <view class="name">{{item.personName}}</view>
- <view class="phone">
- <text>手机号 :</text><text style="margin-left:15rpx">{{item.phoneNum}}</text>
- </view>
- <view class="idNumber">
- <text>身份证号 :</text><text style="margin-left:15rpx">{{item.cardNo}}</text>
- </view>
- </view>
- </view>
- </uni-swipe-action-item>
- </uni-swipe-action>
- <!-- 添加家人信息 -->
- <view class="btn" @tap="addFamily">添加家人信息</view>
- </view>
- </template>
- <script>
- import uniSwipeAction from '../../components/uni-swipe-action/uni-swipe-action.vue'
- import uniSwipeActionItem from '../../components/uni-swipe-action-item/uni-swipe-action-item.vue'
- export default {
- data() {
- return {
- length:0,//数据判断值
- data: [],//列表数据
- options: [{//左滑动数据
- text: '删除',
- style: {
- backgroundColor: '#dd524d'
- }
- }]
- }
- },
- mounted() {
- this.getListData()
-
- },
- components: {
- uniSwipeAction,
- uniSwipeActionItem
- },
- computed:{
-
- },
- methods: {
- //根据身份证号获取年龄
- IdCard(UUserCard) {
- var myDate = new Date();
- var month = myDate.getMonth() + 1;
- var day = myDate.getDate();
- var age = myDate.getFullYear() - UUserCard.substring(6, 10) - 1;
- if (UUserCard.substring(10, 12) < month || UUserCard.substring(10, 12) == month && UUserCard.substring(12, 14) <= day) {
- age++;
- }
- return age
- },
- // 点击删除
- onClick(item) {
- uni.showModal({
- title: '提示',
- content: '您确定要删除当前数据吗?',
- success: (res) => {
- // 判断用户是选择确定还是取消
- if (res.confirm) {
- this.http.httpRequest('/wxapplet/owner/peopleInfor/family/del', 'post', {
- cardNo: item.cardNo,
- comtyId: item.comtyId,
- zzjgid: item.zzjgid
- }, true).then((res) => {
- console.log(res)
- // 判断接口是否请求成功
- if (res.code == 0) {
- uni.showToast({
- title:'删除成功',
- 'icon':'success'
- })
- this.getListData()
- } else {
- uni.showToast({
- title: res.msg,
- 'icon': 'none'
- })
- }
- })
- } else if (res.cancel) {
- }
- }
- })
- },
- // 获取列表数据
- getListData() {
- uni.showLoading({
- mask:true,
- title:'加载中'
- })
- this.http.httpRequest('/wxapplet/owner/peopleInfor/getfamily', 'get', {
- cardNo: uni.getStorageSync('idNumber'),
- comtyId: uni.getStorageSync('comtyId')
- }, true).then((res) => {
- console.log(res)
- if (res.code == 0) {
- uni.hideLoading()
- this.data = res.data.rows
- this.length=this.data.length
- } else {
- uni.hideLoading()
- uni.showToast({
- title: res.msg,
- 'icon': 'none'
- })
- }
- }).catch(()=>{
- uni.hideLoading()
- })
- },
- // 添加家人信息
- addFamily() {
- uni.navigateTo({
- url: "addFamily"
- })
- }
- }
- }
- </script>
- <style>
- .btn {
- width: 702rpx;
- height: 90rpx;
- background: rgba(41, 138, 253, 1);
- opacity: 1;
- border-radius: 18rpx;
- font-size: 32rpx;
- font-family: PingFang SC;
- font-weight: bold;
- line-height: 90rpx;
- color: rgba(255, 255, 255, 1);
- text-align: center;
- position: fixed;
- left: 26rpx;
- bottom: 56rpx;
- }
- .idNumber {
- width: 100%;
- height: 34rpx;
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 400;
- line-height: 34rpx;
- color: rgba(51, 51, 51, 1);
- }
- .name {
- width: 100%;
- height: 44rpx;
- font-size: 32rpx;
- font-family: PingFang SC;
- font-weight: bold;
- line-height: 44px;
- color: rgba(51, 51, 51, 1);
- }
- .phone {
- width: 100%;
- height: 34rpx;
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 400;
- line-height: 34rpx;
- color: rgba(51, 51, 51, 1);
- margin-top: 28rpx;
- margin-left: 26rpx;
- }
- .left {
- width: 140rpx;
- height: 140rpx;
- border-radius: 20rpx;
- margin-top: 40rpx;
- }
- .right {
- width: 100%;
- margin-left: 20rpx;
- margin-top: 40rpx;
- }
- .item {
- width: 680rpx;
- height: 220rpx;
- border-bottom: 2rpx solid rgba(247, 247, 247, 1);
- ;
- margin: 0 auto;
- display: flex;
- }
- </style>
|