center.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <div class="sld_mydownloadcenter_wrapper">
  3. <MemberTitle :memberTitle="L['下载中心']"></MemberTitle>
  4. <div class="container">
  5. <h3 class="mb-30">{{ L["下载中心"] }}</h3>
  6. <div class="search_con flex_row_between_center search_info">
  7. <div class="search_incon1 flex_row_start_center">
  8. <el-input
  9. class="search_input"
  10. v-model="goodsName"
  11. :placeholder="L['商品名称']"
  12. clearable
  13. @clear="clear"
  14. >
  15. </el-input>
  16. <div class="search pointer" @click="getDownloadList">
  17. {{ L["搜索"] }}
  18. </div>
  19. </div>
  20. </div>
  21. <div class="point_list">
  22. <table class="point_table">
  23. <tbody>
  24. <tr class="voucher_tabeltitle">
  25. <th>{{ L["序号"] }}</th>
  26. <th>{{ L["商品名称"] }}</th>
  27. <th>{{ L["商品附件"] }}</th>
  28. <th>{{ L["下载时间"] }}</th>
  29. <th class="oprate">{{ L["操作"] }}</th>
  30. </tr>
  31. <tr v-for="(item, index) in downloadList.list" :key="index">
  32. <td>{{ index + 1 }}</td>
  33. <td>{{ item.goodsName }}</td>
  34. <td>
  35. <a href="javascript:;" class="next" @click="download(item.annexPath,item.annexName)" style="color:#00985e;text-decoration: underline;">
  36. {{ item.annexName }}
  37. </a>
  38. </td>
  39. <td>{{ item.createTime }}</td>
  40. <td>
  41. <nuxt-link style="color:#00985e;text-decoration: underline;" :to="'/goods/detail/'+ calcProductName(item.goodsName) +'_'+ item.defaultProductId" target="_blank">
  42. {{L["商品详情"]}}
  43. </nuxt-link>
  44. </td>
  45. </tr>
  46. </tbody>
  47. </table>
  48. <SldCommonEmpty
  49. v-if="!downloadList.list.length"
  50. totalHeight="587"
  51. totalWidth="1003"
  52. :tip="L['暂无下载记录']"
  53. />
  54. </div>
  55. <div class="flex_row_end_center sld_pagination">
  56. <el-pagination
  57. @current-change="handleCurrentChange"
  58. v-model:currentPage="pageData.page.current"
  59. :page-size="pageData.page.pageSize"
  60. layout="prev, pager, next, jumper"
  61. :total="pageData.page.total"
  62. :hide-on-single-page="true"
  63. >
  64. </el-pagination>
  65. </div>
  66. </div>
  67. </div>
  68. </template>
  69. <script setup>
  70. import {reactive, getCurrentInstance, ref, onMounted} from "vue";
  71. // import {lang_zn} from "@/assets/language/zh";
  72. import { getCurLanguage } from '@/composables/common.js';
  73. import {useFiltersStore} from "@/store/filter.js";
  74. import {ElDialog, ElPagination, ElInput} from "element-plus";
  75. const filtersStore = useFiltersStore();
  76. // const L = lang_zn;
  77. const L = getCurLanguage();
  78. definePageMeta({
  79. layout: "member",
  80. middleware: ["auth"],
  81. });
  82. const {proxy} = getCurrentInstance();
  83. const downloadList = reactive({list: []});
  84. const pageData = reactive({page: {}});
  85. const goodsName = ref("");
  86. const params = reactive({
  87. current: 1,
  88. goodsName: "",
  89. });
  90. const getDownloadList = () => {
  91. if (
  92. goodsName.value != "" &&
  93. goodsName.value != null &&
  94. goodsName.value != undefined
  95. ) {
  96. params.goodsName = goodsName.value;
  97. } else {
  98. params.goodsName = "";
  99. }
  100. get("v3/member/front/download/list", params).then((res) => {
  101. if (res.state == 200) {
  102. downloadList.list = res.data.list;
  103. pageData.page = res.data.pagination;
  104. }
  105. });
  106. };
  107. //清空搜索
  108. const clear = () => {
  109. goodsName.value = "";
  110. getDownloadList();
  111. };
  112. const download = (url,name) =>{
  113. const link = document.createElement('a');
  114. fetch(url).then(res => res.blob()).then(blob => {
  115. link.href = URL.createObjectURL(blob)
  116. link.download = name;
  117. document.body.appendChild(link)
  118. link.click()
  119. window.URL.revokeObjectURL(link.href);
  120. document.body.removeChild(link);
  121. });
  122. }
  123. const handleSwitch = (index) => {
  124. params.type = index;
  125. params.current = 1;
  126. getDownloadList();
  127. };
  128. const handlePrevCilickChange = (e) => {
  129. params.current = e;
  130. getDownloadList();
  131. };
  132. const handleNextCilickChange = (e) => {
  133. params.current = e;
  134. getDownloadList();
  135. };
  136. const handleCurrentChange = (e) => {
  137. params.current = e;
  138. getDownloadList();
  139. };
  140. onMounted(() => {
  141. getDownloadList();
  142. });
  143. </script>
  144. <style lang="scss" scoped>
  145. .mb-30 {
  146. margin-bottom: 30px;
  147. }
  148. .sld_pagination {
  149. margin-right: 40px;
  150. margin-bottom: 20px;
  151. }
  152. .sld_mydownloadcenter_wrapper {
  153. width: 957px;
  154. margin-left: 10px;
  155. float: left;
  156. .container {
  157. padding: 20px;
  158. background-color: #fff;
  159. margin-bottom: 10px;
  160. }
  161. .point_table {
  162. border-left: none;
  163. border-right: none;
  164. width: 100%;
  165. margin-bottom: 30px;
  166. border: 1px solid #e0e0e0;
  167. border-collapse: collapse;
  168. border-spacing: 0;
  169. background-color: transparent;
  170. .voucher_tabeltitle {
  171. height: 39px;
  172. background-color: #ececec;
  173. th {
  174. text-align: center;
  175. font-weight: 400;
  176. border: 1px solid #e3e3e3;
  177. }
  178. }
  179. td {
  180. text-align: center;
  181. line-height: 50px;
  182. background: #fff;
  183. border: 1px solid #e3e3e3;
  184. font-weight: 400;
  185. }
  186. }
  187. }
  188. .address_item span:not(:first-child) {
  189. margin-top: 12px;
  190. }
  191. .search_incon1 {
  192. height: 34px;
  193. background: #ffffff;
  194. }
  195. .search_con {
  196. .search_input {
  197. width: 323px;
  198. border-right: none;
  199. }
  200. }
  201. .search_con {
  202. .el-input__inner {
  203. height: 29px;
  204. padding-left: 11px;
  205. border: none;
  206. box-sizing: border-box;
  207. outline: none;
  208. font-size: 12px;
  209. font-weight: 400;
  210. }
  211. }
  212. .search_con {
  213. height: 44px;
  214. /*border-top: 1px solid #e8e8f1;*/
  215. padding-top: 18px;
  216. padding-bottom: 25px;
  217. box-sizing: border-box;
  218. }
  219. .search_con {
  220. .search {
  221. width: 105px;
  222. height: 32px;
  223. border: none;
  224. background-color: #f7f7f7;
  225. color: #000;
  226. line-height: 32px;
  227. text-align: center;
  228. font-size: 12px;
  229. }
  230. }
  231. </style>