From 480a7eb5fa89aa602167a7b5f42df5c6d79053b2 Mon Sep 17 00:00:00 2001
From: xuxueyang <xuxy@fengyuntec.com>
Date: 星期五, 26 七月 2024 16:20:55 +0800
Subject: [PATCH] fix bug 接口对接和样式调整

---
 sub_pages/customer/shop/shop.vue |   65 +++++++++++++++++++++-----------
 1 files changed, 42 insertions(+), 23 deletions(-)

diff --git a/sub_pages/customer/shop/shop.vue b/sub_pages/customer/shop/shop.vue
index 496e493..1c44a92 100644
--- a/sub_pages/customer/shop/shop.vue
+++ b/sub_pages/customer/shop/shop.vue
@@ -18,12 +18,14 @@
             <view class="store-name">花仙子</view>
             <view class="store-address">云南省-昆明市-官渡区</view>
           </view>
-          <view class="store-sc m-l-a m-r-0">
-            <image src="../../../static/icon-gz-1.png" class="icon" v-if="dto.followed"
-                   @click="updateGz(false)"></image>
-            <image src="../../../static/icon-gz-0.png" class="icon" v-if="!dto.followed"
-                   @click="updateGz(true)"></image>
-            关注
+          <view class="store-sc m-l-a m-r-0" @click="updateGz(!dto.followed)">
+            <view class="icon-view">
+              <image src="../../../static/icon-gz-1.png" class="icon" v-if="dto.followed"
+                     ></image>
+              <image src="../../../static/icon-gz-0.png" class="icon" v-if="!dto.followed"
+                     ></image>
+            </view>
+            <view>关注</view>
           </view>
         </view>
       </view>
@@ -69,7 +71,7 @@
           报价已包含打包费、材料费、交易佣金
         </view>
         <view class="component-shop-item flex" v-for="(item,index) of list" :key="index"
-              @click="toDetail(item)">
+              @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">
@@ -104,10 +106,10 @@
 
               <view class="icons flex">
                 <uni-icons v-if="item.shopnum&&item.shopnum>=1" type="minus" size="32"
-                           @click.stop="mulnum(item)"></uni-icons>
+                           @click.stop="addnum(item,-1)"></uni-icons>
                 <view class="curnums" 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)"></uni-icons>
+                           @click.stop="addnum(item,1)"></uni-icons>
               </view>
             </view>
           </view>
@@ -139,6 +141,7 @@
 
 <script>
 import trade from '@/sub_pages/customer/trade/trade.vue'
+import http from "../../../plugins/http";
 
 export default {
   components: {
@@ -217,23 +220,38 @@
     buttonSearchFlow() {
 
     },
-    mulnum(item) {
-      if (item.shopnum > 0) {
-        item.shopnum -= 1
-      }
-      this.shoptotal -= 1
-      this.$forceUpdate()
 
-    },
-    addnum(item) {
-      if (item.shopnum) {
-        item.shopnum += 1
-      } else {
-        item.shopnum = 1
+    async addnum(item, addnum) {
+      if (!this.currentInfo.id) {
+        await this.$message.confirm('请前往登录')
+        uni.navigateTo({
+          url: '/pages/user/supplier-user'
+        })
+        return
       }
-      this.shoptotal += 1
+      if (!item.shopnum) {
+        item.shopnum = 0
+      }
+      if (item.shopnum + addnum >= 0) {
+
+      } else {
+        return
+      }
+      this.$message.showLoading()
+      const {code} = await http.request('post', '/api/customer/flower/cart/change-num', {
+            data: {
+              id: item.id,
+              num: addnum
+            }
+          }
+      )
+      this.$message.hideLoading()
+      if (code === 0) {
+        item.shopnum += addnum
+      }
       this.$forceUpdate()
     },
+
   }
 }
 </script>
@@ -247,12 +265,13 @@
 
     .brand-info-0 {
       .top-title {
-        height: 54rpx;
+        height: 80rpx;
         background: #E4ECE8;
         border-radius: 4rpx;
         font-weight: 400;
         font-size: 24rpx;
         color: #779787;
+        margin-top: 10rpx;
         line-height: 80rpx;
       }
     }

--
Gitblit v1.9.3