cmy il y a 3 ans
Parent
commit
5f7fd313c3
3 fichiers modifiés avec 75 ajouts et 38 suppressions
  1. 9 0
      api/order.js
  2. 6 6
      pages.json
  3. 60 32
      pages/order/order.vue

+ 9 - 0
api/order.js

@@ -144,3 +144,12 @@ export function computedOrderkey(data) {
 	});
 }
 
+// 统计订单金额
+export function adopt(data) {
+	return request({
+		url: '/api/auction/adopt',
+		method: 'post',
+		data
+	});
+}
+

+ 6 - 6
pages.json

@@ -614,12 +614,12 @@
 				// "selectedIconPath": "static/tabBar/tab-cart-current.png",
 				"text": "趣豆会馆"
 			},
-			{
-				"pagePath": "pages/order/order",
-				// "iconPath": "static/tabBar/tab-cart.png",
-				// "selectedIconPath": "static/tabBar/tab-cart-current.png",
-				"text": "订单"
-			},
+			// {
+			// 	"pagePath": "pages/order/order",
+			// 	// "iconPath": "static/tabBar/tab-cart.png",
+			// 	// "selectedIconPath": "static/tabBar/tab-cart-current.png",
+			// 	"text": "订单"
+			// },
 			{
 				"pagePath": "pages/money/money",
 				// "iconPath": "static/tabBar/tab-cart.png",

+ 60 - 32
pages/order/order.vue

@@ -14,17 +14,16 @@
 		</view>
 		<view class="navbar" v-show="currentIndex==0">
 			<view v-for="(item, index) in navList" :key="index" class="nav-item"
-				:class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
+				:class="{ current: tabCurrentIndex === index }" @click="tabClick(index,0)">{{ item.text }}</view>
 		</view>
 		<view class="navbar" v-show="currentIndex==1">
 			<view v-for="(item, index) in navList1" :key="index" class="nav-item"
-				:class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
+				:class="{ current: tabCurrentIndex1 === index }" @click="tabClick(index,1)">{{ item.text }}</view>
 		</view>
 
-		<swiper :current="tabCurrentIndex" class="swiper-box-one" duration="300" @change="changeTab"
-			:style="{'height': height}">
+		<swiper :current="currentAuto" class="swiper-box-one" duration="0" @change="changeTab">
 			<swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex"
-				:style="{'height': height}" v-if="currentIndex==0">
+				v-if="currentIndex==0">
 				<scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
 					<!-- 空白页 -->
 					<empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
@@ -92,8 +91,8 @@
 					<uni-load-more :status="tabItem.loadingType"></uni-load-more>
 				</scroll-view>
 			</swiper-item>
-			<swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex"
-				:style="{'height': height}" v-if="currentIndex==1">
+			<swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList1" :key="tabIndex"
+				v-if="currentIndex==1">
 				<scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
 					<!-- 空白页 -->
 					<empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
@@ -162,7 +161,7 @@
 				</scroll-view>
 			</swiper-item>
 		</swiper>
-		<u-tabbar activeColor="#f42b4e" v-model="current" :list="tabbar" :mid-button="true"></u-tabbar>
+		<!-- <u-tabbar activeColor="#f42b4e" v-model="current" :list="tabbar" :mid-button="true"></u-tabbar> -->
 	</view>
 </template>
 
@@ -173,7 +172,8 @@
 		orderList,
 		orderCancel,
 		orderDel,
-		orderTake
+		orderTake,
+		adopt
 	} from '@/api/order.js';
 	import {
 		tabbar
@@ -187,9 +187,10 @@
 			return {
 				height: '', //第一层swiper高度
 				tabbar: tabbar,
-				current: 1,
-				currentIndex: 0,
-				tabCurrentIndex: 0,
+				current: 1,//底部tabar选中的icon对象
+				currentIndex: 0, //当前选中的第一级0为我要买单,1我要卖单
+				tabCurrentIndex: 0, //当前选中的第二级别我要买单选中项
+				tabCurrentIndex1: 0, //当前选中的第二级别我要卖单选中项
 				maiList: [{
 						title: '我的买单'
 					},
@@ -282,13 +283,22 @@
 
 			};
 		},
-
+		computed: {
+			currentAuto() {
+				if (this.currentIndex == 0) {
+					return this.tabCurrentIndex
+				}
+				if (this.currentIndex == 1) {
+					return this.tabCurrentIndex1
+				}
+			}
+		},
 		onLoad(options) {
 			/**
 			 * 修复app端点击除全部订单外的按钮进入时不加载数据的问题
 			 * 替换onLoad下代码即可
 			 */
-			this.tabCurrentIndex = +options.state;
+			this.tabCurrentIndex = +options.state || 0;
 			// #ifndef MP
 			this.loadData();
 			// #endif
@@ -328,6 +338,15 @@
 			});
 		},
 		methods: {
+			//顶部tab点击
+			tabClick(index, type) {
+				if (type == 0) {
+					this.tabCurrentIndex = index;
+				}
+				if (type == 1) {
+					this.tabCurrentIndex1 = index;
+				}
+			},
 			navGo(index) {
 				this.currentIndex = index
 				console.log(this.currentIndex, '点击');
@@ -378,8 +397,16 @@
 			//获取订单列表
 			loadData(source) {
 				//这里是将订单挂载到tab列表下
-				let index = this.tabCurrentIndex;
-				let navItem = this.navList[index];
+				let index, navItem;
+				if (this.currentIndex == 0) {
+					index = this.tabCurrentIndex;
+					navItem = this.navList[index];
+				}
+				if (this.currentIndex == 1) {
+					index = this.tabCurrentIndex1;
+					navItem = this.navList1[index];
+				}
+
 				let state = navItem.state;
 				if (source === 'tabChange' && navItem.loaded === true) {
 					//tab切换只有第一次需要加载数据
@@ -396,7 +423,7 @@
 				// 修改当前对象状态为加载中
 				navItem.loadingType = 'loading';
 
-				orderList({
+				adopt({
 						type: state,
 						page: navItem.page,
 						limit: navItem.limit
@@ -434,7 +461,12 @@
 
 			//swiper 切换
 			changeTab(e) {
-				this.tabCurrentIndex = e.target.current;
+				if (this.currentIndex == 0) {
+					this.tabCurrentIndex = e.target.current;
+				}
+				if (this.currentIndex == 1) {
+					this.tabCurrentIndex1 = e.target.current;
+				}
 				this.loadData('tabChange');
 			},
 
@@ -526,10 +558,8 @@
 	}
 
 	.order-title {
-
-
 		width: 750rpx;
-		height: 262rpx;
+		height: 135px;
 		// background: linear-gradient(-41deg, rgba(60, 237, 237, 0.99), #04B8FF, #375AFE);
 		background: url(../../static/img/order99.png) repeat-x 0;
 		display: flex;
@@ -538,27 +568,25 @@
 		text-align: center;
 
 		text {
-			margin: 60rpx 0;
-			font-size: 34rpx;
+			margin: 30px 0;
+			font-size: 17px;
 			font-family: PingFang SC;
 			font-weight: bold;
 			color: #FFFFFF;
 		}
 
 		.roder-content {
-
-
 			display: flex;
 			justify-content: space-around;
 
 			.left {
-				width: 336rpx;
-				height: 81rpx;
-				line-height: 81rpx;
-				border: 2rpx solid #FFFFFF;
-				border-radius: 10rpx;
+				width: 168px;
+				height: 40px;
+				line-height: 40px;
+				border: 1px solid #FFFFFF;
+				border-radius: 5px;
 				text-align: center;
-				font-size: 30rpx;
+				font-size: 15px;
 				font-family: PingFang SC;
 				font-weight: bold;
 				color: #FFFFFF;
@@ -944,6 +972,6 @@
 	}
 
 	.swiper-box-one {
-		background-color: #bfa;
+		height: calc(100% - 175px);
 	}
 </style>