Просмотр исходного кода

订单中心添加默认时间筛选

xiaoxin 1 год назад
Родитель
Сommit
ab26fed98f
4 измененных файлов с 130 добавлено и 100 удалено
  1. 40 33
      config/index.js
  2. 2 2
      src/utils/httpRequest.js
  3. 12 0
      src/utils/lastSevenDays.js
  4. 76 65
      src/views/mission/mission.vue

+ 40 - 33
config/index.js

@@ -1,40 +1,47 @@
-'use strict'
+"use strict";
 // Template version: 1.2.5
 // see http://vuejs-templates.github.io/webpack for documentation.
 
-const path = require('path')
-const devEnv = require('./dev.env')
+const path = require("path");
+const devEnv = require("./dev.env");
 
 module.exports = {
   configureWebpack: {
     module: {
-      rules: [{
-        test: /\.mjs$/,
-        include: /node_modules/,
-        type: 'javascript/auto'
-      }]
+      rules: [
+        {
+          test: /\.mjs$/,
+          include: /node_modules/,
+          type: "javascript/auto"
+        }
+      ]
     }
   },
   dev: {
-
     // Paths
-    assetsSubDirectory: 'static',
-    assetsPublicPath: '/',
+    assetsSubDirectory: "static",
+    // assetsPublicPath: "/wm-test/", // 测试
+    assetsPublicPath: "/wm-admin/", // 线上
+    // assetsPublicPath: "/",  // 开发
+
     // 代理列表, 是否开启代理通过[./dev.env.js]配置
-    proxyTable: devEnv.OPEN_PROXY === false ? {} : {
-      '/proxyApi': {
-        // target: 'https://mxys.chuanghai-tech.com/sqx_fast/', // 线上
-        target: 'https://mxys.chuanghai-tech.com/wm-test/wm-api',// 测试
-        // target: 'http://iyfpk3.natappfree.cc/sqx_fast',// 开发
-        changeOrigin: true,
-        pathRewrite: {
-          '^/proxyApi': ''
-        }
-      },
-    },
+    proxyTable:
+      devEnv.OPEN_PROXY === false
+        ? {}
+        : {
+            "/proxyApi": {
+              target: "https://mxys.chuanghai-tech.com/sqx_fast/", // 线上
+              // target: "https://mxys.chuanghai-tech.com/wm-test/wm-api", // 测试
+              // target: 'http://iyfpk3.natappfree.cc/sqx_fast',// 开发
+              changeOrigin: true,
+              pathRewrite: {
+                "^/proxyApi": ""
+              }
+            }
+          },
 
     // Various Dev Server settings
-    host: '127.0.0.1', // can be overwritten by process.env.HOST
+    host: "127.0.0.1", // can be overwritten by process.env.HOST
     port: 8001, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
     autoOpenBrowser: true,
     errorOverlay: true,
@@ -54,7 +61,7 @@ module.exports = {
      */
 
     // https://webpack.js.org/configuration/devtool/#development
-    devtool: 'eval-source-map',
+    devtool: "eval-source-map",
 
     // If you have problems debugging vue-files in devtools,
     // set this to false - it *may* help
@@ -66,32 +73,32 @@ module.exports = {
     // (https://github.com/webpack/css-loader#sourcemaps)
     // In our experience, they generally work as expected,
     // just be aware of this issue when enabling this option.
-    cssSourceMap: false,
+    cssSourceMap: false
   },
 
   build: {
     // Template for index.html
-    index: path.resolve(__dirname, '../dist/index.html'),
+    index: path.resolve(__dirname, "../dist/index.html"),
 
     // Paths
-    assetsRoot: path.resolve(__dirname, '../dist'),
-    assetsSubDirectory: 'static',
-    assetsPublicPath: '/wm-admin',
+    assetsRoot: path.resolve(__dirname, "../dist"),
+    assetsSubDirectory: "static",
+    assetsPublicPath: "/wm-admin",
 
     /**
      * Source Maps
      */
 
-    productionSourceMap: false,//隐藏源码
+    productionSourceMap: false, //隐藏源码
     // https://webpack.js.org/configuration/devtool/#production
-    devtool: '#source-map',
+    devtool: "#source-map",
 
     // Gzip off by default as many popular static hosts such as
     // Surge or Netlify already gzip all static assets for you.
     // Before setting to `true`, make sure to:
     // npm install --save-dev compression-webpack-plugin
     productionGzip: false,
-    productionGzipExtensions: ['js', 'css'],
+    productionGzipExtensions: ["js", "css"],
 
     // Run the build command with an extra argument to
     // View the bundle analyzer report after build finishes:
@@ -99,4 +106,4 @@ module.exports = {
     // Set to `true` or `false` to always turn it on or off
     bundleAnalyzerReport: process.env.npm_config_report
   }
-}
+};

+ 2 - 2
src/utils/httpRequest.js

@@ -71,8 +71,8 @@ http.adornUrl = actionName => {
   // return 'http://iyfpk3.natappfree.cc/sqx_fast/' + actionName; // 开发
   // return 'https://www.daweilinli.com/sqx_fast/' + actionName
   // return 'http://192.168.0.131:8171/sqx_fast/' + actionName
-  // return 'https://mxys.chuanghai-tech.com/sqx_fast/' + actionName; //  线上
-  return "https://mxys.chuanghai-tech.com/wm-test/wm-api/sqx_fast/" + actionName;// 测试
+  return "https://mxys.chuanghai-tech.com/sqx_fast/" + actionName; //  线上
+  // return "https://mxys.chuanghai-tech.com/wm-test/wm-api/sqx_fast/" + actionName;// 测试
 };
 
 http.adornUrl2 = actionName => {

+ 12 - 0
src/utils/lastSevenDays.js

@@ -0,0 +1,12 @@
+export function getLastSevenDays() {
+  const days = [];
+  for (let i = 6; i >= 0; i--) {
+    const date = new Date();
+    date.setDate(date.getDate() - i); // 从今天往前推 i 天
+    const year = date.getFullYear();
+    const month = String(date.getMonth() + 1).padStart(2, "0"); // 月份补零
+    const day = String(date.getDate()).padStart(2, "0"); // 日期补零
+    days.push(`${year}-${month}-${day}`);
+  }
+  return days;
+}

+ 76 - 65
src/views/mission/mission.vue

@@ -97,39 +97,31 @@
         <div style="position: relative;display: inline-block;margin: 3px;">
           <span>商铺类型:</span>
           <el-select
-              v-model="spEarningTypeId"
-              style="width:200px;"
-              @change="phoneSelect"
-              :clearable="true"
+            v-model="spEarningTypeId"
+            style="width:200px;"
+            @change="phoneSelect"
+            :clearable="true"
+          >
+            <el-option
+              v-for="item in spEarnings"
+              :key="item.id"
+              :label="item.shopTypeName"
+              :value="item.id"
             >
-              <el-option
-                v-for="item in spEarnings"
-                :key="item.id"
-                :label="item.shopTypeName"
-                :value="item.id"
-              >
-              </el-option> </el-select
-            >&nbsp;&nbsp;&nbsp;
+            </el-option> </el-select
+          >&nbsp;&nbsp;&nbsp;
         </div>
         <div style="position: relative;display: inline-block;margin: 3px;">
           <span>优惠券类型:</span>
           <el-select
-              v-model="couponType"
-              style="width:200px;"
-              @change="phoneSelect"
-              :clearable="true"
-            >
-              <el-option
-                label="平台"
-                :value="0"
-              >
-              </el-option>
-              <el-option
-                label="商家"
-                :value="1"
-              >
-              </el-option>
-          </el-select>&nbsp;&nbsp;&nbsp;
+            v-model="couponType"
+            style="width:200px;"
+            @change="phoneSelect"
+            :clearable="true"
+          >
+            <el-option label="平台" :value="0"> </el-option>
+            <el-option label="商家" :value="1"> </el-option> </el-select
+          >&nbsp;&nbsp;&nbsp;
         </div>
         <div style="position: relative;display: inline-block;margin: 3px;">
           <span>手机号:</span>
@@ -373,10 +365,7 @@
           label="骑手所在站点"
           width="200"
         ></el-table-column>
-        <el-table-column
-          prop="orderSequence"
-          label="序号"
-        ></el-table-column>
+        <el-table-column prop="orderSequence" label="序号"></el-table-column>
         <el-table-column
           prop="transactionId"
           label="商户单号"
@@ -527,7 +516,9 @@
           width="80"
         >
           <template slot-scope="scope">
-            <span v-if="scope.row.isPrint === 0 || scope.row.isPrint === ''">未打印</span>
+            <span v-if="scope.row.isPrint === 0 || scope.row.isPrint === ''"
+              >未打印</span
+            >
             <span v-if="scope.row.isPrint === 1">已打印</span>
           </template>
         </el-table-column>
@@ -590,7 +581,8 @@
               v-if="scope.row.status === 6"
               :disabled="!isAuth('mission:qucan')"
               @click="wancheng(scope.row)"
-            >制作已完成</el-button>
+              >制作已完成</el-button
+            >
             <el-button
               size="mini"
               type="danger"
@@ -598,11 +590,12 @@
               style="margin: 10px;"
               v-if="
                 scope.row.status === 3 ||
-                scope.row.status === 6 ||
-                scope.row.status === 7
+                  scope.row.status === 6 ||
+                  scope.row.status === 7
               "
               @click="tuikuan(scope.row)"
-            >退款</el-button>
+              >退款</el-button
+            >
             <el-button
               size="mini"
               type="primary"
@@ -610,38 +603,41 @@
               :disabled="!isAuth('mission:qucan')"
               @click="wancheng(scope.row)"
               style="margin: 5px 0;"
-            >{{ scope.row.orderType == 1 ? "餐品已完成" : "餐品已完成" }}
+              >{{ scope.row.orderType == 1 ? "餐品已完成" : "餐品已完成" }}
             </el-button>
             <el-button
               size="mini"
               type="primary"
               v-if="
                 scope.row.status == 3 ||
-                scope.row.status === 4 ||
-                scope.row.status === 6
+                  scope.row.status === 4 ||
+                  scope.row.status === 6
               "
               :disabled="!isAuth('mission:qucan')"
               @click="dayin(scope.row)"
               style="margin: 3px;"
-            >打印小票</el-button>
+              >打印小票</el-button
+            >
             <el-button
               size="mini"
               type="primary"
               v-if="
                 scope.row.status == 3 ||
-                scope.row.status === 4 ||
-                scope.row.status === 6
+                  scope.row.status === 4 ||
+                  scope.row.status === 6
               "
               :disabled="!isAuth('mission:mingxi')"
               @click="detailClick(scope.row)"
               style="margin: 3px;"
-            >打印小票明细</el-button>
+              >打印小票明细</el-button
+            >
             <el-button
               size="mini"
               type="primary"
               @click="complainDetails(scope.row)"
               style="margin: 3px;"
-            >聊天内容</el-button>
+              >聊天内容</el-button
+            >
             <el-button
               size="mini"
               type="primary"
@@ -649,7 +645,8 @@
               :disabled="!isAuth('orderCenterRun:zhuandan')"
               @click="zhuandan(scope.row)"
               style="margin: 3px;"
-            >转单</el-button>
+              >转单</el-button
+            >
           </template>
         </el-table-column>
       </el-table>
@@ -1048,15 +1045,16 @@
 </template>
 
 <script>
+import { getLastSevenDays } from "@/utils/lastSevenDays.js";
 export default {
   data() {
     return {
       dialogVisible: false,
       stationData: [], // 骑手站点数据
       stationName: "",
-      spEarnings:[],// 商铺类型数据
-      couponType:'',// 优惠券类型
-      spEarningTypeId:"",
+      spEarnings: [], // 商铺类型数据
+      couponType: "", // 优惠券类型
+      spEarningTypeId: "",
       imageUrl: [],
       limit: 10,
       page: 1,
@@ -1064,7 +1062,7 @@ export default {
       phone: "",
       userName: "",
       orderNumber: "",
-      transactionId:"",// 商户单号
+      transactionId: "", // 商户单号
       status: "",
       describes: "",
       token: "",
@@ -1246,7 +1244,7 @@ export default {
 
       tableData: [],
       tableData2: {},
-      shopMoney:'',// 店铺总交易
+      shopMoney: "", // 店铺总交易
       form: {
         id: "",
         classifyName: "",
@@ -1323,7 +1321,7 @@ export default {
         this.stationData = data.data;
       });
     },
-    shopTypeList(){
+    shopTypeList() {
       this.$http({
         url: this.$http.adornUrl("admin/shoptype/selectShopTypeList"),
         method: "get",
@@ -1332,7 +1330,7 @@ export default {
           limit: 1000
         })
       }).then(({ data }) => {
-        console.log(data,'商铺类型');
+        console.log(data, "商铺类型");
 
         let returnData = data.data.list;
         this.spEarnings = returnData;
@@ -1681,7 +1679,7 @@ export default {
       this.riderPhone = "";
       this.userName = "";
       this.orderNumber = "";
-      this.transactionId=""
+      this.transactionId = "";
       this.status = "";
       this.shopName = "";
       this.reservationFlag = "";
@@ -1691,9 +1689,9 @@ export default {
       this.endTime = "";
       this.payStartTime = "";
       this.payEndTime = "";
-      this.stationName=""
-      this.spEarningTypeId=""
-      this.couponType=""
+      this.stationName = "";
+      this.spEarningTypeId = "";
+      this.couponType = "";
       this.taskdataSelect();
     },
     // 查询
@@ -1740,6 +1738,7 @@ export default {
     taskdataSelect() {
       this.totalMoney = 0;
       this.tableDataLoading = true;
+
       this.$http({
         url: this.$http.adornUrl("admin/order/selectAllOrderAdmin"),
         method: "get",
@@ -1749,7 +1748,7 @@ export default {
           phone: this.phone,
           userName: this.userName,
           orderNumber: this.orderNumber,
-          transactionId:this.transactionId,
+          transactionId: this.transactionId,
           status: this.status,
           shopName: this.shopName,
           orderType: this.orderType,
@@ -1761,8 +1760,8 @@ export default {
           payStartTime: this.payStartTime,
           payEndTime: this.payEndTime,
           riderStationId: this.stationName,
-          shopTypeId:this.spEarningTypeId,
-          couponType:this.couponType
+          shopTypeId: this.spEarningTypeId,
+          couponType: this.couponType
         })
       }).then(({ data }) => {
         console.log(data, "订单中心");
@@ -1770,6 +1769,14 @@ export default {
         this.tableDataLoading = false;
         let returnData = data.data;
         this.tableData2 = returnData;
+        if (this.tableData2.list.length == 0) {
+          this.$message({
+            message: `${this.payStartTime}--${this.payEndTime} 支付时间段暂无数据`,
+            type: "warning",
+            duration: 2500
+          });
+        }
+
         console.log(this.tableData2, "hhhhh");
         for (var i in this.tableData2.list) {
           this.tableData2.list[i].goodsPriceZ = 0;
@@ -1916,7 +1923,7 @@ export default {
         method: "post",
         params: this.$http.adornParams({
           orderId: row.orderId,
-          isAppend: 1,// 1 默认补打
+          isAppend: 1 // 1 默认补打
         })
       }).then(({ data }) => {
         if (data.code == 0) {
@@ -2190,7 +2197,7 @@ export default {
             phone: this.phone,
             userName: this.userName,
             orderNumber: this.orderNumber,
-            transactionId:this.transactionId,
+            transactionId: this.transactionId,
             status: this.status,
             shopName: this.shopName,
             orderSequence: this.orderSequence,
@@ -2203,8 +2210,8 @@ export default {
             payStartTime: this.payStartTime,
             payEndTime: this.payEndTime,
             riderStationId: this.stationName,
-            shopTypeId:this.spEarningTypeId,
-            couponType:this.couponType
+            shopTypeId: this.spEarningTypeId,
+            couponType: this.couponType
           })
         }).then(({ data }) => {
           console.log(data, "导出");
@@ -2237,10 +2244,14 @@ export default {
   },
 
   mounted() {
+    let data = getLastSevenDays();
+    this.payStartTime = data[0];
+    this.payEndTime = data[6];
+
     // this.classifySelect()
     this.taskdataSelect();
     this.stationList();
-    this.shopTypeList()
+    this.shopTypeList();
   }
 };
 </script>