From 5901682e975b002feb3fd805e200637079e5c32e Mon Sep 17 00:00:00 2001
From: Facius <847580812@qq.com>
Date: Fri, 25 Jun 2021 20:02:50 +0800
Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E4=BB=B6=E7=94=B3=E8=AF=B7=E6=82=AC?=
 =?UTF-8?q?=E6=B5=AE=E6=8C=89=E9=92=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/components/parts/applyButton.vue |  54 ++++++++++
 src/pages/index/mine.vue             |   4 +-
 src/pages/mine/warehouse/index.vue   | 146 +++++----------------------
 3 files changed, 79 insertions(+), 125 deletions(-)
 create mode 100644 src/components/parts/applyButton.vue

diff --git a/src/components/parts/applyButton.vue b/src/components/parts/applyButton.vue
new file mode 100644
index 0000000..704fa92
--- /dev/null
+++ b/src/components/parts/applyButton.vue
@@ -0,0 +1,54 @@
+<template>
+	<!-- 申请配件按钮 -->
+	<view class="apply-button" @click="handleClick">
+		<u-button :custom-style="customStyle" shape="circle" @click.stop="handleOperate" type="primary">
+			<u-icon class="apply-icon" name="plus"></u-icon>
+			<text class="apply-text" v-if="showText">申请配件</text>
+		</u-button>
+	</view>
+</template>
+
+<script>
+	export default {
+		props: {
+			type: { // 按钮宽'collapse': '80rpx', 'expand': '220rpx'
+				type: String,
+				default: 'expand'
+			}
+		},
+		computed: {
+			typeWidth() {
+				return {
+					'collapse': '80rpx',
+					'expand': '220rpx'
+				}
+			},
+			showText() {
+				return this.type == 'expand'
+			},
+			customStyle() {
+				return {
+					'height': '80rpx',
+					'width': this.typeWidth[this.type],
+				}
+			}
+		},
+		methods: {
+			handleClick() {
+				this.$emit('click')
+			},
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.apply-button {
+		.apply-icon {
+			font-size: 36rpx;
+		}
+		.apply-text {
+			font-size: 32rpx;
+			padding-left: 10rpx;
+		}
+	}
+</style>
diff --git a/src/pages/index/mine.vue b/src/pages/index/mine.vue
index 016db18..8b136c8 100644
--- a/src/pages/index/mine.vue
+++ b/src/pages/index/mine.vue
@@ -283,7 +283,7 @@
 						width: 120rpx;
 						height: 120rpx;
 						background-color: #FFFFFF;
-						border-radius: 56rpx;
+						border-radius: 60rpx;
 						display: flex;
 						align-items: center;
 						justify-content: center;
@@ -335,7 +335,7 @@
 					color: #FFFFFF;
 					margin-right: 4rpx;
 					font-size: 26rpx;
-					margin-top: -26rpx;
+					margin-top: -24rpx;
 					.right-image-view {
 						width: 34rpx;
 						height: 32rpx;
diff --git a/src/pages/mine/warehouse/index.vue b/src/pages/mine/warehouse/index.vue
index 8442a4d..f15b213 100644
--- a/src/pages/mine/warehouse/index.vue
+++ b/src/pages/mine/warehouse/index.vue
@@ -2,17 +2,7 @@
 	<!-- 我的配件 -->
 	<view class="ware-house">
 		<u-navbar back-icon-color="#333333" background="#FFFFFF" title="我的配件" titleColor="#333333"
-			:border-bottom="false" title-bold></u-navbar>
-<!-- 		<view class="tools-box">
-			<view class="search-sub">
-				<u-subsection :current="curNow" :list="subList" active-color="white" bg-color="white"
-					inactive-color="#666" button-color="#2272FF" bparts-radius="36" @change="sectionChange" height="72"
-					bold>
-				</u-subsection>
-			</view>
-			<u-button class="right-btn" @click="handleClickRecords" :custom-style="buttonStyle" type="primary"
-				shape="circle">操作记录</u-button>
-		</view> -->
+			:border-bottom="false" title-bold></u-navbar>
 		<view class="search-view">
 			<view class="search-btn" @click="handleClickSearch">
 				<image class="search-image" mode="widthFix" :src="sousuoImage"></image>
@@ -27,7 +17,7 @@
 		</view>
 		<view class="tab-view">
 			<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom" scroll-anchoring
-				refresher-enabled="true" :refresher-triggered="triggered" :refresher-threshold="100"
+				refresher-enabled="true" :refresher-triggered="triggered" :refresher-threshold="100" @scroll="scroll"
 				:scroll-top="scrollTop" refresher-background="#F4F5F7" @refresherpulling="triggered = true"
 				@refresherrefresh="onRefresh" @refresherrestore="onRestore" enable-back-to-top>
 				<view class="loading-view" v-if="!loaded">
@@ -45,28 +35,21 @@
 				</template>
 			</scroll-view>
 		</view>
-<!-- 		<view class="bottom-view" v-if="isReserve">
-			<view class="selected-all-view" @click="radioChange">
-				<u-icon class="selected-all-icon" name="checkbox-mark" :color="radioColor"></u-icon>
-				<text>全选</text>
-			</view>
-			<view class="right-view">
-				<u-button class="scd-btn" @click="handleClickRecords" :custom-style="buttonStyle" type="primary"
-					shape="circle">{{buttonText}}</u-button>
-			</view>
-			
-		</view> -->
+		<view class="fixed-button">
+			<ApplyButton :type="buttonType" @click="handleClickApply"/>
+		</view>
 	</view>
 </template>
 
 <script>
 	import AppliedCell from "@/components/parts/appliedPartsCell.vue"
 	import NoOrder from "@/components/order/noOrder.vue"
-
+	import ApplyButton from "@/components/parts/applyButton.vue"
 	export default {
 		components: {
 			AppliedCell,
-			NoOrder
+			NoOrder,
+			ApplyButton
 		},
 		data() {
 			return {
@@ -79,6 +62,7 @@
 				triggered: false,
 				_freshing: false,
 				selectedAll: false,
+				buttonType: 'expand' // 申请按钮宽 collapse': '80rpx', 'expand': '220rpx''
 			};
 		},
 		computed: {
@@ -126,19 +110,7 @@
 					'height': '80rpx',
 					'width': '200rpx'
 				}
-			},
-			// radioColor() {
-			// 	return this.selectedAll ? '#2272FF' : 'transparent'
-			// },
-			// buttonTexts() {
-			// 	return [['签收', '', '取消申请', '', ''], ['退件', '']]
-			// },
-			// buttonText() {
-			// 	return this.buttonTexts[this.curNow][this.currentIndex]
-			// },
-			// isReserve() { // 选中备件仓
-			// 	return this.curNow == 1 && this.currentIndex == 0
-			// }
+			},
 		},
 		onLoad(e) {
 			getApp().trackPage('我的配件页')
@@ -146,10 +118,6 @@
 			this._freshing = false;
 		},
 		methods: {
-			// sectionChange(index) {
-			// 	this.curNow = index;
-			// 	this.reloadPartsList()
-			// },
 			// tab栏切换
 			change(index) {
 				this.currentIndex = index;
@@ -186,51 +154,6 @@
 					this.loaded = true
 				});
 			},
-
-			// getReturnedParts(status) { // 返件列表
-			// 	this.pageNumber += 1
-			// 	this.loaded = false
-			// 	var param = {
-			// 		'pageSize': 20,
-			// 		'pageNumbr': 1,
-			// 		'items': true,
-			// 		'type': 'new'
-			// 	}
-			// 	this.$u.api.returnedParts(param).then((res) => {
-			// 		if (res.code == 200) {
-			// 			if (res.data.type != this.partsType) return
-			// 			this.triggered = false;
-			// 			this._freshing = false;
-			// 			if (this.pageNumber == 1) {
-			// 				this.partsList = []
-			// 			}
-			// 			if (res.data) {
-			// 				this.partsList.push(...res.data)
-			// 				this.loadStatus = res.data.length < this.pageSize ? 'nomore' : 'loadmore'
-			// 			}
-			// 		} else {
-			// 			console.log(res.message)
-			// 		}
-			// 		this.loaded = true
-			// 	});
-
-			// },
-			// getReserveList() { // 备件列表
-			// 	this.pageNumber += 1
-			// 	this.loaded = false
-			// 	this.$u.api.reserveList().then((res) => {
-			// 		if (res.code == 200) {
-			// 			if (res.data.type != this.partsType) return
-			// 			this.triggered = false
-			// 			this._freshing = false
-			// 			this.partsList = res.data || []
-			// 			this.loadStatus = 'nomore'
-			// 		} else {
-			// 			console.log(res.message);
-			// 		}
-			// 		this.loaded = true
-			// 	});
-			// },
 			handleOperate(info) {
 				// 调接口
 				// 修改info的status
@@ -246,11 +169,11 @@
 					url: 'pages/mine/warehouse/partsDetail'
 				})
 			},
-			// handleClickRecords() {
-			// 	uni.navigateTo({
-			// 		url: 'pages/mine/warehouse/records'
-			// 	})
-			// },
+			handleClickApply() {
+				uni.navigateTo({
+					url: 'pages/parts/application'
+				})
+			},
 			handleClickSearch() {
 				uni.navigateTo({
 					url: 'pages/mine/warehouse/searchParts'
@@ -276,6 +199,9 @@
 				if (this.loadStatus != 'loadmore') return
 				this.loadStatus == 'loading'
 				this.getUnstockedList(this.currentTab.status)
+			},
+			scroll() {
+				this.buttonType = 'collapse'
 			},
 		}
 	};
@@ -342,37 +268,11 @@
 				position: absolute;
 			}
 		}
-
-		// .tools-box {
-		// 	display: flex;
-		// 	flex-direction: row;
-		// 	justify-content: space-between;
-		// 	padding-bottom: 20rpx;
-
-		// 	.search-sub {
-		// 		height: 72rpx;
-		// 		width: 320rpx;
-		// 	}
-		// }
-		.bottom-view {
-			display: flex;
-			justify-content: space-around;
-			align-items: center;
-			.selected-all-view {
-				.selected-all-icon {
-					border: 2rpx solid #666666;
-				}
-			}
-			.right-view {
-				display: flex;
-				align-items: center;
-				.fst-btn {
-					
-				}
-				.scd-btn {
-					
-				}
-			}
+
+		.fixed-button {
+			position: fixed;
+			right: 20rpx;
+			bottom: 140rpx;
 			
 		}
 	}
-- 
2.23.0