Bladeren bron

处理重提

zhangli 2 jaren geleden
bovenliggende
commit
44f461a60d
2 gewijzigde bestanden met toevoegingen van 206 en 127 verwijderingen
  1. 11 2
      config/api.js
  2. 195 125
      pagesMain/giftApply.vue

+ 11 - 2
config/api.js

@@ -1,10 +1,12 @@
 // const API_BASE = 'https://xinghuolanqiu.com/newApi'
 // const API_BASE = 'http://192.168.1.126:30000'
 //const API_BASE = 'http://192.168.1.117:8089'
-const API_BASE = 'http://192.168.1.145/newApi'
+//const API_BASE = 'http://192.168.1.145/newApi'
 //const API_BASE = 'http://192.168.1.109/newApi'
 // const API_BASE = 'http://192.168.1.117:8089'
 //const API_BASE = 'http://192.168.1.145/newApi'
+const API_BASE = 'http://192.168.1.117:8089'
+// const API_BASE = 'http://192.168.1.145/newApi'
 
 module.exports = {
 	//  微信授权登录
@@ -106,5 +108,12 @@ module.exports = {
 	findResourceRecordList: API_BASE + '/v2/sale/customer/findResourceRecordList',
 	
 	//  销售员列表
-	findGroups: API_BASE + '/v2/sale/group/findGroups'
+	findGroups: API_BASE + '/v2/sale/group/findGroups',
+	
+	// 学员列表
+	giftStudentPage: API_BASE + '/v2/sale/center/giftStudentPage',
+	// 获取一级礼物
+	findVenueGiftOneList: API_BASE + '/v2/sale/center/findVenueGiftOneList',
+	// 获取二级礼物
+	findVenueGiftTwoList: API_BASE + '/v2/sale/center/findVenueGiftTwoList',
 }

+ 195 - 125
pagesMain/giftApply.vue

@@ -1,27 +1,52 @@
 <template>
 	<view class="content">
-		<scroll-view scroll-y class="scroll-box" @scrolltolower="handleLoadMore" :refresher-enabled="true"
-		 :refresher-triggered="triggered" :refresher-threshold="100" refresher-background="white" @refresherrefresh="onRefresh"
-		 @refresherrestore="onRestore">
-			<u-card :show-head="false" :foot-border-top="false" margin="10px 15px" borderRadius="40" :foot-style="{padding: '0 10px 5px 0'}" v-for="(site, index2) in tableList"
-			 :key="index2" class="card-box" @click="goToOrderList(site)">
-				<view slot="body" class="card-content">
-					<view class="student-info">
-						<view class="info-name">{{site.studentName}}</view>
-						<!-- <view class="info-type" :class="site.status == 1 ? 'info-type-active' : ''">{{site.status == 0 ? '未报名' : '已报名'}}</view> -->
-						<view class="info-name">{{site.parentName}}</view>
-						<view class="info-phone">{{site.parentPhone}}</view>
-					</view>
-					<!-- <u-image width="28px" height="28px" :src="site.type == 2 ? iconPath1 : iconPath2"></u-image> -->
-				</view>
-				<view slot="foot" style="text-align: right;">
-					<u-button type="warning" :ripple="true" shape="circle" :custom-style="{...handleCustomStyle, marginRight: '5px'}" size="mini" @click="handleJumpGiftInfoClick">赠送</u-button>
-					<u-button type="warning" :ripple="true" shape="circle" :custom-style="handleCustomStyle" size="mini" @click="handleJumpSubscribeClick">不送</u-button>
-				</view>
-			</u-card>
-			<u-divider v-if="item.isOver" bg-color="transparent" :style="{paddingTop : item.tableList.length == 0 ? '10px' : ''}">没有更多了</u-divider>
-		</scroll-view>
-		<u-icon name="plus-circle-fill" :color="mainColor" size="96" class="fix-add-icon" @click="handleThreadAddClick"></u-icon>
+		<view class="filter-box">
+			<u-search placeholder="请输入关键字" v-model="filterText" @search="setFilterText" @custom="setFilterText"></u-search>
+		</view>
+		<u-tabs-swiper ref="uTabs" :active-color="mainColor" :list="tabList" :current="current" @change="tabsChange"
+		 :is-scroll="false"></u-tabs-swiper>
+		<swiper :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish" class="swiper-box">
+			<swiper-item class="swiper-item" v-for="(item, index1) in tabList" :key="index1">
+				<scroll-view scroll-y class="scroll-box" @scrolltolower="handleLoadMore" :refresher-enabled="true"
+				 :refresher-triggered="triggered" :refresher-threshold="100" refresher-background="white" @refresherrefresh="onRefresh"
+				 @refresherrestore="onRestore">
+					<u-card :show-head="false" :foot-border-top="false" margin="10px 15px" borderRadius="40" :foot-style="{padding: '0 10px 5px 0'}" v-for="(site, index2) in item.tableList"
+					 :key="index2" class="card-box">
+						<view slot="body" class="card-content">
+							<view class="student-info">
+								<view style="width: 100%;">
+									<text class="info-name" style="margin-right: 10px;">{{ site.studentName }}</text>
+									<text class="info-name">{{ site.venueName }}</text>
+								</view>
+								<view class="info-phone">{{ site.className }}</view>
+								<view class="info-phone">{{ getStatus(site.approvalStatus) }}</view>
+								<view style="width: 100%;" v-if="site.giftType == 1">
+									<text class="info-phone" style="margin-right: 10px;">{{ site.giftTypeName }}</text>
+									<text class="info-phone">{{ site.giftName }}</text>
+								</view>
+							</view>
+						</view>
+						<view slot="foot" style="text-align: right;"v-if="site.giftType == 0" >
+							<u-button type="warning" :ripple="true" shape="circle" :custom-style="{...handleCustomStyle, marginRight: '5px'}" size="mini" @click="handleGiveClick(site.venueId)">赠送</u-button>
+							<u-button type="warning" :ripple="true" shape="circle" :custom-style="handleCustomStyle" size="mini" @click="handleNoGiveClick">不送</u-button>
+						</view>
+					</u-card>
+					<u-divider v-if="item.isOver" bg-color="transparent" :style="{paddingTop : item.tableList.length == 0 ? '10px' : ''}">没有更多了</u-divider>
+				</scroll-view>
+			</swiper-item>
+		</swiper>
+		<!-- 礼物数据  -->
+		<u-popup v-model="giftShow" mode="center" border-radius="30" width="600rpx" height="500px" >
+			<view class="common-title">礼物</view>
+			<view class="menber-box" style="overflow-y: auto;height:390px;">
+				<view @click="handleOneClick"></view>
+			</view>
+			<view class="button-box">
+				<u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="recordShow = false">确定</u-button>
+			</view>
+		</u-popup>
+		<!-- 一级礼物 -->
+		<u-action-sheet :list="oneList" v-model="oneShow" @click="handleSetOneClick"></u-action-sheet>
 		<u-top-tips ref="uTips"></u-top-tips>
 	</view>
 </template>
@@ -43,64 +68,121 @@
 		},
 		data() {
 			return {
+				venueId: '',
+				// filterText: '',
 				triggered: false,
-				tableList: [
-					{
-						studentName: 111,
-						parentName: 222,
-						parentPhone: 3333
-					}
-				],
+				tabList: [
+				{
+					name: '未赠送',
+					isOver: false,
+					pageIndex: 1,
+					filterText: '',
+					tableList: [],
+				}, {
+					name: '已赠送',
+					isOver: false,
+					pageIndex: 1,
+					filterText: '',
+					tableList: [],
+				}, {
+					name: '不赠送',
+					isOver: false,
+					pageIndex: 1,
+					filterText: '',
+					tableList: [],
+				}],
 				current: 0,
-				iconPath1: API.getServerImg + 'weibaoming.png',
-				iconPath2: API.getServerImg + 'xianshangkehu.png',
-				giftList: []
+				swiperCurrent: 0,
+				giftShow: false,
+				oneShow: false,
+				oneList: [],
+				
 			}
 		},
-		onLoad() {
-			// this.getTableList(0)
-			this.getGiftInfo()
+		onShow() {
+			this.getData()
+		},
+		computed: {
+			getStatus() {
+				return function(index) {
+					switch (index) {
+						case 0:
+							return '待审批'
+						case 1:
+							return '审批通过'
+						case 2:
+							return '提交'
+					}
+				}
+			}
 		},
-		onReady() {},
 		methods: {
-			getGiftInfo() {
-				NET.request(API.getGiftList, {}, 'POST').then(res => {
-					res.data.forEach(item => {
-						if (item == 1) {
-							item.value = ''
-						} else {
-							item.itemList.forEach(site => {
-								site.checked = false
-							})
-						}
-					})
-					this.giftList = res.data
+			getData() {
+				this.tabList = Object.assign([], this.$options.data().tabList)
+				this.getTableList(0)
+				this.getTableList(1)
+				this.getTableList(2)
+			},
+			handleGiveClick(id) {
+				this.giftShow = true
+				this.venueId = id
+			},
+			handleOneClick() {
+				NET.request(API.findVenueGiftOneListudentPage, {
+					id: thisvenueId
+				}, 'POST').then(res => {
+					console.log(res);
+				})
+			},
+			// 赠送
+			handleJumpGiftInfoClick(id) {
+				uni.navigateTo({
+					url: `/pagesMain/giftInfo?id=${id}`
+				})
+			},
+			// 不送
+			handleNoGiveClick() {
+				console.log('不送');
+			},
+			//  获取列表数据
+			getTableList(index) {
+				NET.request(API.giftStudentPage, {
+					giftType: index,
+					name: this.tabList[index].filterText,
+					page: this.tabList[index].pageIndex,
+					size: 10,
+				}, 'POST').then(res => {
+					this.triggered = false
+					this.tabList[index].tableList = this.tabList[index].tableList.concat(res.data.row)
+					this.tabList[index].isOver = res.data.row.length != 10
 				}).catch(error => {
+					this.triggered = false
 					this.$refs.uTips.show({
-						title: error.message,
+						title: error.msg,
 						type: 'warning',
 					})
 				})
 			},
-			//  跳转添加信息
-			handleThreadAddClick() {
-				uni.navigateTo({
-					url: '/pagesEnroll/intentionForm?type=2'
-				});
+			//  设置过滤字段
+			setFilterText(value) {
+				this.tabList[this.current].filterText = value
+				this.onRefresh()
 			},
-			//  跳转场馆列表
-			handleJumpSubscribeClick() {
-				uni.navigateTo({
-					url: '/pagesMain/venueMore'
-				});
+			//  tab页面切换
+			tabsChange(index) {
+				this.swiperCurrent = index;
 			},
-			//  无效备注确认
-			handleConfirmClick(){
-				this.$refs.invalidFormRef.validate(valid => {
-						if (valid) {
-							return 
-						}
-				})
+			//  swiper-item左右移动,通知tabs的滑块跟随移动
+			transition(e) {
+				let dx = e.detail.dx;
+				this.$refs.uTabs.setDx(dx);
+			},
+			//  swiper滑动结束,分别设置tabs和swiper的状态
+			animationfinish(e) {
+				let current = e.detail.current;
+				this.$refs.uTabs.setFinishCurrent(current);
+				this.swiperCurrent = current;
+				this.current = current;
 			},
 			//  下拉刷新
 			onRefresh() {
@@ -109,7 +191,7 @@
 					this.tabList[this.current].isOver = false
 					this.tabList[this.current].pageIndex = 1
 					this.tabList[this.current].tableList = []
-					this.getTableList(this.current, 'refresh')
+					this.getTableList(this.current)
 				}
 			},
 			//  重置下拉刷新状态
@@ -123,30 +205,6 @@
 					this.tabList[this.current].pageIndex++
 					this.getTableList(this.current)
 				}
-			},
-			//  获取列表数据
-			getTableList(index) {
-				NET.request(API.getCustomerList, {
-					name: this.tabList[index].filterText,
-					type: this.tabList[index].type,
-					page: this.tabList[index].pageIndex,
-				}, 'POST').then(res => {
-					this.triggered = false
-					this.tabList[index].tableList = this.tabList[index].tableList.concat(res.data.row)
-					this.tabList[index].isOver = res.data.row.length != 10
-				}).catch(error => {
-					this.triggered = false
-					this.$refs.uTips.show({
-						title: error.msg,
-						type: 'warning',
-					})
-				})
-			},
-			// 跳转赠送详情
-			handleJumpGiftInfoClick() {
-				uni.navigateTo({
-					url: '/pagesMain/giftInfo'
-				})
 			}
 		},
 	}
@@ -172,47 +230,54 @@
 			background-color: #FFFFFF;
 		}
 
-		.scroll-box {
-			width: 100%;
+		.swiper-box {
 			height: calc(100vh - 82px);
 
-			.card-box {
-				.card-content {
-					display: flex;
-					align-items: center;
+			.swiper-item {
+				height: calc(100vh - 82px);
 
-					.student-info {
-						flex: 1;
+				.scroll-box {
+					width: 100%;
+					height: calc(100vh - 82px);
 
-						.info-name {
-							width: 64px;
-							float: left;
-							line-height: 28px;
-							font-size: 14px;
-							font-weight: bold;
-						}
+					.card-box {
+						.card-content {
+							display: flex;
+							align-items: center;
 
-						.info-type {
-							padding: 0 10px;
-							margin-top: 3px;
-							border-radius: 20px;
-							float: left;
-							line-height: 20px;
-							font-size: 10px;
-							color: #FFFFFF;
-							background-color: #999999;
-						}
+							.student-info {
+								flex: 1;
 
-						.info-type-active {
-							background-color: $mainColor;
-						}
+								.info-name {
+									// width: 64px;
+									// float: left;
+									line-height: 28px;
+									font-size: 14px;
+									font-weight: bold;
+								}
+
+								.info-type {
+									padding: 0 10px;
+									margin-top: 3px;
+									border-radius: 20px;
+									float: left;
+									line-height: 20px;
+									font-size: 10px;
+									color: #FFFFFF;
+									background-color: #999999;
+								}
 
-						.info-phone {
-							width: calc(100% - 64px);
-							float: left;
-							line-height: 28px;
-							font-size: 12px;
-							color: #999999;
+								.info-type-active {
+									background-color: $mainColor;
+								}
+
+								.info-phone {
+									// float: left;
+									line-height: 28px;
+									font-size: 12px;
+									color: #999999;
+								}
+							}
 						}
 					}
 				}
@@ -274,5 +339,10 @@
 		bottom: 15px;
 		right: 15px;
 	}
+	.button-box {
+		// width: 100%;
+		padding: 10px 15px;
+		box-sizing: border-box;
+	}
 </style>