敢为人鲜小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

206 lines
4.1 KiB

3 months ago
  1. <template>
  2. <view class="page">
  3. <!-- 导航栏 -->
  4. <navbar title="礼包列表" leftClick @leftClick="$utils.navigateBack" bgColor="#E3441A" color="#fff" />
  5. <!-- 订单筛选 -->
  6. <view class="tabs">
  7. <uv-tabs :list="tabs"
  8. :activeStyle="{color : '#fff', fontWeight : 600}"
  9. lineColor="#fff"
  10. :inactiveStyle="{color: 'rgba(255,255,255,.8)'}"
  11. lineHeight="8rpx"
  12. lineWidth="50rpx"
  13. :current="current"
  14. @click="clickTabs"></uv-tabs>
  15. </view>
  16. <view class="list">
  17. <view class="item" v-for="(item, index) in list" @click="toGiftDetail(item.id)" :key="index">
  18. <view class="content">
  19. <view class="top">
  20. <view class="service">
  21. {{ item.title }}
  22. </view>
  23. <view class="status">
  24. <text>{{ item.state === 0 ? '待领取' : '已领取' }}</text>
  25. </view>
  26. </view>
  27. <view class="main">
  28. <view class="left">
  29. <image mode="aspectFill" :src="item.image && item.image.split(',')[0]"></image>
  30. </view>
  31. <view class="right">
  32. <view class="text-hidden-1">
  33. 赠送人{{item.senderName}}
  34. </view>
  35. <view class="text-hidden-1">
  36. 赠送时间{{item.createTime}}
  37. </view>
  38. <view class="text-hidden-2">
  39. 祝福语{{item.message}}
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="bottom">
  45. <view class="price">
  46. <text class="total-title">礼包价值</text>
  47. <text class="unit"></text>
  48. <text class="num">{{item.price}}</text>
  49. <text class="c-unit"></text>
  50. </view>
  51. <view @click.stop="receiveGift(item)" class="btn" v-if="item.state === 0">
  52. 立即领取
  53. </view>
  54. </view>
  55. </view>
  56. <view style="margin-top: 20rpx; min-width: 700rpx;">
  57. <uv-empty mode="list" v-if="list.length === 0"></uv-empty>
  58. </view>
  59. </view>
  60. </view>
  61. </template>
  62. <script>
  63. import mixinsList from '@/mixins/list.js'
  64. export default {
  65. mixins: [mixinsList],
  66. data() {
  67. return {
  68. mixinsListApi: 'getGiftList',
  69. tabs: [
  70. {
  71. name: '我赠送的'
  72. },
  73. {
  74. name: '我收到的'
  75. }
  76. ],
  77. current : 0,
  78. }
  79. },
  80. methods: {
  81. clickTabs({index}){
  82. },
  83. // 跳转礼包详情
  84. toGiftDetail(id) {
  85. uni.navigateTo({
  86. url: '/pages_order/order/giftDetail?id=' + id
  87. })
  88. },
  89. // 领取礼包
  90. receiveGift(item) {
  91. uni.showModal({
  92. title: '提示',
  93. content: '确认领取该礼包吗?',
  94. success: async (res) => {
  95. if (res.confirm) {
  96. await this.$http.post('/gift/receive', {
  97. id: item.id
  98. })
  99. uni.showToast({
  100. title: '领取成功',
  101. icon: 'success'
  102. })
  103. this.getData()
  104. }
  105. }
  106. })
  107. }
  108. }
  109. }
  110. </script>
  111. <style scoped lang="scss">
  112. .list {
  113. .item {
  114. width: calc(100% - 40rpx);
  115. background-color: #fff;
  116. margin: 20rpx;
  117. box-sizing: border-box;
  118. border-radius: 16rpx;
  119. padding: 30rpx;
  120. .content {
  121. .top {
  122. display: flex;
  123. justify-content: space-between;
  124. align-items: center;
  125. font-size: 34rpx;
  126. .status {
  127. font-weight: 600;
  128. color: #FFAC2F;
  129. flex-shrink: 0;
  130. margin-left: 20rpx;
  131. }
  132. }
  133. .main {
  134. display: flex;
  135. margin: 20rpx 0rpx;
  136. .left {
  137. display: flex;
  138. align-items: center;
  139. justify-content: center;
  140. width: 180rpx;
  141. height: 180rpx;
  142. image {
  143. width: 95%;
  144. height: 95%;
  145. border-radius: 10rpx;
  146. }
  147. }
  148. .right {
  149. display: flex;
  150. flex-direction: column;
  151. justify-content: space-between;
  152. width: calc(100% - 200rpx);
  153. color: #777;
  154. font-size: 26rpx;
  155. padding: 30rpx 20rpx;
  156. box-sizing: border-box;
  157. margin-left: 20rpx;
  158. border-radius: 10rpx;
  159. background-color: #F8F8F8;
  160. }
  161. }
  162. }
  163. .bottom {
  164. display: flex;
  165. justify-content: space-between;
  166. font-size: 25rpx;
  167. .price {
  168. .num {
  169. font-size: 36rpx;
  170. }
  171. .num,
  172. .unit,
  173. .c-unit {
  174. color: $uni-color;
  175. }
  176. }
  177. .btn {
  178. border: 1px solid #C7C7C7;
  179. padding: 10rpx 20rpx;
  180. border-radius: 40rpx;
  181. color: #575757;
  182. }
  183. }
  184. }
  185. }
  186. </style>