com-wechat-notice-setting.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <style>
  2. #pane-second .el-card__body {
  3. background-color: #F3F3F3;
  4. padding: 0;
  5. }
  6. .title {
  7. padding: 18px 20px;
  8. margin-top: 12px;
  9. border-bottom: 1px solid #F3F3F3;
  10. background-color: #fff;
  11. }
  12. .el-alert .el-alert__description {
  13. margin-top: 0
  14. }
  15. .el-form-item {
  16. position: relative;
  17. }
  18. .send-btn {
  19. position: absolute !important;
  20. top: 0;
  21. right: -95px;
  22. }
  23. </style>
  24. <template id="com-wechat-notice-setting">
  25. <el-card shadow="never" style="border:0" v-loading="cardLoading" v-cloak>
  26. <div slot="header">
  27. <span>默认行业消费品,行业ID为31。需要到微信公众号后台开通。</span>
  28. </div>
  29. <el-form :model="ruleForm" ref="ruleForm" :rules="rules" size="small" label-width="150px">
  30. <el-card shadow="never" style="margin-top: 12px;">
  31. <el-row>
  32. <el-col :span="24">
  33. <el-switch
  34. v-model="ruleForm.is_open"
  35. active-text="开启消息模板推送"
  36. active-value="1"
  37. inactive-value="0"
  38. active-color="#409EFF">
  39. </el-switch>
  40. </el-col>
  41. </el-row>
  42. </el-card>
  43. <el-card shadow="never" style="margin-top: 12px;">
  44. <el-row>
  45. <el-col :span="24">
  46. <el-switch
  47. v-model="ruleForm.is_miniapp_priority"
  48. active-text="是否跳转链接小程序优先"
  49. active-value="1"
  50. inactive-value="0"
  51. active-color="#409EFF">
  52. </el-switch>
  53. </el-col>
  54. </el-row>
  55. </el-card>
  56. <el-card shadow="never" style="margin-top: 12px;">
  57. <el-row>
  58. <el-col :span="24">
  59. <el-switch
  60. v-model="ruleForm.is_logging"
  61. active-text="是否记录数据库日志"
  62. active-value="1"
  63. inactive-value="0"
  64. active-color="#409EFF">
  65. </el-switch>
  66. </el-col>
  67. </el-row>
  68. </el-card>
  69. <el-button :loading="btnLoading" style="margin-top: 20px;padding: 9px 25px" type="primary" @click="store"
  70. size="small">保存
  71. </el-button>
  72. </el-form>
  73. </el-card>
  74. </template>
  75. <script>
  76. Vue.component('com-wechat-notice-setting', {
  77. template: '#com-wechat-notice-setting',
  78. data() {
  79. return {
  80. ruleForm: {},
  81. rules: {},
  82. btnLoading:false,
  83. cardLoading:false,
  84. };
  85. },
  86. methods: {
  87. store() {
  88. let self = this;
  89. self.btnLoading = true;
  90. request({
  91. params: {
  92. r: 'mall/setting/mall',
  93. },
  94. method: 'post',
  95. data: {
  96. key:'wechat_notice',
  97. value:self.ruleForm
  98. }
  99. }).then(e => {
  100. self.btnLoading = false;
  101. if (e.data.code == 0) {
  102. self.$message.success(e.data.msg);
  103. } else {
  104. self.$message.error(e.data.msg);
  105. }
  106. }).catch(e => {
  107. self.$message.error(e.data.msg);
  108. self.btnLoading = false;
  109. });
  110. },
  111. getDetail() {
  112. let self = this;
  113. self.cardLoading = true;
  114. request({
  115. params: {
  116. r: 'mall/setting/mall',
  117. key:'wechat_notice'
  118. },
  119. method: 'get',
  120. }).then(e => {
  121. self.cardLoading = false;
  122. if (e.data.code == 0) {
  123. self.ruleForm = e.data.data;
  124. } else {
  125. self.$message.error(e.data.msg);
  126. }
  127. }).catch(e => {
  128. console.log(e);
  129. });
  130. }
  131. },
  132. mounted: function () {
  133. this.getDetail();
  134. }
  135. });
  136. </script>