From 79f11f34546a394ab1c16ba427c31e9b59d05523 Mon Sep 17 00:00:00 2001
From: queenwuli <942534046@qq.com>
Date: Sat, 09 Jan 2021 10:40:57 +0800
Subject: [PATCH] gx

---
 hive-app/pages/workbench/orderList.vue |  244 ++++++++++++++++++++++++++++++++----------------
 1 files changed, 161 insertions(+), 83 deletions(-)

diff --git a/hive-app/pages/workbench/orderList.vue b/hive-app/pages/workbench/orderList.vue
index 712fc2d..27d587b 100644
--- a/hive-app/pages/workbench/orderList.vue
+++ b/hive-app/pages/workbench/orderList.vue
@@ -1,50 +1,53 @@
 <template>
 	<!-- 订单列表 -->
 	<view>
-		<!-- #ifndef H5 -->
-		<view class="status_bar"></view>
-		<!-- #endif -->
-		<view class="input-box">
-			<view class="input-icon iconfont iconsousuo"></view>
-			<input placeholder="输入会员姓名;手机号;编号查询" class="input" placeholder-class="input-text"/>
+		<view class="header">
+			<search-bar @confirm="search" placeholder="输入会员姓名、手机号、订单号" class="mb-0"></search-bar>
 		</view>
 		<view>
 			<h-tabs
 				class="tab"
+				:activeIndex="orderStatus"
+				@tabClick="tabChange"
 				:tabData="tabs" 
 				:config="{
 					color: '#abb1cc',
 					activeColor: '#518EFF',
 					underLineColor: '#518EFF',
 					underLineHeight: 4,
-					fontSize: '30px',
-					itemWidth: 80,
+					fontSize: '28',
 					underLineWidth: 60,
 				}"
 			/>
-			<view class="order">
-				<view class="flex justify-between order-number">
-					<text class="font-14">订单号: N202012123556</text>
-					<text class="font-14 blue">待付款</text>
-				</view>
-				<view class="flex justify-between order-content">
-					<view class="flex flex-v">
-						<text class="font-12">李某某</text>
-						<text class="font-12 gray mt-10">2020-12-15 18:11:01</text>
+			<view class="list">
+				<view class="list-item" v-for="item in list">
+					<navigator :url="'./orderDetail?orderId='+item.orderId" hover-class="none">
+						<view class="list-header">
+							<text>订单号: {{item.orderNo}}</text>
+							<text :class="caculateColor(item.orderStatus)">{{item.orderStatus}}</text>
+						</view>
+						<view class="list-content">
+							<view class="flex flex-v flex-1">
+								<text class="font-bold font-15">{{item.vipName}}</text>
+								<text class="gray">{{item.orderTime}}</text>
+							</view>
+							<view class="flex justify-between flex-1">
+								<view>
+									<view>应付金额</view>
+									<view>实付金额</view>
+									<view>欠款总额</view>
+								</view>
+								<view class="right">
+									<view>¥ {{item.needPay | formatNum}}</view>
+									<view>¥ {{item.realPay | formatNum}}</view>
+									<view>¥ {{item.arrears | formatNum}}</view>
+								</view>
+							</view>
+						</view>
+					</navigator>
+					<view class="list-footer" v-if="item.orderStatus!=='已取消' && $utils.hasPermission('ddgl.cancel')">
+						<text class="blue-btn small-btn" @click="cancelOrder(item.orderId)">取消订单</text>
 					</view>
-					<view class="flex flex-v">
-						<text class="font-12">应付金额</text>
-						<text class="font-12 mt-10">实付金额</text>
-						<text class="font-12 mt-10">欠款总额</text>
-					</view>
-					<view class="flex flex-v">
-						<text class="font-12">$ 8000.00</text>
-						<text class="font-12 mt-10">$ 0.00</text>
-						<text class="font-12 mt-10">$ 8000.00</text>
-					</view>
-				</view>
-				<view class="flex justify-end">
-					<button class="blue-btn small-btn">取消订单</button>
 				</view>
 			</view>
 		</view>
@@ -53,78 +56,153 @@
 
 <script>
 	import HTabs from "@/components/liuyuno-tabs/liuyuno-tabs.vue";
+	import searchBar from '../../components/searchBar/index.vue';
 	export default {
 		components: {
-		    HTabs
+		    HTabs,
+			searchBar
 		},
 		data() {
-		  return {
-		    tabs:[
-				{
-					state: 1,
-					name: '全部'
-				},
-				{
-					state: 2,
-					name: '代付款'
-				},
-				{
-					state: 3,
-					name: '已付款'
-				},
-				{
-					state: 4,
-					name: '欠款'
-				},
-			],
-		  }  
+			return {
+				orderStatus: 0,
+				tabs:[
+					{
+						state: 0,
+						name: '全部'
+					},
+					{
+						state: 1,
+						name: '待付款'
+					},
+					{
+						state: 2,
+						name: '已付款'
+					},
+					{
+						state: 3,
+						name: '欠款'
+					},
+				],
+				list: []
+			}  
+		},
+		onLoad(options) {
+			if(options.status){
+				this.orderStatus = Number(options.status);
+			}
+			this.loadList()
+			
+			// 判断权限
+			// #ifdef APP-PLUS
+			if(!this.$utils.hasPermission('ddgl.add')){
+				let webView = this.$mp.page.$getAppWebview();
+				webView.setTitleNViewButtonStyle(0, {
+				    width: 0,  
+				});
+			}
+			// #endif
+		},
+		onNavigationBarButtonTap(Object){
+			if(Object.key === 'add'){
+				uni.navigateTo({
+					url: './selectCustomer'
+				})
+			}
+		},
+		methods:{
+			loadList(){
+				this.$httpUtils.request('/api/order/findOrderList', {
+					pageNum: 1,
+					pageSize: 100,
+					queryKey: this.queryKey,
+					orderStatus: this.orderStatus
+				}, 'POST').then((res) => {
+					if(res.status == 200){
+						this.list = res.rows;
+					}
+				})
+			},
+			search(val){
+				this.queryKey = val;
+				this.loadList();
+			},
+			tabChange(index){
+				if(this.orderStatus === index){
+					return;
+				}
+				this.orderStatus = index;
+				this.loadList();
+			},
+			caculateColor(status){
+				if(status==='待付款'){
+					return 'blue'
+				} else if(status === '已付款'){
+					return 'blueness'
+				} else if(status === '欠款'){
+					return 'red'
+				} else {
+					return 'gray'
+				}
+			},
+			cancelOrder(id){
+				uni.showModal({
+				    title: '提示',
+				    content: '确定取消订单吗?',
+				    success: (res) => {
+				        if (res.confirm) {
+				            console.log('用户点击确定');
+							this.$httpUtils.request('/api/order/cancelOrder/'+id).then((res) => {
+								if(res.status == 200){
+									this.loadList()
+								}
+								this.$toast.info(res.info);
+							})
+				        }
+				    }
+				});
+			}
 		}
 	}
 </script>
 
 <style>
-	.input-box{
-		margin: 0 15px;
-		background: #F8F8F8;
-		border-radius: 25px;
-		display: flex;
-		align-items: center;
-		padding: 10px 0;
+	page{
+		background: #F6F6F8;
 	}
-	.input-icon{
-		font-size: 20px;
-		margin: 0 16px;
-	}
-	.input{
-		flex: 1;
-		font-size: 14px;
-	}
-	.input-text{
-		color: #ABB1CC;
+	.header{
+		padding: 10px 10px 5px;
+		background: #FFFFFF;
 	}
 	.tab{
+		background: #FFFFFF;
 		border-bottom: 1px solid #EDEAF4;
-		border-radius: 4px;
-		box-shadow:0 6px 6px rgba(237,234,244,0.5);
 	}
-	.order{
-		border: 1px solid #EDEAF4;
+	.list-item{
+		background: #FFFFFF;
 		border-radius: 4px;
-		box-shadow:0 6px 6px rgba(237,234,244,0.5);
 		margin: 10px;
-		padding: 0 6px;
+		color: #3a3f3f;
+		border: 1px solid #EDEAF4;
+		padding: 0 10px;
 	}
-	.order-number{
-		padding: 10px 6px;
+	.list-header{
+		display: flex;
+		justify-content: space-between;
+		padding: 12px 0;
+		font-size: 15px;
 		border-bottom: 1px solid #EDEAF4;
 	}
-	.order-content{
-		padding: 15px 6px;
-		border-bottom: 1px solid #EDEAF4;
+	.list-content{
+		display: flex;
+		justify-content: space-between;
+		padding: 12px 0;
+		font-size: 14px;
+		line-height: 28px;
 	}
-	.small-btn{
-		width: 100px;
-		margin: 10px 0;
-		line-height: 30px;
+	.list-footer{
+		display: flex;
+		justify-content: flex-end;
+		padding: 10px 0;
+		border-top: 1px solid #EDEAF4;
 	}
 </style>

--
Gitblit v1.9.1