review.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <div class="app-container">
  3. <div class="audit-content">
  4. <div class="grid">
  5. <div class="row">
  6. <div class="col">设备名称:</div>
  7. <div class="col">{{ productInfo.productName }}</div>
  8. </div>
  9. <div class="row">
  10. <div class="col">设备SN码:</div>
  11. <div class="col">{{ productInfo.snCode }}</div>
  12. </div>
  13. </div>
  14. <div class="row">
  15. <div class="col">设备图片:</div>
  16. <div class="col">
  17. <el-image
  18. style="width: 120px; height: 120px"
  19. :src="productInfo.productImage"
  20. :preview-src-list="[productInfo.productImage]"
  21. />
  22. </div>
  23. </div>
  24. <div class="row">
  25. <div class="col">所属品牌:</div>
  26. <div class="col">{{ productInfo.brandName }}</div>
  27. </div>
  28. <div class="row">
  29. <div class="col">购买渠道:</div>
  30. <div class="col">{{ productInfo.purchaseWay }}</div>
  31. </div>
  32. <div class="row">
  33. <div class="col">发票:</div>
  34. <div class="col">
  35. <el-image
  36. style="width: 120px; height: 120px"
  37. :src="productInfo.invoiceImage"
  38. :preview-src-list="[productInfo.invoiceImage]"
  39. />
  40. </div>
  41. </div>
  42. <div class="row">
  43. <div class="col">设备参数:</div>
  44. <div class="col">
  45. <template v-for="(param, index) in productInfo.paramList">
  46. <div :key="index" class="param">
  47. <div class="label">{{ param.paramName }}:</div>
  48. <div class="content">{{ param.paramContent }}</div>
  49. </div>
  50. </template>
  51. </div>
  52. </div>
  53. <el-form ref="auditForm" label-width="112px" :model="auditForm" :rules="rules">
  54. <el-form-item label="审核:">
  55. <el-radio-group v-model="auditForm.auditStatus">
  56. <el-radio :label="1">通过</el-radio>
  57. <el-radio :label="0">不通过</el-radio>
  58. </el-radio-group>
  59. </el-form-item>
  60. <el-form-item v-if="auditForm.auditStatus === 0" label="原因:" prop="invalidReason">
  61. <el-input v-model="auditForm.invalidReason" type="textarea" :rows="3" />
  62. </el-form-item>
  63. <el-form-item>
  64. <el-button type="info" @click="$_back">返回</el-button>
  65. <el-button type="primary" @click="submit">提交</el-button>
  66. </el-form-item>
  67. </el-form>
  68. </div>
  69. </div>
  70. </template>
  71. <script>
  72. import { getProductById, auditProduct } from '@/api/product'
  73. import { mapGetters } from 'vuex'
  74. export default {
  75. data() {
  76. return {
  77. productInfo: {
  78. productId: '',
  79. productName: '',
  80. snCode: '',
  81. productImage: '',
  82. certificateImage: '',
  83. paramList: [],
  84. invoiceImage: '',
  85. brandName: '',
  86. purchaseWay: ''
  87. },
  88. auditForm: {
  89. productId: '',
  90. auditBy: '', // 审核人id
  91. authId: '', // 机构id
  92. auditStatus: 1, // 审核状态
  93. invalidReason: '', // 审核信息
  94. source: 2
  95. },
  96. rules: {
  97. invalidReason: { required: true, message: '不通过原因不能为空', tigger: 'blur' }
  98. }
  99. }
  100. },
  101. computed: {
  102. ...mapGetters(['authUserId'])
  103. },
  104. created() {
  105. this.productInfo.productId = this.$route.query.id
  106. this.authId = this.$route.query.authId
  107. this.getDetail()
  108. },
  109. methods: {
  110. // 获取商品详情
  111. getDetail() {
  112. this.isLoading = true
  113. getProductById({ productId: this.productInfo.productId })
  114. .then((res) => {
  115. this.productInfo = { ...this.productInfo, ...res.data }
  116. })
  117. .finally(() => {
  118. this.isLoading = false
  119. })
  120. },
  121. // 提交审核信息
  122. submit() {
  123. this.$refs.auditForm.validate((valid) => {
  124. if (valid) {
  125. this.isLoading = true
  126. // 指定审核人
  127. this.auditForm.auditBy = this.authUserId
  128. this.auditForm.productId = this.productInfo.productId
  129. auditProduct(this.auditForm)
  130. .then((res) => {
  131. this.$message.success(res.data)
  132. this.$store.dispatch('tagsView/delView', this.$route)
  133. this.$router.back()
  134. })
  135. .finally(() => {
  136. this.isLoading = false
  137. })
  138. }
  139. })
  140. }
  141. }
  142. }
  143. </script>
  144. <style lang="scss" scoped>
  145. .app-container {
  146. .audit-content {
  147. max-width: 1000px;
  148. margin: 0 auto;
  149. margin-top: 25px;
  150. }
  151. .grid,
  152. .param {
  153. display: grid;
  154. grid-template-columns: repeat(2, 1fr);
  155. // grid-template-rows: repeat(2, 1fr);
  156. grid-column-gap: 0px;
  157. grid-row-gap: 0px;
  158. }
  159. .param {
  160. div {
  161. padding-bottom: 16px;
  162. text-align: left;
  163. &:first-child {
  164. text-align: right;
  165. }
  166. }
  167. }
  168. .row {
  169. display: flex;
  170. justify-content: flex-start;
  171. align-items: flex-start;
  172. margin-bottom: 25px;
  173. .col {
  174. font-size: 14px;
  175. color: #333;
  176. &:first-child {
  177. min-width: 100px;
  178. text-align: right;
  179. margin-right: 8px;
  180. font-weight: bold;
  181. color: #666;
  182. }
  183. .el-image {
  184. margin-left: 12px;
  185. &:first-child {
  186. margin-left: 0;
  187. }
  188. }
  189. }
  190. }
  191. .el-button {
  192. width: 120px;
  193. }
  194. }
  195. </style>