categoryPopup.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <u-popup
  3. :show="show"
  4. mode="center"
  5. @close="close"
  6. @open="open"
  7. :round="10"
  8. :closeOnClickOverlay="false"
  9. width="580rpx"
  10. >
  11. <view class="location-edit-popup">
  12. <view class="popup-header">
  13. <text class="popup-title">修改库位</text>
  14. <u-icon name="close" size="20" @click="close"></u-icon>
  15. </view>
  16. <u--form
  17. :model="formData"
  18. ref="locationForm"
  19. :rules="rules"
  20. labelPosition="top"
  21. labelWidth="100%"
  22. :borderBottom="false"
  23. >
  24. <u-form-item
  25. label="原库位"
  26. prop="originLocation"
  27. :borderBottom="false"
  28. >
  29. <u--input
  30. v-model="formData.originLocation"
  31. border="surround"
  32. placeholder="请输入原库位"
  33. height="80rpx"
  34. clearable
  35. fontSize="28rpx"
  36. color="#333333"
  37. ></u--input>
  38. </u-form-item>
  39. <u-form-item
  40. label="新库位"
  41. prop="newLocation"
  42. :borderBottom="false"
  43. class="mt-20"
  44. >
  45. <u--input
  46. v-model="formData.newLocation"
  47. border="surround"
  48. placeholder="请输入新库位"
  49. height="80rpx"
  50. clearable
  51. fontSize="28rpx"
  52. color="#333333"
  53. ></u--input>
  54. </u-form-item>
  55. </u--form>
  56. <view class="btn-group">
  57. <u-button
  58. class="btn cancel-btn"
  59. :plain="true"
  60. shape="square"
  61. @click="onCancel"
  62. >取消</u-button>
  63. <u-button
  64. class="btn confirm-btn"
  65. type="primary"
  66. shape="square"
  67. @click="onConfirm"
  68. >确认</u-button>
  69. </view>
  70. </view>
  71. </u-popup>
  72. </template>
  73. <script>
  74. export default {
  75. name: "locationEditPopup",
  76. props: {
  77. show: {
  78. type: Boolean,
  79. default: false
  80. },
  81. originalLocation: {
  82. type: String,
  83. default: ''
  84. }
  85. },
  86. data() {
  87. return {
  88. formData: {
  89. originLocation: '',
  90. newLocation: ''
  91. },
  92. rules: {
  93. newLocation: {
  94. type: 'string',
  95. required: true,
  96. message: '请输入新库位',
  97. trigger: ['blur', 'change']
  98. }
  99. }
  100. };
  101. },
  102. watch: {
  103. show(newVal) {
  104. if (newVal) {
  105. this.formData.originLocation = this.originalLocation
  106. this.formData.newLocation = '';
  107. }
  108. },
  109. originalLocation(val) {
  110. this.formData.originLocation = val
  111. }
  112. },
  113. methods: {
  114. close() {
  115. this.$emit('update:show', false);
  116. },
  117. open() {},
  118. onCancel() {
  119. this.close();
  120. this.$emit('cancel');
  121. },
  122. onConfirm() {
  123. this.$refs.locationForm.validate(valid => {
  124. if (valid) {
  125. this.close();
  126. this.$emit('confirm', this.formData.newLocation);
  127. }
  128. });
  129. }
  130. }
  131. };
  132. </script>
  133. <style lang="scss" scoped>
  134. .location-edit-popup {
  135. padding: 30rpx;
  136. width: 580rpx;
  137. .popup-header {
  138. display: flex;
  139. justify-content: space-between;
  140. align-items: center;
  141. margin-bottom: 30rpx;
  142. .popup-title {
  143. font-size: 36rpx;
  144. font-weight: 500;
  145. color: #333333;
  146. }
  147. }
  148. .mt-20 {
  149. margin-top: 20rpx;
  150. }
  151. .btn-group {
  152. display: flex;
  153. justify-content: space-between;
  154. margin-top: 40rpx;
  155. .btn {
  156. flex: 1;
  157. height: 88rpx;
  158. display: flex;
  159. align-items: center;
  160. justify-content: center;
  161. font-size: 32rpx;
  162. &.cancel-btn {
  163. margin-right: 20rpx;
  164. color: #666666;
  165. border-color: #dddddd;
  166. }
  167. &.confirm-btn {
  168. background-color: #2979ff;
  169. }
  170. }
  171. }
  172. }
  173. </style>