message-custom.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. <template>
  2. <div class="custom">
  3. <!-- {{ isCustom }} -->
  4. <template v-if="isCustom.businessID === 'product_message'">
  5. <div class="evaluate">
  6. <div @click="product(isCustom)">
  7. <div class="left">
  8. <img
  9. :src="isCustom.pic"
  10. style="width: 80px; height: 80px; border-radius: 10px"
  11. />
  12. <div class="right">
  13. <div class="label">
  14. {{ isCustom.spuName }}
  15. </div>
  16. <div style="font-weight: 400; font-size: 28rpx">
  17. {{ isCustom.price }}元/{{ isCustom.unit }}
  18. </div>
  19. </div>
  20. </div>
  21. </div>
  22. </div>
  23. </template>
  24. <template v-else-if="isCustom.businessID === 'modify_order_cost'">
  25. <div class="evaluate">
  26. <span style="font-size: 36rpx; line-height: 44rpx"
  27. >老板,请及时修改订单费用!</span
  28. >
  29. <div @click="productOrder(isCustom)" style="margin-top: 10px">
  30. <div class="left">
  31. <img
  32. :src="isCustom.pic"
  33. style="width: 80px; height: 80px; border-radius: 10px"
  34. />
  35. <div class="right">
  36. <div class="label">
  37. {{ isCustom.spuName }}
  38. </div>
  39. <div style="font-weight: 400; font-size: 28rpx">
  40. {{ isCustom.price }}元/{{ isCustom.unit }}
  41. </div>
  42. </div>
  43. </div>
  44. <div style="line-height: 32px; margin-top: 10px">
  45. <div>
  46. <span class="name">姓名 :</span>
  47. <span class="value">{{ isCustom.consigneeContactName }}</span>
  48. </div>
  49. <div>
  50. <span class="name">电话 :</span>
  51. <span class="value">{{ isCustom.consigneeContactMobile }}</span>
  52. </div>
  53. <div>
  54. <span class="name">地址 :</span>
  55. <span class="value">{{ isCustom.consigneeAddressDetail }}</span>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. </template>
  61. <template v-else-if="isCustom.businessID === 'reminder_pay'">
  62. <div class="evaluate">
  63. <span style="font-size: 36rpx; line-height: 44rpx">亲,请及时付款!</span>
  64. <div @click="productOrder(isCustom)" style="margin-top: 10px">
  65. <div class="left">
  66. <img
  67. :src="isCustom.pic"
  68. style="width: 80px; height: 80px; border-radius: 10px"
  69. />
  70. <div class="right">
  71. <div class="label">
  72. {{ isCustom.spuName }}
  73. </div>
  74. <div style="font-weight: 400; font-size: 28rpx">
  75. {{ isCustom.price }}元/{{ isCustom.unit }}
  76. </div>
  77. </div>
  78. </div>
  79. <div style="line-height: 32px; margin-top: 10px">
  80. <div>
  81. <span class="name">姓名 :</span>
  82. <span class="value">{{ isCustom.consigneeContactName }}</span>
  83. </div>
  84. <div>
  85. <span class="name">电话 :</span>
  86. <span class="value">{{ isCustom.consigneeContactMobile }}</span>
  87. </div>
  88. <div>
  89. <span class="name">地址 :</span>
  90. <span class="value">{{ isCustom.consigneeAddressDetail }}</span>
  91. </div>
  92. </div>
  93. </div>
  94. </div>
  95. </template>
  96. <template v-else-if="isCustom.businessID === 'order_deliver_goods'">
  97. <div class="evaluate">
  98. <span style="font-size: 36rpx; line-height: 44rpx">老板,请尽快发货!</span>
  99. <div @click="productOrder(isCustom)" style="margin-top: 10px">
  100. <div class="left">
  101. <img
  102. :src="isCustom.pic"
  103. style="width: 80px; height: 80px; border-radius: 10px"
  104. />
  105. <div class="right">
  106. <div class="label">
  107. {{ isCustom.spuName }}
  108. </div>
  109. <div style="font-weight: 400; font-size: 28rpx">
  110. {{ isCustom.price }}元/{{ isCustom.unit }}
  111. </div>
  112. </div>
  113. </div>
  114. <div style="line-height: 32px; margin-top: 10px">
  115. <div>
  116. <span class="name">姓名 :</span>
  117. <span class="value">{{ isCustom.consigneeContactName }}</span>
  118. </div>
  119. <div>
  120. <span class="name">电话 :</span>
  121. <span class="value">{{ isCustom.consigneeContactMobile }}</span>
  122. </div>
  123. <div>
  124. <span class="name">地址 :</span>
  125. <span class="value">{{ isCustom.consigneeAddressDetail }}</span>
  126. </div>
  127. </div>
  128. </div>
  129. </div>
  130. </template>
  131. <template v-else-if="isCustom.businessID === 'order_pay'">
  132. <div class="evaluate">
  133. <span style="font-size: 36rpx; line-height: 44rpx"
  134. >订单价格已修改,请及时付款!</span
  135. >
  136. <div @click="productOrder(isCustom)" style="margin-top: 10px">
  137. <div class="left">
  138. <img
  139. :src="isCustom.pic"
  140. style="width: 80px; height: 80px; border-radius: 10px"
  141. />
  142. <div class="right">
  143. <div class="label">
  144. {{ isCustom.spuName }}
  145. </div>
  146. <div style="font-weight: 400; font-size: 28rpx">
  147. {{ isCustom.price }}元/{{ isCustom.unit }}
  148. </div>
  149. </div>
  150. </div>
  151. </div>
  152. </div>
  153. </template>
  154. <template v-else>
  155. <span v-html="content.custom" />
  156. </template>
  157. </div>
  158. </template>
  159. <script lang="ts" setup>
  160. import { watchEffect, ref } from "../../../../adapter-vue";
  161. import { TUITranslateService, IMessageModel } from "@tencentcloud/chat-uikit-engine";
  162. import { isUrl, JSONToObject } from "../../../../utils/index";
  163. import { CHAT_MSG_CUSTOM_TYPE } from "../../../../constant";
  164. import { ICustomMessagePayload } from "../../../../interface";
  165. import Icon from "../../../common/Icon.vue";
  166. import star from "../../../../assets/icon/star-light.png";
  167. import * as mesApi from "@/api/message/index";
  168. interface Props {
  169. messageItem: IMessageModel;
  170. content: any;
  171. }
  172. const props = withDefaults(defineProps<Props>(), {
  173. messageItem: undefined,
  174. content: undefined,
  175. });
  176. const custom = ref();
  177. const message = ref<IMessageModel>();
  178. const extension = ref();
  179. const isCustom = ref<ICustomMessagePayload>({
  180. businessID: "",
  181. });
  182. watchEffect(() => {
  183. custom.value = props.content;
  184. message.value = props.messageItem;
  185. const { payload } = props.messageItem;
  186. isCustom.value = payload.data || "";
  187. isCustom.value = JSONToObject(payload.data);
  188. if (payload.data === CHAT_MSG_CUSTOM_TYPE.SERVICE) {
  189. extension.value = JSONToObject(payload.extension);
  190. }
  191. });
  192. const openLink = (url: any) => {
  193. window.open(url);
  194. };
  195. // const productOrderPay = async (record) => {
  196. // let userid = uni.getStorageSync("userId");
  197. // if (userid == record.shopOwnerId) {
  198. // let res = await mesApi.default.orderDetail(record.orderId);
  199. // if (res.code == 200) {
  200. // let item = res.data;
  201. // webUni.webView.navigateTo({
  202. // url: `/subpages/my/product-orders/sell-order-details?id=${item.id}&item=${item.consigneeAddress.contact.contactMobile}&orderStatus=${item.orderStatus}&transportStatus=${item.transportStatus}&invoiceStatus=${item.invoiceStatus}&currentIndex=1`,
  203. // });
  204. // }
  205. // console.log(res);
  206. // } else {
  207. // webUni.webView.navigateTo({
  208. // url: `/subpages/my/product-orders/buy-order-details?id=` + record.orderId,
  209. // });
  210. // }
  211. // };
  212. const productOrder = async (record) => {
  213. let userid = uni.getStorageSync("userId");
  214. if (userid == record.shopOwnerId) {
  215. let res = await mesApi.default.orderDetail(record.orderId);
  216. if (res.code == 200) {
  217. let item = res.data;
  218. webUni.webView.navigateTo({
  219. url: `/subpages/my/product-orders/sell-order-details?id=${item.orderId}&item=${item.consigneeAddress.contact.contactMobile}&orderStatus=${item.orderStatus}&transportStatus=${item.transportStatus}&invoiceStatus=${item.invoiceStatus}&currentIndex=1`,
  220. });
  221. }
  222. console.log(res);
  223. } else {
  224. webUni.webView.navigateTo({
  225. url: `/subpages/my/product-orders/buy-order-details?id=` + record.orderId,
  226. });
  227. }
  228. };
  229. const product = (record) => {
  230. webUni.webView.navigateTo({
  231. url: `/subpages/home/carpoolGoods/product-details?id=` + record.id,
  232. });
  233. };
  234. </script>
  235. <style lang="scss" scoped>
  236. @import "../../../../assets/styles/common";
  237. .name {
  238. font-weight: bold;
  239. font-size: 16px;
  240. margin-right: 10px;
  241. }
  242. .value {
  243. font-size: 16px;
  244. margin-right: 10px;
  245. }
  246. a {
  247. color: #679ce1;
  248. }
  249. .custom {
  250. font-size: 14px;
  251. h1 {
  252. font-size: 14px;
  253. color: #000;
  254. }
  255. h1,
  256. a,
  257. p {
  258. font-size: 14px;
  259. }
  260. .evaluate {
  261. min-width: 240px;
  262. width: 240px;
  263. .left {
  264. display: flex;
  265. flex-direction: row;
  266. align-items: center;
  267. justify-content: center;
  268. background: #7a7a7d29;
  269. border-radius: 15px;
  270. padding: 15px;
  271. }
  272. .right {
  273. display: flex;
  274. flex-direction: column;
  275. align-items: flex-start;
  276. height: 75px;
  277. width: 70%;
  278. justify-content: center;
  279. line-height: 25px;
  280. margin-left: 10px;
  281. .label {
  282. font-weight: bold;
  283. font-size: 14px;
  284. width: 100px;
  285. height: auto;
  286. word-wrap: break-word;
  287. overflow: hidden;
  288. text-overflow: ellipsis;
  289. white-space: nowrap;
  290. }
  291. }
  292. ul {
  293. display: flex;
  294. padding: 10px 0;
  295. }
  296. &-list {
  297. display: flex;
  298. flex-direction: row;
  299. &-item {
  300. padding: 0 2px;
  301. }
  302. }
  303. }
  304. .order {
  305. display: flex;
  306. main {
  307. padding-left: 5px;
  308. p {
  309. font-family: PingFangSC-Regular;
  310. width: 145px;
  311. line-height: 17px;
  312. font-size: 14px;
  313. color: #999;
  314. letter-spacing: 0;
  315. margin-bottom: 6px;
  316. word-break: break-word;
  317. }
  318. span {
  319. font-family: PingFangSC-Regular;
  320. line-height: 25px;
  321. color: #ff7201;
  322. }
  323. }
  324. img {
  325. width: 67px;
  326. height: 67px;
  327. }
  328. }
  329. }
  330. </style>