footprint.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <div class="sld_look_log clearfix">
  3. <!-- 路径导航 -->
  4. <div class="log_banner clearfix">
  5. <MemberTitle :memberTitle="L['我的足迹']"></MemberTitle>
  6. <button class="log_option" @click=" centerDialogVisible = true" v-show="looklog.log.length">
  7. {{L['清空']}}
  8. </button>
  9. </div>
  10. <!-- 足迹 -->
  11. <div class="sld_footprint">
  12. <div class="block">
  13. <el-timeline>
  14. <el-timeline-item
  15. :timestamp="time"
  16. placement="top"
  17. color="#00985e"
  18. v-for="({ productLookLogInfoList, time }, index) in looklog.log"
  19. :key="index"
  20. >
  21. <ul class="sld_foot_goods clearfix">
  22. <li
  23. v-for="(
  24. { goodsImage, productId, goodsName, state },
  25. index
  26. ) in productLookLogInfoList"
  27. :key="index"
  28. >
  29. <div class="img">
  30. <router-link
  31. target="_blank"
  32. :to="'/goods/detail/'+ calcProductName(goodsName) +'_'+ productId"
  33. >
  34. <img :src="goodsImage" alt=""/>
  35. <div class="mask" v-if="[5, 6].includes(state)">
  36. <div class="circle">{{ L['已下架'] }}</div>
  37. </div>
  38. </router-link>
  39. </div>
  40. <p class="sld_foot_price">
  41. <a style="cursor: pointer">
  42. <span class="fr" @click="follow(productId, false)">{{
  43. goodsName
  44. }}</span>
  45. </a>
  46. </p>
  47. </li>
  48. </ul>
  49. </el-timeline-item>
  50. </el-timeline>
  51. </div>
  52. <SldCommonEmpty
  53. v-show="!looklog.log.length"
  54. totalWidth="1000"
  55. :tip="L['暂无足迹']"
  56. totalHeight="680"
  57. paddingTop="250"
  58. />
  59. <!-- 分页 -->
  60. <div class="flex_row_center_center sld_pagination">
  61. <el-pagination
  62. @current-change="handleCurrentChange"
  63. v-model:currentPage="looklog.page.current"
  64. :page-size="looklog.page.pageSize"
  65. layout="prev, pager, next, jumper"
  66. :total="looklog.page.total"
  67. :hide-on-single-page="true"
  68. >
  69. </el-pagination>
  70. </div>
  71. <el-dialog v-model="centerDialogVisible" width="30%" center>
  72. <p style="text-align: center;"> {{ L["确定要清空吗?"]}}</p>
  73. <template #footer>
  74. <span class="dialog-footer">
  75. <el-button type="primary" @click="logClear">{{ L["确定"]}}</el-button>
  76. <el-button @click="centerDialogVisible = false">
  77. {{ L["取消"]}}
  78. </el-button>
  79. </span>
  80. </template>
  81. </el-dialog>
  82. </div>
  83. </div>
  84. </template>
  85. <script setup>
  86. import { ElTimeline, ElTimelineItem, ElMessage,ElMessageBox,ElPagination,ElDialog,ElButton } from "element-plus";
  87. import { getCurrentInstance, onMounted, reactive } from "vue";
  88. // import { lang_zn } from "@/assets/language/zh";
  89. import { getCurLanguage } from '@/composables/common.js';
  90. // const L = lang_zn;
  91. const L = getCurLanguage();
  92. definePageMeta({
  93. layout: "member",
  94. middleware: ["auth"],
  95. });
  96. const centerDialogVisible = ref(false)
  97. const { proxy } = getCurrentInstance();
  98. const looklog = reactive({ log: [], page: {} });
  99. const page = reactive({
  100. current: 1,
  101. pageSize: 5,
  102. });
  103. const getInitData = () => {
  104. get("v3/member/front/productLookLog/list", page).then((res) => {
  105. if (res.state == 200) {
  106. looklog.log = res.data.list;
  107. looklog.page = res.data.pagination;
  108. }
  109. });
  110. };
  111. const follow = (productId, logic) => {
  112. //关注商品
  113. let params = {
  114. isCollect: logic,
  115. productIds: productId,
  116. };
  117. post("v3/member/front/followProduct/edit", params)
  118. .then((res) => {
  119. if (res.state == 200) {
  120. getInitData();
  121. } else {
  122. ElMessage.error(res.msg);
  123. }
  124. })
  125. .catch((err) => {
  126. ElMessage.error(err);
  127. });
  128. };
  129. const handlePrevCilickChange = (e) => {
  130. //分页前一页操作
  131. page.current = e;
  132. getInitData();
  133. };
  134. const handleNextCilickChange = (e) => {
  135. //分页前一页操作
  136. page.current = e;
  137. getInitData();
  138. };
  139. const handleCurrentChange = (e) => {
  140. //分页点击操作
  141. page.current = e;
  142. getInitData();
  143. };
  144. const logClear = () => {
  145. get("v3/member/front/productLookLog/empty").then((res) => {
  146. if (res.state == 200) {
  147. getInitData();
  148. ElMessage(res.msg);
  149. }
  150. });
  151. };
  152. onMounted(() => {
  153. getInitData();
  154. });
  155. </script>
  156. <style lang="scss">
  157. .confirm-button-class {
  158. color: #fff;
  159. background-color: #e2231a !important;
  160. border-color: #e2231a !important;
  161. }
  162. @import "@/assets/style/member/footprint.scss";
  163. @import "@/assets/style/base.scss";
  164. </style>