Files
cashier_app/pageChat/components/chat-item.vue
2025-12-04 16:25:51 +08:00

77 lines
1.7 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<text class="" v-if="item.msg_type == 1">{{ item.content }}</text>
<image
v-if="item.msg_type == 2"
:src="item.image_url"
class="img"
mode="widthFix"
@click="previewImage(item.image_url)"
></image>
<video
@error="videoErrorCallback"
v-if="item.msg_type == 5"
:src="item.image_url"
class="img"
mode="widthFix"
@click="previewVideo(item.video_url)"
></video>
<view class="" v-if="item.msg_type == 4">
<view>{{ item.coupon.title }}</view>
<view class="u-m-t-16 bg-f7 coupon u-flex">
<view class="left">
<view class="price">
<text class="u-font-32">¥</text>
<text style="font-size: 72rpx;">15</text>
</view>
<view class="u-font-24 color-999 no-wrap">{{item.coupon.fullAmount}}可用</view>
</view>
<view class="right u-p-l-28">
<view class="u-font-32 ">{{item.coupon.couponName}}</view>
<view class="u-font-24 color-999 u-m-t-8">有效期{{ returnTime(item.coupon) }} </view>
</view>
</view>
</view>
</template>
<script setup>
const props = defineProps({
item: {
type: Object,
default: () => {},
},
});
function previewImage(url) {
uni.previewImage({
urls: [url],
});
}
function returnTime(coupon){
let startTime = coupon.useStartTime;
let endTime = coupon.useEndTime;
if(startTime && endTime){
return startTime.split(' ')[0] + '-' + endTime.split(' ')[0]
}
}
</script>
<style lang="scss" scoped>
.img {
width: 50vw;
}
.coupon{
padding: 16rpx 10rpx;
border-radius: 16rpx;
.price{
color: #FF1C1C;
font-weight: 700;
}
.left{
padding-right: 26rpx;
border-right: 1rpx solid #EDEDED;
}
.right{
}
}
</style>