edit.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <template>
  2. <div class="club-device page">
  3. <div class="page-top flex flex-col justify-center items-center">
  4. <!-- <img class="logo" :src="supplierInfo.logo" /> -->
  5. <!-- <div class="name mt-2" v-text="supplierInfo.shopName + '认证记录'"></div> -->
  6. <div class="name mt-2">认证记录</div>
  7. </div>
  8. <div class="page-content">
  9. <div class="page-title">设备认证</div>
  10. <FormClubDevice
  11. ref="formClubDevice"
  12. :formType="formType"
  13. @step="onClubDeviceFormStep"
  14. />
  15. <div class="control flex flex-col items-center">
  16. <div
  17. class="button submit flex justify-center items-center"
  18. @click="onSubmit"
  19. >
  20. 提交
  21. </div>
  22. </div>
  23. </div>
  24. </div>
  25. </template>
  26. <script>
  27. import FormClubDevice from '../../form/components/form-club-device.vue'
  28. import { mapGetters } from 'vuex'
  29. export default {
  30. layout: 'app-asbl',
  31. components: {
  32. FormClubDevice,
  33. },
  34. data() {
  35. return {
  36. productInfo: {},
  37. formData: {},
  38. productId: 0,
  39. relationId: '',
  40. formType: '',
  41. }
  42. },
  43. computed: {
  44. ...mapGetters(['supplierInfo', 'authUserId', 'routePrefix', 'authId']),
  45. },
  46. mounted() {
  47. this.formType = this.$route.query.type
  48. this.getProductDetails()
  49. },
  50. methods: {
  51. async onSubmit() {
  52. try {
  53. await this.$refs.formClubDevice.validate()
  54. if (this.formType === 'edit') {
  55. this.formData.authId = this.authId
  56. }
  57. await this.$http.api.authProducSave(this.formData)
  58. this.$toast('保存成功')
  59. this.$router.push(
  60. `${this.routePrefix}/record/device/detail?id=${this.productId}`
  61. )
  62. } catch (error) {
  63. console.log(error)
  64. }
  65. },
  66. // 获取认证机构信息
  67. async getProductDetails() {
  68. try {
  69. this.productId = this.$route.query.id
  70. this.relationId = this.$route.query.relationId
  71. const res = await this.$http.api.getProductDetails({
  72. productId: this.productId,
  73. relationId: this.relationId,
  74. })
  75. this.productInfo = res.data
  76. console.log('productInfo', this.productInfo)
  77. this.$refs.formClubDevice.init(this.productInfo)
  78. } catch (error) {}
  79. },
  80. onClubDeviceFormStep(data) {
  81. console.log(data)
  82. this.formData = data[0]
  83. },
  84. },
  85. }
  86. </script>
  87. <style lang="scss" scoped>
  88. @media screen and (min-width: 768px) {
  89. .page {
  90. @include useTheme() {
  91. background: #fff;
  92. .page-top {
  93. height: 360px;
  94. background: fetch('pc-banner-record-device');
  95. background-size: auto 360px;
  96. .logo {
  97. display: block;
  98. width: 120px;
  99. height: 120px;
  100. border-radius: 50%;
  101. background: #fff;
  102. }
  103. .name {
  104. font-size: 30px;
  105. color: #fff;
  106. }
  107. }
  108. .page-content {
  109. width: 700px;
  110. margin: 0 auto;
  111. overflow: hidden;
  112. min-height: calc(100vh - 80px - 80px - 360px);
  113. box-sizing: border-box;
  114. padding-bottom: 40px;
  115. .page-title {
  116. font-size: 24px;
  117. font-weight: bold;
  118. text-align: center;
  119. padding: 40px 0;
  120. }
  121. .el-select {
  122. width: 100%;
  123. }
  124. .control {
  125. margin-top: 62px;
  126. .button {
  127. width: 295px;
  128. height: 50px;
  129. cursor: pointer;
  130. &.submit {
  131. background-color: fetch('color');
  132. color: #fff;
  133. }
  134. }
  135. }
  136. .device-param-list {
  137. position: relative;
  138. .add-param {
  139. position: absolute;
  140. cursor: pointer;
  141. top: -40px;
  142. right: 0;
  143. text-decoration: underline;
  144. font-size: 14px;
  145. color: fetch('color');
  146. }
  147. .param {
  148. position: relative;
  149. .remove {
  150. position: absolute;
  151. right: 0;
  152. top: 0;
  153. width: 20px;
  154. height: 20px;
  155. background: #f94b4b;
  156. border-radius: 2px;
  157. cursor: pointer;
  158. color: #fff;
  159. font-size: 14px;
  160. text-align: center;
  161. line-height: 20px;
  162. }
  163. }
  164. }
  165. }
  166. }
  167. }
  168. }
  169. @media screen and (max-width: 768px) {
  170. .page {
  171. @include useTheme() {
  172. background: #fff;
  173. .page-top {
  174. height: 46vw;
  175. background: fetch('h5-banner-record-device');
  176. background-size: auto 46vw;
  177. .logo {
  178. display: block;
  179. width: 14.8vw;
  180. height: 14.8vw;
  181. border-radius: 50%;
  182. background: #fff;
  183. }
  184. .name {
  185. font-size: 4vw;
  186. color: #fff;
  187. }
  188. }
  189. .page-content {
  190. box-sizing: border-box;
  191. padding: 8vw 7vw;
  192. .page-title {
  193. font-size: 4.2vw;
  194. font-weight: bold;
  195. text-align: center;
  196. color: #282828;
  197. margin-bottom: 4.6vw;
  198. }
  199. .el-select {
  200. width: 100%;
  201. }
  202. .control {
  203. .button {
  204. width: 100%;
  205. height: 12vw;
  206. cursor: pointer;
  207. &.submit {
  208. background-color: fetch('color');
  209. color: #fff;
  210. }
  211. }
  212. }
  213. .device-param-list {
  214. position: relative;
  215. .add-param {
  216. position: absolute;
  217. cursor: pointer;
  218. top: -40px;
  219. right: 0;
  220. font-size: 3.4vw;
  221. color: fetch('color');
  222. }
  223. .param {
  224. position: relative;
  225. .remove {
  226. position: absolute;
  227. right: 0;
  228. top: 0;
  229. width: 4.4vw;
  230. height: 4.4vw;
  231. background: #f94b4b;
  232. border-radius: 0.2vw;
  233. cursor: pointer;
  234. color: #fff;
  235. font-size: 3.4vw;
  236. text-align: center;
  237. line-height: 4.4vw;
  238. }
  239. }
  240. }
  241. }
  242. }
  243. }
  244. }
  245. </style>