edit.vue 5.4 KB

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