Browse Source

优惠码

李天标 5 năm trước cách đây
mục cha
commit
6344ddda2a
3 tập tin đã thay đổi với 66 bổ sung3 xóa
  1. 7 1
      App.vue
  2. 18 0
      pages.json
  3. 41 2
      pages/User/buyPromo.vue

+ 7 - 1
App.vue

@@ -7,7 +7,13 @@
 		// 	console.log('App Show');
 		// },
 		// onHide: function() {
-		// 	console.log('App Hide');
+		// 	console.log('返回上一页');
+		// 	uni.navigateTo({
+		// 	    url: 'pages/User/user'
+		// 	});
+		// },
+		// onBackPress: function(){
+		// 	console.log('返回上一页2');
 		// }
 	}
 </script>

+ 18 - 0
pages.json

@@ -52,6 +52,24 @@
 			}
 		},
 		{
+		    "path" : "pages/User/promoCode",
+		    "style" : {
+				"navigationBarTitleText":"优惠码"
+			}
+		},
+		{
+		    "path" : "pages/User/buyPromo",
+		    "style" : {
+				"navigationBarTitleText":"购买优惠码"
+			}
+		},
+		{
+		    "path" : "pages/User/equipmentName",
+		    "style" : {
+				"navigationBarTitleText":"修改设备名称"
+			}
+		},
+		{
 			"path": "pages/Charts/elseStatistics",
 			"style": {
 				"navigationBarTitleText": "统计图表"

+ 41 - 2
pages/User/buyPromo.vue

@@ -33,6 +33,10 @@
 				<p class="p">购买</p>
 			</button>
 		</view>
+		<view class="" style="margin: auto;">
+			<font class="font1">{{title}}</font>
+			<image class="img"  :src=img mode=""></image>
+		</view>
 	</view>
 </template>
 
@@ -42,7 +46,9 @@
 			return {
 				price:null,
 				num:'10',
-				day:'30'
+				day:'30',
+				title:'',
+				img:null
 			}
 		},
 		onLoad() {
@@ -69,7 +75,28 @@
 					});
 					return null;
 				}
-				console.log(this.num+this.day)
+				var p = this.price;
+				var n = this.num;
+				var pri = p*n;
+				if(pri==0){
+					uni.showModal({
+						content: '价格为0',
+						showCancel: false
+					});
+					return null;
+				}
+				var globalUser = uni.getStorageSync("globalUser");
+				var id = globalUser.id;
+				uni.request({
+					url: this.serverurl + '/TPromoCode/buy?pri='+pri+'&adminId='+id+'&day='+this.day,
+					method: "GET",
+					success: (res) => {
+						var img = res.data.data;
+						this.title = "请用微信扫码支付";
+						this.img = img;
+					}
+				})
+				console.log(pri)
 			}
 		},
 
@@ -138,4 +165,16 @@
 		font-size: 45upx;
 		font-family: "PingFang-SC-Bold";
 	}
+	.font1{
+		color: #F4AE1B;
+		padding-left: 300upx;
+		padding-top: 100upx;
+		font-size: 25upx;
+		font-family: "PingFang-SC-Bold";
+	}
+	.img{
+		height: 650upx;
+		weight:650upx;
+		margin: auto;
+	}
 </style>