shish 4 лет назад
Родитель
Сommit
b759341b02

+ 6 - 1
hdPad/src/api/item/index.js

@@ -3,4 +3,9 @@ import https from '@/plugins/luch-request_0.0.7/request'
 // 花材列表
 export const showList = async (data) => {
 	return https.get("/item/show-list", data);
-};
+};
+
+//检查是否要刷新
+export const checkRefresh = data => {
+	return https.get("/item/check-refresh", data);
+};

+ 34 - 1
hdPad/src/pages/home/cash.vue

@@ -33,6 +33,11 @@
 			</view>
 		</template>
 	</template>
+
+    <uni-popup ref="refrshRef" type="dialog">
+        <uni-popup-dialog type="info" cancelText="取消" @close="cancelRefresh" confirmText="确认" title="提示" content="花材价格已修改,请刷新" @confirm="confirmRefresh"></uni-popup-dialog>
+    </uni-popup>
+
 </view>
 </template>
 <script>
@@ -46,6 +51,7 @@ import leftArea from './components/leftArea.vue'
 import leftGroup from './components/leftGroup.vue'
 import navComponent from './components/nav.vue'
 import loginComponent from './login.vue'
+import { checkRefresh } from '@/api/item'
 import productMins from "@/mixins/product";
 export default {
 	name: "cash",
@@ -64,7 +70,8 @@ export default {
             currentJobType:'bill',
             currentJobId:0,
 			hasChooseCustomer:true,
-			changeFlower:2
+			changeFlower:2,
+			T:null
 		}
 	},
 	computed: {
@@ -72,6 +79,12 @@ export default {
 	},
 	onLoad() {
 		this.initDataFromStorage()
+
+		this.beginRemind()
+
+	},
+	onUnload(){
+		clearInterval(this.T)
 	},
 	onPullDownRefresh() {
 	},
@@ -94,6 +107,26 @@ export default {
 		}
 	},
 	methods: {
+		cancelRefresh(){
+			this.beginRemind()
+		},
+		confirmRefresh(){
+			clearInterval(this.T)
+        	this.$util.pageTo({ url: "/pages/home/cash",type:2})
+		},
+		beginRemind(){
+			let that = this
+			clearInterval(that.T)
+			that.T = setInterval(function(){
+				checkRefresh().then(res=>{
+					if(res.code == 1){
+						if(res.data.remind && res.data.remind == 1){
+							that.$refs.refrshRef.open('center')
+						}
+					}
+				})
+			}, 8000); 
+		},
 		//开单完成之后更新花材的库存
 		rightItemRefresh(){
 			this.$refs.rightItemRef.itemRefresh()

+ 2 - 2
hdPad/src/pages/home/components/rightItem.vue

@@ -97,12 +97,12 @@ export default {
             let { data } =  await showClass()
             this.classData = data
             this.categoryId = this.classData[0].id
-            let { data:{list} } =  await showList()
+            let { data:{list} } =  await showList({isCashier:1})
             this.allItemInfo = list
             this.showCatItem()
         },
         itemRefresh(){
-            showList().then(res=>{
+            showList({isCashier:1}).then(res=>{
                 this.allItemInfo = res.data.list
                 this.showCatItem()
             })