discardDialog.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <u-popup :show="visible" :round="0" :closeOnClickOverlay="false" :zIndex="99999" @close="handleCancel"
  3. class="u-popup-my">
  4. <view class="popup-content">
  5. <view class="popup-header">
  6. <text class="popup-title">废弃</text>
  7. <view class="close-btn" @click="handleCancel">×</view>
  8. </view>
  9. <scroll-view class="popup-body" scroll-y>
  10. <view class="page">
  11. <view class="card-a">
  12. <!-- 头部 -->
  13. <view class="a-header">
  14. <text class="a-main-title">废弃随手拍</text>
  15. </view>
  16. <!-- 废弃信息 -->
  17. <view class="card-section">
  18. <view class="section-title">📋 废弃信息</view>
  19. <view class="info-list">
  20. <view class="info-item">
  21. <text class="info-label">废弃原因</text>
  22. <textarea
  23. v-if="!isView"
  24. class="info-textarea"
  25. v-model="formData.handleOpinion"
  26. placeholder="请输入废弃原因(100字以内)"
  27. maxlength="100"
  28. />
  29. <text v-else class="info-value readonly">{{ formData.handleOpinion || '无' }}</text>
  30. </view>
  31. <view class="info-item">
  32. <text class="info-label">废弃人</text>
  33. <text class="info-value readonly">{{ formData.handlerName }}</text>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </scroll-view>
  40. <view class="popup-footer">
  41. <template v-if="isView">
  42. <u-button type="default" @click="handleCancel">关闭</u-button>
  43. </template>
  44. <template v-else>
  45. <u-button type="default" @click="handleCancel">取消</u-button>
  46. <u-button type="primary" @click="handleSubmit" :loading="loading">确定</u-button>
  47. </template>
  48. </view>
  49. </view>
  50. <u-toast ref="uToast"></u-toast>
  51. </u-popup>
  52. </template>
  53. <script>
  54. export default {
  55. emits: ['confirm'],
  56. data() {
  57. return {
  58. visible: false,
  59. loading: false,
  60. dialogType: 'add',
  61. formData: { id: '', handleOpinion: '', handlerName: '' },
  62. rules: { handleOpinion: { required: true, message: '请输入废弃原因', trigger: 'blur' } }
  63. };
  64. },
  65. computed: {
  66. isView() {
  67. return this.dialogType === 'view';
  68. }
  69. },
  70. methods: {
  71. open(row, type = 'add') {
  72. this.dialogType = type;
  73. const userInfo = uni.getStorageSync('userInfo') || {};
  74. this.formData = {
  75. id: row.id || '',
  76. handleOpinion: row.handleOpinion || '',
  77. handlerName: row.handlerName || userInfo.name || ''
  78. };
  79. this.visible = true;
  80. },
  81. handleCancel() {
  82. this.visible = false;
  83. this.formData = { id: '', handleOpinion: '', handlerName: '' };
  84. },
  85. async handleSubmit() {
  86. if (!this.formData.handleOpinion) {
  87. this.$refs.uToast.show({ type: 'error', message: '请输入废弃原因' });
  88. return;
  89. }
  90. this.$emit('confirm', { id: this.formData.id, handleOpinion: this.formData.handleOpinion });
  91. this.visible = false;
  92. this.formData = { id: '', handleOpinion: '', handlerName: '' };
  93. }
  94. }
  95. };
  96. </script>
  97. <style lang="scss" scoped>
  98. .popup-content {
  99. width: 100vw;
  100. height: calc(100vh - 100px);
  101. background: #fff;
  102. border-radius: 0;
  103. display: flex;
  104. flex-direction: column;
  105. background-color: #eff2f7;
  106. }
  107. .popup-header {
  108. display: flex;
  109. justify-content: space-between;
  110. align-items: center;
  111. padding: 30rpx;
  112. border-bottom: 1rpx solid #e5e5e5;
  113. background: #fff;
  114. .popup-title {
  115. font-size: 36rpx;
  116. font-weight: bold;
  117. color: #333;
  118. }
  119. .close-btn {
  120. width: 60rpx;
  121. height: 60rpx;
  122. display: flex;
  123. align-items: center;
  124. justify-content: center;
  125. font-size: 60rpx;
  126. color: #999;
  127. line-height: 1;
  128. }
  129. }
  130. .popup-body {
  131. flex: 1;
  132. overflow-y: auto;
  133. padding: 28rpx;
  134. }
  135. .page {
  136. font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, sans-serif;
  137. }
  138. .card-a {
  139. background: #ffffff;
  140. border-radius: 48rpx;
  141. box-shadow: 0 12rpx 40rpx rgba(0, 0, 0, 0.05);
  142. overflow: hidden;
  143. }
  144. .a-header {
  145. background: linear-gradient(135deg, #fef0f0 0%, #fff3e0 100%);
  146. padding: 40rpx 32rpx 24rpx;
  147. text-align: center;
  148. .a-main-title {
  149. font-size: 36rpx;
  150. font-weight: 800;
  151. color: #e53935;
  152. }
  153. }
  154. .card-section {
  155. padding: 30rpx 32rpx;
  156. border-bottom: 2rpx solid #f0f2f5;
  157. &:last-child {
  158. border-bottom: none;
  159. }
  160. }
  161. .section-title {
  162. font-size: 30rpx;
  163. font-weight: 700;
  164. color: #1f2a44;
  165. margin-bottom: 24rpx;
  166. padding-left: 16rpx;
  167. border-left: 6rpx solid #f56c6c;
  168. }
  169. .info-list {
  170. display: flex;
  171. flex-direction: column;
  172. gap: 28rpx;
  173. }
  174. .info-item {
  175. display: flex;
  176. flex-direction: column;
  177. gap: 8rpx;
  178. }
  179. .info-label {
  180. font-size: 26rpx;
  181. font-weight: 600;
  182. color: #6c7a91;
  183. }
  184. .info-value {
  185. font-size: 28rpx;
  186. font-weight: 500;
  187. color: #1e2a3a;
  188. padding: 16rpx 20rpx;
  189. border-radius: 24rpx;
  190. border: 2rpx solid #e9edf2;
  191. background: #fff;
  192. &.readonly {
  193. color: #999;
  194. background: #f5f5f5;
  195. }
  196. }
  197. .info-textarea {
  198. font-size: 28rpx;
  199. color: #1e2a3a;
  200. min-height: 160rpx;
  201. padding: 16rpx 20rpx;
  202. border-radius: 24rpx;
  203. border: 2rpx solid #e9edf2;
  204. background: #fff;
  205. }
  206. .popup-footer {
  207. display: flex;
  208. padding: 20rpx 30rpx;
  209. border-top: 1rpx solid #e5e5e5;
  210. background: #fff;
  211. gap: 20rpx;
  212. /deep/ .u-button {
  213. flex: 1;
  214. }
  215. }
  216. </style>