AddGoods.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966
  1. <template>
  2. <div class="manage-root add-goods">
  3. <Header />
  4. <breadcrumb
  5. :breadcrumbList="breadcrumbList"
  6. class="breadcrumb-box"
  7. ></breadcrumb>
  8. <div class="manage-root-contain" v-loading="tableLoading">
  9. <div class="common-title-box">
  10. <h3>
  11. 添加兑换内容
  12. <span
  13. style="color: rgba(255, 20, 20, 1)"
  14. v-if="checkGoodsList.length > 0"
  15. >已选{{ checkGoodsList.length }}</span
  16. >
  17. </h3>
  18. <div class="btn-box">
  19. <el-button @click="$router.go(-1)" size="small">取消</el-button>
  20. <el-button
  21. type="primary"
  22. @click="handleChooseGoods"
  23. size="small"
  24. :loading="loading"
  25. ><svg-icon icon-class="Check" style="margin-right: 8px"></svg-icon
  26. >完成</el-button
  27. >
  28. </div>
  29. </div>
  30. <div class="filt-box">
  31. <div class="filt-item">
  32. <label>类型</label>
  33. <ul>
  34. <li
  35. :class="[items.value === itemType ? 'active' : '']"
  36. v-for="(items, indexs) in typeSelectList"
  37. :key="indexs"
  38. @click="
  39. itemType = items.value;
  40. getList(1);
  41. "
  42. >
  43. <i v-if="items.value === itemType" class="el-icon-success"></i>
  44. {{ items.label }}
  45. </li>
  46. </ul>
  47. </div>
  48. <template v-if="itemType === 'kecheng'">
  49. <div class="filt-item">
  50. <label>学段</label>
  51. <ul>
  52. <li
  53. :class="[
  54. items.study_phase === courseForm.studyValue ? 'active' : '',
  55. courseForm.categoryValue === 'ZB' ? 'not-allow' : '',
  56. ]"
  57. v-for="(items, indexs) in studyList"
  58. :key="indexs"
  59. @click="
  60. handleClick('courseForm', 'studyValue', items.study_phase)
  61. "
  62. >
  63. <i
  64. v-if="items.study_phase === courseForm.studyValue"
  65. class="el-icon-success"
  66. ></i>
  67. {{ items.study_phase_name }}
  68. </li>
  69. </ul>
  70. </div>
  71. <div class="filt-item">
  72. <label>类别</label>
  73. <ul>
  74. <li
  75. :class="[
  76. itemt.value === courseForm.categoryValue ? 'active' : '',
  77. ]"
  78. v-for="(itemt, indext) in categoryList"
  79. :key="indext"
  80. @click="handleClick('courseForm', 'categoryValue', itemt.value)"
  81. >
  82. <i
  83. v-if="itemt.value === courseForm.categoryValue"
  84. class="el-icon-success"
  85. ></i>
  86. {{ itemt.label }}
  87. </li>
  88. </ul>
  89. </div>
  90. </template>
  91. <template v-else-if="itemType === 'baozhi'">
  92. <div class="filt-item">
  93. <label>年份</label>
  94. <ul>
  95. <li
  96. :class="[itemy.value === baozhiForm.yearValue ? 'active' : '']"
  97. v-for="(itemy, indexy) in yearList"
  98. :key="indexy"
  99. @click="handleClick('baozhiForm', 'yearValue', itemy.value)"
  100. >
  101. <i
  102. v-if="itemy.value === baozhiForm.yearValue"
  103. class="el-icon-success"
  104. ></i>
  105. {{ itemy.label }}
  106. </li>
  107. </ul>
  108. </div>
  109. <div class="filt-item">
  110. <label>学段</label>
  111. <ul>
  112. <li
  113. :class="[
  114. items.study_phase === baozhiForm.studyValue ? 'active' : '',
  115. ]"
  116. v-for="(items, indexs) in baozhiStudyList"
  117. :key="indexs"
  118. @click="
  119. handleClick(
  120. 'baozhiForm',
  121. 'studyValue',
  122. items.study_phase,
  123. items.study_phase_name
  124. )
  125. "
  126. >
  127. <i
  128. v-if="items.study_phase === baozhiForm.studyValue"
  129. class="el-icon-success"
  130. ></i>
  131. {{ items.study_phase_name }}
  132. </li>
  133. </ul>
  134. </div>
  135. <div class="filt-item">
  136. <label>类型</label>
  137. <ul>
  138. <li
  139. :class="[itemt.value === baozhiForm.typeValue ? 'active' : '']"
  140. v-for="(itemt, indext) in typeList"
  141. :key="indext"
  142. @click="handleClick('baozhiForm', 'typeValue', itemt.value)"
  143. >
  144. <i
  145. v-if="itemt.value === baozhiForm.typeValue"
  146. class="el-icon-success"
  147. ></i>
  148. {{ itemt.label }}
  149. </li>
  150. </ul>
  151. </div>
  152. </template>
  153. <template v-if="itemType === 'jingdu'">
  154. <div class="filt-item">
  155. <label>主题</label>
  156. <ul>
  157. <li
  158. :class="[
  159. itemy.value === jingduForm.categoryValue ? 'active' : '',
  160. ]"
  161. v-for="(itemy, indexy) in themeList"
  162. :key="indexy"
  163. @click="handleClick('jingduForm', 'categoryValue', itemy.value)"
  164. >
  165. <i
  166. v-if="itemy.value === baozhiForm.categoryValue"
  167. class="el-icon-success"
  168. ></i>
  169. {{ itemy.label }}
  170. </li>
  171. </ul>
  172. </div>
  173. <div class="filt-item">
  174. <label>学段</label>
  175. <ul>
  176. <li
  177. :class="[
  178. items.study_phase === jingduForm.studyValue ? 'active' : '',
  179. ]"
  180. v-for="(items, indexs) in jingduStudyList"
  181. :key="indexs"
  182. @click="
  183. handleClick(
  184. 'jingduForm',
  185. 'studyValue',
  186. items.study_phase,
  187. items.study_phase_name
  188. )
  189. "
  190. >
  191. <i
  192. v-if="items.study_phase === jingduForm.studyValue"
  193. class="el-icon-success"
  194. ></i>
  195. {{ items.study_phase_name }}
  196. </li>
  197. </ul>
  198. </div>
  199. </template>
  200. <template v-else-if="itemType === 'huakan'">
  201. <div class="filt-item">
  202. <label>年份</label>
  203. <ul>
  204. <li
  205. :class="[itemy.value === huakanForm.yearValue ? 'active' : '']"
  206. v-for="(itemy, indexy) in huakanyearList"
  207. :key="indexy"
  208. @click="handleClick('huakanForm', 'yearValue', itemy.value)"
  209. >
  210. <i
  211. v-if="itemy.value === huakanForm.yearValue"
  212. class="el-icon-success"
  213. ></i>
  214. {{ itemy.label }}
  215. </li>
  216. </ul>
  217. </div>
  218. </template>
  219. <div class="filt-item">
  220. <label>搜索</label>
  221. <el-input placeholder="搜索" v-model="searchValue" maxlength="20">
  222. <el-button
  223. slot="append"
  224. icon="el-icon-search"
  225. @click="getList(1)"
  226. ></el-button>
  227. </el-input>
  228. </div>
  229. </div>
  230. <ul class="item-box">
  231. <li
  232. v-for="(itemC, indexC) in tableData"
  233. :key="indexC"
  234. @click="changeSelectGoods(itemC)"
  235. >
  236. <el-image
  237. class="image"
  238. :src="
  239. itemC.cover_image_url || itemC.iss_cover_url
  240. ? itemC.cover_image_url || itemC.iss_cover_url
  241. : itemC.goods_type === 2
  242. ? require('../../assets/baozhi' +
  243. (Math.floor(Math.random() * 2) + 1) +
  244. '.png')
  245. : require('../../assets/kecheng' +
  246. (Math.floor(Math.random() * 3) + 1) +
  247. '.png')
  248. "
  249. :fit="'cover'"
  250. >
  251. </el-image>
  252. <el-checkbox
  253. v-model="itemC.check"
  254. @change="changeSelectGoods(itemC)"
  255. >{{ itemC.name || itemC.iss_name }}</el-checkbox
  256. >
  257. </li>
  258. </ul>
  259. <div class="nodata" v-if="total_count === 0">
  260. <img src="../../assets/nodata.png" />
  261. <p>找不到文件</p>
  262. </div>
  263. <!-- <el-pagination
  264. background
  265. :current-page="currentPages"
  266. :page-size="page_capacitys"
  267. :page-sizes="[8, 16, 24, 32, 40]"
  268. :total="total_count"
  269. layout="total, prev, pager, next, sizes, jumper"
  270. @size-change="(val)=>handleSizeChange(val,'page_capacitys','currentPages')"
  271. @current-change="(val)=>handleCurrentChange(val,'currentPages')"
  272. v-if="total_count>0&&(courseForm.categoryValue==='ZB'||itemType==='jingdu')"
  273. /> -->
  274. <el-pagination
  275. background
  276. :current-page="currentPage"
  277. :page-size="page_capacity"
  278. :page-sizes="[9, 18, 27, 36, 45, 54]"
  279. :total="total_count"
  280. layout="total, prev, pager, next, sizes, jumper"
  281. @size-change="
  282. (val) => handleSizeChange(val, 'page_capacity', 'currentPage')
  283. "
  284. @current-change="(val) => handleCurrentChange(val, 'currentPage')"
  285. v-else-if="total_count > 0"
  286. />
  287. </div>
  288. </div>
  289. </template>
  290. <script>
  291. //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  292. //例如:import 《组件名称》from ‘《组件路径》';
  293. import Header from "../../components/Header.vue";
  294. import Breadcrumb from "../../components/Breadcrumb.vue";
  295. import { getLogin } from "@/api/ajax";
  296. import { mapState } from "vuex";
  297. export default {
  298. //import引入的组件需要注入到对象中才能使用
  299. components: { Header, Breadcrumb },
  300. props: {},
  301. data() {
  302. //这里存放数据
  303. return {
  304. breadcrumbList: [
  305. {
  306. icon: "barcode-line",
  307. url: "",
  308. text: "",
  309. },
  310. {
  311. icon: "",
  312. url: "",
  313. notLink: true,
  314. text: "兑换码管理",
  315. },
  316. {
  317. icon: "",
  318. url: "",
  319. text: "创建兑换码",
  320. },
  321. {
  322. icon: "",
  323. url: "",
  324. text: "添加内容",
  325. },
  326. ],
  327. pageLoading: false,
  328. tableData: [],
  329. tableHeight: "", // 表格高度
  330. total_count: 0,
  331. loading: false,
  332. tableLoading: false,
  333. itemType: "baozhi",
  334. typeSelectList: [
  335. {
  336. label: "报纸",
  337. value: "baozhi",
  338. },
  339. {
  340. label: "精读",
  341. value: "jingdu",
  342. },
  343. {
  344. label: "课程",
  345. value: "kecheng",
  346. },
  347. {
  348. label: "画刊",
  349. value: "huakan",
  350. },
  351. ],
  352. yearList: [
  353. {
  354. value: -1,
  355. label: "全部",
  356. },
  357. ],
  358. huakanyearList: [
  359. {
  360. value: null,
  361. label: "全部",
  362. },
  363. ],
  364. studyList: [
  365. {
  366. study_phase: -1,
  367. study_phase_name: "全部",
  368. },
  369. ],
  370. baozhiStudyList: [],
  371. categoryList: [
  372. {
  373. value: "LB",
  374. label: "录播",
  375. },
  376. {
  377. value: "ZB",
  378. label: "直播",
  379. },
  380. ],
  381. typeList: [
  382. {
  383. value: 0,
  384. label: "单本",
  385. },
  386. {
  387. value: 1,
  388. label: "专辑",
  389. },
  390. ],
  391. courseForm: {
  392. studyValue: -1,
  393. categoryValue: "LB",
  394. },
  395. baozhiForm: {
  396. yearValue: -1,
  397. studyValue: -1,
  398. typeValue: 0,
  399. },
  400. jingduForm: {
  401. studyValue: 11,
  402. categoryValue: "",
  403. },
  404. huakanForm: {
  405. yearValue: null,
  406. key_word: "",
  407. },
  408. searchValue: "",
  409. page_capacity: 18,
  410. currentPage: 1,
  411. currentPages: 1,
  412. page_capacitys: 8, // 每页条数
  413. themeList: [],
  414. jingduStudyList: [
  415. {
  416. study_phase: 11,
  417. study_phase_name: "小学",
  418. },
  419. {
  420. study_phase: 21,
  421. study_phase_name: "初一",
  422. },
  423. {
  424. study_phase: 22,
  425. study_phase_name: "初二",
  426. },
  427. {
  428. study_phase: 23,
  429. study_phase_name: "初三",
  430. },
  431. ],
  432. checkGoodsList: [],
  433. checkGoodsIdList: [],
  434. };
  435. },
  436. //计算属性 类似于data概念
  437. computed: {},
  438. //监控data中数据变化
  439. watch: {},
  440. //方法集合
  441. methods: {
  442. changeSelectGoods(item) {
  443. if (this.checkGoodsIdList.indexOf(item.goods_id) > -1) {
  444. this.checkGoodsIdList.splice(
  445. this.checkGoodsIdList.indexOf(item.goods_id),
  446. 1
  447. );
  448. this.checkGoodsList.splice(
  449. this.checkGoodsIdList.indexOf(item.goods_id),
  450. 1
  451. );
  452. item.check = false;
  453. } else {
  454. this.checkGoodsIdList.push(item.goods_id);
  455. this.checkGoodsList.push({
  456. goods_id: item.goods_id,
  457. goods_type: item.goods_type,
  458. });
  459. item.check = true;
  460. }
  461. },
  462. getList(val) {
  463. this.tableLoading = true;
  464. if (val) {
  465. this.pageNumber = val;
  466. }
  467. let MethodName = "/ShopServer/Manager/GoodsQuery/PageQueryCourseList";
  468. let data = {
  469. page_capacity: this.page_capacity,
  470. cur_page: this.currentPage,
  471. search_content: this.searchValue.trim(),
  472. };
  473. if (this.itemType === "baozhi") {
  474. MethodName = "/ShopServer/Manager/GoodsQuery/PageQueryIssueList";
  475. data.year_label = this.baozhiForm.yearValue;
  476. data.study_phase = this.baozhiForm.studyValue;
  477. data.comb_flag =
  478. this.baozhiForm.typeValue == 1 ? null : this.baozhiForm.typeValue;
  479. data.album_flag =
  480. this.baozhiForm.typeValue == 0 ? null : this.baozhiForm.typeValue;
  481. getLogin(MethodName, data)
  482. .then((res) => {
  483. this.tableLoading = false;
  484. if (res.status === 1) {
  485. res.issue_list.forEach((item) => {
  486. item.goods_type = 2;
  487. item.goods_id = item.id;
  488. item.check =
  489. this.checkGoodsIdList.indexOf(item.id) > -1 ? true : false;
  490. });
  491. this.tableData = res.issue_list;
  492. this.total_count = res.total_count;
  493. }
  494. })
  495. .catch(() => {
  496. this.tableLoading = false;
  497. });
  498. } else if (this.itemType === "kecheng") {
  499. (data.course_type = this.courseForm.categoryValue),
  500. (data.study_phase = this.courseForm.studyValue);
  501. getLogin(MethodName, data)
  502. .then((res) => {
  503. this.tableLoading = false;
  504. if (res.status === 1) {
  505. res.course_list.forEach((item) => {
  506. item.goods_type =
  507. this.courseForm.categoryValue === "ZB" ? 1 : 0;
  508. item.goods_id = item.id;
  509. item.check =
  510. this.checkGoodsIdList.indexOf(item.id) > -1 ? true : false;
  511. });
  512. this.tableData = res.course_list;
  513. this.total_count = res.total_count;
  514. }
  515. })
  516. .catch(() => {
  517. this.tableLoading = false;
  518. });
  519. } else if (this.itemType === "jingdu") {
  520. MethodName = "/ShopServer/Manager/GoodsQuery/PageQueryIreadArticleList";
  521. data.label = this.jingduForm.categoryValue;
  522. data.study_phase = this.jingduForm.studyValue;
  523. getLogin(MethodName, data)
  524. .then((res) => {
  525. this.tableLoading = false;
  526. if (res.status === 1) {
  527. res.iread_article_list.forEach((item) => {
  528. item.goods_type = 3;
  529. item.goods_id = item.id;
  530. item.check =
  531. this.checkGoodsIdList.indexOf(item.id) > -1 ? true : false;
  532. });
  533. this.tableData = res.iread_article_list;
  534. this.total_count = res.total_count;
  535. }
  536. })
  537. .catch(() => {
  538. this.tableLoading = false;
  539. });
  540. } else if (this.itemType === "huakan") {
  541. MethodName = "/PaperServer/Manager/PicIssueManager/PageQueryIssue";
  542. data.year_label = this.huakanForm.yearValue;
  543. data.key_word = this.searchValue.trim();
  544. getLogin(MethodName, data)
  545. .then((res) => {
  546. this.tableLoading = false;
  547. if (res.status === 1) {
  548. res.data.list.forEach((item) => {
  549. item.goods_type = 4;
  550. item.goods_id = item.id;
  551. item.check =
  552. this.checkGoodsIdList.indexOf(item.id) > -1 ? true : false;
  553. });
  554. this.tableData = res.data.list;
  555. this.total_count = res.data.total_count;
  556. }
  557. })
  558. .catch(() => {
  559. this.tableLoading = false;
  560. });
  561. }
  562. },
  563. //计算table高度(动态设置table高度)
  564. getTableHeight() {
  565. let tableH = 320; //距离页面下方的高度
  566. let tableHeightDetil = window.innerHeight - tableH;
  567. if (tableHeightDetil <= 320) {
  568. this.tableHeight = 320;
  569. } else {
  570. this.tableHeight = window.innerHeight - tableH;
  571. }
  572. },
  573. handleSizeChange(val, type, page) {
  574. this[type] = val;
  575. this[page] = 1;
  576. this.getList();
  577. },
  578. handleCurrentChange(val, type) {
  579. this[type] = val;
  580. this.getList();
  581. },
  582. // 去掉前后空格
  583. handleTrim(form, fild) {
  584. this[form][fild] = this[form][fild].trim();
  585. },
  586. handleClick(form, file, value, name) {
  587. if (form === "courseForm" && file === "categoryValue" && value === "ZB") {
  588. this.courseForm.studyValue = -1;
  589. } else if (
  590. form === "courseForm" &&
  591. file === "categoryValue" &&
  592. value === "LB"
  593. ) {
  594. this.courseForm.studyValue = window.localStorage.getItem(
  595. "courseFormstudyValue"
  596. )
  597. ? window.localStorage.getItem("courseFormstudyValue") * 1
  598. : -1;
  599. }
  600. if (
  601. form === "courseForm" &&
  602. file === "studyValue" &&
  603. this.courseForm.categoryValue === "ZB"
  604. ) {
  605. return false;
  606. }
  607. this[form][file] = value;
  608. this.currentPage = 1;
  609. this.currentPages = 1;
  610. this.getList();
  611. },
  612. // 提交表单
  613. handleChooseGoods() {
  614. if (this.checkGoodsList.length === 0) {
  615. this.$message.warning("至少需要选择一个内容");
  616. return;
  617. }
  618. this.loading = true;
  619. let MethodName =
  620. "/ShopServer/Manager/DiscountCodeManager/AddGoodsToDiscountCode";
  621. let data = {
  622. discount_code_id: window.localStorage.getItem("cdKeyId")
  623. ? window.localStorage.getItem("cdKeyId")
  624. : "",
  625. goods_list: this.checkGoodsList,
  626. };
  627. getLogin(MethodName, data)
  628. .then((res) => {
  629. this.loading = false;
  630. if (res.status === 1) {
  631. this.$router.go(-1);
  632. }
  633. })
  634. .catch((res) => {
  635. this.loading = false;
  636. });
  637. },
  638. // 学段列表
  639. getStudyList() {
  640. let MethodName = "/OrgServer/DictManager/GetStudyPhaseList";
  641. getLogin(MethodName, {})
  642. .then((res) => {
  643. if (res.status === 1) {
  644. let studyList = [
  645. {
  646. study_phase: -1,
  647. study_phase_name: "全部",
  648. },
  649. ];
  650. this.studyList = studyList.concat(res.study_phase_list);
  651. this.baozhiStudyList = res.study_phase_list;
  652. this.baozhiForm.studyValue = window.localStorage.getItem(
  653. "baozhiFormstudyValue"
  654. )
  655. ? window.localStorage.getItem("baozhiFormstudyValue") * 1
  656. : res.study_phase_list[0]
  657. ? res.study_phase_list[0].study_phase
  658. : -1;
  659. if (this.itemType === "baozhi") {
  660. this.titleName = window.localStorage.getItem(
  661. "baozhiFormstudyValueName"
  662. )
  663. ? window.localStorage.getItem("baozhiFormstudyValueName")
  664. : res.study_phase_list[0]
  665. ? res.study_phase_list[0].study_phase_name
  666. : "";
  667. } else if (this.itemType === "jingdu") {
  668. this.titleName = window.localStorage.getItem(
  669. "jingduFormstudyValueName"
  670. )
  671. ? window.localStorage.getItem("jingduFormstudyValueName")
  672. : res.study_phase_list[0]
  673. ? res.study_phase_list[0].study_phase_name
  674. : "";
  675. } else if (this.itemType === "kecheng") {
  676. this.titleName = window.localStorage.getItem(
  677. "courseFormstudyValueName"
  678. )
  679. ? window.localStorage.getItem("courseFormstudyValueName")
  680. : res.study_phase_list[0]
  681. ? res.study_phase_list[0].study_phase_name
  682. : "";
  683. }
  684. }
  685. })
  686. .catch(() => {});
  687. },
  688. // 获取年份列表
  689. getYearList() {
  690. this.yearList = [
  691. {
  692. value: -1,
  693. label: "全部",
  694. },
  695. ];
  696. let yearList = [];
  697. let MethodName = "/ShopServer/Client/ShopHomeQuery/GetIssueYearLabelList";
  698. getLogin(MethodName, {})
  699. .then((res) => {
  700. if (res.status === 1) {
  701. res.year_label_list.forEach((nowYear) => {
  702. let obj = {
  703. value: nowYear,
  704. label: nowYear,
  705. };
  706. yearList.push(obj);
  707. });
  708. this.yearList = this.yearList.concat(yearList);
  709. }
  710. })
  711. .catch(() => {
  712. this.loading = false;
  713. });
  714. this.huakanyearList = [
  715. {
  716. value: null,
  717. label: "全部",
  718. },
  719. ];
  720. getLogin(MethodName, { goods_type: 4 })
  721. .then((res) => {
  722. if (res.status === 1) {
  723. let yearLists = [];
  724. res.year_label_list.forEach((nowYear) => {
  725. let obj = {
  726. value: nowYear,
  727. label: nowYear,
  728. };
  729. yearLists.push(obj);
  730. });
  731. this.huakanyearList = this.huakanyearList.concat(yearLists);
  732. }
  733. })
  734. .catch(() => {});
  735. },
  736. getLabelList() {
  737. this.themeList = [
  738. {
  739. value: "",
  740. label: "全部",
  741. },
  742. ];
  743. let yearList = [];
  744. let MethodName =
  745. "/ShopServer/Manager/GoodsQuery/GetIreadArticleLabelList";
  746. getLogin(MethodName, {})
  747. .then((res) => {
  748. if (res.status === 1) {
  749. res.label_list.forEach((nowYear) => {
  750. let obj = {
  751. value: nowYear,
  752. label: nowYear,
  753. };
  754. yearList.push(obj);
  755. });
  756. this.themeList = this.themeList.concat(yearList);
  757. }
  758. })
  759. .catch(() => {
  760. this.loading = false;
  761. });
  762. },
  763. },
  764. //生命周期 - 创建完成(可以访问当前this实例)
  765. created() {
  766. this.getTableHeight();
  767. this.getStudyList();
  768. this.getYearList();
  769. this.getLabelList();
  770. this.getList();
  771. },
  772. //生命周期 - 挂载完成(可以访问DOM元素)
  773. mounted() {
  774. let _this = this;
  775. let input = document.querySelector("input");
  776. input.addEventListener("keyup", function (event) {
  777. // 判断是否按下回车键
  778. if (event.keyCode === 13) {
  779. // 回车键被按下,执行你想要的操作
  780. _this.getList(1);
  781. }
  782. });
  783. },
  784. //生命周期-创建之前
  785. beforeCreated() {},
  786. //生命周期-挂载之前
  787. beforeMount() {},
  788. //生命周期-更新之前
  789. beforUpdate() {},
  790. //生命周期-更新之后
  791. updated() {},
  792. //生命周期-销毁之前
  793. beforeDestory() {},
  794. //生命周期-销毁完成
  795. destoryed() {},
  796. //如果页面有keep-alive缓存功能,这个函数会触发
  797. activated() {},
  798. };
  799. </script>
  800. <style lang="scss" scoped>
  801. /* @import url(); 引入css类 */
  802. .breadcrumb-box {
  803. width: 1408px;
  804. margin: 0 auto;
  805. position: initial;
  806. }
  807. .manage-root-contain {
  808. width: 1408px;
  809. height: calc(100vh - 120px);
  810. overflow: auto;
  811. margin: 0 auto;
  812. border-radius: 4px;
  813. background: #fff;
  814. padding: 24px;
  815. display: block;
  816. .common-title-box {
  817. width: 100%;
  818. .el-icon-arrow-left {
  819. font-weight: 500;
  820. margin-right: 8px;
  821. cursor: pointer;
  822. }
  823. }
  824. .filt-box {
  825. margin: 24px 0;
  826. }
  827. .filt-item {
  828. display: flex;
  829. margin-bottom: 8px;
  830. label {
  831. width: 52px;
  832. font-weight: 400;
  833. font-size: 16px;
  834. line-height: 32px;
  835. color: #2f3742;
  836. flex-shrink: 0;
  837. }
  838. ul {
  839. list-style: none;
  840. display: flex;
  841. flex-flow: wrap;
  842. padding: 0;
  843. margin: 0;
  844. li {
  845. margin: 0 8px 16px 0;
  846. background: #f2f3f5;
  847. border-radius: 2px;
  848. padding: 3px 11px;
  849. font-weight: 500;
  850. font-size: 16px;
  851. line-height: 24px;
  852. color: #2f3742;
  853. cursor: pointer;
  854. border: 1px solid #f2f3f5;
  855. height: 32px;
  856. box-sizing: border-box;
  857. display: flex;
  858. align-items: center;
  859. &:hover {
  860. color: #165dff;
  861. }
  862. &.not-allow {
  863. cursor: not-allowed;
  864. background: #f2f3f5;
  865. color: #c1c5cd;
  866. }
  867. &.active {
  868. color: #165dff;
  869. border-color: #165dff;
  870. background: #ffffff;
  871. .el-icon-success {
  872. margin-right: 4px;
  873. font-size: 12px;
  874. margin-top: 2px;
  875. }
  876. }
  877. &.not-allow.active {
  878. color: #cedcfe;
  879. border-color: #cedcfe;
  880. }
  881. }
  882. }
  883. .el-input {
  884. width: 240px;
  885. height: 32px;
  886. background: #f2f3f5;
  887. border-radius: 2px;
  888. }
  889. }
  890. }
  891. .item-box {
  892. padding: 0 0 0 40px;
  893. margin: 0;
  894. list-style: none;
  895. display: flex;
  896. flex-flow: wrap;
  897. li {
  898. width: 120px;
  899. margin: 12px;
  900. .image {
  901. width: 120px;
  902. height: 168px;
  903. }
  904. .el-checkbox {
  905. width: 120px;
  906. display: flex;
  907. }
  908. }
  909. }
  910. .nodata {
  911. text-align: center;
  912. img {
  913. width: 329px;
  914. }
  915. p {
  916. color: #a8a8a8;
  917. font-size: 14px;
  918. font-weight: 400;
  919. line-height: 22px;
  920. margin: 30px 0;
  921. }
  922. }
  923. </style>
  924. <style lang="scss">
  925. .filt-box {
  926. input {
  927. height: 32px;
  928. line-height: 32px;
  929. background: #f2f3f5;
  930. border: none;
  931. }
  932. .el-input__icon {
  933. line-height: 32px;
  934. cursor: pointer;
  935. color: #4e5969 !important;
  936. }
  937. .el-input-group__append {
  938. background: #f2f3f5;
  939. border: none;
  940. }
  941. .el-button {
  942. padding: 9px 12px;
  943. }
  944. }
  945. .add-goods {
  946. .item-box {
  947. .el-checkbox {
  948. padding: 12px 0;
  949. .el-checkbox__inner {
  950. margin-top: 5px;
  951. }
  952. .el-checkbox__label {
  953. width: 100px;
  954. white-space: normal;
  955. color: #2f3742;
  956. font-size: 14px;
  957. font-weight: 400;
  958. line-height: 22px;
  959. }
  960. }
  961. }
  962. }
  963. </style>