detail.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. <template>
  2. <div class="page">
  3. <div class="page-top"></div>
  4. <div class="page-content">
  5. <div class="page-title">设备认证</div>
  6. <div class="row">
  7. <div class="col">认证方式:</div>
  8. <div class="col">新设备认证</div>
  9. </div>
  10. <div class="row">
  11. <div class="col">设备名称:</div>
  12. <div class="col">{{ productInfo.productName }}</div>
  13. </div>
  14. <div class="row">
  15. <div class="col">设备图片:</div>
  16. <div class="col">
  17. <el-image
  18. v-if="productInfo.productImage"
  19. :src="productInfo.productImage"
  20. :preview-src-list="[productInfo.productImage]"
  21. ></el-image>
  22. <span v-else>暂无图片</span>
  23. </div>
  24. </div>
  25. <div class="row">
  26. <div class="col">所属品牌:</div>
  27. <div class="col">{{ productInfo.brandName }}</div>
  28. </div>
  29. <div class="row">
  30. <div class="col">购买渠道:</div>
  31. <div class="col">{{ productInfo.purchaseWay || '暂无' }}</div>
  32. </div>
  33. <div class="row">
  34. <div class="col">发票:</div>
  35. <div class="col">
  36. <el-image
  37. v-if="productInfo.invoiceImage"
  38. :src="productInfo.invoiceImage"
  39. :preview-src-list="[productInfo.invoiceImage]"
  40. ></el-image>
  41. <span v-else>暂无图片</span>
  42. </div>
  43. </div>
  44. <div class="row">
  45. <div class="col">设备SN码:</div>
  46. <div class="col">{{ productInfo.snCode }}</div>
  47. </div>
  48. <div class="row">
  49. <div class="col">设备参数:</div>
  50. <div class="col">
  51. <div class="params-list">
  52. <div
  53. class="param"
  54. v-for="param in productInfo.paramList"
  55. :key="param.productName"
  56. >
  57. <div class="param-name">{{ param.paramName }}:</div>
  58. <div class="param-content">{{ param.paramContent }}</div>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. <div class="row">
  64. <div class="col">状态:</div>
  65. <div class="col" :class="auditStatusColor(productInfo.auditStatus)">
  66. {{ productInfo.auditStatus | auditStatusFilter }}
  67. </div>
  68. </div>
  69. <div class="row" v-if="productInfo.auditStatus === 0">
  70. <div class="col">原因:</div>
  71. <div class="col">
  72. {{ productInfo.invalidReason ? productInfo.invalidReason : '暂无' }}
  73. </div>
  74. </div>
  75. <div
  76. class="control flex flex-col items-center"
  77. v-if="productInfo.auditStatus === 0"
  78. >
  79. <div
  80. class="button edit flex justify-center items-center"
  81. @click="onEdit"
  82. >
  83. 编辑
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </template>
  89. <script>
  90. import { mapGetters } from 'vuex'
  91. export default {
  92. layout: 'app-normal',
  93. data() {
  94. return {
  95. relationId: '',
  96. productId: '',
  97. productInfo: {},
  98. }
  99. },
  100. filters: {
  101. auditStatusFilter(value) {
  102. // 认证状态:0审核未通过,1审核通过,2待审核
  103. const map = {
  104. 0: '审核未通过',
  105. 1: '审核通过',
  106. 2: '待审核',
  107. }
  108. return map[value]
  109. },
  110. },
  111. computed: {
  112. ...mapGetters(['supplierInfo', 'authUserId', 'routePrefix']),
  113. },
  114. mounted() {
  115. this.initData()
  116. },
  117. methods: {
  118. initData() {
  119. this.productId = this.$route.query.id
  120. this.relationId = this.$route.query.relationId
  121. this.getProductDetails()
  122. },
  123. // 获取认证机构信息
  124. async getProductDetails() {
  125. try {
  126. const res = await this.$http.api.getProductDetails({
  127. productId: this.productId,
  128. relationId: this.relationId,
  129. })
  130. this.productInfo = { ...this.productInfo, ...res.data }
  131. console.log('res', this.productInfo)
  132. } catch (error) {
  133. console.log(error)
  134. }
  135. },
  136. auditStatusColor(value) {
  137. // 认证状态:0 danger,1 success,2 warning
  138. const map = {
  139. 0: 'danger',
  140. 1: 'success',
  141. 2: 'warning',
  142. }
  143. return map[value]
  144. },
  145. onEdit() {
  146. this.$router.push(
  147. `${this.routePrefix}/record/device/edit?type=edit&id=${this.productId}&relationId=${this.relationId}`
  148. )
  149. },
  150. },
  151. }
  152. </script>
  153. <style lang="scss" scoped>
  154. @media screen and (min-width: 768px) {
  155. .page {
  156. background: #fff;
  157. }
  158. .page-top {
  159. height: 360px;
  160. background: url(~/assets/theme-images/normal/pc/banner-record.png);
  161. background-size: auto 360px;
  162. background-position: center;
  163. .logo {
  164. display: block;
  165. width: 120px;
  166. height: 120px;
  167. border-radius: 50%;
  168. background: #fff;
  169. }
  170. .name {
  171. font-size: 30px;
  172. color: #fff;
  173. }
  174. }
  175. .page-content {
  176. width: 600px;
  177. margin: 0 auto;
  178. overflow: hidden;
  179. min-height: calc(100vh - 80px - 80px - 360px);
  180. box-sizing: border-box;
  181. padding-bottom: 40px;
  182. .page-title {
  183. font-size: 24px;
  184. font-weight: bold;
  185. text-align: center;
  186. padding: 40px 0;
  187. }
  188. .params-list {
  189. .param {
  190. display: grid;
  191. grid-template-columns: repeat(2, 1fr);
  192. grid-column-gap: 8px;
  193. grid-row-gap: 16px;
  194. .param-name {
  195. text-align: right;
  196. }
  197. }
  198. }
  199. .row {
  200. display: flex;
  201. justify-content: flex-start;
  202. align-items: flex-start;
  203. font-size: 18px;
  204. margin: 24px 0;
  205. .col {
  206. &.success {
  207. color: #bc1724 !important;
  208. }
  209. &.warning {
  210. color: #1890ff !important;
  211. }
  212. &.danger {
  213. color: #f94b4b !important;
  214. }
  215. &:first-child {
  216. width: 100px;
  217. color: #666;
  218. text-align: right;
  219. }
  220. &:last-child {
  221. color: #282828;
  222. }
  223. }
  224. .el-image {
  225. width: 120px;
  226. height: 120px;
  227. margin-right: 12px;
  228. box-sizing: border-box;
  229. border-radius: 4px;
  230. }
  231. }
  232. .control {
  233. margin-top: 62px;
  234. .button {
  235. width: 295px;
  236. height: 50px;
  237. cursor: pointer;
  238. &.edit {
  239. border: 1px solid #bc1724;
  240. color: #bc1724;
  241. }
  242. }
  243. }
  244. }
  245. }
  246. @media screen and (max-width: 768px) {
  247. .page {
  248. background: #fff;
  249. }
  250. .page-top {
  251. height: 46vw;
  252. background: url(~assets/theme-images/normal/pc/banner-record.png);
  253. background-size: auto 46vw;
  254. background-position: center;
  255. .logo {
  256. display: block;
  257. width: 14.8vw;
  258. height: 14.8vw;
  259. border-radius: 50%;
  260. background: #fff;
  261. }
  262. .name {
  263. font-size: 4vw;
  264. color: #fff;
  265. }
  266. }
  267. .page-content {
  268. box-sizing: border-box;
  269. padding: 8vw 7vw;
  270. .page-title {
  271. font-size: 4.2vw;
  272. font-weight: bold;
  273. text-align: center;
  274. color: #282828;
  275. margin-bottom: 4.6vw;
  276. }
  277. .params-list {
  278. .param {
  279. display: grid;
  280. grid-template-columns: repeat(2, 1fr);
  281. grid-column-gap: 1.2vw;
  282. grid-row-gap: 2.4vw;
  283. .param-name {
  284. text-align: right;
  285. }
  286. }
  287. }
  288. .row {
  289. display: flex;
  290. justify-content: flex-start;
  291. align-items: flex-start;
  292. font-size: 3.4vw;
  293. margin: 5.6vw 0;
  294. .col {
  295. &.success {
  296. color: #bc1724 !important;
  297. }
  298. &.warning {
  299. color: #1890ff !important;
  300. }
  301. &.danger {
  302. color: #f94b4b !important;
  303. }
  304. &:first-child {
  305. width: 19vw;
  306. color: #666;
  307. white-space: nowrap;
  308. flex-shrink: 0;
  309. // text-align: right;
  310. }
  311. &:last-child {
  312. color: #282828;
  313. }
  314. }
  315. .el-image {
  316. width: 26vw;
  317. height: 26vw;
  318. border-radius: 1vw;
  319. }
  320. }
  321. .control {
  322. margin-top: 22.8vw;
  323. .button {
  324. width: 100%;
  325. height: 12vw;
  326. cursor: pointer;
  327. &.edit {
  328. border: 1px solid #bc1724;
  329. color: #bc1724;
  330. }
  331. }
  332. }
  333. }
  334. }
  335. </style>