Files
dvcp_v2_wechat_app/src/mods/AppMarFuneral/AppMarFuneral.vue
2022-02-14 17:25:54 +08:00

217 lines
4.8 KiB
Vue

<template>
<div class="wrapper padding" v-if="pageShow">
<template v-if="list.length">
<header>
<span>婚丧嫁娶列表</span>
<div class="total">
<em>{{ list.length }}</em>
</div>
</header>
<div class="card" v-for="item in list" :key="item.id">
<div class="item">
<span class="label">事主姓名</span>
<span class="value">{{ item.name }}</span>
</div>
<div class="item">
<span class="label">联系方式</span>
<span class="value">{{ item.phone }}</span>
</div>
<div class="item">
<span class="label">上报时间</span>
<span class="value">{{ item.createTime }}</span>
</div>
<div class="item">
<span class="label">上报地点</span>
<span class="value">{{ item.address }}</span>
</div>
<div class="item" v-if="item.content.trim().length">
<span class="label">上报内容</span>
<span class="value">{{ item.content || '' }}</span>
</div>
<div class="tag" :style="{backgroundColor:$dict.getColor('marriageType',item.type)}">
{{ $dict.getLabel('marriageType', item.type) }}
</div>
<u-icon name="more-dot-fill" size="28" color="#999999" :custom-style="customStyle" @click="handleDel(item)"
v-if="item.openId == userInfo.openId"></u-icon>
</div>
</template>
<AiEmpty v-else/>
<div class="btn-wrapper">
<div class="btn" @click="suport" hover-class="text-hover">我要上报</div>
</div>
</div>
</template>
<script>
export default {
name: "AppMarFuneral",
appName: "婚丧嫁娶",
data() {
return {
current: 1,
pageShow: false,
list: [],
userInfo: {},
}
},
computed: {
customStyle() {
return {
position: "absolute",
top: "16px",
right: "24px",
transform: "rotate(90deg)"
};
},
},
onLoad() {
this.$loading()
this.userInfo = uni.getStorageSync("userInfo");
this.$dict.load("marriageType").then(() => {
this.getList()
})
uni.$on('update', () => {
this.current = 1
this.getList()
})
},
methods: {
handleDel({id}) {
uni.showModal({
title: "提示",
content: "是否确定要删除?",
success: ret => {
if (ret.confirm) {
this.$instance.post("/app/appmarriagefuneralinfo/delete", null, {
params: {ids: id}
}).then(res => {
if (res.code == 0) {
this.$u.toast("删除成功");
this.getList();
}
})
}
}
})
},
getList() {
this.$instance.post("/app/appmarriagefuneralinfo/list", null, {
params: {
current: this.current,
size: 10,
}
}).then(res => {
if (res?.data) {
this.list = this.current > 1 ? [...this.list, ...res.data.records] : res.data.records;
this.$nextTick(() => {
this.pageShow = true
})
}
this.$hideLoading()
}).catch(() => {
this.$hideLoading()
})
},
suport() {
uni.navigateTo({
url: "./marAdd"
})
}
},
onReachBottom() {
this.current++;
this.getList();
}
}
</script>
<style lang="scss" scoped>
.padding {
box-sizing: border-box;
padding: 48px 32px 156px;
header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 44px;
& > span {
font-size: 38px;
font-weight: 600;
color: #333333;
}
.total {
margin-left: auto;
font-size: 28px;
font-weight: 400;
color: #666666;
display: flex;
align-items: center;
& > em {
color: #4181FF;
}
}
}
.card {
min-height: 308px;
background: #FFFFFF;
box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.02);
border-radius: 16px;
box-sizing: border-box;
padding: 32px;
display: flex;
flex-direction: column;
justify-content: space-between;
position: relative;
margin-bottom: 24px;
.item {
display: flex;
margin-bottom: 8px;
.label {
font-size: 26px;
font-weight: 400;
color: #999999;
flex-shrink: 0;
line-height: 36px;
}
.value {
font-size: 26px;
font-weight: 400;
color: #333333;
margin-left: 32px;
line-height: 36px;
}
}
.tag {
width: 70px;
height: 44px;
background: #FF883C;
border-radius: 8px;
font-size: 26px;
line-height: 40px;
font-weight: 400;
color: #FFFFFF;
text-align: center;
margin-top: 24px;
}
}
}
</style>