浏览代码

bug 修复

lilei 4 年之前
父节点
当前提交
8bb1c773fd

+ 2 - 2
App.vue

@@ -1,6 +1,6 @@
 <script>
 <script>
-	const uat_URL = 'https://lese.test.sxzxyj.net/gc-channel/' // 预发布
-	// const uat_URL = 'http://192.168.16.102:8303/gc-channel/' // 本地
+	// const uat_URL = 'https://lese.test.sxzxyj.net/gc-channel/' // 预发布
+	const uat_URL = 'http://192.168.16.105:8303/gc-channel/' // 本地
 	const pro_URL = 'https://lese.sxzxyj.net/gc-channel/'  // 生产
 	const pro_URL = 'https://lese.sxzxyj.net/gc-channel/'  // 生产
 	const buildType = 0 // 打包环境对应类型,1 生产 0 预发布
 	const buildType = 0 // 打包环境对应类型,1 生产 0 预发布
 	const buildURL = buildType ? pro_URL : uat_URL // 打包后实际对应的url
 	const buildURL = buildType ? pro_URL : uat_URL // 打包后实际对应的url

+ 32 - 0
api/officialPartnerGoldLog.js

@@ -27,3 +27,35 @@ export const GoldLogTotal = params => {
 	  data: params
 	  data: params
 	})
 	})
 }
 }
+
+// 根据手机号码查询用户乐豆余额
+export const queryldByMobile = params => {
+  return axios.request({
+    url: `customer/queryByMobile/${params.mobile}`,
+    method: 'get',
+  })
+};
+
+// 乐豆核销
+export const offPartnerHx = params => {
+	return axios.request({
+	  url: `offPartner/verification`,
+	  method: 'post',
+	  data: params
+	})
+}
+
+// 发送短信验证码
+export const sendVerifyCode = params => {
+  return axios.request({
+    url: `offPartner/sendVerifiCode/${params.mobile}`,
+    method: 'get',
+  })
+}
+// 校验验证码
+export const checkVerificationCode = params => {
+  return axios.request({
+    url: `offPartner/checkVerificationCode/${params.mobile}/${params.code}`,
+    method: 'get',
+  })
+}

+ 1 - 23
api/user.js

@@ -25,29 +25,7 @@ export const getCaptcha = randomCode => {
     responseType: 'blob',
     responseType: 'blob',
   }, true)
   }, true)
 }
 }
-// 发送短信验证码
-export const sendVerifyCode = params => {
-  return axios.request({
-    url: 'org/apply/sendVerifyCode',
-    method: 'post',
-    data: params
-  }, true)
-}
-// 申请试用
-export const apply = params => {
-  return axios.request({
-    url: 'org/apply/apply',
-    method: 'post',
-    data: params
-  }, true)
-}
-// 获取门店名称
-export const getStore = (token) => {
-  return axios.request({
-    url: 'getStore',
-    method: 'get'
-  })
-}
+ 
 // 登出
 // 登出
 export const logout = () => {
 export const logout = () => {
   return axios.request({
   return axios.request({

+ 9 - 0
pages.json

@@ -58,6 +58,15 @@
             }
             }
             
             
         }
         }
+        ,{
+            "path" : "pages/ledouHexiao/hexiaoSuccess",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "核销成功",
+                "enablePullDownRefresh": false
+            }
+            
+        }
     ],
     ],
 	"globalStyle": {
 	"globalStyle": {
 		"navigationBarTextStyle": "black",
 		"navigationBarTextStyle": "black",

+ 10 - 0
pages/index/index.vue

@@ -56,6 +56,7 @@
 </template>
 </template>
 <script>
 <script>
 	import searchModal from './searchModal.vue'
 	import searchModal from './searchModal.vue'
+	import { getUserInfo } from '@/api/user.js'
 	import { getGoldLogList, GoldLogCancel, GoldLogTotal } from '@/api/officialPartnerGoldLog.js'
 	import { getGoldLogList, GoldLogCancel, GoldLogTotal } from '@/api/officialPartnerGoldLog.js'
 	export default {
 	export default {
 		components: { searchModal },
 		components: { searchModal },
@@ -85,8 +86,17 @@
 		onShow() {
 		onShow() {
 			this.openScreen = false  //  关闭筛选框
 			this.openScreen = false  //  关闭筛选框
 			this.refresh({})
 			this.refresh({})
+			this.getUserInfo()
 		},
 		},
 		methods:{
 		methods:{
+			//  获取用户信息
+			getUserInfo(){
+				getUserInfo().then(res => {
+					if(res.status == 200){
+						this.$u.vuex('vuex_userData', res.data);
+					}
+				})
+			},
 			openQuery(){
 			openQuery(){
 				uni.navigateTo({
 				uni.navigateTo({
 					url: "/pages/userCenter/leDouQuery"
 					url: "/pages/userCenter/leDouQuery"

+ 51 - 0
pages/ledouHexiao/hexiaoSuccess.vue

@@ -0,0 +1,51 @@
+<template>
+	<view class="pages-content">
+		<view>
+			<u-icon name="checkmark-circle-fill" size="150" color="#00aaff"></u-icon>
+		</view>
+		<view class="pc-a">核销成功</view>
+		<view>{{changeNum}}个乐豆</view>
+		<view>
+			<u-button type="primary" @click="toPage">返回核销记录</u-button>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				changeNum: 0
+			}
+		},
+		onLoad(opts) {
+			this.changeNum = opts.changeNum
+		},
+		methods: {
+			toPage(){
+				uni.reLaunch({
+					url:'/pages/index/index'
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	.pages-content{
+		display: flex;
+		justify-content: center;
+		flex-direction: column;
+		width: 100%;
+		padding: 100rpx;
+		text-align: center;
+		height: 60vh;
+
+		.pc-a{
+			font-size: 40rpx;
+		}
+		>view{
+			padding: 20rpx 0;
+		}
+	}
+</style>

+ 74 - 66
pages/ledouHexiao/ledouHexiao.vue

@@ -5,14 +5,14 @@
 				<view class="txt-right">{{form.storeName}}</view>
 				<view class="txt-right">{{form.storeName}}</view>
 			</u-form-item>
 			</u-form-item>
 			<u-form-item label="支付用户">
 			<u-form-item label="支付用户">
-				<view class="txt-right">{{form.phone}}</view>
+				<view class="txt-right">{{form.customerMobile}}</view>
 			</u-form-item>
 			</u-form-item>
-			<u-form-item label="备注" prop="remark">
-				<u-input placeholder="请输入备注" :maxlength="500" :custom-style="{textAlign:'right'}" trim v-model="form.remark" />
+			<u-form-item label="备注" prop="remarks">
+				<u-input placeholder="请输入备注" :maxlength="500" :custom-style="{textAlign:'right'}" trim v-model="form.remarks" />
 			</u-form-item> 
 			</u-form-item> 
-			<u-form-item label="核销数量" label-position="top" prop="ledou" required>
+			<u-form-item label="核销数量" label-position="top" prop="changeNum" required>
 				<view class="ledu-input">
 				<view class="ledu-input">
-					<view><u-input placeholder="请输入核销数量" :custom-style="{borderBottom:'1px solid #999',textAlign:'center',width:'100%'}" trim type="number" v-model="form.ledou" /></view>
+					<view><u-input placeholder="请输入核销数量" :custom-style="{borderBottom:'1px solid #999',textAlign:'center',width:'100%'}" trim type="number" v-model="form.changeNum" /></view>
 					<text>个乐豆</text>
 					<text>个乐豆</text>
 				</view>
 				</view>
 			</u-form-item> 
 			</u-form-item> 
@@ -28,37 +28,37 @@
 				<view class="text-cont">
 				<view class="text-cont">
 					<view>
 					<view>
 						<text>用户手机:</text>
 						<text>用户手机:</text>
-						<text>{{form.phone||'--'}}</text>
+						<text>{{form.customerMobile||'--'}}</text>
 					</view>
 					</view>
 				</view>
 				</view>
 				<view class="text-cont">
 				<view class="text-cont">
 					<view>
 					<view>
 						<text>验证码:</text>
 						<text>验证码:</text>
-						<u-input type="number" placeholder="请输入验证码"></u-input>
+						<u-input type="number" v-model="code" :maxlength="6" placeholder="请输入验证码"></u-input>
 						<u-button size="mini" :disabled="isDisable" @click="getCodeValidate">{{nowVal}}</u-button>
 						<u-button size="mini" :disabled="isDisable" @click="getCodeValidate">{{nowVal}}</u-button>
 					</view>
 					</view>
 				</view>
 				</view>
 				<view class="fot-btn">
 				<view class="fot-btn">
-					<u-button @click="confirm" size="medium" type="primary" >确定</u-button>
+					<u-button @click="confirm" :loading="loading" size="medium" type="primary" >确定</u-button>
 				</view>
 				</view>
 			</view>
 			</view>
 		</u-popup>
 		</u-popup>
 		
 		
 		<!-- 图文验证码 -->
 		<!-- 图文验证码 -->
-		<uni-popup ref="imageTxtPopup" type="center">
+		<!-- <uni-popup ref="imageTxtPopup" type="center">
 			<popup-con type="forgetImageTxt" title="图文验证码" :popBtn="popBtn" :changeImg="changeImg" @captchaImg="captchaImg"></popup-con>
 			<popup-con type="forgetImageTxt" title="图文验证码" :popBtn="popBtn" :changeImg="changeImg" @captchaImg="captchaImg"></popup-con>
-		</uni-popup>
+		</uni-popup> -->
 	</view>
 	</view>
 </template>
 </template>
 
 
 <script>
 <script>
-	import uniPopup from '@/components/uni-popup/uni-popup.vue'
-	import popupCon from '@/components/uni-popup/popup-con.vue'
-	import { memberVerifyCode, memberGetByMobile } from '@/api/user.js'
+	// import uniPopup from '@/components/uni-popup/uni-popup.vue'
+	// import popupCon from '@/components/uni-popup/popup-con.vue'
+	import { offPartnerHx, sendVerifyCode, checkVerificationCode } from '@/api/officialPartnerGoldLog.js'
 	export default {
 	export default {
 		components: {
 		components: {
-			uniPopup,
-			popupCon
+			// uniPopup,
+			// popupCon
 		},
 		},
 		data() {
 		data() {
 			return {
 			return {
@@ -67,25 +67,26 @@
 				count: '',  //  当前秒数
 				count: '',  //  当前秒数
 				timer: null,  //  倒计时
 				timer: null,  //  倒计时
 				isDisable: false,  //  是否禁止获取验证码
 				isDisable: false,  //  是否禁止获取验证码
-				changeImg: false,  //  是否重新更换图形验证码
-				randomCode: '',  //  图片验证码随机码
+				code: '',
+				loading: false,
 				form:{
 				form:{
-					storeName: '收取门店',
-					phone: '13709146191',
-					remark: '',
-					ledou: ''
+					storeName: '',
+					customerMobile: '',
+					remarks: '',
+					changeNum: ''
 				},
 				},
 				rules: {
 				rules: {
-					ledou: [
+					changeNum: [
 						{ 
 						{ 
 							required: true, 
 							required: true, 
 							type: 'number',
 							type: 'number',
 							message: '请输入乐豆', 
 							message: '请输入乐豆', 
+							min: 1,
 							// 可以单个或者同时写两个触发验证方式 
 							// 可以单个或者同时写两个触发验证方式 
 							trigger: ['change','blur'],
 							trigger: ['change','blur'],
 						}
 						}
 					],
 					],
-					remark: [
+					remarks: [
 						{
 						{
 							message: '请输入备注', 
 							message: '请输入备注', 
 							trigger: 'change'
 							trigger: 'change'
@@ -94,6 +95,12 @@
 				}
 				}
 			}
 			}
 		},
 		},
+		onLoad(opts) {
+			let data = JSON.parse(decodeURIComponent(opts.item))
+			let user = this.$store.state.vuex_userData
+			this.form.customerMobile = data.mobile
+			this.form.storeName = user.org.name
+		},
 		// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
 		// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
 		onReady() {
 		onReady() {
 			this.$refs.uForm.setRules(this.rules);
 			this.$refs.uForm.setRules(this.rules);
@@ -104,7 +111,12 @@
 					console.log(valid)
 					console.log(valid)
 					if (valid) {
 					if (valid) {
 						console.log('验证通过');
 						console.log('验证通过');
-						this.showModal = true
+						if(this.form.changeNum>0){
+							this.showModal = true
+						}else{
+							uni.showToast({icon: 'none',title: '请输入乐豆'}) 
+						}
+						
 					} else {
 					} else {
 						console.log('验证失败');
 						console.log('验证失败');
 					}
 					}
@@ -112,27 +124,55 @@
 			},
 			},
 			closeModal(){
 			closeModal(){
 				this.showModal = false
 				this.showModal = false
+				this.code = ''
+			},
+			// 提交核销
+			saveHx(){
+				offPartnerHx({
+					"customerMobile": this.form.customerMobile,
+					"changeNum": this.form.changeNum,
+					"remarks": this.form.remarks
+				}).then(res => {
+					if(res.status == 200){
+						uni.navigateTo({
+							url: "/pages/ledouHexiao/hexiaoSuccess?changeNum="+this.form.changeNum
+						})
+					}else{
+						this.code = ''
+						uni.showToast({icon: 'none',title: res.message})
+					}
+					this.loading = false
+				})
 			},
 			},
 			// 确定验证码
 			// 确定验证码
 			confirm(){
 			confirm(){
-				
-			},
-			//  获取验证码
-			getCodeValidate(){
-				if(this.form.phone){
-					//  校验手机号是否注册过
-					memberGetByMobile({phone: this.form.phone}).then(res => {
+				if(this.code != ''&&this.code.length == 6){
+					this.loading = true
+					checkVerificationCode({mobile:this.form.customerMobile,code:this.code}).then(res => {
 						if(res.status == 200){
 						if(res.status == 200){
-							//  图文验证码
-							this.$refs.imageTxtPopup.open()
+							this.saveHx()
 						}else{
 						}else{
 							uni.showToast({icon: 'none',title: res.message})
 							uni.showToast({icon: 'none',title: res.message})
+							this.loading = false
 						}
 						}
 					})
 					})
 				}else{
 				}else{
-					uni.showToast({icon: 'none',title: '请先输入手机号'})
+					uni.showToast({icon: 'none',title: '请输入验证码'}) 
 				}
 				}
 			},
 			},
+			//  获取验证码
+			getCodeValidate(){
+				sendVerifyCode({mobile: this.form.customerMobile}).then(res => {
+					if(res.status == 200){
+						//  开启倒计时
+						this.getCodeFun()
+						uni.showToast({icon: 'none',title: '验证码发送成功'}) 
+					}else{
+						this.code = ''
+						uni.showToast({icon: 'none',title: res.message})
+					}
+				})
+			},
 			//  开始倒计时
 			//  开始倒计时
 			getCodeFun(){
 			getCodeFun(){
 				const TIME_COUNT = 60
 				const TIME_COUNT = 60
@@ -152,38 +192,6 @@
 				  }, 1000)
 				  }, 1000)
 				}
 				}
 			},
 			},
-			//  图文验证码
-			captchaImg(code, nowRandomCode){
-				this.captchaVerify(code, nowRandomCode)
-			},
-			//  验证图片验证码
-			captchaVerify(code, nowRandomCode){
-				const _this = this
-				let obj = {}
-				obj.phone = this.form.phone
-				obj.random = nowRandomCode
-				obj.captcha = code
-				//  短信验证码
-				memberVerifyCode(obj).then(res => {
-					console.log(JSON.stringify(res))
-					if(res.status == 200){  //  验证码输入正确
-						_this.randomCode = nowRandomCode  //  图片验证码随机码
-						//  关闭   图形验证码 弹框
-						_this.$refs.imageTxtPopup.close()
-						//  开启倒计时
-						this.getCodeFun()
-						uni.showToast({icon: 'none',title: '验证码发送成功'})
-					}else {  //  验证码输入错误
-						_this.randomCode = ''
-						//  切换验证码重新校验
-						_this.changeImg = false
-						_this.$nextTick(function(){
-							_this.changeImg = true
-						})
-						uni.showToast({icon: 'none',title: res.message})
-					}
-				})
-			},
 		}
 		}
 	}
 	}
 </script>
 </script>

+ 1 - 12
pages/userCenter/index.vue

@@ -28,7 +28,6 @@
 
 
 <script>
 <script>
 	import {logout} from '@/api/login.js'
 	import {logout} from '@/api/login.js'
-	import { getUserInfo } from '@/api/user.js'
 	export default {
 	export default {
 		data() {
 		data() {
 			return {
 			return {
@@ -42,21 +41,11 @@
 			};
 			};
 		},
 		},
 		onShow() {
 		onShow() {
-			this.getUserInfo()
+			this.userInfoData = this.$store.state.vuex_userData
 		},
 		},
 		onLoad() {
 		onLoad() {
 		},
 		},
 		methods:{
 		methods:{
-			//  获取用户信息
-			getUserInfo(){
-				getUserInfo().then(res => {
-					if(res.status == 200){
-						this.userInfoData = res.data
-					}else{
-						this.userInfoData = null
-					}
-				})
-			},
 			// 打开对应的页面
 			// 打开对应的页面
 			toPage(index){
 			toPage(index){
 				let pageUrl=[
 				let pageUrl=[

+ 36 - 31
pages/userCenter/leDouQuery.vue

@@ -1,47 +1,28 @@
 <template>
 <template>
 	<view class="query-content">
 	<view class="query-content">
 		<view class="query-input">
 		<view class="query-input">
-			<u-input v-model="queryWord" :border="true" placeholder="请输入完整手机号码查询" type="number"/>
+			<u-input v-model="queryWord" :border="true" :maxlength="11" placeholder="请输入完整手机号码查询" type="number"/>
 			<view class="query-button">
 			<view class="query-button">
-				<u-button shape="circle" type="primary">查询</u-button>
+				<u-button shape="circle" @click="queryData" type="primary">查询</u-button>
 			</view>
 			</view>
 		</view>
 		</view>
 		<view class="query-result">
 		<view class="query-result">
 			<u-gap height="20" bg-color="#f8f8f8"></u-gap>
 			<u-gap height="20" bg-color="#f8f8f8"></u-gap>
-			<view class="result-list">
+			<view class="result-list" v-if="result">
 				<view class="result-title">
 				<view class="result-title">
 					<view>
 					<view>
 						<u-icon name="account-fill" color="#666" size="28"></u-icon>
 						<u-icon name="account-fill" color="#666" size="28"></u-icon>
-						<text>普通用户</text>
+						<text>{{result.customerRoleDictValue}}</text>
 					</view>
 					</view>
-					<view>
+					<view v-if="result.customerRole == 1">
 						<u-button @click="hexiao" type="warning" size="mini">乐豆核销</u-button>
 						<u-button @click="hexiao" type="warning" size="mini">乐豆核销</u-button>
 					</view>
 					</view>
 				</view>
 				</view>
 				<view class="result-info">
 				<view class="result-info">
 					<u-cell-group>
 					<u-cell-group>
-						<u-cell-item :arrow="false" title="注册时间" value="2020-12-25 12:23:55"></u-cell-item>
-						<u-cell-item :arrow="false" title="用户手机" value="1279495656"></u-cell-item>
-						<u-cell-item :arrow="false" title="乐豆余额" :value-style="{color:'red'}" value="1200">
-						</u-cell-item>
-					</u-cell-group>
-				</view>
-			</view>
-			<u-gap height="20" bg-color="#f8f8f8"></u-gap>
-			<view class="result-list">
-				<view class="result-title">
-					<view>
-						<u-icon name="account-fill" color="#666" size="28"></u-icon>
-						<text>合伙人</text>
-					</view>
-					<view>
-					</view>
-				</view>
-				<view class="result-info">
-					<u-cell-group>
-						<u-cell-item :arrow="false" title="注册时间" value="2020-12-25 12:23:55"></u-cell-item>
-						<u-cell-item :arrow="false" title="用户手机" value="1279495656"></u-cell-item>
-						<u-cell-item :arrow="false" title="乐豆余额" :value-style="{color:'red'}" value="1200">
+						<u-cell-item :arrow="false" title="注册时间" :value="result.registerTime"></u-cell-item>
+						<u-cell-item :arrow="false" title="用户手机" :value="result.mobile"></u-cell-item>
+						<u-cell-item :arrow="false" title="乐豆余额" :value-style="{color:'red'}" :value="result.currentGold||'0'">
 						</u-cell-item>
 						</u-cell-item>
 					</u-cell-group>
 					</u-cell-group>
 				</view>
 				</view>
@@ -51,17 +32,41 @@
 </template>
 </template>
 
 
 <script>
 <script>
+	import { queryldByMobile } from '@/api/officialPartnerGoldLog.js'
 	export default{
 	export default{
 		data() {
 		data() {
 			return {
 			return {
-				queryWord: ''
+				queryWord: '',
+				result: null
 			}
 			}
 		},
 		},
 		methods: {
 		methods: {
+			queryData(){
+				if(this.queryWord.length == 11){
+					queryldByMobile({mobile:this.queryWord}).then(res => {
+						console.log(res)
+						if(res.status == 200){
+							this.result = res.data
+						}
+					})
+				}else{
+					uni.showToast({
+						icon: 'none',
+						title: '请输入手机号码'
+					})
+				}
+			},
 			hexiao() {
 			hexiao() {
-				uni.navigateTo({
-					url: "/pages/ledouHexiao/ledouHexiao"
-				})
+				// if(this.result.currentGold>0){
+					uni.navigateTo({
+						url: "/pages/ledouHexiao/ledouHexiao?item="+ encodeURIComponent(JSON.stringify(this.result))
+					})
+				// }else{
+				// 	uni.showToast({
+				// 		icon: 'none',
+				// 		title: '此用户的乐豆余额为0'
+				// 	})
+				// }
 			}
 			}
 		},
 		},
 	}
 	}