hmp 4 роки тому
батько
коміт
064f8b7b84

+ 12 - 1
assets/http/api.js

@@ -23,6 +23,9 @@ const activity = {
 const wxApp={
 	getOpenId:p => http.get('/wx-app/getOpenId', {params:p}),
 	getOpenData:p => http.post('/wx-app/getOpenData',p),
+	getGenerateScheme: p => http.get('/wx-app/getGenerateScheme', {
+		params: p
+	}),
 }
 
 //字典
@@ -76,6 +79,13 @@ const order={
 	exchange:p => http.post('/app/help/goods/exchangeProps',p,{header:{'Content-Type':'application/x-www-form-urlencoded'}}),
 }
 
+/**
+ * 用户地址
+ */
+const address={
+	list:p => http.get('sing_user/useraddress/list', {params:p}),
+}
+
 
 export const api={
 	uploadFile,
@@ -89,5 +99,6 @@ export const api={
 	heatrecord,
 	CMCC,
 	pointgoods,
-	order
+	order,
+	address
 }

+ 6 - 1
manifest.json

@@ -68,5 +68,10 @@
     "uniStatistics" : {
         "enable" : false
     },
-    "vueVersion" : "2"
+    "vueVersion" : "2",
+    "h5" : {
+        "router" : {
+            "base" : "/h5/"
+        }
+    }
 }

+ 27 - 0
pages.json

@@ -120,6 +120,33 @@
             }
             
         }
+        ,{
+            "path" : "pages/webview/auth_result",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "授权结果",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+        ,{
+            "path" : "pages/shop/detail",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "商品详情",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+        ,{
+            "path" : "pages/webview/point_rule",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "积分兑换规则",
+                "enablePullDownRefresh": false
+            }
+            
+        }
     ],
 	"tabBar": {
 		"color": "#555555",

+ 1 - 1
pages/mine/mine.vue

@@ -137,7 +137,7 @@
 					{
 						name: '活动规则',
 						icon: '/static/mine/guize.png',
-						url: '',
+						url: '/pages/webview/point_rule?url=https://vote.guosen-fumao.cn/point_rule.html',
 						auth: false //是否登录验证
 					},
 					{

+ 194 - 0
pages/shop/detail.vue

@@ -0,0 +1,194 @@
+<template>
+	<view :style="vuex_skin">
+		<view class="goods">
+			<image @click="$util.preview(detail.imgUrl)" :src="detail.imgUrl" style="width: 100vw;" mode="widthFix"></image>
+			<view class="title">
+				<view class="text-bold" style="color: #353535;font-family: PingFang-SC-Bold;font-size: 34rpx;">{{detail.name}}</view>
+				<view class=" text-base" style="padding: 20rpx 0;">
+					<view class="text-bold text-lg">
+						{{detail.point}}
+						<text style="padding-left: 6rpx;">积分</text>
+					</view>
+				</view>
+				<block v-if="!$u.test.isEmpty(detail.content)">
+					<view class="text-sm" style="color: #888888;line-height: 42rpx;">产品说明:{{detail.content}}</view>
+				</block>
+			</view>
+		</view>
+		<block v-if="exchangeShow">
+			<view hover-class="none" class="container flex align-center justify-between"
+				style="border-bottom: 1rpx solid #efefef;">
+				<view class="flex padding align-center">
+					<image src="@/static/mine/address.png" style="width: 65upx;height: 65upx;"></image>
+					<view class="padding-left text-sm" v-if="!$u.test.isEmpty(address)">
+						<view style="font-size: 28upx;font-family: PingFang SC;font-weight: 800;color: #000000;">
+							{{address.consignee}} {{address.phone}}
+						</view>
+						<view class="text-gray">{{address.address}}</view>
+					</view>
+					<view class="padding-left"
+						style="font-size: 28upx;font-family: PingFang SC;font-weight: 800;color: #000000;" v-else>
+						请选择收货地址</view>
+				</view>
+				<view class="padding">
+					<u-icon name="arrow-right" color="#d4d4d4"></u-icon>
+				</view>
+			</view>
+
+			<view class="padding-sm">
+				<view class="flex padding-xs">
+					<text class="flex justify-center align-center">积分数:</text>
+					<u-number-box :disabled="$u.test.isEmpty(userInfo.pufaPoint)" @change="pufaPointChange"
+						:input-width="200" :min="0" v-model="data.pufaPoint">
+					</u-number-box>
+				</view>
+			</view>
+		</block>
+
+		<view class="" style="height: 140rpx;">
+
+		</view>
+
+		<view v-if="!exchangeShow" class="footer-fixed flex align-center justify-end padding bg-white"
+			style="padding: 30rpx;;border-top: 1rpx solid #e5e5e5;z-index: 9;">
+			<button class="cu-btn round text-white bg-base" style="width: 180upx;height: 80upx;"
+				@click="exchange">兑换</button>
+		</view>
+
+		<view v-else class="footer-fixed flex align-center justify-between  bg-white"
+			style="border-top: 1rpx solid #e5e5e5;padding: 30rpx;z-index: 9;">
+			<view class="text-red">
+				<text>需支付</text>
+				<text>¥</text>
+				<text>{{cashValue}}</text>
+			</view>
+			<view>
+				<button class="cu-btn round text-white bg-base" style="width: 180upx;height: 80upx;margin-right: 10upx;"
+					@click="confirm">兑换</button>
+				<button @click="exchangeShow = false" class="cu-btn round line-gray"
+					style="width: 180upx;height: 80upx;z-index: 99;">取消</button>
+			</view>
+		</view>
+		<login ref="login" @signIn="signIn" @phoneSuccess="phoneSuccess"></login>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				id: '',
+				//商品详情
+				detail: {},
+				//商品地址
+				address: {},
+				//用户信息
+				userInfo: {},
+				//点击兑换
+				exchangeShow: false,
+				//兑换的积分数
+				cashValue: 0,
+				data: {
+					pufaPoint: 0
+				},
+			}
+		},
+		onLoad(options) {
+			this.id = options.id;
+			if (this.$u.test.isEmpty(this.id)) {
+				this.$u.toast('商品id不能为空')
+				return
+			}
+			this.fetchGoodsDetail()
+			this.fetchUserInfo()
+		},
+		onShow() {
+			this.getAddress()
+		},
+		methods: {
+			pufaPointChange(e) {
+
+			},
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+			/**
+			 * 获取用户信息
+			 */
+			fetchUserInfo() {
+				if (this.$cache.get('userInfo')) {
+					this.userInfo = this.$cache.get('userInfo')
+					return
+				}
+				if (this.$isEmpty(this.vuex_userId)) {
+					this.showLogin()
+					return
+				}
+				let params = {
+					id: this.vuex_userId
+				}
+				this.$api.loginUser.detail(params).then(res => {
+					this.userInfo = res.data.data
+				})
+			},
+			/**
+			 * 获取用户地址
+			 */
+			getAddress() {
+				this.$api.address.list({
+					userId: this.vuex_userId
+				}).then(res => {
+					this.address = res.data.data.records[0];
+				})
+			},
+			/**
+			 * 获取商品详情
+			 */
+			fetchGoodsDetail() {
+				let params = {
+					id: this.id
+				}
+				this.$api.pointgoods.list(params).then(res=>{
+					this.detail=res.data.data.records[0]
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	page {
+		background-color: #FFFFFF;
+	}
+
+	.goods {
+		padding-bottom: 20rpx;
+		border-bottom: 1rpx solid #efefef;
+
+		.title {
+			padding-top: 20rpx;
+			margin-left: 20rpx;
+			font-size: 32rpx;
+			color: #363636;
+		}
+	}
+</style>

+ 10 - 9
pages/shop/shop.vue

@@ -1,5 +1,5 @@
 <template>
-	<view :style="vuex_skin">
+	<view :style="vuex_skin" style="width: 100vw;overflow: hidden;">
 		<u-navbar title-color="#fff" z-index="90" :border-bottom="false" :is-back="false" title="积分商城"
 			:background="{'backgroundColor': vuex_theme.shopBg}"></u-navbar>
 
@@ -34,7 +34,8 @@
 			</view>
 			<view class="recommend-info">
 				<view class="goods-list">
-					<view class="list" v-for="(item,index) in list" :key="index">
+					<navigator hover-class="none" :url="'detail?id='+item.id" class="list" v-for="(item,index) in list"
+						:key="index">
 						<view class="pictrue">
 							<image :src="item.imgUrl"></image>
 						</view>
@@ -51,7 +52,7 @@
 							<button class="cu-btn round text-white bg-base"
 								style="width: 140upx;height: 50upx;">兑换</button>
 						</view>
-					</view>
+					</navigator>
 				</view>
 			</view>
 		</mescroll-body-diy>
@@ -83,7 +84,7 @@
 			this.fetchUserInfo()
 		},
 		methods: {
-			fetchUserInfo(){
+			fetchUserInfo() {
 				if (!this.vuex_userId) {
 					return
 				}
@@ -92,11 +93,11 @@
 				}
 				this.$api.loginUser.detail(params).then(res => {
 					if (this.$isNotEmpty(res.data.data)) {
-						this.userData=res.data.data
-						let userInfo=this.userData
-						userInfo.sessionKey=this.$cache.get('userInfo').sessionKey
-						this.$cache.put('userInfo',userInfo)
-						this.$u.vuex('vuex_phone',this.userData.phone)
+						this.userData = res.data.data
+						let userInfo = this.userData
+						userInfo.sessionKey = this.$cache.get('userInfo').sessionKey
+						this.$cache.put('userInfo', userInfo)
+						this.$u.vuex('vuex_phone', this.userData.phone)
 					}
 				})
 			},

+ 93 - 0
pages/webview/auth_result.vue

@@ -0,0 +1,93 @@
+<template>
+	<view >
+		<view class="content" >
+			<view style="padding-top: 150rpx;">
+				<text class="cuIcon-roundcheckfill" :class="success?'text-success':'text-error'" style="font-size: 150rpx;"></text>
+			</view>
+			<view class="tips">
+				<text class="title" v-text="success?'授权成功':'授权失败'"></text>
+				<text class="desc" v-text="success?'请打开小程序继续助力':response.message"></text>
+			</view>
+			<view class="cu-btn btn radius line-gray" @click.stop="confirm">
+				确认
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				response:{},
+				success:false
+			}
+		},
+		onLoad(options) {
+			this.response = JSON.parse(decodeURIComponent(options.response))
+			if (this.response.resultCode == '0000') {
+				this.success=true
+			}else{
+				this.success=false
+			}
+			
+		},
+		methods: {
+			confirm(){
+				location.href = "weixin://dl/business/?t=X2CyIQDbgtm"
+			}
+		}
+	}
+</script>
+
+<style>
+	page {
+		background-color: #FFFFFF;
+		
+	}
+</style>
+<style lang="scss" scoped>
+	.text-success{
+		color: #19be6b;
+	}
+	
+	.text-error{
+		color: #de5454;
+	}
+	
+	.content {
+		display: flex;
+		flex-direction: column;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+
+		image {
+			width: 150rpx;
+			height: 150rpx;
+		}
+
+		.tips {
+			margin-top: 20rpx;
+			display: flex;
+			flex-direction: column;
+			text-align: center;
+
+			.title {
+				font-size: 36rpx;
+			}
+
+			.desc {
+				margin-top: 20rpx;
+				font-size: 28rpx;
+				color: #969696;
+			}
+		}
+
+		.btn {
+			margin-top: 40rpx;
+			width: 50%;
+			padding: 42rpx;
+		}
+	}
+</style>

+ 22 - 0
pages/webview/point_rule.vue

@@ -0,0 +1,22 @@
+<template>
+	<view>
+		
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				
+			}
+		},
+		methods: {
+			
+		}
+	}
+</script>
+
+<style>
+
+</style>

BIN
static/mine/address.png