index.wxml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <!--pages/cart/index.wxml-->
  2. <n-pop-right open="{{true}}" bind:disagree="handleAuthDisagree" bind:ok="handleAuthOK" />
  3. <view>
  4. <!-- <view wx:if="{{loading}}">
  5. <t-loading t-class="page-loading" theme="circular" size="40rpx" loading t-class-indicator="t-class-indicator">
  6. <span slot="text" class="loading-text">加载中...</span>
  7. </t-loading>
  8. </view> -->
  9. <view class="d-flex flex-column" style="min-height: 800rpx;">
  10. <block wx:if="{{cartData.isNotEmpty}}">
  11. <template is="address" data="{{address: addr.name}}" />
  12. <template is="cartlist" data="{{cart: cartData, cartGoods: cartGoods, invalids: _invalidGoods, container: container }}" />
  13. </block>
  14. <template is="cartempty" wx:else />
  15. </view>
  16. <view class="pt-4 text-md gray-2" wx:if="{{favList && favList.length > 0}}" style="background-color: #f5f5f5;">
  17. <view class="px-4 pb-4">猜你喜欢</view>
  18. <view class="d-flex align-items-start pb-5">
  19. <t-icon name="chevron-left" style="margin-top: 160rpx;" />
  20. <view class="flex-1 overflow-hidden">
  21. <scroll-view scroll-x style="white-space: nowrap;" bindscrolltolower="handleReachBottom">
  22. <view class="d-flex pb-2" style="column-gap: 30rpx;">
  23. <view wx:for="{{favList}}" wx:for-item="item" wx:key="index">
  24. <n-good-card id="fav-gd-{{index}}" data="{{item}}" currency="{{item.currency || '¥'}}" thresholds="{{thresholds}}" class="goods-card-inside" data-index="{{index}}" bind:thumb="onClickGoodsThumb" bind:click="gotoGoodsDetail" bind:add-cart="onAddCart" />
  25. </view>
  26. <view style="padding-top: 150rpx;" wx:if="{{loadMoreStatus !== 2}}">
  27. <t-loading />
  28. </view>
  29. </view>
  30. </scroll-view>
  31. </view>
  32. <t-icon name="chevron-right" style="margin-top: 160rpx;" />
  33. </view>
  34. </view>
  35. </view>
  36. <n-goods-specs-popup id="goodsSpecsPopup" show="{{isSpuSelectPopupShow}}" title="{{details.title || ''}}" src="{{specImg ? specImg : primaryImage}}" specList="{{details.specList || []}}" skuList="{{skuArray}}" limitBuyInfo="{{details.limitInfo[0].text || ''}}" limitMaxCount="{{limitMaxCount}}" limitMinCount="{{limitMinCount}}" limitBuyInfo="{{limitBuyInfo}}" bind:closeSpecsPopup="handlePopupHide" bind:change="chooseSpecItem" bind:specsConfirm="specsConfirm" isStock="{{isStock}}" outEditStatus="{{outEditStatus}}">
  37. <view slot="goods-price">
  38. <view class="popup-sku__price">
  39. <n-price price="{{isAllSelectedSku ? selectSkuSellPrice : minSalePrice }}" wr-class="goods-price" symbol-class="popup-sku__price-symbol" class="mr-2" />
  40. <n-price price="{{isAllSelectedSku ? selectSkuLinePrice : minLinePrice}}" wr-class="goods-del" type="delthrough" />
  41. </view>
  42. </view>
  43. </n-goods-specs-popup>
  44. <t-toast id="t-toast" />
  45. <n-wait loading="{{wait}}" />
  46. <template name="address">
  47. <view class="d-flex px-3 py-2 text-sm gray-3">
  48. <view class="pr-2 shrink-0">配送至</view>
  49. <view class="flex-1 text-single">
  50. {{address && address.length > 0 ? address : "未设置"}}
  51. </view>
  52. <view class="ml-2 linkbtn d-flex align-items-center shrink-0" hover-class="linkbtn-active" catchtap="gotoAddr">
  53. <t-icon name="edit" />
  54. <view class="pl-1">管理</view>
  55. </view>
  56. <view class="ml-2 linkbtn d-flex align-items-center shrink-0" hover-class="linkbtn-active" catchtap="reload">
  57. <t-icon name="refresh" />
  58. <view class="pl-1">刷新</view>
  59. </view>
  60. </view>
  61. </template>
  62. <template name="cartempty">
  63. <view class="pt-7">
  64. <image src="/assets/cart/empty.jpg" mode="aspectFit" style="width: 750rpx;" bindtap="gotoList" />
  65. </view>
  66. </template>
  67. <template name="cartlist">
  68. <view class="cartwrap">
  69. <view class="flex-1">
  70. <template is="cartgroup" data="{{goods: cartGoods, invalids: invalids}}" />
  71. </view>
  72. <t-sticky container="{{ container }}">
  73. <n-cart-bar is-all-selected="{{cart.isAllSelected}}" total-amount="{{cart.totalAmount}}" total-goods-num="{{cart.selectedGoodsCount || 0}}" total-discount-amount="{{cart.totalDiscountAmount}}" fixed="{{false}}" bottomHeight="{{114}}" bindhandleSelectAll="onSelectAll" bindhandleToSettle="onToSettle" />
  74. </t-sticky>
  75. </view>
  76. </template>
  77. <template name="cartgroup">
  78. <view class="cart-group">
  79. <view class="goods-wrap">
  80. <!-- <block wx:for="{{goods}}" wx:for-item="good" wx:for-index="goodindex" wx:key="goodindex"> -->
  81. <!-- <view class="promotion-wrap" wx:if="{{handlePromotion.hasPromotion(promotion.promotionCode)}}" bindtap="gotoBuyMore" data-promotion="{{promotion}}">
  82. <view class="promotion-title">
  83. <view class="promotion-icon">{{promotion.tag}}</view>
  84. <view class="promotion-text">{{promotion.description}}</view>
  85. </view>
  86. <view class="promotion-action action-btn" hover-class="action-btn--active">
  87. <view class="promotion-action-label">
  88. {{promotion.isNeedAddOnShop == 1 ? '去凑单' : '再逛逛'}}
  89. </view>
  90. <t-icon name="chevron-right" size="32rpx" color="#BBBBBB" />
  91. </view>
  92. </view> -->
  93. <view class="goods-item" wx:for="{{goods}}" wx:for-item="goods" wx:for-index="gi" wx:key="extKey">
  94. <n-swipe-out right-width="{{ 72 }}">
  95. <view class="goods-item-info">
  96. <view class="check-wrap" catchtap="selectGoods" data-goods="{{goods}}" data-gi="{{gi}}" data-promoindex="{{promoindex}}">
  97. <t-icon size="40rpx" color="{{goods.isSelected ? 'rgba(0, 0, 0, 0.8)' : '#BBBBBB'}}" name="{{goods.isSelected ? 'check-circle-filled' : 'circle'}}" class="check" />
  98. </view>
  99. <view class="goods-sku-info">
  100. <view class="imageWrap" data-goods="{{goods}}" catchtap="gotoGoods">
  101. <view class="stock-mask" wx:if="{{goods.shortageStock || goods.stockQuantity <= 3}}">
  102. 仅剩{{goods.stockQuantity}}件
  103. </view>
  104. <t-image class="imgfix" t-class="thumb" src="{{goods.skuImage && goods.skuImage.length < 0 ? goods.skuImage : goods.goodImage}}" mode="aspectFit" />
  105. </view>
  106. <view class="flex-1 px-3 d-flex flex-column">
  107. <view class="flex-1 pb-2">
  108. <view class="text-sm thumb-title"><text>{{goods.title}}
  109. </text></view>
  110. <view class="thumb-tag" catchtap="onChangeSpec" data-gi="{{gi}}" data-goods="{{goods}}">
  111. <view> {{goods.skuTitle}}</view>
  112. <t-icon name="chevron-down" />
  113. </view>
  114. </view>
  115. <view>
  116. <n-price price="{{goods.price || '0'}}" fill="{{false}}" decimalSmaller />
  117. </view>
  118. </view>
  119. <view class="goods-stepper">
  120. <t-stepper classname="stepper-info" value="{{goods.buyNum}}" min="{{1}}" max="{{999}}" data-goods="{{goods}}" data-gi="{{gi}}" data-si="{{si}}" catchchange="onChangeStepper" catchblur="onBlurStepper" catchoverlimit="overlimit" theme="grey" />
  121. </view>
  122. </view>
  123. </view>
  124. <view slot="right" class="swiper-right-del" catchtap="onDeleteGoods" data-gi="{{gi}}" data-goods="{{goods}}">
  125. 删除
  126. </view>
  127. </n-swipe-out>
  128. </view>
  129. <!-- </block> -->
  130. </view>
  131. </view>
  132. </template>
  133. <wxs module="sw">
  134. var stringify = function (v) {
  135. return JSON.stringify(v)
  136. }
  137. var join = function (v) {
  138. return v.join(",")
  139. }
  140. module.exports = {
  141. stringify: stringify,
  142. join: join
  143. }
  144. </wxs>