123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- <template>
- <view>
- <view class="u-page" v-if="orderList.length!=0">
- <u-swipe-action :show="item.show" :index="index" v-for="(item, index) in orderList" :key="index" @click="click(item.sendUserId)"
- @content-click="inSystem" @open="open(index)" :options="options">
- <navigator :url="'./System-message/index?sendUserId=' + item.sendUserId" class="item u-border-bottom">
- <u-image mode="widthFix" src="../../static/sailun/xiaoxi.png" width="120rpx" height="104rpx"/>
- <view style="display: flex;justify-content: space-between;width: 100%;">
- <view class="title-wrap" style="display: flex;flex-direction: column;justify-content: space-between;">
- <text class="title u-line-2">{{ item.msgTitle }}</text>
- <view class="title-wrap-one"> 【{{ item.sendUserName }} 】 </view>
- </view>
- <view class="title-wrap-two u-flex" style="flex-direction: column;align-items: flex-end;">
- <view>
- {{ item.gatTime | formatDate }}
- </view>
- <view style="margin:auto 0;">
- <view v-if="!item.unread"> </view>
- <view v-else>
- <view class="title-wrap-two-one u-flex u-row-center">
- <text>
- {{ item.unread }}
- </text>
- </view>
- </view>
- </view>
- </view>
- </view>
- </navigator>
- </u-swipe-action>
- </view>
- <view v-else class="u-flex u-row-center" style="height: 100vh;">
- <u-empty :text="$t('message.noData')" mode="message"></u-empty>
- </view>
- </view>
- </template>
- <script>
- import {
- request
- } from "../../common/request/request";
- require("promise.prototype.finally").shim();
- export default {
- data() {
- return {
- currentdate: "",
- orderList: [],
- disabled: false,
- btnWidth: 180,
- show: false,
- options: [{
- text: this.$t('message.deleted'),
- style: {
- backgroundColor: "#dd524d",
- },
- }, ],
- };
- },
- created() {
- uni.setNavigationBarTitle({
- title: this.$t('message.title')
- });
- },
- onShow() {
- this.getDate();
- },
- filters: {
- formatDate: function(time) {
- var now = new Date();
- var year = now.getFullYear();
- var month = now.getMonth() + 1;
- var day = now.getDate();
- if (month < 10) {
- month = "0" + month;
- }
- if (day < 10) {
- day = "0" + day;
- }
- let nowDay = year + "-" + month + "-" + day;
- if (nowDay != time.substring(0, 10)) {
- return time.substring(0, 10);
- } else {
- return time.substring(11, 19);
- }
- },
- },
- methods: {
- getDate() {
- request({
- url: "/appMessage/getMessageCategory",
- method: "post",
- data: {
- acceptUserId: this.$store.state.storeInfo.storeId,
- userId: this.$store.state.storeInfo.userId,
- },
- })
- .then((res) => {
- this.orderList = res.data.category;
- for (let i = 0; i < this.orderList.length; i++) {
- this.gatTime = this.orderList[i].gatTime;
- }
- })
- .catch((err) => {})
- .finally(() => {
- setTimeout(() => {
- this.loading = false;
- }, 300);
- });
- },
- inSystem(index) {},
- click(index) {
- request({
- url: "/appMessage/deleteMessage",
- method: "post",
- data: {
- acceptUserId: this.$store.state.storeInfo.storeId,
- sendUserId: index,
- userId: this.$store.state.storeInfo.userId,
- },
- })
- .then((res) => {
- this.$u.toast(this.$t('message.deletedSuc'));
- this.getDate();
- })
- .catch((err) => {})
- .finally(() => {
- setTimeout(() => {
- this.loading = false;
- }, 300);
- });
- },
- // 如果打开一个的时候,不需要关闭其他,则无需实现本方法
- open(index) {
- this.orderList[index].show = true;
- this.orderList.map((val, idx) => {
- if (index != idx) this.orderList[idx].show = false;
- });
- // })
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .u-page {
- margin-bottom: 100rpx;
- }
- .item {
- display: flex;
- padding: 20rpx;
- }
- .title {
- text-align: left;
- font-size: 34rpx;
- color: #333333;
- font-weight: bold;
- }
- .title-wrap {
- width: 280rpx;
- margin-left: 15rpx;
- }
- .title-wrap-one {
- font-size: 24rpx;
- color: #999999;
- }
- .title-wrap-two>view:nth-child(1) {
- font-size: 24rpx;
- color: #999999;
- }
- .title-wrap-two-one {
- width: 40rpx;
- height: 40rpx;
- background: #fc3228;
- border-radius: 50%;
- color: #fff;
- text-align: center;
- font-size: 20rpx;
- }
- </style>
|