From 4250e140336ac40e10ab4c3b650030f82098ca92 Mon Sep 17 00:00:00 2001 From: xuxy <1059738716@qq.com> Date: 星期六, 27 七月 2024 21:37:07 +0800 Subject: [PATCH] update bug和样式 --- sub_pages/customer/shop/shop.vue | 124 +++++++++++++++++++++++++++++++--------- 1 files changed, 95 insertions(+), 29 deletions(-) diff --git a/sub_pages/customer/shop/shop.vue b/sub_pages/customer/shop/shop.vue index 4899b93..166571f 100644 --- a/sub_pages/customer/shop/shop.vue +++ b/sub_pages/customer/shop/shop.vue @@ -83,36 +83,40 @@ @click.stop="toDetail(item)"> <view class="img"> <image class="img img100" - src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/ff/fff3027bd0a146478fd1f0aae816a028%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_20240710224139.png"> + :src="item.cover" lazy-load> </image> <view class="level"> - A级 + {{item.levelStr||''}} </view> </view> <view class="m-l-12 info-container flex1"> <view class="title"> - 橙色芭比 + {{item.name}} <view class="price"> - ¥6.60/扎 + ¥{{item.price}}/扎 </view> </view> <view class="shop-name"> - 牛油果泡泡·白色 + {{item.categoryStr}} </view> <view class="other-info flex"> <view class="m-r-15"> - 已售:7 + 已售:{{item.sales || 0}} </view> <view class="m-r-15"> - 剩余:13 + 剩余:{{item.stock || 0}} </view> <view class="m-r-15"> - 1支/扎 + {{item.unit}} </view> </view> <view class="bottom-buttons flex"> - + <view class="m-l-0 m-r-a"> + <view class="m-r-15"> + 颜色:{{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> @@ -127,7 +131,10 @@ </view> <view v-if="flg==='1'" class="brand-info-1"> - <trade :hidefooter="true"></trade> + <trade :hidefooter="true" :catgoryTree="catgoryTree" v-if="catgoryTree" ref="trade"></trade> + <!-- // 构建一个分类树 --> + <!-- catgoryTree --> + </view> <view v-if="flg==='2'" class="brand-info-3"> <view class="title"> @@ -182,32 +189,63 @@ }, ], dto: {}, - list: [{}, {}], + list: [], id: '', + catgoryTree:undefined, } }, onLoad(options) { this.id = options.id || '' + // this.page.size = if (this.id) { this.getDetail() + } + this.listApi = `/api/customer/flower/list` + this.query.supplierId = this.id + this.getList('post') + }, + onReachBottom(){ + if(this.flg==='0'){ + this.getMore('post') } }, methods: { async getDetail() { - this.$message.showLoading() - const { - code, - data - } = await this.$http.request('get', `/api/pub/supplier/detail/${this.id}`, { - params: {} - }) - if (code === 0) { - this.dto = { - ...data, + { + this.$message.showLoading() + const { + code, + data + } = await this.$http.request('get', `/api/pub/supplier/detail/${this.id}`, { + params: {} + }) + if (code === 0) { + this.dto = { + ...data, + } } - } - this.$message.hideLoading() + this.$message.hideLoading() + } + //获取商家下的商品列表 + + // { + // this.$message.showLoading() + // const { + // code, + // data + // } = await this.$http.request('post', `/api/customer/flower/list`, { + // data: { + // supplierId: this.id, + // size: 20 + // } + // }) + // if (code === 0) { + // this.list = data.records || [] + // } + + // this.$message.hideLoading() + // } }, //update 关注 @@ -232,10 +270,35 @@ }, - changeTab(flg) { + async changeTab(flg) { console.log('changeTab', flg) - this.flg = ''+flg + if('1'===(''+flg)){ + if(!this.catgoryTree){ + this.$message.showLoading() + const { + code,data + } = await this.$http.request('get', `/api/customer/flower/category/tree`, { + data: { + supplierId: this.dto.supplierId || this.dto.id + }, + params: { + supplierId: this.dto.supplierId || this.dto.id + } + }) + if (code === 0) { + // data 分类树 + this.catgoryTree = data || [] + let tmp = this + this.$nextTick(()=>{ + tmp.$refs.trade.refInit(tmp.catgoryTree) + }) + } + this.$message.hideLoading() + } + } + this.flg = '' + flg //如果没有加载数据,需要加载一下 + }, buttonSearchFlow() { @@ -304,9 +367,13 @@ padding-left: 20rpx; } } - + .brand-info-1{ + // padding: 40rpx 30rpx; + + } .brand-info-3 { padding: 40rpx 30rpx; + .title { font-weight: 600; font-size: 32rpx; @@ -318,22 +385,21 @@ .form-input { display: flex; border-bottom: 2rpx solid #EEEEEE; + line-height: 80rpx; .label { font-weight: 600; font-size: 28rpx; color: #000000; - line-height: 40rpx; } .value { font-weight: 400; font-size: 28rpx; color: #666666; - line-height: 40rpx; margin-left: auto; margin-right: 0; - + text-align: right; .check { -- Gitblit v1.9.3