setting.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ?>
  4. <style>
  5. .app-share {
  6. padding-top: 12px;
  7. border-top: 1px solid #e2e2e2;
  8. margin-top: -20px;
  9. }
  10. .app-share .app-share-bg {
  11. position: relative;
  12. width: 310px;
  13. height: 360px;
  14. background-repeat: no-repeat;
  15. background-size: contain;
  16. background-position: center
  17. }
  18. .app-share .app-share-bg .title {
  19. width: 160px;
  20. height: 29px;
  21. line-height: 1;
  22. word-break: break-all;
  23. text-overflow: ellipsis;
  24. display: -webkit-box;
  25. -webkit-box-orient: vertical;
  26. -webkit-line-clamp: 2;
  27. overflow: hidden;
  28. }
  29. .app-share .app-share-bg .pic-image {
  30. background-repeat: no-repeat;
  31. background-position: 0 0;
  32. background-size: cover;
  33. width: 160px;
  34. height: 130px;
  35. }
  36. .el-card__header {
  37. padding: 8px 20px;
  38. }
  39. .el-form-item--mini.el-form-item, .el-form-item--small.el-form-item {
  40. margin: 5px;
  41. }
  42. .el-form-item__content, .el-form-item__label{
  43. margin-top: 10px;
  44. }
  45. </style>
  46. <div id="app" v-cloak>
  47. <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;">
  48. <div class="form_box">
  49. <template>
  50. <el-card>
  51. <div style="display: flex;align-items: center;padding-bottom: 10px;border-bottom: 1px solid #E4E7ED;margin:10px 0 20px 15px;font-size:14px;">
  52. <div>社区设置</div>
  53. </div>
  54. <el-form size="small" ref="ruleForm" label-width="150px">
  55. <el-row>
  56. <el-col :span="24">
  57. <el-form-item label="社区开关">
  58. <el-switch v-model="ruleForm.community_status">
  59. </el-switch>
  60. </el-form-item>
  61. </el-col>
  62. </el-row>
  63. <div style="display: flex;align-items: center;padding-bottom: 10px;border-bottom: 1px solid #E4E7ED;margin:10px 0 20px 15px;font-size:18px;">
  64. <span class="tips-text" style="padding-left:70px;line-height:24px;color:red;margin-top:5px;font-size: 14px">开关控制前端页面与后台门店设置社区/村的字段选择的显示</span>
  65. </div>
  66. <el-button :loading="btnLoading" class="button-item" type="primary" style="margin-top: 24px;" @click="submit" size="small">保存
  67. </el-button>
  68. </el-form>
  69. </el-card>
  70. </template>
  71. </div>
  72. </el-card>
  73. </div>
  74. <script src="<?= Yii::$app->request->baseUrl ?>/resources/unpkg/vuedraggable@2.18.1/dist/vuedraggable.umd.min.js"></script>
  75. <script>
  76. const app = new Vue({
  77. el: '#app',
  78. data() {
  79. return {
  80. loading: false,
  81. btnLoading: false,
  82. params: {},
  83. activeName: 'community_setting',
  84. keyword: '',
  85. ruleForm:{
  86. community_status:false
  87. }
  88. }
  89. },
  90. mounted: function() {
  91. this.loadData();
  92. },
  93. methods: {
  94. loadData() {
  95. if(this.loading === true) return;
  96. this.loading = true;
  97. request({
  98. params: {
  99. r: 'store/store-community/setting',
  100. },
  101. method: 'get'
  102. }).then(e => {
  103. this.loading = false;
  104. if (e.data.code == 0) {
  105. if(e.data.data) {//有选中的
  106. this.ruleForm.community_status=e.data.data.mall_info.community_status == 1;
  107. }
  108. }
  109. console.log(this.ruleForm.community_status)
  110. }).catch(e => {
  111. this.loading = false;
  112. })
  113. },
  114. submit() {
  115. this.btnLoading = true;
  116. request({
  117. params: {
  118. r: 'store/store-community/setting',
  119. },
  120. method: 'post',
  121. data: this.ruleForm,
  122. }).then(e => {
  123. this.btnLoading = false;
  124. if (e.data.code === 0) {
  125. this.ruleForm.community_status = this.ruleForm.community_status == 1;
  126. this.$message.success(e.data.msg);
  127. } else {
  128. this.$message.error(e.data.msg);
  129. }
  130. this.loading = false;
  131. this.settingPop = false;
  132. }).catch(e => {
  133. this.btnLoading = false;
  134. this.loading = false;
  135. this.settingPop = false;
  136. });
  137. },
  138. HandleChangeChecked(val, index) {
  139. this.$forceUpdate();
  140. },
  141. }
  142. });
  143. </script>