wangchao 3 роки тому
батько
коміт
19307a0026
2 змінених файлів з 69 додано та 49 видалено
  1. 2 10
      common/appUpdate.js
  2. 67 39
      pages/user/contractLook/inventoryCost.vue

+ 2 - 10
common/appUpdate.js

@@ -13,8 +13,7 @@ export default function appUpdate() {
 	    	imei: "1"
 	    	imei: "1"
 	    },
 	    },
 	    method: 'GET',
 	    method: 'GET',
-	    success: (res) => {		
-			var that=this
+	    success: (res) => {			
 	    	if (res.statusCode === 200) {
 	    	if (res.statusCode === 200) {
 				console.log("uni.request update success",res)
 				console.log("uni.request update success",res)
 				plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo) {
 				plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo) {
@@ -63,14 +62,7 @@ export default function appUpdate() {
 										force: false
 										force: false
 									}, function() {
 									}, function() {
 										plus.nativeUI.toast("热更新成功");
 										plus.nativeUI.toast("热更新成功");
-										uni.clearStorageSync();
-										that.$api.doRequest('post', '/auth/api/logout').then(res => {
-											if (res.data.data) {
-												that.$store.commit('logout')
-												that.$api.logout()
-												plus.runtime.restart();
-											}
-										})
+										plus.runtime.restart();
 									}, function(e) {
 									}, function(e) {
 										console.log(e)
 										console.log(e)
 										plus.nativeUI.toast(`热更新失败:${e.message}`);
 										plus.nativeUI.toast(`热更新失败:${e.message}`);

+ 67 - 39
pages/user/contractLook/inventoryCost.vue

@@ -13,8 +13,12 @@
 					<view class="font">价值(元)</view>
 					<view class="font">价值(元)</view>
 				</view>
 				</view>
 				<view class="goods-table-content" v-for="(item1,index1) in item.goodList">
 				<view class="goods-table-content" v-for="(item1,index1) in item.goodList">
-					<view class="font" :class="item.goodList.length>1&&index1==item.goodList.length-1?'active':''">{{item1.goodsName}}</view>
-					<view class="font" :class="item.goodList.length>1&&index1==item.goodList.length-1?'active':''">{{item1.storage}}</view>
+					<view class="font" :class="item.goodList.length>1&&index1==item.goodList.length-1?'active':''">
+						{{item1.goodsName}}
+					</view>
+					<view class="font" :class="item.goodList.length>1&&index1==item.goodList.length-1?'active':''">
+						{{item1.storage}}
+					</view>
 					<view class="font">{{item1.cost}}</view>
 					<view class="font">{{item1.cost}}</view>
 				</view>
 				</view>
 			</view>
 			</view>
@@ -44,17 +48,22 @@
 		</u-modal>
 		</u-modal>
 		<u-calendar v-model="show" :mode="mode" @change="change" range-color='#22C572' btn-type='success'
 		<u-calendar v-model="show" :mode="mode" @change="change" range-color='#22C572' btn-type='success'
 			range-bg-color='rgba(25, 190, 107, 0.13)' active-bg-color='#22C572'></u-calendar>
 			range-bg-color='rgba(25, 190, 107, 0.13)' active-bg-color='#22C572'></u-calendar>
+		<u-modal v-model="isShowAlert" :title-style="{fontSize: '18px',fontWeight:'500'}"
+			:content-style="{fontSize: '14px',fontWeight:'400'}" confirm-color='#22C572' confirm-text='确定' title='提示'
+			showCancelButton='false' :content="content" @confirm="alertBtn" @cancel="cancelClick"></u-modal>
 	</view>
 	</view>
 </template>
 </template>
 
 
 <script>
 <script>
-	 import helper from '@/common/helper.js'; 
+	import helper from '@/common/helper.js';
 	import {
 	import {
 		mapState
 		mapState
 	} from 'vuex';
 	} from 'vuex';
 	export default {
 	export default {
 		data() {
 		data() {
 			return {
 			return {
+				isShowAlert: false,
+				content: '当前登录身份已失效,请重新登录!',
 				parameter: {
 				parameter: {
 					startDate: "",
 					startDate: "",
 					endDate: '',
 					endDate: '',
@@ -84,7 +93,16 @@
 			...mapState(['hasLogin', 'userInfo']),
 			...mapState(['hasLogin', 'userInfo']),
 		},
 		},
 		methods: {
 		methods: {
-			selectDate() {				this.show = true
+			alertBtn() {
+				uni.navigateTo({
+					url: '/pages/public/login'
+				})
+			},
+			cancelClick() {
+				this.isShowAlert = false
+			},
+			selectDate() {
+				this.show = true
 			},
 			},
 			change(e) {
 			change(e) {
 				this.parameter.startDate = e.startDate
 				this.parameter.startDate = e.startDate
@@ -137,41 +155,50 @@
 				this.isShowDetailBtn = true
 				this.isShowDetailBtn = true
 			},
 			},
 			init() {
 			init() {
-				uni.showLoading({
-					title: '正在加载'
-				})
-				this.$api.doRequest('get', '/costManagementInfo/selectCostManagementInfo', {
-					compId: uni.getStorageSync('pcUserInfo').compId,
-					warehouseType: 1
-				}).then(res => {
-					uni.hideLoading()
-					const results = this.makeGroupData(res.data.data, function(item) {
-						return [item.warehouseName];
-					});
-					console.log('this.costList')
-					console.log(this.costList)
-					let _data = []
-					for (let i = 0; i < results.length; i++) {
-						let _obj = {}
-						_obj.warehouseName = results[i][0].warehouseName
-						// 大于两条添加合计行
-						if (results[i].length > 1) {
-							let _price = 0
-							for (let k = 0; k < results[i].length; k++) {
-								_price += results[i][k].storage
+				debugger
+				if (!this.hasLogin) {
+					this.isShowAlert = true;
+				} else {
+					uni.showLoading({
+						title: '正在加载'
+					})
+					this.$api.doRequest('get', '/costManagementInfo/selectCostManagementInfo', {
+						compId: uni.getStorageSync('pcUserInfo').compId,
+						warehouseType: 1
+					}).then(res => {
+						uni.hideLoading()
+						if (res.data.data) {
+							const results = this.makeGroupData(res.data.data, function(item) {
+								return [item.warehouseName];
+							});
+							console.log('this.costList')
+							console.log(this.costList)
+							let _data = []
+							for (let i = 0; i < results.length; i++) {
+								let _obj = {}
+								_obj.warehouseName = results[i][0].warehouseName
+								// 大于两条添加合计行
+								if (results[i].length > 1) {
+									let _price = 0
+									for (let k = 0; k < results[i].length; k++) {
+										_price += results[i][k].storage
+									}
+									_price = _price.toFixed(2)
+									results[i].push({
+										'goodsName': '合计',
+										'storage': _price
+									})
+								}
+								_obj.goodList = results[i]
+								_data.push(_obj)
 							}
 							}
-							_price = _price.toFixed(2)
-							results[i].push({
-								'goodsName': '合计',
-								'storage': _price
-							})
+							console.log(_data)
+							this.costList = _data
 						}
 						}
-						_obj.goodList = results[i]
-						_data.push(_obj)
-					}
-					console.log(_data)
-					this.costList = _data
-				})
+
+					})
+				}
+
 			},
 			},
 			makeGroupData(array, fn) {
 			makeGroupData(array, fn) {
 				const groups = {};
 				const groups = {};
@@ -190,14 +217,15 @@
 </script>
 </script>
 
 
 <style scoped lang="scss">
 <style scoped lang="scss">
-	.active{
+	.active {
 		font-size: 32rpx;
 		font-size: 32rpx;
 		font-weight: 700;
 		font-weight: 700;
 	}
 	}
+
 	.modal-row {
 	.modal-row {
 		display: flex;
 		display: flex;
 		justify-content: space-between;
 		justify-content: space-between;
-		padding: 10rpx 60rpx ;
+		padding: 10rpx 60rpx;
 		margin-top: 20rpx;
 		margin-top: 20rpx;
 		margin-bottom: 20rpx;
 		margin-bottom: 20rpx;
 	}
 	}