From e4233b5c4e123c4b79a38d0a9b0c8b60631e1683 Mon Sep 17 00:00:00 2001 From: xuxueyang <xuxy@fengyuntec.com> Date: 星期二, 30 七月 2024 10:40:24 +0800 Subject: [PATCH] update --- sub_pages/customer/shopping/shopping.vue | 46 +++++++++++++++++++++++++++++++++++++++------- 1 files changed, 39 insertions(+), 7 deletions(-) diff --git a/sub_pages/customer/shopping/shopping.vue b/sub_pages/customer/shopping/shopping.vue index 3ff5488..e9aaf14 100644 --- a/sub_pages/customer/shopping/shopping.vue +++ b/sub_pages/customer/shopping/shopping.vue @@ -1,6 +1,6 @@ <template> <view class="shopping-container"> - <view class="top-title"><span class="t-red">*</span> 苏州市一价全含,市区内包邮派送到店 + <view class="top-title"><span class="t-red">*</span> 花满芫报价已包含打包材料费、交易佣金 </view> <view class="top-desc"> 全程鲜花冷链专线,时效快,损耗小 @@ -29,24 +29,25 @@ <radio :checked="ids.indexOf(dto.id)>=0" @click="changeItem(dto,'flower')"></radio> <image class="img img100 m-r-6 br-4" :src="dto.url||dto.cover"></image> <view class="flex1"> - <view class="title"><span class="m-r-5" + <view class="title" @click.stop="toDetail(dto)"><span class="m-r-5" style="display: inline-block;">{{dto.categoryStr||''}}</span><span v-if="dto.levelStr" class="m-r-5" style="display: inline-block;">{{ dto.levelStr || '' }}</span>{{ dto.name || '-' }} </view> - <view class="price"> + <view class="price" @click.stop="toDetail(dto)"> {{ dto.price || '-' }}元/扎 </view> <view class="flex"> - <view class="desc m-t-12 flex"> + <view class="desc flex p-t-5" @click.stop="toDetail(dto)"> <view class="m-r-15">剩余:{{ dto.stock || 0 }}</view> <view class="m-r-15">颜色:{{ dto.color || '-' }}</view> </view> <view class="button-icons flex m-l-a m-r-0"> <uni-icons v-if="dto.num&&dto.num>=1" type="minus" size="32" - @click="addnum(dto,-1)"></uni-icons> + @click.stop="addnum(dto,-1)"></uni-icons> <view class="curnums" v-if="dto.num&&dto.num>=1">{{ dto.num }}</view> - <uni-icons type="plus-filled" size="32" @click="addnum(dto,1)"></uni-icons> + <uni-icons type="plus-filled" size="32" + @click.stop="addnum(dto,1)"></uni-icons> </view> </view> </view> @@ -197,7 +198,7 @@ break } } - console.log('this.list',this.list) + console.log('this.list', this.list) } }, @@ -244,6 +245,25 @@ //更换个人的 if (this.ids.indexOf(dto.id) < 0) { this.ids.push(dto.id) + var has = true + + //判断如果都有,那么顶部的按钮也勾选上 + for (var i = 0; i < this.list.length; i++) { + if (this.list[i].supplierId === dto.supplierId) { + for (var j = 0; j < this.list[i].flowerList.length; j++) { + if (this.ids.indexOf(this.list[i].flowerList[j].id) < 0) { + has = false + break + } + } + break + } + } + if (has) { + this.ids.push(dto.supplierId) + + } + } else { this.checkall = false @@ -258,6 +278,13 @@ if (dto.num + addnum >= 0) { } else { + return + } + if (!dto.stock) { + dto.stock = 0 + } + if (dto.num + addnum > dto.stock) { + this.$message.showToast('库存不足,无法添加') return } this.$message.showLoading() @@ -300,6 +327,11 @@ this.list = data || [] } + }, + toDetail(dto) { + uni.navigateTo({ + url: '/sub_pages/customer/trade/detail?id=' + dto.id + }) } } } -- Gitblit v1.9.3