edit.vue 5.5 KB

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