lrf402788946 3 年之前
父節點
當前提交
c07ac2317b
共有 3 個文件被更改,包括 121 次插入6 次删除
  1. 14 4
      src/views/cashing/order.vue
  2. 105 0
      src/views/cashing/parts/order-list.vue
  3. 2 2
      src/views/cashing/quota.vue

+ 14 - 4
src/views/cashing/order.vue

@@ -5,7 +5,10 @@
         <el-col :span="24" class="top">
           <top topType="2" :leftArrow="false"></top>
         </el-col>
-        <el-col :span="24" class="info" :style="{ height: clientHeight + 'px' }"> 我的订单 </el-col>
+        <el-col :span="24" class="info" :style="{ height: clientHeight + 'px' }">
+          <order-list :list="list"></order-list>
+        </el-col>
+        <page :limit="limit" :total="total" @search="search" />
         <el-col :span="24" class="foot">
           <foot :type="1"></foot>
         </el-col>
@@ -15,8 +18,10 @@
 </template>
 
 <script>
+import orderList from './parts/order-list.vue';
 import top from '@/layout/common/top.vue';
 import foot from '@/layout/common/foot.vue';
+import page from '@/layout/common/page.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: cashing } = createNamespacedHelpers('cashing');
 export default {
@@ -25,6 +30,8 @@ export default {
   components: {
     top,
     foot,
+    page,
+    orderList,
   },
   data: function () {
     return {
@@ -38,14 +45,17 @@ export default {
     await this.search();
   },
   mounted() {
-    let clientHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 80;
+    let clientHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 135;
     this.$set(this, `clientHeight`, clientHeight);
   },
   methods: {
     ...cashing(['query']),
     async search({ skip = 0, limit = this.limit, ...info } = {}) {
-      let res = await this.query({ skip, limit, ...info });
-      console.log(res);
+      let res = await this.query({ skip, limit, ...info }); //, user_id: this.user._id
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
     },
   },
   computed: {

+ 105 - 0
src/views/cashing/parts/order-list.vue

@@ -0,0 +1,105 @@
+<template>
+  <div id="list">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="one">
+          <el-col :span="24" class="list" v-for="(item, index) in list" :key="index">
+            <el-col :span="24" class="name">
+              {{ item.name }}
+            </el-col>
+            <el-col :span="24" class="other">
+              <el-col :span="24" class="other_info textOver">
+                订单号:<span>{{ getWord(item, 'no') }}</span>
+              </el-col>
+              <el-col :span="24" class="other_info textOver">
+                联系电话:<span>{{ getWord(item, 'phone') }}</span>
+              </el-col>
+              <el-col :span="24" class="other_info textOver">
+                应收金额:<span>{{ getWord(item, 'money') }}</span>
+              </el-col>
+              <el-col :span="24" class="other_info textOver">
+                最后审核时间:<span>{{ getWord(item, 'end_time') }}</span>
+              </el-col>
+            </el-col>
+            <el-col :span="24" class="btn">
+              <el-button type="info" size="mini" @click="detail(item)">查看详情</el-button>
+            </el-col>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+const _ = require('lodash');
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'list',
+  props: {
+    list: { type: Array },
+  },
+  components: {},
+  data: function () {
+    return {};
+  },
+  created() {},
+  methods: {
+    getWord(data, model) {
+      return _.get(data, model, '暂无');
+    },
+    detail(data) {
+      console.log(data);
+      this.$router.push({ path: '/cashing/quota/detail', query: { id: data.id } });
+    },
+  },
+  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 {
+    .list {
+      background-color: #fff;
+      padding: 8px;
+      border-radius: 5px;
+      margin: 0 0 10px 0;
+      .name {
+        font-size: 16px;
+        font-weight: bold;
+        margin: 0 0 5px 0;
+      }
+      .other {
+        margin: 0 0 5px 0;
+        .other_info {
+          font-size: 14px;
+          color: #666;
+          margin: 0 0 5px 0;
+          span {
+            color: #000;
+          }
+        }
+      }
+      .btn {
+        text-align: center;
+        .el-button {
+          margin: 0 10px;
+        }
+      }
+    }
+  }
+}
+</style>

+ 2 - 2
src/views/cashing/quota.vue

@@ -8,7 +8,7 @@
         <el-col :span="24" class="info" :style="{ height: clientHeight + 'px' }">
           <coupons-list :list="list"></coupons-list>
         </el-col>
-        <page :limit="limit" :total="total" @search="search"></page>
+        <page :limit="limit" :total="total" @search="search" />
         <el-col :span="24" class="foot">
           <foot :type="1"></foot>
         </el-col>
@@ -50,7 +50,7 @@ export default {
   methods: {
     ...couponsApply(['query']),
     async search({ skip = 0, limit = 10, ...info } = {}) {
-      const res = await this.query({ skip, limit, ...info, user_id: this.user.user_id });
+      const res = await this.query({ skip, limit, ...info, user_id: this.user._id });
       if (this.$checkRes(res)) {
         this.$set(this, `list`, res.data);
         this.$set(this, `total`, res.total);