addCartModel.wxml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <!--components/addCartModel/addCartModel.wxml-->
  2. <view class="modal-container {{visible ? 'modal-show' : ''}}">
  3. <view class="modal-mask" bindtap="handleClose"></view>
  4. <view class="modal-content">
  5. <!-- 头部关闭按钮 -->
  6. <view class="modal-header">
  7. <text class="title">选择规格</text>
  8. <text class="close-btn" bindtap="handleClose">×</text>
  9. </view>
  10. <!-- 商品信息 -->
  11. <view class="product-info">
  12. <image class="product-image" src="{{productDetail.prodPicList[0].picUrl}}" mode="aspectFill"></image>
  13. <view class="product-detail">
  14. <view class="prodName">{{productDetail.prodName}}</view>
  15. <view class="product-attr">
  16. <text class="price">¥{{productDetail.prodAttrList[selectIndex].prodAttrPrice.price}}</text>
  17. <text class="stock">剩余:{{productDetail.prodAttrList[selectIndex].availQty}}</text>
  18. </view>
  19. </view>
  20. </view>
  21. <!-- 数量选择 -->
  22. <view class="quantity-section">
  23. <view class="quantity-title">购买数量</view>
  24. <view class="quantity-control">
  25. <text class="btn-minus" bindtap="decreaseQuantity" disabled="{{quantity <= 1}}">-</text>
  26. <input class="quantity-input" type="number" value="{{quantity}}" disabled />
  27. <text class="btn-plus" bindtap="increaseQuantity" disabled="{{quantity >= productDetail.stock}}">+</text>
  28. </view>
  29. </view>
  30. <!-- 规格选择 -->
  31. <view class="spec-section">
  32. <text class="spec-title">规格</text>
  33. <view class="spec-option">
  34. <text class="spec-name {{index === selectIndex?'selected':''}}" data-index="{{index}}" wx:for="{{productDetail.prodAttrList}}" wx:key="name" bindtap="selectSpec">{{item.attrName}}</text>
  35. </view>
  36. </view>
  37. <!-- 底部按钮 -->
  38. <view class="footer">
  39. <button class="add-btn" bindtap="handleAddToCart">{{product.buy?"立即购买":"加入购物车"}}</button>
  40. </view>
  41. </view>
  42. </view>