|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <template>
- <view class="pages">
- <block v-for="(data, index) in list">
-
- <view class="page-box" v-if="data.list.length > 0" :key="index">
- <view class="title">
- <text class="a1">
- {{ data.houseName || '' }}
- </text>
-
- <text :style="{color: 'blue'}" @click="updateShowStatus(data)">已了解</text>
- </view>
- <u-checkbox-group @change="checkboxGroupChange" shape="circle">
- <block v-for="item in data.list" :key="item.id">
- <u-checkbox :disabled="item.showStatus == 0" @change="checkboxChange" v-model="item.checked">
- <view :style="{ textDecoration: item.showStatus == 0 ? 'line-through' : 'none'}">
- {{ item.createTime }}
- </view>
- <rich-text :style="{ textDecoration: item.showStatus == 0 ? 'line-through' : 'none'}" :nodes="item.message"></rich-text>
- </u-checkbox>
- </block>
- </u-checkbox-group>
- </view>
- </block>
- </view>
- </template>
-
- <script>
- export default {
- data() {
- return {
- list: [], //
- }
- },
-
- onLoad() {
- this.getWarningList()
- },
-
- methods: {
- //
- updateShowStatus(data) {
- let arr = data.list.filter(item => item.checked).map(items => {return items.id})
- console.log(arr)
- if (arr.length == 0) {
- uni.showToast({
- title: '请选择已了解的消息~',
- icon: "none",
- duration: 2000,
- })
- return
- }
- this.$u.get('/customer/updateShowStatus', {
- ids: arr.join(',')
- }).then(res => {
- uni.showToast({
- title: '提交成功',
- icon: "none",
- duration: 2000,
- })
- this.list = []
- this.$forceUpdate()
- setTimeout(() => {
- this.getWarningList()
- }, 1000)
- })
- },
-
- // 项目预警列表
- getWarningList() {
- this.$u.get('/customer/warningList').then(res => {
- if (res) {
- this.list = res.records.map(item => {
- item.list.forEach(items => {
- items.checked = items.showStatus == 0 ? true : false
- })
- return item
- })
- this.$forceUpdate()
- }
- })
- },
-
- // 选中某个复选框时,由checkbox时触发
- checkboxChange(e) {
- console.log(e);
- },
-
- // 选中任一checkbox时,由checkbox-group触发
- checkboxGroupChange(e) {
- console.log(e);
- }
- }
- }
- </script>
-
- <style lang="scss" scoped>
- .pages {
- padding: 20rpx 0;
- width: 100vw;
- min-height: 100vh;
- background: #f2f2f2;
- display: flex;
- flex-direction: column;
-
- .page-box {
- margin: 0 auto 20rpx;
- padding: 20rpx;
- width: 686rpx;
- background: #fff;
- border-radius: 16rpx;
- box-shadow: 0rpx 0rpx 7rpx #82848A;
-
- .title {
- display: flex;
- justify-content: space-between;
-
- .a1 {
- font-size: 32rpx;
- font-weight: 600;
- }
- }
- }
- }
- </style>
|