1004749546@qq.com 4 lat temu
rodzic
commit
c59e129ea1

+ 0 - 10
api/banner.js

@@ -1,10 +0,0 @@
-import axios from '@/libs/axios.js';
-
-// 轮播图
-export const bannerList = params => {
-  return axios.request({
-    url: `advert/findByType/${params.type}/${params.location}`,
-    method: 'get',
-	data: {}
-  })
-};

+ 0 - 46
api/coupon.js

@@ -1,46 +0,0 @@
-import axios from '@/libs/axios.js';
-// 确认领取优惠券
-export const receivesCoupon = (params) => {
-	return axios.request({
-		url: `couponReceives/receivesCoupon`,
-		method: 'post',
-		data: params
-	})
-}
-
-// 根据券码查询优惠券信息
-export const couponData = (params) => {
-	return axios.request({
-		url: `coupon/findByCode/${params.couponCode}`,
-		method: 'get'
-	})
-}
-
-// 优惠券领取明细查询
-export const couponListFind = (params) => {
-	let url = `couponReceives/findPage/${params.pageNo}/${params.pageSize}`
-	delete params.pageNo
-	delete params.pageSize
-	return axios.request({
-		url: url,
-		method: 'post',
-		data: params
-	})
-}
-// 订单可用优惠券查询
-export const couponEnable = (params) => {
-	return axios.request({
-		url: 'couponReceives/findUsableCoupon',
-		method: 'post',
-		data: params
-	})
-}
-
-//  礼品卡   立即充值
-export const giftCardUseCard = (params) => {
-	return axios.request({
-		url: `giftCard/useCard/${params.sequence}`,
-		method: 'post',
-		data: {}
-	})
-}

+ 0 - 10
api/deliveryRecord.js

@@ -1,10 +0,0 @@
-import axios from '@/libs/axios.js';
-
-// 列表
-export const getDeliveryLogList = params => {
-  return axios.request({
-    url: `deliveryLog/query/${params.pageNo}/${params.pageSize}`,
-    method: 'post',
-	data: params
-  })
-};

+ 0 - 27
api/goods.js

@@ -1,27 +0,0 @@
-import axios from '@/libs/axios.js';
-
-// 获取商品分类
-export const getGoodsClass = params => {
-  return axios.request({
-    url: `goodsType/queryList`,
-    method: 'post',
-	data: params
-  })
-};
-
-// 获取商品列表
-export const getGoodsList = params => {
-  return axios.request({
-    url: `goods/query/${params.pageNo}/${params.pageSize}`,
-    method: 'post',
-	data: params
-  })
-};
-
-// 获取商品详情
-export const getGoodsDetail = params => {
-  return axios.request({
-    url: `goods/findById/${params.id}`,
-    method: 'get',
-  })
-};

+ 17 - 0
api/index.js

@@ -0,0 +1,17 @@
+import axios from '@/libs/axios.js';
+// 新增采集信息
+export const gatherSave = (params) => {
+  return axios.request({
+    url: `gather/save`,
+    method: 'POST',
+	data: params
+  })
+}
+// 查询采集信息
+export const gatherQuery = (params) => {
+  return axios.request({
+    url: `gather/save`,
+    method: 'POST',
+	data: params
+  })
+}

+ 7 - 0
api/login.js

@@ -40,3 +40,10 @@ export const getUserInfo = params => {
     method: 'get'
   })
 };
+export const loginPhone = params => {
+  return axios.request({
+    url: `loginPhone`,
+    method: 'post',
+	data: params
+  },true)
+};

+ 0 - 70
api/luckyDraw.js

@@ -1,70 +0,0 @@
-import axios from '@/libs/axios.js';
-// 获取是否有转盘
-export const findEnable = params => {
-  return axios.request({
-    url: `luckyDraw/findEnable`,
-    method: 'get',
-  })
-};
-// 抽奖takeOut
-export const takeOut = params => {
-  return axios.request({
-    url: `luckyDraw/takeOut/${params.id}`,
-    method: 'get',
-  })
-};
-// 获取免费抽奖次数
-export const findCustomerTimes = params => {
-  return axios.request({
-    url: `luckyDrawCust/findCustomerTimes/${params.id}`,
-    method: 'get',
-  })
-};
-// 获取任务列表
-export const findCustomerTask = params => {
-  return axios.request({
-    url: `luckyDrawCust/findCustomerTask/${params.id}`,
-    method: 'get',
-  })
-};
-// 购买抽奖次数
-export const buyDrawTimes = params => {
-  return axios.request({
-    url: `luckyDrawCust/buyDrawTimes`,
-    method: 'post',
-	data: params
-  })
-};
-// 获取已中奖列表
-export const findWinPrize = params => {
-  return axios.request({
-    url: `luckyDrawCust/findWinPrize`,
-    method: 'get',
-  })
-};
-
-// 领奖
-export const receive = params => {
-  return axios.request({
-    url: `luckyDrawCust/receive`,
-    method: 'post',
-	data: params
-  })
-};
-
-// 获奖记录
-export const queryWinRecord = params => {
-  return axios.request({
-    url: `luckyDraw/queryWinRecord/${params.pageNo}/${params.pageSize}`,
-    method: 'post',
-	data: params
-  })
-};
-
-// 抽奖任务
-export const doTask = params => {
-  return axios.request({
-    url: `luckyDrawCust/doTask/${params.luckyDrawNo}/${params.taskCode}`,
-    method: 'get',
-  })
-};

+ 0 - 116
api/order.js

@@ -1,116 +0,0 @@
-import axios from '@/libs/axios.js';
-
-// 获取网点下的服务项目
-export const getStoreItems = params => {
-  return axios.request({
-    url: `item/storeItems/?storeId=${params.storeId}`,
-    method: 'get',
-  })
-};
-// 查看用户是否设置过支付密码
-export const existPayPwd = params => {
-  return axios.request({
-    url: `customer/existPayPwd`,
-    method: 'get',
-  })
-};
-// 校验短信验证码是否正确
-export const checkCode = params => {
-  return axios.request({
-    url: `customer/checkVerificationCode`,
-	data: params,
-    method: 'post',
-  })
-};
-// 设置支付密码
-export const setPayPwd = params => {
-  return axios.request({
-    url: `customer/setPayPassword`,
-	data: params,
-    method: 'post',
-  })
-};
-// 校验原密码是否正确
-export const checkPayPwd = params => {
-  return axios.request({
-    url: `customer/checkPayPwd`,
-	data: params,
-    method: 'post',
-  })
-};
-
-// 修改支付密码
-export const changePayPwd = params => {
-  return axios.request({
-    url: `customer/updatePayPwd`,
-	data: params,
-    method: 'post',
-  })
-};
-
-// 下单 保存订单
-export const saveOrder = params => {
-  return axios.request({
-    url: `order/addOrder`,
-    method: 'post',
-	data: params
-  })
-};
-
-// 下单 预支付
-export const signPay  = params => {
-  return axios.request({
-    url: `order/payOrder`,
-    method: 'post',
-    data: params
-  })
-};
-
-// 我的订单
-export const getOrderList = params => {
-	let url = `order/queryPage/${params.pageNo}/${params.pageSize}`
-	delete params.pageNo
-	delete params.pageSize
-	return axios.request({
-		url: url,
-		method: 'post',
-		data: params
-	})
-};
-// 订单详情
-export const orderDetail = params => {
-  return axios.request({
-    url: `order/findById/${params.id}`,
-    method: 'get',
-  })
-};
-
-// 查询物流
-export const queryOrderExpress = params => {
-	return axios.request({
-	  url: `orderExpress/findByOrderNo/${params.orderSn}`,
-	  method: 'get',
-	})
-}
-// 确认收货
-export const finishOrder = params => {
-	return axios.request({
-	  url: `orderExpress/finishOrderExpress`,
-	  method: 'post',
-	  data: params
-	})
-}
-// 查物流下商品信息
-export const queryOrderGoods = params => {
-	return axios.request({
-	  url: `orderGoods/findByExpressNo/${params.id}`,
-	  method: 'get',
-	})
-}
-// 取消订单
-export const cancleOrder = params => {
-	return axios.request({
-	  url: `order/cancel/${params.id}`,
-	  method: 'get',
-	})
-}

+ 0 - 35
api/receiveAddress.js

@@ -1,35 +0,0 @@
-import axios from '@/libs/axios.js';
-
-// 根据客户编号查找收货地址
-export const findAddressBycustomerNo = params => {
-  return axios.request({
-    url: `receiveaddress/findBycustomerNo`,
-    method: 'get'
-  })
-};
-
-// 收货地址删除
-export const deleteAddress = params => {
-  return axios.request({
-    url: `receiveaddress/delete/${params.id}`,
-    method: 'get'
-  })
-};
-
-// 收货地址列表查询(不分页)
-export const getAddressList = params => {
-  return axios.request({
-    url: `receiveaddress/querylist`,
-    method: 'post',
-	data: params
-  })
-};
-
-// 收货地址保存
-export const saveAddress = params => {
-  return axios.request({
-    url: `receiveaddress/save`,
-    method: 'post',
-	data: params
-  })
-};

+ 0 - 36
api/shoppingCart.js

@@ -1,36 +0,0 @@
-import axios from '@/libs/axios.js';
-
-// 添加商品到购物车
-export const addGoodsToCart = params => {
-  return axios.request({
-    url: `shoppingCart/addGoods`,
-    method: 'post',
-	data: params
-  })
-};
-
-// 从购物车删除商品
-export const deleteGoodsFormCart = params => {
-  return axios.request({
-    url: `shoppingCart/deleteGoods`,
-    method: 'post',
-	data: params
-  })
-};
-
-// 查询购物车列表
-export const getCartList = params => {
-  return axios.request({
-    url: `shoppingCart/queryList`,
-    method: 'post',
-	data: params
-  })
-};
-
-// 更新商品购买数量
-export const updateGoodsBuyQty = params => {
-  return axios.request({
-    url: `shoppingCart/updateGoodsBuyQty/${params.id}/${params.buyQty}`,
-    method: 'get'
-  })
-};

+ 0 - 24
api/station.js

@@ -1,24 +0,0 @@
-import axios from '@/libs/axios.js';
-
-// 获取首页网点列表
-export const stationList = params => {
-  return axios.request({
-    url: `station/query`,
-    method: 'post',
-	data: params
-  })
-}
-// 网点详情
-export const stationDetail = params => {
-  return axios.request({
-    url: `station/findById/${params.id}`,
-    method: 'get'
-  })
-}
-// 查询网点的设备列表
-export const stationDevice = params => {
-  return axios.request({
-    url: `device/findById/${params.stationNo}`,
-    method: 'get'
-  })
-}

+ 0 - 42
api/store.js

@@ -1,42 +0,0 @@
-import axios from '@/libs/axios.js';
-
-// 获取首页网点列表
-export const getMapStoreList = params => {
-  return axios.request({
-    url: `store/findList`,
-    method: 'post',
-	data: params
-  },true)
-};
-
-// 获取网点列表
-export const getStoreList = params => {
-  return axios.request({
-    url: `store/findSortList`,
-    method: 'post',
-	data: params
-  })
-};
-// 获取网点详情
-export const getStoreDetail = params => {
-  return axios.request({
-    url: `store/findDetail`,
-    method: 'post',
-	data: params
-  })
-};
-// 获取当前排队情况照片
-export const getWaitPhoto = params => {
-  return axios.request({
-    url: `device/image/${params.deviceNo}`,
-    method: 'get'
-  })
-};
-
-// 查看网点营业状态
-export const getStoreStatus = params => {
-  return axios.request({
-    url: `store/validateStoreAndDevice?storeId=${params.storeId}&deviceNo=${params.deviceNo}`,
-    method: 'get'
-  })
-};

+ 1 - 7
api/user.js

@@ -16,13 +16,7 @@ export const sendVerifyCode = params => {
     data: params
   }, true)
 }
-export const loginPhone = params => {
-  return axios.request({
-    url: `loginPhone`,
-    method: 'post',
-	data: params
-  },true)
-};
+
 // 乐豆使用明细
 export const ldUsedQuery = params => { 
   let url = `customerGoldLog/queryByMonth/${params.pageNo}/${params.pageSize}`

+ 10 - 0
libs/getDate.js

@@ -22,6 +22,16 @@ export default {
     obj.endtime = moment(moment().add(-1, 'days').endOf('day').valueOf()).format('YYYY-MM-DD')
     return obj
   },
+  //  近7天
+  getRecentday () {
+    const obj = {
+      starttime: '',
+      endtime: ''
+    }
+    obj.starttime = moment().subtract('days', 6).format('YYYY-MM-DD')
+    obj.endtime = moment(moment().valueOf()).format('YYYY-MM-DD')
+    return obj
+  },
   // 获取当前周的开始到当天结束时间
   getCurrWeekDays () {
     const obj = {

+ 22 - 0
libs/tools.js

@@ -24,6 +24,28 @@ export function parseQueryString(url) {
     }
     return obj;
 }
+// 保存图片到阿里云
+export const saveImgToAliOss = function(src,callback){
+	console.log(src,getApp().globalData.baseUrl,'getApp().globalData.baseUrl')
+	uni.uploadFile({
+		url: getApp().globalData.baseUrl + 'upload', //自行修改各自的对应的接口 
+		filePath: src,
+		name: 'file',
+		success: (uploadFileRes) => {
+			if (uploadFileRes) {
+				let res = JSON.parse(uploadFileRes.data);
+				callback(res)
+			}
+			uni.showToast({
+				icon: 'none',
+				title: uploadFileRes ? '保存图片成功' : '保存图片失败'
+			})
+		},
+		fail:(error) => {
+			console.log(error)
+		}
+	});
+}
 
 
   

+ 130 - 153
pages/index/addData.vue

@@ -2,50 +2,55 @@
 	<view class="content">
 		<view>
 			<view class="form-data">
-					<u-form :model="form" ref="uForm" :label-width="140" :error-type="['toast']">
-							<u-form-item label="其他垃圾:" >
-								<u-input placeholder="请输入" :maxlength="30" v-model="form.receiverName" />
-								<text slot="right" style="color: #000000;">桶(约{{125}}kg)</text>
-							</u-form-item>
-							<u-form-item label="厨余垃圾:" >
-								<u-input placeholder="请输入" :maxlength="11" type="number" v-model="form.receiverPhone" />
-								<text slot="right" style="color: #000000;">桶(约{{125}}kg)</text>
-							</u-form-item>
-							<u-form-item label="建筑垃圾:" >
-								<u-input placeholder="请输入" :maxlength="11" type="number" v-model="form.receiverPhone" />
-								<text slot="right" style="color: #000000;">吨(约{{125}}kg)</text>
-							</u-form-item>
-					</u-form>
-				</view>
-				<view class="form-data remark">
-					<text>信息备注</text>
-					<textarea :auto-height="true" :maxlength="500" v-model="form.receiveAddress" class="receiveAddress"/>
-				</view>
-				<view class="form-data qyImg">
-					<text>清运照片</text>
-					<view class="info-main">
-						<view class="photograph-con">
-							<u-icon v-show="photograph" name="close-circle-fill" color="#fa3534" size="50" class="close-circle-icon" @click="cancelPhotograph"></u-icon>
-							<u-icon v-show="!photograph" name="camera" color="#bfbfbf" size="60" class="photograph-icon"></u-icon>
-							<!-- <u-image src="/static/camera.png"></u-image> -->
-							<u-image v-show="photograph" width="100%" height="100%" :src="photograph" @click="previewPictures"></u-image>
+				<u-form :model="form" ref="uForm" :label-width="140" :error-type="['toast']">
+						<u-form-item prop="gatherNum_other" label="其他垃圾:" >
+							<u-input :disabled="isView" type="number" placeholder="请输入" v-model="form.gatherNum_other" />
+							<text slot="right" style="color: #000000;">桶(约{{form.gatherNum_other*240}}kg)</text>
+						</u-form-item>
+						<u-form-item prop="gatherNum_chuyu" label="厨余垃圾:" >
+							<u-input :disabled="isView" placeholder="请输入" type="number" v-model="form.gatherNum_chuyu" />
+							<text slot="right" style="color: #000000;">桶(约{{form.gatherNum_chuyu*240}}kg)</text>
+						</u-form-item>
+						<u-form-item prop="gatherNum_jianzhu" label="建筑垃圾:" >
+							<u-input :disabled="isView" placeholder="请输入" type="number" v-model="form.gatherNum_jianzhu" />
+							<text slot="right" style="color: #000000;">吨(约{{form.gatherNum_jianzhu*1000}}kg)</text>
+						</u-form-item>
+				</u-form>
+			</view>
+			<view class="form-data remark">
+				<text>信息备注</text>
+				<textarea :disabled="isView" :auto-height="true" :maxlength="500" v-model="form.remark" class="receiveAddress"/>
+			</view>
+			<view class="form-data qyImg">
+				<text>清运照片</text>
+				<view class="info-main">
+					<view v-if="photograph.length<3" class="camera-btn">
+						<view @click="goPhotograph" class="photograph-camera">
+							<u-icon name="camera" color="#bfbfbf" size="60" ></u-icon>
+						</view>
+						<view >
+							(最多3张)
 						</view>
 					</view>
+					<view v-show="photograph.length" v-for="(item,index) in photograph" :key="index" class="photograph-con">
+						<u-icon v-show="!isView" name="close-circle-fill" color="#fa3534" size="50" class="close-circle-icon" @click="cancelPhotograph(index)"></u-icon>
+						<u-image width="100%" height="100%" :src="item" @click="previewPictures(item)"></u-image>
+					</view>
 				</view>
-			<u-button  @click="open" class="submitBtn" type="success" shape="circle">提交</u-button>
+			</view>
+			<u-button v-if="isView" @click="isView = false" class="submitBtn" type="waring" shape="circle">修改</u-button>
+			<u-button v-else @click="submit" :loading="loading" class="submitBtn" type="success" shape="circle">提交</u-button>
 			<uni-popup ref="openModal" type="center">
-				<uni-popup-dialog content="确认提交吗?" @close="close" @confirm="onOk" :title="title"></uni-popup-dialog>
+				<uni-popup-dialog content="确认提交吗?" @confirm="onOk" :title="title"></uni-popup-dialog>
 			</uni-popup>
 		</view>
 	</view>
 </template>
 
 <script>
-	import {
-		saveAddress
-	} from '@/api/receiveAddress.js'
 	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'
 	export default {
 		components: {
 			uniPopup,uniPopupDialog
@@ -53,24 +58,26 @@
 		data() {
 			return {
 				title:'',
-				show:false,
-				src:"",
+				loading:false, // 提交按钮加载圈
 				photograph: [], //  图片路径
 				form: {
-					receiverName: '',
-					receiverPhone: '',
-					receiveAddress: '' // 详细地址
+					gatherNum_other: '', // 其它垃圾
+					gatherNum_chuyu: '', // 厨余垃圾
+					gatherNum_jianzhu: '', // 建筑垃圾
+					remark: '' // 备注
 				},
+				isView: false // 是否是查看详情
 			};
 		},
 		onLoad(option) {
 			console.log(option,option.id,'ppppppppp')
 			// 查看
 			if(option && option.id){
-				
+				this.isView = true
 			}else {
 				console.log('--------新增')
 				this.photograph = []
+				this.$refs.uForm.resetFields()
 			}
 		},
 		onUnload() {
@@ -84,132 +91,87 @@
 				    sourceType: ['album','camera'], //从相册选择
 				    success:  (res) =>{
 				        console.log(JSON.stringify(res.tempFilePaths));
-						// this.photograph = JSON.stringify(res.tempFilePaths)
-						uni.showLoading({
-							title: '保存中,请稍后...', 
-							mask: true
-						})
-						saveImgToAliOss(res.tempFilePaths[0],function(ret){
-							console.log(ret)
-							_this.photograph = ret.data
-							uni.hideLoading()
-						})
+						this.photograph = this.photograph.concat(res.tempFilePaths) 
+						console.log(this.photograph.length,'this.photograph')
 				    }
 				});
-				// const _this = this;
-				
-				// wx.chooseImage({
-				// 	count: 3, //最多可以选择的图片张数,默认9
-				// 	sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
-				// 	sourceType: ['camera'], //album 从相册选图,camera 使用相机,默认二者都有
-				// 	success: function(res) {
-				// 		// tempFilePaths 图片的本地文件路径列表,tempFiles 图片的本地文件列表,每一项是一个 File 对象
-				// 		console.log(JSON.stringify(res.tempFilePaths));
-				// 		uni.showLoading({
-				// 			title: '保存中,请稍后...', 
-				// 			mask: true
-				// 		})
-				// 		// saveImgToAliOss(res.tempFilePaths[0],function(ret){
-				// 		// 	console.log(ret)
-				// 		// 	_this.photograph = ret.data
-				// 		// 	uni.hideLoading()
-				// 		// })
-				// 	}
-				// });
 			},
-			//  预览签到
-			previewPictures() {
-				const photograph = [this.photograph];
+			//  预览图片
+			previewPictures(item) {
+				const photograph = [item];
 				uni.previewImage({
-					urls: photograph
+					urls: photograph,
 				});
 			},
-			//  删除签到
-			cancelPhotograph() {
+			//  删除图片
+			cancelPhotograph(index) {
 				setTimeout(() => {
-					this.photograph = '';
+					this.photograph.splice(index,1)
 				}, 500);
 			},
 			// 提交
-			open(){
-				this.$refs.openModal.open()
-			},
-			// 取消
-			close(){
+			submit(){
+				if(!this.form.gatherNum_other && !this.form.gatherNum_chuyu && !this.form.gatherNum_jianzhu) {
+					uni.showToast({
+						title: '请至少输入一项垃圾分类的数量!',
+						icon: 'none'
+					})
+					return false
+				} else {
+					this.$refs.openModal.open()
+				}
 			},
 			// 确认提交
 			onOk() {
-				this.$refs.openModal.open()
-				// this.show=true
-				
-				// this.$refs.uForm.validate(valid => {
-				// 	if (valid) {
-				// 		console.log('验证通过');
-				// 		if (this.form.receiverName ==='') {
-				// 			uni.showToast({
-				// 				title: '请输入姓名',
-				// 				icon: 'none'
-				// 			})
-				// 			return false
-				// 		}
-				// 		if (this.form.receiverPhone ==='') {
-				// 			uni.showToast({
-				// 				title: '请输入电话',
-				// 				icon: 'none'
-				// 			})
-				// 			return false
-				// 		}
-				// 		//  省市区
-				// 		if(this.areaIdArr.length == 0){
-				// 			uni.showToast({icon: 'none',title: '请选择省市区'})
-				// 			return
-				// 		}
-				// 		if (this.form.receiveAddress ==='') {
-				// 			uni.showToast({
-				// 				title: '请输入详细地址',
-				// 				icon: 'none'
-				// 			})
-				// 			return false
-				// 		}
-				// 		let params = {
-				// 			receiverName: this.form.receiverName,
-				// 			receiverPhone: this.form.receiverPhone,
-				// 			receiveAreasName: this.areaInfo.label.replace(/\-/g,','), // 地址名称
-				// 			receiveAreas: this.areaIdArr.join(','), 
-				// 			receiveAddress: this.form.receiveAddress // 详细地址
-				// 		}
-				// 		if(this.form.id) {
-				// 			params.id = this.form.id
-				// 		}
-				// 		saveAddress(params).then(res=>{
-				// 			if(res.status == 200) {
-				// 				uni.showToast({
-				// 					title: res.message,
-				// 					icon: 'none'
-				// 				})
-				// 				setTimeout(()=>{
-				// 					uni.navigateBack()
-				// 				},300)
-				// 			} 
-				// 		})
-				// 	} else {
-				// 		console.log('验证失败');
-				// 	}
-				// });
+				this.$refs.openModal.close()
+				let params = {
+					rubbishEntityList: [],
+					imageUrlList: this.photograph
+				}
+				if(this.form.gatherNum_other) {
+					params.rubbishEntityList.push({
+						"rubbishType":"GATHER_OTHER",
+						"rubbishWeight": this.form.gatherNum_other*240,
+						"gatherNum": this.form.gatherNum_other,
+						"unit":"BUCKET"
+					})
+				}
+				if(this.form.gatherNum_chuyu) {
+					params.rubbishEntityList.push({
+						"rubbishType":"GATHER_KITCHEN",
+						"rubbishWeight": this.form.gatherNum_chuyu*240,
+						"gatherNum": this.form.gatherNum_chuyu,
+						"unit":"BUCKET"
+					})
+				}
+				if(this.form.gatherNum_jianzhu) {
+					params.rubbishEntityList.push({
+						"rubbishType":"GATHER_BUILDING",
+						"rubbishWeight": this.form.gatherNum_jianzhu*1000,
+						"gatherNum": this.form.gatherNum_jianzhu,
+						"unit":"TON"
+					})
+				}
+				this.loading=true
+				gatherSave(params).then(res=>{
+					if(res.status == 200) {
+						uni.showToast({
+							title: res.message,
+							icon: 'none'
+						})
+						setTimeout(()=>{
+							uni.navigateBack()
+						},300)
+					} else {
+						uni.showToast({
+							title: res.message,
+							icon: 'none'
+						})
+					}
+					this.loading= false
+				})
 			},
-			// 拍照
-			takePhoto() {
-			            const ctx = uni.createCameraContext();
-			            ctx.takePhoto({
-			                quality: 'high',
-			                success: (res) => {
-			                    this.src = res.tempImagePath
-			                }
-			            });
-			        },
-			        error(e) {
-			            console.log(e.detail);
-			        }
+			
 		},
 		// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
 		onReady() {
@@ -255,15 +217,30 @@
 			margin-top: 14upx;
 			border-radius: 12upx;
 			background-color: #fff;
+			display: flex;
 			.location-icon {
 				padding-left: 10upx;
 				vertical-align: sub;
 			}
-			.photograph-con {
+			.photograph-camera {
 				border: 2upx dashed #bfbfbf;
 				border-radius: 12upx;
-				width: 160upx;
-				height: 160upx;
+				width: 140upx;
+				height: 140upx;
+				display: flex;
+				align-items: center;
+				justify-content: center;
+			}
+			.camera-btn{
+				display: flex;
+				flex-direction: column;
+				align-items: center;
+				color: #999999;
+			}
+			.photograph-con {
+				margin: 0 20upx;
+				width: 140upx;
+				height: 140upx;
 				text-align: center;
 				position: relative;
 				.photograph-icon {

+ 90 - 38
pages/index/index.vue

@@ -2,26 +2,28 @@
 	<view class="content">
 		<view class="header">
 			<view>
-				<text>2021-03-15至2021-06-02</text>
-				<u-image @click="openScreen=true" class="filter-img" width="36rpx" height="36rpx" src="/static/filter.png"></u-image>
+				<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>
-					<text class="other">1000kg</text>
+					<text v-if="status !='loading'" class="other">{{otherTotal}}kg</text>
+					<u-loading :show="status =='loading'"></u-loading>
 				</view>
 				<view class="cont-item">
 					<text>建筑垃圾</text>
-					<text class="jianzhu">1000kg</text>
+					<text v-if="status !='loading'" class="jianzhu">{{jianzhuTotal}}kg</text>
+					<u-loading :show="status =='loading'"></u-loading>
 				</view>
 				<view class="cont-item">
 					<text>厨余垃圾</text>
-					<text class="chuyu">1000kg</text>
+					<text v-if="status !='loading'" class="chuyu">{{chuyuTotal}}kg</text>
+					<u-loading :show="status =='loading'"></u-loading>
 				</view>
 			</view>
-			<!-- <text>总计:其它垃圾2000,厨余垃圾1000,建筑垃圾0。</text> -->
 		</view>
-		<scroll-view class="scroll-con" :scroll-top="scrollTop" scroll-y @scrolltolower="onreachBottom">
+		<scroll-view  class="scroll-con" :scroll-top="scrollTop" scroll-y @scrolltolower="onreachBottom">
 			<!-- 列表数据 -->
 			<view class="cell-item" v-for="item in listdata">
 				<view class="cell-item-title" >
@@ -66,11 +68,19 @@
 
 <script>
 	import searchModal from './searchModal.vue'
+	import {gatherQuery} from '@/api/index.js'
+	import { checkLogin } from '@/api/login.js'
+	import moment from 'moment'
+	import getDate from '@/libs/getDate.js'
 	export default {
 		components: { searchModal },
 		data() {
 			return {
-				listdata: [{},{},{},{}],
+				hasLogin: false, // 是否登录
+				listdata: [], // 列表数据
+				otherTotal: 0, // 其它垃圾总和
+				jianzhuTotal: 0, // 建筑垃圾总和
+				chuyuTotal: 0, // 厨余垃圾总和
 				pageNo: 1,  //  当前页码
 				pageSize: 10,  //  每页条数
 				total: 0,  //  数据总条数
@@ -78,14 +88,18 @@
 				status: 'loadmore',  //  加载中状态
 				openScreen: false,  //  是否打开筛选
 				searchForm: {  //  查询条件
-					beginDate: '',  //  创建时间默认筛选近7天
-					endDate: '',  //  创建时间默认筛选近7天
+					beginDate: getDate.getRecentday().starttime,  //  创建时间默认筛选近7天
+					endDate: getDate.getRecentday().endtime,  //  创建时间默认筛选近7天
 				},
 				scrollTop: 0,  //  滚动条位置
 			}
 		},
 		onLoad() {
-			
+			// 开启分享
+			uni.showShareMenu({
+				withShareTicket: true,
+				menus: ['shareAppMessage', 'shareTimeline']
+			})
 		},
 		onUnload() {
 			
@@ -95,41 +109,59 @@
 		onShareTimeline(res) {
 		},
 		onShow() {
+			checkLogin().then(res => {
+				this.hasLogin = res.status == 200
+				if(this.hasLogin){
+					this.pageInit()
+				} else {
+					this.noDataText = '您尚未登录或登录已过期,完成登录后可查看录入信息!'
+				}
+			})
 		},
 		methods: {
+			pageInit() {
+				this.pageNo = 1
+				this.pageSize = 10
+				this.total = 0
+				this.scrollTop = 0
+				this.searchForm.beginDate = getDate.getRecentday().starttime
+				this.searchForm.endDate = getDate.getRecentday().endtime
+				console.log(this.searchForm,'this.searchForm')
+				this.searchHandle()
+			},
 			// 获取查询参数 刷新列表
 			refresh(params){
 				this.searchForm = params
-				// this.listdata = []
+				this.listdata = []
 				this.total = 0
 				this.searchHandle(1)
 			},
 			// 搜索查询
 			searchHandle (pageNo) {
-				// this.status = "loading"
+				this.status = "loading"
 				pageNo ? this.pageNo = pageNo : null
-				// getGoldLogList({
-				// 	pageNo: this.pageNo,
-				// 	pageSize: this.pageSize,
-				// 	beginDate: this.searchForm.beginDate,
-				// 	endDate: this.searchForm.endDate,
-				// }).then(res => {
-				// 	if (res.status == 200) {
-				// 		if(this.pageNo>1){
-				// 			this.listdata = this.listdata.concat(res.data.list || [])
-				// 		}else{
-				// 			this.listdata = res.data.list || []
-				// 			this.scrollTop = 0
-				// 		}
-				// 		this.total = res.data.count || 0
-				// 		this.noDataText = '暂无数据'
-				// 	} else {
-				// 		this.noDataText = res.message
-				// 		this.listdata = []
-				// 		this.total = 0
-				// 	}
-				// 	this.status = "loadmore"
-				// })
+				gatherQuery({
+					pageNo: this.pageNo,
+					pageSize: this.pageSize,
+					beginDate: this.searchForm.beginDate,
+					endDate: this.searchForm.endDate,
+				}).then(res => {
+					if (res.status == 200) {
+						if(this.pageNo>1){
+							this.listdata = this.listdata.concat(res.data.list || [])
+						}else{
+							this.listdata = res.data.list || []
+							this.scrollTop = 0
+						}
+						this.total = res.data.count || 0
+						this.noDataText = '暂无数据'
+					} else {
+						this.noDataText = res.message
+						this.listdata = []
+						this.total = 0
+					}
+					this.status = "loadmore"
+				})
 			},
 			// scroll-view到底部加载更多
 			onreachBottom() {
@@ -145,9 +177,28 @@
 			// 打开垃圾数据录入页面
 			intoPage(flag) {
 				let url = flag ? `/pages/index/addData?id=${flag}` : `/pages/index/addData`
-				uni.navigateTo({
-				    url: url
-				})
+				// uni.navigateTo({
+				//     url: url
+				// })
+				if(!this.hasLogin){
+					uni.showModal({
+					  title: '提示',
+					  content: '您尚未登录或登录已过期,请登录后使用',
+					  success: (res)=> {
+					    if (res.confirm) {
+					     uni.navigateTo({
+					         url: '/pages/login/login'
+					     })
+					    } else if (res.cancel) {
+					      console.log('用户点击取消');
+					    }
+					  }
+					});
+				} else {
+					uni.navigateTo({
+					    url: url
+					})
+				}
 			}
 		}
 	}
@@ -183,6 +234,7 @@
 				.cont-item{
 					display: flex;
 					flex-direction: column;
+					align-items: center;
 					text{
 						line-height: 50upx;
 					}

+ 0 - 8
pages/login/login.vue

@@ -37,7 +37,6 @@
 				path: '/pages/index/index',
 				lanuch: false,
 				code: '',
-				url:'', // 二维码参数
 				wxButton: {
 					background: '#0DC55F'
 				},
@@ -48,11 +47,7 @@
 				}
 			}
 		},
-		mounted() {},
 		onLoad(option) {
-			if(option.q !=undefined){
-				this.url=decodeURIComponent(option.q)
-			}
 			// 开启分享
 			uni.showShareMenu({
 				withShareTicket: true,
@@ -98,9 +93,6 @@
 							encryptedData: e.target.encryptedData,
 							iv: e.target.iv,
 						}
-						if(_this.url){
-							params.encode=_this.url
-						}
 						login(params).then(res => {
 							uni.hideLoading();
 							_this.code = ''

+ 2 - 2
pages/login/phoneLogin.vue

@@ -30,7 +30,7 @@
 <script>
 import { checkVersionToLoadUpdate, setStorageForAppVersion,clzConfirm } from '@/libs/tools'
 import { isvalidPhone } from '@/libs/validate.js';
-import { login } from '@/api/user.js';
+import { loginPhone } from '@/api/login.js';
 import { getSysVersion } from '@/api/data.js'
 export default {
 	data() {
@@ -108,7 +108,7 @@ export default {
 		submitForm(formData){
 			const _this = this;
 			//  登录
-			login(formData).then(res => {
+			loginPhone(formData).then(res => {
 				uni.hideLoading();
 				if (res.status == 200) {
 					_this.$u.vuex('vuex_token', res.data);

+ 4 - 3
pages/userCenter/index.vue

@@ -147,10 +147,11 @@
 				color: #FFFFFF;
 				.user-info-item{
 					margin: 10rpx 0;
+					:first-child{
+						font-size: 34upx;
+					}
 				}
-				:first-child{
-					font-size: 34upx;
-				}
+				
 			}
 			.user-photo{
 				width: 100rpx;