chenxiong 3 vuotta sitten
vanhempi
commit
0572165a4f
1 muutettua tiedostoa jossa 77 lisäystä ja 26 poistoa
  1. 77 26
      pages2/plan/edit.vue

+ 77 - 26
pages2/plan/edit.vue

@@ -5,10 +5,10 @@
 				<image :src="$method.splitImgHost(item.coverUrl)"></image>
 				<text>{{ item.goodsName }}</text>
 				<text style="color:#999;margin-left:12rpx;">{{ item.secAllNum }}节</text>
-				<view class="del_icon"><u-icon name="minus-circle-fill" color="#EB4D3D" size="40" @click="delItem(index, item.goodsId)"></u-icon></view>
+				<view class="del_icon"><u-icon name="close" color="#fff" size="20" @click="delItem(index, item.goodsId)"></u-icon></view>
 			</view>
 			<view class="item" style="vertical-align: top;">
-				<view class="item_add" @click="openSel"><u-icon name="plus-circle-fill" color="#32467B" size="32"></u-icon></view>
+				<view class="item_add" @click="openSel"><u-icon name="plus-circle-fill" color="#007AFF" size="32"></u-icon></view>
 				<view style="color:#999;text-align: center;">添加网课</view>
 			</view>
 		</view>
@@ -66,33 +66,43 @@
 		</u-popup>
 		<u-popup v-model="show" mode="bottom">
 			<view class="popup_box">
-				<view class="popup_title">
-					<u-row>
-						<u-col span="6"><view class="title_r">我的课程</view></u-col>
-						<u-col span="3" offset="3"><view class="title_l" @click="submit">确认</view></u-col>
-					</u-row>
+				<view>
+					<view class="line1"></view>
+					<view class="grade">选择课程</view>
+					<u-line></u-line>
 				</view>
 				<view class="popup_list" v-if="list2.length !== 0">
-					<view class="popup_item" v-for="(item, index) in list2" :key="index">
-						<view style="display: flex;align-items: center;">
-							<u-checkbox
-								:disabled="item.disabled"
-								@change="checkboxChange"
-								shape="circle"
-								active-color="#32467B"
-								v-model="list2[index].checked"
-								:key="index"
-								:name="item.goodsId"
-							></u-checkbox>
+					<scroll-view class="list_in" scroll-y="true">
+						<view class="popup_item" v-for="(item, index) in list2" :key="index">
+							
+								<u-checkbox
+									:disabled="item.disabled"
+									@change="checkboxChange"
+									shape="circle"
+									active-color="#007AFF"
+									v-model="item.checked"
+									:key="index"
+									:name="item.goodsId"
+								>
+									<view class="course_item" :class="{selected:item.checked}">
+										<view style="display: flex;align-items: center;"><image :src="$method.splitImgHost(item.coverUrl)" style="width: 278rpx;height: 134rpx;"></image></view>
+										<view style="margin: 16rpx;">
+											<view>{{ item.goodsName }}</view>
+											<view style="color:#999;">{{ item.secAllNum }}节</view>
+										</view>
+									</view>
+								</u-checkbox>
+							
 						</view>
-						<view style="display: flex;align-items: center;"><image :src="$method.splitImgHost(item.coverUrl)" style="width: 278rpx;height: 134rpx;"></image></view>
-						<view style="margin: 30rpx;">
-							<view>{{ item.goodsName }}</view>
-							<view style="color:#999;">{{ item.secAllNum }}节</view>
-						</view>
-					</view>
+					</scroll-view>
+					
+				</view>
+				<view class="popup_list" v-else><u-empty text="请前往购买课程" mode="list"></u-empty></view>
+				
+				<view class="submit_wrap">
+					<view class="title_l" @click="submit">确认</view>
+				
 				</view>
-				<view v-else><u-empty text="请前往购买课程" mode="list"></u-empty></view>
 			</view>
 		</u-popup>
 		<view @click="resultForm" class="submit_btn">确认计划</view>
@@ -112,6 +122,7 @@ export default {
 				endDate: '2021-05-31',
 				week: '一、三、五'
 			},
+			businessId:'',
 			calendar: 'range',
 			list: [],
 			list2: [],
@@ -301,6 +312,7 @@ export default {
 				this.index_review = res.data.data.studyDay - 1;
 				this.form.week = res.data.data.studyCount;
 				this.list = res.data.data.goodsVos;
+				this.businessId = res.data.data.goodsVos[0].businessId;
 				this.form.category = this.list[0].educationName + '-' + this.list[0].projectName + '-' + this.list[0].businessName;
 				var numWeek = [];
 				this.form.week.forEach((items, indexs) => {
@@ -392,10 +404,48 @@ export default {
 				this.form.category = this.list[0].educationName + '-' + this.list[0].projectName + '-' + this.list[0].businessName;
 			}
 		},
-		checkboxChange(e) {},
+		checkboxChange(e) {
+			let goodsId = e.name;
+			if(e.value) { //勾选
+				this.businessId = this.list2.find(listItem => listItem.goodsId == goodsId).businessId;
+				this.list2.forEach(listItem => {
+					if(listItem.businessId != this.businessId) {
+						listItem.disabled = true;
+					}
+				})
+			} else { //取消
+				this.$nextTick(() => {
+					let checkedNum = this.list2.filter(listItem => {
+						if(listItem.checked) {
+							return true;
+						} else {
+							if(this.list.length) {
+								return true;
+							} else {
+								return false;
+							}
+						}
+					}).length;
+					
+					if(checkedNum == 0) { //全部取消,且没有已选择的
+						this.businessId = '';
+						this.list2.forEach(listItem => {
+							console.log(listItem)
+							listItem.disabled = false;
+						})
+					}
+				})
+				
+			}
+		},
 		checkSameItem() {
 			this.list2.map(val => {
 				val.disabled = false;
+				if(this.businessId) {
+					if(val.businessId != this.businessId) {
+						val.disabled = true;
+					}
+				}
 				this.list.map(val1 => {
 					if (val.goodsId == val1.goodsId) {
 						val.disabled = true;
@@ -407,6 +457,7 @@ export default {
 		delItem(index, ids) {
 			this.list.splice(index, 1);
 			if (this.list.length === 0) {
+				this.businessId = '';
 				this.form.category = '';
 			} else {
 				this.form.category = this.list[0].educationName + '-' + this.list[0].projectName + '-' + this.list[0].businessName;