Bladeren bron

小程序配置新增展示销售信息

yfh 1 week geleden
bovenliggende
commit
107efa18fe
3 gewijzigde bestanden met toevoegingen van 189 en 3 verwijderingen
  1. 8 1
      src/api/system/config.js
  2. 89 0
      src/views/course/coursePlaySourceConfig/index.vue
  3. 92 2
      src/views/system/config/config.vue

+ 8 - 1
src/api/system/config.js

@@ -81,4 +81,11 @@ export function updateConfigByKey(data) {
     method: 'post',
     data: data
   })
-}
+}
+export function updateIsTownOn(query) {
+  return request({
+    url: '/system/config/updateIsTownOn',
+    method: 'get',
+    params: query
+  })
+}

+ 89 - 0
src/views/course/coursePlaySourceConfig/index.vue

@@ -61,6 +61,36 @@
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
+    <!-- 开关配置对话框 -->
+    <el-dialog title="开关配置" :visible.sync="switchDialogVisible" width="500px" class="switch-dialog">
+      <el-form :model="switchForm" label-width="100px">
+        <el-form-item label="AppId">
+          <el-input v-model="switchForm.appId" :disabled="true"></el-input>
+        </el-form-item>
+        <el-form-item label="开关状态">
+          <el-switch
+            v-model="switchForm.switchStatus"
+            active-text="开启"
+            inactive-text="关闭"
+            active-value="001"
+            inactive-value="002">
+          </el-switch>
+        </el-form-item>
+        <el-form-item label="配置信息" v-if="switchForm.configInfo">
+          <el-input
+            type="textarea"
+            :rows="4"
+            v-model="switchForm.configInfo"
+            :disabled="true">
+          </el-input>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+                <el-button @click="switchDialogVisible = false">取 消</el-button>
+                <el-button type="primary" @click="submitSwitchConfig">确 定</el-button>
+            </span>
+    </el-dialog>
+
     <el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange" border>
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="ID" align="center" prop="id" />
@@ -103,6 +133,12 @@
             @click="handleDelete(scope.row)"
             v-hasPermi="['course:playSourceConfig:remove']"
           >删除</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-setting"
+            @click="handleSwitchConfig(scope.row)"
+          >是否展示销售</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -166,11 +202,17 @@
 
 <script>
 import {list, get, update, add, del} from '@/api/course/coursePlaySourceConfig'
+import {updateIsTownOn} from "@/api/system/config";
 
 export default {
   name: 'CoursePlaySourceConfig',
   data() {
     return {
+      switchDialogVisible: false,
+      switchForm: {
+        appId: '',
+        switchStatus: '001',
+      },
       queryParams: {
         pageNum: 1,
         pageSize: 10,
@@ -221,6 +263,53 @@ export default {
     this.getList();
   },
   methods: {
+
+
+    // 处理开关配置
+    handleSwitchConfig(row) {
+      this.switchForm.appId = row.appid;
+      this.switchForm.switchStatus = "001"; // 默认关闭状态
+
+      // 调用接口获取开关状态
+      this.getSwitchConfig(row.appid);
+      this.switchDialogVisible = true;
+    },
+
+    // 获取开关配置
+    getSwitchConfig(appId) {
+      const params = {
+        appId: this.switchForm.appId
+      };
+      updateIsTownOn(params).then(response=>{
+        if (response.code === 200) {
+          if ( response.date){
+            this.switchForm.switchStatus = response.date;
+          }
+        } else {
+          this.$message.error('获取配置失败: ' + response.msg);
+        }
+      }).catch(error => {
+        this.$message.error('请求失败: ' + error.message);
+      });
+    },
+
+    // 提交开关配置
+    submitSwitchConfig() {
+      const params = {
+        appId: this.switchForm.appId,
+        bock: this.switchForm.switchStatus
+      };
+      updateIsTownOn(params).then(response=>{
+        if (response.code === 200) {
+          this.$message.success('配置更新成功');
+          this.switchDialogVisible = false;
+        } else {
+          this.$message.error('更新失败: ' + response.msg);
+        }
+      })
+    },
+
+
     getList() {
       this.loading = true;
       list(this.queryParams).then(response => {

+ 92 - 2
src/views/system/config/config.vue

@@ -1365,6 +1365,12 @@
                  icon="el-icon-delete"
                  @click="deleteCourseMaConfig(scope.$index)"
                >删除</el-button>
+               <el-button
+                 size="mini"
+                 type="text"
+                 icon="el-icon-setting"
+                 @click="handleSwitchConfig(scope.row)"
+               >是否展示销售管理</el-button>
              </template>
            </el-table-column>
          </el-table>
@@ -1373,7 +1379,39 @@
            <el-button type="primary" @click="submitCourseMaConfig">提 交</el-button>
          </div>
        </el-tab-pane>
-       <el-tab-pane label="红包商户配置" name="redPacket.config" >
+
+      <!-- 开关配置对话框 -->
+      <el-dialog title="开关配置" :visible.sync="switchDialogVisible" width="500px" class="switch-dialog">
+        <el-form :model="switchForm" label-width="100px">
+          <el-form-item label="AppId">
+            <el-input v-model="switchForm.appId" :disabled="true"></el-input>
+          </el-form-item>
+          <el-form-item label="开关状态">
+            <el-switch
+              v-model="switchForm.switchStatus"
+              active-text="开启"
+              inactive-text="关闭"
+              active-value="001"
+              inactive-value="002">
+            </el-switch>
+          </el-form-item>
+          <el-form-item label="配置信息" v-if="switchForm.configInfo">
+            <el-input
+              type="textarea"
+              :rows="4"
+              v-model="switchForm.configInfo"
+              :disabled="true">
+            </el-input>
+          </el-form-item>
+        </el-form>
+        <span slot="footer" class="dialog-footer">
+                <el-button @click="switchDialogVisible = false">取 消</el-button>
+                <el-button type="primary" @click="submitSwitchConfig">确 定</el-button>
+            </span>
+      </el-dialog>
+
+
+      <el-tab-pane label="红包商户配置" name="redPacket.config" >
          <el-form ref="form19" :model="form19"  label-width="150px">
            <el-form-item   label="红包接口类型" prop="isNew">
              <el-radio-group v-model="form19.isNew">
@@ -1561,7 +1599,7 @@
 </template>
 
 <script>
-import {   getConfigByKey,updateConfigByKey, clearCache } from "@/api/system/config";
+import {   getConfigByKey,updateConfigByKey, clearCache,updateIsTownOn } from "@/api/system/config";
 import {listStore} from "@/api/his/storeProduct";
 import { js } from "js-beautify";
 import Material from '@/components/Material'
@@ -1589,6 +1627,11 @@ export default {
       videoAccept:"video/*",
       courseMaConfigLoading:false,
       courseMaConfigList:[],
+      switchDialogVisible: false,
+      switchForm: {
+        appId: '',
+        switchStatus: '001',
+      },
       deliveryGift:{
         open:false,
         title:"商品选择"
@@ -1737,6 +1780,53 @@ export default {
    }
   },
   methods: {
+
+    // 处理开关配置
+    handleSwitchConfig(row) {
+      this.switchForm.appId = row.appid;
+      this.switchForm.switchStatus = "001"; // 默认关闭状态
+
+      // 调用接口获取开关状态
+      this.getSwitchConfig(row.appid);
+      this.switchDialogVisible = true;
+    },
+
+    // 获取开关配置
+    getSwitchConfig(appId) {
+      const params = {
+        appId: this.switchForm.appId
+      };
+      updateIsTownOn(params).then(response=>{
+        if (response.code === 200) {
+          if ( response.date){
+            this.switchForm.switchStatus = response.date;
+          }
+        } else {
+          this.$message.error('获取配置失败: ' + response.msg);
+        }
+      }).catch(error => {
+        this.$message.error('请求失败: ' + error.message);
+      });
+    },
+
+    // 提交开关配置
+    submitSwitchConfig() {
+      const params = {
+        appId: this.switchForm.appId,
+        bock: this.switchForm.switchStatus
+      };
+      updateIsTownOn(params).then(response=>{
+        if (response.code === 200) {
+          this.$message.success('配置更新成功');
+          this.switchDialogVisible = false;
+        } else {
+          this.$message.error('更新失败: ' + response.msg);
+        }
+      })
+    },
+
+
+
     handleCityChange(value) {
       // console.log(this.$refs.citySelect,this.$refs.citySelect[0])
       var nodes=this.$refs.citySelect[value].getCheckedNodes();