敢为人鲜小程序前端代码仓库
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.

207 lines
4.1 KiB

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