eventDetails.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. <template>
  2. <view class="event-details">
  3. <view class="middle">
  4. <view v-if="type == 1">
  5. <view
  6. class="item"
  7. v-for="(item, index) in msgList"
  8. :key="index"
  9. @click="goToGbOrderDetails(item)"
  10. >
  11. <view v-if="item.messageBody.products.length > 1">
  12. <view class="box">
  13. <view class="time">
  14. {{ item.createTime }}
  15. </view>
  16. </view>
  17. <view class="content" style="padding: 44rpx 0">
  18. <view class="title" style="padding: 0 30rpx"> 订单已支付 </view>
  19. <view class="single-data">
  20. <view class="img-box u-border-one" style="display: flex">
  21. <view
  22. v-for="(i, v) in item.messageBody.products"
  23. :key="v"
  24. class="single-img"
  25. >
  26. <image
  27. class="goods-img"
  28. :src="i.productImg"
  29. v-if="v < 3"
  30. ></image>
  31. </view>
  32. </view>
  33. <view class="single-bottom">
  34. <text
  35. >共{{ item.messageBody.productNum }}件商品,实付金额
  36. </text>
  37. <!-- item.messageBody.goods_num -->
  38. <view class="money">
  39. <rich-text
  40. :nodes="$mUtil.priceBigSmall(item.messageBody.money)"
  41. >
  42. </rich-text>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view v-else>
  49. <view class="box">
  50. <view class="time u-text2">
  51. {{ item.createTime }}
  52. </view>
  53. </view>
  54. <view class="content">
  55. <view class="title"> 订单已支付 </view>
  56. <view class="small-box">
  57. <view v-if="item.messageBody.productType == 4">
  58. <view class="small-left">
  59. <image
  60. :src="imgUrl + '/delImg/recharge.png'"
  61. mode=""
  62. ></image>
  63. </view>
  64. </view>
  65. <view v-else>
  66. <view class="small-left">
  67. <image
  68. :src="item.messageBody.products[0].productImg"
  69. mode=""
  70. ></image>
  71. </view>
  72. </view>
  73. <view v-if="item.messageBody.productType == 3">
  74. <view class="small-right">
  75. <view class="small-top u-text2">
  76. {{ item.messageBody.products[0].productName }}
  77. </view>
  78. <view class="specifications u-mt50">
  79. 规格:<text>{{
  80. item.messageBody.products[0].productSpec
  81. }}</text>
  82. </view>
  83. <view class="price">
  84. 积分
  85. {{ item.messageBody.totalPoint }}
  86. </view>
  87. </view>
  88. </view>
  89. <view v-else>
  90. <view class="small-right">
  91. <view class="small-top u-text2">
  92. {{ item.messageBody.products[0].productName }}
  93. </view>
  94. <view
  95. class="specifications u-mt50"
  96. v-if="item.messageBody.products[0].productSpec"
  97. >
  98. 规格:<text>{{
  99. item.messageBody.products[0].productSpec
  100. }}</text>
  101. </view>
  102. <view class="price">
  103. <text style="font-size: 26rpx; color: #1a1a1a"
  104. >¥{{
  105. item.messageBody.money % 1 == 0
  106. ? item.messageBody.money + ".00"
  107. : item.messageBody.money
  108. }}</text
  109. >
  110. <text style="margin-left: 13rpx; color: #999999"
  111. >x {{ item.messageBody.productNum }}</text
  112. >
  113. </view>
  114. </view>
  115. </view>
  116. </view>
  117. <view v-if="item.messageBody.productType == 3">
  118. <view class="bottom-box">
  119. 共{{ item.messageBody.productNum }}件商品,实付积分<text>{{
  120. item.messageBody.totalPoint
  121. }}</text>
  122. <view
  123. v-if="item.messageBody.totalAmount"
  124. style="margin-left: 4rpx"
  125. >含运费<text style="margin-left: 4rpx"
  126. >{{ item.messageBody.totalAmount }}元</text
  127. ></view
  128. >
  129. </view>
  130. </view>
  131. <view v-else>
  132. <view class="bottom-box">
  133. <text
  134. >共{{ item.messageBody.productNum }}件商品,实付金额
  135. </text>
  136. <view class="money">
  137. <rich-text
  138. :nodes="
  139. $mUtil.priceBigSmall(item.messageBody.totalAmount)
  140. "
  141. >
  142. </rich-text>
  143. </view>
  144. </view>
  145. </view>
  146. </view>
  147. </view>
  148. </view>
  149. <loadMore v-if="msgList.length > 0" :status="status"></loadMore>
  150. </view>
  151. <view v-if="type == 2">
  152. <view v-if="msgList.length > 0">
  153. <view
  154. class="item"
  155. v-for="(item, index) in msgList"
  156. :key="index"
  157. @click="goToGbOrderDetails(item)"
  158. >
  159. <view class="box">
  160. <view class="time">
  161. {{ item.createTime }}
  162. </view>
  163. </view>
  164. <view class="content">
  165. <view v-if="item.messageBody.logisticsStatus == 0 && item.messageBody.logisticCode">
  166. <view class="logistics-top"> 订单已发货 </view>
  167. </view>
  168. <view v-else>
  169. <view class="logistics-top"> 订单已备货 </view>
  170. </view>
  171. <view v-if="item.messageBody.logisticsStatus == 1">
  172. <view class="logistics-top"> 订单已收货 </view>
  173. </view>
  174. <view v-for="(v, index) in item.messageBody.products || []" :key="index">
  175. <view class="logistics-box" v-if="v.productNum">
  176. <view class="logistics-left">
  177. <image
  178. :src="v.productImg"
  179. mode=""
  180. ></image>
  181. </view>
  182. <view class="logistics-right">
  183. <view class="logistics-right-top u-text2">
  184. {{ v.productName }}
  185. </view>
  186. <!-- 修改积分字段 -->
  187. <!-- <view v-if="item.messageBody.exchange == true">
  188. <view class="logistics-right-content">
  189. ¥{{ item.messageBody.money }}元 +
  190. {{ item.messageBody.totalPoint }}积分
  191. <text>x{{ item.messageBody.productNum }}</text>
  192. </view>
  193. </view>
  194. <view v-if="item.messageBody.exchange == false">
  195. <view class="logistics-right-content">
  196. ¥{{ item.messageBody.money }}
  197. <text>x{{ item.messageBody.goodsNum }}</text>
  198. </view>
  199. </view> -->
  200. <view class="logistics-right-bottom" v-if="item.messageBody.logisticCode">
  201. 物流单号:{{ item.messageBody.logisticCode }}
  202. </view>
  203. </view>
  204. </view>
  205. </view>
  206. </view>
  207. </view>
  208. <loadMore v-if="msgList.length > 0" :status="status"></loadMore>
  209. </view>
  210. <noData v-else :config="{ top: 20, content: '暂无消息~' }"></noData>
  211. </view>
  212. <view v-if="type == 3">
  213. <view v-if="msgList.length >= 0">
  214. <view
  215. class="after-sales"
  216. v-for="(item, index) in msgList"
  217. :key="index"
  218. @click="goToGbOrderDetails(item)"
  219. >
  220. <view v-if="item.messageBody.products.length">
  221. <view class="box">
  222. <view class="time">
  223. {{ item.createTime }}
  224. </view>
  225. </view>
  226. <view class="after-sales-msg">
  227. <view class="title" v-if="item.messageBody.rightsMsgStatus == 0">
  228. 商家已同意
  229. </view>
  230. <view class="title" v-if="item.messageBody.rightsMsgStatus == 1">
  231. 商家拒绝维权
  232. </view>
  233. <view class="title" v-if="item.messageBody.rightsMsgStatus == 2">
  234. 商家已收货
  235. </view>
  236. <view class="title" v-if="item.messageBody.rightsMsgStatus == 3">
  237. 商家已退款
  238. </view>
  239. <view class="title" v-if="item.messageBody.rightsMsgStatus == 4">
  240. 商家发起自动退款
  241. </view>
  242. <view class="multigraph">
  243. <view v-for="(x, y) in item.messageBody.products" :key="y">
  244. <image :src="x.productImg" v-if="y < 3" mode=""></image>
  245. </view>
  246. </view>
  247. <view class="refund-amount">
  248. 退款金额¥{{ item.messageBody.money
  249. }}<text v-if="item.messageBody.refundPoint > 0"
  250. >, 退款积分{{ item.messageBody.refundPoint }}</text
  251. >
  252. </view>
  253. </view>
  254. </view>
  255. </view>
  256. <loadMore v-if="msgList.length > 0" :status="status"></loadMore>
  257. </view>
  258. <noData v-else :config="{ top: 20, content: '暂无消息~' }"></noData>
  259. </view>
  260. </view>
  261. </view>
  262. </template>
  263. <script setup>
  264. import { ref, reactive } from "vue";
  265. import { onLoad, onReachBottom, onPullDownRefresh } from "@dcloudio/uni-app";
  266. import { messageList_Api, messageReadType_Api } from "@/api/userInfo.js";
  267. // 定义响应式数据
  268. const status = ref("more");
  269. const params = reactive({
  270. //分页
  271. pageNum: 1,
  272. pageSize: 10,
  273. });
  274. const type = ref(null);
  275. const msgList = ref([]);
  276. const imgUrl = ref(null);
  277. // 初始化数据
  278. onLoad((options) => {
  279. uni.setNavigationBarTitle({ title: options.name });
  280. getType(options.type);
  281. type.value = options.type;
  282. delMsg(options.type);
  283. // 设置页面标题
  284. });
  285. // 上拉加载
  286. onReachBottom(() => {
  287. if (status.value === "noMore") {
  288. status.value = "noMore";
  289. } else {
  290. status.value = "more";
  291. params.pageNum++;
  292. getType(type.value);
  293. }
  294. });
  295. // 下拉刷新
  296. onPullDownRefresh(() => {
  297. rest();
  298. getType(type.value);
  299. });
  300. // 跳转到订单详情
  301. const goToGbOrderDetails = (item) => {
  302. console.log(item);
  303. //1:支付消息,2:物流消息
  304. if (type.value == 1 || type.value == 2) {
  305. let id = item.messageBody.orderId;
  306. uni.navigateTo({
  307. url: `/pages/order/orderDetails?orderId=${id}`,
  308. });
  309. }
  310. //售后消息
  311. if (type.value == 3) {
  312. let id = item.messageBody.rightsOrderId;
  313. uni.navigateTo({
  314. url: "/pages/order/orderblackDetails?id=" + id,
  315. });
  316. }
  317. };
  318. // 获取数据
  319. const getType = (type) => {
  320. uni.showLoading({
  321. title: "加载中...",
  322. mask: true,
  323. });
  324. messageList_Api({
  325. ...params,
  326. type: type,
  327. })
  328. .then((res) => {
  329. uni.hideLoading();
  330. if (res && res.code == 200) {
  331. uni.stopPullDownRefresh();
  332. res.rows = res.rows.map((item) => {
  333. if (item.messageBody == null) item.messageBody = {};
  334. return item;
  335. });
  336. msgList.value = msgList.value.concat(res.rows);
  337. console.log(msgList.value);
  338. if (res.total <= msgList.value.length) {
  339. status.value = "noMore";
  340. } else {
  341. status.value = "more";
  342. }
  343. }
  344. })
  345. .catch((err) => {
  346. uni.hideLoading();
  347. });
  348. };
  349. // 重置数据
  350. const rest = () => {
  351. params.pageNum = 1;
  352. msgList.value = [];
  353. };
  354. // 删除页面的未读消息
  355. const delMsg = (type) => {
  356. if (type != null) {
  357. messageReadType_Api({
  358. type: type,
  359. }).then((res) => {});
  360. }
  361. };
  362. </script>
  363. <style>
  364. page {
  365. background-color: #f5f5f5;
  366. }
  367. </style>
  368. <style scoped lang="scss">
  369. // .height76{
  370. // height: 76rpx;
  371. // }
  372. .after-sales {
  373. .after-sales-msg {
  374. background-color: #ffffff;
  375. border-radius: 18rpx;
  376. .article {
  377. display: flex;
  378. .article-left {
  379. padding-left: 30rpx;
  380. padding-bottom: 62rpx;
  381. image {
  382. width: 165rpx;
  383. height: 156rpx;
  384. border-radius: 18rpx;
  385. overflow: hidden;
  386. }
  387. }
  388. .article-right {
  389. margin-left: 30rpx;
  390. padding-right: 30rpx;
  391. display: flex;
  392. display: flex;
  393. flex-direction: column;
  394. justify-content: space-between;
  395. padding-bottom: 70rpx;
  396. .msg-title {
  397. color: #1a1a1a;
  398. font-weight: 400;
  399. font-size: 24rpx;
  400. }
  401. .specifications {
  402. font-size: 22rpx;
  403. color: #999999;
  404. font-weight: 400;
  405. line-height: 24rpx;
  406. margin-top: 4rpx;
  407. }
  408. .refund {
  409. color: #1a1a1a;
  410. font-size: 26rpx;
  411. font-weight: 400;
  412. margin-top: 16rpx;
  413. }
  414. }
  415. }
  416. .multigraph {
  417. display: flex;
  418. image {
  419. margin-left: 20rpx;
  420. width: 200rpx;
  421. height: 200rpx;
  422. border-radius: 18rpx;
  423. }
  424. }
  425. .refund-amount {
  426. text-align: right;
  427. margin-top: 60rpx;
  428. padding-bottom: 34rpx;
  429. font-size: 26rpx;
  430. font-weight: 400;
  431. color: #1a1a1a;
  432. margin-right: 30rpx;
  433. }
  434. .title {
  435. padding: 44rpx 30rpx 22rpx 30rpx;
  436. font-size: 28rpx;
  437. font-weight: 400;
  438. color: #1a1a1a;
  439. }
  440. }
  441. .box {
  442. display: flex;
  443. justify-content: center;
  444. .time {
  445. font-size: 22rpx;
  446. font-weight: 400;
  447. color: #666666;
  448. line-height: 30rpx;
  449. padding: 10rpx 20rpx;
  450. margin: 40rpx 0;
  451. border-radius: 24rpx;
  452. background-color: #e3e3e3;
  453. }
  454. }
  455. }
  456. .middle {
  457. padding: 0 30rpx;
  458. .item {
  459. .box {
  460. display: flex;
  461. justify-content: center;
  462. .time {
  463. font-size: 22rpx;
  464. color: #666666;
  465. font-weight: 400;
  466. background-color: #e3e3e3;
  467. padding: 10rpx 20rpx;
  468. border-radius: 24rpx;
  469. margin: 40rpx 0;
  470. }
  471. }
  472. .content {
  473. overflow: hidden;
  474. padding: 44rpx 30rpx;
  475. // padding: 44rpx 0;
  476. background-color: #ffffff;
  477. border-radius: 18rpx;
  478. .bottom-time {
  479. font-size: 24rpx;
  480. color: #999999;
  481. font-weight: 400;
  482. }
  483. .logistics-top {
  484. font-size: 28rpx;
  485. color: #1a1a1a;
  486. font-weight: 400;
  487. }
  488. .logistics-box {
  489. margin-top: 22rpx;
  490. display: flex;
  491. .logistics-left {
  492. image {
  493. border-radius: 8rpx;
  494. width: 156rpx;
  495. height: 156rpx;
  496. }
  497. }
  498. .logistics-right {
  499. margin-left: 32rpx;
  500. display: flex;
  501. flex-direction: column;
  502. justify-content: space-between;
  503. .logistics-right-content {
  504. color: #1a1a1a;
  505. font-size: 26rpx;
  506. font-weight: 400;
  507. margin-bottom: 8rpx;
  508. text {
  509. color: #999999;
  510. margin-left: 16rpx;
  511. }
  512. }
  513. .logistics-right-bottom {
  514. font-size: 22rpx;
  515. color: #999999;
  516. font-weight: 400;
  517. }
  518. }
  519. }
  520. .bottom-box {
  521. text-align: right;
  522. display: flex;
  523. align-items: flex-end;
  524. float: right;
  525. .money {
  526. color: #ff0000;
  527. font-size: 32rpx;
  528. font-weight: Bold;
  529. }
  530. }
  531. .title {
  532. font-size: 28rpx;
  533. color: #1a1a1a;
  534. font-weight: 400;
  535. margin-bottom: 26rpx;
  536. }
  537. .label {
  538. font-weight: 700;
  539. }
  540. .small-box {
  541. margin-bottom: 60rpx;
  542. display: flex;
  543. .small-left {
  544. overflow: hidden;
  545. image {
  546. border-radius: 10rpx;
  547. width: 200rpx;
  548. height: 200rpx;
  549. }
  550. }
  551. .small-right {
  552. display: flex;
  553. flex-direction: column;
  554. height: 100%;
  555. justify-content: space-between;
  556. margin-left: 30rpx;
  557. .small-top {
  558. // flex: 1;
  559. font-size: 28rpx;
  560. line-height: 40rpx;
  561. color: #1a1a1a;
  562. font-weight: 400;
  563. }
  564. .specifications {
  565. font-size: 22rpx;
  566. color: #999999;
  567. font-weight: 400;
  568. margin-bottom: 14rpx;
  569. }
  570. .price {
  571. display: flex;
  572. color: #1a1a1a;
  573. font-size: 26rpx;
  574. font-weight: 400;
  575. }
  576. }
  577. }
  578. .single-data {
  579. overflow: hidden;
  580. .img-box {
  581. height: 230rpx;
  582. padding: 0 30rpx;
  583. }
  584. .single-img {
  585. display: flex;
  586. flex-wrap: nowrap;
  587. overflow: hidden;
  588. margin-left: 15rpx;
  589. .goods-img {
  590. width: 200rpx;
  591. height: 200rpx;
  592. // padding: 0 5rpx;
  593. border-radius: 10rpx;
  594. // margin-left: 10rpx;
  595. }
  596. }
  597. .single-img:first-child {
  598. margin-left: 0;
  599. }
  600. .single-bottom {
  601. float: right;
  602. text-align: right;
  603. margin-right: 40rpx;
  604. margin-top: 60rpx;
  605. display: flex;
  606. align-items: baseline;
  607. .money {
  608. color: #ff0000;
  609. font-size: 32rpx;
  610. font-weight: bold;
  611. }
  612. }
  613. }
  614. .image {
  615. image {
  616. width: 630rpx;
  617. height: 250rpx;
  618. border-radius: 15rpx;
  619. }
  620. }
  621. }
  622. }
  623. }
  624. .event-details {
  625. background-color: #f5f5f5;
  626. }
  627. </style>