123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- <template>
- <div id="index">
- <el-row>
- <el-col
- :span="24"
- class="main animate__animated animate__backInRight"
- v-loading="loadings"
- element-loading-text="拼命加载中"
- element-loading-spinner="el-icon-loading"
- >
- <span v-show="view === 'list'">
- <el-col :span="24" class="one"> <span>商品评价</span> </el-col>
- <el-col :span="24" class="two">
- <search-1 :form="searchForm" @onSubmit="search" @toReset="toClose"></search-1>
- </el-col>
- <el-col :span="24" class="four">
- <data-table :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @edit="toEdit"> </data-table>
- </el-col>
- </span>
- <detail v-if="view === 'info'" :id="id" @toBack="toBack"></detail>
- </el-col>
- </el-row>
- </div>
- </template>
- <script>
- const _ = require('lodash');
- import { mapState, mapGetters, createNamespacedHelpers } from 'vuex';
- const { mapActions: goods } = createNamespacedHelpers('goods');
- const { mapActions: dictData } = createNamespacedHelpers('dictData');
- export default {
- name: 'index',
- props: {},
- components: {
- search1: () => import('@/components/rateParts/parts/search-1.vue'),
- detail: () => import('@/components/rateParts/detail.vue'),
- },
- data: function () {
- const that = this;
- return {
- loadings: true,
- view: 'list',
- // 列表
- opera: [{ label: '查看评价', method: 'edit' }],
- fields: [
- { label: '商品名称', model: 'name', showTip: false },
- // { label: '店铺名称', model: 'shop.name' },
- ],
- list: [],
- total: 0,
- // 查询
- searchForm: {},
- id: '',
- };
- },
- async created() {
- await this.searchOther();
- await this.search();
- },
- methods: {
- ...dictData({ getDict: 'query' }),
- ...goods(['query', 'delete', 'fetch', 'update', 'create']),
- // 查询
- async search({ skip = 0, limit = this.$limit, ...info } = {}) {
- let condition = _.cloneDeep(this.searchForm);
- let res = await this.query({ skip, limit, ...condition, ...info, shop: this.user.shop.id });
- if (this.$checkRes(res)) {
- this.$set(this, 'list', res.data);
- this.$set(this, 'total', res.total);
- }
- this.loadings = false;
- },
- // 查看评价
- async toEdit({ data }) {
- this.$set(this, `id`, data._id);
- this.$set(this, `view`, 'info');
- },
- toBack() {
- this.view = 'list';
- },
- // 重置
- toClose() {
- this.searchForm = {};
- this.search();
- },
- async searchOther() {},
- },
- computed: {
- ...mapState(['user']),
- },
- metaInfo() {
- return { title: this.$route.meta.title };
- },
- watch: {
- test: {
- deep: true,
- immediate: true,
- handler(val) {},
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .main {
- .one {
- margin: 0 0 10px 0;
- span:nth-child(1) {
- font-size: 20px;
- font-weight: 700;
- margin-right: 10px;
- }
- }
- .two {
- margin: 0 0 10px 0;
- }
- .thr {
- margin: 0 0 10px 0;
- }
- }
- </style>
|