index.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <div id="goods">
  3. <el-col :span="24" class="one"> <span>客服</span> </el-col>
  4. <template v-if="view === 'list'">
  5. <data-table ref="dataTable" :fields="fields" :opera="opera" :data="list" :total="total" :limit="limit" @query="search" @edit="toEdit"></data-table>
  6. </template>
  7. <template v-else>
  8. <el-row>
  9. <el-col :span="24">
  10. <el-button icon="el-icon-back" size="mini" @click="toBack()">返回</el-button>
  11. </el-col>
  12. <el-col :span="24">
  13. <data-form :fields="infoFields" :rules="rules" v-model="form" labelWidth="150px" @save="toSave"> </data-form>
  14. </el-col>
  15. </el-row>
  16. </template>
  17. </div>
  18. </template>
  19. <script>
  20. const _ = require('lodash');
  21. import methodsUtil from '@/util/opera';
  22. import { mapState, createNamespacedHelpers } from 'vuex';
  23. const { mapActions } = createNamespacedHelpers('serviceContact');
  24. export default {
  25. name: 'index',
  26. props: {},
  27. components: {},
  28. data: function () {
  29. return {
  30. view: 'list',
  31. fields: [
  32. { label: '联系电话', model: 'phone' },
  33. { label: '微信', model: 'wx' },
  34. { label: 'QQ', model: 'qq' },
  35. { label: '邮箱', model: 'email' },
  36. ],
  37. opera: [{ label: '修改', method: 'edit' }],
  38. list: [],
  39. total: 0,
  40. limit: 10,
  41. // info部分
  42. infoFields: [
  43. { label: '联系电话', model: 'phone' },
  44. { label: '微信', model: 'wx' },
  45. { label: 'QQ', model: 'qq' },
  46. { label: '邮箱', model: 'email' },
  47. ],
  48. rules: {},
  49. form: {},
  50. };
  51. },
  52. created() {
  53. this.searchOthers();
  54. this.search();
  55. },
  56. methods: {
  57. ...mapActions(['query', 'delete', 'fetch', 'update', 'create']),
  58. ...methodsUtil,
  59. async search({ skip = 0, limit = this.limit, ...info } = {}) {
  60. const res = await this.query({ skip, limit, ...info });
  61. if (this.$checkRes(res)) {
  62. this.$set(this, `list`, res.data);
  63. this.$set(this, `total`, res.total);
  64. }
  65. },
  66. async searchOthers() {},
  67. },
  68. };
  69. </script>
  70. <style lang="less" scoped>
  71. .one {
  72. margin: 0 0 10px 0;
  73. span:nth-child(1) {
  74. font-size: 20px;
  75. font-weight: 700;
  76. margin-right: 10px;
  77. }
  78. }
  79. </style>