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

添加花型屏蔽和物料功能以及订单优化

soobin 2 лет назад
Родитель
Сommit
90c033cb49

src/assets/device/operIcon/ic_屏蔽展示商品@3x.png → src/assets/device/operIcon/showGoods.png


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

@@ -384,6 +384,9 @@
     "furnaceHeadTemperature": "furnace head temperature",
     "temperatureInCabinet": "Temperature in cabinet",
     "humidityInCabinet": "Humidity in cabinet",
+	"showGoods": "Block or display goods",
+	"editShowGoods": "Are you sure about the change?",
+	"unknownError": "Unknown error!",
     "degree": "degree",
     "volume": "volume",
     "alarmContent": "Alarm content",
@@ -461,6 +464,10 @@
       "submitPush": "Submit and push",
       "adRulePlace": "Please select the advertising rules first"
     },
+    "showGoodsPage":{
+      "title":"Goods display setting",
+      "equipmentName":"Equipment name"
+    },
     "flowerType": "Flower type",
     "flowerTypePlace": "Please select the flower type"
   },

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

@@ -384,6 +384,9 @@
     "furnaceHeadTemperature": "炉头温度",
     "temperatureInCabinet": "柜内温度",
     "humidityInCabinet": "柜内湿度",
+	"showGoods": "屏蔽/显示商品",
+	"editShowGoods": "是否确认更改?",
+	"unknownError": "未知错误!",
     "degree":"度",
     "volume": "音量",
     "alarmContent": "报警内容",
@@ -428,6 +431,10 @@
       "batchPricePlace":"请输入批量价格",
       "modifySubmit":"修改提交"
     },
+	"showGoodsPage":{
+		"title":"商品显示设置",
+		"equipmentName":"设备名称"
+	},
 	"deleteDevice":"删除设备",
     "noPosition":"暂无定位",
     "equipLocation":"设备位置",
@@ -442,6 +449,7 @@
     "stick":"棍子",
     "water":"清水",
     "wasteWater":"废水",
+	"sentSuccessfully": "发送请求成功",
     "turnOffHibe":"关闭休眠",
     "enableSleep":"开启休眠",
     "communiChannel":"通信通道",

+ 2 - 0
src/router/index.js

@@ -107,6 +107,8 @@ 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: '/viewPosition', name: 'viewPosition', component: () => import('@/views/device/viewPosition/index'), meta: { index: 1 } },  
     // 设备编辑-编辑规则

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

@@ -122,3 +122,7 @@ export function changeSleepDesc(params) {
 export function delOneDevice(params) {
   return axios.post(`/SZWL-SERVER/tEquipmentDeleted/delOneDevice`, {params})
 }
+// 屏蔽/显示商品
+export function updateProductsShow(params) {
+  return axios.post(`/SZWL-SERVER/tProduct/updateProductsShow`, params)
+}

+ 17 - 1
src/views/device/deviceOper.vue

@@ -141,7 +141,15 @@
         </div>
         <div class="operText">{{ $t("device.modifyPrice") }}</div>
       </div>
-
+	  <div class="operItem" @click="showGoodsClk()">
+        <div class="operIcon">
+          <img
+            class="operImg"
+            src="../../assets/device/operIcon/showGoods.png"
+          />
+        </div>
+        <div class="operText">{{ $t("device.showGoods") }}</div>
+      </div>
 	  <!-- 删除设备 -->           <!--  这个deleteDevice 得完善一下 现在没取到接口要的id  -->
 	  <div v-if="user.type < 2" class="operItem" @click="deleteDevice()">
 	    <div class="operIcon">
@@ -202,6 +210,13 @@ export default {
         query: { deviceId: device.value.id, name: device.value.name },
       });
     };
+	// 点击屏蔽/展示商品
+	const showGoodsClk = () => {
+	  router.push({
+	    path: "showGoods",
+	    query: { deviceId: device.value.id, name: device.value.name },
+	  });
+	};
     const { t } = useI18n();
     const user = getLoginUser();
     const router = useRouter();
@@ -409,6 +424,7 @@ export default {
       tuojiEquipmentFun,
       isRole,
       modifyPriceClk,
+	  showGoodsClk,
       sleepTitle,
       deleteDevice,
     };

+ 48 - 51
src/views/device/index.vue

@@ -110,8 +110,8 @@
                     >
                     <!-- <van-switch size="24px" v-model="item.isSleep" /> -->
                   </div>
-				  <div class="layer8_1 o-ptb-10">
-					  <span v-if="item.isSleep" class="word8_1">
+				  <div v-if="item.isSleep" class="layer8_1 o-ptb-10">
+					  <span class="word8_1">
 					  	<div v-if="!sleepDescBoxShow" >
 							<span>{{ $t("device.sleepDesc") }}: 
 								<van-field
@@ -159,53 +159,46 @@
                   <span class="txt5 o-ptb-10">{{ item.fullName }}</span>
                   <span
                     v-if="item.latitude"
-                    class="txt5 o-ptb-10 kBordBott l-flex-RC"
+                    class="txt5 o-ptb-5 kBordBott l-flex-RC"
                     ><span>{{ $t("device.position") }}:</span>
                     <van-button @click="viewPosiClk(item)" type="primary">{{
                       $t("device.view")
                     }}</van-button>
                   </span>
-                  <div
-                    class="layer7 o-ptb-10 kBordBott flex-row justify-between"
+                  <van-row
+                    class="layer7 o-ptb-10 kBordBott"
+					justify="space-between"
                   >
-                    <span class="word10"
+                    <van-col class="word10"
                       >{{ $t("device.furnaceHeadTemperature") }}:{{
                         item.furnaceTm
-                      }}{{ $t("device.degree") }}</span
+                      }}{{ $t("device.degree") }}</van-col
                     >
-                    <span class="word11"
+                    <van-col class="word11"
                       >{{ $t("device.temperatureInCabinet") }}:{{
                         item.cabinetTm
-                      }}{{ $t("device.degree") }}</span
+                      }}{{ $t("device.degree") }}</van-col
                     >
-                    <span class="word11"
+                    <van-col class="word11"
                       >{{ $t("device.humidityInCabinet") }}:{{ item.cabinetHd
-                      }}{{ $t("device.degree") }}</span
+                      }}{{ $t("device.degree") }}</van-col
                     >
-                  </div>
+                  </van-row>
                   <template v-if="item.isMaterialUse === '1'">
-                    <div class="sugarTxt o-ptb-10 kBordBott">
-                      <span
-                        >{{ $t("device.whiteSugar") }}:{{
-                          $M_FormatCalcuDecial(item.whiteSugar)
-                        }}%</span
-                      >
-                      <span
-                        >--{{ $t("device.redSugar") }}:{{
-                          $M_FormatCalcuDecial(item.redSugar)
-                        }}%</span
-                      >
-                      <span
-                        >--{{ $t("device.yellowSugar") }}:{{
-                          $M_FormatCalcuDecial(item.yellowSugar)
-                        }}%</span
-                      >
-                      <span
-                        >--{{ $t("device.blueSugar") }}:{{
-                          $M_FormatCalcuDecial(item.blueSugar)
-                        }}%</span
-                      >
-                    </div>
+					<van-row justify="space-between" class="sugarTxt o-ptb-10 kBordBott">
+                      <van-col>
+						{{ $t("device.whiteSugar") }}:{{$M_FormatCalcuDecial(item.whiteSugar)}}%
+					  </van-col>
+                      <van-col>
+						  {{ $t("device.redSugar") }}:{{$M_FormatCalcuDecial(item.redSugar)}}%
+					  </van-col>
+                      <van-col>
+						  {{ $t("device.yellowSugar") }}:{{$M_FormatCalcuDecial(item.yellowSugar)}}%
+					  </van-col>
+                      <van-col>
+						  {{ $t("device.blueSugar") }}:{{$M_FormatCalcuDecial(item.blueSugar)}}%
+					  </van-col>
+					</van-row>
                     <div class="sugarTxt o-ptb-10 kBordBott">
                       <span
                         >{{ $t("device.stick") }}:{{
@@ -213,19 +206,15 @@
                         }}%</span
                       >
                     </div>
-                    <div class="sugarTxt o-ptb-10 kBordBott">
-                      <span
-                        >{{ $t("device.water") }}:{{
-                          $M_FormatCalcuDecial(item.water)
-                        }}%</span
-                      >
-                      <span
-                        >--{{ $t("device.wasteWater") }}:{{
-                          $M_FormatCalcuDecial(item.wasteWater)
-                        }}%</span
-                      >
-                    </div>
-                    <span class="txt5 o-ptb-10 kBordBott l-flex-RC"
+                    <van-row gutter="50" class="sugarTxt o-ptb-10 kBordBott">
+                      <van-col>
+					  {{ $t("device.water") }}:{{$M_FormatCalcuDecial(item.water)}}%
+					  </van-col>
+                      <van-col>
+					  {{ $t("device.wasteWater") }}:{{$M_FormatCalcuDecial(item.wasteWater)}}%
+					  </van-col>
+                    </van-row>
+                    <span class="txt5 o-ptb-5 kBordBott l-flex-RC"
                       ><span>{{ $t("device.oneKeyFeed") }}:</span>
                       <van-button @click="replenishmentClk(item)" type="primary"
                         >{{ $t("device.replenishment") }}
@@ -300,7 +289,7 @@ import {
   Api_postMachineNum,
 } from "@/service/home";
 import { onMounted, reactive, toRefs, ref } from "vue";
-import { Toast } from "vant";
+import { Toast, Dialog } from "vant";
 import navBar from "@/components/NavBar";
 import sHeader from "@/components/SimpleHeader";
 import { getLoginUser, $M_FormatCalcuDecial } from "@/common/js/utils";
@@ -364,6 +353,7 @@ export default {
 
     // 获取设备列表数据
     const getList = async () => {
+	  finished.value = false;
       const { data } = await getDeviceList(Object.assign({}, searchParams));
       if (data.code === "00000") {
         if (searchParams.current === 0) {
@@ -464,7 +454,13 @@ export default {
       console.log("row", row);
       Api_getReplenishment({ equipmentId: row.id }).then((res) => {
         console.log("res", res);
-        Toast(res.data.message);
+        // Toast(res.data.message);
+		Dialog.alert({
+		  message: t('device.sentSuccessfully'),
+		}).then(() => {
+		 //返回上一页
+		  router.go(0);
+		});
         setTimeout(() => {
           getList();
         }, 500);
@@ -953,6 +949,7 @@ export default {
         .sugarTxt {
           color: rgba(64, 77, 116, 1);
           font-size: 14px;
+		  line-height: 13px;
         }
 
         .word7 {
@@ -1028,7 +1025,7 @@ export default {
             width: 100%;
 
             .word10 {
-              width: 33.33%;
+              // width: 33.33%;
               overflow-wrap: break-word;
               color: rgba(64, 77, 116, 1);
               font-size: 14px;
@@ -1038,7 +1035,7 @@ export default {
             }
 
             .word11 {
-              width: 33.33%;
+              // width: 33.33%;
               overflow-wrap: break-word;
               color: rgba(64, 77, 116, 1);
               font-size: 14px;

+ 2 - 0
src/views/device/modifyPrice/index.vue

@@ -207,6 +207,8 @@ export default {
     }
 
     .goodsCon {
+		height: 50px;
+		
       .priceInp {
         /deep/ .van-cell {
           display: flex;

+ 214 - 0
src/views/device/showGoods/index.vue

@@ -0,0 +1,214 @@
+<template>
+	<div class="showGoodsIdx">
+		<s-header :name="$t('device.showGoodsPage.title')" :noback="false"></s-header>
+		<div class="headerCon kBordBott o-plr-10 o-ptb-16 l-flex-RC">
+			<div class="line o-mr-6"></div>
+			<div>
+				<span class="c-color c-text-14">{{ $t('device.showGoodsPage.equipmentName') }}:</span>
+				<span class="c-text-color c-text-14">{{ equipmentName }}</span>
+			</div>
+		</div>
+	</div>
+	<van-row class="goods" wrap="true">
+		<van-col v-for="(item, index) in tableData" :key="index" class="goodsCon" span="12">
+			<div class="l-flex-RC">
+				<van-image width="75" height="75" fit="scale-down" :src="showSugerPhoto(item)" />
+				<span class="o-ml-10">{{ item.productName }}</span>
+				<van-switch class="o-ml-5" v-model="switchStates[index]" size="20px" active-color="#4dc294"
+					@change="handleChange(index)" />
+			</div>
+			<van-divider :style="{ color: '#1baeae', borderColor: '#1baeae', fontSize: '20px', fontWeight: 500 }" />
+		</van-col>
+	</van-row>
+	<div style="margin: 16px">
+		<van-button round block type="primary" native-type="submit" @click="updateShowGoods()">
+			提交
+		</van-button>
+	</div>
+</template>
+
+<script>
+	// 导入接口
+	import {
+		selectProducts,
+		updateProductsShow
+	} from '@/service/device/index';
+	import sHeader from "@/components/SimpleHeader";
+	import {
+		ref,
+		reactive
+	} from "@vue/reactivity";
+	import {
+		onMounted
+	} from '@vue/runtime-core';
+	import {
+		useRoute,
+		useRouter
+	} from 'vue-router';
+	import {
+		Toast, Dialog
+	} from 'vant';
+	import {
+		useI18n
+	} from "vue-i18n";
+	export default {
+		components: {
+			sHeader
+		},
+		setup() {
+			// 引入语言
+			const {
+				t
+			} = useI18n();
+			// 商品图片路径处理
+			const showSugerPhoto = (row) => {
+				let imgId = row.no;
+				if (imgId) {
+					return require(`../../../assets/order/spunSugar/goods/${imgId}.png`);
+				}
+				return imgId;
+			};
+			// 路由
+			const route = useRoute();
+			const router = useRouter();
+			// 商品数据
+			const tableData = ref([]);
+			const switchStates = ref([]);
+			// 设备名称
+			const equipmentName = ref('');
+
+			// 刚进页面
+			onMounted(() => {
+				const id = route.query.deviceId || "";
+				const name = route.query.name || "";
+				if (id) {
+					cofficentForm.equipmentId = id;
+					equipmentName.value = name;
+					getList();
+				}
+
+			});
+			// 获取商品列表
+			const getList = () => {
+				selectProducts({
+					equipmentId: cofficentForm.equipmentId
+				}).then(res => {
+					console.log('res', res)
+					const {
+						data
+					} = res.data;
+					if (data) {
+						if (data.length > 0) {
+							// 是否修改状态
+							data.forEach(item => {
+								if (item.showType == null || item.showType == 0) {
+									switchStates.value.push(true);
+								} else {
+									switchStates.value.push(false);
+								}
+							})
+						}
+						tableData.value = data;
+					}
+				})
+			}
+			// 修改的价格
+			const cofficentForm = reactive({
+				equipmentId: '',
+			});
+
+			// 更改状态
+			const handleChange = (index) => {
+				// console.log(index);
+				// console.log(switchStates.value[index]);
+				if (switchStates.value[index]) {
+					tableData.value[index].showType = 0;
+				} else {
+					tableData.value[index].showType = 1;
+				}
+				// console.log(tableData.value[index]);			
+			};
+
+
+			// 点击提交
+			const updateShowGoods = () => {
+				Dialog.confirm({
+					title: t('device.openRemind'),
+					message: t('device.editShowGoods'),
+				}).then(() => {
+					console.log(tableData.value);
+					var products = tableData.value;
+					var list = JSON.stringify(products);
+					updateProductsShow({
+						productList: list
+					}).then((res) => {
+						console.log(res.data.message);
+						// Toast();
+						Dialog.alert({
+						  message: t('device.modificationSucceeded'),
+						}).then(() => {
+						 //返回上一页
+						  router.go(-1);
+						});
+						setTimeout(() => {
+							getList();
+						}, 1000);
+					}).catch((error) => {
+						console.log(error);
+						Toast(t('device.unknownError'));
+					});
+				});
+			};
+			return {
+				cofficentForm,
+				tableData,
+				showSugerPhoto,
+				equipmentName,
+				updateShowGoods,
+				switchStates,
+				handleChange,
+			};
+		},
+	};
+</script>
+
+<style lang="less" scoped>
+	.showGoodsIdx {
+		height: calc(100%-44px);
+		overflow: hidden;
+		overflow-y: auto;
+
+
+		.headerCon {
+			.line {
+				background-color: rgba(128, 150, 236, 1);
+				border-radius: 2px;
+				width: 4px;
+				height: 16px;
+			}
+		}
+
+		.goods {
+			height: 50%;
+
+
+			.goodsCon {
+				flex-wrap: wrap;
+				position: relative;
+
+				.divider {
+					line-height: 50px;
+				}
+
+				// .goodsName {
+				// 	display: flex;
+				// 	/* 设置为 flex 布局 */
+				// 	flex-direction: column;
+				// }
+			}
+
+		}
+
+
+	}
+</style>

+ 2 - 1
src/views/orderCenter/index.vue

@@ -328,6 +328,7 @@ export default {
     let chartType = "day";
     // 获取订单列表数据
     const getList = async () => {
+ 	  finished.value = false;
       getStatisticsFun();
       // 因为订单的时间格式不一样
       const params = Object.assign({}, searchParams);
@@ -392,7 +393,7 @@ export default {
     const search = (data) => {
       searchParams = Object.assign(searchParams, data);
       // 这个会导致请求两次接口
-      finished.value = false;
+      // finished.value = false;
       searchParams.current = 1;
       getList();
     };