Browse Source

录入报告

twt 3 years ago
parent
commit
f2458256fb

+ 1 - 1
operatingCompany/common/request.js

@@ -122,5 +122,5 @@ function refresh(url,date,type,header){
 }
 
 export default {
-	http
+	http,baseUrl
 }

+ 6 - 4
operatingCompany/main.js

@@ -6,12 +6,14 @@ Vue.config.productionTip = false
 
 import request from 'common/request.js'
 import common from 'common/common.js'
-Vue.prototype.$http = request.http
-
+Vue.prototype.$http = request.http
+ import store from './store'
+Vue.prototype.$store = store // 定义成全局组件
 Vue.prototype.$common =common
-
+Vue.prototype.$request =request
 App.mpType = 'app'
-const app = new Vue({
+const app = new Vue({
+	store, //挂载
     ...App
 })
 app.$mount()

+ 16 - 1
operatingCompany/pages.json

@@ -102,10 +102,25 @@
         },
 		{
 			"path": "pages/entryReport/entered",
+			"style": {
+				/* "navigationBarTitleText": "录入报告",
+				"navigationBarBackgroundColor": "#FFFFFF" */
+				/* "enablePullDownRefresh": true */
+				 "navigationStyle": "custom"
+			}
+		},
+		{
+			"path": "pages/entryReport/entryredItem",
 			"style": {
 				"navigationBarTitleText": "录入报告",
 				"navigationBarBackgroundColor": "#FFFFFF"
-				/* "enablePullDownRefresh": true */
+			}
+		},
+		{
+			"path": "pages/entryReport/opinion",
+			"style": {
+				"navigationBarTitleText": "下一步行动建议",
+				"navigationBarBackgroundColor": "#FFFFFF"
 			}
 		}
 		

+ 163 - 12
operatingCompany/pages/entryReport/entered.vue

@@ -1,5 +1,15 @@
 <template>
 	<view class="content">
+	<view class="zdyNav">
+	  <view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
+	  <view class="nav">
+		  <view><image src="../../static/img/baiheiback.png" mode="" class="baiheiback" @click="back"></image></view>
+		  <view >录入报告</view>
+		  <view style="width:70px;"></view>
+	  </view>
+	</view>
+	<view class="status_bar" :style="{height: iStatusBarHeight + 'px'}"></view>
+    <view style="height: 44px;"></view>
 	<view class="paddingBox">
 		<view class="top">
 			<view class="topLine">
@@ -20,19 +30,20 @@
 				</view>
 			</view>
 			<view class="topLine" style="border: none;">
-				<view class="topLineTitle">访问</view>
+				<view class="topLineTitle">访问门店</view>
 				<view class="topLineRIght">
 					<span class="topSpan">{{ShopName}}</span>
 				</view>
 			</view>
 		</view>
 		
-		<view class="kbox" v-for="(v,i) in list">
+		<view class="kbox" v-for="(v,i) in list" >
 			<view class="kboxTitle">{{v.categoryName}}</view>
 			<view class="kboxLineCont">
-				<view class="kline" v-for="(item,index) in v.sectionList">
+				<view class="kline" v-for="(item,index) in v.sectionList" @click="goTx(item,i,index)">
 					<image src="../../static/img/icon_luru@2x.png" mode="" class="klineImg"></image>
-					<view class="klineName">{{item.checkName}}</view>
+					<view class="klineName"> <span class="isRequired" v-show="item.isRequired==1">*</span> {{item.checkName}}</view>
+				    <image v-if="item.check" src="../../static/img/icon_luruhou@2x.png" mode="" class="klineXzImg"></image>
 				</view>
 			</view>
 		</view>
@@ -41,7 +52,7 @@
 	
 	  <view style="height: 150rpx;"></view>
 	  <view class="bottom">
-		  <view class="bottomBtn">完成,填写下一步行动建议</view>
+		  <view class="bottomBtn" @click="goNext">完成,填写下一步行动建议</view>
 	  </view>
 	   
 	</view>
@@ -59,10 +70,22 @@
 				shopId:'',
 				ShopName:'',
 				list:'',
+				iStatusBarHeight:'',
+				packageID:'',
+				packageName:'',
+				sheetID:'',
+			}
+		},
+		onShow() {
+			if(this.$store.state.categoryList){
+				this.list=this.$store.state.categoryList;
+				this.list.splice(1,0)
+				console.log(this.list)
 			}
 		},
 		onLoad(opt) {
           //页面加载初始化生命周期函数
+		   this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
 		   this.userInfo=uni.getStorageSync("userInfo");
 		   this.ShopName=opt.ShopName;
 		   this.shopId=opt.shopId;
@@ -71,12 +94,38 @@
 		   
 		},
 		methods: {
+			back(){
+				var that=this;
+				uni.showModal({
+				    title: '提示',
+				    content: '返回此次填写的内容将不保留,是否返回',
+				    success: function (res) {
+				        if (res.confirm) {
+				          uni.navigateBack({
+				          	delta:1
+				          })
+				        } else if (res.cancel) {
+				           
+				        }
+				    }
+				});
+				
+				
+			},
+			goTx(item,i,index){
+				uni.navigateTo({
+					url:'entryredItem?name='+item.checkName+'&index1='+i+'&index2='+index
+				})
+				
+			},
 			getCheckPackageInfo(){
 				this.$http('accompany/SuperCheckSheet/queryCheckPackageInfo', {
 					shopID:this.shopId
 				}, 'GET').then(res => {
 					this.list=res.data.categoryList;
-					
+					this.packageName=res.data.packageName;
+					this.packageID=res.data.id;
+					this.$store.commit('mutationsCategoryList',this.list)
 				})
 			},
 			bindTimeChange(e){
@@ -98,14 +147,82 @@
 				this.nowDate=timer;
 				return timer;
 			},
-			//自己定义的方法函数
-            goRouter(url){
-				//uni.navigateTo  路由跳转 url 是地址 路由还分为uni.redirectTo switchTab navigateBackreLaunch
-				this.$common.isUserId()
+			goNext(){
+				var go=true;
+				var name='';
+				var categoryList=[]
+				console.log(this.list)
+				this.list.forEach(item=>{
+					var obj={
+						categoryID:item.categoryID,
+						categoryName:item.categoryName,
+						sectionList:[]
+					}
+					item.sectionList.forEach(v=>{
+						if(v.check){
+							var isCheck=1
+						}else{
+							var isCheck=0
+						}
+						var sectionListobj={
+							sectionID:v.sectionID,
+							checkName:v.checkName,
+							checkCycle:v.checkCycle,
+							isCheck:isCheck,
+							isRequired:v.isRequired,
+							itemList:[]
+						}
+						if(v.isRequired==1){
+							if(!v.check){
+								go=false
+								name=v.checkName
+							}
+						}
+						
+						v.itemList.forEach(i=>{
+							var itemObj={
+								itemName:i.itemName,
+								sectionItemID:i.sectionItemID,
+								itemValue:i.itemValue,
+								describe:i.describe,
+								keyType:i.keyType,
+								keyValue:i.keyValue,
+							}
+							sectionListobj.itemList.push(itemObj)
+						})
+						obj.sectionList.push(sectionListobj)
+					})
+						categoryList.push(obj);
+					
+				})
+			
+				console.log('categoryList')
+				console.log(categoryList)
+				if(!go){
+					uni.showToast({
+					    title: '请填写'+name,
+						 icon:'none',
+					    duration: 3000,
+					});
+					return false;
+				}
 				
-				uni.navigateTo({
-					url:url
+				this.$http('accompany/SuperCheckSheet/addSuperCheckSheet', {
+					shopID:this.shopId,
+					shopName:this.ShopName,
+					checkTime:this.date,
+					packageID:this.packageID,
+					packageName:this.packageName,
+					categoryList:JSON.stringify(categoryList)
+				}, 'POST').then(res => {
+					this.sheetID=res.data;
+					console.log(this.sheetID);
+					uni.navigateTo({
+						url:'opinion'
+					})
 				})
+				
+				
 			}
 		},
 		onUnload(){
@@ -191,6 +308,14 @@
 		width: 25%;
 		text-align: center;
 		padding: 20rpx 0;
+		position: relative;
+	}
+	.klineXzImg{
+		width: 28rpx;
+		height: 28rpx;
+		position: absolute;
+		bottom: 60rpx;
+		right: 40rpx;
 	}
 	.klineName{
 		color: #3C3C3C;
@@ -217,4 +342,30 @@
 		margin-top: 24rpx;
 		margin-left: 24rpx;
 	}
+	.isRequired{
+		color: #FF4F00;
+	}
+	.status_bar{
+		background: #FFFFFF;
+	}
+	.nav{
+		width: 100vw;
+		height: 44px;
+		background: #FFFFFF;
+		display: flex;
+		justify-content: space-between;
+		font-size: 34rpx;
+		line-height: 44px;
+	}
+	.baiheiback{
+		width: 70px;
+		height: 44px;
+	}
+	.zdyNav{
+		position: fixed;
+		left: 0;
+		top: 0;
+		background: #FFFFFF;
+		z-index: 11;
+	}
 </style>

+ 341 - 0
operatingCompany/pages/entryReport/entryredItem.vue

@@ -0,0 +1,341 @@
+<template>
+	<view class="content">
+		<view style="height: 20rpx;background: #F4F5F7;"></view>
+		<view class="box">
+			<view class="boxLine" v-for="(item,index) in categoryList[index1].sectionList[index2].itemList">
+				<view class="boxLineTop">
+					<view class="itemName">{{item.itemName}}</view>
+					<view class="store" v-show="item.keyType==4" @click="pickerClick(item)">
+						 <picker @change="bindPickerChange($event)" :value="item.storeIndex" :item="item" :range="item.array">
+						     <view class="pickerView" v-if="item.itemValue!=null">{{item.itemValue}} 分</view>
+							 <view class="pickerView" v-else>请选择</view>
+						 </picker>
+						 <view>
+							 <image src="../../static/img/jiantou.png" mode="" class="storeJtimg"></image>
+						 </view>
+					</view>
+				</view>
+				<view class="boxlinedescribe">{{item.describe}}</view>
+				<view class="itemCklineBox" v-show="item.keyType==1">
+					<view class="itemCkline" :class="{itemckActive:name.check}" @click="itemXx(name)" v-for="(name,nameIndex) in item.array">{{name.name}}</view> 
+					<!-- <view class="itemCkline itemckActive">张杰</view> -->
+				</view>
+				<view class="textareaBox" v-show="item.keyType==2">
+					   <textarea placeholder-style="color:#CCCCCC" placeholder="请输入~" v-model="item.itemValue" class="textareaCont"/>
+				</view>
+				<view class="imgBox" v-show="item.keyType==3">
+					<view class="imgLine" v-for="(img,imgindex) in item.imgArr">
+						<image :class="{img4:(imgindex+1)%4==0}" :src="img" mode="" class="itemImg"></image>
+					    <image src="../../static/img/icon_delpic@2x.png" mode=""  class="delImg"></image>
+					</view>
+					<view class="imgLine" @click="uploadImg(item)">
+						<image src="../../static/img/icon_addpic@2x.png" mode="" class="itemImg"></image>
+					</view>
+				</view>
+			</view>
+		</view>
+		<view style="height: 160rpx;"></view>
+		<view class="bottom">
+		  <view class="bottomBtn" @click="sub">保存</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				pickerindex:null,
+				array:[0,1,2,3,4,5],
+				index1:'',
+				index2:'',
+				categoryList:'',
+				pickerItem:'',
+			}
+		},
+		onLoad(opt) {
+           var name = opt.name;
+		   uni.setNavigationBarTitle({
+		        title: name
+		   })
+		   this.index1=opt.index1;
+		   this.index2=opt.index2;
+		   console.log(this.$store.state.categoryList)
+		   this.categoryList=this.$store.state.categoryList;
+		   this.categoryList[this.index1].sectionList.forEach(v=>{
+			   console.log(v)
+			   if(v.check){
+				   
+			   }else{
+					 v.itemList.forEach((item,index)=>{
+					   
+					   item.itemValue='';
+					   if(item.keyType==4){
+						   var arr=[];
+						  for(var i=0;i<Number(item.keyValue) +1;i++){
+							  arr.push(i)
+						  }
+						   item.array=arr;
+						   item.storeIndex=null;
+						   item.itemValue=null;
+					   }else if(item.keyType==1){
+							item.keyValue=item.keyValue.replace(/,/ig,',')
+							var array= item.keyValue.split(",")
+							var arr=[]
+							array.forEach(name=>{
+								var obj={
+									name:name,
+									check:false
+								}
+								arr.push(obj)
+							})
+							item.array=arr
+					   }else if(item.keyType==3){
+						   item.imgArr=[]
+					   }
+				   })
+			   }
+		   })
+		   /* this.categoryList[this.index1].sectionList[this.index2].itemList.forEach((item,index)=>{
+			   
+			   item.itemValue='';
+			   if(item.keyType==4){
+				   var arr=[];
+				  for(var i=0;i<Number(item.keyValue) +1;i++){
+					  arr.push(i)
+				  }
+				   item.array=arr;
+				   item.storeIndex=null;
+				   item.itemValue=null;
+			   }else if(item.keyType==1){
+				    item.keyValue=item.keyValue.replace(/,/ig,',')
+					var array= item.keyValue.split(",")
+					var arr=[]
+					array.forEach(name=>{
+						var obj={
+							name:name,
+							check:false
+						}
+						arr.push(obj)
+					})
+					item.array=arr
+			   }else if(item.keyType==3){
+				   item.imgArr=[]
+			   }
+		   }) */
+		    console.log(this.categoryList);
+		},
+		methods: {
+			bindPickerChange(e){
+				console.log(e)
+				this.pickerItem.itemValue=e.detail.value;
+				console.log(this.categoryList);
+				this.categoryList.splice(1,0)
+			},
+			pickerClick(item){
+				this.pickerItem=item
+			},
+			itemXx(name){
+				console.log(name)
+				name.check=!name.check;
+				this.categoryList.splice(1,0)
+			},
+			uploadImg(item){
+				var that=this;
+				console.log(item)
+				var length=item.imgArr.length;
+				if(length==10){
+					uni.showToast({
+					    title: '最多上传10张',
+						 icon:'none',
+					    duration: 2000,
+					});
+					return false;
+				}
+				
+				var num=10-length;
+				uni.chooseImage({
+					sourceType: ['album'],
+					count:num, 
+				    success: (chooseImageRes) => {
+				        const tempFilePaths = chooseImageRes.tempFilePaths;
+				        uni.uploadFile({
+				            url: that.$request.baseUrl+'accompany/SuperCheckSheet/uploadFile', //仅为示例,非真实的接口地址
+				            filePath: tempFilePaths[0],
+				            name: 'file',
+				            formData: {
+				                'user': 'test'
+				            },
+				            success: (uploadFileRes) => {
+				                console.log(JSON.parse(uploadFileRes.data).data );
+								item.imgArr=item.imgArr.concat(JSON.parse(uploadFileRes.data).data) ;
+								that.categoryList.splice(1,0)
+				            }
+				        }); 
+						/* that.$http('accompany/SuperCheckSheet/uploadFile', tempFilePaths[0], 'POST').then(res => {
+							
+						}) */
+				    }
+				});
+			},
+			sub(){
+				console.log(this.categoryList);
+				var go=true;
+				this.categoryList[this.index1].sectionList[this.index2].itemList.forEach(item=>{
+					if(item.keyType==3){
+						item.itemValue=item.imgArr.join(',');
+						console.log(item.itemValue)
+					}else if(item.keyType==1){
+						var arr=[]
+						item.array.forEach(name=>{
+							
+							if(name.check){
+								arr.push(name.name)
+							}
+						})
+						item.itemValue=arr.join(',');
+					}
+					if(item.itemValue==0){
+						
+					}else if(item.itemValue==''){
+						go=false
+					}
+				})
+				console.log(this.categoryList[this.index1].sectionList[this.index2].itemList)
+				if(!go){
+					uni.showToast({
+					    title: '每一项都是必填,请填写完成',
+						 icon:'none',
+					    duration: 3000,
+					});
+					return false;
+				}
+				this.categoryList[this.index1].sectionList[this.index2].check=true;
+				uni.navigateBack({
+					delta:1
+				}) 
+				this.$store.commit('mutationsCategoryList',this.categoryList)
+			}
+		}
+	}
+</script>
+
+<style scoped>
+	.content{
+		 background: #F4F5F7;
+		 min-height: 100vh;
+		
+	}
+	/* #ifdef H5 */
+		.content{
+			 background: #F4F5F7;
+			 min-height:calc(100vh - 44px);
+			
+		}
+	/* #endif */
+	.boxLine{
+		padding: 30rpx 20rpx;
+		background: #FFFFFF;
+		border-bottom: 1px solid #EEEEEE;
+	}
+	.boxLineTop{
+		display: flex;
+		justify-content: space-between;
+	}
+	.store{
+		color: #FF4F00;font-size: 30rpx;
+	}
+	.storeJtimg{
+		width: 14rpx;
+		height: 26rpx;
+		margin-top: 8rpx;
+		margin-left: 10rpx;
+	}
+	.store{
+		display: flex;
+	}
+	.itemName{
+		color: #3C3C3C;font-size: 30rpx;font-weight: 600;
+	}
+	.boxlinedescribe{
+		color: #999999;
+		font-size: 26rpx;
+		padding-top: 10rpx;
+	}
+	.itemCklineBox{
+		display: flex;
+		flex-wrap: wrap;
+		padding-top: 20rpx;
+	}
+	.itemCkline{
+		height: 56rpx;
+		background: #F4F5F7;
+		border-radius: 28rpx;
+		line-height: 56rpx;
+		padding: 0 40rpx;
+		font-size: 28rpx;
+		color: #333333;
+		margin-right: 30rpx;
+	}
+	.itemckActive{
+		background: #FF4F00;color: #FFFFFF;
+	}
+	.textareaCont{
+		width: 670rpx;
+		height: 120rpx;
+		background: #F4F5F7;
+		border-radius: 10rpx;
+		padding: 28rpx 20rpx;
+		font-size: 28rpx;
+		color: #3C3C3C;
+	}
+	.textareaBox{
+		padding-top: 20rpx;
+	}
+	.imgBox{
+		padding-top: 20rpx;
+		display: flex;
+		flex-wrap: wrap;
+		
+	}
+	.itemImg{
+		width:150rpx;
+		height: 150rpx;
+		margin-right: 35rpx;
+		margin-top: 30rpx;
+	}
+	.img4{
+		margin-right: 0;
+	}
+	.delImg{
+		width: 32rpx;
+		height: 32rpx;
+		position: absolute;
+		left: 135rpx;
+		top: 10rpx;
+	}
+	.imgLine{
+		position: relative;
+	}
+	.bottom{
+		width: 750rpx;
+		height: 120rpx;
+		background: #FFFFFF;
+		box-shadow: 0px -4px 8px 0px rgba(153,153,153,0.08);
+		position: fixed;
+		left: 0;
+		bottom: 0;
+	}
+	.bottomBtn{
+		width: 702rpx;
+		height: 74rpx;
+		background: linear-gradient(124deg, #FF8700 0%, #FF4F00 100%);
+		border-radius: 37rpx;
+		text-align: center;
+		line-height: 74rpx;
+		color: #FFFFFF;
+		font-size:30rpx;
+		margin-top: 24rpx;
+		margin-left: 24rpx;
+	}
+</style>

+ 39 - 0
operatingCompany/pages/entryReport/opinion.vue

@@ -0,0 +1,39 @@
+<template>
+	<view class="content">
+		
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				
+			}
+		},
+		onLoad() {
+          //页面加载初始化生命周期函数
+		  
+		},
+		methods: {
+			//自己定义的方法函数
+           
+		}
+	}
+</script>
+
+<style scoped>
+	.content{
+		 background: #F4F5F7;
+		 min-height: 100vh;
+		
+	}
+	/* #ifdef H5 */
+		.content{
+			 background: #F4F5F7;
+			 min-height:calc(100vh - 44px);
+			
+		}
+	/* #endif */
+	
+</style>

BIN
operatingCompany/static/img/icon_addpic@2x.png


BIN
operatingCompany/static/img/icon_delpic@2x.png


+ 25 - 0
operatingCompany/store/index.js

@@ -0,0 +1,25 @@
+ import Vue from 'vue'
+ import Vuex from 'vuex'
+
+Vue.use(Vuex)
+const store = new Vuex.Store({
+    state: {
+		categoryList:'',
+	},
+	getters:{
+		gettersCategoryList(state){
+			return state.categoryList
+	   }
+    },
+    mutations: {
+		mutationsCategoryList(state,data){
+			state.categoryList=data
+		}
+	},
+    actions: {
+		actionsCategoryList(context,playload){
+			context.commit('mutationsCategoryList',playload)
+		}
+	}
+})
+export default store