index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="main animate__animated animate__backInRight">
  5. <el-col :span="24" class="one">
  6. <c-search :is_search="true" :fields="fields" @search="btSearch"></c-search>
  7. </el-col>
  8. <el-col :span="24" class="two">
  9. <data-table :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @view="toView" @pay="toPay"> </data-table>
  10. </el-col>
  11. </el-col>
  12. </el-row>
  13. </div>
  14. </template>
  15. <script>
  16. import { order_type } from '@common/src/layout/site';
  17. import { mapState, createNamespacedHelpers } from 'vuex';
  18. const { mapActions } = createNamespacedHelpers('order');
  19. export default {
  20. name: 'index',
  21. props: {},
  22. components: {},
  23. data: function () {
  24. return {
  25. // 查询
  26. searchInfo: {},
  27. list: [],
  28. total: 0,
  29. fields: [
  30. { label: '序号', options: { type: 'index' } },
  31. { label: '订单号', model: '_id', isSearch: true },
  32. { label: '下单时间', model: 'time' },
  33. { label: '下单桌号', model: 'table' },
  34. { label: '支付金额', model: 'money' },
  35. { label: '用餐人数', model: 'num' },
  36. {
  37. label: '订单类型',
  38. model: 'type',
  39. type: 'select',
  40. format: (i) => {
  41. let data = this.typeList.find((r) => r.dict_value == i);
  42. if (data) return data.dict_label;
  43. else return '暂无';
  44. },
  45. isSearch: true,
  46. },
  47. { label: '备注', model: 'remark' },
  48. ],
  49. opera: [
  50. { label: '详情', method: 'view' },
  51. { label: '收款', method: 'pay', confirm: true, type: 'danger' },
  52. ],
  53. // 订单类型
  54. typeList: order_type,
  55. };
  56. },
  57. created() {
  58. this.search();
  59. },
  60. mounted() {},
  61. methods: {
  62. ...mapActions(['query', 'fetch', 'delete']),
  63. async search({ skip = 0, limit = 10, ...info } = {}) {
  64. let res = await this.query({ skip, limit, ...info, ...this.searchInfo });
  65. if (this.$checkRes(res)) {
  66. this.$set(this, `list`, res.data);
  67. this.$set(this, `total`, res.total);
  68. }
  69. },
  70. btSearch(query) {
  71. this.$set(this, `searchInfo`, query);
  72. this.search();
  73. },
  74. // 收款
  75. toPay() {
  76. console.log('收款');
  77. },
  78. // 详情
  79. toView({ data }) {
  80. this.$router.push({ path: '/order/add', query: { id: data._id } });
  81. },
  82. },
  83. computed: {
  84. ...mapState(['user']),
  85. },
  86. metaInfo() {
  87. return { title: this.$route.meta.title };
  88. },
  89. watch: {
  90. test: {
  91. deep: true,
  92. immediate: true,
  93. handler(val) {},
  94. },
  95. },
  96. };
  97. </script>
  98. <style lang="less" scoped>
  99. .dialog_1 {
  100. video {
  101. width: 100%;
  102. height: 390px;
  103. background-color: #000000;
  104. }
  105. }
  106. </style>