setting.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ComponentHelper::loadComponentView('com-image');
  4. ComponentHelper::loadComponentView('com-rich-text');
  5. ?>
  6. <style>
  7. .info-title {
  8. margin-left: 20px;
  9. color: #ff4544;
  10. }
  11. .red {
  12. display:inline-block;
  13. padding: 0 25px;
  14. color: #ff4544;
  15. }
  16. .info-title span {
  17. color: #3399ff;
  18. cursor: pointer;
  19. font-size: 13px;
  20. }
  21. .button-item {
  22. margin-top: 20px;
  23. padding: 9px 25px;
  24. }
  25. .el-tabs__header {
  26. padding: 0 20px;
  27. height: 56px;
  28. line-height: 56px;
  29. background-color: #fff;
  30. margin-bottom: 10px;
  31. }
  32. .form-body {
  33. padding: 10px 20px;
  34. background-color: #fff;
  35. margin-bottom: 20px;
  36. }
  37. .red {
  38. color: #ff4544;
  39. }
  40. .button-item {
  41. margin-top: 12px;
  42. padding: 9px 25px;
  43. }
  44. </style>
  45. <section id="app" v-cloak>
  46. <el-card style="border:0" shadow="never" body-style="background-color: #f3f3f3;padding: 0 0;"
  47. v-loading="loading">
  48. <el-tabs v-model="activeName">
  49. <el-tab-pane label="基础设置" class="form-body" name="first">
  50. <div class="text item" style="width:100%">
  51. <el-form :model="form" label-width="150px" :rules="rule" ref="form">
  52. <el-form-item label="砍价者佣金发放" prop="grant_type">
  53. <el-radio-group v-model="form.grant_type">
  54. <el-radio label="1">订单支付发放</el-radio>
  55. <el-radio label="2">订单完成发放</el-radio>
  56. </el-radio-group>
  57. </el-form-item>
  58. <el-form-item label="活动规则" prop="rule">
  59. <com-rich-text style="width: 750px" :simple-attachment="true" v-model="form.rule"></com-rich-text>
  60. </el-form-item>
  61. <el-button class="button-item" :loading="btnLoading" type="primary" @click="store('form')" size="small">保存</el-button>
  62. </el-form>
  63. </div>
  64. </el-tab-pane>
  65. </el-tabs>
  66. </el-card>
  67. </section>
  68. <script>
  69. const app = new Vue({
  70. el: '#app',
  71. data() {
  72. return {
  73. loading: false,
  74. btnLoading: false,
  75. form: {
  76. title : '',
  77. grant_type : '1',
  78. share_title:"",
  79. share_pic:'',
  80. rule : '',
  81. notify_type:''
  82. },
  83. notify_type:[],
  84. rule: {
  85. title: [{
  86. required: true,
  87. message: '请输入活动标题',
  88. trigger: 'change'
  89. }, ],
  90. },
  91. is_show: false,
  92. activeName: 'first',
  93. };
  94. },
  95. methods: {
  96. //保存基础设置
  97. store(formName) {
  98. this.$refs[formName].validate(valid => {
  99. if (valid) {
  100. this.btnLoading = true;
  101. this.form.notify_type = this.notify_type;
  102. request({
  103. params: {
  104. r: 'bargain/default/setting'
  105. },
  106. method: 'post',
  107. data: this.form
  108. }).then(e => {
  109. this.btnLoading = false;
  110. if (e.data.code == 0) {
  111. this.$message.success(e.data.msg);
  112. } else {
  113. this.$message.error(e.data.msg);
  114. }
  115. });
  116. } else {
  117. this.btnLoading = false;
  118. console.log('error submit!!');
  119. return false;
  120. }
  121. })
  122. },
  123. //加载数据
  124. loadData() {
  125. this.loading = true;
  126. request({
  127. params: {
  128. r: 'bargain/default/setting'
  129. },
  130. method: 'get'
  131. }).then(e => {
  132. this.loading = false;
  133. this.is_show = true;
  134. if (e.data.code == 0) {
  135. this.form = e.data.data.list;
  136. this.form.grant_type = this.form.grant_type.toString();
  137. }
  138. }).catch(e => {
  139. this.loading = false;
  140. });
  141. },
  142. },
  143. created() {
  144. this.loadData();
  145. },
  146. })
  147. </script>