Tang 3 năm trước cách đây
mục cha
commit
9c12a5f4e7
2 tập tin đã thay đổi với 75 bổ sung52 xóa
  1. 1 0
      pages.json
  2. 74 52
      pages2/order/index.vue

+ 1 - 0
pages.json

@@ -212,6 +212,7 @@
 				"path": "order/index",
 				"style": {
 					"navigationBarTitleText": "我的订单",
+					// "enablePullDownRefresh": true,
 					"app-plus": {
 						"titleNView": false, //禁用原生导航栏 
 						"bounce": "none"

+ 74 - 52
pages2/order/index.vue

@@ -3,40 +3,38 @@
 		<view style="width: 100%;text-align: center;position: fixed;height: 96rpx;z-index: 999;">
 			<u-tabs :list="list" sticky :current="current" @change="change" active-color="#007AFF"></u-tabs>
 		</view>
-		<view style="position: absolute;top: 96rpx;width: 100%;">
-			<view>
-				<view v-if="!order.length" class="noData">您暂无相关订单哦~</view>
-				<view v-else v-for="(item, index) in order" style="padding: 20rpx 20rpx 0rpx 20rpx" class="lisChild">
-					<view class="item">
-						<view style="display: flex;justify-content: space-between;align-items: center;height: 50rpx;" @click="openPopup(index)">
-							<view style="color: #666666;font-size: 24rpx;">订单编号:{{ item.orderSn }}</view>
-							<view style="color: #999999;font-size: 24rpx;">{{ $method.timestampToTime(item.createTime) }}</view>
+		<view style="padding-top: 96rpx;">
+			<view v-if="!order.length" class="noData">您暂无相关订单哦~</view>
+			<view v-else v-for="(item, index) in order" style="padding: 20rpx 20rpx 0rpx 20rpx" class="lisChild">
+				<view class="item">
+					<view style="display: flex;justify-content: space-between;align-items: center;height: 50rpx;" @click="openPopup(index)">
+						<view style="color: #666666;font-size: 24rpx;">订单编号:{{ item.orderSn }}</view>
+						<view style="color: #999999;font-size: 24rpx;">{{ $method.timestampToTime(item.createTime) }}</view>
+					</view>
+					<u-line color="#D6D6DB" />
+					<view
+						style="display: flex;justify-content: space-between;padding: 25rpx 0;border-bottom: 1rpx solid #eee;"
+						v-for="(items, indexs) in item.orderGoodsList"
+						:key="indexs"
+					>
+						<image :src="$method.splitImgHost(items.coverUrl)" style="height: 134rpx;width: 278rpx;border-radius: 16rpx;flex-shrink: 0;"></image>
+						<view style="margin-left: 20rpx;flex:1;display: flex;flex-direction: column;">
+							<view style="color: #333333;font-size: 30rpx;font-weight: bold;flex:1">{{ items.goodsName }}</view>
+							<view class="priceTag">¥ {{ items.goodsRealPrice }}</view>
 						</view>
-						<u-line color="#D6D6DB" />
-						<view
-							style="display: flex;justify-content: space-between;padding: 25rpx 0;border-bottom: 1rpx solid #eee;"
-							v-for="(items, indexs) in item.orderGoodsList"
-							:key="indexs"
-						>
-							<image :src="$method.splitImgHost(items.coverUrl)" style="height: 134rpx;width: 278rpx;border-radius: 16rpx;flex-shrink: 0;"></image>
-							<view style="margin-left: 20rpx;flex:1;display: flex;flex-direction: column;">
-								<view style="color: #333333;font-size: 30rpx;font-weight: bold;flex:1">{{ items.goodsName }}</view>
-								<view class="priceTag">¥ {{ items.goodsRealPrice }}</view>
-							</view>
+					</view>
+					<view style="height: 80rpx;display: flex;justify-content: space-between;align-items: center;">
+						<view>
+							<text style="color:#999;font-size: 24rpx;margin-right: 8rpx;">共{{ item.orderGoodsList.length }}项</text>
+							<text style="color: #333;font-size: 30rpx;font-weight: bold;">合计</text>
+							<text style="color:#ff2d55;font-size: 30rpx;font-weight: bold;">¥{{ item.payPrice }}</text>
 						</view>
-						<view style="height: 80rpx;display: flex;justify-content: space-between;align-items: center;">
-							<view>
-								<text style="color:#999;font-size: 24rpx;margin-right: 8rpx;">共{{ item.orderGoodsList.length }}项</text>
-								<text style="color: #333;font-size: 30rpx;font-weight: bold;">合计</text>
-								<text style="color:#ff2d55;font-size: 30rpx;font-weight: bold;">¥{{ item.payPrice }}</text>
-							</view>
-							<view style="display: flex;align-items: center;">
-								<view class="btn2" v-if="item.orderStatus === 0">继续支付</view>
-								<view class="btn2" v-if="item.orderStatus === -1 || item.orderStatus === -2">重新购买</view>
-								<view class="btn2" v-if="item.orderStatus === 1 || item.orderStatus === 2">退款</view>
-								<view class="btn1" v-if="item.orderStatus === -1 || item.orderStatus === -2" @click="delOrder(item)">删除订单</view>
-								<view class="btn1" @click="closeOrder(item)" v-if="item.orderStatus === 0">取消订单</view>
-							</view>
+						<view style="display: flex;align-items: center;">
+							<view class="btn2" v-if="item.orderStatus === 0">继续支付</view>
+							<view class="btn2" v-if="item.orderStatus === -1 || item.orderStatus === -2">重新购买</view>
+							<view class="btn2" v-if="item.orderStatus === 1 || item.orderStatus === 2">退款</view>
+							<view class="btn1" v-if="item.orderStatus === -1 || item.orderStatus === -2" @click="delOrder(item)">删除订单</view>
+							<view class="btn1" @click="closeOrder(item)" v-if="item.orderStatus === 0">取消订单</view>
 						</view>
 					</view>
 				</view>
@@ -62,17 +60,19 @@ export default {
 					name: '已取消'
 				}
 			],
-			list1: [1, 2, 3, 4, 5, 6, 7],
 			current: 0,
 			order: [],
-			formData:{
-				status:'0,1',
-				pageNum:1,
-				pageSize:8
-			}
+			formData: {
+				status: '0,1',
+				pageNum: 1,
+				pageSize: 5
+			},
+			pageNum1: 0,
+			pageNum2: 0,
+			pageNum3: 0
 		};
 	},
-	onPullDownRefresh() {},
+	// onPullDownRefresh() {},
 	onLoad(option) {},
 	onShow() {
 		this.getOrderList();
@@ -88,9 +88,9 @@ export default {
 			path: `/pages/index/index?inviteCode=` + userInfo == null ? '' : userInfo.userAccount
 		};
 	},
-	onReachBottom(){
-		this.formData.pageNum++
-		console.log(this.formData.pageNum)
+	onReachBottom() {
+		this.formData.pageNum++;
+		this.getFY();
 	},
 	methods: {
 		openPopup() {},
@@ -138,36 +138,56 @@ export default {
 				}
 			});
 		},
-		getFY(){
+		getFY() {
 			if (this.current === 0) {
-				this.formData.orderStatus = 0;
+				this.formData.orderStatus = '0';
+				if (this.order.length >= this.pageNum1) {
+					return;
+				}
 			}
 			if (this.current === 1) {
-				this.formData.orderStatus = [1, 2];
+				this.formData.orderStatus = '1,2';
+				if (this.order.length >= this.pageNum2) {
+					return;
+				}
 			}
 			if (this.current === 2) {
-				this.formData.orderStatus = [-1, -2];
+				this.formData.orderStatus = '-1,-2';
+				if (this.order.length >= this.pageNum3) {
+					return;
+				}
 			}
 			this.$api.getorderlists(this.formData).then(res => {
 				if (res.data.code === 200) {
-					this.order.push(res.data.rows)
+					if (res.data.rows.length) {
+						this.order = this.order.concat(res.data.rows);
+					}
 				}
 			});
 		},
 		//获取订单
 		getOrderList() {
-			this.formData.pageNum = 1
+			this.formData.pageNum = 1;
 			if (this.current === 0) {
-				this.formData.orderStatus = 0;
+				this.formData.orderStatus = '0';
 			}
 			if (this.current === 1) {
-				this.formData.orderStatus = [1, 2];
+				this.formData.orderStatus = '1,2';
 			}
 			if (this.current === 2) {
-				this.formData.orderStatus = [-1, -2];
+				this.formData.orderStatus = '-1,-2';
 			}
 			this.$api.getorderlists(this.formData).then(res => {
 				if (res.data.code === 200) {
+					if (this.current === 0) {
+						this.pageNum1 = res.data.total;
+					}
+					if (this.current === 1) {
+						this.pageNum2 = res.data.total;
+					}
+					if (this.current === 2) {
+						this.pageNum3 = res.data.total;
+					}
 					this.order = res.data.rows;
 				}
 			});
@@ -178,9 +198,11 @@ export default {
 			}
 			this.current = index;
 			this.getOrderList();
+			uni.pageScrollTo({
+				scrollTop: 0
+			});
 		}
 	},
-	onReachBottom() {},
 	computed: { ...mapGetters(['userInfo']) }
 };
 </script>