categoryPopup.vue 3.7 KB

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