supermarkelists.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <template>
  2. <div id="policy">
  3. <supermarkettable-detail :tableData="tableData" :total="total" :info="info" @query="query"></supermarkettable-detail>
  4. </div>
  5. </template>
  6. <script>
  7. import supermarkettableDetail from '@/components/supermaket/supermarkettableDetail.vue';
  8. import { createNamespacedHelpers, mapGetters, mapState } from 'vuex';
  9. import _ from 'loadsh';
  10. const { mapActions: mapSite } = createNamespacedHelpers('site');
  11. const { mapActions: transaction } = createNamespacedHelpers('transaction');
  12. export default {
  13. name: 'policy',
  14. props: {},
  15. components: {
  16. supermarkettableDetail,
  17. },
  18. data: () => ({
  19. info: {},
  20. policyInfo: {},
  21. display: 'list',
  22. columnName: '',
  23. contentList: [],
  24. total: 1,
  25. skip: '',
  26. limit: 10,
  27. tableData: [],
  28. }),
  29. async created() {
  30. this.searchSite();
  31. this.jiaoyilist();
  32. },
  33. computed: {
  34. totaltype() {
  35. return this.$route.query.totaltype;
  36. },
  37. },
  38. methods: {
  39. ...mapSite(['showInfo']),
  40. ...transaction({ transactionQuery: 'query', ProductFetch: 'fetch', ProductDelete: 'delete' }),
  41. // 查询站点信息
  42. async searchSite() {
  43. let res = await this.showInfo();
  44. let object = JSON.parse(JSON.stringify(res.data));
  45. if (object) {
  46. this.$set(this, `info`, res.data);
  47. } else {
  48. this.$message.error(res.errmsg ? res.errmsg : 'error');
  49. }
  50. },
  51. async jiaoyilist({ skip = 0, limit = 10 } = {}) {
  52. const res = await this.transactionQuery({ skip, limit });
  53. this.$set(this, `tableData`, res.data);
  54. this.$set(this, `total`, res.total);
  55. },
  56. async query(val) {
  57. console.log(val);
  58. this.jiaoyilist({ skip: (val - 1) * this.limit, limit: this.limit });
  59. },
  60. },
  61. };
  62. </script>
  63. <style lang="scss" scoped></style>