483 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			Vue
		
	
	
	
		
		
			
		
	
	
			483 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			Vue
		
	
	
	
|  | <template> | |||
|  | 	<view> | |||
|  | 		<view class="top-head d-b-c pb20 border-b"> | |||
|  | 			<view class="f26 gray6 mr10">{{$t('MY_ORD_1')}}</view> | |||
|  | 			<view class="search-box"> | |||
|  | 				<input type="text" v-model="form.orderCode" :placeholder="$t('S_C_70')+$t('MY_ORD_1')" > | |||
|  | 				<view class="icon-search"><u-icon name="search" color="#ffffff" size="30rpx" | |||
|  | 						@click="searchFunc"></u-icon></view> | |||
|  | 			</view> | |||
|  | 		</view> | |||
|  | 		<!--列表--> | |||
|  | 		<scroll-view scroll-y="true" class="scroll-Y" :style="'height:' + scrollviewHigh + 'px;'" lower-threshold="50" | |||
|  | 			@scrolltolower="scrolltolowerFunc"> | |||
|  | 			<view class=""> | |||
|  | 				<template v-if="type == 0"> | |||
|  | 					<view v-for="(item, index) in listData" :key="index" class="listdata-item"> | |||
|  | 						<view class="border-b"> | |||
|  | 							<view class="d-b-c mb16"> | |||
|  | 								<text class="type-btn">{{ item.orderTypeVal }}</text> | |||
|  | 								<view class="f24 gray9 flex-1">{{$t('MY_ORD_1')}}:{{ item.orderCode }}</view>  | |||
|  | 								<view class="status-btn">{{ item.orderStatusVal }}</view> | |||
|  | 							</view> | |||
|  | 							<view class="d-b-c"> | |||
|  | 								<!-- 单个商品 --> | |||
|  | 								<template v-if="item.itemList && item.itemList.length == 1"> | |||
|  | 									<view class="d-s-c flex-1"> | |||
|  | 										<image class="product-img" :src="item.itemList[0].cover" mode=""></image> | |||
|  | 										<view class="text-ellipsis f28 gray3" style="width: 220rpx;"> | |||
|  | 											{{ item.itemList[0].productName }} | |||
|  | 										</view> | |||
|  | 									</view> | |||
|  | 								</template> | |||
|  | 								<!-- 多个商品 --> | |||
|  | 								<template v-if="item.itemList && item.itemList.length > 1"> | |||
|  | 									<view class="d-c-c product-list ww100"> | |||
|  | 										<image class="product-img" :src="pitem.cover" mode="" | |||
|  | 											v-for="(pitem, pindex) in item.itemList" :key="pindex"></image> | |||
|  | 									</view> | |||
|  | 								</template> | |||
|  | 								<view class="d-c d-c-e"> | |||
|  | 									<view class="price-color f24"> | |||
|  | 										{{currencyIcon()}} | |||
|  | 										<text class="f32 fb">{{ formatNum(item.orderAmount) }}</text>  | |||
|  | 									</view> | |||
|  | 									<!-- <view class="gray6">x1</view> --> | |||
|  | 								</view> | |||
|  | 							</view> | |||
|  | 							<view class="f24 gray9 mb20">{{$t('w_0423')}}:{{ item.creationTime }}</view> | |||
|  | 						</view> | |||
|  | 						<view class="d-e-c pt20"> | |||
|  | 							<view class="order-btn" @click="openDetail(item)">{{$t('ENU_APPROVE_B_231')}}</view> | |||
|  | 						</view> | |||
|  | 					</view> | |||
|  | 					<view class="d-c-c p30" v-if="listData.length == 0 && !loading"> | |||
|  | 						<text class="iconfont icon-wushuju"></text> | |||
|  | 						<text class="cont">{{$t('w_0405')}}</text> | |||
|  | 					</view> | |||
|  | 					<uni-load-more v-else :loadingType="loadingType"></uni-load-more> | |||
|  | 				</template> | |||
|  | 				<template v-if="type == 1"> | |||
|  | 					<view class="order-item" v-for="(item, index) in listData" :key="index"> | |||
|  | 						<view class="orer-item-top"> | |||
|  | 							<view class="f24 gray3">{{$t('MY_ORD_1')}}: {{ item.orderCode }}</view> | |||
|  | 							<view class="green">{{ item.approveStatus }}</view> | |||
|  | 						</view> | |||
|  | 						<view class="f24 gray9 p-20-0">{{$t('MY_ORD_3')}}:{{ item.payTime }}</view> | |||
|  | 						<view> | |||
|  | 							<!-- <view class="order-product"> | |||
|  | 								<view v-for="(item, index) in listData" :key="index" class="product-item"> | |||
|  | 									<view class="d-b-s mb20"> | |||
|  | 										<image class="product-img" src="/static/default.png" mode=""></image> | |||
|  | 										<view class="product-info d-c d-b-s flex-1"> | |||
|  | 											<view class="text-ellipsis-2 f28 gray3">海之圣超饱和富氢水杯(粉色)</view> | |||
|  | 											<view class="price-color f24"> | |||
|  | 												{{currencyIcon()}} | |||
|  | 												<text class="f32 fb">3960.00</text> | |||
|  | 											</view> | |||
|  | 										</view> | |||
|  | 										<view class="f24 gray9 ml20">X2</view> | |||
|  | 									</view> | |||
|  | 									<view class="secend-product"> | |||
|  | 										<view class="d-b-s mb20"> | |||
|  | 											<view class="d-s-c"> | |||
|  | 												<image src="/static/default.png" mode="" class="s-product-img"></image> | |||
|  | 												<view class="f28"> | |||
|  | 													苹果14Pro 暗夜紫 | |||
|  | 													<text class="ml20">规格名</text> | |||
|  | 												</view> | |||
|  | 											</view> | |||
|  | 											<view class="f24 gray9 ml20">X1</view> | |||
|  | 										</view> | |||
|  | 										<view class="d-b-s mb20"> | |||
|  | 											<view class="f28 gray3 text-ellipsis-2"> | |||
|  | 												<text class="domation">赠品:</text> | |||
|  | 												海之圣超饱和富氢水杯 | |||
|  | 												<text>(绿色</text> | |||
|  | 											</view> | |||
|  | 											<view class="f24 gray9 ml20">X1</view> | |||
|  | 										</view> | |||
|  | 									</view> | |||
|  | 								</view> | |||
|  | 							</view> --> | |||
|  | 							<view> | |||
|  | 								<view class="f24 gray9 line-h-15 mb10"> | |||
|  | 									<text>{{$t('MN_F_T_721')}}:</text> | |||
|  | 									<text>{{ item.recProvinceVal }}</text> | |||
|  | 								</view> | |||
|  | 								<view class="f24 gray9 line-h-15 mb10"> | |||
|  | 									<text>{{$t('MN_F_T_722')}}:</text> | |||
|  | 									<text>{{ item.recCityVal }}</text> | |||
|  | 								</view> | |||
|  | 								<view class="f24 gray9 line-h-15 mb10"> | |||
|  | 									<text>{{$t('MN_F_T_723')}}:</text> | |||
|  | 									<text>{{ item.recCountyVal }}</text> | |||
|  | 								</view> | |||
|  | 								<view class="f24 gray9 line-h-15 mb10"> | |||
|  | 									<text>{{$t('MN_F_T_725')}}:</text> | |||
|  | 									<text>{{ item.recAddress }}</text> | |||
|  | 								</view> | |||
|  | 								<view class="f24 gray9 line-h-15 mb10"> | |||
|  | 									<text>{{$t('CK_KS_51')}}:</text> | |||
|  | 									<text>{{ item.creationTime }}</text> | |||
|  | 								</view> | |||
|  | 								<view class="f24 gray9 line-h-15 mb10"> | |||
|  | 									<text>{{$t('MY_WAL_22')}}:{{ item.selfRemark }}</text> | |||
|  | 									<text></text> | |||
|  | 								</view> | |||
|  | 							</view> | |||
|  | 						</view> | |||
|  | 					</view> | |||
|  | 				</template> | |||
|  | 			</view> | |||
|  | 		</scroll-view> | |||
|  | 
 | |||
|  | 		<apply :detail="detailModel" :isPop="isDetail" @close="closeDetail"></apply> | |||
|  | 	</view> | |||
|  | </template> | |||
|  | 
 | |||
|  | <script> | |||
|  | 	import apply from './apply.vue'; | |||
|  | 	import uniLoadMore from '@/components/uni-load-more.vue'; | |||
|  | 	export default { | |||
|  | 		components: { | |||
|  | 			uniLoadMore, | |||
|  | 			apply | |||
|  | 		}, | |||
|  | 		data() { | |||
|  | 			const currentDate = this.getDate({ | |||
|  | 				format: true | |||
|  | 			}); | |||
|  | 			return { | |||
|  | 				isDetail: false, | |||
|  | 				detailModel: {}, | |||
|  | 				type: 0, | |||
|  | 				/*手机高度*/ | |||
|  | 				phoneHeight: 0, | |||
|  | 				/*可滚动视图区域高度*/ | |||
|  | 				scrollviewHigh: 0, | |||
|  | 				/*最后一页码数*/ | |||
|  | 				last_page: 0, | |||
|  | 				/*当前页面*/ | |||
|  | 				page: 1, | |||
|  | 				/*每页条数*/ | |||
|  | 				list_rows: 10, | |||
|  | 				/*有没有等多*/ | |||
|  | 				no_more: false, | |||
|  | 				/*是否正在加载*/ | |||
|  | 				loading: true, | |||
|  | 				/*数据*/ | |||
|  | 				listData: [], | |||
|  | 				form: { | |||
|  | 					pageNum: 1, | |||
|  | 					pageSize: 50, | |||
|  | 					orderCode: '' | |||
|  | 				} | |||
|  | 			}; | |||
|  | 		}, | |||
|  | 		onShow() { | |||
|  | 			/*获取数据*/ | |||
|  | 			this.listData = []; | |||
|  | 			this.form.pageNum = 1; | |||
|  | 			this.getData(); | |||
|  | 		}, | |||
|  | 		computed: { | |||
|  | 			/*加载中状态*/ | |||
|  | 			loadingType() { | |||
|  | 				if (this.loading) { | |||
|  | 					return 1; | |||
|  | 				} else { | |||
|  | 					if (this.listData.length != 0 && this.no_more) { | |||
|  | 						return 2; | |||
|  | 					} else { | |||
|  | 						return 0; | |||
|  | 					} | |||
|  | 				} | |||
|  | 			}, | |||
|  | 			creationTimeStart() { | |||
|  | 				return this.getDate('start'); | |||
|  | 			}, | |||
|  | 			creationTimeEnd() { | |||
|  | 				return this.getDate('end'); | |||
|  | 			} | |||
|  | 		}, | |||
|  | 		mounted() { | |||
|  | 			this.init(); | |||
|  | 		}, | |||
|  | 		methods: { | |||
|  | 			closeDetail(e) { | |||
|  | 				this.isDetail = false; | |||
|  | 				this.detailModel = null; | |||
|  | 				if (e) { | |||
|  | 					/*获取数据*/ | |||
|  | 					this.listData = []; | |||
|  | 					this.form.pageNum = 1; | |||
|  | 					this.getData(); | |||
|  | 				} | |||
|  | 			}, | |||
|  | 			openDetail(e) { | |||
|  | 				this.detailModel = e; | |||
|  | 				this.isDetail = true; | |||
|  | 			}, | |||
|  | 			changeType(e) { | |||
|  | 				let self = this; | |||
|  | 				if (self.loading) { | |||
|  | 					return; | |||
|  | 				} | |||
|  | 				self.page = 1; | |||
|  | 				self.loading = true; | |||
|  | 				self.type = e; | |||
|  | 				self.getData(); | |||
|  | 			}, | |||
|  | 			searchFunc() { | |||
|  | 				let self = this; | |||
|  | 				console.log(self.loading) | |||
|  | 				if (self.loading) { | |||
|  | 					return; | |||
|  | 				} | |||
|  | 				self.page = 1; | |||
|  | 				self.loading = true; | |||
|  | 				self.getData(); | |||
|  | 			}, | |||
|  | 			getData() { | |||
|  | 				let self = this; | |||
|  | 				self.loading = false; | |||
|  | 				if (self.type == 0) { | |||
|  | 					var formdata = self.form; | |||
|  | 					self._get( | |||
|  | 						'sale/api/my-order/selflist', | |||
|  | 						formdata, | |||
|  | 						function(res) { | |||
|  | 							self.listData = res.rows; | |||
|  | 							self.total = res.total; | |||
|  | 							if (self.total < self.form.pageNum * self.form.pageSize) { | |||
|  | 								self.no_more = true; | |||
|  | 							} | |||
|  | 						}, {}, | |||
|  | 						() => { | |||
|  | 							self.loading = false; | |||
|  | 						} | |||
|  | 					); | |||
|  | 				} else { | |||
|  | 					var formdata = self.form; | |||
|  | 					self._get( | |||
|  | 						'member/api/self-modify-address/list', | |||
|  | 						formdata, | |||
|  | 						function(res) { | |||
|  | 							self.listData = res.rows; | |||
|  | 							self.total = res.total; | |||
|  | 							if (self.total < self.form.pageNum * self.form.pageSize) { | |||
|  | 								self.no_more = true; | |||
|  | 							} | |||
|  | 						}, {}, | |||
|  | 						() => { | |||
|  | 							self.loading = false; | |||
|  | 						} | |||
|  | 					); | |||
|  | 				} | |||
|  | 			}, | |||
|  | 			searchSubmit: function() { | |||
|  | 				/*获取数据*/ | |||
|  | 				this.listData = []; | |||
|  | 				this.form.pageNum = 1; | |||
|  | 				this.getData(); | |||
|  | 			}, | |||
|  | 			/*可滚动视图区域到底触发*/ | |||
|  | 			scrolltolowerFunc() { | |||
|  | 				let self = this; | |||
|  | 				if (self.no_more) { | |||
|  | 					return; | |||
|  | 				} | |||
|  | 				if (self.form.pageNum * self.form.pageSize < self.total) { | |||
|  | 					self.form.pageNum++; | |||
|  | 					self.getData(); | |||
|  | 				} else { | |||
|  | 					self.no_more = true; | |||
|  | 				} | |||
|  | 			}, | |||
|  | 			/*初始化*/ | |||
|  | 			init() { | |||
|  | 				let self = this; | |||
|  | 				uni.getSystemInfo({ | |||
|  | 					success(res) { | |||
|  | 						self.phoneHeight = res.windowHeight; | |||
|  | 						// 计算组件的高度
 | |||
|  | 						let view = uni.createSelectorQuery().select('.top-head'); | |||
|  | 						view.boundingClientRect(data => { | |||
|  | 							let h = self.phoneHeight - data.height; | |||
|  | 							self.scrollviewHigh = h; | |||
|  | 						}).exec(); | |||
|  | 					} | |||
|  | 				}); | |||
|  | 			}, | |||
|  | 			getDate(type) { | |||
|  | 				const date = new Date(); | |||
|  | 				let year = date.getFullYear(); | |||
|  | 				let month = date.getMonth() + 1; | |||
|  | 				let day = date.getDate(); | |||
|  | 
 | |||
|  | 				if (type === 'start') { | |||
|  | 					year = year - 60; | |||
|  | 				} else if (type === 'end') { | |||
|  | 					year = year + 2; | |||
|  | 				} | |||
|  | 				month = month > 9 ? month : '0' + month; | |||
|  | 				day = day > 9 ? day : '0' + day; | |||
|  | 				return `${year}-${month}-${day}`; | |||
|  | 			}, | |||
|  | 			bindDateChange1: function(e) { | |||
|  | 				this.form.creationTimeStart = e.detail.value; | |||
|  | 			}, | |||
|  | 			bindDateChange2: function(e) { | |||
|  | 				this.form.creationTimeEnd = e.detail.value; | |||
|  | 			} | |||
|  | 		} | |||
|  | 	}; | |||
|  | </script> | |||
|  | 
 | |||
|  | <style lang="scss"> | |||
|  | 	.top-head { | |||
|  | 		background-color: #fff; | |||
|  | 		padding: 20rpx 31rpx 20rpx 28rpx; | |||
|  | 	} | |||
|  | 
 | |||
|  | 	.search-box { | |||
|  | 		display: flex; | |||
|  | 		justify-content: center; | |||
|  | 		align-items: center; | |||
|  | 		width: 510rpx; | |||
|  | 		height: 65rpx; | |||
|  | 		background: #F5F6F8; | |||
|  | 		border-radius: 33rpx; | |||
|  | 		padding: 9rpx 12rpx; | |||
|  | 		box-sizing: border-box; | |||
|  | 
 | |||
|  | 		input { | |||
|  | 			flex: 1; | |||
|  | 			// line-height: 65rpx;
 | |||
|  | 			font-size: 26rpx; | |||
|  | 			padding: 0 15rpx; | |||
|  | 		} | |||
|  | 	} | |||
|  | 
 | |||
|  | 	.icon-search { | |||
|  | 		width: 48rpx; | |||
|  | 		height: 48rpx; | |||
|  | 		background-color: #EE252A; | |||
|  | 		display: flex; | |||
|  | 		justify-content: center; | |||
|  | 		align-items: center; | |||
|  | 		color: #fff; | |||
|  | 		border-radius: 50%; | |||
|  | 	} | |||
|  | 
 | |||
|  | 	.top-tabbar { | |||
|  | 		border-bottom: 1rpx solid #eee; | |||
|  | 
 | |||
|  | 		.tab-item { | |||
|  | 			color: #666; | |||
|  | 		} | |||
|  | 
 | |||
|  | 		.tab-item.active { | |||
|  | 			font-weight: 400; | |||
|  | 			color: #333; | |||
|  | 		} | |||
|  | 	} | |||
|  | 
 | |||
|  | 	.order-item { | |||
|  | 		width: 750rpx; | |||
|  | 		background: #ffffff; | |||
|  | 		padding: 0 18rpx 50rpx 25rpx; | |||
|  | 		box-sizing: border-box; | |||
|  | 		margin-bottom: 20rpx; | |||
|  | 	} | |||
|  | 
 | |||
|  | 	.orer-item-top { | |||
|  | 		height: 93rpx; | |||
|  | 		display: flex; | |||
|  | 		justify-content: space-between; | |||
|  | 		align-items: center; | |||
|  | 		border-bottom: 1rpx solid #eee; | |||
|  | 	} | |||
|  | 
 | |||
|  | 	.listdata-item { | |||
|  | 		// height: 370rpx;
 | |||
|  | 		padding: 27rpx 23rpx 22rpx 25rpx; | |||
|  | 		background: #ffffff; | |||
|  | 		margin-bottom: 22rpx; | |||
|  | 	} | |||
|  | 
 | |||
|  | 	.type-btn { | |||
|  | 		line-height: 30rpx; | |||
|  | 		height: 30rpx; | |||
|  | 		background: #3d3d3d; | |||
|  | 		border-radius: 15rpx; | |||
|  | 		padding: 0 23rpx; | |||
|  | 		font-size: 20rpx; | |||
|  | 		color: #ffffff; | |||
|  | 		margin-right: 6rpx; | |||
|  | 	} | |||
|  | 
 | |||
|  | 	.status-btn { | |||
|  | 		font-size: 24rpx; | |||
|  | 		color: #333333; | |||
|  | 		margin-left: 20rpx; | |||
|  | 	} | |||
|  | 
 | |||
|  | 	.product-img { | |||
|  | 		width: 124rpx; | |||
|  | 		height: 124rpx; | |||
|  | 		margin-right: 20rpx; | |||
|  | 		flex-shrink: 0; | |||
|  | 		display: block; | |||
|  | 		border: 15rpx; | |||
|  | 		margin-bottom: 24rpx; | |||
|  | 	} | |||
|  | 
 | |||
|  | 	.product-list { | |||
|  | 		display: flex; | |||
|  | 		justify-content: flex-start; | |||
|  | 		align-items: center; | |||
|  | 		flex-wrap: nowrap; | |||
|  | 		overflow-x: auto; | |||
|  | 		margin-right: 20rpx; | |||
|  | 	} | |||
|  | 
 | |||
|  | 	.order-border-btn { | |||
|  | 		box-sizing: border-box; | |||
|  | 		padding: 0 26rpx; | |||
|  | 		min-width: 146rpx; | |||
|  | 		height: 52rpx; | |||
|  | 		line-height: 52rpx; | |||
|  | 		text-align: center; | |||
|  | 		border-radius: 26rpx; | |||
|  | 		font-size: 24rpx; | |||
|  | 		color: #999; | |||
|  | 		border: 1rpx solid #eee; | |||
|  | 		margin-left: 18rpx; | |||
|  | 		flex-shrink: 0; | |||
|  | 		display: flex; | |||
|  | 		justify-content: center; | |||
|  | 		align-items: center; | |||
|  | 	} | |||
|  | 
 | |||
|  | 	.order-btn { | |||
|  | 		box-sizing: border-box; | |||
|  | 		padding: 0 26rpx; | |||
|  | 		min-width: 146rpx; | |||
|  | 		height: 52rpx; | |||
|  | 		line-height: 52rpx; | |||
|  | 		text-align: center; | |||
|  | 		border-radius: 26rpx; | |||
|  | 		font-size: 24rpx; | |||
|  | 		color: #fff; | |||
|  | 		border: 1rpx solid #eee; | |||
|  | 		margin-left: 18rpx; | |||
|  | 		background: #fb3024; | |||
|  | 		border: 1rpx solid #fb3024; | |||
|  | 		flex-shrink: 0; | |||
|  | 		display: flex; | |||
|  | 		justify-content: center; | |||
|  | 		align-items: center; | |||
|  | 	} | |||
|  | </style> |