From 06c7a41fe4680ae98d8ccd25b17d715b2a036532 Mon Sep 17 00:00:00 2001 From: 陶杰 <1378534974@qq.com> Date: 星期一, 09 九月 2024 19:00:54 +0800 Subject: [PATCH] 1、 245-小程序-供应商-商品管理-回收站-平台或花农删除的商品全部到回收站,回收站增加恢复和删除的按钮,恢复可以将商品恢复到原来的状态,删除可以将此商品彻底删除 目前在回收站点击编辑上架等功能显示“商品未找到”点击删除也删不了商品 2、 255-小程序-供应商-增加同品类同等级价格排名,方便花农根据排名改价格(前后端修改) 3、252-小程序-花店-首页搜索、交易大厅搜索-1.点击分类显示下拉选择效果 2.热区扩大一些,点击<无法切换 --- sub_pages/supplier/flower-manage/flower-manage.vue | 168 +++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 153 insertions(+), 15 deletions(-) diff --git a/sub_pages/supplier/flower-manage/flower-manage.vue b/sub_pages/supplier/flower-manage/flower-manage.vue index 34c0a81..53dd868 100644 --- a/sub_pages/supplier/flower-manage/flower-manage.vue +++ b/sub_pages/supplier/flower-manage/flower-manage.vue @@ -7,19 +7,34 @@ <view @click.stop="clickButton('inpass')" class="button button-search-inpass" style="flex:5"></view> <view @click.stop="clickButton('delete')" class="button button-search-delete" style="margin-top: -1rpx;"> </view> - </view> - - <view class="p15" style="min-height: calc(100vh - 160rpx);"> + <view class="top-buttons" v-if="type==='delete'"> + <view v-if="type === 'delete'" class="button t-red " @click.stop="deleteSelected()">删除</view> + <view v-if="type === 'delete'" class="button " @click.stop="recoverSelected()">恢复</view> + </view> + <view class="p15" style="min-height: calc(100vh - 500rpx);"> <no-data v-if="!list||list.length==0" style="width: 100%;"></no-data> + <view v-for="(item,index) in list" :key="index" class="m-b-24 flow-manage-list"> + <!-- <view v-if="type === 'delete'"><checkbox class="checkbox" :value="item.id" v-model="selectedFlowers" /> </view> + --> + <view class="flow-manage-list-item-radio" v-if="type === 'delete'"><radio :checked="isSelected(item.id)" @click="changeItem(item)"></radio></view> <view class="flow-manage-list-item"> - <view class="flex"> - <image class="flower-img img100 m-r-6" :src="item.cover" @click="previewImg(item.cover)"> - </image> + <view class="flex m-r-6"> + <view class="img flower-img m-r-6"> + <image class="flower-img img100 " :src="item.cover" + :class="[!item.stock?'component-stock-zero':'']" @click="previewImg(item.cover)"> + </image> + <view class="status" :class="[!item.stock?'zero':'']" v-if="item.statusStr"> + {{ item.statusStr}} + </view> + </view> + <view class="flex1"> <view class=" flex"> <view class="title">{{item.name}}<span class="level">{{item.levelStr}}</span></view> + <view class="m-l-a m-r-0" ><span class="label">排名</span><span class="value">{{item.typeRank || '-'}}</span></view> + <view class="m-l-a m-r-0"> {{item.categoryStr || '-'}} </view> @@ -126,6 +141,8 @@ currentInputDto: {}, currentInputKey: '', inputplaceholder: '', + selectedFlowers: [], // 存储选中的花的 ID + ids: [], } }, onShow() { @@ -137,6 +154,7 @@ async onLoad(options) { this.type = options.type || 'all' var title = '' + this.page.size = 5 //todo 根据type切换查询条件 if (this.type === 'delete') { this.listApi = '/api/supplier/flower/list/rc' @@ -171,7 +189,7 @@ this.getList() }, onReachBottom() { - this.page.current += 1 + console.log('onReachBottom') this.getMore() }, async onPullDownRefresh() { @@ -241,21 +259,22 @@ }) }, async buttonStatus(item, status) { - await this.$message.confirm(`确定${status==='off'?'下降':'上架'}此商品吗`) + await this.$message.confirm(`确定${status==='off'?'下架':'上架'}此商品吗`) this.$message.showLoading() this.$http.request('get', '/api/supplier/flower/list/' + status, { params: { id: item.id } }).then(res => { + this.$message.hideLoading() if (res.code == 0) { this.$message.showToast('操作成功') - item.status = status + item.status = (status == 'off' ? 'OFF' : 'UP') item.statusStr = (status == 'off' ? '下架' : '上架') } - }).finally(() => { + }).catch(e => { this.$message.hideLoading() - }) + }).finally(() => {}) }, async buttonDelete(item) { await this.$message.confirm('确定删除此商品吗') @@ -295,21 +314,99 @@ }) } }, + // 删除选中的花卉 + async deleteSelected() { + if (this.selectedFlowers.length === 0) { + this.$message.showToast('请选择要删除的商品'); + return; + } + + // 确认框 + await this.$message.confirm('确定删除此商品吗') + + var dto = { + ids: this.selectedFlowers, + } + + this.$message.showLoading() + this.$http.request('post', '/api/supplier/flower/list/delete/batch' , { + data: dto + }).then(res => { + if (res.code == 0) { + this.$message.showToast('操作成功') + this.refreshList() + + } + }).finally(() => { + this.$message.hideLoading() + }) + + + }, + async recoverSelected() { + if (this.selectedFlowers.length === 0) { + this.$message.showToast('请选择恢复的商品'); + return; + } + + // 确认框 + await this.$message.confirm('确定恢复此商品吗') + + var dto = { + ids: this.selectedFlowers, + } + + this.$message.showLoading() + this.$http.request('post', '/api/supplier/flower/list/restore/batch' , { + data: dto + }).then(res => { + if (res.code == 0) { + this.$message.showToast('操作成功') + this.refreshList() + } + }).finally(() => { + this.$message.hideLoading() + }) + + + }, + changeItem(item) { + const id = item.id; + // 判断selectedFlowers里面是否有item.id, 如果有则去掉,没有就加入 + if (this.selectedFlowers.includes(id)) { + // 移除选中的ID + this.selectedFlowers = this.selectedFlowers.filter(flowerId => flowerId !== id); + } else { + // 添加选中的ID + this.selectedFlowers.push(id); + } + }, + isSelected(id) { + // 检查ID是否在selectedFlowers中 + return this.selectedFlowers.includes(id); + } + } } </script> <style lang="scss" scoped> .flow-manage { + overflow-y: scroll; + + // min-height: ; .flow-manage-list { // padding: 20rpx 30rpx; padding: 22rpx 22rpx 20rpx 22rpx; background-color: #fff; + display: flex; + + .flow-manage-list-item-radio{ + width: 50rpx; + height: 50rpx; + } .flow-manage-list-item { - - // margin-bottom: 20rpx; - .title { font-weight: 600; font-size: 28rpx; @@ -323,6 +420,25 @@ line-height: 40rpx; margin-left: 20rpx; } + } + .label { + + font-weight: 400; + font-size: 24rpx; + color: #666666; + text-align: left; + // padding-left: 10rpx; + // padding-right: 10rpx; + } + + .label::after { + content: ": " + } + + .value { + font-weight: 400; + font-size: 24rpx; + color: #666666; } .buttons { @@ -346,6 +462,28 @@ height: 118rpx; min-width: 128rpx; min-height: 118rpx; + position: relative; + + .status { + position: absolute; + min-width: 66rpx; + height: 34rpx; + background: #20613D; + left: 0; + top: 0; + border-top-left-radius: 8rpx; + border-bottom-right-radius: 8rpx; + color: #FFFFFF; + line-height: 34rpx; + font-size: 22rpx; + text-align: center; + } + + .status.zero { + // background: unset; + // font-size: 24rpx; + + } } .each-list { @@ -382,7 +520,7 @@ } } } - + .top-buttons { display: flex; padding: 22rpx 42rpx; -- Gitblit v1.9.3