message-custom.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <div class="custom" style="font-size: 14px">
  3. <!-- 发送产品自定义消息 -->
  4. <template v-if="isCustom.businessID === 'hm_goods_message'">
  5. <view>
  6. <view class="qzy-center item-main" @click="toDetail(isCustom)">
  7. <image class="item-l" :src="isCustom.coverImg" mode="scaleToFill" />
  8. <view class="item-r">
  9. <view class="text-14 text-bold item-title ellipsis-nowrap">
  10. {{ isCustom.title }}
  11. </view>
  12. <view class="qzy-center text-500">
  13. <text class="text-12">¥</text>
  14. <text class="text-18">{{ isCustom.price }}</text>
  15. <i class="text-12">/{{ isCustom.unit }}</i>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. </div>
  22. </template>
  23. <script lang="ts" setup>
  24. import { watchEffect, ref } from "../../../../adapter-vue";
  25. import {
  26. TUITranslateService,
  27. IMessageModel,
  28. } from "@tencentcloud/chat-uikit-engine";
  29. import { isUrl, JSONToObject } from "../../../../utils/index";
  30. import { CHAT_MSG_CUSTOM_TYPE } from "../../../../constant";
  31. import { ICustomMessagePayload } from "../../../../interface";
  32. import Icon from "../../../common/Icon.vue";
  33. import star from "../../../../assets/icon/star-light.png";
  34. import api from "@/api/home.js";
  35. const ownId = uni.getStorageSync("userId");
  36. interface IEmits {
  37. (key: "scrollToLatestMessage"): void;
  38. }
  39. const emits = defineEmits<IEmits>();
  40. interface Props {
  41. messageItem: IMessageModel;
  42. content: any;
  43. }
  44. const props = withDefaults(defineProps<Props>(), {
  45. messageItem: undefined,
  46. content: undefined,
  47. });
  48. const custom = ref();
  49. const message = ref<IMessageModel>();
  50. const extension = ref();
  51. const isCustom = ref<ICustomMessagePayload>({
  52. businessID: "",
  53. });
  54. watchEffect(() => {
  55. custom.value = props.content;
  56. message.value = props.messageItem;
  57. const { payload } = props.messageItem;
  58. isCustom.value = payload.data || "";
  59. isCustom.value = JSON.parse(payload.data);
  60. if (payload.data === CHAT_MSG_CUSTOM_TYPE.SERVICE) {
  61. extension.value = JSONToObject(payload.extension);
  62. }
  63. });
  64. const toDetail = (item) => {
  65. let shopId = uni.getStorageSync("userId");
  66. if (!shopId.includes("E")) {
  67. uni.navigateTo({
  68. url:
  69. "/pages/user/list/detail?id=" +
  70. item.goodsId +
  71. "&type=" +
  72. item.type +
  73. "&title=" +
  74. item.title,
  75. });
  76. }
  77. };
  78. </script>
  79. <style lang="scss" scoped>
  80. @import "../../../../assets/styles/common";
  81. .phone {
  82. min-width: 180px;
  83. height: 65px;
  84. border-radius: 10px;
  85. display: flex;
  86. flex-direction: row;
  87. align-items: center;
  88. justify-content: center;
  89. padding: 2px;
  90. }
  91. .xian {
  92. width: 408rpx;
  93. height: 1rpx;
  94. background: #000000;
  95. opacity: 0.1;
  96. }
  97. .phone_footer {
  98. display: flex;
  99. flex-direction: row;
  100. justify-content: space-around;
  101. position: relative;
  102. top: 8px;
  103. height: 25px;
  104. align-items: center;
  105. }
  106. a {
  107. color: #405eff;
  108. }
  109. .custom {
  110. font-size: 14px;
  111. h1 {
  112. font-size: 14px;
  113. color: #000;
  114. }
  115. h1,
  116. a,
  117. p {
  118. font-size: 14px;
  119. }
  120. .evaluate {
  121. ul {
  122. display: flex;
  123. padding: 10px 0;
  124. }
  125. &-list {
  126. display: flex;
  127. flex-direction: row;
  128. &-item {
  129. padding: 0 2px;
  130. }
  131. }
  132. }
  133. .order {
  134. display: flex;
  135. min-height: 250px;
  136. min-width: 215px;
  137. flex-direction: column;
  138. padding: 5px;
  139. .header {
  140. width: 100%;
  141. height: 55px;
  142. display: flex;
  143. flex-direction: row;
  144. justify-content: space-between;
  145. }
  146. .contont {
  147. display: flex;
  148. flex-direction: column;
  149. justify-content: space-around;
  150. align-items: flex-start;
  151. height: 190px;
  152. .title {
  153. font-family: PingFang SC;
  154. font-weight: 500;
  155. font-size: 26rpx;
  156. color: #a1a1a1;
  157. line-height: 44rpx;
  158. }
  159. .value {
  160. font-family: PingFang SC;
  161. font-weight: 500;
  162. font-size: 30rpx;
  163. color: #666666;
  164. line-height: 44rpx;
  165. }
  166. }
  167. .main {
  168. padding-left: 5px;
  169. width: 90%;
  170. line-height: 25px;
  171. }
  172. img {
  173. width: 45px;
  174. height: 45px;
  175. }
  176. }
  177. .data-time {
  178. background: #f4f4f4;
  179. padding: 10upx 24upx;
  180. }
  181. .item-l {
  182. width: 60px;
  183. height: 60px;
  184. border-radius: 6upx;
  185. margin-right: 22upx;
  186. }
  187. .item-r {
  188. width: calc(100% - 70px);
  189. padding: 10upx 0;
  190. }
  191. .item-row {
  192. text {
  193. display: block;
  194. }
  195. }
  196. i {
  197. font-style: normal;
  198. }
  199. .invite-box {
  200. .item-row {
  201. padding: 10upx 0;
  202. }
  203. }
  204. }
  205. .operate-box {
  206. margin-top: 10px;
  207. padding-top: 10px;
  208. text-align: center;
  209. font-weight: bold;
  210. font-size: 32upx;
  211. }
  212. .in {
  213. .operate-box {
  214. color: #405eff;
  215. border-top: 1px solid #f4f4f4;
  216. }
  217. .item-main {
  218. background: #f4f4f4;
  219. padding: 14upx;
  220. border-radius: 16rpx;
  221. }
  222. }
  223. .out {
  224. .operate-box {
  225. border-top: 1px solid rgba(255, 255, 255, 0.5);
  226. color: #fff;
  227. }
  228. .item-main {
  229. background: #405eff;
  230. padding: 14upx;
  231. border-radius: 16rpx;
  232. }
  233. }
  234. </style>