myGift.vue 8.5 KB

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