actionNumPopup.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <u-popup
  3. :show="show"
  4. mode="center"
  5. @close="close"
  6. @open="open"
  7. :round="10"
  8. :closeOnClickOverlay="false"
  9. >
  10. <view class="action-num-popup">
  11. <view class="icon-wrapper">
  12. <u-image src="@/static/image/error-img.png" width="112rpx" height="112rpx"></u-image>
  13. </view>
  14. <view class="title">请确认该商品盘点数量</view>
  15. <view class="num-box">
  16. <u-number-box v-model="count">
  17. <view slot="minus" class="minus">
  18. <u-icon name="minus" color="#0256FF" size="12"></u-icon>
  19. </view>
  20. <text slot="input" class="input">{{count}}</text>
  21. <view slot="plus" class="plus">
  22. <u-icon name="plus" color="#ffffff" size="12"></u-icon>
  23. </view>
  24. </u-number-box>
  25. </view>
  26. <view class="btn-group">
  27. <u-button
  28. class="btn cancel-btn"
  29. :plain="true"
  30. shape="square"
  31. @click="onCancel"
  32. >取消</u-button>
  33. <u-button
  34. class="btn confirm-btn"
  35. type="primary"
  36. shape="square"
  37. @click="onConfirm"
  38. >确认</u-button>
  39. </view>
  40. </view>
  41. </u-popup>
  42. </template>
  43. <script>
  44. export default {
  45. name: "actionNumPopup",
  46. props: {
  47. show: {
  48. type: Boolean,
  49. default: false,
  50. },
  51. defaultCount: {
  52. type: [Number, String],
  53. default: 1
  54. },
  55. minCount: {
  56. type: Number,
  57. default: 0
  58. },
  59. maxCount: {
  60. type: Number,
  61. default: 9999
  62. }
  63. },
  64. data() {
  65. return {
  66. count: 2,
  67. };
  68. },
  69. watch: {
  70. show(newVal) {
  71. if (newVal) {
  72. this.count = this.defaultCount || 2;
  73. }
  74. },
  75. defaultCount: {
  76. immediate: true,
  77. handler(val) {
  78. this.count = val || 2;
  79. }
  80. }
  81. },
  82. methods: {
  83. close() {
  84. this.$emit('update:show', false);
  85. },
  86. open() {},
  87. onNumberChange(value) {
  88. this.count = value;
  89. },
  90. onCancel() {
  91. this.close();
  92. this.$emit('cancel');
  93. },
  94. onConfirm() {
  95. this.close();
  96. this.$emit('confirm', this.count);
  97. }
  98. },
  99. };
  100. </script>
  101. <style lang="scss" scoped>
  102. .action-num-popup {
  103. padding: 40rpx 30rpx;
  104. width: 580rpx;
  105. .icon-wrapper {
  106. display: flex;
  107. justify-content: center;
  108. margin-bottom: 20rpx;
  109. }
  110. .title {
  111. font-size: 32rpx;
  112. color: #333;
  113. text-align: center;
  114. font-weight: 500;
  115. margin-bottom: 40rpx;
  116. }
  117. .num-box {
  118. display: flex;
  119. align-items: center;
  120. justify-content: center;
  121. margin: 30rpx 0;
  122. .input {
  123. width: 112rpx;
  124. text-align: center;
  125. border-bottom: 1px solid #0256FF;
  126. margin: 0 8rpx;
  127. }
  128. .minus {
  129. width: 40rpx;
  130. height: 40rpx;
  131. border-radius: 8rpx;
  132. border: 1px solid #0256FF;
  133. display: flex;
  134. align-items: center;
  135. justify-content: center;
  136. }
  137. .plus {
  138. width: 40rpx;
  139. height: 40rpx;
  140. border-radius: 8rpx;
  141. background-color: #0256FF;
  142. display: flex;
  143. align-items: center;
  144. justify-content: center;
  145. }
  146. }
  147. .btn-group {
  148. display: flex;
  149. justify-content: space-between;
  150. .btn {
  151. flex: 1;
  152. display: flex;
  153. align-items: center;
  154. justify-content: center;
  155. font-size: 32rpx;
  156. &.cancel-btn {
  157. margin-right: 20rpx;
  158. color: #666;
  159. border-color: #ddd;
  160. }
  161. &.confirm-btn {
  162. background-color: #2979ff;
  163. }
  164. }
  165. }
  166. }
  167. </style>