index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <view class="">
  3. <radio-group @change="radioChange">
  4. <view class="setMeal" v-for="(item, index) in setMealList" :key="index" @tap="goBack(item)">
  5. <view class="">
  6. <view class="classBody">
  7. <view class="">
  8. <image class="classImg" :src="baseImagePath +item.imgUrl">
  9. </view>
  10. <view style="padding: 0 0 0 22rpx;">
  11. <view class="classBodyHead">
  12. {{item.name}}
  13. </view>
  14. <view class="classBodyContent">
  15. {{item.title}}
  16. </view>
  17. </view>
  18. <view class="viewRight">
  19. <view style="font-weight: bold;font-size: 26rpx;">
  20. {{item.surplusSum}}
  21. </view>
  22. </view>
  23. </view>
  24. <view class="border">
  25. <view class="classTime">
  26. 有效期至{{item.invalidDay}}
  27. </view>
  28. <radio style="line-height: 66rpx;" color="#0078FF" :value="index" :checked="id==index+1" />
  29. </view>
  30. </view>
  31. </view>
  32. </radio-group>
  33. </view>
  34. </template>
  35. <script>
  36. import {
  37. getMyPackage
  38. } from "@/api/carWash.js"
  39. export default {
  40. data: function() {
  41. return {
  42. id: 0,
  43. baseImagePath: this.baseImagePath,
  44. setMealList: [],
  45. pageNo:1,
  46. pageSize:10,
  47. shopId:"",
  48. carId:"",
  49. carWashType:""
  50. }
  51. },
  52. onLoad: function(option) { //option为object类型,会序列化上个页面传递的参数
  53. this.id = parseInt(option.id);
  54. this.setMealList = JSON.parse(option.setMealList);
  55. this.shopId =option.shopId;
  56. this.carId = option.carId;
  57. this.carWashType = option.carWashType;
  58. this.getMyPackage();
  59. for (let index in this.setMealList) {
  60. let dateTime = Number(this.setMealList[index].invalidDay)
  61. let date = new Date(dateTime);
  62. //时间戳为10位需*1000,时间戳为13位的话不需乘1000
  63. let y = date.getFullYear();
  64. let MM = date.getMonth() + 1;
  65. MM = MM < 10 ? ('0' + MM) : MM; //月补0
  66. let d = date.getDate();
  67. d = d < 10 ? ('0' + d) : d; //天补0
  68. this.setMealList[index].invalidDay = y + '.' + MM + '.' + d
  69. }
  70. },
  71. onReachBottom() {
  72. this.getMyPackage()
  73. },
  74. methods: {
  75. radioChange(e) {
  76. },
  77. getMyPackage(){
  78. let data = {
  79. pageNo: this.pageNo,
  80. pageSize: this.pageSize,
  81. carwashcode:this.carWashType,
  82. shopId:this.shopId,
  83. carId:this.carId
  84. }
  85. let that = this;
  86. // debugger
  87. getMyPackage(data).then((res) => {
  88. this.setMealList = [...this.setMealList,...res.data.data]
  89. // that.pageNo++
  90. })
  91. },
  92. goBack(datas) {
  93. uni.$emit('setMeal', datas)
  94. uni.navigateBack({
  95. delta: 1
  96. })
  97. },
  98. },
  99. }
  100. </script>
  101. <style>
  102. page {
  103. background: #EDEDED;
  104. }
  105. .setMeal {
  106. width: 710rpx;
  107. height: 232rpx;
  108. background: #FFFFFF;
  109. border-radius: 10rpx;
  110. margin-left: 20rpx;
  111. margin-top: 20rpx;
  112. }
  113. .classBody {
  114. width: 100%;
  115. display: flex;
  116. padding: 28rpx 28rpx 0 28rpx;
  117. }
  118. .classImg {
  119. width: 120rpx;
  120. height: 120rpx;
  121. /* background: linear-gradient(135deg, #D10498 0%, #D21728 100%); */
  122. border-radius: 8rpx;
  123. }
  124. .classBodyHead {
  125. height: 31rpx;
  126. font-size: 32rpx;
  127. font-family: PingFang SC;
  128. font-weight: bold;
  129. color: #333333;
  130. line-height: 31rpx;
  131. }
  132. .classBodyContent {
  133. width: 370rpx;
  134. height: 23rpx;
  135. font-size: 24rpx;
  136. font-family: PingFang SC;
  137. font-weight: 500;
  138. color: #666666;
  139. line-height: 31rpx;
  140. padding-top: 22rpx;
  141. }
  142. .viewRight {
  143. display: flex;
  144. height: 100%;
  145. margin-left: 68rpx;
  146. font-size: 24rpx;
  147. font-family: PingFang SC;
  148. font-weight: 500;
  149. color: #666666;
  150. line-height: 31rpx;
  151. }
  152. .border {
  153. display: flex;
  154. justify-content: space-between;
  155. width: 660rpx;
  156. height: 84rpx;
  157. margin-left: 25rpx;
  158. height: 1px;
  159. border-top: 1px dashed #D4D4D4;
  160. }
  161. .classTime {
  162. font-size: 24rpx;
  163. font-family: PingFang SC;
  164. font-weight: 500;
  165. color: #0062FF;
  166. line-height: 66rpx;
  167. }
  168. </style>