普兆健康管家前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

192 lines
4.0 KiB

  1. <template>
  2. <view>
  3. <uv-popup ref="popup" mode="bottom" bgColor="none" >
  4. <view class="popup__view">
  5. <view class="flex header">
  6. <view class="title">线上试剂盒回寄</view>
  7. <button class="btn" @click="close">关闭</button>
  8. </view>
  9. <view class="form">
  10. <uv-form
  11. ref="form"
  12. :model="form"
  13. :rules="rules"
  14. errorType="toast"
  15. >
  16. <view class="form-item">
  17. <uv-form-item prop="logisticsNo" :customStyle="formItemStyle">
  18. <view class="form-item-label">回寄订单号</view>
  19. <view class="form-item-content">
  20. <formInput v-model="form.logisticsNo"></formInput>
  21. </view>
  22. </uv-form-item>
  23. </view>
  24. </uv-form>
  25. </view>
  26. <view class="flex footer">
  27. <button class="flex btn" @click="close">取消</button>
  28. <button class="flex btn btn-primary" @click="onConfirm">确认</button>
  29. </view>
  30. </view>
  31. </uv-popup>
  32. </view>
  33. </template>
  34. <script>
  35. import formInput from '@/pages_order/components/formInput.vue'
  36. export default {
  37. components: {
  38. formInput,
  39. },
  40. data() {
  41. return {
  42. id: null,
  43. form: {
  44. logisticsNo: null,
  45. },
  46. rules: {
  47. 'logisticsNo': {
  48. type: 'string',
  49. required: true,
  50. message: '请输入回寄订单号',
  51. },
  52. },
  53. formItemStyle: { padding: 0 },
  54. }
  55. },
  56. methods: {
  57. open(id) {
  58. this.id = id
  59. this.$refs.popup.open()
  60. },
  61. close() {
  62. this.$refs.popup.close()
  63. },
  64. async onConfirm() {
  65. try {
  66. await this.$refs.form.validate()
  67. await this.$fetch('logisticsSubscribe', { id: this.id, logisticsNo: this.form.logisticsNo })
  68. this.$emit('submitted')
  69. uni.showToast({
  70. icon: 'success',
  71. title: '提交成功',
  72. });
  73. this.close()
  74. } catch (err) {
  75. console.log('onConfirm err', err)
  76. }
  77. },
  78. },
  79. }
  80. </script>
  81. <style lang="scss" scoped>
  82. .popup__view {
  83. width: 100vw;
  84. display: flex;
  85. flex-direction: column;
  86. box-sizing: border-box;
  87. background: #FFFFFF;
  88. border-top-left-radius: 32rpx;
  89. border-top-right-radius: 32rpx;
  90. }
  91. .header {
  92. position: relative;
  93. width: 100%;
  94. padding: 24rpx 0;
  95. box-sizing: border-box;
  96. border-bottom: 2rpx solid #EEEEEE;
  97. .title {
  98. font-family: PingFang SC;
  99. font-weight: 500;
  100. font-size: 34rpx;
  101. line-height: 1.4;
  102. color: #181818;
  103. }
  104. .btn {
  105. font-family: PingFang SC;
  106. font-weight: 500;
  107. font-size: 32rpx;
  108. line-height: 1.4;
  109. color: #8B8B8B;
  110. position: absolute;
  111. top: 26rpx;
  112. left: 40rpx;
  113. }
  114. }
  115. .form {
  116. padding: 32rpx 40rpx;
  117. &-item {
  118. padding: 8rpx 0 6rpx 0;
  119. & + & {
  120. padding-top: 24rpx;
  121. border-top: 2rpx solid #EEEEEE;
  122. }
  123. &-label {
  124. margin-bottom: 14rpx;
  125. font-family: PingFang SC;
  126. font-weight: 400;
  127. font-size: 26rpx;
  128. line-height: 1.4;
  129. color: #181818;
  130. }
  131. &-content {
  132. .placeholder {
  133. color: #C6C6C6;
  134. font-size: 32rpx;
  135. font-weight: 400;
  136. }
  137. .region {
  138. min-height: 44rpx;
  139. justify-content: flex-start;
  140. }
  141. }
  142. }
  143. }
  144. .footer {
  145. width: 100%;
  146. padding: 32rpx 40rpx;
  147. box-sizing: border-box;
  148. border-top: 2rpx solid #F1F1F1;
  149. column-gap: 32rpx;
  150. .btn {
  151. width: 100%;
  152. padding: 16rpx 0;
  153. font-family: PingFang SC;
  154. font-weight: 500;
  155. font-size: 36rpx;
  156. line-height: 1.4;
  157. color: #252545;
  158. border-radius: 41rpx;
  159. border: 2rpx solid #252545;
  160. &-primary {
  161. padding: 18rpx 2rpx;
  162. color: #FFFFFF;
  163. background-image: linear-gradient(to right, #4B348F, #845CFA);
  164. border: none;
  165. }
  166. }
  167. }
  168. </style>