From 0dabc0e7acc5491a709f20f3544eb8319e0d1fa0 Mon Sep 17 00:00:00 2001
From: xuxueyang <xuxy@fengyuntec.com>
Date: 星期四, 29 八月 2024 16:37:55 +0800
Subject: [PATCH] 1

---
 sub_pages/customer/self/collect.vue |  132 ++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 122 insertions(+), 10 deletions(-)

diff --git a/sub_pages/customer/self/collect.vue b/sub_pages/customer/self/collect.vue
index 68fd238..f652d88 100644
--- a/sub_pages/customer/self/collect.vue
+++ b/sub_pages/customer/self/collect.vue
@@ -55,11 +55,41 @@
 			})
 		},
 		methods: {
+			async clearCollect() {
+				await this.$message.confirm('是否清空已失效的商品')
+				this.$message.showLoading()
+				const {
+					code
+				} = await this.$http.request('post', '/api/collect/clear', {
+					data: {
+
+					}
+				})
+				this.$message.hideLoading()
+				if (code === 0) {
+					this.refreshList()
+				}
+			},
+			async delCollect(item) {
+				await this.$message.confirm('是否取消收藏')
+				this.$message.showLoading()
+				const {
+					code
+				} = await this.$http.request('get', '/api/collect/delete', {
+					params: {
+						flowerId: item.id
+					}
+				})
+				this.$message.hideLoading()
+				if (code === 0) {
+					this.refreshList()
+				}
+			},
 			toDetail(item) {
 				if (item.status == 'UP') {
 
 				} else {
-					this.$message.showToast('已失效,无法查看详情')
+					this.$message.showToast('商品已下架,无法查看详情')
 					return
 				}
 				uni.navigateTo({
@@ -130,7 +160,7 @@
 				if (!item.stock) {
 					item.stock = 0
 				}
-				if (item.shopnum + addnum > item.stock) {
+				if (addnum > 0 & item.shopnum + addnum > item.stock) {
 					this.$message.showToast('库存不足,无法修改')
 					return
 				}
@@ -162,22 +192,30 @@
 	<view class="page-collect " style="background: #E1F0E7;">
 		<view style="padding-bottom: 0rpx;" class="p20">
 			<view class="search-container flex">
-				<view class="flex1 input">
+				<view class="flex1 input flex">
 					<u-input placeholder="请输入花名" v-model="query.name">
 						<template slot="suffix">
 							<uni-icons color="#20613D" type="search" size="24" @click="refreshList"></uni-icons>
 						</template>
 					</u-input>
+					<!-- 	<view class="desc-gray text-center m-l-10">
+						一键清空失效商品
+					</view> -->
 				</view>
 			</view>
 			<view class="component-filter-container p10">
-				<view class="flex1" @click.stop="order_show=true">
-					{{ this.query.columnStr || '排序' }}
+				<!-- @click.stop="order_show=true" -->
+				<view class="flex1"  @click.stop="$refs.popup_column.open()">
+					排序{{ query.columnStr&&('-'+query.columnStr) || '' }}
 					<image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image>
 				</view>
-				<view class="flex1" @click.stop="level_show=true">
-					{{ this.query.levelStr || '级别' }}
+				<!-- @click.stop="level_show=true" -->
+				<view class="flex1" @click.stop="$refs.popup_level.open()">
+					{{ query.levelStr || '级别' }}
 					<image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image>
+				</view>
+				<view class="flex1 desc-gray" @click.stop="clearCollect">
+					一键清空已失效
 				</view>
 			</view>
 		</view>
@@ -191,8 +229,10 @@
 			@cancel="order_show=false"></u-picker>
 
 		<view class="trade-list-container">
-			<view class="trade-info-container flex" v-for="(dto,index) of list" :key="index">
-				<image class="img img100 br-4 m-r-10" :src="dto.url||dto.cover" @click.stop="toDetail(dto)"></image>
+			<view class="trade-info-container flex" :class="[dto.status!=='UP'?'OFF':'']" v-for="(dto,index) of list"
+				:key="index">
+				<image class="img img100 br-4 m-r-10" :class="[!dto.stock?'component-stock-zero':'']"
+					:src="dto.url||dto.cover" @click.stop="toDetail(dto)"></image>
 				<view class="flex1">
 					<view class="flex" @click.stop="toDetail(dto)">
 						<view class="title">
@@ -225,6 +265,10 @@
 								<uni-icons v-if="!dto.shopnum||dto.shopnum<=99" type="plus-filled" size="32"
 									@click.stop="addnum(dto,1)"></uni-icons>
 							</view>
+							<view class=" m-l-15 m-r-0 button" @click.stop="delCollect(dto)">
+								取消收藏
+							</view>
+
 						</view>
 					</view>
 				</view>
@@ -232,6 +276,57 @@
 			</view>
 
 		</view>
+
+
+		<uni-popup ref="popup_level" type="bottom">
+			<view class="component-popup_input_all">
+				<view class="text-center m-b-40" style="font-size: 48rpx;font-weight: 600;">点击选择不同级别</view>
+				<view v-for="(item,i) in level_columns" :key="i" class="m-t-20">
+					<view class="m-t-12 flex value-items">
+						<view class="value-item" @click="()=>{
+						if(each.value!==query.value){
+							query.level = each.value
+							query.levelStr = each.label
+							refreshList()
+							$refs.popup_level.close()
+						}																																						
+					}" :class="[query.level==each.value?'cur':'']" v-for="(each, j) in item" :key="j">
+							{{ each.label || '-' }}
+						</view>
+					</view>
+				</view>
+				<view class="button-space"></view>
+				<view>
+					<view class="button-green" @click="$refs.popup_level.close()">关闭
+					</view>
+				</view>
+			</view>
+		</uni-popup>
+		<uni-popup ref="popup_column" type="bottom">
+			<view class="component-popup_input_all">
+				<view class="text-center m-b-40" style="font-size: 48rpx;font-weight: 600;">点击选择不同排序</view>
+				<view v-for="(item,i) in order_columns" :key="i" class="m-t-20">
+					<view class="m-t-12 flex value-items">
+						<view class="value-item" @click="()=>{
+						if(each.value!==query.value){
+							query.column = each.value
+							query.columnStr = each.label
+							refreshList()
+							$refs.popup_column.close()
+						}																																						
+					}" :class="[query.column==each.value?'cur':'']" v-for="(each, j) in item" :key="j">
+							{{ each.label || '-' }}
+						</view>
+					</view>
+				</view>
+				<view class="button-space"></view>
+				<view>
+					<view class="button-green" @click="$refs.popup_column.close()">关闭
+					</view>
+				</view>
+			</view>
+		</uni-popup>
+
 	</view>
 </template>
 
@@ -269,6 +364,13 @@
 
 		}
 
+		.trade-info-container.OFF {
+			.title {
+				color: #666;
+
+			}
+		}
+
 		.trade-info-container {
 			background-color: #fff;
 			border-radius: 40rpx;
@@ -285,7 +387,7 @@
 				font-weight: 600;
 				font-size: 28rpx;
 
-				color: #000000;
+				color: #000;
 				line-height: 40rpx;
 
 				.level {
@@ -330,6 +432,16 @@
 				text-align: center;
 			}
 
+			.button {
+				width: 168rpx;
+				height: 48rpx;
+				border-radius: 30rpx;
+				border: 2rpx solid #333;
+				font-size: 24rpx;
+				color: #333;
+				line-height: 48rpx;
+				text-align: center;
+			}
 		}
 
 	}

--
Gitblit v1.9.3