edit.vue 6.0 KB

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