lilei 4 anos atrás
pai
commit
9e6527a965
6 arquivos alterados com 77 adições e 10 exclusões
  1. 8 0
      api/data.js
  2. 1 1
      api/user.js
  3. 8 0
      libs/tools.js
  4. 9 0
      pages.json
  5. 29 9
      pages/index/index.vue
  6. 22 0
      pages/userCenter/myCode/myCode.vue

+ 8 - 0
api/data.js

@@ -5,4 +5,12 @@ export const getLookUpDatas = (params) => {
     url: `lookup/findByLookup/${params.type}`,
     method: 'get'
   })
+}
+// 开箱操作
+export const openDevice = (params) => {
+  return axios.request({
+    url: `device/ctl/open`,
+    method: 'post',
+	data: params
+  })
 }

+ 1 - 1
api/user.js

@@ -31,4 +31,4 @@ export const ldUsedQuery = params => {
     data: params,
     method: 'post'
   })
-}
+}

+ 8 - 0
libs/tools.js

@@ -10,6 +10,14 @@ export function objToUrl(obj) {
   return uri;
 }
 
+export function getQueryString(url,name) {
+    var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
+    var r = url.match(reg);
+    if (r != null) {
+        return unescape(r[2]);
+    }
+    return null;
+}
 
 
   

+ 9 - 0
pages.json

@@ -198,6 +198,15 @@
 		    }
 		    
 		}
+        ,{
+            "path" : "pages/userCenter/myCode/myCode",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "我的投递码",
+                "enablePullDownRefresh": false
+            }
+            
+        }
     ],
 	"globalStyle": {
 		"navigationBarTextStyle": "black",

+ 29 - 9
pages/index/index.vue

@@ -14,11 +14,11 @@
 				</u-grid-item>
 				<u-grid-item :index="2">
 					<u-image width="90rpx" height="90rpx" src="/static/shouyi.png"></u-image>
-					<view class="grid-text">乐豆收益</view>
+					<view class="grid-text">我的投递码</view>
 				</u-grid-item>
 				<u-grid-item :index="3">
 					<u-image width="90rpx" height="90rpx" src="/static/hexiao.png"></u-image>
-					<view class="grid-text">扫码核销</view>
+					<view class="grid-text">扫一扫</view>
 				</u-grid-item>
 			</u-grid>
 		</view>
@@ -67,9 +67,10 @@
 		updateGoodsBuyQty
 	} from '@/api/shoppingCart.js'
 	import {bannerList} from '@/api/banner.js'
-	import {getLookUpDatas} from '@/api/data.js'
+	import {getLookUpDatas,openDevice} from '@/api/data.js'
 	import {stationList} from '@/api/station.js'
-	import { checkLogin } from '@/api/login.js'
+	import {checkLogin} from '@/api/login.js'
+	import {getQueryString} from '@/libs/tools.js'
 	export default {
 		data() {
 			return {
@@ -221,7 +222,7 @@
 				let path=[
 					'/pages/userCenter/zhinan',
 					'/pages/userCenter/liucheng',
-					'/pages/userCenter/ldDetailed',
+					'/pages/userCenter/myCode/myCode',
 					''
 				]
 				 
@@ -247,19 +248,38 @@
 			},
 			// 扫码核销
 			smHx(){
-				uni.navigateTo({
-					url: '/pages/checkOut/checkOut'
-				})
-				return
+				const _this = this
+				// uni.navigateTo({
+				// 	url: '/pages/checkOut/checkOut'
+				// })
+				// return
 				uni.scanCode({
 					success(e) {
 						console.log(e)
+						// 普通二维码,用户扫箱体的二维码开箱
+						if(e.scanType == 'QR_CODE'){
+							console.log(e.result)
+							_this.openDevice(e.result)
+						}
+						// 小程序码,用户核销
+						if(e.scanType == 'WX_CODE'){
+							
+						}
 					},
 					fail(err) {
 						console.log(err)
 					}
 				})
 			},
+			// 开箱
+			openDevice(data){
+				openDevice({
+					id: getQueryString(data,"id"),
+					type: getQueryString(data,"type")
+				}).then(res => {
+					console.log(res)
+				})
+			},
 			// 查看网点
 			viewStore(item){
 				uni.navigateTo({

+ 22 - 0
pages/userCenter/myCode/myCode.vue

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