index.vue 5.2 KB

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