AmountSelection.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <view class="container">
  3. <p>{{ '代金券' + title[Number(isGift)] }}</p>
  4. <view class="AmountSelection">
  5. <view
  6. v-for="(item, index) in amountData" :key="index" class="selectionItem"
  7. @click="active = index; $emit('getCustomValue', index)"
  8. >
  9. <image v-show="active == index" class="selectIcon" src="../../../../static/images/user/xuanzhong.png"></image>
  10. <!-- <tui-input type="number" min="0" max="20000" class="numbers" @input="$emit('getCustomValue', index)" v-if="index == amountData.length-1" v-model="amountData[index].value"></tui-input> -->
  11. <view
  12. v-if="index == amountData.length - 1" class="numbers"
  13. @click="(isShowGiveCustomDialog = true) && (customIndex = index)"
  14. >
  15. {{ amountData[index].value }}
  16. </view>
  17. <p v-else class="numbers">{{ item.value }}</p>
  18. <p class="title">{{ index != amountData.length - 1 ? title2[Number(isGift)] + item.price : '自定义金额' }}</p>
  19. </view>
  20. </view>
  21. <tui-dialog
  22. style="position: relative;z-index: 888;" :buttons="[{ text: '取消' }, { text: '确定', color: '#586c94' }]"
  23. :show="isShowGiveCustomDialog" :title="`自定义${title[Number(isGift)]}数量`" @click="handleClickGiveCustomDialog"
  24. >
  25. <template #content>
  26. <tui-input
  27. :label="`${title[Number(isGift)]}数量`" type="number" :placeholder="`请输入${title[Number(isGift)]}数量`"
  28. @input="(e) => $emit('getCustomValue', customIndex, e)"
  29. >
  30. <template #right>
  31. <text>代金券</text>
  32. </template>
  33. </tui-input>
  34. </template>
  35. </tui-dialog>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. name: 'AmountSelection',
  41. props: {
  42. amountData: {
  43. type: Array,
  44. default: []
  45. },
  46. isGift: {
  47. type: Boolean,
  48. default: false
  49. }
  50. },
  51. data() {
  52. return {
  53. active: 0,
  54. title: ['充值', '转赠'],
  55. title2: ['售价', '价值'],
  56. isShowGiveCustomDialog: false,
  57. customIndex: ''
  58. }
  59. },
  60. methods: {
  61. handleClickGiveCustomDialog(e) {
  62. if (e.index === 0) {
  63. } else if (e.index === 1) {
  64. }
  65. this.isShowGiveCustomDialog = false
  66. }
  67. }
  68. }
  69. </script>
  70. <style lang="scss" scoped>
  71. /deep/ .tui-input__wrap {
  72. padding: 0 !important;
  73. background: none !important;
  74. }
  75. /deep/ .tui-input__self {
  76. padding: 0 !important;
  77. text-align: center !important;
  78. min-width: 40rpx !important;
  79. font-size: 52rpx !important;
  80. font-weight: 500 !important;
  81. line-height: 62rpx !important;
  82. font-feature-settings: "kern" on;
  83. color: #FF380C !important;
  84. }
  85. .container {
  86. margin-top: 24rpx;
  87. box-sizing: border-box;
  88. padding: 21rpx 30rpx 32rpx 30rpx;
  89. width: 690rpx;
  90. border-radius: 20rpx;
  91. background: #FFFFFF;
  92. font-family: 思源黑体;
  93. >p {
  94. font-size: 32rpx;
  95. font-weight: 600;
  96. color: #222229;
  97. }
  98. .AmountSelection {
  99. margin-top: 23rpx;
  100. width: 100%;
  101. display: flex;
  102. flex-wrap: wrap;
  103. gap: 15rpx;
  104. .selectionItem {
  105. position: relative;
  106. width: 200rpx;
  107. height: 200rpx;
  108. border-radius: 10rpx;
  109. background: #ff390c0d;
  110. display: flex;
  111. flex-direction: column;
  112. align-items: center;
  113. justify-content: center;
  114. .selectIcon {
  115. width: 36rpx;
  116. height: 36rpx;
  117. position: absolute;
  118. top: -10rpx;
  119. right: 0;
  120. }
  121. .numbers {
  122. display: block;
  123. text-align: center;
  124. min-width: 100%;
  125. height: 73rpx;
  126. font-size: 52rpx;
  127. font-weight: 500;
  128. line-height: 62rpx;
  129. font-feature-settings: "kern" on;
  130. color: #FF380C;
  131. }
  132. .title {
  133. /* margin-top: 18rpx; */
  134. font-size: 28rpx;
  135. font-weight: normal;
  136. line-height: 42rpx;
  137. font-feature-settings: "kern" on;
  138. color: #9E9E9E;
  139. }
  140. }
  141. }
  142. }
  143. </style>