index.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. /**
  3. * @link:http://www.gdqijianshi.com/
  4. * @copyright: Copyright (c) 2020 广东七件事集团
  5. * Created by PhpStorm
  6. * Author: lun
  7. * Date: 2021-10-23
  8. * Time: 16:11
  9. */
  10. ?>
  11. <div id="app" v-cloak>
  12. <el-card class="box-card" v-loading="loading" shadow="never" style="border:0;min-width: 1500px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  13. <div slot="header">
  14. <div>
  15. <span>基础设置</span>
  16. </div>
  17. </div>
  18. <div class="form_box">
  19. <el-form :model="ruleForm" size="small" ref="ruleForm" label-width="150px">
  20. <el-card shadow="never">
  21. <div>
  22. <el-row>
  23. <el-col :span="16">
  24. <el-form-item label="启用门店股东" style="margin-bottom: 0">
  25. <div>
  26. <el-switch v-model="ruleForm.is_enable" :active-value="1" :inactive-value="0"></el-switch>
  27. </div>
  28. </el-form-item>
  29. </el-col>
  30. </el-row>
  31. </div>
  32. </el-card>
  33. </el-form>
  34. <el-button :loading="btnLoading" class="button-item" type="primary" style="margin-top: 24px;" @click="store('ruleForm')" size="small">保存
  35. </el-button>
  36. </div>
  37. </el-card>
  38. </div>
  39. <script>
  40. const app = new Vue({
  41. el: '#app',
  42. data() {
  43. return {
  44. loading: false,
  45. btnLoading: false,
  46. ruleForm: {
  47. is_enable: 0,
  48. },
  49. }
  50. },
  51. mounted: function() {
  52. this.loadData();
  53. },
  54. methods: {
  55. loadData() {
  56. this.loading = true;
  57. request({
  58. params: {
  59. r: 'store-boss/default/index',
  60. },
  61. method: 'get'
  62. }).then(e => {
  63. this.loading = false;
  64. if (e.data.code == 0 && !isEmpty(e.data.data)) {
  65. this.ruleForm = e.data.data;
  66. }
  67. }).catch(e => {
  68. this.loading = false;
  69. })
  70. },
  71. store(formName) {
  72. this.$refs[formName].validate((valid) => {
  73. if (valid) {
  74. this.btnLoading = true;
  75. request({
  76. params: {
  77. r: 'store-boss/default/index',
  78. },
  79. method: 'post',
  80. data: this.ruleForm
  81. }).then(e => {
  82. this.btnLoading = false;
  83. if (e.data.code == 0) {
  84. this.$message.success(e.data.msg);
  85. } else {
  86. this.$message.error(e.data.msg);
  87. }
  88. }).catch(e => {
  89. this.$message.error(e);
  90. this.btnLoading = false;
  91. })
  92. } else {
  93. this.btnLoading = false;
  94. console.log('error submit!!');
  95. return false;
  96. }
  97. });
  98. },
  99. }
  100. });
  101. </script>