index.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. <template>
  5. <el-card>
  6. <el-form :model="basic" size="small" ref="ruleForm" label-width="180px">
  7. <!-- :rules="rules" -->
  8. <el-tabs v-model="activeName" type="card">
  9. <el-tab-pane label="基本设置" name="basic">
  10. <el-row>
  11. <el-col :span="24">
  12. <div class="title paddingTop">
  13. <span class="title-line"></span>
  14. <span>秒杀设置</span>
  15. </div>
  16. <div class="form-body">
  17. <el-form-item label="秒杀插件:" prop="status">
  18. <el-radio v-model="basic.status" :label="1">开启</el-radio>
  19. <el-radio v-model="basic.status" :label="0">关闭</el-radio>
  20. </el-form-item>
  21. <el-form-item label="支付超时取消订单:" prop="request_url">
  22. <el-input type="text" v-model="basic.order_cancel_time">
  23. <template slot="append">分钟</template>
  24. </el-input>
  25. </el-form-item>
  26. </div>
  27. </el-col>
  28. </el-row>
  29. </el-tab-pane>
  30. </el-tabs>
  31. <div style="border-top: 1px solid #dad9d9;">
  32. <el-button :loading="btnLoading" class="button-item" type="primary" style="margin-top: 10px;" @click="store('ruleForm')" size="small">保存
  33. </el-button>
  34. </div>
  35. </el-form>
  36. </el-card>
  37. </template>
  38. </div>
  39. </el-card>
  40. </div>
  41. <script>
  42. const app = new Vue({
  43. el: '#app',
  44. data() {
  45. return {
  46. activeName: 'basic',
  47. loading: false,
  48. btnLoading: false,
  49. dialogVisible: false,
  50. basic: {
  51. status: 0,
  52. order_cancel_time: 1
  53. },
  54. }
  55. },
  56. mounted: function() {
  57. this.loadData();
  58. },
  59. methods: {
  60. // 获取基础设置详情
  61. loadData() {
  62. this.loading = true;
  63. request({
  64. params: {
  65. r: 'seckill/setting/index',
  66. },
  67. method: 'get'
  68. }).then(e => {
  69. this.loading = false;
  70. if (e.data.code == 0) {
  71. if (e.data.data) {
  72. this.basic = e.data.data;
  73. }
  74. } else {
  75. this.$message.error(e.data.msg)
  76. }
  77. }).catch(e => {
  78. this.loading = false;
  79. })
  80. },
  81. store(formName) {
  82. var self = this
  83. if (self.basic.status == 1) {
  84. if (
  85. (!self.basic.order_cancel_time)
  86. ) {
  87. self.$message.error('请填写超时取消时间');
  88. return false;
  89. }
  90. }
  91. self.btnLoading = true;
  92. request({
  93. params: {
  94. r: 'seckill/setting/save-setting',
  95. },
  96. method: 'post',
  97. data: self.basic
  98. }).then(e => {
  99. self.btnLoading = false;
  100. if (e.data.code == 0) {
  101. self.$message.success(e.data.msg);
  102. } else {
  103. self.$message.error(e.data.msg);
  104. }
  105. }).catch(e => {
  106. self.$message.error(e);
  107. self.btnLoading = false;
  108. })
  109. }
  110. }
  111. });
  112. </script>
  113. <style>
  114. .form_box {
  115. background-color: #f3f3f3;
  116. padding: 0 0 20px;
  117. }
  118. .button-item {
  119. margin-top: 12px;
  120. padding: 9px 25px;
  121. }
  122. .el-input-group__append {
  123. background-color: #fff;
  124. color: #353535;
  125. }
  126. .el-form-item {
  127. margin-bottom: 25px !important;
  128. }
  129. .title {
  130. display: flex;
  131. align-items: center;
  132. padding: 18px 20px;
  133. /* border-top: 1px solid #F3F3F3; */
  134. border-bottom: 1px solid #F3F3F3;
  135. background-color: #fff;
  136. }
  137. .title-line {
  138. width: 4px;
  139. height: 20px;
  140. background-color: #1479F0;
  141. margin-right: 10px;
  142. }
  143. .paddingTop {
  144. margin-top: 10px;
  145. }
  146. </style>