珠宝小程序前端代码
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.

213 lines
4.3 KiB

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
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"
  53. v-if="item.state == 0 && queryParams.type == 1">
  54. 立即领取
  55. </view>
  56. </view>
  57. </view>
  58. <view style="margin-top: 20rpx; min-width: 700rpx;">
  59. <uv-empty mode="list" v-if="list.length === 0"></uv-empty>
  60. </view>
  61. </view>
  62. </view>
  63. </template>
  64. <script>
  65. import mixinsList from '@/mixins/list.js'
  66. export default {
  67. mixins: [mixinsList],
  68. data() {
  69. return {
  70. mixinsListApi: 'getMyGiftOrder',
  71. tabs: [
  72. {
  73. name: '我赠送的'
  74. },
  75. {
  76. name: '我收到的'
  77. }
  78. ],
  79. current : 0,
  80. }
  81. },
  82. onLoad() {
  83. this.queryParams.type = 0
  84. },
  85. methods: {
  86. clickTabs({index}){
  87. this.list = []
  88. this.queryParams.type = index
  89. this.getData()
  90. },
  91. // 跳转礼包详情
  92. toGiftDetail(id) {
  93. uni.navigateTo({
  94. url: '/pages_order/order/giftDetail?id=' + id
  95. })
  96. },
  97. // 领取礼包
  98. receiveGift(item) {
  99. uni.showModal({
  100. title: '提示',
  101. content: '确认领取该礼包吗?',
  102. success: async (res) => {
  103. if (res.confirm) {
  104. await this.$http.post('/gift/receive', {
  105. id: item.id
  106. })
  107. uni.showToast({
  108. title: '领取成功',
  109. icon: 'success'
  110. })
  111. this.getData()
  112. }
  113. }
  114. })
  115. }
  116. }
  117. }
  118. </script>
  119. <style scoped lang="scss">
  120. .list {
  121. .item {
  122. width: calc(100% - 40rpx);
  123. background-color: #fff;
  124. margin: 20rpx;
  125. box-sizing: border-box;
  126. border-radius: 16rpx;
  127. padding: 30rpx;
  128. .content {
  129. .top {
  130. display: flex;
  131. justify-content: space-between;
  132. align-items: center;
  133. font-size: 34rpx;
  134. .status {
  135. font-weight: 600;
  136. color: #FFAC2F;
  137. flex-shrink: 0;
  138. margin-left: 20rpx;
  139. }
  140. }
  141. .main {
  142. display: flex;
  143. margin: 20rpx 0rpx;
  144. .left {
  145. display: flex;
  146. align-items: center;
  147. justify-content: center;
  148. width: 180rpx;
  149. height: 180rpx;
  150. image {
  151. width: 95%;
  152. height: 95%;
  153. border-radius: 10rpx;
  154. }
  155. }
  156. .right {
  157. display: flex;
  158. flex-direction: column;
  159. justify-content: space-between;
  160. width: calc(100% - 200rpx);
  161. color: #777;
  162. font-size: 26rpx;
  163. padding: 30rpx 20rpx;
  164. box-sizing: border-box;
  165. margin-left: 20rpx;
  166. border-radius: 10rpx;
  167. background-color: #F8F8F8;
  168. }
  169. }
  170. }
  171. .bottom {
  172. display: flex;
  173. justify-content: space-between;
  174. font-size: 25rpx;
  175. .price {
  176. .num {
  177. font-size: 36rpx;
  178. }
  179. .num,
  180. .unit,
  181. .c-unit {
  182. color: $uni-color;
  183. }
  184. }
  185. .btn {
  186. border: 1px solid #C7C7C7;
  187. padding: 10rpx 20rpx;
  188. border-radius: 40rpx;
  189. color: #575757;
  190. }
  191. }
  192. }
  193. }
  194. </style>