batchDiscountPopup.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <u-popup :show="show" mode="bottom" :round="10" closeable @close="close">
  3. <view class="content">
  4. <view class="goods-information"> 我要打折 </view>
  5. <view class="discount">
  6. <view class=""> 折扣 </view>
  7. <u--input
  8. inputAlign="right"
  9. placeholder="打8折请输入80,以原价计算"
  10. border="none"
  11. type="number"
  12. v-model="value"
  13. @change="change"
  14. maxlength="2"
  15. ></u--input>
  16. <view style="margin-left: 10rpx"> % </view>
  17. </view>
  18. <!-- <view
  19. class="text-list"
  20. v-if="JSON.stringify(selectGoodsInformation) != '{}' && value"
  21. >
  22. <view class="_text-1">
  23. <text>折扣价</text>
  24. <text>¥{{ discountPrice }}</text>
  25. </view>
  26. <view class="_text-1">
  27. <text>优惠</text>
  28. <text style="color: #f83224">-¥{{ preferential }}</text>
  29. </view>
  30. </view> -->
  31. <button class="btn" @click="confirm">确定</button>
  32. </view>
  33. </u-popup>
  34. </template>
  35. <script>
  36. export default {
  37. props: {
  38. show: {
  39. typeof: Boolean,
  40. default: false,
  41. },
  42. selectGoodsInformation: {
  43. typeof: Object,
  44. default: () => {
  45. return {};
  46. },
  47. },
  48. },
  49. data() {
  50. return {
  51. value: "",
  52. discountPrice: 0,
  53. preferential: 0,
  54. };
  55. },
  56. methods: {
  57. close() {
  58. this.value = "";
  59. this.discountPrice = 0;
  60. this.preferential = 0;
  61. this.$emit("close");
  62. },
  63. confirm() {
  64. this.$emit("close", this.value);
  65. this.value = "";
  66. this.discountPrice = 0;
  67. this.preferential = 0;
  68. },
  69. change(e) {
  70. this.discountPrice =
  71. Number(this.selectGoodsInformation.goods.price) * (Number(e) * 0.01);
  72. this.preferential =
  73. Number(this.selectGoodsInformation.goods.price) - this.discountPrice;
  74. },
  75. },
  76. };
  77. </script>
  78. <style scoped lang="scss">
  79. .content {
  80. padding: 30rpx 24rpx;
  81. .goods-information {
  82. display: flex;
  83. justify-content: center;
  84. font-weight: 600;
  85. .goods-img {
  86. width: 104rpx;
  87. height: 104rpx;
  88. border-radius: 10rpx;
  89. margin-right: 20rpx;
  90. }
  91. .goods-right {
  92. display: flex;
  93. flex-direction: column;
  94. justify-content: space-around;
  95. .title {
  96. font-size: 28rpx;
  97. color: #333;
  98. }
  99. .price {
  100. font-size: 28rpx;
  101. opacity: 0.8;
  102. color: #333;
  103. }
  104. }
  105. }
  106. .discount {
  107. display: flex;
  108. padding: 36rpx;
  109. border-radius: 10rpx;
  110. border: 2rpx solid #f83224;
  111. margin-top: 56rpx;
  112. font-size: 30rpx;
  113. color: #222;
  114. align-items: center;
  115. font-weight: 600;
  116. }
  117. .text-list {
  118. border-top: 2rpx solid rgba(151, 151, 151, 0.1);
  119. margin-top: 40rpx;
  120. ._text-1 {
  121. display: flex;
  122. justify-content: space-between;
  123. height: 100rpx;
  124. align-items: center;
  125. font-size: 28rpx;
  126. }
  127. }
  128. .btn {
  129. background-color: #f83224;
  130. border-radius: 44rpx;
  131. color: #fff;
  132. margin-top: 100rpx;
  133. }
  134. }
  135. </style>