edit.vue 5.6 KB

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