Ritchie 1 год назад
Родитель
Сommit
0595e3bbda

+ 6 - 0
src/assets/language/en.json

@@ -706,6 +706,12 @@
     "numberOfOrders": "Order quantity",
     "salesAmount": "Sales amount",
     "commonTools": "Common tools",
+    "coins": "Coins",
+    "bills": "PaperMoney",
+    "coinsBills": "Cash",
+    "creditCard": "CreditCard",
+    "electronicPayment": "PayOnline",
+    "migrationInstructions": "Common Tools have been moved to the Personal Center",
     "machineSales": "Machine sales",
     "deviceManagement": "Machine management",
     "discountCode": "discountCode",

+ 8 - 2
src/assets/language/ja.json

@@ -298,7 +298,7 @@
         "to": "に",
         "attention": "(注意:桁数が正しくない場合、更新によりマシンに異常が発生する可能性があります)",
         "submitUpdates": "更新を提出",
-        "nameLength":"装置名は25文字以内です",
+        "nameLength": "装置名は25文字以内です",
         "modificationSucceeded": "変更に成功",
         "existsFailed": "デバイス名はすでに存在します",
         "editFailed": "変更に失敗",
@@ -653,7 +653,7 @@
         "days": "日",
         "type": "タイプ",
         "deductionRoll": "クーポン",
-        "discount2": "割引",     
+        "discount2": "割引",
         "deductionPriceLabdel": "控除価格",
         "deductionPricePlaceholder": "控除価格を入力してください",
         "enterNumber": "数字を入力",
@@ -707,6 +707,12 @@
         "numberOfOrders": "注文数",
         "salesAmount": "売上高",
         "commonTools": "一般ツール",
+        "coins": "コイン",
+        "bills": "紙幣",
+        "coinsBills": "現金",
+        "creditCard": "クレジットカード",
+        "electronicPayment": "オンライン支払い",
+        "migrationInstructions": "【常用ツール】は【個人センター】に移動しました。",
         "machineSales": "機械販売",
         "deviceManagement": "装置管理",
         "discountCode": "割引コード",

+ 6 - 0
src/assets/language/zh.json

@@ -707,6 +707,12 @@
     "numberOfOrders": "订单数",
     "salesAmount": "销售额",
     "commonTools": "常用工具",
+    "coins": "硬币",
+    "bills": "纸币",
+    "coinsBills": "现金",
+    "creditCard": "信用卡",
+    "electronicPayment": "电子支付",
+    "migrationInstructions": "【常用工具】已迁移至【个人中心】",
     "machineSales": "机器销售额",
     "deviceManagement": "设备管理",
     "discountCode": "优惠码",

+ 4 - 0
src/service/home.js

@@ -28,4 +28,8 @@ export function Api_postMachineNum(params) {
 // 查询是否有设备报警
 export function getIsAlarm(params) {
     return axios.get(`/SZWL-SERVER/tAlarmRecord/isAlarm?${stringToUrl(params)}`);
+}
+// 查询设备销售情况
+export function Api_getEquipmentPageStatistics(params) {
+    return axios.post(`/ORDER-SERVER/tOrder/getEquipmentPageStatistics?${stringToUrl(params)}`, params)
 }

+ 28 - 0
src/styles/home/index.less

@@ -1,5 +1,6 @@
 .homePage {
   width: 100%;
+
   .homeBox {
     height: 100%;
     width: 100%;
@@ -379,6 +380,33 @@
       }
     }
 
+    .machineSaleBox {
+      background-color: #e7e7e7;
+      border-radius: 15px;
+      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 阴影效果 */
+      padding: 5px 5px;
+
+      .contentWord {
+        padding: 10px 10px;
+        color: rgba(64, 77, 116, 1);
+        font-size: 13px;
+        text-align: left;
+        flex-wrap: wrap; 
+        line-height: 13px;
+        display: flex;
+        align-items: center;
+      }
+
+      .layer5 {
+        padding: 5px 10px;
+        .word5 {
+          color: rgba(64, 77, 116, 1);
+          font-size: 0.375rem;
+        }
+      }
+
+    }
+
     .outer11 {
       width: 90%;
       flex-wrap: wrap;

+ 14 - 0
src/views/device/index.vue

@@ -175,6 +175,20 @@
                     <a class="clickable-link" @click="viewPosiClk(item)">{{ item.fullName }}</a>
                   </span>
 
+                  <!-- 机器参数 -->
+                  <!-- <van-row class="layer5 kBordBott" justify="space-between"
+                    v-if="(item.machineType == '0' || item.machineType == null) && item.equimentType != 'P30'">
+                    <van-col class="word5" style="">{{ $t("device.furnaceHeadTemperature") }}:{{
+        item.furnaceTm
+      }}{{ $t("device.degree") }}</van-col>
+                    <van-col class="word5" style="">{{ $t("device.temperatureInCabinet") }}:{{
+        item.cabinetTm
+      }}{{ $t("device.degree") }}</van-col>
+                    <van-col class="word5" style="">{{ $t("device.humidityInCabinet") }}:{{
+        item.cabinetHd
+      }}{{ $t("device.humidity") }}</van-col>
+                  </van-row> -->
+
 
                   <van-row class="layer5 kBordBott" justify="space-between" v-if="item.machineType == '1'">
                     <van-col class="word5" style="">{{ $t("device.cornGeneratorTemperature") }}:{{

+ 141 - 10
src/views/home/index.vue

@@ -82,19 +82,57 @@
       </div>
       <kNoData v-else></kNoData>
       <!-- </div> -->
-      <!-- 机器销售额 -->
-      <div class="outer9 flex-col justify-center">
-        <div class="main24 flex-col justify-between">
-          <div class="ImageText10 flex-col">
-            <div class="wrap2 flex-row justify-between">
-              <div class="outer10 flex-col"></div>
-              <div class="TextGroup13 flex-col">
-                <span class="txt13">{{ $t("home.machineSales") }}</span>
+
+      <div v-if="user.ifForeign === '1'">
+        <!-- 机器销售额 -->
+        <div class="outer9 flex-col justify-center">
+          <div class="main24 flex-col justify-between">
+            <div class="ImageText10 flex-col">
+              <div class="wrap2 flex-row justify-between">
+                <div class="outer10 flex-col"></div>
+                <div class="TextGroup13 flex-col">
+                  <span class="txt13">{{ $t("home.machineSales") }}</span>
+                </div>
               </div>
             </div>
           </div>
         </div>
+        <!-- 各支付方式总额 -->
+        <van-list offset="100" :immediate-check="false">
+          <div v-for="item in combinedList" :key="item" class="o-pb-20">
+            <div>
+              <van-cell-group inset class="machineSaleBox">
+                <!-- 设备名称 -->
+                <div class="contentWord kBordBott">{{ item.machineName }}
+                </div>
+                <!-- <van-row class="layer5" justify="space-between">
+            <van-col span="12">总销售额: {{ item.totalSales }}</van-col>
+            <van-col span="12">总现金: {{ item.totalCash }}</van-col>
+          </van-row> -->
+                <van-row class="layer5" justify="space-between">
+                  <!-- 硬币 -->
+                  <van-col span="8">{{ $t("home.coins") }}: {{ item.coins }}</van-col>
+                  <!-- 纸币 -->
+                  <van-col span="8">{{ $t("home.bills") }}: {{ item.bills }}</van-col>
+                  <!-- 硬币+纸币 -->
+                  <van-col span="8">{{ $t("home.coinsBills") }}: {{ item.coinsBills }}</van-col>
+                  <!-- 信用卡 -->
+                  <van-col span="8">{{ $t("home.creditCard") }}: {{ item.creditCard }}</van-col>
+                  <!-- 电子支付 -->
+                  <van-col span="8">{{ $t("home.electronicPayment") }}: {{ item.electronicPayment }}</van-col>
+                </van-row>
+              </van-cell-group>
+            </div>
+          </div>
+        </van-list>
       </div>
+      <div v-else style="text-align: center;">
+        <div><br><br></div>
+        {{ $t("home.migrationInstructions") }}
+        
+      </div>
+
+
 
     </div>
     <!-- 通知弹窗 -->
@@ -146,7 +184,6 @@ import kNoData from "../../components/commom/kNoData/index.vue";
 import kDialog from "../../components/commom/kDialog/index.vue";
 import { onMounted, ref, nextTick } from "vue";
 import sHeader from "../../components/SimpleHeader";
-// import navBar from "../../components/NavBar";
 import dateSelectList from "../../components/dateSelectList";
 import typeSelectList from "../../components/typeSelectList";
 import { getLoginUser, $M_Menus, Format_time, styleUrl } from "../../common/js/utils";
@@ -157,10 +194,11 @@ import {
   Api_postMachineNum,
   Api_getUpdateNotice,
   getIsAlarm,
+  Api_getEquipmentPageStatistics,
 } from "../../service/home";
 import dateUtil from "../../utils/dateUtil";
 import { useI18n } from "vue-i18n";
-import { showToast } from "vant";
+import { showFailToast, showToast } from "vant";
 import RobotIcon from '@/assets/home/robot.png';
 import { getLocal, setLocal, navigatorLanguage } from "@/common/js/utils";
 
@@ -243,11 +281,13 @@ export default {
     const update = (uDate) => {
       dateSelect.value = uDate;
       getStatisticsFun();
+      getMachineNameListFunc()
     };
     let typeSelectData = {};
     const upselectdata = (uSData) => {
       typeSelectData = uSData;
       getStatisticsFun();
+      getMachineNameListFunc()
     };
     const salesVolume = ref(0);
     const salesNumber = ref(0);
@@ -461,8 +501,89 @@ export default {
       }
 
       getTitleFunc();
+
+      if (user) {
+        getMachineNameListFunc();
+      }
+
     });
 
+    const finished = ref(false);
+    const loading = ref(true);
+
+
+    // 设备销售数据 
+    const combinedList = ref([]); // 设备销额集合
+
+
+    const getMachineNameListFunc = async () => {
+
+      combinedList.value = [];
+      const searchParams = {
+        adminId: user.id,
+        ...dateSelect.value,
+      }
+      try {
+        const { data } = await Api_getEquipmentPageStatistics(Object.assign({}, searchParams));
+        if (data.code === "00000" && data.data) {
+
+          for (let i = 0; i < data.data.categories.length; i++) {
+            const machineNameVal = data.data.categories[i];  // 设备名称
+            const coinsVal = data.data.series[0].data[i];  // 硬币销额
+            const billsVal = data.data.series[1].data[i];  // 纸币销额
+            const coinsBillsVal = data.data.series[2].data[i];  // 硬币+纸币销额
+            const creditCardVal = data.data.series[3].data[i];  // 信用卡销额
+            const electronicPaymentVal = data.data.series[4].data[i];  // 电子支付销额
+
+
+            const machineSalesData = {
+              // totalSales: totalSalesVal,
+              // totalCash: totalCashVal,
+              machineName: machineNameVal,
+              coins: coinsVal,
+              bills: billsVal,
+              coinsBills: coinsBillsVal,
+              creditCard: creditCardVal,
+              electronicPayment: electronicPaymentVal
+            }
+
+            combinedList.value.push(machineSalesData);
+          }
+
+
+          // data.data.categories.forEach((item) => {
+          //   machineName.value = item.value
+          // })
+          // coins.value = 0;
+          // bills.value = 0;
+          // coinsBills.value = 0;
+          // creditCard.value = 0;
+          // electronicPayment.value = 0;
+          // data.data.series[0].data.forEach((item) => {
+          //   coins.value = parseInt(coins.value + item);
+          // });
+          // console.log("coins.value >>>", coins.value);
+          // data.data.series[1].data.forEach((item) => {
+          //   bills.value = parseInt(bills.value + item);
+          // });
+          // data.data.series[2].data.forEach((item) => {
+          //   coinsBills.value = parseInt(coinsBills.value + item);
+          // });
+          // data.data.series[3].data.forEach((item) => {
+          //   creditCard.value = parseInt(creditCard.value + item);
+          // });
+          // data.data.series[4].data.forEach((item) => {
+          //   electronicPayment.value = parseInt(electronicPayment.value + item);
+          // });
+
+        } else {
+          showFailToast(data.message);
+        }
+      } catch (error) {
+        console.error("Error", error)
+      }
+    }
+
     const getTitleFunc = async () => {
       const currentDomain = window.location.href;
       // const currentDomain = window.location.hostname;
@@ -686,6 +807,7 @@ export default {
     // };
 
     return {
+      user,
       userName,
       update,
       upselectdata,
@@ -724,6 +846,15 @@ export default {
       offset,
       isShowRobot,
       sysTitle,
+      finished,
+      loading,
+      // machineName,
+      // coins,
+      // bills,
+      // coinsBills,
+      // creditCard,
+      // electronicPayment,
+      combinedList
     };
   },