index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <view>
  3. <!-- 分类购物车下拉列表 -->
  4. <view class="cartList" :class="cartData.iScart?'on':''">
  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"></view>
  43. </view>
  44. </template>
  45. <script>
  46. export default {
  47. props:{
  48. cartData: {
  49. type: Object,
  50. default: () => {}
  51. }
  52. },
  53. data() {
  54. return {};
  55. },
  56. mounted(){
  57. },
  58. methods: {
  59. closeList(){
  60. this.$emit('closeList', false);
  61. },
  62. leaveCart(index){
  63. this.$emit('ChangeCartNumDan', false,index);
  64. },
  65. joinCart(index){
  66. this.$emit('ChangeCartNumDan', true,index);
  67. },
  68. subDel(){
  69. this.$emit('ChangeSubDel');
  70. },
  71. oneDel(id,index){
  72. this.$emit('ChangeOneDel',id,index);
  73. }
  74. }
  75. }
  76. </script>
  77. <style lang="scss">
  78. .mask{
  79. z-index: 99;
  80. }
  81. .cartList{
  82. position: fixed;
  83. left:0;
  84. bottom: 0;
  85. width: 100%;
  86. background-color: #fff;
  87. z-index:100;
  88. padding: 0 30rpx 200rpx 30rpx;
  89. padding-bottom: calc(200rpx + constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  90. padding-bottom: calc(200rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  91. box-sizing: border-box;
  92. border-radius:16rpx 16rpx 0 0;
  93. transform: translate3d(0, 100%, 0);
  94. transition: all .3s cubic-bezier(.25, .5, .5, .9);
  95. &.on{
  96. transform: translate3d(0, 0, 0);
  97. }
  98. .title{
  99. height: 108rpx;
  100. .name{
  101. font-size:28rpx;
  102. color: #282828;
  103. font-weight:bold;
  104. }
  105. .del{
  106. font-size: 26rpx;
  107. color: var(--view-theme);
  108. .iconfont{
  109. margin-right: 5rpx;
  110. font-size: 34rpx;
  111. }
  112. }
  113. }
  114. .list{
  115. max-height: 720rpx;
  116. overflow-x: hidden;
  117. overflow-y: auto;
  118. .item{
  119. margin-bottom: 40rpx;
  120. .pictrue{
  121. width: 176rpx;
  122. height: 176rpx;
  123. border-radius: 16rpx;
  124. position: relative;
  125. image{
  126. width: 100%;
  127. height: 100%;
  128. border-radius: 16rpx;
  129. }
  130. .mantle{
  131. position: absolute;
  132. top:0;
  133. left:0;
  134. width: 100%;
  135. height: 100%;
  136. background:rgba(255,255,255,0.65);
  137. border-radius:16rpx;
  138. }
  139. }
  140. .txtPic{
  141. width: 486rpx;
  142. .name{
  143. font-size:28rpx;
  144. color: #282828;
  145. &.on{
  146. color: #A3A3A3;
  147. }
  148. }
  149. .noBnt{
  150. width:126rpx;
  151. height:44rpx;
  152. background:rgba(242,242,242,1);
  153. border-radius:22rpx;
  154. text-align: center;
  155. line-height: 44rpx;
  156. font-size: 24rpx;
  157. color: #A3A3A3;
  158. margin-top: 10rpx;
  159. }
  160. .delTxt{
  161. margin-top: 48rpx;
  162. font-size: 24rpx;
  163. color: #E93323;
  164. text{
  165. width: 70rpx;
  166. height: 50rpx;
  167. text-align: center;
  168. line-height: 50rpx;
  169. }
  170. }
  171. .info{
  172. font-size: 23rpx;
  173. color: #989898;
  174. margin-top: 5rpx;
  175. }
  176. .bottom{
  177. margin-top: 11rpx;
  178. .money{
  179. font-weight:bold;
  180. font-size: 26rpx;
  181. color: var(--view-priceColor);
  182. .num{
  183. font-size: 34rpx;
  184. }
  185. }
  186. .cartNum{
  187. font-weight:bold;
  188. .num{
  189. font-size: 34rpx;
  190. color: #282828;
  191. width: 120rpx;
  192. text-align: center;
  193. }
  194. .reduce{
  195. color: #282828;
  196. font-size: 24rpx;
  197. width: 60rpx;
  198. height: 60rpx;
  199. text-align: center;
  200. line-height: 60rpx;
  201. }
  202. .plus{
  203. color: #282828;
  204. font-size: 24rpx;
  205. width: 60rpx;
  206. height: 60rpx;
  207. text-align: center;
  208. line-height: 60rpx;
  209. }
  210. }
  211. }
  212. }
  213. }
  214. }
  215. }
  216. </style>