jf 5 years ago
parent
commit
77b4b4c814

+ 13 - 30
ghsApp/src/pagesStorehouse/flower/category.vue

@@ -17,26 +17,11 @@
 								:color="column.color"
 							>
 								<view v-if="column.custom == 'edit'" class="edit-td">
-									<template v-if="parentData.isSort">
-										<text
-											:class="['iconfont', 'iconshangyi', { disabled: index == 0 }]"
-											@click.stop="upSortByIndex(item, index)"
-										></text>
-										<text
-											:class="[
-												'iconfont',
-												'iconxiayi',
-												{ disabled: index >= parentData.dataList.length - 1 }
-											]"
-											@click.stop="downSortByIndex(item, index)"
-										></text>
+									<template v-if="isSort">
+										<text :class="['iconfont', 'iconshangyi', { disabled: index == 0 }]" @click.stop="upSortByIndex(item, index)"></text>
+										<text :class="['iconfont','iconxiayi',{ disabled: index >= parentData.dataList.length - 1 }]" @click.stop="downSortByIndex(item, index)"></text>
 									</template>
-									<text
-										v-else
-										class="iconfont icondelete"
-										@click.stop="delEvent(item, index)"
-									>
-									</text>
+									<text v-else class="iconfont icondelete" @click.stop="delEvent(item, index)"></text>
 								</view>
 								<view v-else-if="column.custom">
 									<view class="input-td">
@@ -60,19 +45,11 @@
 			</view>
 		</scroll-view>
 		<view class="under-bar">
-			<button
-				v-if="!isSort"
-				:class="['admin-button-com', 'default']"
-				@click="isSort = true"
-			>
+			<button v-if="!isSort" :class="['admin-button-com', 'default']" @click="isSort = true">
 				排序
 			</button>
-			<button
-				v-else
-				:class="['admin-button-com', 'default']"
-				@click="isSort = false"
-			>
-				取消排序
+			<button v-else :class="['admin-button-com', 'default','active']" @click="isSort = false">
+				确认排序
 			</button>
 			<button :class="['admin-button-com']" @click="showFlower = true">
 				添加
@@ -323,9 +300,15 @@ export default {
 			align-items: center;
 			justify-content: center;
 			margin: 0 20upx;
+			color: #FFFFFF;
+			background: #0099ff;
 			// width: 140upx;
 			height: 70upx;
 			font-size: 32upx;
+			&.active{
+				background: #ff0000;
+				border:1px solid #ff0000;
+			}
 		}
 	}
 	.main-view {

+ 32 - 26
ghsApp/src/pagesStorehouse/flower/manage.vue

@@ -10,31 +10,15 @@
 							</t-th>
 						</t-tr>
 						<t-tr v-for="(item, index) in list.data" :key="item.id">
-							<t-td
-								v-for="(column, colIndex) in columns"
-								:key="colIndex"
-								:align="column.align"
-								:color="column.color"
-							>
+							<t-td v-for="(column, colIndex) in columns" :key="colIndex" :align="column.align" :color="column.color" >
 								<view v-if="column.custom == 'edit'" class="edit-td">
-									<text
-										:class="['iconfont', 'iconshangyi', { disabled: index == 0 }]"
-										@click.stop="upSortByIndex(item, index)"
-									></text>
-									<text
-										:class="[
-											'iconfont',
-											'iconxiayi',
-											{ disabled: index >= dataList.length - 1 }
-										]"
-										@click.stop="downSortByIndex(item, index)"
-									></text>
-									<text class="iconfont iconbianji" @click.stop="editEvent(item, index)">
-									</text>
-									<text class="iconfont icondelete" @click.stop="delEvent(item, index)">
-									</text>
+									<text v-if="isRank" :class="['iconfont', 'iconshangyi', { disabled: index == 0 }]" @click.stop="upSortByIndex(item, index)"></text>
+									<text v-if="isRank" :class="['iconfont','iconxiayi',{ disabled: index >= dataList.length - 1 }]" @click.stop="downSortByIndex(item, index)"></text>
+									<text v-if="!isRank" class="iconfont iconbianji" @click.stop="addEvent(item, index)"></text>
+									<text v-if="!isRank" class="iconfont icondelete" @click.stop="delEvent(item, index)"></text>
+									<text v-if="!isRank" class="iconfont iconxiangyou" @click.stop="editEvent(item, index)" style="margin:0;font-size: 20rpx"></text>
 								</view>
-								<view v-else>
+								<view v-else @click.stop="editEvent(item, index)">
 									{{ item[column.dataIndex] || "" }}
 								</view>
 							</t-td>
@@ -48,7 +32,10 @@
 		</scroll-view>
 
 		<view class="under-bar">
-			<button :class="['admin-button-com']" @click="addEvent">
+			<button class="admin-button-com" :class="isRank?'active':''" @click="isRank = !isRank">
+				{{isRank?'确定排序':'排序'}}
+			</button>
+			<button class="admin-button-com" @click="addEvent">
 				添加
 			</button>
 		</view>
@@ -85,6 +72,7 @@ export default {
 	mixins: [list],
 	data() {
 		return {
+			isRank:false,
 			showEdit: false,
 			editInfo: {
 				name: "",
@@ -221,7 +209,15 @@ export default {
 				complete: () => {}
 			});
 		},
-		addEvent() {
+		addEvent(obj) {
+			if(obj){
+				this.editInfo = {
+					name: obj.name,
+						id: obj.id,
+						inTurn: obj.inTurn
+				},
+				console.log(obj)
+			}
 			this.showEdit = true;
 		},
 		closeModal() {
@@ -232,7 +228,11 @@ export default {
 			};
 			this.showEdit = false;
 		},
-		async affirmEvent() {
+		async affirmEvent(e) {
+			if(e.index==0){
+				this.closeModal();
+				return
+			}
 			try {
 				let params = {
 					...this.editInfo
@@ -275,8 +275,14 @@ export default {
 			justify-content: center;
 			margin: 0 20upx;
 			// width: 140upx;
+			color: #FFFFFF;
+			background: #0099ff;
 			height: 70upx;
 			font-size: 32upx;
+			&.active{
+				background: #ff0000;
+				border:1px solid #ff0000;
+			}
 		}
 	}
 	.main-view {