arrival-reminder.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <view class="arrival-reminder-page">
  3. <page-scroll
  4. ref="pageScroll"
  5. emptyText="暂无到货提醒"
  6. @updateList="updateList"
  7. url="/token/shop/user/noticeArrivalList"
  8. :immediate="true"
  9. >
  10. <view class="list-container">
  11. <arrival-reminder-item
  12. v-for="(item, index) in list"
  13. :key="index"
  14. :info="item"
  15. @cancel="handleCancel"
  16. />
  17. </view>
  18. </page-scroll>
  19. </view>
  20. </template>
  21. <script>
  22. import PageScroll from '@/components/pageScroll/index.vue';
  23. import ArrivalReminderItem from '../components/arrival-reminder-item.vue';
  24. export default {
  25. components: {
  26. PageScroll,
  27. ArrivalReminderItem
  28. },
  29. data() {
  30. return {
  31. list: []
  32. };
  33. },
  34. methods: {
  35. updateList(data) {
  36. this.list = data
  37. },
  38. handleCancel(item) {
  39. uni.showModal({
  40. title: '提示',
  41. content: '确定要取消该书籍的到货提醒吗?',
  42. success: (res) => {
  43. if (res.confirm) {
  44. // 调用取消到货提醒接口
  45. uni.$u.http.post('/token/shop/user/noticeArrivalCancel', {
  46. isbn: item.isbn,
  47. }).then(res => {
  48. if (res.code === 200) {
  49. uni.showToast({ title: '已取消到货提醒', icon: 'none' });
  50. this.list = this.list.filter(row => row.isbn !== item.isbn);
  51. this.$refs.pageScroll?.loadData(true)
  52. } else {
  53. uni.showToast({ title: '取消到货提醒失败', icon: 'none' });
  54. }
  55. });
  56. }
  57. }
  58. });
  59. }
  60. }
  61. }
  62. </script>
  63. <style lang="scss" scoped>
  64. .arrival-reminder-page {
  65. background-color: #f5f5f5;
  66. min-height: 100vh;
  67. }
  68. .list-container {
  69. padding-top: 20rpx;
  70. padding-bottom: 20rpx;
  71. }
  72. </style>