订单列表显示,修改bug

master
2022-12-29 18:19:17 +08:00
parent cfb4310d6f
commit 8c33b899bf
3 changed files with 137 additions and 29 deletions

View File

@ -71,4 +71,12 @@ export function jumpObtain(skuId, goodsId) {
method: Method.GET, method: Method.GET,
}); });
} }
// 清除未读
// /im/message/clean/unred
export function clearmeaager() {
return http.request({
url: `${api.im}/message/clean/unred`,
method: Method.PUT,
});
}

View File

@ -1,5 +1,5 @@
<template> <template>
<view> <view class="wrapper">
<u-navbar class="my-title" title-size="32" back-text="" :title="toUser.name"></u-navbar> <u-navbar class="my-title" title-size="32" back-text="" :title="toUser.name"></u-navbar>
<!-- 空盒子用来防止消息过少时 拉起键盘会遮盖消息 --> <!-- 空盒子用来防止消息过少时 拉起键盘会遮盖消息 -->
<view :animation="anData" style="height:0;"> <view :animation="anData" style="height:0;">
@ -20,27 +20,41 @@
<view class="flex justify-end" style="width: 400rpx;margin-top: 12px;"> <view class="flex justify-end" style="width: 400rpx;margin-top: 12px;">
<view> <view>
<view class="user-name">{{ user.nickName }}</view> <view class="user-name">{{ user.nickName }}</view>
<view class="margin-left padding-chat bg-user-orang" style="border-radius: 35rpx;"> <view class="margin-left padding-chat bg-user-orang" style="border-radius: 35rpx; ">
<text style="word-break: break-all;" v-if="item.messageType === 'MESSAGE'">{{ item.text }}</text> <text style="word-break: break-all;" v-if="item.messageType === 'MESSAGE'">{{ item.text }}</text>
<view v-else> <view v-if="item.messageType == 'GOODS'">
<view class="goodsCard u-flex u-row-between u-p-b-0" style="width:100%;margin: 0 0; "> <view class="goodsCard u-flex u-row-between u-p-b-0" style="width:100%;margin: 0 0; ">
<view class="imagebox" @click="jumpGoodDelic"> <view class="imagebox" @click="jumpGoodDelic">
<image class="image" :src="JSON.parse(item.text).thumbnail" mode="widthFix"></image> <image class="image" :src="JSON.parse(item.text)['thumbnail']" mode="widthFix"></image>
</view> </view>
<view class="goodsdesc" @click="jumpGoodDelic"> <view class="goodsdesc" @click="jumpGoodDelic">
<view class="goodsdesc-name"> <view class="goodsdesc-name">
<text class="goodsCard_goodNmae">{{ <text class="goodsCard_goodNmae">{{
JSON.parse(item.text).goodsName JSON.parse(item.text)['goodsName']
}}</text> }}</text>
</view> </view>
<view class="goodsdesc-rice" style="margin-top:10rpx; color: orange;"><text <view class="goodsdesc-rice" style="margin-top:10rpx; color: orange;"><text
style="font-size:20rpx;">¥{{ style="font-size:20rpx;">¥{{
JSON.parse(item.text).price JSON.parse(item.text)['price']
}}</text> }}</text>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view v-if="item.messageType === 'ORDER'">
<view class="orderSn">
<text>订单号{{ JSON.parse(item.text)['sn'] }}</text>
<view class="oederList">
<img style="height: 120rpx; width: 120rpx; margin-top: 15rpx;"
:src="JSON.parse(item.text)['groupImages']" mode="widthFix" />
<view class="groupNameOrTime">
<text @click="linkTosOrders(JSON.parse(item.text)['sn'])">{{ JSON.parse(item.text)['groupName']
}}</text>
<view class="orderTime"> <text>{{ JSON.parse(item.text)['paymentTime'] }}</text></view>
</view>
</view>
</view>
</view>
</view> </view>
</view> </view>
</view> </view>
@ -65,51 +79,68 @@
<view class="other-name">{{ toUser.name }}</view> <view class="other-name">{{ toUser.name }}</view>
<view class="margin-left padding-chat flex-column-start bg-to-color" style="border-radius: 35rpx;"> <view class="margin-left padding-chat flex-column-start bg-to-color" style="border-radius: 35rpx;">
<text style="word-break: break-all;" v-if="item.messageType === 'MESSAGE'">{{ item.text }}</text> <text style="word-break: break-all;" v-if="item.messageType === 'MESSAGE'">{{ item.text }}</text>
<view v-else> <view v-if="item.messageType === 'GOODS'">
<view class="goodsCard u-flex u-row-between u-p-b-0" style="width:100%;margin: 0 0; "> <view class="goodsCard u-flex u-row-between u-p-b-0" style="width:100%;margin: 0 0; ">
<view class="imagebox" @click="jumpGoodDelic"> <view class="imagebox" @click="jumpGoodDelic">
<image class="image" :src="JSON.parse(item.text).thumbnail" mode="widthFix"></image> <image class="image" :src="JSON.parse(item.text)['thumbnail']" mode="widthFix"></image>
</view> </view>
<view class="goodsdesc" @click="jumpGoodDelic"> <view class="goodsdesc" @click="jumpGoodDelic">
<view class="goodsdesc-name"> <view class="goodsdesc-name">
<text class="goodsCard_goodNmae">{{ <text class="goodsCard_goodNmae">{{
JSON.parse(item.text).goodsName JSON.parse(item.text)['goodsName']
}}</text> }}</text>
</view> </view>
<view class="goodsdesc-rice" style="margin-top:10rpx; color: orange;"><text <view class="goodsdesc-rice" style="margin-top:10rpx; color: orange;"><text
style="font-size:20rpx;">¥{{ style="font-size:20rpx;">¥{{
JSON.parse(item.text).price JSON.parse(item.text)['price']
}}</text> }}</text>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view v-if="item.messageType === 'ORDER'">
<view class="orderSn">
<text>订单号{{ JSON.parse(item.text)['sn'] }}</text>
<view class="oederList">
<img style="height: 120rpx; width: 120rpx; margin-top: 15rpx;"
:src="JSON.parse(item.text)['groupImages']" mode="widthFix" />
<view class="groupNameOrTime">
<text @click="linkTosOrders(JSON.parse(item.text)['sn'])">{{ JSON.parse(item.text)['groupName']
}}</text>
<view class="orderTime"> <text>{{ JSON.parse(item.text)['paymentTime'] }}</text></view>
</view>
</view>
</view>
</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="cartMessage" v-if="showHide && !localImGoodsId && showHideModel"> <!-- 如果没有聊天记录定位到底部 -->
<view class="goodsCard u-flex u-row-between u-p-b-0"> <view
<view class="imagebox" @click="jumpGoodDelic"> :style="{ position: msgList.length == 0 ? 'fixed' : '', bottom: msgList.length == 0 ? '50px' : '', width: msgList.length == 0 ? '100%' : '' }">
<image class="image" :src="goodLiistData.thumbnail" mode="widthFix"></image> <view class="cartMessage" v-if="showHide && !localImGoodsId && showHideModel">
</view> <view class="goodsCard u-flex u-row-between u-p-b-0">
<view class="goodsdesc" @click="jumpGoodDelic"> <view class="imagebox" @click="jumpGoodDelic">
<view class="goodsdesc-name"> <image class="image" :src="goodLiistData.thumbnail" mode="widthFix"></image>
</view>
<text class="goodsCard_goodNmae">{{ <view class="goodsdesc" @click="jumpGoodDelic">
<view class="goodsdesc-name">
<text class="goodsCard_goodNmae">{{
goodLiistData.goodsName goodLiistData.goodsName
}}</text> }}</text>
</view> </view>
<view class="goodsdesc-rice" style="margin-top:10rpx; color: orange;"><text style="font-size:20rpx;">¥{{ <view class="goodsdesc-rice" style="margin-top:10rpx; color: orange;"><text style="font-size:20rpx;">¥{{
goodLiistData.price goodLiistData.price
}}</text> }}</text>
</view>
</view>
<view class="cancel" @click="cancenModel">X</view>
<view class="sendGood" @click="sendGoodsMessage">
<view>发送商品</view>
</view> </view>
</view>
<view class="cancel" @click="cancenModel">X</view>
<view class="sendGood" @click="sendGoodsMessage">
<view>发送商品</view>
</view> </view>
</view> </view>
</view> </view>
@ -233,6 +264,9 @@ export default {
}, },
data () { data () {
return { return {
fixed: 'fixed',
bottom: '50px',
width: '100%',
showHideModel: undefined, showHideModel: undefined,
localImGoodsId: '', localImGoodsId: '',
showHide: true, showHide: true,
@ -274,6 +308,14 @@ export default {
} }
}, },
methods: { methods: {
//
linkTosOrders (val) {
console.log(val);
uni.navigateTo({
url: '/pages/order/orderDetail?sn=' + val,
});
},
// //
jumpGoodDelic () { jumpGoodDelic () {
uni.navigateTo({ uni.navigateTo({
@ -294,6 +336,14 @@ export default {
this.msgList.push({ "text": JSON.stringify(this.goodLiistData), "my": true, "messageType": 'GOODS' }) this.msgList.push({ "text": JSON.stringify(this.goodLiistData), "my": true, "messageType": 'GOODS' })
this.showHide = false this.showHide = false
storage.setImGoodsLink(this.params.talkId) storage.setImGoodsLink(this.params.talkId)
//
this.$nextTick(() => {
uni.pageScrollTo({
scrollTop: 2000000,
duration: 0
});
})
}, },
// //
cancenModel () { cancenModel () {
@ -331,12 +381,12 @@ export default {
}, },
// //
msgGo (type) { msgGo (type) {
console.log(type, 'typetypetype');
const query = uni.createSelectorQuery() const query = uni.createSelectorQuery()
// 100ms // 100ms
setTimeout(() => { setTimeout(() => {
// //
query.select('#msgList').boundingClientRect(data => { query.select('#msgList').boundingClientRect(data => {
// scorllscorll // scorllscorll
if (type == 'up') { if (type == 'up') {
this.go = data.height - this.oldHeight this.go = data.height - this.oldHeight
@ -454,6 +504,7 @@ export default {
}) })
} }
}) })
this.msgGo(type) this.msgGo(type)
}, },
touchMoreMessage (e) { touchMoreMessage (e) {
@ -546,6 +597,43 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.orderTime {
margin-top: 15rpx;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.wrapper {
height: auto !important;
}
.oederList {
display: flex;
color: black;
font-size: 20rpx;
font-weight: bold;
width: 95%;
}
.orderSn {
width: 350rpx;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.groupNameOrTime {
margin: 15rpx 15rpx;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.orderGood {
background-color: #ffffff;
}
.goodsCard { .goodsCard {
border-radius: 20rpx; border-radius: 20rpx;
margin-top: 15rpx; margin-top: 15rpx;
@ -556,7 +644,8 @@ export default {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
color: #302c2b; color: #302c2b;
position: relative;
.imagebox { .imagebox {
width: 122rpx; width: 122rpx;

View File

@ -37,6 +37,7 @@
<view class="talk-message"> <view class="talk-message">
<span v-if="item.lastMessageType == 'MESSAGE'">{{ item.lastTalkMessage }}</span> <span v-if="item.lastMessageType == 'MESSAGE'">{{ item.lastTalkMessage }}</span>
<span v-if="item.lastMessageType == 'GOODS'">[]</span> <span v-if="item.lastMessageType == 'GOODS'">[]</span>
<span v-if="item.lastMessageType == 'ORDER'">[]</span>
</view> </view>
</view> </view>
<view class="talk-time"> <view class="talk-time">
@ -56,7 +57,7 @@
</template> </template>
<script> <script>
import { getTalkList } from "@/api/im.js"; import { getTalkList, clearmeaager } from "@/api/im.js";
import storage from "@/utils/storage.js"; import storage from "@/utils/storage.js";
import { beautifyTime } from "@/utils/filters.js" import { beautifyTime } from "@/utils/filters.js"
export default { export default {
@ -112,6 +113,7 @@ export default {
uni.hideLoading(); uni.hideLoading();
if (res.data.success) { if (res.data.success) {
this.talkList = res.data.result; this.talkList = res.data.result;
console.log(this.talkList, 'this.talkListthis.talkList');
} }
}); });
}, },
@ -121,7 +123,16 @@ export default {
}); });
}, },
cleanUnread () { cleanUnread () {
alert(1) clearmeaager().then((res) => {
console.log(res);
if (res.data.code == 200) {
this.userTalkList();
uni.showToast({
icon: "none",
title: res.data.message,
});
}
})
}, },
}, },
}; };