message-custom.vue 11 KB

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