|
@@ -73,6 +73,17 @@
|
|
|
v-hasPermi="['merchantAppConfig:merchantAppConfig:add']"
|
|
v-hasPermi="['merchantAppConfig:merchantAppConfig:add']"
|
|
|
>新增</el-button>
|
|
>新增</el-button>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
|
|
+ <el-col :span="1.5">
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ icon="el-icon-link"
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ :disabled="multiple"
|
|
|
|
|
+ :loading="batchBindLoading"
|
|
|
|
|
+ @click="handleBatchBindMiniProgram"
|
|
|
|
|
+ v-hasPermi="['course:playSourceConfig:bind']"
|
|
|
|
|
+ >{{ batchBindButtonText }}</el-button>
|
|
|
|
|
+ </el-col>
|
|
|
<!-- <el-col :span="1.5">-->
|
|
<!-- <el-col :span="1.5">-->
|
|
|
<!-- <el-button-->
|
|
<!-- <el-button-->
|
|
|
<!-- type="success"-->
|
|
<!-- type="success"-->
|
|
@@ -109,8 +120,8 @@
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
|
|
|
|
|
- <el-table border v-loading="loading" :data="merchantAppConfigList" @selection-change="handleSelectionChange">
|
|
|
|
|
-<!-- <el-table-column type="selection" width="55" align="center" />-->
|
|
|
|
|
|
|
+ <el-table ref="merchantAppConfigTable" border v-loading="loading" :data="merchantAppConfigList" @selection-change="handleSelectionChange">
|
|
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
<el-table-column label="主键ID" align="center" prop="id" />
|
|
<el-table-column label="主键ID" align="center" prop="id" />
|
|
|
<el-table-column label="商户号" align="center" prop="merchantId" />
|
|
<el-table-column label="商户号" align="center" prop="merchantId" />
|
|
|
<el-table-column label="商户类型" align="center" prop="merchantType">
|
|
<el-table-column label="商户类型" align="center" prop="merchantType">
|
|
@@ -330,17 +341,19 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
-import { listMerchantAppConfig, getMerchantAppConfig, delMerchantAppConfig, addMerchantAppConfig, updateMerchantAppConfig, exportMerchantAppConfig } from "@/api/merchantAppConfig/merchantAppConfig";
|
|
|
|
|
|
|
+import { listMerchantAppConfig, getMerchantAppConfig, delMerchantAppConfig, addMerchantAppConfig, updateMerchantAppConfig, exportMerchantAppConfig, batchBindMiniProgram } from "@/api/merchantAppConfig/merchantAppConfig";
|
|
|
import { listAll } from "@/api/course/coursePlaySourceConfig";
|
|
import { listAll } from "@/api/course/coursePlaySourceConfig";
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: "MerchantAppConfig",
|
|
name: "MerchantAppConfig",
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
- // 遮罩层
|
|
|
|
|
|
|
+ // 遭罩层
|
|
|
loading: true,
|
|
loading: true,
|
|
|
- // 导出遮罩层
|
|
|
|
|
|
|
+ // 导出遭罩层
|
|
|
exportLoading: false,
|
|
exportLoading: false,
|
|
|
|
|
+ // 批量绑定加载状态
|
|
|
|
|
+ batchBindLoading: false,
|
|
|
// 选中数组
|
|
// 选中数组
|
|
|
ids: [],
|
|
ids: [],
|
|
|
// 非单个禁用
|
|
// 非单个禁用
|
|
@@ -408,6 +421,18 @@ export default {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
|
|
+ computed: {
|
|
|
|
|
+ // 批量绑定按钮文案
|
|
|
|
|
+ batchBindButtonText() {
|
|
|
|
|
+ if (this.batchBindLoading) {
|
|
|
|
|
+ return '绑定中...';
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.ids && this.ids.length > 0) {
|
|
|
|
|
+ return `批量绑定小程序(${this.ids.length})`;
|
|
|
|
|
+ }
|
|
|
|
|
+ return '批量绑定小程序';
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
created() {
|
|
created() {
|
|
|
|
|
|
|
|
this.getDicts("sys_normal_disable").then(response => {
|
|
this.getDicts("sys_normal_disable").then(response => {
|
|
@@ -732,6 +757,72 @@ export default {
|
|
|
this.download(response.msg);
|
|
this.download(response.msg);
|
|
|
this.exportLoading = false;
|
|
this.exportLoading = false;
|
|
|
}).catch(() => {});
|
|
}).catch(() => {});
|
|
|
|
|
+ },
|
|
|
|
|
+ /** 批量绑定小程序 */
|
|
|
|
|
+ handleBatchBindMiniProgram() {
|
|
|
|
|
+ // 1. 检查是否有选中的记录
|
|
|
|
|
+ if (!this.ids || this.ids.length === 0) {
|
|
|
|
|
+ this.$message.warning('请先选择商户配置');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 2. 显示确认对话框
|
|
|
|
|
+ this.$confirm(
|
|
|
|
|
+ `确定要将选中的 ${this.ids.length} 个商户配置绑定到对应的小程序吗?系统将自动查找匹配的小程序进行绑定。`,
|
|
|
|
|
+ '批量绑定确认',
|
|
|
|
|
+ {
|
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
|
+ type: 'warning'
|
|
|
|
|
+ }
|
|
|
|
|
+ ).then(() => {
|
|
|
|
|
+ // 3. 显示loading状态
|
|
|
|
|
+ this.batchBindLoading = true;
|
|
|
|
|
+ // 4. 调用后端接口
|
|
|
|
|
+ return batchBindMiniProgram(this.ids);
|
|
|
|
|
+ }).then(response => {
|
|
|
|
|
+ // 5. 成功处理:显示详细的绑定结果
|
|
|
|
|
+ this.batchBindLoading = false;
|
|
|
|
|
+
|
|
|
|
|
+ // 使用后端返回的详细消息
|
|
|
|
|
+ const message = response.msg || '绑定成功';
|
|
|
|
|
+
|
|
|
|
|
+ // 根据返回的code判断是否完全成功
|
|
|
|
|
+ if (response.code === 200) {
|
|
|
|
|
+ this.$message({
|
|
|
|
|
+ type: 'success',
|
|
|
|
|
+ message: message,
|
|
|
|
|
+ duration: 5000,
|
|
|
|
|
+ showClose: true
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 部分成功或其他情况
|
|
|
|
|
+ this.$message({
|
|
|
|
|
+ type: 'warning',
|
|
|
|
|
+ message: message,
|
|
|
|
|
+ duration: 5000,
|
|
|
|
|
+ showClose: true
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 刷新列表
|
|
|
|
|
+ this.getList();
|
|
|
|
|
+ // 清空勾选
|
|
|
|
|
+ this.$refs.merchantAppConfigTable && this.$refs.merchantAppConfigTable.clearSelection();
|
|
|
|
|
+ }).catch(error => {
|
|
|
|
|
+ // 6. 失败处理:显示详细的失败原因
|
|
|
|
|
+ this.batchBindLoading = false;
|
|
|
|
|
+
|
|
|
|
|
+ // 如果有错误信息,显示详细的失败原因
|
|
|
|
|
+ if (error && error.msg) {
|
|
|
|
|
+ this.$message({
|
|
|
|
|
+ type: 'error',
|
|
|
|
|
+ message: error.msg,
|
|
|
|
|
+ duration: 5000,
|
|
|
|
|
+ showClose: true
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|