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

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