redEnvelopeTransfer.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <style>
  2. /**基本聊天数据**/
  3. .msg{padding: 20rpx;}
  4. .msg .msg-in{width: calc(100% - 160rpx); margin-left: 30rpx;}
  5. .msg .loading-msg{width:20px;height:20px;animation:rotate 1.5s linear infinite;margin-left: 20rpx;}
  6. .msg .msg-err{width:20px;height:20px;margin-left: 20rpx;}
  7. .msg .avatar{width: 80rpx;height: 80rpx;border-radius: 50%;overflow: hidden;margin-top: 6px;}
  8. .msg .avatar image{width: 80rpx;height: 80rpx;border-radius: 50%;}
  9. .msg .content{position: relative;min-height: 20px;font-size: 16px;background-color: #fb9f3c;width: 46vw;padding: 20rpx;border-radius: 8rpx;word-break:break-all;display:inline-block;}
  10. .msg .content .i{width: 0;height: 0;left: -10px;position: absolute;border-top: 10px solid transparent; border-right: 10px solid #fb9f3c; border-bottom: 10px solid transparent;}
  11. .msg .nickname{font-size: 12px;margin-bottom:6px;}
  12. .msg .red_envelope{background: #fb9f3c;}
  13. .msg .red_envelope .red-view{padding-bottom: 10px;}
  14. .msg .red_envelope .red-view image{width: 30px;height: 30px;}
  15. .msg .red_envelope .red-view .text{white-space:nowrap;overflow:hidden;text-overflow: ellipsis;font-size: 14px;color: #fff;width: calc(100% - 30px);}
  16. .msg .red_envelope .tag{padding-top: 10px;font-size: 12px;border-top: 1px solid rgba(255,255,255,0.6);color: #fff;}
  17. .msg.no-msg .content{background-color:rgba(251,159,60,0.6);}
  18. .msg.no-msg .red_envelope{background-color:transparent;}
  19. .me-msg{padding: 20rpx;}
  20. .msg-in{width: calc(100% - 140rpx); margin-right: 20rpx;}
  21. .me-msg .loading-msg{width:20px;height:20px;animation:rotate 1.5s linear infinite;margin-right: 20rpx;}
  22. .me-msg .msg-err{width:20px;height:20px;margin-right: 20rpx;}
  23. .me-msg .avatar{width: 80rpx;height: 80rpx;border-radius: 50%;overflow: hidden;}
  24. .me-msg .avatar image{width: 80rpx;height: 80rpx;border-radius: 50%;}
  25. .me-msg .content{position: relative;min-height: 20px;font-size: 16px;background-color: #fb9f3c;width: 46vw;padding: 20rpx;border-radius: 8rpx;word-break:break-all;display:inline-block;}
  26. .me-msg .content .i{width: 0;height: 0;right: -10px;position: absolute;border-top: 10px solid transparent; border-left: 10px solid #fb9f3c; border-bottom: 10px solid transparent;}
  27. .me-msg .red_envelope{background: #fb9f3c;}
  28. .me-msg .red_envelope .red-view{padding-bottom: 10px;}
  29. .me-msg .red_envelope .red-view image{width: 30px;height: 30px;}
  30. .me-msg .red_envelope .red-view .text{font-size: 14px;color: #fff;}
  31. .me-msg .red_envelope .tag{padding-top: 10px;font-size: 12px;border-top: 1px solid rgba(255,255,255,0.6);color: #fff;}
  32. .me-msg.no-msg .content{background-color:rgba(251,159,60,0.6);}
  33. .me-msg.no-msg .red_envelope{background-color:transparent;}
  34. .me-msg.no-msg .content .i{border-left-color:rgba(251,159,60,0.6);}
  35. .me-msg .nickname{font-size: 12px;margin-bottom:6px;margin-right: 6px;}
  36. /**结束**/
  37. </style>
  38. <template>
  39. <view>
  40. <view class="msg no-msg fx-r" v-if="item.user.uid != user.uid">
  41. <view class="avatar" @tap="tapUser(1)" hover-class="avatar-hover"><image :src="item.user.avatar" mode="aspectFill" ></image></view>
  42. <view class="msg-in">
  43. <view class="nickname">{{item.user.nickname}}</view>
  44. <view class="content" @tap="tapRedBack">
  45. <view class="i"></view>
  46. <view class="red_envelope">
  47. <view class="red-view fx-r">
  48. <image mode="widthFix" src="/static/img/chat-red-v2.svg"></image>
  49. <view class="text">
  50. <view >来自{{inItem.send.name}}的转账</view>
  51. <view class="tagv1">已收款</view>
  52. </view>
  53. </view>
  54. <view class="tag">红包转账</view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="me-msg no-msg fx-r fx-ae" v-else >
  60. <view class="msg-in fx-h fx-be fx-ae">
  61. <view class="nickname">{{item.user.nickname}}</view>
  62. <view class="msg-in fx-r fx-bc fx-ae">
  63. <image v-if="item.isSend == 0" class="loading-msg" src="/static/img/xloading.png"></image>
  64. <image v-if="item.isSend == -1" @tap="tapRsend" class="msg-err" src="/static/img/waring.png"></image>
  65. <view class="content" @tap="tapRedBack">
  66. <view class="i"></view>
  67. <view class="red_envelope">
  68. <view class="red-view fx-r">
  69. <image mode="widthFix" src="/static/img/chat-red-v2.svg"></image>
  70. <view class="text">
  71. <view >来自{{inItem.send.name}}的转账</view>
  72. <view class="tagv1">已收款</view>
  73. </view>
  74. </view>
  75. <view class="tag">红包转账</view>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. <view class="avatar" @tap="tapUser(0)" hover-class="avatar-hover"><image :src="item.user.avatar" mode="aspectFill" ></image></view>
  81. </view>
  82. </view>
  83. </template>
  84. <script>
  85. import {mapState,mapMutations } from 'vuex';
  86. export default {
  87. computed: mapState(['user','sysData']),
  88. name: 'redEnvelopeTransfer',
  89. props:{
  90. item : {
  91. type: Object,
  92. default: ()=>{return {data:{}} }
  93. }
  94. },
  95. watch:{
  96. item:{
  97. immediate:true,
  98. handler(val) {
  99. this.inItem = JSON.parse(val.data);
  100. console.log(val);
  101. }
  102. }
  103. },
  104. data() {
  105. return{
  106. inItem:{}
  107. }
  108. },
  109. created() {
  110. //console.log(this.item);
  111. },
  112. mounted() {
  113. },
  114. methods: {
  115. tapRsend:function() {
  116. this.$emit('rsend',this.item);
  117. },
  118. tapRedBack:function(){
  119. this.$emit('redItem',this.item);
  120. },
  121. tapUser:function(type){
  122. this.$emit('userItem',type == 0 ? this.user.uid : this.item.sendUid);
  123. }
  124. }
  125. }
  126. </script>