فهرست منبع

openId 变更

zhengkaixin 3 سال پیش
والد
کامیت
dc44c780bf
9فایلهای تغییر یافته به همراه282 افزوده شده و 49 حذف شده
  1. 2 1
      .env.dev.js
  2. 1 1
      .env.prod.js
  3. 3 3
      .env.test.js
  4. 28 0
      apis/finance.js
  5. 13 0
      apis/user.js
  6. 1 1
      pages/login/welcome.vue
  7. 87 9
      pages/user/finance/recharge.vue
  8. 28 18
      pages/user/help.vue
  9. 119 16
      pages/user/message.vue

+ 2 - 1
.env.dev.js

@@ -8,7 +8,8 @@ const UNI_APP = {
 	//openId:"oHjCawgwCGen5k1-hAsimdEX5lZo",
 	openId:"oHjCawigqi8SEAwutwkQ-VEgdp3k",
 	//小鹏管家appid
-	VUE_APP_WXAPPID:"wx7e70eb62a8459869"
+	//VUE_APP_WXAPPID:"wx7e70eb62a8459869",
+	VUE_APP_WXAPPID:"wx3afdb1b60188c1e5"
 }  
 
 module.exports = UNI_APP;

+ 1 - 1
.env.prod.js

@@ -5,7 +5,7 @@ const UNI_APP = {
 	SIMPLE_RUN:false,
 	openId:"oHjCawigqi8SEAwutwkQ-VEgdp3k",//测试用openId
 	//小鹏管家appid
-	VUE_APP_WXAPPID:"wx7e70eb62a8459869"
+	VUE_APP_WXAPPID:"wx3afdb1b60188c1e5"
 }  
 
 module.exports = UNI_APP;

+ 3 - 3
.env.test.js

@@ -1,6 +1,6 @@
 const UNI_APP = {  
-		ProjectName :"51充电联盟",
-    // BASE_URL: 'http://192.168.77.162:8080/charging-station/' ,
+	ProjectName :"51充电联盟",
+   // BASE_URL: 'http://192.168.77.162:8080/charging-station/' ,
 	BASE_URL: 'https://charging.xiaoxinda.com/charging-station-test/',
     //BASE_URL: 'https://charging.xiaoxinda.com/charging-station-server/',
    
@@ -10,7 +10,7 @@ const UNI_APP = {
 	//openId:"oHjCawigqi8SEAwutwkQ-VEgdp3k",//测试用openId
 	//openId:"oHjCawmHqG44pqUW54iBlenaHYB8",
 	//小鹏管家appid
-	VUE_APP_WXAPPID:"wx7e70eb62a8459869",
+	VUE_APP_WXAPPID:"wx3afdb1b60188c1e5",
 	//zkx的测试openId
 	//openId:"oHjCawsJ5blME36lHaSpSVfEhleU",
 	openId:"oHjCawigqi8SEAwutwkQ-VEgdp3k",

+ 28 - 0
apis/finance.js

@@ -0,0 +1,28 @@
+import request from '../utils/request.js';
+import requestWhite from '../utils/requestWhite.js';
+
+
+export function helpList (data) {
+	 
+	return requestWhite({
+		method: 'post',
+		data:data ,
+		url: '/mobile/roleSharing/helpList'
+	})
+} 
+
+export function marketingData(data) {
+	return request({
+		method: 'post',
+		data: data,
+		url: '/mobile/charging/marketingData'
+	})
+}
+
+export function personalCenter(data) {
+	return request({
+		method: 'post',
+		data: data,
+		url: '/mobile/regUser/personalCenter'
+	})
+}

+ 13 - 0
apis/user.js

@@ -0,0 +1,13 @@
+import request from '../utils/request.js';
+import requestWhite from '../utils/requestWhite.js';
+
+
+export function helpList (data) {
+	 
+	return requestWhite({
+		method: 'post',
+		data:data ,
+		url: '/mobile/roleSharing/helpList'
+	})
+} 
+

+ 1 - 1
pages/login/welcome.vue

@@ -68,7 +68,7 @@
 					
 					}
 				}).catch(error => {
-					this.carhelp.logoff()
+					
 				
 				})
 			},

+ 87 - 9
pages/user/finance/recharge.vue

@@ -3,10 +3,10 @@
 		<u-navbar title="充值"></u-navbar>
 		<view class="recharge">
 			<view class="title">选择充值金额</view>
-			<p>当前余额¥0.00</p>
+			<p>当前余额{{detail.balance}}</p>
 			<view class="rechargeMain">
-				<view class="recharge-item" :class="moneyActiveClass == index ? 'active' : ''"
-					v-for="(item,index) in moneyList" :key="item.id" @click="moneyClick(item,index)">{{item.name}}</view>
+				<view class="recharge-item" :class="moneyActiveClass == item.id ? 'active' : ''"
+					v-for="(item,index) in moneyList" :key="item.id" @click="moneyClick(item,item.id)">{{item.rechargeAmount}}</view>
 			</view>
 			<p>其他充值金额</p>
 			<view class="recharge-input">
@@ -39,17 +39,18 @@
 </template>
 
 <script>
+	import * as Pay from '@/apis/weixin.js'
+	import {
+		wxPayJs
+	} from '@/utils/wxpay'
+	import * as API from '@/apis/finance.js'
 	export default {
 		data() {
 			return {
+				detail:{},
 				moneyActiveClass: 1,
 				moneyList: [
-					{id: '1',name: '10'},
-					{id: '2',name: '20'},
-					{id: '3',name: '50'},
-					{id: '4',name: '100'},
-					{id: '5',name: '200'},
-					{id: '6',name: '500'},
+					
 				],
 				list: [{
 						name: '微信支付',
@@ -68,9 +69,82 @@
 				checked: true,
 			}
 		},
+		onReady() {
+			this.init();
+		},
 		methods: {
+			submit(){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				Pay.wxpay(this.chargingMarketingId).then((response) => {
+					if(!response.result){		
+						uni.showToast({
+							title:  response.message
+						})
+						return
+					}
+					var data = response.data
+					uni.hideLoading()
+					console.log("Pay+"+new Date().getTime())		
+					wxPayJs(data);
+						
+				}).catch(error => {
+					this.$refs.common.showLoading(false, error);
+						
+				})
+			},
+			init1(){
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+			
+				API.personalCenter().then((res) => {
+					this.detail = res.data
+						this.isReady=true;
+					uni.hideLoading()
+					
+				}).catch(error => {
+					uni.showToast({
+						title: error
+					})
+				})
+			},
+			init(){
+				
+				
+				
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				var data = {
+					
+				};
+				
+				
+				API.marketingData(data).then((res) => {
+						
+					this.moneyList = res.data.chargingMarketingList
+					if(this.moneyList.length>0){
+						this.selectItem=this.moneyList[0];
+						this.moneyActiveClass=this.moneyList[0].id
+					
+					}
+					uni.hideLoading()
+					this.init1()
+				}).catch(error => {
+					uni.showToast({
+						
+						title: error
+					})
+				})
+			},
 			moneyClick(item,index) {
 				this.moneyActiveClass = index;
+				this.selectItem=item
 			},
 			// 选中某个单选框时,由radio时触发
 			radioChange(e) {
@@ -88,6 +162,10 @@
 					url: '/pages/user/finance/rechargeRes'
 				})
 			}
+		},onShow(){
+			if(this.isReady){
+				this.init1()
+			}
 		}
 	}
 </script>

+ 28 - 18
pages/user/help.vue

@@ -2,9 +2,9 @@
 	<view>
 		<u-navbar title="操作指南"></u-navbar>
 		<view class="collapse">
-			<u-collapse>
-				<u-collapse-item :title="item.head" v-for="(item, index) in itemList" :key="index">
-					{{item.body}}
+			<u-collapse v-if="itemList.length">
+				<u-collapse-item :title="item.title" v-for="(item, index) in itemList" :key="index">
+					{{item.content}}
 				</u-collapse-item>
 			</u-collapse>
 		</view>
@@ -12,27 +12,37 @@
 </template>
 
 <script>
+	import * as API from '@/apis/user.js'
+	
 	export default {
 		data() {
 			return {
-				itemList: [{
-					head: "赏识在于角度的转换",
-					body: "只要我们正确择取一个合适的参照物乃至稍降一格去看待他人,值得赏识的东西便会扑面而来",
-					open: true,
-					disabled: true
-				},{
-					head: "生活中不是缺少美,而是缺少发现美的眼睛",
-					body: "学会欣赏,实际是一种积极生活的态度,是生活的调味品,会在欣赏中发现生活的美",
-					open: false,
-				},{
-					head: "周围一些不起眼的人、事、物,或许都隐藏着不同凡响的智慧",
-					body: "但是据说雕刻大卫像所用的这块大理石,曾被多位雕刻家批评得一无是处,有些人认为这块大理石采凿得不好,有些人嫌它的纹路不够美",
-					open: false,
-				}],
+				itemList: [],
 			}
 		},
+		onReady() {
+			this.getHomePage()
+		},
 		methods: {
-
+			getHomePage(){
+						uni.showLoading({
+							title: "加载中",
+							mask: true,
+						})
+						API.helpList({
+							category:2
+						}).then((res) => {
+							this.itemList = res.data.helpList
+						
+						
+							uni.hideLoading()
+							
+						}).catch(error => {
+							uni.showToast({
+								title: error
+							})
+						})
+					}
 		}
 	}
 </script>

+ 119 - 16
pages/user/message.vue

@@ -3,17 +3,20 @@
 		<u-navbar title="意见反馈"></u-navbar>	  
 		<view class="message">
 			<view class="message-form">
-				<u-form :model="form" ref="uForm" label-width ="100">
+				<u-form :model="subForm" ref="uForm" label-width ="100">
 					<u-form-item label-width="0">
-							<u-input v-model="value" type="textarea"  placeholder="请描述您的商品" height="200"/>
+							<u-input v-model="subForm.content" type="textarea"  placeholder="请描述您的商品" height="200"/>
 					</u-form-item>
 					<u-form-item label-width="0">
 						<view class="upload">
-							<u-upload :action="action" :file-list="fileList" ></u-upload>
+							<u-upload  max-count="3" name="photoFile"
+							ref="uUpload"
+							 :form-data="formData" :header="header" :action="action"
+							  :file-list="listPic" ></u-upload>
 						</view>
 					</u-form-item>
 					<u-form-item >
-						<u-input v-model="value" placeholder="请留下联系方式,方便我们与您取得联系(必填)" />
+						<u-input v-model="subForm.telephone" placeholder="请留下联系方式,方便我们与您取得联系(必填)" />
 					</u-form-item>
 				</u-form>
 			</view>
@@ -23,26 +26,126 @@
 </template>
 
 <script>
+	import * as API from '@/apis/user.js'
+	import * as WxJsApi from '@/utils/wxJsApi'
+	
 	export default {
 		data() {
 			return {
-				form: {
+				isReady:false,
+				imgBase64: '',
+				listPic: [],
+				action:"",
+				formData:{},
+				header:{
+					
 				},
-				value: '',
-				action: 'http://www.example.com/upload',
-				fileList: [
-					{
-						url: 'http://pics.sc.chinaz.com/files/pic/pic9/201912/hpic1886.jpg',
-					}
-				]
+				subForm: {
+					content: '',
+					picUrl: '',
+					telephone: ''
+				}
 			}
+		},onLoad() {
+			this.action=process.car.BASE_URL+"uploadPicture"
+			
+			this.formData.subFolder="/team51/message"
+			//接口应该免登陆
+		// 	var token=this.carhelp.getToken()
+			
+		// 	this.header={
+		
+		// 		'Authorization':token
+		// 	}
+			//获取微信配置
+			WxJsApi.getWxConfig(['getLocation','addEventListener']).then((res)=>{
+			
+				this.isReady=true;
+				console.log(res)
+			 
+			}).catch(error => {
+					console.log(res)
+			})
 		},
 		methods: {
-			submit() {
-				uni.redirectTo({
-					url: '/pages/user/index'
+			 
+			//微信选择图片
+			chooseImage() {
+				WxJsApi.chooseImage().then(res => {
+					var localData = res.localData;
+			
+					if (localData.indexOf('data:image') != 0) {
+						//判断是否有这样的头部
+						localData = 'data:image/jpeg;base64,' + localData
+					}
+					localData = localData.replace(/\r|\n/g, '').replace('data:image/jgp', 'data:image/jpeg')
+					this.imgBase64 = localData;
+					this.uploadpic();
+				}).catch(error => {
+					mui.toast(error);
 				})
-			}
+			},
+			//上传图片
+			uploadpic() {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				
+				WxJsApi.uploadPic(this.imgBase64).then(response => {
+					this.isLoading = false;
+			
+					this.listPic.push(response);
+				}).catch(error => {
+					this.isLoading = false;
+					mui.toast(error);
+				})
+			},
+			//表单检测
+			checkFrom() {
+				if (!this.subForm.content) {
+					mui.toast('请输入内容');
+					return false;
+				} else {
+					return true;
+				}
+			},
+			//提交
+			submit() {
+				let files = [];
+								// 通过filter,筛选出上传进度为100的文件(因为某些上传失败的文件,进度值不为100,这个是可选的操作)
+								files = this.$refs.uUpload.lists.filter(val => {
+									return val.progress == 100;
+								})
+								// 如果您不需要进行太多的处理,直接如下即可
+								// files = this.$refs.uUpload.lists;
+				
+				console.log(files);
+				return
+				if (this.checkFrom()) {
+					this.subForm.picUrl = this.listPic.join(',');
+					uni.showLoading({
+						title: "加载中",
+						mask: true,
+					})
+					API.problemFeedback(this.subForm).then(response => {
+						this.isLoading = false;
+						uni.showToast({
+							title: '提交成功'
+						})
+						
+						uni.navigateBack({
+							
+						})
+			
+					}).catch(error => {
+						this.isLoading = false;
+						uni.showToast({
+							title: error
+						})
+					})
+				}
+			},
 		}
 	}
 </script>