shish 2 zile în urmă
părinte
comite
8b32d26f29

+ 50 - 1
hdApp/src/admin/ghsProduct/components/sel-popup.vue

@@ -15,7 +15,18 @@
           <div class="tui-scrolldiv-box">
             <div class="tui-number-box tui-bold tui-attr-title">
               <div class="tui-attr-title">数量</div>
-              <number-box :max="maxStock" :min="1" :value="buyNum" @change="change"></number-box>
+              <number-box 
+                :max="maxStock" 
+                :min="1" 
+                :value="buyNum"
+                :height="64"
+                :width="120"
+                :size="32"
+                :iconSize="44"
+                iconColor="#333333"
+                bgcolor="#F5F7FA"
+                @change="change"
+              ></number-box>
             </div>
           </div>
         </scroll-view>
@@ -214,6 +225,44 @@ export default {
     justify-content: space-between;
     padding: 20upx 0 30upx 0;
     box-sizing: border-box;
+
+    ::v-deep .tui-numberbox {
+      display: flex;
+      align-items: center;
+
+      .tui-numbox-icon {
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        width: 68upx;
+        height: 68upx;
+        padding: 0;
+        background-color: #f0f2f5;
+        border-radius: 14upx;
+        font-weight: bold;
+        transition: all 0.2s ease;
+
+        &:active {
+          background-color: #e2e8f0;
+          transform: scale(0.96);
+        }
+
+        &.tui-disabled {
+          background-color: #f7f8fa;
+          color: #cccccc !important;
+        }
+      }
+
+      .tui-num-input {
+        height: 68upx !important;
+        line-height: 68upx;
+        border-radius: 14upx;
+        margin: 0 16upx;
+        font-weight: bold;
+        color: #333333;
+        font-size: 32upx;
+      }
+    }
   }
 }
 </style>

+ 90 - 1
hdApp/src/admin/ghsProduct/detail.vue

@@ -9,6 +9,7 @@
         <view class="tui-pro-title app-size-32">
           <text v-if="productInfo.presell == 1">【预售】</text>
           <text v-if="Number(productInfo.discountPrice) > 0">【推荐】</text>
+          <text v-if="productInfo.variety == 1" class="variety-tag">【多颜色】</text>
           {{ productInfo.name}}
         </view>
         <button
@@ -103,10 +104,48 @@ export default {
       previewContent: [],
       id:0,
       shopId:0,
-      ghsInfo:{}
+      ghsInfo:{},
+      xjData: {},
+      hasColorInfo: {}
     };
   },
   onLoad(option) {},
+  onShow() {
+    // 监听选颜色页面 (xj.vue) 确认后的返回事件与数据
+    if (this.xjData && this.xjData.hasUpdate == 1) {
+      this.customData = (this.hasColorInfo && this.hasColorInfo.id) ? this.hasColorInfo : this.productInfo;
+      if (this.xjData.cancel == 1) {
+        const customData = {
+          ...this.customData,
+          bigCount: 0,
+          smallCount: 0,
+          itemPrice: this.customData.price
+        };
+        this.addItemEvent(customData);
+      } else {
+        const num = Number(this.xjData.stock) || 0;
+        const price = this.xjData.price || this.customData.price;
+        const customData = {
+          ...this.customData,
+          bigCount: num,
+          smallCount: 0,
+          itemPrice: price,
+          bigPrice: price,
+          smallPrice: 0
+        };
+        this.addItemEvent(customData);
+        if (this.popupAction === 'buy') {
+          this.$util.pageTo({ url: this.getAffirmUrl(), type: 2 });
+        } else {
+          uni.showToast({
+            title: '已加入购物车',
+            duration: 1500
+          });
+        }
+      }
+    }
+    this.xjData = {};
+  },
   mounted() {},
   computed: {
     ...mapGetters({ shopUser: "getShopUser",loginInfo: "getLoginInfo" })
@@ -176,6 +215,31 @@ export default {
       }
       return true
     },
+    /**
+     * 跳转到多颜色花材选颜色页面 (xj.vue)
+     * @param {Object} info 花材商品信息
+     * @param {string} actionType 操作类型: 'cart' 加入购物车, 'buy' 立即购买
+     */
+    goToSpecialVariety(info, actionType = 'cart') {
+      this.popupAction = actionType;
+      this.hasColorInfo = info;
+      const stock = Number(info.stock) || 0;
+      if (stock <= 0) {
+        uni.showToast({ title: "没有库存", icon: "none" });
+        return;
+      }
+      const ghsId = this.option.ghsId || (this.ghsInfo && this.ghsInfo.id) || '';
+      const ptItemId = info.itemId || info.id || 0;
+      this.$util.pageTo({
+        url: "/pagesPurchase/xj",
+        query: {
+          stock: info.stock,
+          price: info.price,
+          ghsId: ghsId,
+          ptItemId: ptItemId
+        }
+      });
+    },
     openCartPopup() {
       if (!this.checkLogin()) {
         return
@@ -188,6 +252,10 @@ export default {
         this.$msg('暂无库存')
         return
       }
+      if (this.productInfo.variety == 1) {
+        this.goToSpecialVariety(this.productInfo, 'cart')
+        return
+      }
       this.popupAction = 'cart'
       this.buyNum = 1
       this.popupShow = true
@@ -204,6 +272,10 @@ export default {
         this.$msg('暂无库存')
         return
       }
+      if (this.productInfo.variety == 1) {
+        this.goToSpecialVariety(this.productInfo, 'buy')
+        return
+      }
       this.popupAction = 'buy'
       this.buyNum = 1
       this.popupShow = true
@@ -341,6 +413,23 @@ export default {
   .shop-intro {
     background: #fff;
     padding: 30upx 0 10upx 30upx;
+    .variety-tag {
+      color: #049e2c;
+      font-weight: bold;
+    }
+    .variety-action-row {
+      margin: 10upx 0 20upx;
+      .variety-button {
+        display: inline-block;
+        border: 2upx solid #049e2c;
+        border-radius: 24upx;
+        padding: 10upx 30upx;
+        font-size: 28upx;
+        color: #049e2c;
+        font-weight: bold;
+        text-align: center;
+      }
+    }
     .tui-pro-titbox {
       margin: 30upx 0 20upx;
       @include disFlex(center, space-between);