gift_all.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <view class="cu-modal" :class="{ show: visible }">
  3. <view class="mask" @click="close"></view>
  4. <view class="cu-dialog wrapper">
  5. <view class="content">
  6. <view class="marginT15 title">确认好友</view>
  7. <view style="margin: 25px 15px">
  8. <input
  9. v-model="inputVal"
  10. class="uni-input flex1 marginX10 color-white input"
  11. placeholder="请输入好友ID"
  12. />
  13. </view>
  14. <view class="flex-align-center paddingB15">
  15. <cm-button :height="35" style="width: 400rpx" @click="apply()">确认</cm-button>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import { LEVEL_MAP } from '@/utils/config'
  23. import { throttle } from '@/utils'
  24. import resource from '@/utils/resource'
  25. import cmButton from '../../components/cm-button.vue'
  26. export default {
  27. components: { cmButton },
  28. data() {
  29. return {
  30. resource,
  31. LEVEL_MAP,
  32. visible: false,
  33. inventoryIds: [],
  34. inputVal: ''
  35. }
  36. },
  37. computed: {
  38. itemSize() {
  39. let width = (this.$store.state.systemInfo.screenWidth - 80 - 30 - 8) / 3
  40. let height = (132 / 88) * width
  41. return { width, height }
  42. }
  43. },
  44. methods: {
  45. show(ids) {
  46. this.inventoryIds = ids
  47. this.visible = true
  48. },
  49. async apply() {
  50. if (this.inputVal) {
  51. throttle.call(this.realApply)
  52. } else {
  53. this.$message.warn('受赠人不能为空!')
  54. }
  55. },
  56. async realApply() {
  57. const res = await this.$service.award.transferOrderPreSubmit({
  58. inventoryIds: this.inventoryIds,
  59. toUserShortId: this.inputVal
  60. })
  61. if (res.code === '0') {
  62. this.$emit('giftSuccess', res.data, {
  63. inventoryIds: this.inventoryIds,
  64. toUserShortId: this.inputVal
  65. })
  66. this.close()
  67. } else {
  68. this.$message.error(res.msg)
  69. }
  70. },
  71. close() {
  72. this.visible = false
  73. }
  74. }
  75. }
  76. </script>
  77. <style lang="scss" scoped>
  78. .mask {
  79. position: absolute;
  80. left: 0;
  81. right: 0;
  82. top: 0;
  83. bottom: 0;
  84. }
  85. .wrapper {
  86. width: 100%;
  87. background: transparent;
  88. .content {
  89. margin: 0 20px;
  90. background: #000000;
  91. border-radius: 16rpx;
  92. border: 4rpx solid;
  93. border-image: linear-gradient(180deg, rgba(89, 55, 195, 1), rgba(169, 27, 136, 1)) 2 2;
  94. .title {
  95. font-size: 20px;
  96. font-family: Helvetica;
  97. color: #ffffff;
  98. line-height: 26px;
  99. font-style: italic;
  100. text-align: center;
  101. text-shadow: 0px 2px 4px #a76ef4;
  102. }
  103. .input {
  104. height: 80rpx;
  105. line-height: 50rpx;
  106. border: 1px solid;
  107. border-image: linear-gradient(180deg, rgba(89, 55, 195, 1), rgba(169, 27, 136, 1)) 2 2;
  108. padding-left: 15rpx;
  109. }
  110. .item {
  111. margin: 0 13px 13px 0;
  112. position: relative;
  113. .super {
  114. position: absolute;
  115. z-index: 0;
  116. left: 0;
  117. top: 0;
  118. }
  119. .super-image {
  120. position: absolute;
  121. top: 6px;
  122. }
  123. .super-text {
  124. width: 125rpx;
  125. height: 48rpx;
  126. position: absolute;
  127. bottom: 10rpx;
  128. }
  129. .bg-title {
  130. color: #fff;
  131. font-size: 22rpx;
  132. text-align: center;
  133. position: absolute;
  134. left: 0;
  135. right: 0;
  136. bottom: 60rpx;
  137. // padding: 2rpx 0;
  138. }
  139. }
  140. }
  141. }
  142. </style>