cart.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <template>
  2. <view class="cart-pages">
  3. <view class="cart-bar">
  4. <view>共25件商品</view>
  5. <view @click="editCart">
  6. <text class="edit" v-if="!isEdit">管理</text>
  7. <text class="save" v-else>完成</text>
  8. </view>
  9. </view>
  10. <view class="goods-list">
  11. <!-- 按分类显示 -->
  12. <view class="goods-class-box" v-for="item in 2">
  13. <view class="goods-class-head">
  14. <view>
  15. <u-checkbox shape="circle" active-color="#01c9b2" name='goodsClas' @change="goodsClasChange">
  16. 人气零食
  17. </u-checkbox>
  18. </view>
  19. <view class="des">
  20. <view>满<text>300</text></view>
  21. <u-image mode="scaleToFill" width="30rpx" height="30rpx" src="/static/ledou.png"></u-image>
  22. <view>才可购买</view>
  23. </view>
  24. </view>
  25. <view class="goods-class-list">
  26. <!-- 商品列表 -->
  27. <view class="goods-item" v-for="(item,index) in 3" :key="index">
  28. <view class="checkbox">
  29. <u-checkbox v-if="index!=1||isEdit" shape="circle" active-color="#01c9b2" name='goodsItem'></u-checkbox>
  30. </view>
  31. <view class="goods-imgs">
  32. <view v-if="index==1" class="goods-staus">已售罄</view>
  33. <u-image border-radius="12" width="158rpx" height="140rpx" src="/static/goods.png"></u-image>
  34. </view>
  35. <view class="goods-info">
  36. <view class="good-name">拉就是两地分居拉进来就是两地分居拉进来就是两地分居拉进来进来</view>
  37. <view class="goods-price">
  38. <view>
  39. <text>50</text>
  40. <u-image mode="scaleToFill" width="35rpx" height="35rpx" src="/static/ledou.png"></u-image>
  41. </view>
  42. <view v-if="index!=1">
  43. <u-number-box :min="1"></u-number-box>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="cart-submit">
  52. <view>
  53. <u-checkbox shape="circle" name='checkAll' active-color="#01c9b2" @change="checkAllChange" v-model="checkAll">全选</u-checkbox>
  54. </view>
  55. <view v-if="!isEdit">
  56. <view class="heji">
  57. <view>总计:<text>450</text></view>
  58. <u-image mode="scaleToFill" width="40rpx" height="40rpx" src="/static/ledou.png"></u-image>
  59. </view>
  60. <u-button size="mini" :custom-style="toOrderButton" type="error" @click="toOrder()">立即下单</u-button>
  61. </view>
  62. <view v-else>
  63. <u-button size="mini" :custom-style="toOrderButton" type="error">删除</u-button>
  64. </view>
  65. </view>
  66. </view>
  67. </template>
  68. <script>
  69. export default {
  70. data() {
  71. return {
  72. checkAll: false,// 全选
  73. isEdit: false, // 是否编辑模式
  74. toOrderButton: {
  75. borderRadius:'100rpx',
  76. fontSize:'30rpx',
  77. width: '180rpx',
  78. height: '60rpx'
  79. }
  80. };
  81. },
  82. methods: {
  83. // 全选
  84. checkAllChange(e) {
  85. console.log(e);
  86. },
  87. // 每个分类的全选
  88. goodsClasChange(e){
  89. console.log(e);
  90. },
  91. // 编辑购物车
  92. editCart(){
  93. this.isEdit = !this.isEdit
  94. },
  95. //立即下单
  96. toOrder(){
  97. uni.redirectTo({
  98. url:"/pages/toOrder/index"
  99. })
  100. }
  101. },
  102. }
  103. </script>
  104. <style lang="scss">
  105. page{
  106. height: 100%;
  107. }
  108. .cart-pages{
  109. width: 100%;
  110. height: 100%;
  111. display: flex;
  112. flex-direction: column;
  113. .cart-bar{
  114. display: flex;
  115. justify-content: space-between;
  116. padding:20upx;
  117. .edit{
  118. color: #666;
  119. }
  120. .save{
  121. color: #00aaff;
  122. }
  123. }
  124. .goods-list{
  125. flex-grow: 1;
  126. overflow: auto;
  127. .goods-class-box{
  128. background: #FFFFFF;
  129. box-shadow: 1px 1px 3px #eee;
  130. margin-bottom: 20upx;
  131. .goods-class-head{
  132. display: flex;
  133. align-items: center;
  134. padding: 20upx;
  135. border-bottom: 1px solid #F8F8F8;
  136. justify-content: space-between;
  137. .des{
  138. display: flex;
  139. align-items: center;
  140. font-size: 26upx;
  141. color: #999;
  142. text{
  143. color: #FA3534;
  144. }
  145. }
  146. }
  147. }
  148. .goods-item{
  149. padding: 20upx;
  150. display: flex;
  151. align-items: center;
  152. justify-content: space-between;
  153. border-bottom: 1px solid #F8F8F8;
  154. &:last-child{
  155. border: 0;
  156. }
  157. .checkbox{
  158. width: 80rpx;
  159. overflow: hidden;
  160. }
  161. .goods-imgs{
  162. position: relative;
  163. .goods-staus{
  164. width: 100%;
  165. height: 100%;
  166. position: absolute;
  167. z-index: 10000;
  168. border-radius: 15rpx;
  169. background: rgba($color: #000000, $alpha: 0.4);
  170. text-align: center;
  171. line-height: 140rpx;
  172. left: 0;
  173. top: 0;
  174. color: #eee;
  175. font-size: 24upx;
  176. font-weight: bold;
  177. }
  178. }
  179. .goods-info{
  180. padding-left: 20upx;
  181. .good-name{
  182. font-weight: bold;
  183. }
  184. }
  185. .goods-price{
  186. display: flex;
  187. align-items: center;
  188. justify-content: space-between;
  189. padding-top: 20upx;
  190. >view{
  191. &:first-child{
  192. font-size: 22upx;
  193. display: flex;
  194. align-items: center;
  195. text{
  196. color: red;
  197. font-size: 32upx;
  198. margin-right: 6upx;
  199. font-weight: bold;
  200. }
  201. }
  202. }
  203. }
  204. }
  205. }
  206. .cart-submit{
  207. padding: 20upx;
  208. background: #FFFFFF;
  209. box-shadow: 1px 1px 3px #eee;
  210. border-top: 1px solid #eee;
  211. display: flex;
  212. align-items: center;
  213. justify-content: space-between;
  214. >view{
  215. &:last-child{
  216. display: flex;
  217. align-items: center;
  218. font-size: 26upx;
  219. text{
  220. color: red;
  221. font-size: 40upx;
  222. }
  223. > view{
  224. padding-right: 50upx;
  225. }
  226. .heji{
  227. display: flex;
  228. align-items: center;
  229. font-weight: bold;
  230. }
  231. }
  232. }
  233. }
  234. }
  235. </style>