zhengkaixin 3 anni fa
parent
commit
f244ac866d

+ 10 - 0
apis/friends.js

@@ -0,0 +1,10 @@
+import request from '../utils/request.js';
+import Qs from 'qs';
+
+export function inviteCouponList(data) {
+	 
+	return request({
+		method: 'post',
+		url: '/mobile/chargingCouponApi/inviteCouponList'
+	})
+}

+ 100 - 0
components/ShareServer.vue

@@ -0,0 +1,100 @@
+<template>
+	<div></div>
+</template>
+
+<script>
+	import wx from 'weixin-js-sdk'
+	import * as API_WeiXin from '@/apis/weixin'
+
+	export default {
+		name: 'Share',
+		props: {
+			 
+		},
+		data() {
+			return {
+				url:'',
+				isLoading: false,
+				nowItem: {
+					shareTitle: '',
+					shareImg: '',
+					shareDescription: ''
+				}
+			}
+		},
+		created() {},
+		methods: {
+			 
+
+			//获取微信jssdk配置信息
+			get_wx_config() {
+				this.isLoading = true;
+				API_WeiXin.getConfig(window.location.href.split("#")[0]).then(response => {
+					this.isLoading = false;
+
+					var wxconfig = response.wxConfig;
+					console.log(wxconfig.nonceStr)
+					this.wxConfig = wxconfig;
+					wx.config({
+						debug: false, // 开启调试模式,
+						appId: wxconfig.appId, // 必填,企业号的唯一标识,此处填写企业号corpid
+						timestamp: wxconfig.timestamp, // 必填,生成签名的时间戳
+						nonceStr: wxconfig.nonceStr, // 必填,生成签名的随机串
+						signature: wxconfig.signature, // 必填,签名,见附录1
+						jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareQZone'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
+					});
+					//this.wxShare()
+				}).catch(error => {
+					this.isLoading = false;
+					this.mui.toast(error);
+				})
+			},
+			setUrl(url){
+				this.url=window.location.href.split("#")[0]+"#"+url;
+			},
+			setTitle(text){
+				this.title=text;
+				this.wxShare() 
+				
+			},
+			//微信分享自定义
+			wxShare() {
+				var img=window.location.href.split("#")[0]+"/"+require("@/assets/img/logo_qilian.jpg")
+				console.log(this.nowItem);
+				var title="[荆州市企业联合会]"+this.title
+			//	var desc=
+				let joinUrl = this.url;
+				var _this = this;
+				wx.ready(function() {
+					wx.onMenuShareAppMessage({
+						title: title,
+					//	desc:desc ,
+						link: joinUrl,
+						 imgUrl: img,
+						success: function() {
+							// 设置成功
+							_this.$emit("wxShare",null);
+						}
+					})
+					wx.onMenuShareTimeline({
+						title: title,
+						//desc:desc ,
+						link: joinUrl,
+						 imgUrl: img,
+						success: function() {
+							// 设置成功
+							_this.$emit("wxShare",null);
+						}
+					})
+				});
+			}
+		},
+		mounted() {
+			this.url=window.location.href;
+			this.get_wx_config();
+		},
+	}
+</script>
+
+<style>
+</style>

+ 8 - 1
pages/login/welcome.vue

@@ -177,7 +177,14 @@
 			
 			this.findNoLTextConfigure()
 			this.findByOpenId()
-			if(op.gunId){
+			if(op.friends){
+				
+				this.carhelp.set("friends_invitation",{
+					op:op,
+					date:new Date().getTime()
+				})
+			
+			}else  if(op.gunId){
 				var k=API.codeOperation("jp_team51_charge_id:A_"+op.gunId);
 				if(k){
 					uni.redirectTo({

+ 2 - 2
pages/record/details.vue

@@ -15,7 +15,7 @@
 			<view class="oldTextjp2" oldstyle="font-size: 18px;">
 				<view class="details-row"><p>电费</p><span>{{chargeDetail.totalElecMoney != null ? chargeDetail.totalElecMoney : '0.00'}}元</span></view>
 				<view class="details-row"><p>服务费</p><span>{{chargeDetail.totalServiceMoney != null ? chargeDetail.totalServiceMoney : '0.00'}}元</span></view>
-				<view class="details-row"><p>优惠券抵扣</p><span style="color:red">{{userCouponObj? userCouponObj.text+'元' : '未使用'}}</span></view>
+				<view class="details-row"><p>优惠券抵扣</p><span style="color:red">{{userCouponObj? userCouponObj.text : '未使用'}}</span></view>
 			</view>
 		</view>
 		<view class="details">
@@ -23,7 +23,7 @@
 				<h4 class="oldTextjp" oldstyle="font-size: 20px;">充电详情</h4>
 			</view>
 			<view class="oldTextjp2" oldstyle="font-size: 18px;">
-				<view class="details-row"><p>消费电量(度)</p><span>{{chargeDetail.electricQuantity != null ? chargeDetail.electricQuantity/10000 : '0.000'}}</span></view>
+				<view class="details-row"><p>消费电量(度)</p><span>{{chargeDetail.electricQuantity != null ? chargeDetail.electricQuantity : '0.000'}}</span></view>
 				<view class="details-row"><p>开始时间</p><span>{{chargeDetail.startTime}}</span></view>
 				<view class="details-row"><p>结束时间</p><span>{{chargeDetail.endTime}}</span></view>
 				<view class="details-row"><p>充电时长</p><span>{{chargeDetail.chargingMinute != null ? chargeDetail.chargingMinute+'分' : '00分00秒'}}</span></view>

+ 1 - 1
pages/record/index.vue

@@ -22,7 +22,7 @@
 						<p :style="elderStatus ? 'font-size: 14px' : ''">开始时间:{{item.status == '0' || item.status == '4' ? '暂未开始' : item.createTime}}</p>
 					</view>
 					<view class="recordList-row">
-						<p :style="elderStatus ? 'font-size: 14px' : ''">充电电量:{{item.electricQuantity != null ? item.electricQuantity/10000 : '0.000'}}度</p>
+						<p :style="elderStatus ? 'font-size: 14px' : ''">充电电量:{{item.electricQuantity != null ? item.electricQuantity : '0.000'}}度</p>
 					</view>
 					<view class="recordList-row">
 						<p :style="elderStatus ? 'font-size: 14px' : ''">充电时长:{{item.chargingMinute != null ? item.chargingMinute+'分钟' : '00分00秒'}}</p>

+ 48 - 53
pages/user/InviteFriends.vue

@@ -1,5 +1,9 @@
 <template>
 	<view>
+		<u-mask :show="show" @click="show = false">
+				<u-image width="100%" height="500px"  :mode="'widthFix'"  src="/static/img/guide_point.png"></u-image>
+				
+		</u-mask>
 		<u-navbar title="邀请好友"></u-navbar>
 		<view class="InviteFriends">
 			<view class="InviteFriends-head">
@@ -46,21 +50,7 @@
 						</view>
 					</view>
 					<view class="reward-main">
-						<view class="reward-info">
-							<view class="reward-info-item">
-								<p>待兑换</p>
-								<view class="reward-info-price">
-									<h2>5</h2><span>元</span>
-								</view>
-							</view>
-							<view class="reward-info-item reward-info-item2">
-								<p>已兑换</p>
-								<view class="reward-info-price">
-									<h2>5</h2><span>元</span>
-								</view>
-							</view>
-						</view>
-						<view class="reward-btn">兑换奖励</view>
+						
 						<view class="reward-list">
 							<view class="reward-list-title">
 								成功邀请记录
@@ -102,65 +92,70 @@
 <script>
 	import wx from 'weixin-js-sdk'
 	import * as API_WeiXin from '@/apis/weixin'
+	import * as API from '@/apis/friends.js'
+	import * as WxJsApi from '@/utils/wxJsApi.js'
 	
 	export default {
 		data() {
 			return {
-				
+				id:"",
+				code:"",
+				show:false,
 			}
 		},
-		onLoad() {
+		onLoad(op) {
+				this.id=op.id
+				this.code=op.code
 				this.get_wx_config();
+				
+		},
+		onShow() {
+				//this.inviteCouponList();
 		},
 		methods: {
+			inviteCouponList(){
+						uni.showLoading({
+							title: "加载中",
+							mask: true,
+						})
+						API.inviteCouponList().then((res) => {
+							this.list = res.data.helpList
+						
+						
+							uni.hideLoading()
+							
+						}).catch(error => {
+							uni.showToast({
+								title: error
+							})
+						})
+					},
 			inviteFriendsBtn(){
-				WeixinJSBridge.invoke('sendAppMessage',{
-				"appid": process.car.VUE_APP_WXAPPID,
-				"img_url": "",
-				"img_width": "200",
-				"img_height": "200",
-				"link": window.location.href,
-				"desc": "descContent",
-				"title": "shareTitle"
-				}, function(res) {
-				//_report('send_msg', res.err_msg);
-				})
+				 this.show=true;
 			},
 			//获取微信jssdk配置信息
 			get_wx_config() {
-				this.isLoading = true;
-				API_WeiXin.getConfig(window.location.href.split("#")[0]).then(response => {
-					this.isLoading = false;
-			
-					var wxconfig = response.wxConfig;
-					console.log(wxconfig.nonceStr)
-					this.wxConfig = wxconfig;
-					wx.config({
-						debug: false, // 开启调试模式,
-						appId: wxconfig.appId, // 必填,企业号的唯一标识,此处填写企业号corpid
-						timestamp: wxconfig.timestamp, // 必填,生成签名的时间戳
-						nonceStr: wxconfig.nonceStr, // 必填,生成签名的随机串
-						signature: wxconfig.signature, // 必填,签名,见附录1
-						jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareQZone'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
-					});
-					//this.wxShare()
+				WxJsApi.getWxConfig( ['onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareQZone']).then((res) => {
+					// console.log(res)
+					this.wxShare()
 				}).catch(error => {
-					// this.isLoading = false;
-					// this.mui.toast(error);
+					console.log(error)
 				})
 			},
 			//微信分享自定义
 			wxShare() {
-				var img="";//window.location.href.split("#")[0]+"/"+require("@/assets/img/logo_qilian.jpg")
+				var info=this.carhelp.getPersonInfo()
+				var img=""//require("@/static/img/aboutus.png")
 				console.log(this.nowItem);
-				var title="[荆州市企业联合会]"+this.title
-			//	var desc=
-				let joinUrl = this.url;
+				var ProjectName=process.car.ProjectName;
+				var title="["+ProjectName+"]"+'和好友一起领5元红包'
+			 	var desc="来自"+info.name+"的邀请"
+				let joinUrl = window.location.href.split("#")[0]+"#/?friends=friends&id="+this.id+"&icode="+this.code+"&uid="+info.id;
 				var _this = this;
 				wx.ready(function() {
 					wx.onMenuShareAppMessage({
 						title: title,
-					//	desc:desc ,
+						desc:desc ,
 						link: joinUrl,
 						 imgUrl: img,
 						success: function() {
@@ -170,7 +165,7 @@
 					})
 					wx.onMenuShareTimeline({
 						title: title,
-						//desc:desc ,
+						desc:desc ,
 						link: joinUrl,
 						 imgUrl: img,
 						success: function() {
@@ -378,7 +373,7 @@
 		}
 	}
 	.reward-list{
-		border-top: 1px dashed #cacaca;
+		//border-top: 1px dashed #cacaca;
 		padding-top: 20px;
 		.reward-list-title{
 			font-size: 18px;

+ 1 - 1
pages/user/index.vue

@@ -169,7 +169,7 @@
 			WxJsApi.getWxConfig(['getLocation', 'addEventListener', 'scanQRCode']).then((res) => {
 				// console.log(res)
 			}).catch(error => {
-				console.log(res)
+				console.log(error)
 			})
 			
 			var  consumerPhone=this.carhelp.getConfig().consumerPhone

BIN
static/img/guide_point.png