zhangdan 4 年 前
コミット
ae9b144aeb

+ 1 - 1
App.vue

@@ -1,6 +1,6 @@
 <script>
 	// const uat_domain = 'https://lese.test.sxzxyj.net' // 预发布
-	const uat_domain = 'http://192.168.16.177:8305' // 本地
+	const uat_domain = 'http://192.168.16.221:8305' // 本地
 	const pro_domain = 'https://lese.sxzxyj.net' // 生产
 	const uat_URL = uat_domain+'/gc-gather/' // 预发布
 	const pro_URL = pro_domain+'/gc-shop/'  // 生产

+ 26 - 8
api/index.js

@@ -1,17 +1,35 @@
-import axios from '@/libs/axios.js';
+import axios from '@/libs/axios.js'
 // 新增采集信息
-export const gatherSave = (params) => {
+export const gatherList = params => {
   return axios.request({
-    url: `gather/save`,
-    method: 'POST',
+    url: `gather/query/${params.pageNo}/${params.pageSize}`,
+    method: 'post',
 	data: params
   })
 }
-// 查询采集信息
-export const gatherQuery = (params) => {
+
+// 查询采集信息详情
+export const gatherDetail = (params) => {
   return axios.request({
-    url: `gather/save`,
-    method: 'POST',
+    url: `gather/findById/${params.id}`,
+    method: 'get',
+  })
+}
+
+// 采集信息总计
+export const gatherTotal = (params) => {
+  return axios.request({
+    url: `gather/queryListSum`,
+    method: 'post',
 	data: params
   })
+}
+
+// 保存采集信息详情
+export const gatherSave = (params) => {
+  return axios.request({
+    url: `gather/save`,
+    method: 'post',
+	data:params
+  })
 }

+ 2 - 1
components/uni-popup/uni-popup-dialog.vue

@@ -181,7 +181,7 @@
 
 	.uni-dialog-content-text {
 		font-size: 14px;
-		color: #6e6e6e;
+		color: #222;
 	}
 
 	.uni-dialog-button-group {
@@ -214,6 +214,7 @@
 
 	.uni-dialog-button-text {
 		font-size: 14px;
+		color:#A6A6A6
 	}
 
 	.uni-button-color {

+ 28 - 4
pages/index/addData.vue

@@ -50,8 +50,8 @@
 <script>
 	import uniPopup from '@/components/uni-popup/uni-popup.vue'
 	import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'
-	import {gatherSave} from '@/api/index.js'
-	import {numberToFixed} from '@/libs/tools.js'
+	import {gatherSave,gatherDetail} from '@/api/index.js'
+	import {numberToFixed,saveImgToAliOss} from '@/libs/tools.js'
 	export default {
 		components: {
 			uniPopup,uniPopupDialog
@@ -67,7 +67,8 @@
 					gatherNum_jianzhu: '', // 建筑垃圾
 					remarks: '' // 备注
 				},
-				isView: false // 是否是查看详情
+				isView: false ,// 是否是查看详情
+				itemId:''
 			};
 		},
 		onLoad(option) {
@@ -75,6 +76,8 @@
 			// 查看
 			if(option && option.id){
 				this.isView = true
+				this.itemId=option.id
+				this.getDetailData()
 			}else {
 				console.log('--------新增')
 				this.photograph = []
@@ -93,6 +96,22 @@
 			  	this.form[key] = ret
 			  })
 			},
+			// 获取详情数据
+			getDetailData(){
+				gatherDetail({id:this.itemId}).then(res=>{
+					if(res.status==200){
+						console.log(res)
+						const a = res.data.gatherRubbishList.find(item=>item.rubbishType=='GATHER_BUILDING')
+						const b = res.data.gatherRubbishList.find(item=>item.rubbishType=='GATHER_OTHER')
+						const c = res.data.gatherRubbishList.find(item=>item.rubbishType=='GATHER_KITCHEN')
+						this.form.gatherNum_jianzhu= a ? a.gatherNum : '0'
+						this.form.gatherNum_chuyu= b ? b.gatherNum : '0'
+						this.form.gatherNum_other= c ? c.gatherNum : '0'
+						this.form.remarks=res.data.remarks
+						this.photograph=res.data.imageUrlList || []
+					}
+				})
+			},
 			// 拍照或从相册选图片
 			goPhotograph() {
 				uni.chooseImage({
@@ -103,6 +122,11 @@
 				        console.log(JSON.stringify(res.tempFilePaths));
 						this.photograph = this.photograph.concat(res.tempFilePaths) 
 						console.log(this.photograph.length,'this.photograph')
+						saveImgToAliOss(res.tempFilePaths,function(ret){
+							console.log(ret,'----------ret')
+							_this.photograph = ret.data
+							uni.hideLoading()
+						})
 				    }
 				});
 			},
@@ -121,7 +145,7 @@
 			},
 			// 提交
 			submit(){
-				if(!this.form.gatherNum_other && !this.form.gatherNum_chuyu && !this.form.gatherNum_jianzhu) {
+				if((!this.form.gatherNum_other ||this.form.gatherNum_other==0)  && (!this.form.gatherNum_chuyu || this.form.gatherNum_chuyu==0) && (!this.form.gatherNum_jianzhu || this.form.gatherNum_jianzhu==0)) {
 					uni.showToast({
 						title: '请至少输入一项垃圾分类的数量!',
 						icon: 'none'

+ 32 - 11
pages/index/index.vue

@@ -5,6 +5,7 @@
 				<text>{{searchForm.beginDate}}至{{searchForm.endDate}}</text>
 				<u-image v-if="hasLogin" @click="openScreen=true" class="filter-img" width="36rpx" height="36rpx" src="/static/filter.png"></u-image>
 			</view>
+			<!-- 总计 -->
 			<view class="header-cont">
 				<view class="cont-item">
 					<text>其它垃圾</text>
@@ -28,25 +29,28 @@
 			<view class="cell-item" v-for="item in listdata">
 				<view class="cell-item-title" >
 					<view>
-						<text>2020-02-23 15:12:30</text>
+						<text>{{item.createDate}}</text>
 					</view>
-					<view @click="intoPage()">
+					<view @click="intoPage(item)">
 						<span class="view">查看详情</span>
 						<u-icon name="arrow-right" color="#999999" size="28"></u-icon>
 					</view>
 				</view>
 				<view class="cell-item-cont">
+					<!-- 其他垃圾 -->
 					<view class="cont-item">
 						<u-image src="/static/index/other.png"></u-image>
-						<text>1000kg</text>
+						<text>{{item.gatherOther? (item.gatherOther/1000).toFixed(3)/1 :0}}kg</text>
 					</view>
+					<!-- 建筑垃圾 -->
 					<view class="cont-item">
 						<u-image src="/static/index/jianzhu.png"></u-image>
-						<text>1000kg</text>
+						<text>{{item.gatherBuilding ? (item.gatherBuilding/1000).toFixed(3)/1 :0}}kg</text>
 					</view>
+					<!-- 厨余垃圾 -->
 					<view class="cont-item">
 						<u-image src="/static/index/chuyu.png"></u-image>
-						<text>1000kg</text>
+						<text>{{item.gatherKitchen ? (item.gatherKitchen/1000).toFixed(3)/1 :0}}kg</text>
 					</view>
 				</view>
 			</view>
@@ -68,7 +72,7 @@
 
 <script>
 	import searchModal from './searchModal.vue'
-	import {gatherQuery} from '@/api/index.js'
+	import {gatherList,gatherTotal} from '@/api/index.js'
 	import { checkLogin } from '@/api/login.js'
 	import moment from 'moment'
 	import getDate from '@/libs/getDate.js'
@@ -128,6 +132,7 @@
 				this.searchForm.endDate = getDate.getRecentday().endtime
 				console.log(this.searchForm,'this.searchForm')
 				this.searchHandle()
+				this.getTotal()
 			},
 			// 获取查询参数 刷新列表
 			refresh(params){
@@ -135,16 +140,17 @@
 				this.listdata = []
 				this.total = 0
 				this.searchHandle(1)
+				this.getTotal()
 			},
 			// 搜索查询
 			searchHandle (pageNo) {
 				this.status = "loading"
 				pageNo ? this.pageNo = pageNo : null
-				gatherQuery({
+				gatherList({
 					pageNo: this.pageNo,
 					pageSize: this.pageSize,
-					beginDate: this.searchForm.beginDate,
-					endDate: this.searchForm.endDate,
+					beginDate: this.searchForm.beginDate+' 00:00:00',
+					endDate: this.searchForm.endDate+' 23:59:59',
 				}).then(res => {
 					if (res.status == 200) {
 						if(this.pageNo>1){
@@ -168,14 +174,29 @@
 				console.log(111111)
 				if(this.listdata.length < this.total){
 					this.pageNo += 1
-					// this.searchHandle()
+					this.searchHandle()
 				}else{
 					uni.showToast({ title: '已经到底了', icon: 'none' })
 					this.status = "nomore"
 				}
 			},
+			// 总计
+			getTotal(){
+				gatherTotal({
+					beginDate: this.searchForm.beginDate,
+					endDate: this.searchForm.endDate}).then(res=>{
+						if(res.status==200){
+							this.otherTotal=res.data.GATHER_OTHER ? (res.data.GATHER_OTHER/1000).toFixed(3)/1:0
+							this.jianzhuTotal=res.data.GATHER_BUILDING ? (res.data.GATHER_BUILDING/1000).toFixed(3)/1:0
+							this.chuyuTotal=res.data.GATHER_KITCHEN? (res.data.GATHER_KITCHEN/1000).toFixed(3)/1:0
+						}
+					console.log(res)
+				})
+			},
 			// 打开垃圾数据录入页面
-			intoPage(flag) {
+			intoPage(item) {
+				const flag=item ? item.gatherId : ''
+				console.log(flag,'---------hangid,;;;;')
 				let url = flag ? `/pages/index/addData?id=${flag}` : `/pages/index/addData`
 				// uni.navigateTo({
 				//     url: url

+ 6 - 4
pages/login/login.vue

@@ -11,7 +11,7 @@
 						微信授权登录
 					</u-button>
 					<u-gap height="30"></u-gap>
-					<u-button shape="circle" :custom-style="phoneButton" class="login-btn" @click="phoneLogin" type="primary">
+					<u-button shape="circle" :custom-style="phoneButton" class="login-btn phoneBtn" @click="phoneLogin" :hoverClass='none'>
 						账号密码登录
 					</u-button>
 				</view>
@@ -43,7 +43,6 @@
 				phoneButton: {
 					background: '#fff',
 					color:'#000',
-					border: '1px solid #BBBBBB'
 				}
 			}
 		},
@@ -172,8 +171,11 @@
 		.login-btn{
 			display: block;
 			width: 670upx;
-			height: 100upx;
-			border-radius: 50upx;
+			height: 80upx;
+		}
+		.phoneBtn:active{
+			background: #fff ;
+			outline: none;
 		}
 		.nologin{
 			text-align: center;

+ 5 - 5
pages/userCenter/changePwd.vue

@@ -17,10 +17,10 @@
 				</view>
 			</view>
 		</view>
-		<!-- 消息提醒弹窗 -->
+		<!-- 按钮 -->
 		<view class="form-footer-btn">
-			<u-button size="medium" hover-class="none" @click="handleReset">重置</u-button>
-			<u-button size="medium" hover-class="none" :loading="loading" :custom-style="customBtnStyle" @click="handleSubmit">保存</u-button>
+			<u-button size="medium" hover-class="none" shape="circle" @click="handleReset">重置</u-button>
+			<u-button size="medium" hover-class="none" shape="circle" :loading="loading" :custom-style="customBtnStyle" @click="handleSubmit">保存</u-button>
 		</view>
 	</view>
 </template>
@@ -43,8 +43,8 @@
 				},
 				loading: false,
 				customBtnStyle: {  //  自定义按钮样式
-					borderColor: '#2ab4e5',
-					backgroundColor: '#2ab4e5',
+					borderColor: '#0DC55F',
+					backgroundColor: '#0DC55F',
 					color: '#fff'
 				},
 			}