edit.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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-ross',
  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. background: #fff;
  91. }
  92. .page-top {
  93. height: 360px;
  94. @include themify($themes) {
  95. background: themed('pc-banner-record-device');
  96. background-size: auto 360px;
  97. }
  98. .logo {
  99. display: block;
  100. width: 120px;
  101. height: 120px;
  102. border-radius: 50%;
  103. background: #fff;
  104. }
  105. .name {
  106. font-size: 30px;
  107. color: #fff;
  108. }
  109. }
  110. .page-content {
  111. width: 700px;
  112. margin: 0 auto;
  113. overflow: hidden;
  114. min-height: calc(100vh - 80px - 80px - 360px);
  115. box-sizing: border-box;
  116. padding-bottom: 40px;
  117. .page-title {
  118. font-size: 24px;
  119. font-weight: bold;
  120. text-align: center;
  121. padding: 40px 0;
  122. }
  123. .el-select {
  124. width: 100%;
  125. }
  126. .control {
  127. margin-top: 62px;
  128. .button {
  129. width: 295px;
  130. height: 50px;
  131. cursor: pointer;
  132. &.submit {
  133. @include themify($themes) {
  134. background-color: themed('color');
  135. color: #fff;
  136. }
  137. }
  138. }
  139. }
  140. .device-param-list {
  141. position: relative;
  142. .add-param {
  143. position: absolute;
  144. cursor: pointer;
  145. top: -40px;
  146. right: 0;
  147. text-decoration: underline;
  148. font-size: 14px;
  149. @include themify($themes) {
  150. color: themed('color');
  151. }
  152. }
  153. .param {
  154. position: relative;
  155. .remove {
  156. position: absolute;
  157. right: 0;
  158. top: 0;
  159. width: 20px;
  160. height: 20px;
  161. background: #f94b4b;
  162. border-radius: 2px;
  163. cursor: pointer;
  164. color: #fff;
  165. font-size: 14px;
  166. text-align: center;
  167. line-height: 20px;
  168. }
  169. }
  170. }
  171. }
  172. }
  173. @media screen and (max-width: 768px) {
  174. .page {
  175. background: #fff;
  176. }
  177. .page-top {
  178. height: 46vw;
  179. @include themify($themes) {
  180. background: themed('h5-banner-record-device');
  181. background-size: auto 46vw;
  182. }
  183. .logo {
  184. display: block;
  185. width: 14.8vw;
  186. height: 14.8vw;
  187. border-radius: 50%;
  188. background: #fff;
  189. }
  190. .name {
  191. font-size: 4vw;
  192. color: #fff;
  193. }
  194. }
  195. .page-content {
  196. box-sizing: border-box;
  197. padding: 8vw 7vw;
  198. .page-title {
  199. font-size: 4.2vw;
  200. font-weight: bold;
  201. text-align: center;
  202. color: #282828;
  203. margin-bottom: 4.6vw;
  204. }
  205. .el-select {
  206. width: 100%;
  207. }
  208. .control {
  209. .button {
  210. width: 100%;
  211. height: 12vw;
  212. cursor: pointer;
  213. &.submit {
  214. @include themify($themes) {
  215. background-color: themed('color');
  216. color: #fff;
  217. }
  218. }
  219. }
  220. }
  221. .device-param-list {
  222. position: relative;
  223. .add-param {
  224. position: absolute;
  225. cursor: pointer;
  226. top: -40px;
  227. right: 0;
  228. font-size: 3.4vw;
  229. @include themify($themes) {
  230. color: themed('color');
  231. }
  232. }
  233. .param {
  234. position: relative;
  235. .remove {
  236. position: absolute;
  237. right: 0;
  238. top: 0;
  239. width: 4.4vw;
  240. height: 4.4vw;
  241. background: #f94b4b;
  242. border-radius: 0.2vw;
  243. cursor: pointer;
  244. color: #fff;
  245. font-size: 3.4vw;
  246. text-align: center;
  247. line-height: 4.4vw;
  248. }
  249. }
  250. }
  251. }
  252. }
  253. </style>