Explorar el Código

Merge branch 'develop_daping' of chelingzhu-web/zxyj-mini-html into master

李文文 hace 4 años
padre
commit
e70a9501f9

+ 1 - 1
App.vue

@@ -4,7 +4,7 @@
 	const pro_domain = 'https://lese.sxzxyj.net' // 生产
 	const uat_URL = uat_domain+'/gc-shop/' // 预发布
 	const pro_URL = pro_domain+'/gc-shop/'  // 生产
-	const buildType = 0 // 打包环境对应类型,1 生产 0 预发布
+	const buildType = 1 // 打包环境对应类型,1 生产 0 预发布
 	const buildURL = buildType ? pro_URL : uat_URL // 打包后实际对应的url
 	const envText = ['预发布环境','生产环境']
 	const envTips = process.env.NODE_ENV == 'development' ? envText[0] : envText[buildType]

+ 3 - 1
api/user.js

@@ -25,7 +25,9 @@ export const loginPhone = params => {
 };
 // 乐豆使用明细
 export const ldUsedQuery = params => { 
-  let url = `customerGoldLog/queryByMonth`
+  let url = `customerGoldLog/queryByMonth/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
   return axios.request({
     url: url,
     data: params,

+ 30 - 1
components/uni-cart-fix/uni-cart-fix.vue

@@ -15,6 +15,7 @@
 </template>
 	<script>
 		import dragButton from "@/components/drag-button/drag-button.vue";
+		import {checkLogin} from '@/api/login.js'
 		export default {
 			components: {
 			    dragButton
@@ -32,11 +33,39 @@
 			computed: {
 				count() {
 					return this.$store.state.vuex_cartNums
-				},
+				}
+			},
+			data() {
+				return {
+					hasLogin: false
+				}
+			},
+			mounted() {
+				// 是否登录
+				checkLogin().then(res => {
+					console.log(res,'checkLogin')
+					this.hasLogin = res.status == 200
+				})
 			},
 			methods: {
 				toCart() {
 					let _this = this
+					if(!this.hasLogin) {
+						uni.showModal({
+						  title: '提示',
+						  content: '您尚未登录或登录已过期,请先进行登录',
+						  success (res) {
+						    if (res.confirm) {
+						      uni.navigateTo({
+						          url: '/pages/login/login'
+						      });
+						    } else if (res.cancel) {
+						      console.log('用户点击取消');
+						    }
+						  }
+						});
+						return
+					}
 					if(_this.closeCurPage){
 						uni.redirectTo({
 							url:"/pagesA/cart/cart"

+ 7 - 0
pages/checkOut/checkOut.vue

@@ -135,6 +135,13 @@
 						})
 						return false
 					}
+					if(this.number<=0){
+						uni.showToast({
+							title: '输入的支付数量不能小于或等于0!',
+							icon: 'none'
+						})
+						return false
+					}
 					existPayPwd().then(res => {
 						console.log(res,'rrrrrr')
 						if(res.status == 200) {

+ 0 - 5
pages/goods/index.vue

@@ -65,11 +65,6 @@
 			// 是否登录
 			checkLogin().then(res => {
 				this.hasLogin = res.status == 200
-				// if(res.status != 200){
-				// 	uni.navigateTo({
-				// 		url:"/pages/login/login"
-				// 	})
-				// }
 			})
 		},
 		// 下拉刷新

+ 7 - 6
pages/index/index.vue

@@ -374,7 +374,7 @@
 						// 普通二维码,用户扫箱体的二维码开箱
 						if(e.scanType == 'QR_CODE'){
 							let params = parseQueryString(e.result)
-							console.log(params)
+							console.log(params,'---------------')
 							if(params.codeType == 'hexiao'){  //  扫商户码
 								_this.getStoreData(params.officialPartnerNo)
 							}else{  //  扫箱体码
@@ -416,13 +416,14 @@
 			// 开箱
 			openDevice(data){
 				let params = parseQueryString(data)
+				console.log(params)
 				openDevice(params).then(res => {
-					console.log(res)
+					console.log(res,'-------------扫码开箱')
 					if(res.status == 200){
-						// uni.showToast({
-						// 	icon:"none",
-						// 	title:"认证成功,请点击设备开启按钮"
-						// })
+						uni.showToast({
+							icon:"none",
+							title:"扫码成功"
+						})
 					}
 				})
 			},

+ 21 - 6
pages/login/login.vue

@@ -36,6 +36,7 @@
 				path: '/pages/index/index',
 				lanuch: false,
 				code: '',
+				url:'', // 二维码参数
 				wxButton: {
 					background: '#07c160'
 				},
@@ -46,6 +47,9 @@
 		},
 		mounted() {},
 		onLoad(option) {
+			if(option.q !=undefined){
+				this.url=decodeURIComponent(option.q)
+			}
 			// 开启分享
 			uni.showShareMenu({
 				withShareTicket: true,
@@ -86,11 +90,15 @@
 				console.log(this.code, e)
 				if (e.target.errMsg === 'getPhoneNumber:ok') {
 					setTimeout(()=>{
-						login({
+						const params={
 							code: _this.code,
 							encryptedData: e.target.encryptedData,
-							iv: e.target.iv
-						}).then(res => {
+							iv: e.target.iv,
+						}
+						if(_this.url){
+							params.encode=_this.url
+						}
+						login(params).then(res => {
 							uni.hideLoading();
 							_this.code = ''
 							console.log(res,_this.path, 'login data')
@@ -137,9 +145,16 @@
 			},
 			// 手机号登录
 			phoneLogin () {
-			  wx.navigateTo({
-			    url: '/pages/login/phoneLogin?path='+this.path+'&lanuch='+this.lanuch
-			  })
+				if(this.url){
+					wx.navigateTo({
+						url: '/pages/login/phoneLogin?path='+this.path+'&lanuch='+this.lanuch+'&encode='+this.url 
+					})
+				}else{
+					wx.navigateTo({
+						url: '/pages/login/phoneLogin?path='+this.path+'&lanuch='+this.lanuch
+					})
+				}
+			  
 			}
 		}
 	}

+ 10 - 2
pages/login/phoneLogin.vue

@@ -50,9 +50,13 @@
 				wxcode: '',
 				path: '/pages/index/index',
 				lanuch: false,
+				encode:'' // 二维码地址
 			}
 		},
 		onLoad(opts) {
+			console.log(opts,'----参数')
+			this.encode=opts.encode
+			console.log(opts,this.encode,'----参数')
 			// 开启分享
 			uni.showShareMenu({
 				withShareTicket: true,
@@ -60,8 +64,10 @@
 			})
 			const {
 				path,
-				lanuch
+				lanuch,
+				encode
 			} = option;
+			// console.log(option,'----参数')
 			this.lanuch = (lanuch + '') === 'true';
 		},
 		onUnload() {
@@ -89,7 +95,9 @@
 				obj.phone = _this.form.phone
 				obj.random = _this.randomCode  // 当前随机码
 				obj.verifiCode = _this.form.verifyCode
-				
+				if(this.encode){
+					obj.encode=this.encode
+				}
 				uni.login({
 					provider: 'weixin',
 					success(res) {

+ 49 - 2
pages/userCenter/index.vue

@@ -7,7 +7,8 @@
 				<u-image v-show="!hasLogin" src="/static/logo.png" width="100" height="100"></u-image>
 			</view>
 			<view class="user-info">
-				<text v-if="hasLogin">{{user.mobile||'--'}}</text>
+				<view v-if="hasLogin" class="user-info-item">{{user.mobile||'--'}}</view>
+				<view v-if="hasLogin" class="user-info-item">注册时间:{{user.registerTime||'--'}}</view>
 				<u-button v-else="!hasLogin" plain size="mini" shape="circle" @click="toLoginPage">立即登录</u-button>
 			</view>
 			<view v-if="hasLogin">
@@ -34,6 +35,7 @@
 				<u-cell-item icon="phone" icon-size="40" :icon-style="{color:'#f00'}" @click="callPhone" title="联系客服"></u-cell-item>
 				<u-cell-item icon="file-text" icon-size="40" :icon-style="{color:'#ffaa00'}" index="3" @click="toPage" title="服务协议"></u-cell-item>
 				<u-cell-item icon="info-circle" icon-size="38" :icon-style="{color:'#55aa00'}" index="4" @click="toPage" title="关于我们"></u-cell-item>
+				<u-cell-item  icon="error-circle" icon-size="38" :icon-style="{color:'#aaaaff'}" :value="version" @click="checkUpdate" title="版本检查"></u-cell-item>
 			</u-cell-group>
 		</view>
 	</view>
@@ -45,7 +47,8 @@
 		data() {
 			return {
 				hasLogin: false,
-				userData: {}
+				userData: {},
+				version: ''
 			};
 		},
 		onShow() {
@@ -80,9 +83,50 @@
 					if(res.status == 200){
 						this.$u.vuex("vuex_userData",res.data)
 						this.userData = res.data
+						console.log(this.userData,'-----用户信息')
 					}
 				})
 			},
+			// 获取当前小程序版本
+			getVersion(){
+				const accountInfo = uni.getAccountInfoSync();
+				this.version = accountInfo.miniProgram.version
+				// console.log(accountInfo,accountInfo.miniProgram.appId,'ppppppppp'); // 小程序 appId
+			},
+			// 检查更新
+			checkUpdate(){
+				if (uni.canIUse('getUpdateManager')) {
+				      const updateManager = uni.getUpdateManager()
+				      updateManager.onCheckForUpdate(function (res) {
+				        console.log('onCheckForUpdate====', res)
+				        // 请求完新版本信息的回调
+				        if (res.hasUpdate) {
+				          console.log('res.hasUpdate====')
+				          updateManager.onUpdateReady(function () {
+				            uni.showModal({
+				              title: '更新提示',
+				              content: '新版本已经准备好,是否重启应用?',
+				              success: function (res) {
+				                console.log('success====', res)
+				                // res: {errMsg: "showModal: ok", cancel: false, confirm: true}
+				                if (res.confirm) {
+				                  // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
+				                  updateManager.applyUpdate()
+				                }
+				              }
+				            })
+				          })
+				          updateManager.onUpdateFailed(function () {
+				            // 新的版本下载失败
+				            uni.showModal({
+				              title: '已经有新版本了哟~',
+				              content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~'
+				            })
+				          })
+				        }
+				      })
+				    }
+			},
 			// 打开对应的页面
 			toPage(index){
 				console.log(index)
@@ -146,6 +190,9 @@
 				flex-grow: 1;
 				padding: 0 20rpx;
 				color: #FFFFFF;
+				.user-info-item{
+					margin: 10rpx 0;
+				}
 			}
 			.user-photo{
 				width: 100rpx;

+ 45 - 25
pages/userCenter/ldDetailed.vue

@@ -2,31 +2,31 @@
 	<view class="ldDetailed-container">
 		<!-- 筛选菜单 -->
 		<u-dropdown ref="uDropdown" class="filter-dropdown">
-			<u-dropdown-item v-model="queryParam.changeType" :title="titType" :options="optionsType" @change="searchHandle()"></u-dropdown-item>
-			<u-dropdown-item v-model="timeScope" :title="titScope" :options="optionsScope" @change="searchHandle()"></u-dropdown-item>
+			<u-dropdown-item v-model="queryParam.changeType" :title="titType" :options="optionsType" @change="searchHandle(1)"></u-dropdown-item>
+			<u-dropdown-item v-model="timeScope" :title="titScope" :options="optionsScope" @change="searchHandle(1)"></u-dropdown-item>
 		</u-dropdown>
 		<scroll-view class="scroll-con" scroll-y @scrolltolower="onreachBottom">
 			<!-- 列表数据 -->
 			<view class="cell-item-con">
 				<view class="cell-item" v-for="(item, index) in listdata" :key="index">
-					<text class="cell-item-month" v-if="timeScope == 'threeMonth'">{{item.month}}</text>
-					<view class="cell-item-main" v-for="(subItem, ind) in item.monthDataList" :key="ind">
+					<!-- <text class="cell-item-month" v-if="timeScope == 'threeMonth'">{{item.month}}</text> -->
+					<view class="cell-item-main" >
 						<view :class="['cell-item-pic']">
-							<u-image mode="scaleToFill" v-if="subItem.changeType == 'ADD'" shape="circle" width="70rpx" height="70rpx" src="/static/tudi.png"></u-image>
+							<u-image mode="scaleToFill" v-if="item.changeType == 'ADD'" shape="circle" width="70rpx" height="70rpx" src="/static/tudi.png"></u-image>
 							<u-image mode="scaleToFill" v-else shape="circle" width="70rpx" height="70rpx" src="/static/bued.png"></u-image>
 						</view>
 						<view class="cell-item-c">
-							<text class="cell-item-des">{{subItem.operateTypeDictValue||'--'}}</text>
-							<text class="cell-item-date">{{subItem.createDate}}</text>
+							<text class="cell-item-des">{{item.operateTypeDictValue||'--'}}</text>
+							<text class="cell-item-date">{{item.createDate}}</text>
 						</view>
-						<view :class="['cell-item-score', subItem.changeType == 'ADD' ? 'black' : 'red']">
-							<text>{{subItem.changeType == 'ADD' ? '+'+subItem.changeNum : '-'+subItem.changeNum}}</text>
+						<view :class="['cell-item-score', item.changeType == 'ADD' ? 'black' : 'red']">
+							<text>{{item.changeType == 'ADD' ? '+'+item.changeNum : '-'+item.changeNum}}</text>
 							<u-image mode="scaleToFill" width="40rpx" height="40rpx" src="/static/ledou.png"></u-image>
 						</view>
 					</view>
-					<view class="nodata" v-if="item.monthDataList.length==0 && status!='loading'">
+					<!-- <view class="nodata" v-if="item.monthDataList.length==0 && status!='loading'">
 						<u-empty :text="noDataText" mode="list"></u-empty>
-					</view>
+					</view> -->
 				</view>
 			</view>
 			<view class="nodata" v-if="listdata.length==0 && status!='loading'">
@@ -48,7 +48,7 @@
 			return {
 				listdata: [],
 				pageNo: 1,  //  当前页码
-				pageSize: 10,  //  每页条数
+				pageSize: 20,  //  每页条数
 				total: 0,  //  数据总条数
 				noDataText: '暂无数据',  //  列表请求状态提示语
 				status: 'loadmore',  //  加载中状态
@@ -64,7 +64,7 @@
 			}
 		},
 		onShow() {
-			this.searchHandle()
+			this.searchHandle(1)
 		},
 		onLoad() {
 			this.timeScope = 'threeMonth'
@@ -114,31 +114,44 @@
 		},
 		methods:{
 			// 搜索查询
-			searchHandle () {
-				this.listdata = []
+			searchHandle (pageNo) {
+				this.pageNo = pageNo ? pageNo : this.pageNo
+				if(this.pageNo == 1){
+					this.listdata = []
+				}
 				this.status = "loading"
 				let params = Object.assign(this.queryParam,this.queryDate)
+				params.pageNo = this.pageNo
+				params.pageSize = this.pageSize
 				console.log(params,'pppppppp')
 				ldUsedQuery(params).then(res => {
 					console.log(res,'pppppppp')
 					if (res.status == 200) {
-						let list = res.data
-						// 查询3个月时 数据处理
-						if (this.timeScope == 'threeMonth') {
-							list.map(item=>{
-								let m = moment(item.month).month()+1
-								item.month = (m == moment().month()+1) ? '本月' : m+'月'
-							})
+						if(this.pageNo>1){
+							this.listdata = this.listdata.concat(res.data.list || [])
+						}else{
+							this.listdata = res.data.list || []
 						}
-						this.listdata = list
+						this.total = res.data.count || 0
 					} else {
 						this.noDataText = res.message
 						this.listdata = []
 						this.total = 0
 					}
-					this.status = "nomore"
+					this.status = "loadmore"
 				})
 			},
+			// scroll-view到底部加载更多
+			onreachBottom() {
+				console.log(111111)
+				if(this.listdata.length < this.total){
+					this.pageNo += 1
+					this.searchHandle()
+				}else{
+					uni.showToast({ title: '已经到底了', icon: 'none' })
+					this.status = "nomore"
+				}
+			}
 		}
 	}
 </script>
@@ -151,6 +164,8 @@
 	.ldDetailed-container{
 		width: 100%;
 		height: 100%;
+		display: flex;
+		flex-direction: column;
 		.nodata{
 			margin: 50upx 0;
 		}
@@ -160,10 +175,15 @@
 			.u-dropdown__menu__item{
 				background-color: #fff!important;
 			}
+			
+		}
+		> u-dropdown{
+			flex: none !important;
 		}
 		//  列表
 		.scroll-con{
-			height: calc(100% - 40);
+			// height: calc(100% - 40);
+			flex: 1;
 			overflow: auto;
 		}
 		//  列表样式

+ 9 - 1
pagesA/goods/goods.vue

@@ -2,7 +2,7 @@
 	<view class="content">
 		<view v-if="goldLimit>0" class="info">该类商品需购满{{goldLimit}}乐豆才能下单哦!</view>
 		<view v-if="goodsList.length">
-			<uni-coods :list="goodsList"></uni-coods>
+			<uni-coods :hasLogin="hasLogin" :list="goodsList"></uni-coods>
 			<view class="loadmore"><u-loadmore @loadmore="loadmore" :status="status" /></view>
 		</view>
 		<!-- 购物车 -->
@@ -14,6 +14,7 @@
 	import {
 		getGoodsList
 	} from '@/api/goods.js'
+	import {checkLogin} from '@/api/login.js'
 	export default {
 		data() {
 			return {
@@ -26,6 +27,7 @@
 				status: 'loadmore',
 				count: 0,
 				dragPic: '/static/cart.png',  //  购物车图标
+				hasLogin: false
 			};
 		},
 		onLoad(opts) {
@@ -51,6 +53,12 @@
 				uni.stopPullDownRefresh()
 			}, 200)
 		},
+		onShow() {
+			// 是否登录
+			checkLogin().then(res => {
+				this.hasLogin = res.status == 200
+			})
+		},
 		methods: {
 			// 查询商品
 			getGoods(item,index){