Ver Fonte

feat: "logo定制"
fix: "订单数据首页刷新时间"

ritchie há 2 anos atrás
pai
commit
d21128f997

BIN
src/assets/device/operIcon/customLogo.png


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

@@ -431,6 +431,14 @@
       "batchPricePlace": "Please enter the batch price",
       "modifySubmit": "Modification submission"
     },
+    "customLogo": {
+      "customLogo": "Custom Logo",
+      "logoLabel": "modify logo",
+      "logoPlaceholder": "Please enter the logo number",
+      "logoRequired": "Please enter the correct numeric number",
+      "registerButton": "Commit",
+      "customLogoSucceed": "Custom logo success"
+    },
     "deleteDevice": "Delete Device",
     "noPosition": "No positioning",
     "equipLocation": "Equipment location",

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

@@ -435,6 +435,15 @@
 		"title":"商品显示设置",
 		"equipmentName":"设备名称"
 	},
+    "customLogo": {
+      "customLogo": "自定义Logo",
+      "logoLabel": "修改Logo",
+      "logoPlaceholder": "请输入logo的编号",
+      "logoRequired": "请输入正确的数字编号",
+      "registerButton": "提交",
+      "customLogoSucceed": "定制logo成功"
+    },
+
 	"deleteDevice":"删除设备",
     "noPosition":"暂无定位",
     "equipLocation":"设备位置",

+ 6 - 6
src/router/index.js

@@ -107,18 +107,18 @@ const router = createRouter({
     { path: '/labelManAdd', name: 'labelManAdd', component: () => import('@/views/labelMan/add'), meta: { index: 1 } },
     // 修改价格
     { path: '/modifyPrice', name: 'modifyPrice', component: () => import('@/views/device/modifyPrice/index'), meta: { index: 1 } },
-	  // 屏蔽/展示商品
-	  { path: '/showGoods', name: 'showGoods', component: () => import('@/views/device/showGoods/index'), meta: { index: 1 } },
+    // 屏蔽/展示商品
+    { path: '/showGoods', name: 'showGoods', component: () => import('@/views/device/showGoods/index'), meta: { index: 1 } },
     // 查看定位
     { path: '/viewPosition', name: 'viewPosition', component: () => import('@/views/device/viewPosition/index'), meta: { index: 1 } },  
     // 设备编辑-编辑规则
     { path: '/editAdRule', name: 'editAdRule', component: () => import('@/views/device/editAdRule/index'), meta: { index: 1 } },
     // 跳转空中云汇
-	  { path: '/hpp', name: 'Hpp', component: () => import('@/views/Hpp.vue'), meta: { index: 1, noLogin: true } },
+    { path: '/hpp', name: 'Hpp', component: () => import('@/views/Hpp.vue'), meta: { index: 1, noLogin: true } },
     // 定制logo
-	  { path: '/customLogo', name: 'customLogo', component: () => import('@/views/customeLogo/index'), meta: { index: 1 } },
-    // 日志管理
-    { path: '/logMan', name: 'logMan', component: () => import('@/views/logMan/index'), meta: { index: 1 } },
+    { path: '/customLogo', name: 'customLogo', component: () => import('@/views/device/customLogo.vue'), meta: { index: 1} },
+    // TODO:日志管理
+    // { path: '/logMan', name: 'logMan', component: () => import('@/views/logMan/index'), meta: { index: 1 } },
     // apk管理,广告管理,订单导出 不是所有的帐号能看到
   ]
 });

+ 4 - 0
src/service/device/index.js

@@ -126,3 +126,7 @@ export function delOneDevice(params) {
 export function updateProductsShow(params) {
   return axios.post(`/SZWL-SERVER/tProduct/updateProductsShow`, params)
 }
+// 定制Logo
+export function customLogo(params) {
+  return axios.post(`/SZWL-SERVER/tLogo/customLogo?${stringToUrl(params)}`, params)
+}

+ 188 - 0
src/views/device/customLogo.vue

@@ -0,0 +1,188 @@
+<template>
+<!--  修改logo  -->
+  <div class="page flex-col">
+    <s-header :name="$t('device.customLogo.customLogo')" :noback="false"></s-header>
+
+    <div class="wrap1 flex-col">
+      <van-field v-model="logoNumber"
+                 type="digit"
+                 :label="$t('device.customLogo.logoLabel')"
+                 :placeholder="$t('device.customLogo.logoPlaceholder')"
+                 :rules="[{ required: true, message: $t('device.customLogo.logoRequired') }]"
+      ></van-field>
+
+      <van-button round
+                  :disabled="logoNumber === ''"
+                  type="primary"
+                  class="volumeChangeButton"
+                  @click="submitChange">{{ $t('device.customLogo.registerButton') }}</van-button>
+    </div>
+
+  </div>
+</template>
+
+<script>
+import {defineComponent, onMounted, ref} from 'vue';
+import sHeader from "@/components/SimpleHeader.vue";
+import {customLogo, getDeviceDetal} from "@/service/device";
+import {Toast} from "vant";
+import {useRoute} from "vue-router";
+import {useI18n} from "vue-i18n";
+
+export default defineComponent({
+  setup() {
+    const { t } = useI18n();
+    const route = useRoute();
+    const logoNumber = ref('');
+    const deviceId = route.query.deviceId;
+    const deviceDetail = ref(null);
+
+
+    // 初始化页面获取列表
+    onMounted(async () => {
+      await getDeviceDetailFun();
+    });
+
+    const getDeviceDetailFun = async () => {
+      const { data } = await getDeviceDetal({id : deviceId});
+      if (data.code === '00000') {
+        deviceDetail.value = data.data;
+        // volume.value = data.data.volume ? data.data.volume : 0;
+      } else { Toast.fail(data.message); }
+    }
+
+    const submitChange = async ()=> {
+      console.log('提交:${logoNumber.value}');
+      // TODO: 提交逻辑 done
+      // if (deviceId.value === "") {
+      //   Toast.fail(t('device.'))
+      // }
+      const { data } = await customLogo({
+        id: deviceId,
+        // adminId:
+      })
+      if (data.code === '00000') {
+        Toast.success(t('device.modificationSucceeded'));
+      } else {
+        Toast.fail(data.message);
+      }
+      console.log('submitChange', {equipmentId: deviceId});
+
+    }
+
+    return {
+      deviceDetail,
+      logoNumber,
+      submitChange,
+    }
+  },
+  components: { sHeader },
+
+});
+</script>
+
+<style lang="less" scoped>
+@import "../../common/style/common";
+.page {
+  background-color: rgba(255, 255, 255, 1);
+  position: relative;
+  width: 100%;
+  height: calc(100vh - 44px);
+  overflow: hidden;
+  .van-slider {
+    width: 92%;
+    height: 4px;
+    margin: 0 auto;
+    margin-top: 35px;
+    background-color: #dfdfe5;
+    .van-slider__bar {
+      background-color: rgba(77, 193, 147, 1);
+    }
+    .van-slider__button {
+      background-color: rgba(77, 193, 147, 1);
+      width: 16px;
+      height: 16px;
+    }
+  }
+  .volumeChangeButton {
+    background-color: #4d6add;
+    width: 220px;
+    height: 34px;
+    margin: 49px auto;
+    .van-button__text { font-size: 15px; }
+  }
+  .wrap1 {
+    width: 100%;
+    height: 274px;
+    .box2 {
+      background-color: rgba(255, 255, 255, 1);
+      z-index: 23;
+      height: 54px;
+      margin-top: 1px;
+      width: 100%;
+      position: relative;
+      .section3 {
+        width: 162px;
+        height: 20px;
+        margin: 17px 0 0 15px;
+        .box3 {
+          background-color: rgba(128, 150, 236, 1);
+          border-radius: 2px;
+          width: 4px;
+          height: 12px;
+          margin-top: 4px;
+        }
+        .info1 {
+          width: 150px;
+          height: 20px;
+          overflow-wrap: break-word;
+          color: rgba(64, 77, 116, 1);
+          font-size: 14px;
+          font-family: PingFangSC-Medium;
+          text-align: left;
+          white-space: nowrap;
+          line-height: 20px;
+          display: block;
+        }
+      }
+      .img1 {
+        z-index: 31;
+        position: absolute;
+        left: 0;
+        top: 53px;
+        width: 100%;
+        height: 2px;
+      }
+    }
+    .box4 {
+      width: 147px;
+      height: 14px;
+      margin: 19px 0 0 15px;
+      .word3 {
+        width: 104px;
+        height: 13px;
+        overflow-wrap: break-word;
+        color: rgba(64, 77, 116, 1);
+        font-size: 13px;
+        text-align: left;
+        white-space: nowrap;
+        line-height: 13px;
+        margin-top: 1px;
+        display: block;
+      }
+      .word4 {
+        width: 33px;
+        height: 13px;
+        overflow-wrap: break-word;
+        color: rgba(64, 77, 116, 1);
+        font-size: 15px;
+        font-family: PingFangSC-Medium;
+        text-align: left;
+        white-space: nowrap;
+        line-height: 15px;
+        display: block;
+      }
+    }
+  }
+}
+</style>

+ 9 - 4
src/views/device/deviceOper.vue

@@ -162,15 +162,15 @@
 	  </div>
 
     <!-- 定制logo -->
-    <!-- <div class="operItem" @click="customLogo()">
+    <div class="operItem" @click="customLogo()">
 	    <div class="operIcon">
 	      <img
 	        class="operImg"
 	        src="../../assets/device/operIcon/customLogo.png"
 	      />
 	    </div>
-	    <div class="operText">{{ $t("device.customLogo") }}</div>
-	  </div> -->
+	    <div class="operText">{{ $t("device.customLogo.customLogo") }}</div>
+	  </div>
     
     </div>
   </van-dialog>
@@ -277,6 +277,10 @@ export default {
 	const openDoorFun = () => {
       router.push({ path: "openDoor", query: { deviceId: device.value.id } });
 	};
+  // 定制logo
+    const customLogo = () => {
+      router.push({ path: "customLogo", query: {deviceId: device.value.id }});
+    }
     // 音量调节
     const modulation = () => {
       router.push({ path: "modulation", query: { deviceId: device.value.id } });
@@ -432,6 +436,7 @@ export default {
       openOffFurnace,
       openDoorFun,
       modulation,
+      customLogo,
       doSugar,
       alarmClock,
       recharge,
@@ -440,7 +445,7 @@ export default {
       tuojiEquipmentFun,
       isRole,
       modifyPriceClk,
-	  showGoodsClk,
+	    showGoodsClk,
       sleepTitle,
       deleteDevice,
     };

+ 15 - 7
src/views/orderCenter/index.vue

@@ -422,18 +422,26 @@ export default {
         //   new Date(new Date(new Date().getTime()).setHours(0, 0, 0, 0)),
         //   "yyyy-MM-dd hh:mm:ss"
         // );
-        let dayInMs = 24 * 60 * 60 * 1000;
+        // 这是获取本周的第一天
+        // let dayInMs = 24 * 60 * 60 * 1000;
+        // let now = new Date();
+        // let firstDay = new Date(now.getTime() - (now.getDay() - 1) * dayInMs);
+        // searchParams.startDate = dateUtil.formateDate(firstDay, "yyyy-MM-dd hh:mm:ss");
+
+        // 获取当天
         let now = new Date();
-        let firstDay = new Date(now.getTime() - (now.getDay() - 1) * dayInMs);
-        searchParams.startDate = dateUtil.formateDate(firstDay, "yyyy-MM-dd hh:mm:ss");
-        
-        
+        let startDate = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0);
+        searchParams.startDate = dateUtil.formateDate(startDate, "yyyy-MM-dd hh:mm:ss");
+
         // searchParams.endDate = dateUtil.formateDate(
         //   new Date(new Date(new Date().getTime()).setHours(23, 59, 59, 59)),
         //   "yyyy-MM-dd hh:mm:ss"
         // );
-        let lastDay = new Date(now.getTime() + (7 - now.getDay()) * dayInMs);
-        searchParams.endDate = dateUtil.formateDate(lastDay, "yyyy-MM-dd hh:mm:ss");
+        // 这是获取本周的最后一天
+        // let lastDay = new Date(now.getTime() + (7 - now.getDay()) * dayInMs);
+        // searchParams.endDate = dateUtil.formateDate(lastDay, "yyyy-MM-dd hh:mm:ss");
+        let endDate = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59);
+        searchParams.endDate = dateUtil.formateDate(endDate, "yyyy-MM-dd hh:mm:ss");
 
         finished.value = false;
         getList();