高敬炎 vor 2 Jahren
Ursprung
Commit
e756cc9222
2 geänderte Dateien mit 53 neuen und 3 gelöschten Zeilen
  1. 2 2
      config/index.js
  2. 51 1
      pages/mine/index.vue

+ 2 - 2
config/index.js

@@ -1,7 +1,7 @@
 const dev = {
 	// baseUrlNew: 'https://api.changyuntong56.com',
-	// baseUrlNew: 'http://192.168.110.138:8999',
-	baseUrlNew: 'https://api.changyuntong56.com',
+	baseUrlNew: 'http://192.168.110.138:8999',
+	// baseUrlNew: 'https://api.changyuntong56.com',
 	// baseUrlNew: 'http://192.168.110.9:8099',
 	// baseUrlNew: 'http://192.168.110.82:8999',
 	// baseUrlNew: 'http://192.168.110.67:8999',

+ 51 - 1
pages/mine/index.vue

@@ -8,6 +8,7 @@
 					height="30px"></u--image> -->
 			</view>
 			<view class="row2 flex align-center">
+				
 				<u--image class="flex-end" :showLoading="true" :src="headUrl" width="60px" height="60px" shape='circle'>
 				</u--image>
 				<view class="right-text">
@@ -18,7 +19,9 @@
 					</view>
 					<view @click="toLogin" class="phone" v-if="hasLogin">{{starUserphone}}</view>
 				</view>
-				<view style="margin: auto;margin-right: 10px">
+				<view class='flex align-center' style="margin: auto;margin-right: 10px">
+					<u--image class='image scan' :showLoading="true" src="../../static/images/mine/saoma.png" width="20px"
+						height="20px" @click="scanCode()" v-if='hasLogin'></u--image>
 					<u-image @click="goDetailPage('/pages/mine/set')" style='margin-top: -6px;' class='image'
 						:showLoading="true" src="@/static/images/mine/set.png" width="25px" height="25px"></u-image>
 				</view>
@@ -196,6 +199,7 @@
 				driverCall: '',
 				isFirstSH: false,
 				driverSex: "",
+				id:'',
 				version: "1.1.0" //版本号
 			};
 		},
@@ -254,6 +258,7 @@
 				}
 			})
 		},
+		
 		async onLoad() {
 			that = this
 			// let _status = await that.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
@@ -281,6 +286,46 @@
 			}
 		},
 		methods: {
+			scanCode() {
+				let _this = this;
+				uni.scanCode({
+					onlyFromCamera: true,
+					success: function(res) {
+						console.log('条码内容:' + res.result);
+						_this.id=res.result.split(',')[1]
+						console.log(_this.id)
+						_this.mobileScanOk();
+					}
+				});
+			},
+			mobileScanOk() {
+				this.$request.baseRequest('get', '/publishTaskInfo/seeTask', {
+					id: this.id
+				}).then(res => {
+					console.log(res)
+					res.data.driverCommonId=this.userInfo.id
+					this.$request.baseRequest('post', '/publishTaskInfo/api/addOrder ', res.data).then(res => {
+						console.log(res)
+						if (res.code == 200) {
+							this.$refs.uToast.show({
+								type: 'success',
+								message: "抢单成功!",
+								complete() {
+									uni.switchTab({
+										url: "/pages/order/index"
+									})
+								}
+							})
+						
+						} else {
+							this.$refs.uToast.show({
+								type: 'error',
+								message: res.message,
+							})
+						}
+					})
+				})
+			},
 			// 检查APP是否有新版本
 			onAPPUpdate() {
 				// true 没有新版本的时候有提示,默认:false
@@ -535,4 +580,9 @@
 		font-size: 32rpx;
 		text-align: center;
 	}
+	.scan{
+		position:relative;
+		    top: -1px;
+		    left: -4px;
+	}
 </style>