index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <view>
  3. <!-- 分类购物车下拉列表 -->
  4. <view class="cartList" :class="{on:cartData.iScart,ons:!isFooter}">
  5. <view class="title acea-row row-between-wrapper">
  6. <view class="name">已选商品</view>
  7. <view class="del acea-row row-middle" @click="subDel"><view class="iconfont icon-shanchu1"></view>清空</view>
  8. </view>
  9. <view class="list">
  10. <view class="item acea-row row-between-wrapper" v-for="(item,index) in cartData.cartList" :key="index">
  11. <view class="pictrue">
  12. <image v-if="item.productInfo.attrInfo" :src='item.productInfo.attrInfo.image'></image>
  13. <image v-else :src='item.productInfo.image'></image>
  14. <view class="mantle" v-if="!item.status || !item.attrStatus"></view>
  15. </view>
  16. <view class="txtPic">
  17. <view class="name line2" :class="(item.attrStatus && item.status)?'':'on'">{{item.productInfo.store_name}}</view>
  18. <view v-if="item.attrStatus && item.status">
  19. <view class="info" v-if="item.productInfo.attrInfo">{{item.productInfo.attrInfo.suk}}</view>
  20. <!-- #ifdef H5 || APP-PLUS -->
  21. <slot name="center" :item="item"></slot>
  22. <!-- #endif -->
  23. <!-- #ifdef MP -->
  24. <slot name="center{{index}}"></slot>
  25. <!-- #endif -->
  26. <view class="bottom acea-row row-between-wrapper">
  27. <view class="money">¥<text class="num">{{item.truePrice}}</text></view>
  28. <view class="cartNum acea-row row-middle">
  29. <view class="reduce iconfont icon-jianhao1" @click="leaveCart(index)"></view>
  30. <view class="num">{{item.cart_num}}</view>
  31. <view class="plus iconfont icon-jiahao1" @click="joinCart(index)"></view>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="noBnt" v-else-if="!item.attrStatus">已售罄</view>
  36. <view class="noBnt" v-else-if="!item.status">已下架</view>
  37. <view class="delTxt acea-row row-right" v-if="!item.status || !item.attrStatus"><text @click="oneDel(item.id,index)">删除</text></view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="mask" v-if="cartData.iScart" @click="closeList" @touchmove.stop.prevent="moveHandle"></view>
  43. </view>
  44. </template>
  45. <script>
  46. export default {
  47. props:{
  48. cartData: {
  49. type: Object,
  50. default: () => {}
  51. },
  52. isFooter: {
  53. type: Boolean,
  54. default: false
  55. }
  56. },
  57. data() {
  58. return {};
  59. },
  60. mounted(){
  61. },
  62. methods: {
  63. moveHandle(){
  64. },
  65. closeList(){
  66. this.$emit('closeList', false);
  67. },
  68. leaveCart(index){
  69. this.$emit('ChangeCartNumDan', false,index);
  70. },
  71. joinCart(index){
  72. this.$emit('ChangeCartNumDan', true,index);
  73. },
  74. subDel(){
  75. this.$emit('ChangeSubDel');
  76. },
  77. oneDel(id,index){
  78. this.$emit('ChangeOneDel',id,index);
  79. }
  80. }
  81. }
  82. </script>
  83. <style lang="scss">
  84. .mask{
  85. z-index: 99;
  86. }
  87. .cartList{
  88. position: fixed;
  89. left:0;
  90. bottom: 0;
  91. width: 100%;
  92. background-color: #fff;
  93. z-index:100;
  94. padding: 0 30rpx 110rpx 30rpx;
  95. padding-bottom: calc(110rpx + constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  96. padding-bottom: calc(110rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  97. box-sizing: border-box;
  98. border-radius:16rpx 16rpx 0 0;
  99. transform: translate3d(0, 100%, 0);
  100. transition: all .3s cubic-bezier(.25, .5, .5, .9);
  101. &.on{
  102. transform: translate3d(0, 0, 0);
  103. }
  104. &.ons{
  105. // #ifndef H5
  106. padding-bottom: 0;
  107. padding-bottom: calc(0 + constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  108. padding-bottom: calc(0 + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  109. // #endif
  110. }
  111. .title{
  112. height: 108rpx;
  113. .name{
  114. font-size:28rpx;
  115. color: #282828;
  116. font-weight:bold;
  117. }
  118. .del{
  119. font-size: 26rpx;
  120. color: var(--view-theme);
  121. .iconfont{
  122. margin-right: 5rpx;
  123. font-size: 34rpx;
  124. }
  125. }
  126. }
  127. .list{
  128. max-height: 720rpx;
  129. overflow-x: hidden;
  130. overflow-y: auto;
  131. .item{
  132. margin-bottom: 40rpx;
  133. .pictrue{
  134. width: 176rpx;
  135. height: 176rpx;
  136. border-radius: 16rpx;
  137. position: relative;
  138. image{
  139. width: 100%;
  140. height: 100%;
  141. border-radius: 16rpx;
  142. }
  143. .mantle{
  144. position: absolute;
  145. top:0;
  146. left:0;
  147. width: 100%;
  148. height: 100%;
  149. background:rgba(255,255,255,0.65);
  150. border-radius:16rpx;
  151. }
  152. }
  153. .txtPic{
  154. width: 486rpx;
  155. .name{
  156. font-size:28rpx;
  157. color: #282828;
  158. &.on{
  159. color: #A3A3A3;
  160. }
  161. }
  162. .noBnt{
  163. width:126rpx;
  164. height:44rpx;
  165. background:rgba(242,242,242,1);
  166. border-radius:22rpx;
  167. text-align: center;
  168. line-height: 44rpx;
  169. font-size: 24rpx;
  170. color: #A3A3A3;
  171. margin-top: 10rpx;
  172. }
  173. .delTxt{
  174. margin-top: 48rpx;
  175. font-size: 24rpx;
  176. color: #E93323;
  177. text{
  178. width: 70rpx;
  179. height: 50rpx;
  180. text-align: center;
  181. line-height: 50rpx;
  182. }
  183. }
  184. .info{
  185. font-size: 23rpx;
  186. color: #989898;
  187. margin-top: 5rpx;
  188. }
  189. .bottom{
  190. margin-top: 11rpx;
  191. .money{
  192. font-weight:bold;
  193. font-size: 26rpx;
  194. color: var(--view-priceColor);
  195. .num{
  196. font-size: 34rpx;
  197. }
  198. }
  199. .cartNum{
  200. font-weight:bold;
  201. .num{
  202. font-size: 34rpx;
  203. color: #282828;
  204. width: 120rpx;
  205. text-align: center;
  206. }
  207. .reduce{
  208. color: #282828;
  209. font-size: 24rpx;
  210. width: 60rpx;
  211. height: 60rpx;
  212. text-align: center;
  213. line-height: 60rpx;
  214. }
  215. .plus{
  216. color: #282828;
  217. font-size: 24rpx;
  218. width: 60rpx;
  219. height: 60rpx;
  220. text-align: center;
  221. line-height: 60rpx;
  222. }
  223. }
  224. }
  225. }
  226. }
  227. }
  228. }
  229. </style>