Browse Source

no message

zpj 1 năm trước cách đây
mục cha
commit
36f19e9997
7 tập tin đã thay đổi với 170 bổ sung và 16 xóa
  1. 1 1
      package.json
  2. 2 1
      pages.json
  3. 30 9
      pages/index/order.vue
  4. 91 5
      pages/index/success.vue
  5. 46 0
      pages/mod/countdown.vue
  6. BIN
      static/img/s-1.png
  7. BIN
      static/img/s-2.png

+ 1 - 1
package.json

@@ -1,5 +1,5 @@
 {
   "dependencies": {
-    "uniapp-keyboard-listener": "^1.0.4"
+    "uniapp-keyboard-listener":"^1.0.4"
   }
 }

+ 2 - 1
pages.json

@@ -30,7 +30,8 @@
 		"navigationBarTitleText": "",
 		"navigationBarBackgroundColor": "#F8F8F8",
 		"backgroundColor": "#F8F8F8",
-		"navigationStyle": "custom"
+		"navigationStyle": "custom",
+		"rpxCalcMaxDeviceWidth": 1366
 	},
 	"uniIdRouter": {}
 }

+ 30 - 9
pages/index/order.vue

@@ -4,6 +4,10 @@
 	  <view class="box-1 align-items-start">
 	  	<image src="@/static/img/jiankong.png" mode=""></image>
 		<view class="fs-32 fc-3 fw-b">你已进入监控区域</view>
+		
+		<view class="box-1-time">
+			<Countdown></Countdown>
+		</view>
 	  </view>
 		
 		
@@ -92,9 +96,10 @@
 import keyboardListener from 'uniapp-keyboard-listener';
 import {GoodsInfo,OrderCreate,OrderPay} from '@/api/cashierApi.js'
 import tools from '@/common/js/tools';
+import Countdown from '../mod/countdown.vue'
 
 export default {
-  components: {keyboardListener},
+  components: {keyboardListener,Countdown},
   data() {
     return {
 	  totalNum:0,//总数量
@@ -155,7 +160,7 @@ export default {
 					this.payFLag = true;
 					this.isAJAX = false;
 					uni.redirectTo({
-						url:'/pages/index/success'
+						url:'/pages/index/success?money=' + this.totalPrice
 					})
 				}else{
 					this.isAJAX = false;
@@ -184,7 +189,7 @@ export default {
 						if(v.id == obj.id){
 							v.num += 1;
 							this.totalNum += 1;
-							this.totalPrice += v.price;
+							this.totalPrice = (this.totalPrice*1 + v.price*1).toFixed(2);
 							flag = false;
 						}
 					})
@@ -192,32 +197,43 @@ export default {
 						obj.num = 1;
 						this.goodsList.push(obj)
 						this.totalNum += 1;
-						this.totalPrice += res.data.price;
+						this.totalPrice = (this.totalPrice*1 + res.data.price*1).toFixed(2);
 					}
 				}
+				this.headValue = '';
+			}else{
+				this.headValue = '';
+				tools.error(res.msg)
 			}
 		})
 	},
 	// 删除商品
 	delGoods(i){
-		
+		this.totalNum = this.totalNum - this.goodsList[i].num;
+		this.totalPrice = (this.totalPrice*1 - (this.goodsList[i].price*this.goodsList[i].num)).toFixed(2);
+		this.goodsList.splice(i,1)
 	},
 	// 减少
 	reduce(i){
 		this.goodsList[i].num -= 1
 		this.totalNum -= 1;
-		this.totalPrice = this.totalPrice - this.goodsList[i].price;
+		this.totalPrice = (this.totalPrice*1 - (this.goodsList[i].price*1)).toFixed(2);
 	},
 	// 添加 
 	add(i){
 		this.goodsList[i].num += 1
 		this.totalNum += 1;
-		this.totalPrice = this.totalPrice + this.goodsList[i].price;
+		this.totalPrice = (this.totalPrice*1 + this.goodsList[i].price*1).toFixed(2);
 	},
 	// 支付
 	save(){
-		this.payFLag = false;
-		this.$refs.popup.open('center')
+		if(this.goodsList.length > 0){
+			this.payFLag = false;
+			this.$refs.popup.open('center')
+		}else{
+			tools.error('请添加商品')
+		}
+		
 	},
 	// 选择支付类型
 	selectTyep(type){
@@ -276,6 +292,11 @@ export default {
 			box-sizing: border-box;
 			padding: 80rpx 0 0 24rpx;
 			position: relative;
+			.box-1-time{
+				position: absolute;
+				bottom: 20rpx;
+				right: 20rpx;
+			}
 			image{
 				width: 48rpx;
 				height: 48rpx;

+ 91 - 5
pages/index/success.vue

@@ -1,15 +1,101 @@
 <template>
-	<view>
-
+	<view class="success-box">
+		<view class="box-1"></view>
+		
+		<view class="img-1">
+			<image class="img-2" src="@/static/img/s-2.png" mode="scaleToFill"></image>
+			
+			<view class="text-align-center fs-32 fc-3 fw-400 mb-25 ">支付成功</view>
+			
+			<view class="text-align-center fs-42 fc-3 fw-b mb-120 ">¥{{totalPrice}}</view>
+			
+			<view class="fs-30 text-align-center fc-6 fw-400 ">请取走你的小票和商品</view>
+		</view>
+		
+		<view class="box-border-box box-2 flex-justify-space">
+			<view class="" @click="out()">退出登录</view>
+			<view class="" @click="buy()">继续购买</view>
+		</view>
+		
 	</view>
 </template>
 
 <script>
 	export default {
-		
+		data(){
+			return{
+				totalPrice:'',
+			}
+		},
+		onLoad(e) {
+			this.totalPrice = e.money
+		},
+		methods:{
+			out(){
+				window.localStorage.clear()
+				uni.clearStorageSync()
+				uni.reLaunch({
+					url:'/pages/login/index'
+				})
+			},
+			buy(){
+				uni.redirectTo({
+					url:'/pages/index/index'
+				})
+			}
+		},
 	}
 </script>
 
-<style scoped>
-
+<style scoped lang="scss">
+	.success-box{
+		width: 100%;
+		height: 100vh;
+		background-color: #F2F3F5;
+		position: relative;
+		
+		.box-2{
+			margin-top: 600rpx;
+			padding: 0 40rpx;
+			view{
+				width: 46%;
+				height: 83rpx;
+				line-height: 83rpx;
+				border-radius: 69rpx;
+				border: 2rpx solid #1778FD;
+				text-align: center;
+				color: #1778FD;
+				font-size: 32rpx;
+			}
+		}
+		
+		.box-1{
+			width: 750rpx;
+			height: 272rpx;
+			background: #0473CF;
+			border-radius: 0 0 100rpx 100rpx;
+			
+		}
+		.img-1{
+			background: url('@/static/img/s-1.png') no-repeat;
+			background-size: 100% 100%;
+			position: absolute;
+			top: 185rpx;
+			left: 48rpx;
+			width: 650rpx;
+			height: 610rpx;
+			z-index: 0;
+			box-sizing: border-box;
+			padding-top: 78rpx;
+		}
+		.img-2{
+			width: 160rpx;
+			height: 127rpx;
+			margin: 0 auto 35rpx auto;
+			z-index: 2;
+		}
+		.mb-120{
+			margin-bottom: 140rpx;
+		}
+	}
 </style>

+ 46 - 0
pages/mod/countdown.vue

@@ -0,0 +1,46 @@
+<template>
+	<view class="time-box">
+		交易取消{{s}}s
+	</view>
+</template>
+
+<script>
+	export default {
+		data(){
+			return{
+				s:360
+			}
+		},
+		mounted() {
+			this.timeFun()
+		},
+		methods:{
+			timeFun(){
+				let timeServer = setInterval(() => {
+					--this.s;
+					if (this.s <= 0) {
+						clearInterval(timeServer);
+						window.localStorage.clear()
+						uni.clearStorageSync()
+						uni.reLaunch({
+							url:'/pages/login/index'
+						})
+					}
+				}, 1000);
+			},
+		},
+	}
+</script>
+
+<style scoped lang="scss">
+	.time-box{
+		width: 223rpx;
+		height: 57rpx;
+		line-height: 57rpx;
+		text-align: center;
+		border-radius: 104rpx;
+		border: 2rpx solid #CCCCCC;
+		font-size: 28rpx;
+		color: #666;
+	}
+</style>

BIN
static/img/s-1.png


BIN
static/img/s-2.png