report.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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. this.getBusinessById();
  77. },
  78. methods: {
  79. toast() {
  80. let obj = {
  81. outReport: this.form.outReport,
  82. checkReport: this.form.checkReport,
  83. disinfectReport: this.form.disinfectReport,
  84. nucleicReport: this.form.nucleicReport,
  85. }
  86. this.$common.toast(JSON.stringify(obj))
  87. },
  88. outSelect(e) {
  89. let that = this;
  90. uni.uploadFile({
  91. url: that.uploadImageUrl,
  92. filePath: e.tempFilePaths[0],
  93. name: 'file',
  94. success: (resp => {
  95. that.form.outReport = JSON.parse(resp.data).data;
  96. })
  97. })
  98. },
  99. checkSelect(e) {
  100. let that = this;
  101. uni.uploadFile({
  102. url: that.uploadImageUrl,
  103. filePath: e.tempFilePaths[0],
  104. name: 'file',
  105. success: (resp => {
  106. that.form.checkReport = JSON.parse(resp.data).data;
  107. })
  108. })
  109. },
  110. disinfectSelect(e) {
  111. let that = this;
  112. uni.uploadFile({
  113. url: that.uploadImageUrl,
  114. filePath: e.tempFilePaths[0],
  115. name: 'file',
  116. success: (resp => {
  117. that.form.disinfectReport = JSON.parse(resp.data).data;
  118. })
  119. })
  120. },
  121. nucleicSelect(e) {
  122. let that = this;
  123. uni.uploadFile({
  124. url: that.uploadImageUrl,
  125. filePath: e.tempFilePaths[0],
  126. name: 'file',
  127. success: (resp => {
  128. that.form.nucleicReport = JSON.parse(resp.data).data;
  129. })
  130. })
  131. },
  132. getBusinessById() {
  133. this.$api.getBusinessById({
  134. id: this.id
  135. }).then(resp => {
  136. this.form = resp.data;
  137. if (this.form.nucleicReport) {
  138. this.nucleicReport = [{
  139. 'name': 'payTicket.png',
  140. 'extname': '.png',
  141. 'url': this.form.nucleicReport
  142. }]
  143. }
  144. if (this.form.disinfectReport) {
  145. this.disinfectReport = [{
  146. 'name': 'payTicket.png',
  147. 'extname': '.png',
  148. 'url': this.form.disinfectReport
  149. }]
  150. }
  151. if (this.form.checkReport) {
  152. this.checkReport = [{
  153. 'name': 'payTicket.png',
  154. 'extname': '.png',
  155. 'url': this.form.checkReport
  156. }]
  157. }
  158. if (this.form.outReport) {
  159. this.outReport = [{
  160. 'name': 'payTicket.png',
  161. 'extname': '.png',
  162. 'url': this.form.outReport
  163. }]
  164. }
  165. })
  166. },
  167. confirmFn() {
  168. console.log(this.form)
  169. if (!this.form.nucleicReport) {
  170. this.$common.toast('请上传核酸报告');
  171. return;
  172. }
  173. if (!this.form.disinfectReport) {
  174. this.$common.toast('请上传消杀合格证明');
  175. return;
  176. }
  177. if (!this.form.checkReport) {
  178. this.$common.toast('请上传入关检验检疫证');
  179. return;
  180. }
  181. if (!this.form.outReport) {
  182. this.$common.toast('请上传签发出库证明');
  183. return;
  184. }
  185. this.$api.uploadReport(this.form).then(Resp => {
  186. this.$common.toast('上传成功');
  187. setTimeout(() => {
  188. this.$common.back()
  189. }, 500)
  190. })
  191. }
  192. }
  193. }
  194. </script>
  195. <style lang="scss">
  196. page {
  197. background-color: #fff;
  198. }
  199. .item-line {
  200. color: #a2a2a2;
  201. padding: 5px 0 10px 29px;
  202. border-bottom: 1px solid #E5E5E5;
  203. }
  204. @import '@/common/common.scss'
  205. </style>