zs 1 年之前
父节点
当前提交
ba985f9821
共有 1 个文件被更改,包括 40 次插入25 次删除
  1. 40 25
      src/views/platfinance/bill/index.vue

+ 40 - 25
src/views/platfinance/bill/index.vue

@@ -1,16 +1,12 @@
 <template>
   <div id="card-1">
     <el-row>
-      <el-col
-        :span="24"
-        class="main animate__animated animate__backInRight"
-        v-loading="loadings"
-        element-loading-text="拼命加载中"
-        element-loading-spinner="el-icon-loading"
-      >
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loadings"
+        element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading">
         <el-col :span="24" class="one"> <span>账单管理</span> </el-col>
         <el-col :span="24" class="one">
-          <search-1 :form="searchForm" @onSubmit="search" @querySearch="querySearch" @toReset="toClose" :shopList="shopList"></search-1>
+          <search-1 :form="searchForm" @onSubmit="search" @querySearch="querySearch" @toReset="toClose"
+            :shopList="shopList"></search-1>
         </el-col>
         <el-col :span="24" v-if="afterSaleList.length != '0' || orderList.length != '0'">
           <el-button type="primary" @click="toFile()">对账</el-button>
@@ -21,10 +17,12 @@
         <el-col :span="24">
           <el-tabs type="border-card">
             <el-tab-pane label="订单">
-              <data-table :fields="orderfields" @query="search" rowKey="rowKey" :data="orderList" :usePage="false"> </data-table>
+              <data-table :fields="orderfields" @query="search" rowKey="rowKey" :data="orderList" :usePage="false">
+              </data-table>
             </el-tab-pane>
             <el-tab-pane label="售后单">
-              <data-table :fields="afterSalefields" @query="search" rowKey="rowKey" :data="afterSaleList" :usePage="false"> </data-table>
+              <data-table :fields="afterSalefields" @query="search" rowKey="rowKey" :data="afterSaleList"
+                :usePage="false"> </data-table>
             </el-tab-pane>
           </el-tabs>
         </el-col>
@@ -92,19 +90,33 @@ export default {
     // 查询
     async search({ skip = 0, limit = this.$limit, ...info } = {}) {
       let condition = _.cloneDeep(this.searchForm);
-      if (condition.buy_time && condition.shop) {
-        condition[`start`] = _.head(condition.buy_time);
-        condition[`end`] = _.last(condition.buy_time);
-        delete condition.buy_time;
-        // 判断是否是个人店铺查询
-        if (this.user.role.code == 'shopAdmin') info.shop = this.user.shop._id || this.user.shop.id;
-        let res = await this.query({ skip, limit, ...condition, ...info });
-        if (this.$checkRes(res)) {
-          this.$set(this, 'info', res.data);
-          this.$set(this, 'afterSaleList', res.data.afterSaleList);
-          this.$set(this, 'orderList', res.data.orderList);
-        }
-      } else this.$message({ type: `warning`, message: `请选择查询信息` });
+      if (this.user.role.code == 'shopAdmin') {
+        if (condition.buy_time) {
+          condition[`start`] = _.head(condition.buy_time);
+          condition[`end`] = _.last(condition.buy_time);
+          delete condition.buy_time;
+          // 判断是否是个人店铺查询
+          if (this.user.role.code == 'shopAdmin') info.shop = this.user.shop._id || this.user.shop.id;
+          let res = await this.query({ skip, limit, ...condition, ...info });
+          if (this.$checkRes(res)) {
+            this.$set(this, 'info', res.data);
+            this.$set(this, 'afterSaleList', res.data.afterSaleList);
+            this.$set(this, 'orderList', res.data.orderList);
+          }
+        } else this.$message({ type: `warning`, message: `请选择查询信息` });
+      } else {
+        if (condition.buy_time && condition.shop) {
+          condition[`start`] = _.head(condition.buy_time);
+          condition[`end`] = _.last(condition.buy_time);
+          delete condition.buy_time;
+          let res = await this.query({ skip, limit, ...condition, ...info });
+          if (this.$checkRes(res)) {
+            this.$set(this, 'info', res.data);
+            this.$set(this, 'afterSaleList', res.data.afterSaleList);
+            this.$set(this, 'orderList', res.data.orderList);
+          }
+        } else this.$message({ type: `warning`, message: `请选择查询信息` });
+      }
       this.loadings = false;
     },
     // 重置
@@ -151,7 +163,7 @@ export default {
       });
     },
     // 查询其他信息
-    async searchOther() {},
+    async searchOther() { },
   },
   computed: {
     ...mapState(['user']),
@@ -163,7 +175,7 @@ export default {
     test: {
       deep: true,
       immediate: true,
-      handler(val) {},
+      handler(val) { },
     },
   },
 };
@@ -179,14 +191,17 @@ export default {
     margin-right: 10px;
   }
 }
+
 .two {
   span {
     color: red;
   }
 }
+
 .title {
   text-align: center;
 }
+
 .el-col {
   margin: 10px 0;
 }