shish 2 лет назад
Родитель
Сommit
187aab5b8e
2 измененных файлов с 127 добавлено и 49 удалено
  1. 9 0
      ghsApp/src/api/purchase/index.js
  2. 118 49
      ghsApp/src/pagesPurchase/info.vue

+ 9 - 0
ghsApp/src/api/purchase/index.js

@@ -47,6 +47,15 @@ export const getPurchaseDetailApi = orderSn => {
 	return https.get("/purchase-order/detail", { orderSn });
 };
 
+export const getCgDetail = data => {
+	return https.get("/purchase-order/detail", data);
+};
+
+export const checkSeatRemin = data => {
+	return https.get("/purchase-order/check-seat-update", data);
+};
+
+
 /** *
  * 采购列表
  */

+ 118 - 49
ghsApp/src/pagesPurchase/info.vue

@@ -14,7 +14,7 @@
 				</view>
 			</view>
 			<view class="title"> 
-				<text @click="assignOrder()">单据信息</text>
+				<text>单据信息</text>
 			</view>
 			<view class="bills-info_box content-box">
 				<view class="order-info_box">
@@ -76,18 +76,20 @@
 
 			<view class="title">
 				商品信息 
-				<text @click="goRefund(detailInfo)" v-if="detailInfo.status == 4" 
-				style="float:right;font-weight:normal;color:#3385FF;margin-right:30upx;">申请售后</text>
-				<text @click="printAllLabel(detailInfo,1)" style="float:right;font-weight:normal;color:#3385FF;margin-right:30upx;">
-				打全部价码
-				</text>
-				<text @click="printAllLabel(detailInfo,0)" style="float:right;font-weight:normal;color:#3385FF;margin-right:30upx;">
-				打全部标签
-				</text>
+				<block v-if="!$util.isEmpty(getLoginInfo.admin) && getLoginInfo.admin.currentGhsShopId > 0">
+					<text @click="goRefund(detailInfo)" v-if="detailInfo.status == 4" 
+					style="float:right;font-weight:normal;color:#3385FF;margin-right:30upx;">申请售后</text>
+					<text @click="printAllLabel(detailInfo,1)" style="float:right;font-weight:normal;color:#3385FF;margin-right:30upx;">
+					打全部价码
+					</text>
+					<text @click="printAllLabel(detailInfo,0)" style="float:right;font-weight:normal;color:#3385FF;margin-right:30upx;">
+					打全部标签
+					</text>
+				</block>
 			</view>
 			<view style="text-align: right;">
 				<button @tap="assignOrder()" class="admin-button-com mini-btn blue" style="">刷新货位</button>
-				<button @tap="assignOrder()" class="admin-button-com mini-btn blue" style="margin-left:50upx;">隐藏货位</button>
+				<button @tap="" class="admin-button-com mini-btn blue" style="margin-left:50upx;">隐藏货位</button>
 			</view>
 			<view class="module-com content-box">
 				<view class="commodity-view">
@@ -106,8 +108,10 @@
 										</text>
 									</view>
 									<view class="info-line" style="position:relative;">
-										<text class="item-type" style="color:#3385FF;" @click.stop="printLabel(s,0)">打标签</text>
-										<text class="item-type" style="color:#3385FF;" @click.stop="printLabel(s,1)">打价码</text>
+										<block v-if="!$util.isEmpty(getLoginInfo.admin) && getLoginInfo.admin.currentGhsShopId > 0">
+											<text class="item-type" style="color:#3385FF;" @click.stop="printLabel(s,0)">打标签</text>
+											<text class="item-type" style="color:#3385FF;" @click.stop="printLabel(s,1)">打价码</text>
+										</block>
 										<text class="item-count">
 										{{ parseFloat(s.itemNum) }}扎 × 
 										<text style="font-weight:bold;margin-left:5upx;" v-if="s.aboutPrice==1">约</text>
@@ -182,7 +186,8 @@
 					</tui-list-cell>
 				</div>
 			</view>
-			<view class="content-box price-detail">
+
+			<view class="content-box price-detail" v-if="!$util.isEmpty(getLoginInfo.admin) && getLoginInfo.admin.currentGhsShopId > 0">
 				<div class="module-com input-line-wrap">
 					<tui-list-cell class="line-cell" :hover="false">
 						<div class="tui-title">备注</div>
@@ -235,19 +240,21 @@
 
 		</view>
 
-		<view class="app-footer open_btn" v-if="detailInfo.location == 0">
-			<view v-if="detailInfo.status != 3" @click="changePrice()" class="admin-button-com big blue">修改价格</view>
-			<view v-if="detailInfo.status == 2 || detailInfo.status == 3 || detailInfo.status == 4" @click="printBillFn(detailInfo)" class="admin-button-com big blue">打印({{detailInfo.printNum}})</view>
-			<view v-if="detailInfo.status == 3" @click="cancelIn()" class="admin-button-com big blue">取消入库</view>
-			<view v-if="detailInfo.status == 3" @click="changePrice()" class="admin-button-com big blue">入库和改价</view>
-		</view>
+		<block v-if="!$util.isEmpty(getLoginInfo.admin) && getLoginInfo.admin.currentGhsShopId > 0">
+			<view class="app-footer open_btn" v-if="detailInfo.location == 0">
+				<view v-if="detailInfo.status != 3" @click="changePrice()" class="admin-button-com big blue">修改价格</view>
+				<view v-if="detailInfo.status == 2 || detailInfo.status == 3 || detailInfo.status == 4" @click="printBillFn(detailInfo)" class="admin-button-com big blue">打印({{detailInfo.printNum}})</view>
+				<view v-if="detailInfo.status == 3" @click="cancelIn()" class="admin-button-com big blue">取消入库</view>
+				<view v-if="detailInfo.status == 3" @click="changePrice()" class="admin-button-com big blue">入库和改价</view>
+			</view>
 
-		<view class="app-footer open_btn" v-else>
-			<view v-if="detailInfo.status != 3" @click="changePrice()" class="admin-button-com big blue">修改价格</view>
-			<view v-if="detailInfo.status == 2 || detailInfo.status == 3 || detailInfo.status == 4" @click="printBillFn(detailInfo)" class="admin-button-com big blue">打印({{detailInfo.printNum}})</view>
-			<view v-if="detailInfo.status == 3" @click="cancelIn()" class="admin-button-com big blue">取消入库</view>
-			<view v-if="detailInfo.status == 3" @click="changePrice()" class="admin-button-com big blue">入库和改价</view>
-		</view>
+			<view class="app-footer open_btn" v-else>
+				<view v-if="detailInfo.status != 3" @click="changePrice()" class="admin-button-com big blue">修改价格</view>
+				<view v-if="detailInfo.status == 2 || detailInfo.status == 3 || detailInfo.status == 4" @click="printBillFn(detailInfo)" class="admin-button-com big blue">打印({{detailInfo.printNum}})</view>
+				<view v-if="detailInfo.status == 3" @click="cancelIn()" class="admin-button-com big blue">取消入库</view>
+				<view v-if="detailInfo.status == 3" @click="changePrice()" class="admin-button-com big blue">入库和改价</view>
+			</view>
+		</block>
 
 		<modal-module :show="printLabelShow" @click="dialogInputConfirm" :maskClosable="true" title="数量" padding="30rpx 30rpx" >
 		<template v-slot:content>
@@ -264,18 +271,22 @@
 	</view>
 </template>
 <script>
-import { getPurchaseDetailApi,updateRemark,printAll,printItem,confirmPutIn,cancelPutIn,printBill,assignSeat } from "@/api/purchase";
+import { getPurchaseDetailApi,getCgDetail,updateRemark,printAll,printItem,confirmPutIn,cancelPutIn,printBill,assignSeat,checkSeatRemin } from "@/api/purchase";
 import productMins from "@/mixins/product";
 import TuiListCell from "@/components/plugin/list-cell";
 import ModalModule from "@/components/plugin/modal"
 import { print } from '@/api/product';
 import { getPrint } from "@/api/shop";
+import { mapGetters } from "vuex";
 export default {
 	name: "info",
 	components: {
 		TuiListCell,
 		ModalModule
 	},
+	computed: {
+    	...mapGetters(["getLoginInfo"])
+  	},
 	mixins: [productMins],
 	data() {
 		return {
@@ -291,22 +302,31 @@ export default {
 			printType:0,
 			printLabelShow:false,
 			printNum:'',
-			wcPrintNum:1
+			wcPrintNum:1,
+			T:null,
+			orderSn:'',
+			salt:''
 		};
 	},
 	onPullDownRefresh() {
-		this.init().then(res => {
+		this.initCgData().then(res => {
 			uni.stopPullDownRefresh()
 		})
 	},
 	onLoad() {
+		this.initCgData()
+	},
+	onUnload(){
+		clearInterval(this.T)
 	},
 	methods: {
 		assignOrder(){
-			assignSeat({id:this.detailInfo.id}).then(res=>{
+			assignSeat({id:this.detailInfo.id,salt:this.salt}).then(res=>{
 				if(res.code == 1){
-					this.$msg(res.msg)
-					this.init()
+					if(res.data && res.data.assign == 1){
+						this.$msg(res.msg)
+						this.initCgData()
+					}
 				}
 			})
 		},
@@ -326,19 +346,16 @@ export default {
 							return false
 						}
 						let order = res.tapIndex
-						uni.showLoading({mask:true})
 						printBill({id:info.id,order:order}).then((res) => {
 							info.printNum++
-							uni.hideLoading()
+							this.$msg('打印成功')
 						})
 					}
-				});
-
+				})
 			}else{
-				uni.showLoading({mask:true})
 				printBill({id:info.id}).then((res) => {
 					info.printNum++
-					uni.hideLoading()
+					this.$msg('打印成功')
 				})
 			}
 		},
@@ -389,7 +406,7 @@ export default {
 				cancelPutIn({id:that.detailInfo.id}).then(res=>{
 					uni.hideLoading()
 					if(res.code == 1){
-						that.init()
+						that.initCgData()
 					}
 				})
 			})
@@ -447,24 +464,76 @@ export default {
 				phoneNumber: mobile
 			});
 		},
-		async init() {
-			const { orderSn } = this.option;
-			if (!orderSn) {
-				return;
+		init(){
+
+		},
+		checkRemind(){
+			let that = this
+			if(this.T){
+				clearInterval(this.T)
 			}
-			const { data } = await getPurchaseDetailApi(orderSn);
-			this.detailInfo = data;
+			this.T = setInterval(function(){
+				checkSeatRemin({orderSn:that.orderSn,salt:that.salt}).then(res=>{
+					if(res.code == 1){
+						if(res.data.need && res.data.need == 1){
+							clearInterval(that.T)
+							that.$util.confirmModal({content:'货位有变,请刷新',singer:true},() => {
+								that.assignOrder()
+							},()=>{
+								that.checkRemind()
+							})
+						}
+					}
+				})
+            },5000)
+		},
+		async initCgData() {
 			let that = this
-			getPrint().then(res=>{
-				if(res.code == 1){
-					that.wcPrintNum = res.data.wcPrintNum ? Number(res.data.wcPrintNum) : 1
+			clearInterval(that.T)
+			if(that.option.orderSn){
+				that.orderSn = that.option.orderSn
+				const { data } = await getPurchaseDetailApi(that.option.orderSn);
+				that.detailInfo = data;
+				if(that.detailInfo && that.detailInfo.needRemindRefreshSeat == 1){
+					that.checkRemind()
+				}else{
+					clearInterval(that.T)
 				}
-			})
+				getPrint().then(res=>{
+					if(res.code == 1){
+						that.wcPrintNum = res.data.wcPrintNum ? Number(res.data.wcPrintNum) : 1
+					}
+				})
+			}else{
+				if(that.option.q){
+					let currentUrl = decodeURIComponent(that.option.q)
+					let str = currentUrl.substring(currentUrl.lastIndexOf("?") + 1)
+					var sceneItem = str.split("&");
+					var arr, name, value;
+					var sceneArray = new Array();
+					for (var i = 0, l = sceneItem.length; i < l; i++) {
+						arr = sceneItem[i].split("=");
+						name = arr[0];
+						value = arr[1];
+						sceneArray[name] = value;
+					}
+					if(sceneArray.orderSn && sceneArray.salt){
+						that.orderSn = sceneArray.orderSn
+						that.salt = sceneArray.salt
+						const { data } = await getCgDetail({orderSn:sceneArray.orderSn,salt:sceneArray.salt})
+						that.detailInfo = data
+						if(that.detailInfo && that.detailInfo.needRemindRefreshSeat == 1){
+							that.checkRemind()
+						}else{
+							clearInterval(that.T)
+						}
+					}
+				}
+			}
 		}
 	}
 };
 </script>
-
 <style lang="scss" scoped>
 .info-content_box {
 	padding: 0 20upx 100upx;