myGift.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <view>
  3. <u-sticky h5-nav-height="0">
  4. <u-tabs :list="list" active-color="#5c40e8" :is-scroll="false" :current="current" @change="change"></u-tabs>
  5. </u-sticky>
  6. <view v-if="current == 0">
  7. <block v-for="(item, index) in giftList" :key="index">
  8. <view class="card">
  9. <view class="padding">
  10. <view class="flex justify-between align-center padding-bottom-sm">
  11. <view class="flex align-center">
  12. <view class="cuIcon-goods padding-right-xs text-bold text-black" style="font-size: 40upx;"></view>
  13. <view class="title">{{item.title}}</view>
  14. </view>
  15. <view v-if="item.status == '已完成'">
  16. <text class="padding-right-sm text-gray">已完成</text>
  17. <text class="cuIcon-delete text-gray" style="font-size: 30upx;"></text>
  18. </view>
  19. <view v-else>
  20. <text class="text-red">{{item.status}}</text>
  21. </view>
  22. </view>
  23. <view class="flex margin-top-xs">
  24. <image :src="item.image" style="width: 220upx;height: 220upx;"></image>
  25. <view class="padding-left-sm">
  26. <view class="name text-cut" style="width: 350upx;">{{item.name}}</view>
  27. <view class="specification">
  28. <view>{{item.specification}}</view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="flex justify-end padding" style="margin-top: -120upx;">
  34. <view class="count">x{{item.count}}</view>
  35. </view>
  36. </view>
  37. </block>
  38. </view>
  39. <view v-if="current == 1">
  40. <block v-for="(item, index) in giftList" :key="index">
  41. <view class="card" @click="select(index)" v-if="item.status == '待领取'">
  42. <view class="flex">
  43. <view :class="item.selected ? 'theme-color cuIcon-roundcheckfill':'cuIcon-round'" class="padding-sm" style="font-size: 50upx;"></view>
  44. <view class="padding-tb-sm">
  45. <view class="flex align-center padding-bottom-sm">
  46. <view class="cuIcon-goods padding-right-xs text-bold text-black" style="font-size: 40upx;"></view>
  47. <view class="title">{{item.title}}</view>
  48. </view>
  49. <view class="flex margin-top-xs">
  50. <image :src="item.image" style="width: 220upx;height: 220upx;"></image>
  51. <view class="padding-left-sm">
  52. <view class="name text-cut" style="width: 350upx;">{{item.name}}</view>
  53. <view class="specification">
  54. <view>{{item.specification}}</view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="flex justify-end padding" style="margin-top: -110upx;">
  61. <view class="count">x{{item.count}}</view>
  62. </view>
  63. </view>
  64. </block>
  65. <view style="height: 120upx;"></view>
  66. <view class="footer-fixed flex align-center justify-between padding-sm bg-white">
  67. <view class="flex align-center" @click="selectAll">
  68. <view :class="selectAllShow ? 'theme-color cuIcon-roundcheckfill':'cuIcon-round'" class="padding-right-xs" style="font-size: 50upx;"></view>
  69. <view class="text-sm padding-right-xs">全选</view>
  70. </view>
  71. <view>
  72. <button class="cu-btn round text-white theme-bg-color" style="width: 180upx;height: 80upx;margin-right: 30upx;" @click="donate">捐赠</button>
  73. <button class="cu-btn round text-white theme-bg-color" style="width: 180upx;height: 80upx;" @click="navTap">领取</button>
  74. </view>
  75. </view>
  76. </view>
  77. <view v-if="current == 2">
  78. <block v-for="(item, index) in giftList" :key="index">
  79. <view class="card" v-if="item.status == '已完成'">
  80. <view class="padding">
  81. <view class="flex justify-between align-center padding-bottom-sm">
  82. <view class="flex align-center">
  83. <view class="cuIcon-goods padding-right-xs text-bold text-black" style="font-size: 40upx;"></view>
  84. <view class="title">{{item.title}}</view>
  85. </view>
  86. <view>
  87. <text class="padding-right-sm text-gray">已完成</text>
  88. <text class="cuIcon-delete text-gray" style="font-size: 30upx;"></text>
  89. </view>
  90. </view>
  91. <view class="flex margin-top-xs">
  92. <image :src="item.image" style="width: 220upx;height: 220upx;"></image>
  93. <view class="padding-left-sm">
  94. <view class="name text-cut" style="width: 350upx;">{{item.name}}</view>
  95. <view class="specification">
  96. <view>{{item.specification}}</view>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. <view class="flex justify-end padding" style="margin-top: -120upx;">
  102. <view class="count">x{{item.count}}</view>
  103. </view>
  104. </view>
  105. </block>
  106. </view>
  107. <u-popup v-model="dialogShow" mode="center" width="500" height="480" border-radius="30">
  108. <view class="bg-img text-center" style="background-image: url('/static/dialogBgImg.png');height: 600rpx;">
  109. <view style="height: 80upx;"></view>
  110. <view style="font-size: 50upx;font-family: PingFang SC;font-weight: 600;color: #ffffff;">感谢你</view>
  111. <view class="text-bold text-black" style="padding: 80upx 0;">广发基金会已收到您的捐赠!</view>
  112. <view class="padding">
  113. <u-button class="custom-style" shape="circle" @click="dialogShow = false">确定</u-button>
  114. </view>
  115. </view>
  116. </u-popup>
  117. </view>
  118. </template>
  119. <script>
  120. export default {
  121. data() {
  122. return {
  123. list: [{
  124. name: '全部'
  125. }, {
  126. name: '待领取'
  127. }, {
  128. name: '已完成'
  129. }],
  130. current: 0,
  131. selectAllShow: false,
  132. giftList: [
  133. {image: '/static/gift/commodity2.png', title: 'lilbetter化妆品旗舰', name: 'Lilbetter发泥男士定型自然', specification: '发泥+洁面乳 120ml', count: 1, selected: true, status: '已完成'},
  134. {image: '/static/gift/commodity1.png', title: '轩城工艺沙发', name: '创意单人懒人沙发香蕉躺椅', specification: '黄色(皮质)', count: 3, selected: false, status: '待领取'},
  135. {image: '/static/gift/commodity3.png', title: '懒虫家居生活馆', name: '懒人沙发阳台躺卧飘窗榻榻米', specification: '亚麻经典灰', count: 2, selected: true, status: '已完成'},
  136. {image: '/static/gift/commodity4.png', title: '白七自制', name: '白七尼龙帆布单肩斜跨学生', specification: '黑色', count: 1, selected: false, status: '待领取'},
  137. ],
  138. dialogShow: false,
  139. }
  140. },
  141. methods: {
  142. change(index) {
  143. this.current = index;
  144. },
  145. select(index) {
  146. this.giftList[index].selected = !this.giftList[index].selected;
  147. let flag = true;
  148. for (let item of this.giftList) {
  149. if (!item.selected) {
  150. flag = false;
  151. }
  152. }
  153. this.selectAllShow = flag;
  154. },
  155. selectAll() {
  156. this.selectAllShow = !this.selectAllShow;
  157. for (let item of this.giftList) {
  158. if (this.selectAllShow) {
  159. item.selected = true;
  160. } else {
  161. item.selected = false;
  162. }
  163. }
  164. },
  165. donate() {
  166. let count = 0;
  167. for (let item of this.giftList) {
  168. if (item.status == '待领取' && item.selected) {
  169. console.log(item.title);
  170. } else {
  171. count++
  172. }
  173. }
  174. if (count == this.giftList.length) {
  175. uni.showToast({
  176. title: "请至少选择一件礼包",
  177. icon: "none"
  178. })
  179. }
  180. },
  181. navTap() {
  182. uni.navigateTo({
  183. url: '/pages/mine/order/orderConfirm'
  184. })
  185. }
  186. }
  187. }
  188. </script>
  189. <style lang="scss" scoped>
  190. .card {
  191. margin: 20upx;
  192. border-radius: 16upx;
  193. background-color: #FFFFFF;
  194. .title {
  195. font-size: 28upx;
  196. font-family: PingFang SC;
  197. font-weight: 800;
  198. color: #222222;
  199. }
  200. .name {
  201. font-size: 26upx;
  202. font-family: PingFang SC;
  203. font-weight: 800;
  204. color: #222222;
  205. }
  206. .specification {
  207. padding-top: 30upx;
  208. font-size: 24upx;
  209. font-family: PingFang SC;
  210. font-weight: bold;
  211. color: #959595;
  212. }
  213. .count {
  214. width: 60upx;
  215. height: 60upx;
  216. border: #d9d9d9 1upx solid;
  217. border-radius: 16upx;
  218. display: flex;
  219. align-items: center;
  220. justify-content: center;
  221. }
  222. }
  223. .custom-style {
  224. background-color: #5b3ee7;
  225. width: 250upx;
  226. color: #ffffff;
  227. }
  228. </style>