collect.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <view class="content">
  3. <view class="top hflex acenter jbetween">
  4. <view class="left">共<span class="text_red">{{length}}</span>件商品</view>
  5. <view class="left" :class="is_manager?'text_blue':''" @click="manager">{{is_manager?'完成':'编辑'}}</view>
  6. </view>
  7. <view class="box">
  8. <block v-for="(item,index) in pageList" :key="index">
  9. <view class="item hflex acenter">
  10. <u-checkbox-group v-if="is_manager == 1" placement="column" @change="checkboxChange(index)">
  11. <u-checkbox v-model="item.id" :value="item.id" :checked="item.checked" shape="circle"></u-checkbox>
  12. </u-checkbox-group>
  13. <view class="">
  14. <image :src="item.img" class="img"></image>
  15. </view>
  16. <view class="vflex" style="margin-left: 24rpx;">
  17. <view class="name">{{item.name}}</view>
  18. <view class="price">¥{{item.price}}</view>
  19. </view>
  20. </view>
  21. </block>
  22. </view>
  23. <view class="bottom hflex acenter jbetween" v-if="is_manager == 1">
  24. <view>
  25. <u-checkbox-group placement="column" @change="checkboxAll2">
  26. <u-checkbox :value="all" :checked="isAllSelected" shape="circle" label="全选"></u-checkbox>
  27. </u-checkbox-group>
  28. </view>
  29. <view class="hflex aend">
  30. <view class="btn2">删除</view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import $api from '@/static/js/api.js'
  37. var that = ''
  38. export default {
  39. data() {
  40. return {
  41. length: 0,
  42. pageList: [
  43. {
  44. img: '/static/images/mine/avatar1.jpg',
  45. name: '兰蔻小黑瓶50ml全新肌底液精华液化妆品护肤全套礼盒…',
  46. price: 1298
  47. },
  48. {
  49. img: '/static/images/index/class_img4.png',
  50. name: '兰蔻小黑瓶50ml全新肌底液精华液化妆品护肤全套礼盒…',
  51. price: 1298
  52. }
  53. ],
  54. is_manager: 0,
  55. all: '',
  56. isAllSelected: false,
  57. }
  58. },
  59. onLoad() {
  60. that = this
  61. that.totalLength()
  62. },
  63. methods: {
  64. // 统计商品数量
  65. totalLength() {
  66. that.length = that.pageList.length
  67. },
  68. // 编辑
  69. manager() {
  70. if(that.is_manager == 0) {
  71. that.is_manager = 1
  72. } else {
  73. that.is_manager = 0
  74. }
  75. },
  76. // 全选
  77. checkboxAll2() {
  78. that.isAllSelected = !that.isAllSelected
  79. if(that.isAllSelected) {
  80. for(var i = 0;i<that.pageList.length;i++) {
  81. that.$set(that.pageList[i],'checked',true)
  82. }
  83. } else {
  84. for(var i = 0;i<that.pageList.length;i++) {
  85. that.$set(that.pageList[i],'checked',false)
  86. }
  87. }
  88. },
  89. // 单选
  90. checkboxChange(index) {
  91. console.log(index);
  92. }
  93. },
  94. }
  95. </script>
  96. <style lang="scss" scoped>
  97. .content {
  98. background: #F5F5F5;
  99. .top {
  100. width: 100%;
  101. box-sizing: border-box;
  102. padding: 20rpx 30rpx;
  103. .left {
  104. font-size: 32rpx;
  105. font-weight: 400;
  106. color: #555555;
  107. line-height: 44rpx;
  108. }
  109. .text_red {
  110. color: #FF5E5E;
  111. }
  112. .text_blue {
  113. color: #506DFF;
  114. }
  115. }
  116. .box {
  117. width: 100%;
  118. box-sizing: border-box;
  119. padding: 0 30rpx;
  120. background: #FFFFFF;
  121. .item {
  122. width: 100%;
  123. padding: 20rpx 0 32rpx;
  124. border-bottom: 1rpx solid #F4F4F4;
  125. .img {
  126. width: 196rpx;
  127. height: 196rpx;
  128. border-radius: 16rpx;
  129. }
  130. .name {
  131. font-size: 32rpx;
  132. font-weight: 400;
  133. color: #222222;
  134. line-height: 44rpx;
  135. text-overflow: ellipsis;
  136. overflow: hidden;
  137. display: -webkit-box;
  138. -webkit-box-orient: vertical;
  139. box-orient: vertical;
  140. line-clamp: 2;
  141. -webkit-line-clamp: 2;
  142. }
  143. .price {
  144. font-size: 44rpx;
  145. font-weight: bold;
  146. color: #FF5E5E;
  147. line-height: 52rpx;
  148. padding-top: 32rpx;
  149. }
  150. }
  151. .item:nth-last-child(1) {
  152. border: none;
  153. }
  154. }
  155. .bottom {
  156. width: 100%;
  157. z-index: 9;
  158. position: fixed;
  159. bottom: 0;
  160. height: 166rpx;
  161. background: #FFFFFF;
  162. box-sizing: border-box;
  163. padding: 8rpx 30rpx 74rpx;
  164. .btn2 {
  165. width: 200rpx;
  166. height: 80rpx;
  167. border-radius: 44rpx;
  168. border: 1px solid #506DFF;
  169. font-size: 36rpx;
  170. font-weight: 500;
  171. color: #506DFF;
  172. line-height: 80rpx;
  173. text-align: center;
  174. }
  175. }
  176. }
  177. </style>