ReedawFoodApp/pageTwo/compk/contrast.vue

224 lines
5.6 KiB
Vue
Raw Permalink Normal View History

2025-05-30 11:14:38 +08:00
<template>
<view class="content">
2026-03-23 09:50:49 +08:00
<view class="tagList">
<scroll-view class="scroll-view_H" scroll-x="true">
<text class="scroll-view-item_H" v-for="(ite,ind) in publicRecordInfo"
@click="handlePageScrollTo(ite.id,ind)" :class="[ind == index?'active':'']">
{{ite.name}}
</text>
</scroll-view>
</view>
<view class="calendar">
2025-05-30 11:14:38 +08:00
<!-- 日历 -->
<ren-calendar ref='ren' :markDays='markDays' @onDayClick='onDayClick' @onMonthClickPre='onMonthClickPre'
v-if="isShow">
</ren-calendar>
<!-- -->
<view class="box" v-if="infoList.length">
<view class="list" v-for="(item,index) in infoList" :key="index" @click="addMemberTags(item.id,item)">
<view class="item">
<view class="check">
<uni-icons :type="isActive.indexOf(item.id)!=-1?'checkbox-filled':'circle'" size="22"
:color="isActive.indexOf(item.id)!=-1?'#FEC407':'#dfdfdf'"></uni-icons>
</view>
<view>{{item.v1}}<text>{{item.v1_name}}</text></view>
<view v-if="item.v2">{{item.v2}}<text>{{item.v2_name}}</text></view>
<view v-if="item.v3">{{item.v3}}<text>{{item.v3_name}}</text></view>
</view>
</view>
</view>
<!-- -->
<view class="bottom">
<view class="list" v-for="(ite,ind) in ActiveDays" :key="ind" v-if="isActive"
@click="addMemberTags(ite.id,ite)">
<view class="item borderRadius">
<view class="time">{{ite.r_t}}</view>
<view>{{ite.v1}}<text>{{ite.v1_name}}</text></view>
<view v-if="ite.v2">{{ite.v2}}<text>{{ite.v2_name}}</text></view>
<view v-if="ite.v3">{{ite.v3}}<text>{{ite.v3_name}}</text></view>
<view class="check">
<uni-icons type="clear" size="22" color="#999"></uni-icons>
</view>
</view>
</view>
<view class="pkclass" v-if="length==2">vs</view>
<view :class="{'active':length!=2}" class="btn" @click="handlePK">对比</view>
</view>
</view>
</view>
</template>
<script>
import RenCalendar from '@/element/ren-calendar/ren-calendar.vue';
import {
mapState
} from "vuex";
export default {
data() {
return {
markDays: [],
infoList: [],
list: [],
isActive: [],
ActiveDays: [],
startM: null,
endM: null,
isShow: true,
2026-03-23 09:50:49 +08:00
index: 0,
2025-05-30 11:14:38 +08:00
}
},
components: {
RenCalendar,
},
computed: {
2026-03-23 09:50:49 +08:00
...mapState(["user", "PublicRecord"]),
2025-05-30 11:14:38 +08:00
length() {
return this.isActive.length
},
endDate() {
return this.$tools.getDate("start")
},
2026-03-23 09:50:49 +08:00
publicRecordInfo() {
let that = this
return that.PublicRecord
},
2025-05-30 11:14:38 +08:00
},
2026-03-23 09:50:49 +08:00
onLoad() {
2025-05-30 11:14:38 +08:00
let that = this
2026-03-23 09:50:49 +08:00
that.handlonLoad()
2025-05-30 11:14:38 +08:00
},
methods: {
2026-03-23 09:50:49 +08:00
handlePageScrollTo(id, ind) {
let that = this
that.index = ind
that.handlonLoad()
},
handlonLoad() {
let that = this
that.startM = that.$tools.getDate("m").substring(0, 10)
that.endM = that.$tools.getDate("m").substring(11, 21)
that.markDays = []
that.list = []
that.infoList = []
that.isActive = []
that.ActiveDays = []
that.$nextTick(() => {
that.isShow = true
that.getList(that.startM, that.endM)
})
},
2025-05-30 11:14:38 +08:00
getList(start, end) {
let that = this
that.$model.getresultdiff({
2026-03-23 09:50:49 +08:00
aud_id: that.user.aud_id,
2025-05-30 11:14:38 +08:00
s_time: start,
e_time: end,
2026-03-23 09:50:49 +08:00
type: that.publicRecordInfo[that.index].key_word
2025-05-30 11:14:38 +08:00
}).then(res => {
if (res) {
that.markDays = res.Dlist
that.list = res.data
for (var i = 0; i < res.data.length; i++) {
if (Date.parse(that.endDate) == Date.parse(res.data[i].r_t)) {
that.infoList.push(res.data[i])
}
}
2026-03-23 09:50:49 +08:00
console.log("对比", res, )
2025-05-30 11:14:38 +08:00
}
})
},
onMonthClickPre(data) {
console.log("onMonthClickPre", data)
let that = this
let start = data.substring(0, 10)
let end = data.substring(11, 21)
that.infoList = []
that.markDays = []
that.list = []
that.getList(start, end)
},
onDayClick(data) {
let that = this
this.infoList = []
for (var i = 0; i < that.list.length; i++) {
if (Date.parse(data.date) == Date.parse(that.list[i].r_t)) { //includes 检测数组是否有某个值
this.infoList.push(that.list[i]);
}
}
},
addMemberTags(index, item) {
var that = this;
console.log("addMemberTags", index, item)
// if (this.user.type != 1) return
if (that.isActive.indexOf(index) == -1) {
that.isActive.push(index);
that.ActiveDays.push(item);
} else {
that.isActive.splice(that.isActive.indexOf(index), 1);
that.ActiveDays.splice(that.ActiveDays.indexOf(item), 1);
}
if (that.isActive.length > 2) {
that.isActive.splice(0, 1)
that.ActiveDays.splice(0, 1);
}
},
handlePK() {
let that = this
if (that.isActive.length != 2) {
that.$tools.msg("请先选择数据!")
return
}
let info = {}
info.before_id = that.isActive[0]
info.after_id = that.isActive[1]
2026-03-23 09:50:49 +08:00
info.type = that.publicRecordInfo[that.index].key_word
2025-05-30 11:14:38 +08:00
console.log("1111", info, that.isActive)
uni.navigateTo({
url: "/pageTwo/compk/pkdetail?info=" + JSON.stringify(info)
})
},
},
}
</script>
<style scoped lang="scss">
2026-03-23 09:50:49 +08:00
.tagList {
width: 100%;
height: 45px;
line-height: 45px;
background: #fff;
box-shadow: 0px 1px 5px 2px #dfe2e1fc;
position: fixed;
top: 0;
z-index: 999;
.active {
color: $maincolor;
font-weight: bold;
font-size: 16px;
}
.scroll-view_H {
white-space: nowrap;
width: 100%;
.scroll-view-item_H {
display: inline-block;
height: 45rpx;
line-height: 45rpx;
text-align: center;
}
}
text {
color: #666;
padding: 0 15px;
}
}
.calendar{
margin-top: 50px;
}
2025-05-30 11:14:38 +08:00
</style>