yjwang 7 órája
szülő
commit
32e45253b5

+ 9 - 0
src/api/company/traffic.js

@@ -8,6 +8,15 @@ export function rechargeTraffic(data) {
   })
 }
 
+// 经销商流量扣减
+export function deductTraffic(data) {
+  return request({
+    url: '/company/traffic/deductTraffic',
+    method: 'post',
+    data: data
+  })
+}
+
 export function listTrafficRecords(query) {
   return request({
     url: '/company/traffic/list',

+ 9 - 1
src/api/hisStore/store.js

@@ -126,7 +126,7 @@ export function saveStoreErpInfo(data) {
   })
 }
 
-// 一键启用店铺(含资质证书有效期验证)
+// 一键启用店铺(含资质证书有效期验证,提交审核
 export function enableStore(storeId) {
   return request({
     url: '/store/his/store/enable/' + storeId,
@@ -134,3 +134,11 @@ export function enableStore(storeId) {
   })
 }
 
+// 一键停用店铺(直接停用,不需审核)
+export function disableStore(storeId) {
+  return request({
+    url: '/store/his/store/disable/' + storeId,
+    method: 'put'
+  })
+}
+

+ 188 - 1
src/views/company/companyTraffic/index.vue

@@ -72,6 +72,14 @@
             @click="handleRechargeCompany(scope.row)"
             v-hasPermi="['company:traffic:charge']"
           >充值</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-minus"
+            style="color:#E6A23C"
+            @click="handleDeduct(scope.row)"
+            v-hasPermi="['company:traffic:deduct']"
+          >扣减</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -147,11 +155,60 @@
       </div>
     </el-dialog>
 
+    <!-- 流量扣减对话框 -->
+    <el-dialog title="经销商流量扣减" :visible.sync="deductOpen" width="500px" append-to-body :before-close="cancelDeduct">
+      <el-form ref="deductForm" :model="deductForm" :rules="deductRules" label-width="110px">
+        <el-form-item label="经销商名称">
+          <el-input v-model="deductForm.companyName" size="small" disabled />
+        </el-form-item>
+        <el-form-item label="当前流量余额">
+          <el-input :value="formatBalance({ balance: deductForm.currentBalance })" size="small" disabled />
+        </el-form-item>
+        <el-form-item label="扣减数值" prop="deductValue">
+          <el-input-number
+            v-model="deductForm.deductValue"
+            :min="1"
+            :max="999999999"
+            :step="1"
+            :precision="0"
+            placeholder="请输入扣减数值"
+            controls-position="right"
+            style="width: 100%"
+          />
+          <div style="color:#909399;font-size:12px;line-height:1.4;margin-top:4px;">
+            单次扣减上限:KB ≤ 1024、MB ≤ 1024、GB ≤ 1024、TB ≤ 10,超出请分次操作。
+          </div>
+        </el-form-item>
+        <el-form-item label="单位" prop="unit">
+          <el-select v-model="deductForm.unit" placeholder="请选择单位" style="width: 100%">
+            <el-option label="KB" value="KB" />
+            <el-option label="MB" value="MB" />
+            <el-option label="GB" value="GB" />
+            <el-option label="TB" value="TB" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="备注" prop="remark">
+          <el-input
+            v-model="deductForm.remark"
+            type="textarea"
+            placeholder="请输入备注(0-200字)"
+            maxlength="200"
+            show-word-limit
+            :rows="3"
+          />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitDeductForm">确 定</el-button>
+        <el-button @click="cancelDeduct">取 消</el-button>
+      </div>
+    </el-dialog>
+
   </div>
 </template>
 
 <script>
-import { listTrafficRecords, rechargeTraffic, trafficConversion } from '@/api/company/traffic'
+import { listTrafficRecords, rechargeTraffic, trafficConversion, deductTraffic } from '@/api/company/traffic'
 import { allList } from '@/api/company/company'
 import { resetForm } from '@/utils/common'
 import { delAdIqiyiAccount } from '@/api/ad/AdIqiyiAccount'
@@ -179,6 +236,8 @@ export default {
       rechargeTitle: "",
       // 是否显示充值弹出层
       rechargeOpen: false,
+      // 是否显示扣减弹出层
+      deductOpen: false,
       // 公司搜索相关
       companySearchLoading: false,
       companyOptions: [],
@@ -200,6 +259,15 @@ export default {
         chargeAmount: null,
         remark: null
       },
+      // 流量扣减表单参数
+      deductForm: {
+        companyId: null,
+        companyName: null,
+        currentBalance: 0,
+        deductValue: null,
+        unit: 'MB',
+        remark: null
+      },
       // 流量详情数据
       detailData: {},
       // 表单校验(保持不变)
@@ -211,6 +279,19 @@ export default {
           { required: true, message: "充值金额不能为空", trigger: "blur" },
           { type: "number", min: 1, message: "充值金额必须大于0", trigger: "blur" }
         ]
+      },
+      // 扣减表单校验
+      deductRules: {
+        deductValue: [
+          { required: true, message: "扣减数值不能为空", trigger: "blur" },
+          { type: "number", min: 1, message: "扣减数值必须大于0", trigger: "blur" }
+        ],
+        unit: [
+          { required: true, message: "请选择单位", trigger: "change" }
+        ],
+        remark: [
+          { max: 200, message: "备注最多 200 个字", trigger: "blur" }
+        ]
       }
     };
   },
@@ -369,6 +450,112 @@ export default {
       this.rechargeOpen = false;
       this.resetForm("rechargeForm");
       this.rechargeForm = {};
+    },
+
+    /** 打开扣减弹窗 */
+    handleDeduct(row) {
+      this.deductForm = {
+        companyId: row.companyId,
+        companyName: row.companyName,
+        currentBalance: row.balance || 0,
+        deductValue: null,
+        unit: 'MB',
+        remark: null
+      };
+      this.deductOpen = true;
+      this.$nextTick(() => {
+        if (this.$refs.deductForm) {
+          this.$refs.deductForm.clearValidate();
+        }
+      });
+    },
+
+    /** 取消扣减 */
+    cancelDeduct() {
+      this.deductOpen = false;
+      this.deductForm = {
+        companyId: null,
+        companyName: null,
+        currentBalance: 0,
+        deductValue: null,
+        unit: 'MB',
+        remark: null
+      };
+      if (this.$refs.deductForm) {
+        this.$refs.deductForm.resetFields();
+      }
+    },
+
+    /** 扣减数值转 KB */
+    convertToKB(value, unit) {
+      let ratio = 0;
+      switch (unit) {
+        case 'KB': ratio = 1; break;
+        case 'MB': ratio = 1024; break;
+        case 'GB': ratio = 1024 * 1024; break;
+        case 'TB': ratio = 1024 * 1024 * 1024; break;
+        default: ratio = 0;
+      }
+      return Number(value || 0) * ratio;
+    },
+
+    /** 单位上限 */
+    getUnitLimit(unit) {
+      switch (unit) {
+        case 'KB': return 1024;
+        case 'MB': return 1024;
+        case 'GB': return 1024;
+        case 'TB': return 10;
+        default: return 0;
+      }
+    },
+
+    /** 提交扣减 */
+    submitDeductForm() {
+      this.$refs["deductForm"].validate(valid => {
+        if (!valid) return;
+        const value = Number(this.deductForm.deductValue || 0);
+        const unit = this.deductForm.unit;
+        const limit = this.getUnitLimit(unit);
+        if (limit <= 0) {
+          this.msgError("非法的扣减单位");
+          return;
+        }
+        if (value > limit) {
+          this.msgError(`单次扣减数值不能超过 ${limit} ${unit}`);
+          return;
+        }
+        const deductKB = this.convertToKB(value, unit);
+        if (deductKB <= 0) {
+          this.msgError("扣减数值必须大于0");
+          return;
+        }
+        if (deductKB > Number(this.deductForm.currentBalance || 0)) {
+          this.msgError("扣减流量超过当前余额");
+          return;
+        }
+        this.$confirm(
+          '确定要从 [' + this.deductForm.companyName + '] 扣减 '
+            + this.deductForm.deductValue + ' ' + this.deductForm.unit + ' 流量吗?',
+          '提示',
+          { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }
+        ).then(() => {
+          return deductTraffic({
+            companyId: this.deductForm.companyId,
+            deductValue: this.deductForm.deductValue,
+            unit: this.deductForm.unit,
+            remark: this.deductForm.remark
+          });
+        }).then(response => {
+          if (response.code === 200) {
+            this.msgSuccess("扣减成功");
+            this.deductOpen = false;
+            this.getList();
+          } else {
+            this.msgError(response.msg);
+          }
+        }).catch(() => {});
+      });
     }
   }
 };

+ 5 - 0
src/views/course/complaintChannel/index.vue

@@ -67,6 +67,7 @@
           size="mini"
           :loading="exportLoading"
           @click="handleExport"
+          v-hasPermi="['course:complaintChannel:export']"
         >导出</el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" />
@@ -114,6 +115,7 @@
             size="mini"
             type="text"
             icon="el-icon-view"
+            v-hasPermi="['course:complaintChannel:query']"
             @click="handleDetail(scope.row)"
           >详情</el-button>
           <el-button
@@ -122,11 +124,13 @@
             icon="el-icon-check"
             @click="handleComplete(scope.row)"
             v-if="scope.row.isCompleted !== 1"
+            v-hasPermi="['course:complaintChannel:edit']"
           >完成</el-button>
           <el-button
             size="mini"
             type="text"
             icon="el-icon-delete"
+            v-hasPermi="['course:complaintChannel:remove']"
             @click="handleDelete(scope.row)"
           >删除</el-button>
         </template>
@@ -240,6 +244,7 @@
                           size="mini"
                           icon="el-icon-delete"
                           style="color: #f56c6c; margin-left: 10px;"
+                          v-hasPermi="['course:complaintChannel:remove']"
                           @click="handleDelMsg(msg)"
                         >删除</el-button>
                       </div>

+ 50 - 3
src/views/hisStore/store/index.vue

@@ -172,6 +172,17 @@
           v-hasPermi="['his:store:edit']"
         >一键启用</el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          icon="el-icon-video-pause"
+          size="mini"
+          :loading="disableLoading"
+          :disabled="multiple"
+          @click="handleDisable"
+          v-hasPermi="['his:store:edit']"
+        >一键停用</el-button>
+      </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
@@ -1212,7 +1223,7 @@
 </template>
 
 <script>
-import { listStore, getStore, delStore, addStore, updateStore, exportStore, refreshPasWod,exportFsStream, businessLicenseCheck, getStoreErpInfo, saveStoreErpInfo, enableStore} from '@/api/hisStore/store'
+import { listStore, getStore, delStore, addStore, updateStore, exportStore, refreshPasWod,exportFsStream, businessLicenseCheck, getStoreErpInfo, saveStoreErpInfo, enableStore, disableStore} from '@/api/hisStore/store'
 import storeDetails from '../components/storeDetails.vue';
 import StoreDialog from '../components/StoreDialog.vue';
 import {getCitys} from "@/api/store/city";
@@ -1297,6 +1308,7 @@ export default {
       // 导出遮罩层
       exportLoading: false,
       enableLoading: false,
+            disableLoading: false,
       originalForm: null,
       excludedFields: [
         'storeId', 'createTime', 'updateTime',
@@ -2203,7 +2215,7 @@ export default {
         .filter(s => storeIds.includes(s.storeId))
         .map(s => s.storeName)
         .join('、')
-      this.$confirm(`确认一键启用以下店铺吗?<br/>${storeNames}`, '一键启用', {
+      this.$confirm(`确认一键启用以下店铺吗?启用后需等待管理员审核。<br/>${storeNames}`, '一键启用', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning',
@@ -2218,7 +2230,7 @@ export default {
             const msgs = failures.map(f => f.msg).join('<br/>')
             this.$message({ dangerouslyUseHTMLString: true, message: msgs, type: 'error', duration: 5000 })
           } else {
-            this.$message.success('全部启用成功')
+            this.$message.success('已提交审核,请等待管理员审核通过')
           }
           this.getList()
         }).catch(() => {
@@ -2227,6 +2239,41 @@ export default {
         })
       }).catch(() => {})
     },
+    /** 一键停用店铺 */
+    handleDisable() {
+      const storeIds = this.ids
+      if (storeIds.length === 0) {
+        this.$message.warning('请选择要停用的店铺')
+        return
+      }
+      const storeNames = this.storeList
+        .filter(s => storeIds.includes(s.storeId))
+        .map(s => s.storeName)
+        .join('、')
+      this.$confirm(`确认一键停用以下店铺吗?停用后店铺将无法进行业务操作。<br/>${storeNames}`, '一键停用', {
+        confirmButtonText: '确定停用',
+        cancelButtonText: '取消',
+        type: 'warning',
+        dangerouslyUseHTMLString: true
+      }).then(() => {
+        this.disableLoading = true
+        const promises = storeIds.map(id => disableStore(id))
+        Promise.all(promises).then(responses => {
+          this.disableLoading = false
+          const failures = responses.filter(r => r.code !== 200)
+          if (failures.length > 0) {
+            const msgs = failures.map(f => f.msg).join('<br/>')
+            this.$message({ dangerouslyUseHTMLString: true, message: msgs, type: 'error', duration: 5000 })
+          } else {
+            this.$message.success('停用成功')
+          }
+          this.getList()
+        }).catch(() => {
+          this.disableLoading = false
+          this.getList()
+        })
+      }).catch(() => {})
+    },
     /** 设置ERP店铺信息按钮 */
     handleErpInfo(row) {
       this.erpForm = {