jkshop.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <view class="content">
  3. <view class="content2">
  4. <view class="shopBox">
  5. <view class="shopLine" v-for="(item,index) in list" @click="ckshop(item)">
  6. <img src="../../static/img/ckn.png" alt="" class="ckImg" v-if="!item.ck">
  7. <img src="../../static/img/cky.png" alt="" class="ckImg" v-if="item.ck">
  8. <view class="shopName">{{item.shopName}}</view>
  9. </view>
  10. </view>
  11. </view>
  12. <view class="bottom">
  13. <view class="bottomLeft" @click="all">
  14. <img src="../../static/img/ckn.png" alt="" class="ckImg" v-if="!allck">
  15. <img src="../../static/img/cky.png" alt="" class="ckImg" v-if="allck">
  16. <view class="allTxt">全选</view>
  17. </view>
  18. <view class="determine" @click="determine">确定添加</view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. list:'',
  27. allck:false,
  28. shopckList:'',
  29. }
  30. },
  31. onLoad() {
  32. this.getShopList()
  33. },
  34. methods: {
  35. determine(){
  36. var shopckList=[]
  37. this.list.forEach(item=>{
  38. if(item.ck){
  39. shopckList.push(item)
  40. }
  41. })
  42. uni.setStorage({
  43. key: 'shopckList',
  44. data: shopckList,
  45. success: function () {
  46. uni.navigateBack(-1)
  47. }
  48. });
  49. },
  50. ckshop(item){
  51. item.ck=!item.ck
  52. },
  53. all(){
  54. this.allck=!this.allck;
  55. if(this.allck){
  56. this.list.forEach(item=>{
  57. item.ck=true;
  58. })
  59. }else{
  60. this.list.forEach(item=>{
  61. item.ck=false;
  62. })
  63. }
  64. },
  65. getShopList(){
  66. uni.showLoading({
  67. title: '加载中'
  68. })
  69. this.$http('openH5SetTheGuest/getShopList', {
  70. },'GET').then(res => {
  71. uni.hideLoading();
  72. res.data.forEach(item=>{
  73. item.ck=false;
  74. })
  75. this.list=res.data;
  76. //console.log(this.list)
  77. })
  78. }
  79. }
  80. }
  81. </script>
  82. <style scoped>
  83. .content{
  84. min-height: 100vh;
  85. background:#F4F5F7;
  86. }
  87. .shopBox{
  88. background: #ffffff;
  89. border-radius: 10rpx;
  90. }
  91. .content2{
  92. padding: 20rpx 24rpx;
  93. }
  94. .shopLine{
  95. display: flex;
  96. padding: 30rpx 20rpx;
  97. border-bottom: 1px solid #EEEEEE;
  98. }
  99. .ckImg{
  100. width: 44rpx;
  101. height: 44rpx;
  102. }
  103. .shopName{
  104. color: #3C3C3C;
  105. line-height: 44rpx;
  106. font-size: 28rpx;
  107. padding-left: 26rpx;
  108. }
  109. .bottom{
  110. width: 750rpx;
  111. height: 120rpx;
  112. background: #FFFFFF;
  113. position: fixed;
  114. left: 0;
  115. bottom: 0;
  116. display: flex;
  117. justify-content: space-between;
  118. }
  119. .bottomLeft{
  120. display: flex;
  121. padding-top: 38rpx;
  122. padding-left: 24rpx;
  123. }
  124. .allTxt{
  125. line-height: 44rpx;padding-left: 12rpx;color: #3C3C3C;
  126. }
  127. .determine{
  128. width: 310rpx;
  129. height: 98rpx;
  130. background: #3F90F7;
  131. border-radius: 10rpx;
  132. font-weight: 500;
  133. color: #FFFFFF;
  134. font-size: 31rpx;
  135. line-height: 98rpx;
  136. text-align: center;
  137. margin-top: 11rpx;
  138. margin-right: 24rpx;
  139. }
  140. </style>