zpj 1 سال پیش
والد
کامیت
3e0a6df86b
6فایلهای تغییر یافته به همراه88 افزوده شده و 58 حذف شده
  1. 0 1
      common/js/ajax.js
  2. 1 1
      manifest.json
  3. 69 37
      pages/index/order.vue
  4. 3 10
      pages/index/success.vue
  5. 15 9
      pages/mod/countdown.vue
  6. BIN
      static/img/no-goods.png

+ 0 - 1
common/js/ajax.js

@@ -42,7 +42,6 @@ export const request = (url, method, data, show = false) => {
             resolve(res.data)
           }
         }else if(res.statusCode === 401){
-          window.localStorage.clear()
           uni.clearStorageSync()
           uni.reLaunch({
             url: '/pages/login/index'

+ 1 - 1
manifest.json

@@ -1,5 +1,5 @@
 {
-    "name" : "zh-cashier-app",
+    "name" : "振合网收银系统",
     "appid" : "__UNI__9EAB491",
     "description" : "",
     "versionName" : "1.0.0",

+ 69 - 37
pages/index/order.vue

@@ -6,13 +6,17 @@
 		<view class="fs-32 fc-3 fw-b">你已进入监控区域</view>
 		
 		<view class="box-1-time">
-			<Countdown></Countdown>
+			<Countdown ref="countdown"></Countdown>
 		</view>
 	  </view>
 		
 		
 	  <!-- 2 -->
-	  <scroll-view scroll-y="true" class="scroll-view-css list-box">
+	  <view v-if="goodsList.length == 0" class="scroll-view-css">
+	  	<image class="no-img" src="@/static/img/no-goods.png" mode="scaleToFill"></image>
+		<view class="fs-30 fc-6 text-align-center">请扫码添加商品</view>
+	  </view>
+	  <scroll-view v-else scroll-y="true" class="scroll-view-css list-box">
 	  	<view class="goods-box flex-justify-space" v-for="(item,i) in goodsList" :key="i">
 			<image :src="item.cover_img" mode="scaleToFill"></image>
 			
@@ -36,6 +40,9 @@
 		
 	 <!-- 3 -->
 	  <view class="box-2">
+		  <view class="">
+		  	{{msgTest}}
+		  </view>
 		<view class="box-2-shou flex-justify-center align-items-center" @click="headInput()">
 			<image src="@/static/img/txm.png" mode=""></image>
 			<view class="fs-30 fc-3 fw-400">手输条码</view>
@@ -57,14 +64,18 @@
 	  <keyboard-listener v-if="outscan" @keyup="monitorKeyboard"></keyboard-listener>
 	  
 	  <!-- 支付类型 -->
-	  <uni-popup ref="popup">
-		  <view class="pop-view">
-			<view class="fs-32 fw-600 pop-1 pop-view-1">请选择支付类型</view>
-			<view class="pop-2">
-				<view class="fs-32 pop-1 pop-view-1 fc-lv" @click="selectTyep(1)">微信</view>
-				<view class="fs-32 pop-1 fc-lan" @click="selectTyep(2)">支付宝</view>
-			</view>
+	  <uni-popup ref="popup" :mask-click="false">
+		  <view class="">
+			  <view class="pop-view mb-25">
+				<view class="fs-32 fw-600 pop-1 pop-view-1">请选择支付类型</view>
+				<view class="pop-2">
+					<view class="fs-32 pop-1 pop-view-1 fc-lv" @click="selectTyep(1)">微信</view>
+					<view class="fs-32 pop-1 fc-lan" @click="selectTyep(2)">支付宝</view>
+				</view>
+			  </view>
+		  	<view class="code-view-1" @click="closePay()">取消支付</view>
 		  </view>
+		  
 	  </uni-popup>
 	  
 	  <!-- 付款码 -->
@@ -79,9 +90,7 @@
 				<image src="@/static/img/code-1.png" mode="scaleToFill"></image>
 				<view class="fs-30 fc-6 text-align-center">对准下方扫描口</view>
 		  	</view>
-			<view class="code-view-1" @click="closePay()">
-				取消叫i有
-			</view>
+			<view class="code-view-1" @click="closePay()">取消支付</view>
 		  </view>
 	  </uni-popup>
 	  
@@ -119,6 +128,8 @@ export default {
 	  
 	  headValue:'',//手动输入的值
 	  
+	  msgTest:'',
+	  
     };
   },
   onLoad() {
@@ -146,6 +157,10 @@ export default {
         newArr = this.keyArr.filter(item => item != 'Shift' && item != 'Enter' && item != 'Unidentified')
         if(this.payFLag){
 			// 添加商品
+			if(this.isAJAX){
+				return
+			}
+			this.isAJAX = true;
         	this.nvalue = newArr.join("")
         	this.getGoods();
         }else{
@@ -156,6 +171,7 @@ export default {
 			this.isAJAX = true;
 			this.auth_code = newArr.join("")
 			OrderPay({order_id:this.order_id,pay_type:this.payType,auth_code:this.auth_code}).then((res)=>{
+				this.msgTest = res
 				if(res.code == 1){
 					this.payFLag = true;
 					this.isAJAX = false;
@@ -176,6 +192,7 @@ export default {
 	getGoods(){
 		GoodsInfo({goods_sn:this.nvalue}).then((res)=>{
 			if(res.code == 1){
+				this.isAJAX = false;
 				if(this.goodsList.length == 0){
 					let obj = res.data;
 					obj.num = 1;
@@ -202,6 +219,7 @@ export default {
 				}
 				this.headValue = '';
 			}else{
+				this.isAJAX = false;
 				this.headValue = '';
 				tools.error(res.msg)
 			}
@@ -231,6 +249,7 @@ export default {
 			this.payFLag = false;
 			this.$refs.popup.open('center')
 		}else{
+			this.payFLag = true;
 			tools.error('请添加商品')
 		}
 		
@@ -238,42 +257,41 @@ export default {
 	// 选择支付类型
 	selectTyep(type){
 		this.payType = type;
-		if(this.order_id){
-			this.$refs.popup.close();
-			// 扫码弹窗
-			this.$refs.popupCode.open('center')
-		}else{
-			if(this.isAJAX){
-				return
-			}
-			this.isAJAX = true;
-			OrderCreate({goods:this.goodsList}).then((res)=>{
-				if(res.code == 1){
-					this.isAJAX = false;
-					this.order_id = res.data.order_id;
-					this.$refs.popup.close();
-					// 扫码弹窗
-					this.$refs.popupCode.open('center')
-				}else{
-					tools.error(res.msg)
-					this.isAJAX = false;
-					this.payFLag = true;
-					this.order_id = '';
-					this.payType = '';
-					this.$refs.popup.close();
-				}
-			})
+		if(this.isAJAX){
+			return
 		}
+		this.isAJAX = true;
+		OrderCreate({goods:this.goodsList}).then((res)=>{
+			if(res.code == 1){
+				this.isAJAX = false;
+				this.order_id = res.data.order_id;
+				this.$refs.popup.close();
+				this.$refs.countdown.timeFun();
+				// 扫码弹窗
+				this.$refs.popupCode.open('center')
+			}else{
+				tools.error(res.msg)
+				this.isAJAX = false;
+				this.payFLag = true;
+				this.order_id = '';
+				this.payType = '';
+				this.$refs.popup.close();
+			}
+		})
 	},
 	// 取消支付
 	closePay(){
+		this.payFLag = true;
+		this.order_id = '';
 		this.payType = '';
+		this.$refs.popup.close();
 		this.$refs.popupCode.close();
 	},
 	// 手动输入
 	headInput(){
 		this.$refs.inputDialog.open();
 	},
+	// 手动输入获取商品
 	dialogInputConfirm(){
 		this.nvalue = this.headValue;
 		this.getGoods();
@@ -286,6 +304,11 @@ export default {
 
 <style scoped lang="scss">
 	.index-home{
+		.no-img{
+			width: 200rpx;
+			height: 200rpx;
+			margin: 30% auto 30rpx auto;
+		}
 		.box-1{
 			width: 100%;
 			height: 150rpx;
@@ -413,5 +436,14 @@ export default {
 	}
 	.code-view-1{
 		text-align: center;
+		margin: 0 auto;
+		width: 223rpx;
+		height: 57rpx;
+		line-height: 57rpx;
+		border-radius: 104rpx;
+		border: 2rpx solid #fff;
+		text-align: center;
+		color: #fff;
+		font-size: 32rpx;
 	}
 </style>

+ 3 - 10
pages/index/success.vue

@@ -12,8 +12,7 @@
 			<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="box-border-box box-2">
 			<view class="" @click="buy()">继续购买</view>
 		</view>
 		
@@ -31,15 +30,8 @@
 			this.totalPrice = e.money
 		},
 		methods:{
-			out(){
-				window.localStorage.clear()
-				uni.clearStorageSync()
-				uni.reLaunch({
-					url:'/pages/login/index'
-				})
-			},
 			buy(){
-				uni.redirectTo({
+				uni.reLaunch({
 					url:'/pages/index/index'
 				})
 			}
@@ -66,6 +58,7 @@
 				text-align: center;
 				color: #1778FD;
 				font-size: 32rpx;
+				margin: 0 auto;
 			}
 		}
 		

+ 15 - 9
pages/mod/countdown.vue

@@ -1,6 +1,6 @@
 <template>
-	<view class="time-box">
-		交易取消{{s}}s
+	<view class="time-box" @click="out()">
+		交易取消{{s}}{{!s?'':'s'}}
 	</view>
 </template>
 
@@ -8,22 +8,28 @@
 	export default {
 		data(){
 			return{
-				s:360
+				s:'',
+				timeServer:'',
 			}
 		},
 		mounted() {
-			this.timeFun()
+			
 		},
 		methods:{
+			out(){
+				clearInterval(this.timeServer);
+				uni.reLaunch({
+					url:'/pages/index/index'
+				})
+			},
 			timeFun(){
-				let timeServer = setInterval(() => {
+				this.s = 180
+				this.timeServer = setInterval(() => {
 					--this.s;
 					if (this.s <= 0) {
-						clearInterval(timeServer);
-						window.localStorage.clear()
-						uni.clearStorageSync()
+						clearInterval(this.timeServer);
 						uni.reLaunch({
-							url:'/pages/login/index'
+							url:'/pages/index/index'
 						})
 					}
 				}, 1000);

BIN
static/img/no-goods.png