report.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <view>
  3. <view class="box">
  4. <view class="top">
  5. <text class="title">证明上传</text>
  6. </view>
  7. <view class="item">
  8. <view class="l">核酸证明:</view>
  9. <view class="r">
  10. <view class="img">
  11. <uni-file-picker v-model="nucleicReport" fileMediatype="image" mode="grid" limit="1"
  12. @select="nucleicSelect" @delete="form.nucleicReport=''" :image-styles="imageStyles" />
  13. </view>
  14. </view>
  15. </view>
  16. <view class="item">
  17. <view class="l">消杀合格证明:</view>
  18. <view class="r">
  19. <view class="img">
  20. <uni-file-picker v-model="disinfectReport" fileMediatype="image" mode="grid" limit="1"
  21. @select="disinfectSelect" @delete="form.disinfectReport=''" :image-styles="imageStyles" />
  22. </view>
  23. </view>
  24. </view>
  25. <view class="item">
  26. <view class="l">检验检疫证:</view>
  27. <view class="r">
  28. <view class="img">
  29. <uni-file-picker ref="checkReport" v-model="checkReport" fileMediatype="image" mode="grid"
  30. limit="1" @select="checkSelect" @delete="form.checkReport=''" :image-styles="imageStyles" />
  31. </view>
  32. </view>
  33. </view>
  34. <view class="item">
  35. <view class="l">签发出库证明:</view>
  36. <view class="r">
  37. <view class="img">
  38. <uni-file-picker v-model="outReport" fileMediatype="image" mode="grid" limit="1"
  39. @select="outSelect" @delete="form.outReport=''" :image-styles="imageStyles" />
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <u-button type="primary" @click="confirmFn">保存</u-button>
  45. </view>
  46. </template>
  47. <script>
  48. import request from '../../utils/request.js'
  49. export default {
  50. data() {
  51. return {
  52. id: '',
  53. form: {
  54. partMoney: 0
  55. },
  56. imgList: [],
  57. outReport: [],
  58. checkReport:[],
  59. disinfectReport:[],
  60. nucleicReport:[],
  61. imageStyles: {
  62. width: 150,
  63. height: 100,
  64. border: {
  65. color: "#eee",
  66. width: 1,
  67. style: 'dashed',
  68. radius: '5px'
  69. }
  70. },
  71. uploadImageUrl: request.server + '/upload/image',
  72. }
  73. },
  74. onLoad(options) {
  75. this.id = options.id;
  76. },
  77. onShow() {
  78. this.getBusinessById();
  79. },
  80. methods: {
  81. outSelect(e) {
  82. this.handlerUpload(e, 'outReport')
  83. },
  84. checkSelect(e) {
  85. this.handlerUpload(e, 'checkReport')
  86. },
  87. disinfectSelect(e) {
  88. this.handlerUpload(e, 'disinfectReport')
  89. },
  90. nucleicSelect(e) {
  91. this.handlerUpload(e, 'nucleicReport')
  92. },
  93. handlerUpload(e, target) {
  94. let that = this;
  95. uni.uploadFile({
  96. url: that.uploadImageUrl,
  97. filePath: e.tempFilePaths[0],
  98. name: 'file',
  99. success: (resp => {
  100. that.form[target] = JSON.parse(resp.data).data;
  101. })
  102. })
  103. },
  104. getBusinessById() {
  105. this.$api.getBusinessById({
  106. id: this.id
  107. }).then(resp => {
  108. this.form = resp.data;
  109. if(this.form.nucleicReport){
  110. this.nucleicReport=[{
  111. 'name':'payTicket.png',
  112. 'extname':'.png',
  113. 'url':this.form.nucleicReport
  114. }]
  115. }
  116. if(this.form.disinfectReport){
  117. this.disinfectReport=[{
  118. 'name':'payTicket.png',
  119. 'extname':'.png',
  120. 'url':this.form.disinfectReport
  121. }]
  122. }
  123. if(this.form.checkReport){
  124. this.checkReport=[{
  125. 'name':'payTicket.png',
  126. 'extname':'.png',
  127. 'url':this.form.checkReport
  128. }]
  129. }
  130. if(this.form.outReport){
  131. this.outReport=[{
  132. 'name':'payTicket.png',
  133. 'extname':'.png',
  134. 'url':this.form.outReport
  135. }]
  136. }
  137. })
  138. },
  139. confirmFn() {
  140. console.log(this.form)
  141. if (!this.form.nucleicReport) {
  142. this.$common.toast('请上传核酸报告');
  143. return;
  144. }
  145. if (!this.form.disinfectReport) {
  146. this.$common.toast('请上传消杀合格证明');
  147. return;
  148. }
  149. if (!this.form.checkReport) {
  150. this.$common.toast('请上传入关检验检疫证');
  151. return;
  152. }
  153. if (!this.form.outReport) {
  154. this.$common.toast('请上传签发出库证明');
  155. return;
  156. }
  157. this.$api.uploadReport(this.form).then(Resp => {
  158. this.$common.toast('上传成功');
  159. setTimeout(() => {
  160. this.$common.back()
  161. }, 500)
  162. })
  163. }
  164. }
  165. }
  166. </script>
  167. <style lang="scss">
  168. page {
  169. background-color: #fff;
  170. }
  171. .item-line {
  172. color: #a2a2a2;
  173. padding: 5px 0 10px 29px;
  174. border-bottom: 1px solid #E5E5E5;
  175. }
  176. @import '@/common/common.scss'
  177. </style>