setting.php 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <div id="app" v-cloak>
  2. <el-card class="box-card" v-loading="loading" shadow="never" style="border:0;min-width: 1200px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  3. <div class="form_box">
  4. <el-form :model="form" size="small" ref="form" label-width="300px">
  5. <el-card shadow="never">
  6. <div slot="header">
  7. <span>基础配置</span>
  8. </div>
  9. <el-row>
  10. <el-col :span="16">
  11. <el-form-item label="门店优惠券是否展示到前端门店列表页面">
  12. <el-switch
  13. :active-value="1"
  14. :inactive-value="0"
  15. v-model="form.is_show_coupon"
  16. >
  17. </el-switch>
  18. </el-form-item>
  19. </el-col>
  20. </el-row>
  21. </el-card>
  22. </el-form>
  23. <el-button type="primary" class="button-item" size="small" style="margin-top: 20px;" :loading=btnLoading @click="onSubmit">提交</el-button>
  24. </div>
  25. </el-card>
  26. </div>
  27. <script>
  28. const app = new Vue({
  29. el: '#app',
  30. data() {
  31. return {
  32. loading: false,
  33. btnLoading: false,
  34. form: {
  35. is_show_coupon: 1
  36. },
  37. }
  38. },
  39. methods: {
  40. onSubmit() {
  41. this.$refs.form.validate((valid) => {
  42. if (valid) {
  43. this.btnLoading = true;
  44. let para = Object.assign(this.form);
  45. request({
  46. params: {
  47. r: 'store/client/coupon/setting'
  48. },
  49. data: para,
  50. method: 'post'
  51. }).then(e => {
  52. this.btnLoading = false;
  53. if (e.data.code === 0) {
  54. this.$message({
  55. message: e.data.msg,
  56. type: 'success'
  57. });
  58. } else {
  59. this.$message.error(e.data.msg);
  60. }
  61. }).catch(e => {
  62. this.btnLoading = false;
  63. this.$message.error(e.data.msg);
  64. });
  65. }
  66. });
  67. },
  68. getList() {
  69. this.loading = true;
  70. request({
  71. params: {
  72. r: 'store/client/coupon/setting'
  73. },
  74. }).then(e => {
  75. this.loading = false;
  76. if (e.data.code === 0) {
  77. this.form = e.data.data;
  78. } else {
  79. this.$message.error(e.data.msg);
  80. }
  81. }).catch(e => {
  82. this.loading = false;
  83. });
  84. },
  85. },
  86. mounted: function() {
  87. this.getList();
  88. }
  89. })
  90. </script>