yygoods.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <view class="content">
  3. <checkbox-group>
  4. <view class="good" v-for="item in list">
  5. <image :src="item.image" mode="" class="good-img"></image>
  6. <view class="good-info">
  7. <view class="good-tit clamp2">
  8. {{item.name}}
  9. </view>
  10. <view class="good-tip">
  11. 随时随地 预约服务
  12. </view>
  13. <view class="good-buy">
  14. 已售1000件
  15. </view>
  16. <view class="good-price">
  17. {{item.price}} <text class="ot-price">¥{{item.ot_price}}</text>
  18. </view>
  19. </view>
  20. <checkbox :checked="item.isCheck" class="good-check" :value="item.id" @click="changeCheck(item)"/>
  21. </view>
  22. </checkbox-group>
  23. <u-loadmore :status="loadingType" />
  24. <view class="" style="height: 120rpx;">
  25. </view>
  26. <view class="sub-btn" @click="addGood">
  27. 确认添加
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. loadingType: 'loadmore',
  36. page: 1,
  37. pageSize: 10,
  38. loaded: false,
  39. list: []
  40. }
  41. },
  42. computed: {
  43. chooseList() {
  44. let arr = this.list.filter((item)=> {
  45. return item.isCheck == true
  46. })
  47. return arr
  48. }
  49. },
  50. onLoad() {
  51. },
  52. onShow() {
  53. this.getList()
  54. },
  55. onReachBottom() {
  56. // this.getList()
  57. },
  58. onReady() {
  59. },
  60. methods: {
  61. addGood() {
  62. this._prePage().xmlist = this.chooseList
  63. console.log(this.chooseList)
  64. uni.navigateBack()
  65. },
  66. changeCheck(item) {
  67. item.isCheck = !item.isCheck
  68. console.log(this.list)
  69. },
  70. getList() {
  71. let that = this
  72. if(that.loadingType == 'nomre' || that.loadingType == 'loading') {
  73. return
  74. }
  75. that.loadingType = 'loading'
  76. this.$u.api.getYyItemList({
  77. page: that.page,
  78. pageSize: that.pageSize,
  79. }).then(res => {
  80. that.list = that.list.concat(res.data.map(item => {
  81. item.isCheck = false
  82. return item
  83. }))
  84. that.page++
  85. if(that.pageSize == res.data.length ) {
  86. that.loadingType = 'loadmore'
  87. }else {
  88. that.loadingType = 'nomore'
  89. }
  90. that.loaded = true
  91. })
  92. }
  93. }
  94. }
  95. </script>
  96. <style lang="scss">
  97. .content {
  98. padding-top: 1rpx;
  99. }
  100. .good {
  101. width: 690rpx;
  102. margin: 20rpx auto;
  103. display: flex;
  104. justify-content: flex-start;
  105. padding: 20rpx;
  106. background-color: #fff;
  107. border-radius: 20rpx;
  108. position: relative;
  109. .good-check {
  110. position: absolute;
  111. bottom: 20rpx;
  112. right: 20rpx;
  113. }
  114. .good-img {
  115. width: 256rpx;
  116. height: 256rpx;
  117. background: #D6DEE1;
  118. border-radius: 15rpx;
  119. flex-shrink: 0;
  120. margin-right: 15rpx;
  121. }
  122. .good-info {
  123. display: flex;
  124. flex-direction: column;
  125. // align-items: ;
  126. justify-content: space-between;
  127. align-items: flex-start;
  128. .good-tit {
  129. font-size: 28rpx;
  130. font-weight: 500;
  131. color: #333333;
  132. }
  133. .good-buy {
  134. font-size: 24rpx;
  135. font-weight: 500;
  136. color: #9a9a9a;
  137. }
  138. .good-tip {
  139. font-size: 24rpx;
  140. font-weight: 500;
  141. color: #FA7014;
  142. }
  143. .good-price {
  144. color: #fd463e;
  145. font-size: 32rpx;
  146. &::before {
  147. content: '¥';
  148. font-size: 22rpx;
  149. color: #fd463e;
  150. }
  151. text {
  152. padding-left: 15rpx;
  153. font-size: 26rpx;
  154. font-weight: 500;
  155. text-decoration: line-through;
  156. color: #999999;
  157. }
  158. }
  159. }
  160. }
  161. .sub-btn {
  162. width: 616rpx;
  163. height: 74rpx;
  164. background: #4D74CF;
  165. border-radius: 15rpx;
  166. font-size: 30rpx;
  167. font-weight: bold;
  168. color: #FFFFFF;
  169. text-align: center;
  170. line-height: 74rpx;
  171. position: fixed;
  172. bottom: 45rpx;
  173. left: 0;
  174. right: 0;
  175. margin: auto;
  176. }
  177. </style>