Kaynağa Gözat

Merge remote-tracking branch 'origin/master'

zyp 1 gün önce
ebeveyn
işleme
8c4b8ef7da

+ 7 - 0
src/api/crm/customer.js

@@ -156,3 +156,10 @@ export function delCustomer(customerId) {
     method: 'delete'
   })
 }
+
+export function switchToTop(customerId) {
+  return request({
+    url: '/crm/customer/switchToTop/' + customerId,
+    method: 'post',
+  })
+}

+ 47 - 0
src/api/crm/customerLevel.js

@@ -0,0 +1,47 @@
+import request from "@/utils/request";
+
+export const list = (query) => {
+  return request({
+    url: "/crm/customerLevel/list",
+    method: "get",
+    params: query,
+  });
+};
+
+export const get = (id) => {
+  return request({
+    url: "/crm/customerLevel/" + id,
+    method: "get",
+  });
+};
+
+export const add = (data) => {
+  return request({
+    url: "/crm/customerLevel/add",
+    method: "post",
+    data: data,
+  });
+};
+
+export const edit = (data) => {
+  return request({
+    url: "/crm/customerLevel/edit",
+    method: "put",
+    data: data,
+  });
+};
+
+export const del = (data) => {
+  return request({
+    url: "/crm/customerLevel/delete/" + data,
+    method: "delete",
+  });
+};
+
+export const customerLevelOption = (query) => {
+  return request({
+    url: "/crm/customerLevel/getCustomerLevelOption",
+    method: "get",
+    params: query,
+  });
+};

+ 9 - 3
src/api/store/statistics.js

@@ -1,6 +1,6 @@
 import request from '@/utils/request'
 
- 
+
 export function storeOrder(query) {
   return request({
     url: '/store/statistics/storeOrder',
@@ -15,5 +15,11 @@ export function storePayment(query) {
     params: query
   })
 }
- 
- 
+
+ export function getOrderStatistics(params) {
+  return request({
+    url: '/store/storeOrder/statistics/getStoreOrderStatistics',
+    method: 'get',
+    params
+  });
+}

+ 1 - 1
src/views/course/courseQuestionBank/index.vue

@@ -118,7 +118,7 @@
           icon="el-icon-upload2"
           size="mini"
           @click="handleImport"
-          v-hasPermi="['course:courseQuestionBank:import']"
+          v-hasPermi="['course:courseQuestionBank:importData']"
         >导入</el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>

+ 2 - 2
src/views/course/userWatchCourseStatistics/index.vue

@@ -91,10 +91,10 @@
       <el-table-column label="会员数量" align="center" prop="userNum" />
       <el-table-column label="观看人数" align="center" prop="watchNum" />
       <el-table-column label="完播人数" align="center" prop="completeWatchNum" />
-      <el-table-column label="完播率(%)" align="center" prop="completeWatchRate" />
+      <el-table-column label="完播率" align="center" prop="completeWatchRatePercent" />
       <el-table-column label="答题人数" align="center" prop="answerNum" />
       <el-table-column label="正确人数" align="center" prop="answerRightNum" />
-      <el-table-column label="正确率(%)" align="center" prop="answerRightRate" />
+      <el-table-column label="正确率" align="center" prop="answerRightRatePercent" />
       <el-table-column label="红包领取个数" align="center" prop="redPacketNum" />
       <el-table-column label="红包领取总额" align="center" prop="redPacketAmount" />
     </el-table>

+ 1 - 2
src/views/course/userWatchCourseTotalStatistics/index.vue

@@ -81,7 +81,6 @@
           size="mini"
           :loading="exportLoading"
           @click="handleExport"
-          v-hasPermi="['course:userWatchCourseStatistics:export']"
         >导出</el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
@@ -100,7 +99,7 @@
       <el-table-column label="会员数量" align="center" prop="userNum" />
       <el-table-column label="观看人数" align="center" prop="watchNum" />
       <el-table-column label="完播人数" align="center" prop="completeWatchNum" />
-      <el-table-column label="完播率(%)" align="center" prop="completeWatchRate" />
+      <el-table-column label="完播率" align="center" prop="completeWatchRatePercent" />
       <el-table-column label="红包领取个数" align="center" prop="redPacketNum" />
     </el-table>
 

+ 1 - 1
src/views/course/userWatchStatistics/index.vue

@@ -65,7 +65,7 @@
       <el-table-column label="会员数量" align="center" prop="userNum" />
       <el-table-column label="观看人数" align="center" prop="watchNum" />
       <el-table-column label="完播人数" align="center" prop="completeWatchNum" />
-      <el-table-column label="完播率(%)" align="center" prop="completeWatchRate" />
+      <el-table-column label="完播率" align="center" prop="completeWatchRatePercent" />
 
     </el-table>
 

+ 9 - 1
src/views/crm/components/customerDetails.vue

@@ -43,7 +43,7 @@
             </el-descriptions-item>
             <el-descriptions-item label="客户类型" >
                 <span v-if="item!=null">
-                    <el-tag  v-for="(dict, index) in typeOptions"    v-if="item.customerType==dict.dictValue">{{dict.dictLabel}}</el-tag>
+                    <el-tag v-for="dict in customerLevelOptions"  v-if="item.customerLevel === dict.dictValue">{{dict.dictLabel}}</el-tag>
                 </span>
             </el-descriptions-item>
             <el-descriptions-item label="客户状态" >
@@ -141,6 +141,7 @@
     import customerStoreOrderList from '../components/customerStoreOrderList.vue';
     import customerContacts from './customerContacts.vue';
     import { getCustomer,getCustomer1,getCustomer2 } from "@/api/crm/customer";
+    import {customerLevelOption} from "@/api/crm/customerLevel";
     export default {
         name: "customer",
         components: { customerContacts,customerVisitList,customerLogsList,customerVoiceLogsList,customerStoreOrderList,customerSmsLogsList },
@@ -155,6 +156,7 @@
                 sexOptions:[],
                 item:null,
                 company:null,
+              customerLevelOptions: [],
 
             };
         },
@@ -176,11 +178,17 @@
                 this.customerExts = response.data;
 
             });
+          this.getCustomerLevelOptions()
 
         },
         mounted(){
         },
         methods: {
+          getCustomerLevelOptions() {
+            customerLevelOption().then(response => {
+              this.customerLevelOptions = response.data;
+            })
+          },
             handleMobile(){
                 const customerId = this.item.customerId;
                 getCustomer2(customerId).then(response =>{

+ 53 - 32
src/views/crm/customer/index.vue

@@ -60,17 +60,17 @@
               />
         </el-select>
       </el-form-item>
-      <el-form-item label="客户类型" prop="customerType">
-        <el-select multiple v-model="ctsTypeArr" placeholder="请选择客户类型" clearable size="small">
+      <el-form-item label="客户类型" prop="customerLevel">
+        <el-select v-model="queryParams.customerLevel" placeholder="请选择客户类型" clearable size="small">
            <el-option
-                v-for="item in typeOptions"
+                v-for="item in customerLevelOptions"
                 :key="'type'+item.dictValue"
                 :label="item.dictLabel"
                 :value="item.dictValue"
               />
         </el-select>
       </el-form-item>
-      
+
       <el-form-item label="创建时间" prop="createTime">
         <el-date-picker clearable size="small" style="width: 205.4px"
           v-model="dateRange"
@@ -186,9 +186,9 @@
         </template>
       </el-table-column>
 
-      <el-table-column  label="客户类型" align="center" prop="customerType">
+      <el-table-column  label="客户类型" align="center">
         <template slot-scope="scope">
-            <el-tag prop="customerType" v-for="(item, index) in typeOptions" :key="'customerType'+index"   v-if="scope.row.customerType==item.dictValue">{{item.dictLabel}}</el-tag>
+          <el-tag v-for="item in customerLevelOptions"  v-if="scope.row.customerLevel === item.dictValue">{{item.dictLabel}}</el-tag>
         </template>
       </el-table-column>
 
@@ -228,6 +228,13 @@
             @click="handleDelete(scope.row)"
             v-hasPermi="['crm:customer:remove']"
           >删除</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-mouse"
+            @click="handleSwitchToTop(scope.row)"
+            v-hasPermi="['crm:customer:switchToTop']"
+          >{{ scope.row.isTop === 1 ? '取消置顶' : '置顶' }}</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -280,10 +287,10 @@
                 />
           </el-select>
         </el-form-item>
-        <el-form-item label="客户类型" prop="customerType">
-          <el-select v-model="form.customerType" placeholder="请选择客户类型" clearable size="small">
+        <el-form-item label="客户类型">
+          <el-select v-model="form.customerLevel" placeholder="请选择客户类型" clearable size="small">
             <el-option
-                  v-for="item in typeOptions"
+                  v-for="item in customerLevelOpenOptions"
                   :key="item.dictValue"
                   :label="item.dictLabel"
                   :value="item.dictValue"
@@ -346,7 +353,15 @@
 </template>
 
 <script>
-import { listCustomer,getCustomer,addCustomer,updateCustomer,delCustomer,exportCustomer  } from "@/api/crm/customer";
+import {
+  listCustomer,
+  getCustomer,
+  addCustomer,
+  updateCustomer,
+  delCustomer,
+  exportCustomer,
+  switchToTop
+} from "@/api/crm/customer";
 import { getCompanyList } from "@/api/company/company";
 import customerDetails from '../components/customerDetails.vue';
 import editCustomerSource from '../components/editCustomerSource.vue';
@@ -356,6 +371,7 @@ import { throwStatement } from "@babel/types";
 import { treeselect } from "@/api/company/companyDept";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import {customerLevelOption} from "@/api/crm/customerLevel";
 
 export default {
    watch: {
@@ -441,7 +457,8 @@ export default {
         companyId: null,
         isLine: null,
         source: null,
-        tags: null
+        tags: null,
+        customerLevel: null,
       },
       // 表单参数
       form: {},
@@ -459,7 +476,9 @@ export default {
         source: [
           { required: true, message: "客户来源不能为空", trigger: "blur" }
         ],
-      }
+      },
+      customerLevelOptions: [],
+      customerLevelOpenOptions: [],
     };
   },
   created() {
@@ -483,8 +502,14 @@ export default {
     });
     this.getCitys();
     this.getList();
+    this.getCustomerLevelOptions()
   },
   methods: {
+     getCustomerLevelOptions() {
+       customerLevelOption().then(response => {
+         this.customerLevelOptions = response.data;
+       })
+     },
     handleEditSource(){
       this.source.open=true;
       var that=this;
@@ -534,25 +559,6 @@ export default {
           this.citys=res.data;
         })
     },
-    handleClose(tag) {
-        this.tags.splice(this.tags.indexOf(tag), 1);
-        this.form.tags=this.tags.toString();
-    },
-    showInput() {
-      this.inputVisible = true;
-      this.$nextTick(_ => {
-        this.$refs.saveTagInput.$refs.input.focus();
-      });
-    },
-    handleInputConfirm() {
-      let inputValue = this.inputValue;
-      if (inputValue) {
-        this.tags.push(inputValue);
-      }
-      this.inputVisible = false;
-      this.inputValue = '';
-      this.form.tags=this.tags.toString();
-    },
     handleShow(row){
       var that=this;
       that.show.open=true;
@@ -631,7 +637,8 @@ export default {
         companyId: null,
         isLine: null,
         source: null,
-        tags: null
+        tags: null,
+        customerLevel: null,
       };
       this.tags=[];
       this.cityIds=[];
@@ -689,6 +696,11 @@ export default {
               that.cityIds.push(id)
           });
         }
+
+        customerLevelOption({status: 0}).then(response => {
+          this.customerLevelOpenOptions = response.data;
+        })
+
         this.open = true;
         this.title = "修改客户";
       });
@@ -731,6 +743,15 @@ export default {
           this.msgSuccess("删除成功");
         }).catch(function() {});
     },
+    handleSwitchToTop(row) {
+      switchToTop(row.customerId).then(response => {
+        const {code} = response
+        if (code === 200) {
+          this.msgSuccess(row.isTop === 0 ? "已置顶" : "已取消置顶");
+          this.getList();
+        }
+      })
+    },
     /** 导出按钮操作 */
     handleExport() {
       //const queryParams = this.queryParams;

+ 34 - 5
src/views/crm/customer/line.vue

@@ -158,7 +158,7 @@
       </el-table-column>
       <el-table-column label="流量来源" align="center" prop="trafficSource" />
       <el-table-column label="备注" align="center" prop="remark" />
-      <el-table-column label="操作"   align="center" class-name="small-padding fixed-width">
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
             size="mini"
@@ -285,6 +285,12 @@
         <el-form-item label="备注" prop="remark">
           <el-input type="textarea" :rows="2" v-model="form.remark"   placeholder="请输入备注" />
         </el-form-item>
+        <el-form-item label="是否置顶">
+          <el-radio-group v-model="form.isTop">
+            <el-radio :label="0" >否</el-radio>
+            <el-radio :label="1" >是</el-radio>
+          </el-radio-group>
+        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>
@@ -329,7 +335,17 @@
 </template>
 
 <script>
-import { assignCustomer,importLineTemplate,listLineCustomer, getLineCustomer, delLineCustomer, addLineCustomer, updateLineCustomer, exportLineCustomer } from "@/api/crm/customer";
+import {
+  assignCustomer,
+  importLineTemplate,
+  listLineCustomer,
+  getLineCustomer,
+  delLineCustomer,
+  addLineCustomer,
+  updateLineCustomer,
+  exportLineCustomer,
+  switchToTop
+} from "@/api/crm/customer";
 import {getCitys} from "@/api/store/city";
 import { getToken } from "@/utils/auth";
 import { isAdmin } from "@/api/system/user";
@@ -337,6 +353,7 @@ import editCustomerSource from '../components/editCustomerSource.vue';
 
 import customerAssignList from '../components/customerAssignList.vue';
 import assignCompany from '../components/assignCompany.vue';
+import {customerLevelOption} from "@/api/crm/customerLevel";
 
 export default {
   name: "Customer",
@@ -453,6 +470,8 @@ export default {
         province:null,
         city:null,
         district:null,
+        customerLevel: null,
+        isTop: 0
       },
       // 表单校验
       rules: {
@@ -462,7 +481,7 @@ export default {
         source: [
           { required: true, message: "客户来源不能为空", trigger: "blur" }
         ],
-      }
+      },
     };
   },
   created() {
@@ -602,7 +621,9 @@ export default {
         companyId: null,
         isLine: null,
         source: null,
-        tags: null
+        tags: null,
+        customerLevel: null,
+        isTop: 0
       };
       this.tags=[];
       this.cityIds=[];
@@ -739,6 +760,14 @@ export default {
           this.msgSuccess("删除成功");
         }).catch(function() {});
     },
+    handleSwitchToTop(row) {
+      switchToTop(row.customerId).then(response => {
+        if (response.code === 200) {
+          this.msgSuccess(row.isTop === 0 ? "置顶成功" : "已取消置顶");
+          this.getList();
+        }
+      })
+    },
     /** 导出按钮操作 */
     handleExport() {
       const queryParams = this.queryParams;
@@ -779,7 +808,7 @@ export default {
      // 提交上传文件
      submitFileForm() {
       this.$refs.upload.submit();
-    }
+    },
   }
 };
 </script>

+ 233 - 0
src/views/crm/customerLevel/index.vue

@@ -0,0 +1,233 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="级别名称" prop="name">
+        <el-input
+          v-model="queryParams.name"
+          placeholder="请输入级别名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['crm:customerLevel:add']"
+        >新增</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border height="500" v-loading="loading" :data="customerLevelList">
+      <el-table-column label="ID" align="center" prop="id" />
+      <el-table-column label="级别名称" align="center" prop="name" />
+      <el-table-column  label="状态" align="center" prop="status">
+        <template slot-scope="scope">
+          <el-tag :type="getStatusType(scope.row.status)">{{getStatusLabel(scope.row.status)}}</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="序号" align="center" prop="sort" />
+      <el-table-column label="操作"   align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['crm:customerLevel:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['crm:customerLevel:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page-sizes="pageSizes"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <el-dialog :title="customLevelDialog.title" :visible.sync="customLevelDialog.open" width="500px" append-to-body>
+      <el-form ref="form" :model="customLevelDialog.form" :rules="customLevelDialog.rules" label-width="80px">
+        <el-form-item label="级别名称" prop="name">
+          <el-input v-model="customLevelDialog.form.name" placeholder="请输入级别名称" />
+        </el-form-item>
+        <el-form-item label="状态" prop="status">
+          <el-radio v-model="customLevelDialog.form.status" label="0">正常</el-radio>
+          <el-radio v-model="customLevelDialog.form.status" label="1">停用</el-radio>
+        </el-form-item>
+        <el-form-item label="排序" prop="sort">
+          <el-input-number v-model="customLevelDialog.form.sort" placeholder="请输入排序" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+
+  </div>
+</template>
+
+<script>
+import {add, del, get, edit, list} from '@/api/crm/customerLevel'
+
+const initForm = {
+  id: null,
+  name: null,
+  status: '0',
+  sort: 0
+}
+
+const statusOptions = [
+  {
+    dictLabel: "正常",
+    dictValue: 0,
+    type: 'success'
+  },
+  {
+    dictLabel: "停用",
+    dictValue: 1,
+    type: 'danger'
+  }
+]
+
+export default {
+  name: "index",
+  data() {
+    return {
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        name: null
+      },
+      loading: false,
+      customerLevelList: [],
+      statusOptions: statusOptions,
+      total: 0,
+      pageSizes:[10, 20, 30, 50, 100],
+      showSearch: true,
+      customLevelDialog: {
+        title: "新增",
+        open: false,
+        form: initForm,
+        rules: {
+          name: [
+            { required: true, message: "级别名称不能为空", trigger: "blur" }
+          ]
+        }
+      }
+    }
+  },
+  created() {
+    this.handleQuery()
+  },
+  methods: {
+    handleQuery() {
+      this.queryParams.pageNum = 1
+      this.getList()
+    },
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    getList() {
+      this.loading = true
+      list(this.queryParams).then(response => {
+        this.customerLevelList = response.rows
+        this.total = response.total
+        this.loading = false
+      })
+    },
+    getStatusType(status) {
+      return this.statusOptions.find(val => val.dictValue === status)?.type || ''
+    },
+    getStatusLabel(status) {
+      return this.statusOptions.find(val => val.dictValue === status)?.dictLabel || ''
+    },
+    handleAdd() {
+      this.reset()
+      this.customLevelDialog.open = true
+      this.customLevelDialog.title = "新增级别"
+    },
+    handleUpdate(row) {
+      this.reset()
+      get(row.id).then(response => {
+        this.customLevelDialog.form = response.data
+        this.customLevelDialog.form.status = response.data.status.toString()
+        this.customLevelDialog.open = true
+        this.customLevelDialog.title = "修改级别"
+      })
+    },
+    handleDelete(row) {
+      this.$confirm('是否确认删除级别编号为"' + row.id + '"的数据项?', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(function() {
+        return del(row.id)
+      }).then(() => {
+        this.getList()
+        this.msgSuccess("删除成功")
+      })
+    },
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.customLevelDialog.form.id != null) {
+            edit(this.customLevelDialog.form).then(response => {
+              const {code} = response
+              if (code === 200) {
+                this.msgSuccess("修改成功");
+                this.customLevelDialog.open = false;
+                this.getList();
+              }
+            })
+          } else {
+            add(this.customLevelDialog.form).then(response => {
+              const {code} = response
+              if (code === 200) {
+                this.msgSuccess("新增成功");
+                this.customLevelDialog.open = false;
+                this.getList();
+              }
+            })
+          }
+        }
+      });
+    },
+    cancel() {
+      this.customLevelDialog.open = false
+      this.reset();
+    },
+    reset() {
+      this.customLevelDialog.form = initForm
+      this.resetForm("form")
+    },
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 1 - 1
src/views/index.vue

@@ -300,7 +300,7 @@
                 <div class="card-row">
                   <span>答题红包金额(元)</span>
                   <span class="highlight">
-                    <count-to :start-val="0" :end-val="rewardMoney" :duration="3600" class="card-panel-num" /></span>
+                    {{rewardMoney}}</span>
                 </div>
               </div>
             </div>

+ 498 - 0
src/views/store/statistics/orderstatatic.vue

@@ -0,0 +1,498 @@
+<template>
+  <div class="order-statistics-container">
+    <el-card class="search-card">
+      <div class="search-header">
+        <span class="title">订单统计</span>
+        <div class="search-actions">
+          <el-date-picker
+            v-model="dateRange"
+            type="daterange"
+            align="right"
+            unlink-panels
+            range-separator="至"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            :picker-options="pickerOptions"
+            @change="handleDateChange"
+          />
+          <el-button type="primary" @click="handleSearch" :loading="loading">查询</el-button>
+        </div>
+      </div>
+    </el-card>
+
+    <el-row :gutter="20" class="statistics-row">
+      <el-col :span="6">
+        <el-card shadow="hover">
+          <div class="statistic-item">
+            <div class="statistic-title">订单总量</div>
+            <div class="statistic-value">{{ statistics.orderCount }}</div>
+          </div>
+        </el-card>
+      </el-col>
+
+      <el-col :span="6">
+        <el-card shadow="hover">
+          <div class="statistic-item" @click="fetchOrderDetails" style="cursor: pointer;">
+            <div class="statistic-title">总金额</div>
+            <div class="statistic-value">¥{{ statistics.totalAmount | formatMoney }}</div>
+          </div>
+        </el-card>
+      </el-col>
+
+      <el-col :span="6">
+        <el-card shadow="hover">
+          <div class="statistic-item">
+            <div class="statistic-title">成交率</div>
+            <div class="statistic-value">{{ statistics.successRate }}%</div>
+          </div>
+        </el-card>
+      </el-col>
+
+      <el-col :span="6">
+        <el-card shadow="hover">
+          <div class="statistic-item">
+            <div class="statistic-title">退货率</div>
+            <div class="statistic-value">{{ statistics.returnRate }}%</div>
+          </div>
+        </el-card>
+      </el-col>
+    </el-row>
+
+    <!-- 订单详情对话框 -->
+    <el-dialog
+      title="订单详情"
+      :visible.sync="detailModalVisible"
+      width="85%"
+      top="5vh"
+      class="clean-dialog"
+    >
+      <div class="clean-container">
+        <el-table
+          :data="orderDetails"
+          border
+          style="width: 100%"
+          v-loading="detailLoading"
+          height="70vh"
+          class="clean-table"
+        >
+          <el-table-column
+            label="订单号"
+            align="center"
+            prop="orderCode"
+            width="180"
+            header-align="center"
+          />
+          <el-table-column
+            label="所属公司"
+            align="center"
+            prop="companyName"
+            header-align="center"
+            show-overflow-tooltip
+          />
+          <el-table-column
+            label="用户/收件人"
+            align="center"
+            header-align="center"
+            width="150"
+          >
+            <template slot-scope="scope">
+              <div class="compact-cell">
+                <div>{{ scope.row.nickname || '-' }}</div>
+                <div class="secondary-text">{{ scope.row.realName || '-' }}</div>
+              </div>
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="金额(元)"
+            align="center"
+            header-align="center"
+            width="150"
+          >
+            <template slot-scope="scope">
+              <div class="compact-cell">
+                <div>总价: {{ scope.row.totalPrice ? scope.row.totalPrice.toFixed(2) : '0.00' }}</div>
+                <div>实付: {{ scope.row.payPrice ? scope.row.payPrice.toFixed(2) : '0.00' }}</div>
+              </div>
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="时间"
+            align="center"
+            header-align="center"
+            width="220"
+          >
+            <template slot-scope="scope">
+              <div class="compact-cell">
+                <div>{{ scope.row.createTime }}</div>
+                <div class="secondary-text">{{ scope.row.payTime || '未支付' }}</div>
+              </div>
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="支付/类型"
+            align="center"
+            header-align="center"
+            width="150"
+          >
+            <template slot-scope="scope">
+              <div class="compact-cell">
+                <el-tag
+                  size="small"
+                  style="display:block;margin:0 auto 4px;width:fit-content"
+                  v-for="item in payTypeOptions"
+                  v-if="scope.row.payType==item.dictValue"
+                >{{item.dictLabel}}</el-tag>
+                <el-tag
+                  size="small"
+                  style="display:block;margin:0 auto;width:fit-content"
+                  v-for="item in orderTypeOptions"
+                  v-if="scope.row.orderType==item.dictValue"
+                >{{item.dictLabel}}</el-tag>
+              </div>
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="状态"
+            align="center"
+            header-align="center"
+            width="150"
+          >
+            <template slot-scope="scope">
+              <div class="compact-cell">
+                <el-tag
+                  size="small"
+                  style="display:block;margin:0 auto 4px;width:fit-content"
+                  v-for="item in statusOptions"
+                  v-if="scope.row.status==item.dictValue"
+                >{{item.dictLabel}}</el-tag>
+                <el-tag
+                  size="small"
+                  style="display:block;margin:0 auto;width:fit-content"
+                  v-for="item in deliveryStatusOptions"
+                  v-if="scope.row.deliveryStatus==item.dictValue"
+                >{{item.dictLabel}}</el-tag>
+              </div>
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="操作"
+            fixed="right"
+            width="90"
+            align="center"
+            header-align="center"
+          >
+            <template slot-scope="scope">
+              <el-button
+                size="mini"
+                type="text"
+                style="color:#409EFF;padding:5px 0"
+                @click="handleDetails(scope.row)"
+                v-hasPermi="['store:storeOrder:query']"
+              >详情</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+
+        <div style="margin-top:15px">
+          <pagination
+            v-show="pagination.total>0"
+            :total="pagination.total"
+            :page.sync="pagination.currentPage"
+            :limit.sync="pagination.pageSize"
+            @pagination="fetchOrderDetails"
+          />
+        </div>
+      </div>
+
+      <el-drawer
+        :title="show.title"
+        :visible.sync="show.open"
+        size="65%"
+        :modal="false"
+        :wrapper-closable="false"
+        :append-to-body="true"
+        custom-class="safe-drawer"
+      >
+        <product-order ref="order" />
+      </el-drawer>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { getOrderStatistics } from "@/api/store/statistics";
+import { listStoreOrder  } from "@/api/store/storeOrder";
+import productOrder from "../components/productOrder";
+export default {
+  components: { productOrder  },
+  name: 'OrderStatistics',
+  data() {
+    return {
+      deliveryPayStatusOptions:[],
+      deliveryStatusOptions:[],
+      orderTypeOptions:[],
+      payTypeOptions:[],
+      show:{
+        open:false,
+        title:"订单详情"
+      },
+      statusOptions:[],
+      dateRange: [],
+      pickerOptions: {
+        shortcuts: [{
+          text: '最近一周',
+          onClick(picker) {
+            const end = new Date();
+            const start = new Date();
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
+            picker.$emit('pick', [start, end]);
+          }
+        }, {
+          text: '最近一个月',
+          onClick(picker) {
+            const end = new Date();
+            const start = new Date();
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
+            picker.$emit('pick', [start, end]);
+          }
+        }, {
+          text: '最近三个月',
+          onClick(picker) {
+            const end = new Date();
+            const start = new Date();
+            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
+            picker.$emit('pick', [start, end]);
+          }
+        }]
+      },
+      loading: false,
+      detailLoading: false,
+      statistics: {
+        orderCount: 0,
+        totalAmount: 0,
+        successRate: 0,
+        returnRate: 0
+      },
+      orderDetails: [],
+      detailModalVisible: false,
+      pagination: {
+        currentPage: 1,
+        pageSize: 10,
+        total: 0
+      },
+
+    };
+  },
+  filters: {
+    formatMoney(value) {
+      if (!value) return '0.00';
+      return parseFloat(value).toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
+    }
+  },
+  created() {
+    this.getDicts("store_order_type").then((response) => {
+      this.orderTypeOptions = response.data;
+    });
+    this.getDicts("user_status").then((response) => {
+      this.userStatusOptions = response.data;
+    });
+    this.getDicts("store_pay_type").then((response) => {
+      this.payTypeOptions = response.data;
+    });
+    this.getDicts("store_order_status").then((response) => {
+      this.statusOptions = response.data;
+    });
+    this.getDicts("store_order_delivery_status").then((response) => {
+      this.deliveryStatusOptions = response.data;
+    });
+    this.getDicts("store_delivery_pay_status").then((response) => {
+      this.deliveryPayStatusOptions = response.data;
+    });
+    // 默认查询最近30天数据
+    const end = new Date();
+    const start = new Date();
+    start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
+    this.dateRange = [start, end];
+    this.fetchStatistics();
+  },
+  methods: {
+    handleDetails(row){
+      this.show.open=true;
+      const orderId = row.id ;
+      setTimeout(() => {
+        this.$refs.order.getOrder(orderId);
+      }, 500);
+    },
+    /**
+     * 格式化日期(内置方法,替代外部工具函数)
+     * @param {Date|string} date 日期对象或字符串
+     * @param {string} [fmt='yyyy-MM-dd HH:mm:ss'] 格式字符串
+     * @returns {string} 格式化后的日期字符串
+     */
+    formatDate(date, fmt = 'yyyy-MM-dd HH:mm:ss') {
+      if (!date) return '';
+      if (typeof date === 'string') {
+        date = new Date(date.replace(/-/g, '/'));
+      }
+      if (!(date instanceof Date)) {
+        date = new Date(date);
+      }
+
+      const o = {
+        'M+': date.getMonth() + 1, // 月份
+        'd+': date.getDate(), // 日
+        'H+': date.getHours(), // 小时
+        'm+': date.getMinutes(), // 分
+        's+': date.getSeconds(), // 秒
+        'q+': Math.floor((date.getMonth() + 3) / 3), // 季度
+        'S': date.getMilliseconds() // 毫秒
+      };
+
+      if (/(y+)/.test(fmt)) {
+        fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
+      }
+
+      for (const k in o) {
+        if (new RegExp('(' + k + ')').test(fmt)) {
+          fmt = fmt.replace(
+            RegExp.$1,
+            RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)
+          );
+        }
+      }
+
+      return fmt;
+    },
+
+
+    handleDateChange(val) {
+      this.dateRange = val;
+      this.fetchStatistics();
+    },
+
+    handleSearch() {
+      this.fetchStatistics();
+    },
+
+    async fetchStatistics() {
+      if (!this.dateRange || this.dateRange.length !== 2) {
+        this.$message.warning('请选择日期范围');
+        return;
+      }
+
+      this.loading = true;
+      try {
+        const params = {
+          startTime: this.formatDate(this.dateRange[0], 'yyyy-MM-dd'),
+          endTime: this.formatDate(this.dateRange[1], 'yyyy-MM-dd')
+        };
+        const response = await getOrderStatistics(params);
+        this.statistics = response.data;
+
+      } catch (error) {
+        this.$message.error('获取统计数据失败');
+      } finally {
+        this.loading = false;
+      }
+    },
+
+    async fetchOrderDetails() {
+      if (!this.dateRange || this.dateRange.length !== 2) return;
+
+      this.detailLoading = true;
+      try {
+        const params = {
+          createTimeRange: this.formatDate(this.dateRange[0], 'yyyy-MM-dd')+"--"+this.formatDate(this.dateRange[1], 'yyyy-MM-dd'),
+          pageNum: this.pagination.currentPage,
+          pageSize: this.pagination.pageSize,
+          paid:1
+        };
+        const response = await listStoreOrder(params);
+        this.orderDetails = response.rows;
+        this.pagination.total = response.total;
+        this.detailModalVisible = true;
+      } catch (error) {
+        this.$message.error('获取订单详情失败');
+      } finally {
+        this.detailLoading = false;
+      }
+    },
+
+    handleSizeChange(val) {
+      this.pagination.pageSize = val;
+      this.fetchOrderDetails();
+    },
+
+    handleCurrentChange(val) {
+      this.pagination.currentPage = val;
+      this.fetchOrderDetails();
+    }
+  }
+};
+</script>
+
+<style scoped>
+.order-statistics-container {
+  padding: 20px;
+}
+
+.search-card {
+  margin-bottom: 20px;
+}
+
+.search-header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
+
+.title {
+  font-size: 18px;
+  font-weight: bold;
+}
+
+.statistics-row {
+  margin-bottom: 20px;
+}
+
+.statistic-item {
+  padding: 10px;
+}
+
+.statistic-title {
+  font-size: 14px;
+  color: #999;
+  margin-bottom: 10px;
+}
+
+.statistic-value {
+  font-size: 24px;
+  font-weight: bold;
+  margin-bottom: 10px;
+}
+
+
+.statistic-compare .up {
+  color: #f56c6c;
+  margin-left: 5px;
+}
+
+.statistic-compare .down {
+  color: #67c23a;
+  margin-left: 5px;
+}
+.clean-dialog {
+  border-radius: 8px;
+}
+.clean-table .el-table__header th {
+  background-color: #f8f8f9;
+}
+.compact-cell {
+  padding: 4px 0;
+  line-height: 1.4;
+}
+.secondary-text {
+  color: #909399;
+  font-size: 0.9em;
+}
+</style>

+ 1 - 1
src/views/user/transfer/index.vue

@@ -182,7 +182,7 @@
           </el-radio-group>
         </el-form-item>
         <el-form-item label="审批意见" prop="approvalRemark">
-          <el-input v-model="form.approvalRemark" type="textarea" placeholder="请输入内容"  disabled="disabled"/>
+          <el-input v-model="form.approvalRemark" type="textarea" placeholder="请输入审批意见" :disabled="viewMode"/>
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">