mibiShop.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <div class="mibiShop container-height">
  3. <Breadcrumb />
  4. <div class="list">
  5. <div class="list_item bg_color_fff border_radius_16 box_shadow_card list_item_animation"
  6. v-for="item in list" :key="item"
  7. >
  8. <img :src="item.imageUrl" alt="" style="width: 291.2px; height: 291.2px;border-radius: 16px 16px 0 0;" class="bg_color_f5">
  9. <div class="item_info padding16">
  10. <div class="line2 font_size18 bold line_height24">
  11. {{item.itemName}}
  12. </div>
  13. <div class="flex-center-between">
  14. <div v-if="appStore.userInfo?.memberType==1 || appStore.userInfo?.memberType==2">
  15. <div class="font_size20">
  16. <div class="bold color_price "> {{item.discountPoints}} {{$t('common.mibi')}}</div>
  17. <div class="line_through gray999 mr10 ml10 font_size14">{{item.points}}{{$t('common.mibi')}}</div>
  18. </div>
  19. </div>
  20. <div class="bold color_price font_size20" v-else>{{item.points}}{{$t('common.mibi')}}</div>
  21. <div class="border_radius_4 lijiduihuan color_fff gradient font_size14 flex-center"
  22. @click="isLogin({callback: openLoginDialog,t}) && confirmBuy({
  23. callback:initList,
  24. appStore,
  25. router,
  26. type:'pointsBalance',
  27. price:appStore.userInfo?.memberType==1 || appStore.userInfo?.memberType==2 ? item.discountPoints:item.points,
  28. t,
  29. productId:item.itemId,
  30. orderType:'mi_mall',
  31. payMethod:'MI'
  32. })"
  33. >
  34. {{$t('common.exchange')}}
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. <Pagination
  41. :total="listTotal"
  42. :page-size="searchFom.pageSize"
  43. :current-page="searchFom.pageNum"
  44. @page-change="handlePageChange"
  45. />
  46. </div>
  47. </template>
  48. <script setup>
  49. import Pagination from '@/components/Pagination.vue'
  50. import { ref, onMounted,reactive, inject } from 'vue'
  51. import { useRouter } from 'vue-router'
  52. import { useAppStore } from '@/pinia/appStore'
  53. import { getMallList } from '@/api/mall.js'
  54. import { confirmBuy,isLogin } from '@/utils/util.js'
  55. import { useI18n } from 'vue-i18n'
  56. const { t } = useI18n()
  57. const appStore = useAppStore()
  58. const router = useRouter()
  59. const openLoginDialog = inject('openLoginDialog')
  60. // 添加分页相关数据
  61. const list = ref([]);
  62. const listTotal = ref(0);
  63. const searchFom = reactive({
  64. pageNum: 1,
  65. pageSize: 20,
  66. })
  67. onMounted(() => {
  68. getList('init');
  69. });
  70. const handlePageChange = (page) => {
  71. searchFom.pageNum = page
  72. // 这里可以添加获取数据的逻辑
  73. console.log('当前页:', page);
  74. getList();
  75. }
  76. const initList = ()=>{
  77. getList('init');
  78. };
  79. // 查询寻找工作流列表
  80. const getList = async (type) => {
  81. if(type === 'init'){
  82. searchFom.pageNum = 1
  83. }
  84. const res = await getMallList(searchFom)
  85. if(res.code === 200){
  86. listTotal.value = res.total || 0;
  87. list.value = res.rows || [];
  88. }
  89. };
  90. </script>
  91. <style lang="scss">
  92. .mibiShop{
  93. .list{
  94. display: grid;
  95. grid-template-columns: repeat(auto-fill, minmax(291.2px, 1fr));
  96. gap: 16px;
  97. .list_item{
  98. width: 291.2px;
  99. .item_info{
  100. height: 144px;
  101. .line2{
  102. height: 52px;
  103. }
  104. .lijiduihuan{
  105. height: 32px;
  106. padding: 0 16px;
  107. }
  108. }
  109. }
  110. }
  111. }
  112. </style>