|
@@ -1,27 +1,171 @@
|
|
<template>
|
|
<template>
|
|
<div id="index">
|
|
<div id="index">
|
|
- <p>order</p>
|
|
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-col :span="24" class="main animate__animated animate__backInRight">
|
|
|
|
+ <el-col :span="24" class="one"> <span>订单管理</span> </el-col>
|
|
|
|
+ <el-col :span="24" class="two">
|
|
|
|
+ <search-1 :form="searchForm" :statusList="statusList" @onSubmit="search" @toReset="toClose" :total="total"></search-1>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="24" class="thr">
|
|
|
|
+ <el-button type="primary" size="mini" @click="toAdd()">新增</el-button>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="24" class="four">
|
|
|
|
+ <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
|
|
|
|
+ <el-tab-pane label="待付款" name="1">
|
|
|
|
+ <card-1 :list="list" :toEdit="toEdit" :toDel="toDel" :total="total" :statusList="statusList"></card-1>
|
|
|
|
+ </el-tab-pane>
|
|
|
|
+ <el-tab-pane label="待发货" name="2">
|
|
|
|
+ <card-2 :list="list" :toEdit="toEdit" :toDel="toDel" :total="total" :statusList="statusList"></card-2>
|
|
|
|
+ </el-tab-pane>
|
|
|
|
+ <el-tab-pane label="待收货" name="3">
|
|
|
|
+ <card-3 :list="list" :toEdit="toEdit" :toDel="toDel" :total="total" :statusList="statusList"></card-3>
|
|
|
|
+ </el-tab-pane>
|
|
|
|
+ <el-tab-pane label="已收货" name="4">
|
|
|
|
+ <card-4 :list="list" :toEdit="toEdit" :toDel="toDel" :total="total" :statusList="statusList"></card-4>
|
|
|
|
+ </el-tab-pane>
|
|
|
|
+ </el-tabs>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
|
|
|
+const _ = require('lodash');
|
|
|
|
+import { mapState, mapGetters, createNamespacedHelpers } from 'vuex';
|
|
|
|
+const { mapActions } = createNamespacedHelpers('order');
|
|
|
|
+const { mapActions: orderDetail } = createNamespacedHelpers('orderDetail');
|
|
|
|
+const { mapActions: dictData } = createNamespacedHelpers('dictData');
|
|
|
|
+
|
|
export default {
|
|
export default {
|
|
name: 'index',
|
|
name: 'index',
|
|
props: {},
|
|
props: {},
|
|
- components: {},
|
|
|
|
|
|
+ components: {
|
|
|
|
+ search1: () => import('./parts/search-1.vue'),
|
|
|
|
+ card1: () => import('./parts/card-1.vue'),
|
|
|
|
+ card2: () => import('./parts/card-2.vue'),
|
|
|
|
+ card3: () => import('./parts/card-3.vue'),
|
|
|
|
+ card4: () => import('./parts/card-4.vue'),
|
|
|
|
+ },
|
|
data: function () {
|
|
data: function () {
|
|
- return {};
|
|
|
|
|
|
+ const that = this;
|
|
|
|
+ return {
|
|
|
|
+ activeName: '2',
|
|
|
|
+ list: [],
|
|
|
|
+ total: 0,
|
|
|
|
+ // 查询
|
|
|
|
+ searchForm: {},
|
|
|
|
+ // 多选值
|
|
|
|
+ selected: [],
|
|
|
|
+ // 类型列表
|
|
|
|
+ statusList: [],
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ async created() {
|
|
|
|
+ await this.searchOther();
|
|
|
|
+ await this.search();
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ ...dictData({ dictQuery: 'query' }),
|
|
|
|
+ ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
|
|
|
|
+ ...orderDetail({ orderQuery: 'query', orderFetch: 'fetch', orderCreate: 'create', orderUpdate: 'update', orderDelete: 'delete' }),
|
|
|
|
+ // 查询
|
|
|
|
+ async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
|
+ const condition = _.cloneDeep(this.searchForm);
|
|
|
|
+ if (this.activeName == '1') {
|
|
|
|
+ info.status = '0';
|
|
|
|
+ let res = await this.query({ skip, limit, ...condition, ...info });
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$set(this, 'list', res.data);
|
|
|
|
+ this.$set(this, 'total', res.total);
|
|
|
|
+ }
|
|
|
|
+ } else if (this.activeName == '2') {
|
|
|
|
+ info.status = '1';
|
|
|
|
+ let res = await this.orderQuery({ skip, limit, ...condition, ...info });
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$set(this, 'list', res.data);
|
|
|
|
+ this.$set(this, 'total', res.total);
|
|
|
|
+ }
|
|
|
|
+ } else if (this.activeName == '3') {
|
|
|
|
+ info.status = '2';
|
|
|
|
+ let res = await this.orderQuery({ skip, limit, ...condition, ...info });
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$set(this, 'list', res.data);
|
|
|
|
+ this.$set(this, 'total', res.total);
|
|
|
|
+ }
|
|
|
|
+ } else if (this.activeName == '4') {
|
|
|
|
+ info.status = '3';
|
|
|
|
+ let res = await this.orderQuery({ skip, limit, ...condition, ...info });
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$set(this, 'list', res.data);
|
|
|
|
+ this.$set(this, 'total', res.total);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ handleClick(tab, event) {
|
|
|
|
+ this.search();
|
|
|
|
+ },
|
|
|
|
+ // 新增
|
|
|
|
+ toAdd() {},
|
|
|
|
+ // 修改
|
|
|
|
+ async toEdit({ data }) {},
|
|
|
|
+ async toDel({ data }) {
|
|
|
|
+ let res = await this.delete(data._id);
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$message({ type: `success`, message: `刪除信息成功` });
|
|
|
|
+ this.search();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ toClose() {
|
|
|
|
+ this.searchForm = {};
|
|
|
|
+ this.search();
|
|
|
|
+ },
|
|
|
|
+ // 多选
|
|
|
|
+ handleSelect(data) {
|
|
|
|
+ this.$set(this, `selected`, data);
|
|
|
|
+ },
|
|
|
|
+ // 查询其他信息
|
|
|
|
+ async searchOther() {
|
|
|
|
+ let res;
|
|
|
|
+ // 类型
|
|
|
|
+ res = await this.dictQuery({ code: 'order_process' });
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$set(this, `statusList`, res.data);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
...mapState(['user']),
|
|
...mapState(['user']),
|
|
},
|
|
},
|
|
- created() {},
|
|
|
|
- methods: {},
|
|
|
|
metaInfo() {
|
|
metaInfo() {
|
|
return { title: this.$route.meta.title };
|
|
return { title: this.$route.meta.title };
|
|
},
|
|
},
|
|
|
|
+ watch: {
|
|
|
|
+ test: {
|
|
|
|
+ deep: true,
|
|
|
|
+ immediate: true,
|
|
|
|
+ handler(val) {},
|
|
|
|
+ },
|
|
|
|
+ },
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
|
|
|
|
-<style lang="less" scoped></style>
|
|
|
|
|
|
+<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>
|