message-custom.vue 11 KB

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