小欧追 2 years ago
parent
commit
99b7c2e825
4 changed files with 65 additions and 70 deletions
  1. 11 0
      components/u-header.vue
  2. 18 22
      pages/login/login.vue
  3. 34 46
      pages/order/order.vue
  4. 2 2
      utils/request.js

+ 11 - 0
components/u-header.vue

@@ -276,6 +276,17 @@
 						this.userinfo = res.data
 						this.hasLogin = true
 						console.log(this.userinfo)
+					}
+					if (!res.data.wx_authed) {
+						uni.login({
+							provider: 'weixin',
+							success: (code) => {
+								console.log(code.code);
+								this.request('/user/wx_auth', {
+									code: code.code
+								}, "GET")
+							}
+						})
 					}
 
 				});

+ 18 - 22
pages/login/login.vue

@@ -4,7 +4,7 @@
 		<view class="logina">
 			<view class="logina_a">
 				<view class="logina_p">账号</view>
-				<input v-model="account" value=""  class="logina_inp" placeholder="请输入账号" />
+				<input v-model="account" value="" class="logina_inp" placeholder="请输入账号" />
 			</view>
 			<view class="logina_a">
 				<view class="logina_p">密码</view>
@@ -80,26 +80,22 @@
 				uni.showLoading({
 					title: "登录中...",
 				});
-				that
-					.request(
-						"/user/login", {
-							account: that.account,
-							password: that.password,
-							type: 2,
-						},
-						"post"
-					)
-					.then((res) => {
-						uni.hideLoading();
-						setToken(res.data.userinfo.token); //模拟存储token
-						getApp().globalData = {
-							isAdmin: res.data.is_admin
-						}
-						uni.showToast({
-							title: "登录成功",
-						});
-						that.navTimeBack(res.data.is_admin);
+				that.request(
+					"/user/login", {
+						account: that.account,
+						password: that.password,
+						type: 2,
+					}, "post").then((res) => {
+					uni.hideLoading();
+					setToken(res.data.userinfo.token); //模拟存储token
+					getApp().globalData = {
+						isAdmin: res.data.is_admin
+					}
+					uni.showToast({
+						title: "登录成功",
 					});
+					that.navTimeBack(res.data.is_admin);
+				});
 			},
 			navTimeBack(type) {
 				console.log(type)
@@ -206,11 +202,11 @@
 		left: 0;
 	}
 
-	.logina {
+	.logina {
 		position: absolute;
 		bottom: 0;
 		left: 0;
-		width: 100%;
+		width: 100%;
 		height: 55vh;
 		background: #ffffff;
 		opacity: 1;

+ 34 - 46
pages/order/order.vue

@@ -2,27 +2,22 @@
 	<view class="content" :style="'padding-top:'+ headerHeight+'px'">
 		<uHeader ref="toRefresh" :userinfo="userinfo" />
 		<view class="menu-top">
-			<u-tabs :list="list" name="cate_name" count="cate_count" :is-scroll="false" :current="current"
-				@change="change" bg-color="#F7E8CB" active-color="#E68500"></u-tabs>
+			<u-tabs :list="list" name="cate_name" count="cate_count" :is-scroll="false" :current="current" @change="change" bg-color="#F7E8CB" active-color="#E68500"></u-tabs>
 			<swiper :interval="3000" :duration="1000" :current="current" class="order-list-box" @change="touchChange">
 				<!-- 待接单 -->
 				<swiper-item style="height: 100%;">
-					<scroll-view :scroll-top="50" scroll-y="true" style=" height:100%;" @scrolltoupper="upper"
-						@scrolltolower="lower">
+					<scroll-view :scroll-top="50" scroll-y="true" style=" height:100%;" @scrolltoupper="upper" @scrolltolower="lower">
 						<view class="noOrder" v-if="dataA.length < 1">
 							暂无订单~~
 						</view>
-						<view class="card" @click=" isAdmin? info(item) : ''" v-for="(item,index) in dataA"
-							:key="index">
+						<view class="card" @click=" isAdmin? info(item) : ''" v-for="(item,index) in dataA" :key="index">
 							<view class="row">
 								<view style="width:20%;">
-									<view
-										:class="item.freight==='fast'?'type_name green':item.freight === 'air'?'type_name blue':'type_name yellow' ">
+									<view :class="item.freight==='fast'?'type_name green':item.freight === 'air'?'type_name blue':'type_name yellow' ">
 										{{item.freight === 'fast'?'快 车':item.freight === 'air'?'空 运':'专 车'}}
 									</view>
 								</view>
-								<view class="row"
-									style="width: 60%; justify-content: flex-start; overflow: hidden; white-space:nowrap;text-overflow:ellipsis;">
+								<view class="row" style="width: 60%; justify-content: flex-start; overflow: hidden; white-space:nowrap;text-overflow:ellipsis;">
 									<view class="name" style="width:20%;">
 										订单号
 									</view>
@@ -40,8 +35,7 @@
 									{{item.from_city}}
 								</view>
 								<view class="image">
-									<image src="http://pet.hdlkeji.com/assets/static/1/95.png"
-										style="width: 50rpx;height: 20rpx;"></image>
+									<image src="http://pet.hdlkeji.com/assets/static/1/95.png" style="width: 50rpx;height: 20rpx;"></image>
 								</view>
 								<view class="big-text">
 									{{item.to_city}}
@@ -115,21 +109,18 @@
 				</swiper-item>
 				<!-- 进行中 -->
 				<swiper-item style="height: 100%;">
-					<scroll-view :scroll-top="50" scroll-y="true" style=" height:100%;" @scrolltoupper="upper"
-						@scrolltolower="lower">
+					<scroll-view :scroll-top="50" scroll-y="true" style=" height:100%;" @scrolltoupper="upper" @scrolltolower="lower">
 						<view class="noOrder" v-if="dataB.length < 1">
 							暂无订单~~
 						</view>
 						<view class="card" @click="info(item)" v-for="(item,index) in dataB" :key="index">
 							<view class="row">
 								<view style="width:20%;">
-									<view
-										:class="item.freight==='fast'?'type_name green':item.freight === 'air'?'type_name blue':'type_name yellow' ">
+									<view :class="item.freight==='fast'?'type_name green':item.freight === 'air'?'type_name blue':'type_name yellow' ">
 										{{item.freight === 'fast'?'快 车':item.freight === 'air'?'空 运':'专 车'}}
 									</view>
 								</view>
-								<view class="row"
-									style="width: 60%; justify-content: flex-start; overflow: hidden; white-space:nowrap;text-overflow:ellipsis;">
+								<view class="row" style="width: 60%; justify-content: flex-start; overflow: hidden; white-space:nowrap;text-overflow:ellipsis;">
 									<view class="name" style="width:20%;">
 										订单号
 									</view>
@@ -147,8 +138,7 @@
 									{{item.from_city}}
 								</view>
 								<view class="image">
-									<image src="http://pet.hdlkeji.com/assets/static/1/95.png"
-										style="width: 40rpx;height: 20rpx;"></image>
+									<image src="http://pet.hdlkeji.com/assets/static/1/95.png" style="width: 40rpx;height: 20rpx;"></image>
 								</view>
 								<view class="big-text">
 									{{item.to_city}}
@@ -245,8 +235,7 @@
 				</swiper-item>
 				<!-- 已完成 -->
 				<swiper-item style="height: 100%;">
-					<scroll-view :scroll-top="50" scroll-y="true" style=" height:100%;" @scrolltoupper="upper"
-						@scrolltolower="lower">
+					<scroll-view :scroll-top="50" scroll-y="true" style=" height:100%;" @scrolltoupper="upper" @scrolltolower="lower">
 						<view class="noOrder" v-if="dataC.length < 1">
 							暂无订单~~
 						</view>
@@ -254,13 +243,11 @@
 							<view class="row">
 								<view class="row">
 									<view style="width:20%">
-										<view
-											:class="item.freight==='fast'?'type_name green':item.freight === 'air'?'type_name blue':'type_name yellow' ">
+										<view :class="item.freight==='fast'?'type_name green':item.freight === 'air'?'type_name blue':'type_name yellow' ">
 											{{item.freight === 'fast'?'快 车':item.freight === 'air'?'空 运':'专 车'}}
 										</view>
 									</view>
-									<view class="row"
-										style="width: 60%; justify-content: flex-start; overflow: hidden; white-space:nowrap;text-overflow:ellipsis;">
+									<view class="row" style="width: 60%; justify-content: flex-start; overflow: hidden; white-space:nowrap;text-overflow:ellipsis;">
 										<view class="name">
 											订单号
 										</view>
@@ -279,8 +266,7 @@
 									{{item.from_city}}
 								</view>
 								<view class="image">
-									<image src="http://pet.hdlkeji.com/assets/static/1/95.png"
-										style="width: 50rpx;height: 20rpx;"></image>
+									<image src="http://pet.hdlkeji.com/assets/static/1/95.png" style="width: 50rpx;height: 20rpx;"></image>
 								</view>
 								<view class="big-text">
 									{{item.to_city}}
@@ -365,21 +351,18 @@
 				</swiper-item>
 				<!--  已结算 -->
 				<swiper-item style="height: 100%;">
-					<scroll-view :scroll-top="50" scroll-y="true" style=" height:100%;" @scrolltoupper="upper"
-						@scrolltolower="lower">
+					<scroll-view :scroll-top="50" scroll-y="true" style=" height:100%;" @scrolltoupper="upper" @scrolltolower="lower">
 						<view class="noOrder" v-if="dataD.length < 1">
 							暂无订单~~
 						</view>
 						<view class="card" @click="info(item)" v-for="(item,index) in dataD" :key="index">
 							<view class="row">
 								<view style="width:20%;">
-									<view
-										:class="item.freight==='fast'?'type_name green':item.freight === 'air'?'type_name blue':'type_name yellow' ">
+									<view :class="item.freight==='fast'?'type_name green':item.freight === 'air'?'type_name blue':'type_name yellow' ">
 										{{item.freight === 'fast'?'快 车':item.freight === 'air'?'空 运':'专 车'}}
 									</view>
 								</view>
-								<view class="row"
-									style="width: 60%; justify-content: flex-start; overflow: hidden; white-space:nowrap;text-overflow:ellipsis;">
+								<view class="row" style="width: 60%; justify-content: flex-start; overflow: hidden; white-space:nowrap;text-overflow:ellipsis;">
 									<view class="name" style="width:20%;">
 										订单号
 									</view>
@@ -397,8 +380,7 @@
 									{{item.from_city}}
 								</view>
 								<view class="image">
-									<image src="http://pet.hdlkeji.com/assets/static/1/95.png"
-										style="width: 50rpx;height: 20rpx;"></image>
+									<image src="http://pet.hdlkeji.com/assets/static/1/95.png" style="width: 50rpx;height: 20rpx;"></image>
 								</view>
 								<view class="big-text">
 									{{item.to_city}}
@@ -480,21 +462,18 @@
 				</swiper-item>
 				<!-- 已取消 -->
 				<swiper-item style="height: 100%;">
-					<scroll-view :scroll-top="50" scroll-y="true" style=" height:100%;" @scrolltoupper="upper"
-						@scrolltolower="lower">
+					<scroll-view :scroll-top="50" scroll-y="true" style=" height:100%;" @scrolltoupper="upper" @scrolltolower="lower">
 						<view class="noOrder" v-if="dataE.length < 1">
 							暂无订单~~
 						</view>
 						<view class="card" @click="info(item)" v-for="(item,index) in dataE" :key="index">
 							<view class="row">
 								<view style="width:20%;">
-									<view
-										:class="item.freight==='fast'?'type_name green':item.freight === 'air'?'type_name blue':'type_name yellow' ">
+									<view :class="item.freight==='fast'?'type_name green':item.freight === 'air'?'type_name blue':'type_name yellow' ">
 										{{item.freight === 'fast'?'快 车':item.freight === 'air'?'空 运':'专 车'}}
 									</view>
 								</view>
-								<view class="row"
-									style="width: 60%; justify-content: flex-start; overflow: hidden; white-space:nowrap;text-overflow:ellipsis;">
+								<view class="row" style="width: 60%; justify-content: flex-start; overflow: hidden; white-space:nowrap;text-overflow:ellipsis;">
 									<view class="name" style="width:20%;">
 										订单号
 									</view>
@@ -512,8 +491,7 @@
 									{{item.from_city}}
 								</view>
 								<view class="image">
-									<image src="http://pet.hdlkeji.com/assets/static/1/95.png"
-										style="width: 50rpx;height: 20rpx;"></image>
+									<image src="http://pet.hdlkeji.com/assets/static/1/95.png" style="width: 50rpx;height: 20rpx;"></image>
 								</view>
 								<view class="big-text">
 									{{item.to_city}}
@@ -616,8 +594,7 @@
 		</u-popup>
 
 		<!-- 手动派单选择人员 -->
-		<u-select safe-area-inset-bottom="true" title="取宠人-----送宠人" v-model="checkUser" :list="all_data"
-			:label-name="'name'" :value-name="'id'" mode="mutil-column" @confirm="checkUsered">
+		<u-select safe-area-inset-bottom="true" title="取宠人-----送宠人" v-model="checkUser" :list="all_data" :label-name="'name'" :value-name="'id'" mode="mutil-column" @confirm="checkUsered">
 		</u-select>
 	</view>
 </template>
@@ -880,6 +857,17 @@
 						if (res.data.need_verification) {
 							this.show = true
 						}
+						if (!res.data.wx_authed) {
+							uni.login({
+								provider: 'weixin',
+								success: (code) => {
+									console.log(code.code);
+									this.request('/user/wx_auth', {
+										code: code.code
+									}, "GET")
+								}
+							})
+						}
 					}
 				})
 			},

+ 2 - 2
utils/request.js

@@ -8,8 +8,8 @@ import {
 	getToken,
 	removeToken
 } from "./auth";
-// let baseUrl = 'https://pet.hdlkeji.com/api';
-let baseUrl = 'https://ldc365.cn/api';
+let baseUrl = 'https://pet.hdlkeji.com/api';
+// let baseUrl = 'https://ldc365.cn/api';
 async function request(mehtod, params, type, callBack) {
 	//创建一个名为request请求的方法函数
 	if (!type) {