actionNumPopup.vue 3.7 KB

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