cart.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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;border-radius: 100%;">
  18. <van-checkbox-group :value="checkboxList" @change="checkboxChange()">
  19. <van-checkbox checked-color="#D9332E" :name="index"></van-checkbox>
  20. </van-checkbox-group>
  21. <!-- <checkbox-group style="border-radius: 100%;" @change="checkboxChange(index)">
  22. <label class="checklabel">
  23. <view class="checkboxteil">
  24. <checkbox :checked="item.checked" />
  25. </view>
  26. </label>
  27. </checkbox-group> -->
  28. </view>
  29. <view style="flex: 15;">
  30. <van-card
  31. title-class="changewidth"
  32. price-class ="priceClass"
  33. :price="item.price"
  34. :desc="item.titleDesc"
  35. :title="item.title"
  36. thumb="https://gd3.alicdn.com/imgextra/i3/0/O1CN01IiyFQI1UGShoFKt1O_!!0-item_pic.jpg_400x400.jpg"
  37. >
  38. <view slot="footer">
  39. <uninumberbox :min="1" @change="bindChange"/>
  40. </view>
  41. </van-card>
  42. </view>
  43. </view>
  44. </view>
  45. <view style="position: fixed;bottom: 0;">
  46. <van-submit-bar
  47. :price="3050"
  48. button-text="结算"
  49. bind:submit="onClickButton"
  50. :tip="true"
  51. >
  52. <van-checkbox checked-color="#D9332E" :value="isAll" shape="round" @change="onChange">
  53. 全选
  54. </van-checkbox>
  55. </van-submit-bar>
  56. </view>
  57. </view>
  58. </template>
  59. <script>
  60. import uniNavBar from '@/component/uni-nav-bar/uni-nav-bar.vue'
  61. import uninumberbox from '@/component/uinNumber.vue'
  62. export default {
  63. components: {
  64. uniNavBar,
  65. uninumberbox
  66. },
  67. data() {
  68. return {
  69. isAll: false,
  70. checkboxList:[],
  71. list:[
  72. {title:'洗澡拖鞋dddd一次性', titleDesc:'一次性亚述拖鞋dddd不ww要错过x2', price:'0.5'},
  73. {title:'洗澡拖鞋dsssss一次性', titleDesc:'一次性亚述拖dddddd鞋不要33错过x2', price:'0.5'},
  74. {title:'洗澡拖鞋一dddddd次性', titleDesc:'一次性亚述拖ddddd鞋不要错过wx2', price:'0.5'},
  75. {title:'洗澡拖鞋一次性', titleDesc:'一次性亚述拖dddddddddddddd鞋不要错过wwx3', price:'0.5'},
  76. {title:'洗澡拖鞋一次性', titleDesc:'一次性亚述拖ddddd鞋不要错ee过x2', price:'0.5'},
  77. {title:'洗澡拖鞋一次性', titleDesc:'一次性亚述拖鞋不要错过x2', price:'0.5'},
  78. {title:'洗澡拖鞋一次性', titleDesc:'一次性亚述拖鞋不要错过x2', price:'0.5'},
  79. {title:'洗澡拖鞋一次性', titleDesc:'一次性亚述拖鞋不要错过x2', price:'0.5'},
  80. {title:'洗澡拖鞋一次性', titleDesc:'一次性亚述拖鞋不要错过x2', price:'0.5'},
  81. {title:'洗澡拖鞋一次性', titleDesc:'一次性亚述拖鞋不要错过x2', price:'0.5'},
  82. {title:'洗澡拖鞋一次性', titleDesc:'一次性亚述拖鞋不要错过x2', price:'0.5'}
  83. ]
  84. }
  85. },
  86. // 隐藏分享菜单
  87. onLoad: function () {
  88. // uni.hideShareMenu({
  89. // success(res) {
  90. // console.log(res)
  91. // },
  92. // fail(res){
  93. // console.log(res)
  94. // }
  95. // });
  96. },
  97. methods: {
  98. // 返回上层
  99. goback() {
  100. uni.navigateBack();
  101. },
  102. // 编辑
  103. deleteShop() {
  104. },
  105. // 数量累加
  106. bindChange(e) {
  107. console.log(e)
  108. },
  109. // 单选
  110. checkboxChange(e) {
  111. this.checkboxList = []
  112. console.log(e.detail)
  113. e.detail.forEach((item, idx) => {
  114. this.$set(this.checkboxList, idx, item)
  115. })
  116. console.log(this.checkboxList)
  117. // let items = this.list;
  118. // let values = e;
  119. // for (let i = 0, lenI = items.length; i < lenI; ++i) {
  120. // const item = items[i]
  121. // if(values == item){
  122. // this.$set(item,'checked',true)
  123. // }else{
  124. // this.$set(item,'checked',false)
  125. // }
  126. // }
  127. },
  128. // 全选
  129. onChange() {
  130. this.isAll = !this.isAll;
  131. let items = this.list;
  132. if(this.isAll) {
  133. items.forEach((item, idx) => {
  134. this.$set(this.checkboxList, idx, idx.toString())
  135. })
  136. // for (let i = 0, lenI = items.length; i < lenI; ++i) {
  137. // console.log(i);
  138. // this.$set(this.checkboxList, i, i)
  139. // // const item = items[i]
  140. // // this.$set(item,'checked',true)
  141. // }
  142. }else {
  143. for (let i = 0, lenI = items.length; i < lenI; ++i) {
  144. this.checkboxList = []
  145. // this.$set(this.checkboxList, [])
  146. // const item = items[i]
  147. // this.$set(item,'checked',false)
  148. }
  149. }
  150. }
  151. }
  152. }
  153. </script>
  154. <style>
  155. .uniNavBar {
  156. height: 100%;
  157. }
  158. .cart-list {
  159. background-color: #fff;
  160. /* padding: 0 36upx; */
  161. }
  162. .titleright {
  163. text-align: right;
  164. padding: 10upx 30upx;
  165. background: #fff;
  166. border-bottom: 1px solid #eee;
  167. }
  168. .changewidth {
  169. color: #303133;
  170. font-size: 32upx;
  171. font-weight: 100!important;
  172. }
  173. .priceClass {
  174. color:#303133!important;
  175. font-weight: 100!important;
  176. font-size: 36upx;
  177. }
  178. .van-card {
  179. background-color: #fff!important;
  180. }
  181. .shoplist {
  182. display: flex;
  183. padding: 0 35upx;
  184. justify-content: space-between;
  185. align-items: center;
  186. }
  187. .checklabel {
  188. transform:scale(0.7);
  189. border-radius: 100%;
  190. }
  191. .checkboxteil {
  192. transform:scale(0.7);
  193. border-radius: 100%;
  194. }
  195. </style>