edit.vue 5.4 KB

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