From 3ae92c6fa55922af770ebc8e9355c5c0255e69cd Mon Sep 17 00:00:00 2001 From: xuxy <1059738716@qq.com> Date: 星期一, 12 八月 2024 21:54:23 +0800 Subject: [PATCH] update花店详情 --- sub_pages/customer/shop/shop-trade.vue | 43 -------- sub_pages/customer/shop/shop.vue | 186 ++++++++++++++++++++++++++---------- sub_pages/customer/trade/detail.vue | 28 ++++ 3 files changed, 160 insertions(+), 97 deletions(-) diff --git a/sub_pages/customer/shop/shop-trade.vue b/sub_pages/customer/shop/shop-trade.vue index dbd7a58..4b3513b 100644 --- a/sub_pages/customer/shop/shop-trade.vue +++ b/sub_pages/customer/shop/shop-trade.vue @@ -104,47 +104,7 @@ this.currentCategory = this.list[0] || {} } }, - async updateParamsAndSearch() { - //todo 设置参数并查询 - await this.refreshList() - this.$refs.popup_param.close() - }, - openParamPop() { - //todo 同时设置查询参数为空吧 - this.$refs.popup_param.open() - }, - closeParamPop() { - this.$refs.popup_param.close() - }, - buttonSearchFlow() { - - if (this.type == 'category') { - //根据分类名称查询 - this.$message.showLoading() - this.$http.request('get', '/api/customer/flower/category/tree', { - params: { - name: this.query.name || '' - } - }).then(res => { - var data = res.data - this.list = data || [] - if (this.list.length > 0) { - this.query.categoryId = this.list[0].id || '' - this.currentCategory = this.list[0] || {} - } else { - this.query.categoryId = '' - this.currentCategory = {} - } - }).finally(() => { - this.$message.hideLoading() - }) - } else { - uni.navigateTo({ - url: '/sub_pages/customer/trade/list?' + 'supplierName=' + this.query.name - }) - - } - }, + toDetailList(item) { //去商品列表页面 console.log('toDetailList', this.supplierId) @@ -155,6 +115,7 @@ changeType(item) { this.query.categoryId = item.id || '' this.currentCategory = item + //拼接二级分类,然后查询商品列表 }, diff --git a/sub_pages/customer/shop/shop.vue b/sub_pages/customer/shop/shop.vue index d653f30..2e44cdb 100644 --- a/sub_pages/customer/shop/shop.vue +++ b/sub_pages/customer/shop/shop.vue @@ -53,7 +53,7 @@ </view> </view> <view class="brand-info"> - <view v-if="flg==='0'" class="brand-info-0"> + <view v-show="flg==='0'||flg==='1'" class="brand-info-0"> <view class="search-container flex" style="padding-left: 20rpx;padding-right: 20rpx;padding-top: 20rpx"> <view class="flex1 input"> @@ -67,7 +67,7 @@ </u-input> </view> </view> - <view class="component-filter-container" style="padding-top: 12rpx;"> + <view class="component-filter-container" style="padding-top: 12rpx;" v-show="flg==='0'"> <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> @@ -77,68 +77,78 @@ <image src="../../../static/common/icon-arrow-down.png" class="icon-arrow-down"></image> </view> </view> - <view class="top-title m-t-12"> + <view class="top-title m-t-12" v-show="flg==='0'"> 报价已包含打包费、材料费、交易佣金 </view> - <view class="component-shop-item flex" v-for="(item,index) of list" :key="index"> - <view class="img" @click.stop="toDetail(item)"> - <image class="img img100" :src="item.cover" lazy-load> - </image> - <view class="level"> - {{item.levelStr||''}} - </view> + <no-data v-if="(!list||list.length==0)&&true" style="width: 100%;margin-top: 120rpx;"></no-data> + <view class="flex m-t-12 flex-wrap-normal"> + <view class="type-list" v-if="flg==='1'"> + <view v-for="(item,index) of catgoryTree" @click="changeType(item)" + :class="[query.categoryRoot===item.id?'current':'']" :key="index" class="p10 flex type-item"> + {{item.name || '-'}} </view> + </view> + <view class="flex1"> + + + <view class="component-shop-item flex" v-for="(item,index) of list" :key="index" :class="flg==='1'?'flg-category':''"> + <view class="img" @click.stop="toDetail(item)"> + <image class="img img100" :src="item.cover" lazy-load> + </image> + <view class="level"> + {{item.levelStr||''}} + </view> + </view> - <view class="m-l-12 info-container flex1"> - <view class="title" @click.stop="toDetail(item)"> - {{item.name}} - <view class="price"> - ¥{{item.price}}/扎 - </view> - </view> - <view class="shop-name" @click.stop="toDetail(item)"> - {{item.categoryStr}} - </view> - <view class="other-info flex" @click.stop="toDetail(item)"> - <view class="m-r-15"> - 已售:{{item.sales || 0}} - </view> - <view class="m-r-15"> - 剩余:{{item.stock || 0}} - </view> - <view class="m-r-15"> - {{item.unit}} - </view> - </view> - <view class="bottom-buttons flex"> - <view class="m-l-0 m-r-a"> - <view class="m-r-15 desc-gray other-info"> - 颜色:{{item.color||'-'}} + <view class="m-l-12 info-container flex1"> + <view class="title" @click.stop="toDetail(item)"> + {{item.name}} + <view class="price"> + ¥{{item.price}}/扎 </view> </view> - <view class="icons flex"> - <uni-icons v-if="item.shopnum&&item.shopnum>=1" type="minus" size="32" - @click.stop="addnum(item,-1)"></uni-icons> - <view class="curnums" @click.stop="updateItemNum(item)" - v-if="item.shopnum&&item.shopnum>=1"> - {{ item.shopnum }} + <view class="shop-name" @click.stop="toDetail(item)"> + {{item.categoryStr}} + </view> + <view class="other-info flex" @click.stop="toDetail(item)"> + <view class="m-r-15"> + 已售:{{item.sales || 0}} </view> - <uni-icons v-if="!item.shopnum||item.shopnum<=99" type="plus-filled" size="32" - @click.stop="addnum(item,1)"></uni-icons> + <view class="m-r-15"> + 剩余:{{item.stock || 0}} + </view> + <view class="m-r-15"> + {{item.unit}} + </view> + </view> + <view class="bottom-buttons flex"> + <view class="m-l-0 m-r-a"> + <view class="m-r-15 desc-gray other-info"> + 颜色:{{item.color||'-'}} + </view> + </view> + <view class="icons flex"> + <uni-icons v-if="item.shopnum&&item.shopnum>=1" type="minus" size="32" + @click.stop="addnum(item,-1)"></uni-icons> + <view class="curnums" @click.stop="updateItemNum(item)" + v-if="item.shopnum&&item.shopnum>=1"> + {{ item.shopnum }} + </view> + <uni-icons v-if="!item.shopnum||item.shopnum<=99" type="plus-filled" size="32" + @click.stop="addnum(item,1)"></uni-icons> + </view> </view> </view> </view> </view> - + </view> </view> - <view v-show="flg==='1'" class="brand-info-1"> + <!-- <view v-show="flg==='1'" class="brand-info-1"> <trade :hidefooter="true" :supplierId="id" :catgoryTree="catgoryTree" v-if="catgoryTree" ref="trade"> </trade> - <!-- // 构建一个分类树 --> - <!-- catgoryTree --> - </view> + --> <view v-if="flg==='2'" class="brand-info-3"> <view class="title"> 基础信息 @@ -252,6 +262,7 @@ levelStr: '', level: '', name: '', + categoryRoot:'', }, level_show: false, level_columns: [ @@ -399,7 +410,13 @@ }, async changeTab(flg) { console.log('changeTab', flg) + if ('0' === ('' + flg)) { + //刷新list数据 + this.query.categoryRoot = '' + this.refreshList('post') + } if ('1' === ('' + flg)) { + this.list = [] if (!this.catgoryTree) { this.$message.showLoading() const { @@ -416,18 +433,34 @@ if (code === 0) { // data 分类树 this.catgoryTree = data || [] - let tmp = this - this.$nextTick(() => { - tmp.$refs.trade.refInit(tmp.catgoryTree) - }) + // let tmp = this + // this.$nextTick(() => { + // tmp.$refs.trade.refInit(tmp.catgoryTree) + // }) } this.$message.hideLoading() } + //如果存在第一个分类,根据一级分类查询 + if(this.catgoryTree.length>0){ + this.query.categoryRoot =this.catgoryTree[0].id + //然后刷新 + this.refreshList('post') + + } + } this.flg = '' + flg //如果没有加载数据,需要加载一下 + }, + changeType(item) { + if(item.id!==this.query.categoryRoot){ + this.query.categoryRoot = item.id || '' + this.refreshList('post') + //拼接二级分类,然后查询商品列表 + } + }, buttonSearchFlow() { // this.query.name = this.search_flow || '' @@ -518,6 +551,55 @@ padding: 40rpx 32rpx; height: calc(100vh - 450rpx); padding-top: 0rpx; + + .type-list { + max-width: 140rpx; + min-width: 140rpx; + background: #EEF7F5; + border-radius: 8rpx; + min-height: calc(100vh - 600rpx); + // max-height: calc(100vh - 600rpx); + overflow-y: scroll; + margin-right: 10rpx; + + .type-item { + text-align: center; + font-weight: 400; + font-size: 24rpx; + color: #000000; + display: block; + line-height: 60rpx; + // padding-left: 30rpx; + // padding-right: 30rpx; + } + + .type-item.current { + font-weight: 600; + color: #04BA97; + } + } + .flg-category.component-shop-item{ + .img{ + width: 140rpx; + height: 140rpx; + margin-top: 10rpx; + } + .info-container{ + .title { + margin-top: 0rpx; + } + .shop-name{ + + } + .other-info { + margin-bottom: 60rpx; + } + .bottom-buttons{ + bottom: -50rpx; + } + } + + } .brand-info-0 { .top-title { diff --git a/sub_pages/customer/trade/detail.vue b/sub_pages/customer/trade/detail.vue index e0db91c..97e4269 100644 --- a/sub_pages/customer/trade/detail.vue +++ b/sub_pages/customer/trade/detail.vue @@ -9,17 +9,25 @@ <swiper-item v-if="dto.video"> <video :src="dto.video" class="top-img" :auto-pause-if-navigate="true" style="display: block;margin: 0 auto;"></video> - + <view class="index-tag"> + 1/{{(dto.video&&1||0)+(dto.cover&&1||0)+(dto.bannerList&&dto.bannerList.length||0)}} + </view> </swiper-item> <swiper-item v-for="(url, index) in dto.bannerList" :key="index"> - <image class="top-img" :lazy-load="true" mode="scaleToFill" @click="previewImg(url)" - :src="url"> + <image class="top-img" :lazy-load="true" mode="scaleToFill" @click="previewImg(url)" :src="url"> </image> + <view class="index-tag"> + {{index+1+(dto.video&&1)}}/{{(dto.video&&1||0)+(dto.cover&&1||0)+(dto.bannerList&&dto.bannerList.length||0)}} + </view> </swiper-item> <swiper-item> - <image :src="dto.cover" :lazy-load="true" @click="previewImg(dto.cover)" class="top-img" mode="scaleToFill"> + <image :src="dto.cover" :lazy-load="true" @click="previewImg(dto.cover)" class="top-img" + mode="scaleToFill"> </image> + <view class="index-tag"> + {{(dto.bannerList&&dto.bannerList.length||0)+1+(dto.video&&1||0)}}/{{(dto.video&&1||0)+(dto.cover&&1||0)+(dto.bannerList&&dto.bannerList.length||0)}} + </view> </swiper-item> @@ -529,6 +537,18 @@ swiper-item { background-color: #fff; border-radius: 8rpx; + position: relative; + .index-tag{ + position: absolute; + color: #fff; + font-size: 22rpx; + right: 10rpx; + bottom: 10rpx; + padding: 10rpx 20rpx; + text-align: center; + background-color: #545454; + border-radius: 30rpx; + } } } -- Gitblit v1.9.3