| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305 |
- <template>
- <view class="my-msg">
- <uv-navbar title="我的消息" placeholder autoBack>
- <template v-slot:right>
- <view class="uv-nav-slot">
- <image
- class="clear-icon"
- :src="$handleImageUrl('/czd/clear.png')"
- mode=""
- @click.stop="messageAllRead()"
- ></image>
- </view>
- </template>
- </uv-navbar>
- <view class="middle">
- <!-- <view class="item" @click="goTodel(0, '活动消息')">
- <view class="left">
- <image
- :src="$handleImageUrl('/czd/myMsg_iocn1.png')"
- mode=""
- ></image>
- </view>
- <view class="right">
- <view class="msg">
- <view class="name">
- 活动消息
- <text
- class="count"
- v-if="titleOne.num == 0 ? false : titleOne.num"
- >{{ titleOne.num }}</text
- >
- </view>
- <view class="time">{{ titleOne.time ? titleOne.time : "" }}</view>
- </view>
- <view class="advertisement">{{
- titleOne.remark ? titleOne.remark : ""
- }}</view>
- </view>
- </view> -->
- <view class="item" @click="goTodel(1, '支付消息')">
- <view class="left">
- <!-- <text class="iconfont"></text> -->
- <image
- :src="$handleImageUrl('/czd/myMsg_iocn5.png')"
- mode=""
- ></image>
- </view>
- <view class="right right2">
- <view class="msg">
- <view class="name">
- 支付消息
- <text class="count" v-if="titleTwo == 0 ? false : titleTwo.num">{{
- titleTwo.num
- }}</text>
- </view>
- <view class="time">{{ titleTwo.time ? titleTwo.time : "" }}</view>
- </view>
- <view class="advertisement">{{
- titleTwo.remark ? titleTwo.remark : ""
- }}</view>
- </view>
- </view>
- <view class="item" @click="goTodel(2, '物流消息')">
- <view class="left right3">
- <!-- <text class="iconfont"></text> -->
- <image
- :src="$handleImageUrl('/czd/myMsg_iocn3.png')"
- mode=""
- ></image>
- </view>
- <view class="right right4">
- <view class="msg">
- <view class="name">
- 物流消息
- <text
- class="count"
- v-if="titleThree.num == 0 ? false : titleThree.num"
- >{{ titleThree.num }}</text
- >
- </view>
- <view class="time">{{
- titleThree.time ? titleThree.time : ""
- }}</view>
- </view>
- <view class="advertisement">{{
- titleThree.remark ? titleThree.remark : ""
- }}</view>
- </view>
- </view>
- <view class="item" @click="goTodel(3, '售后消息')">
- <view class="left">
- <!-- <text class="iconfont"></text> -->
- <image
- :src="$handleImageUrl('/czd/myMsg_iocn2.png')"
- mode=""
- ></image>
- </view>
- <view class="right right5">
- <view class="msg">
- <view class="name">
- 售后消息
- <text
- class="count"
- v-if="titleFour == 0 ? false : titleFour.num"
- >{{ titleFour.num }}</text
- >
- </view>
- <view class="time">{{ titleFour.time ? titleFour.time : "" }}</view>
- </view>
- <view class="advertisement">{{
- titleFour.remark ? titleFour.remark : ""
- }}</view>
- </view>
- </view>
- <!-- <view class="item" @click="goTodel(4, '系统消息')">
- <view class="left">
- <image :src="$handleImageUrl('/czd/myMsg_iocn4.png')" mode=""></image>
- </view>
- <view class="right right5">
- <view class="msg">
- <view class="name">
- 系统消息
- <text class="count" v-if="titleSix == 0 ? false : titleSix.num">{{
- titleSix.num
- }}</text>
- </view>
- <view class="time">{{ titleSix.time ? titleSix.time : "" }}</view>
- </view>
- <view class="advertisement">{{
- titleSix.remark ? titleSix.remark : ""
- }}</view>
- </view>
- </view> -->
- </view>
- </view>
- </template>
- <script setup>
- import { ref } from "vue";
- import { onShow } from "@dcloudio/uni-app";
- import { messageUnreadInfo_Api, messageAllRead_Api } from "@/api/userInfo.js";
- const msg = ref([]);
- // const titleOne = ref({});
- const titleTwo = ref({});
- const titleThree = ref({});
- const titleFour = ref({});
- // const titleFive = ref({});
- const titleSix = ref({});
- const goTodel = (type, name) => {
- uni.navigateTo({
- url: "/pages/user/eventDetails?type=" + type + "&name=" + name,
- });
- };
- const getMsg = () => {
- messageUnreadInfo_Api().then((res) => {
- if (res && res.code == 200) {
- // console.log(res);
- msg.value = res.data;
- res.data.forEach((v) => {
- if (v.type == 1) titleTwo.value = v;
- else if (v.type == 2) titleThree.value = v;
- else if (v.type == 3) titleFour.value = v;
- else if (v.type == 4) titleSix.value = v;
- });
- }
- });
- };
- const messageAllRead = () => {
- uni.showModal({
- title: "提示",
- content: "是否确认清除所有未读消息?",
- success: (res) => {
- if (res.confirm) {
- console.log("用户点击确定");
- uni.showLoading({
- title: "加载中",
- mask: true,
- });
- messageAllRead_Api()
- .then((res) => {
- uni.hideLoading();
- if (res && res.code == 200) {
- getMsg();
- }
- })
- .catch((err) => {
- // uni.hideLoading();
- });
- } else if (res.cancel) {
- console.log("用户点击取消");
- }
- },
- });
- };
- onShow(() => {
- getMsg();
- });
- </script>
- <style scoped lang="scss">
- .middle {
- padding: 0 30rpx;
- .item {
- display: flex;
- align-items: center;
- padding: 30rpx 0 26rpx;
- border-bottom: 1rpx solid #e6e6e6;
- .left {
- margin-right: 24rpx;
- width: 78rpx;
- height: 78rpx;
- border-radius: 50%;
- // background: #4bbcfe;
- display: flex;
- align-items: center;
- justify-content: center;
- color: #fff;
- .iconfont {
- font-size: 48rpx;
- }
- image {
- width: 78rpx;
- height: 78rpx;
- border-radius: 50%;
- }
- }
- .left2 {
- background: #ad9be5;
- }
- .left3 {
- background: #4ed47f;
- }
- .left4 {
- background: #e4c78d;
- }
- .left5 {
- background: #fe9168;
- }
- .right {
- flex: 1;
- display: flex;
- flex-direction: column;
- justify-content: space-around;
- .msg {
- display: flex;
- justify-content: space-between;
- align-items: flex-start;
- .name {
- font-size: 28rpx;
- color: #1a1a1a;
- font-weight: 400;
- text {
- margin-left: 10rpx;
- color: #ffffff;
- font-size: 20rpx;
- font-weight: 400;
- padding: 0 6rpx;
- background-color: #ff0000;
- border-radius: 13rpx;
- }
- }
- .time {
- font-size: 26rpx;
- color: #999999;
- font-weight: 400;
- }
- }
- .advertisement {
- font-size: 24rpx;
- color: #999999;
- font-weight: 400;
- margin-top: 17rpx;
- }
- }
- }
- }
- .count {
- padding: 0px 11rpx !important;
- border-radius: 100rpx !important;
- }
- .clear-icon {
- width: 40rpx;
- height: 40rpx;
- }
- </style>
|