index.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <view class="gift_list">
  3. <view v-if="giftList.length > 0">
  4. <view class="gift_item" v-for="item in giftList" :key="item.id" v-show="item.num > 0">
  5. <image :src="item.img" class="gift_img"></image>
  6. <view class="right">
  7. <view class="fixed">赠品名称:</view>
  8. <view class="bottom">
  9. <view class="name">{{ item.name }}</view>
  10. <view class="num">数量:{{ item.num }}</view>
  11. </view>
  12. </view>
  13. </view>
  14. </view>
  15. <view v-else class="noTip">该订单没有赠品</view>
  16. </view>
  17. </template>
  18. <script>
  19. import { _API_GetOrderGift } from '../../apis/order.js'
  20. export default {
  21. data() {
  22. return {
  23. giftList: []
  24. }
  25. },
  26. onLoad({ order_no }) {
  27. if(order_no) {
  28. this.getGiftList(order_no)
  29. }
  30. },
  31. methods: {
  32. getGiftList(order_no) {
  33. uni.showLoading({
  34. title:'加载中'
  35. })
  36. _API_GetOrderGift({
  37. order_num: order_no
  38. }).then(res => {
  39. uni.hideLoading()
  40. if(res.code === 200) {
  41. this.giftList = res.data.list
  42. }
  43. })
  44. }
  45. }
  46. }
  47. </script>
  48. <style scoped lang="scss">
  49. .noTip {
  50. width: 100%;
  51. padding: 20px 0;
  52. text-align: center;
  53. color: #181818;
  54. }
  55. .gift_list {
  56. min-height: 100%;
  57. background: $app-base-bg;
  58. .gift_item {
  59. padding: 28rpx 30rpx;
  60. margin-bottom: 1px;
  61. background-color: #FFFFFF;
  62. display: flex;
  63. justify-content: space-between;
  64. align-items: center;
  65. .gift_img {
  66. display: block;
  67. width: 140rpx;
  68. height: 140rpx;
  69. }
  70. .right {
  71. width: calc(100% - 140rpx);
  72. height: 140rpx;
  73. padding: 0 50rpx 0 30rpx;
  74. display: flex;
  75. justify-content: space-between;
  76. flex-direction: column;
  77. .fixed {
  78. color: #181818;
  79. font-size: 32rpx;
  80. }
  81. .bottom {
  82. display: flex;
  83. justify-content: space-between;
  84. align-items: center;
  85. .name {
  86. color: #F76454;
  87. font-size: 32rpx;
  88. }
  89. .num {
  90. color: #181818;
  91. font-size: 28rpx;
  92. }
  93. }
  94. }
  95. }
  96. }
  97. </style>