cart.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <view style="height: 100vh;background-color: #F5F5F5;">
  3. <view style="height:50upx"></view>
  4. <uniNavBar
  5. left-icon="back" title="购物车"
  6. @clickLeft="goback"
  7. @clickRight = "deleteShop"
  8. />
  9. <view class="titleright">编辑</view>
  10. <view class="cart-list">
  11. <view style="display: flex;align-items: center;padding: 20upx 36upx;
  12. border-bottom: 1px solid #F5F5F5;">
  13. <image src="" style="width: 50upx;height: 50upx;"></image>
  14. <span style="padding-left: 8upx;">华南酒店</span>
  15. </view>
  16. <view v-for="(item,index) in list" :key="index" class="shoplist" style="background-color: #fff;">
  17. <view style="flex: 1;">
  18. <van-checkbox-group :value="checkboxList" @change="changeBox(index)">
  19. <van-checkbox :name="index">{{index}}</van-checkbox>
  20. </van-checkbox-group>
  21. </view>
  22. <view style="flex: 15;">
  23. <van-card
  24. title-class="changewidth"
  25. price-class ="priceClass"
  26. :price="item.price"
  27. :desc="item.titleDesc"
  28. :title="item.title"
  29. thumb="https://gd3.alicdn.com/imgextra/i3/0/O1CN01IiyFQI1UGShoFKt1O_!!0-item_pic.jpg_400x400.jpg"
  30. >
  31. <view slot="footer">
  32. <uninumberbox :min="1" @change="bindChange"/>
  33. </view>
  34. </van-card>
  35. </view>
  36. </view>
  37. </view>
  38. <view style="position: fixed;bottom: 0;">
  39. <van-submit-bar
  40. :price="3050"
  41. button-text="结算"
  42. bind:submit="onClickButton"
  43. :tip="true"
  44. >
  45. <van-checkbox checked-color="#D9332E" :value="isAll" shape="round" @change="onChange">
  46. 全选
  47. </van-checkbox>
  48. </van-submit-bar>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import uniNavBar from '@/component/uni-nav-bar/uni-nav-bar.vue'
  54. import uninumberbox from '@/component/uinNumber.vue'
  55. export default {
  56. components: {
  57. uniNavBar,
  58. uninumberbox
  59. },
  60. data() {
  61. return {
  62. isAll: false,
  63. checkboxList:[],
  64. list:[
  65. {title:'洗澡拖鞋dddd一次性', titleDesc:'一次性亚述拖鞋dddd不ww要错过x2', price:'0.5'},
  66. {title:'洗澡拖鞋dsssss一次性', titleDesc:'一次性亚述拖dddddd鞋不要33错过x2', price:'0.5'},
  67. {title:'洗澡拖鞋一dddddd次性', titleDesc:'一次性亚述拖ddddd鞋不要错过wx2', price:'0.5'},
  68. {title:'洗澡拖鞋一次性', titleDesc:'一次性亚述拖dddddddddddddd鞋不要错过wwx3', price:'0.5'},
  69. {title:'洗澡拖鞋一次性', titleDesc:'一次性亚述拖ddddd鞋不要错ee过x2', price:'0.5'},
  70. {title:'洗澡拖鞋一次性', titleDesc:'一次性亚述拖鞋不要错过x2', price:'0.5'},
  71. {title:'洗澡拖鞋一次性', titleDesc:'一次性亚述拖鞋不要错过x2', price:'0.5'},
  72. {title:'洗澡拖鞋一次性', titleDesc:'一次性亚述拖鞋不要错过x2', price:'0.5'},
  73. {title:'洗澡拖鞋一次性', titleDesc:'一次性亚述拖鞋不要错过x2', price:'0.5'},
  74. {title:'洗澡拖鞋一次性', titleDesc:'一次性亚述拖鞋不要错过x2', price:'0.5'},
  75. {title:'洗澡拖鞋一次性', titleDesc:'一次性亚述拖鞋不要错过x2', price:'0.5'}
  76. ]
  77. }
  78. },
  79. // 隐藏分享菜单
  80. onLoad: function () {
  81. uni.hideShareMenu({
  82. success(res) {
  83. console.log(res)
  84. },
  85. fail(res){
  86. console.log(res)
  87. }
  88. });
  89. },
  90. methods: {
  91. // 返回上层
  92. goback() {
  93. uni.navigateBack();
  94. },
  95. // 编辑
  96. deleteShop() {
  97. },
  98. // 数量累加
  99. bindChange(e) {
  100. console.log(e)
  101. },
  102. // 单选
  103. changeBox(e) {
  104. if(this.checkboxList.length ===0 || this.checkboxList.length ===1 ) {
  105. this.checkboxList.push(e)
  106. }else {
  107. this.checkboxList.push(e);
  108. const array = this.checkboxList;
  109. const uniqueSet = new Set(array);
  110. const newArray = [...uniqueSet]
  111. this.$set(this.items, newArray);
  112. // this.checkboxList.filter(item => {
  113. // if(item === e) {
  114. // }else {
  115. // this.checkboxList.push(e)
  116. // }
  117. // })
  118. }
  119. console.log(this.checkboxList)
  120. },
  121. // 全选
  122. onChange() {
  123. }
  124. }
  125. }
  126. </script>
  127. <stle>
  128. .uniNavBar {
  129. height: 100%;
  130. }
  131. .cart-list {
  132. background-color: #fff;
  133. /* padding: 0 36upx; */
  134. }
  135. .titleright {
  136. text-align: right;
  137. padding: 10upx 30upx;
  138. background: #fff;
  139. border-bottom: 1px solid #eee;
  140. }
  141. .changewidth {
  142. color: #303133;
  143. font-size: 32upx;
  144. font-weight: 100!important;
  145. }
  146. .priceClass {
  147. color:#303133!important;
  148. font-weight: 100!important;
  149. font-size: 36upx;
  150. }
  151. .van-card {
  152. background-color: #fff!important;
  153. }
  154. .shoplist {
  155. display: flex;
  156. padding: 0 35upx;
  157. justify-content: space-between;
  158. align-items: center;
  159. }
  160. </style>