|
@@ -24,6 +24,22 @@
|
|
|
{{ scope.row.status == 0 ? "已下线" : "上线中" }}
|
|
{{ scope.row.status == 0 ? "已下线" : "上线中" }}
|
|
|
</el-tag>
|
|
</el-tag>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
+ <template #balance="scope">
|
|
|
|
|
+ <span class="money-text primary">¥ {{ formatMoney(scope.row.balance) }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template #totalRecharge="scope">
|
|
|
|
|
+ <span class="money-text success">¥ {{ formatMoney(scope.row.totalRecharge) }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template #currentProfit="scope">
|
|
|
|
|
+ <span :class="['money-text', scope.row.currentProfit >= 0 ? 'success' : 'danger']">
|
|
|
|
|
+ {{ scope.row.currentProfit >= 0 ? '+' : '' }}¥ {{ formatMoney(scope.row.currentProfit) }}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template #totalProfit="scope">
|
|
|
|
|
+ <span :class="['money-text', scope.row.totalProfit >= 0 ? 'success' : 'danger']">
|
|
|
|
|
+ {{ scope.row.totalProfit >= 0 ? '+' : '' }}¥ {{ formatMoney(scope.row.totalProfit) }}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </template>
|
|
|
</page-content>
|
|
</page-content>
|
|
|
|
|
|
|
|
<!-- 新增 -->
|
|
<!-- 新增 -->
|
|
@@ -58,6 +74,30 @@
|
|
|
<el-button @click="dialogTableVisible = false">取消</el-button>
|
|
<el-button @click="dialogTableVisible = false">取消</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 上账/下账弹窗 -->
|
|
|
|
|
+ <el-dialog v-model="balanceDialogVisible" :title="balanceDialogType === 1 ? '上账(充值)' : '下账(扣款)'" width="500px">
|
|
|
|
|
+ <el-form ref="balanceFormRef" :model="balanceForm" :rules="balanceFormRules" label-width="100px">
|
|
|
|
|
+ <el-form-item label="企业名称">
|
|
|
|
|
+ <el-input v-model="balanceForm.firmName" disabled />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="当前余额">
|
|
|
|
|
+ <el-input v-model="balanceForm.currentBalance" disabled>
|
|
|
|
|
+ <template #suffix>元</template>
|
|
|
|
|
+ </el-input>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item :label="balanceDialogType === 1 ? '上账金额' : '下账金额'" prop="amount">
|
|
|
|
|
+ <el-input-number v-model="balanceForm.amount" :min="0.01" :precision="2" :step="100" style="width: 100%" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="备注" prop="remark">
|
|
|
|
|
+ <el-input v-model="balanceForm.remark" type="textarea" :rows="3" placeholder="请输入备注" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ <template #footer>
|
|
|
|
|
+ <el-button @click="balanceDialogVisible = false">取消</el-button>
|
|
|
|
|
+ <el-button type="primary" :loading="balanceLoading" @click="handleBalanceSubmit">确定</el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -87,6 +127,15 @@ const {
|
|
|
handleFilterChange,
|
|
handleFilterChange,
|
|
|
} = usePage();
|
|
} = usePage();
|
|
|
|
|
|
|
|
|
|
+// 金额格式化函数
|
|
|
|
|
+const formatMoney = (value: number | undefined | null): string => {
|
|
|
|
|
+ if (value === null || value === undefined) return "0.00";
|
|
|
|
|
+ return Math.abs(value).toLocaleString("zh-CN", {
|
|
|
|
|
+ minimumFractionDigits: 2,
|
|
|
|
|
+ maximumFractionDigits: 2,
|
|
|
|
|
+ });
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
// 搜索配置
|
|
// 搜索配置
|
|
|
const searchConfig: ISearchConfig = reactive({
|
|
const searchConfig: ISearchConfig = reactive({
|
|
|
permPrefix: "business:firm-info",
|
|
permPrefix: "business:firm-info",
|
|
@@ -153,23 +202,69 @@ const contentConfig: IContentConfig<FirmInfoPageQuery> = reactive({
|
|
|
cols: [
|
|
cols: [
|
|
|
{ type: "selection", width: 55, align: "center" },
|
|
{ type: "selection", width: 55, align: "center" },
|
|
|
{ label: "企业名称", prop: "name" },
|
|
{ label: "企业名称", prop: "name" },
|
|
|
- { label: "员工数", prop: "empNum" },
|
|
|
|
|
|
|
+ { label: "员工数", prop: "empNum", width: 80 },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: "当前余额",
|
|
|
|
|
+ prop: "balance",
|
|
|
|
|
+ width: 120,
|
|
|
|
|
+ templet: "custom",
|
|
|
|
|
+ slotName: "balance",
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: "累计充值",
|
|
|
|
|
+ prop: "totalRecharge",
|
|
|
|
|
+ width: 120,
|
|
|
|
|
+ templet: "custom",
|
|
|
|
|
+ slotName: "totalRecharge",
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: "当前盈利",
|
|
|
|
|
+ prop: "currentProfit",
|
|
|
|
|
+ width: 120,
|
|
|
|
|
+ templet: "custom",
|
|
|
|
|
+ slotName: "currentProfit",
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: "累计盈利",
|
|
|
|
|
+ prop: "totalProfit",
|
|
|
|
|
+ width: 120,
|
|
|
|
|
+ templet: "custom",
|
|
|
|
|
+ slotName: "totalProfit",
|
|
|
|
|
+ },
|
|
|
{
|
|
{
|
|
|
label: "状态", // 0 已下线 1 上线中
|
|
label: "状态", // 0 已下线 1 上线中
|
|
|
prop: "status",
|
|
prop: "status",
|
|
|
|
|
+ width: 90,
|
|
|
templet: "custom",
|
|
templet: "custom",
|
|
|
},
|
|
},
|
|
|
- { label: "创建时间", prop: "createTime" },
|
|
|
|
|
|
|
+ { label: "创建时间", prop: "createTime", width: 170 },
|
|
|
{
|
|
{
|
|
|
label: "操作",
|
|
label: "操作",
|
|
|
prop: "operation",
|
|
prop: "operation",
|
|
|
|
|
+ width: 280,
|
|
|
templet: "tool",
|
|
templet: "tool",
|
|
|
operat: [
|
|
operat: [
|
|
|
{
|
|
{
|
|
|
- name: "qrCode",
|
|
|
|
|
- text: "查看邀请码",
|
|
|
|
|
|
|
+ name: "recharge",
|
|
|
|
|
+ text: "上账",
|
|
|
attrs: {
|
|
attrs: {
|
|
|
type: "success",
|
|
type: "success",
|
|
|
|
|
+ icon: "Plus",
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: "deduct",
|
|
|
|
|
+ text: "下账",
|
|
|
|
|
+ attrs: {
|
|
|
|
|
+ type: "warning",
|
|
|
|
|
+ icon: "Minus",
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: "qrCode",
|
|
|
|
|
+ text: "邀请码",
|
|
|
|
|
+ attrs: {
|
|
|
|
|
+ type: "primary",
|
|
|
icon: "Setting",
|
|
icon: "Setting",
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
@@ -247,6 +342,23 @@ const editModalConfig: IModalConfig<FirmInfoForm> = reactive({
|
|
|
const dialogTableVisible = ref(false);
|
|
const dialogTableVisible = ref(false);
|
|
|
const firmId = ref();
|
|
const firmId = ref();
|
|
|
const firmName= ref();
|
|
const firmName= ref();
|
|
|
|
|
+
|
|
|
|
|
+// 上账/下账相关
|
|
|
|
|
+const balanceDialogVisible = ref(false);
|
|
|
|
|
+const balanceDialogType = ref(1); // 1-上账 2-下账
|
|
|
|
|
+const balanceLoading = ref(false);
|
|
|
|
|
+const balanceFormRef = ref();
|
|
|
|
|
+const balanceForm = reactive({
|
|
|
|
|
+ firmId: 0,
|
|
|
|
|
+ firmName: "",
|
|
|
|
|
+ currentBalance: 0,
|
|
|
|
|
+ amount: 0,
|
|
|
|
|
+ remark: "",
|
|
|
|
|
+});
|
|
|
|
|
+const balanceFormRules = {
|
|
|
|
|
+ amount: [{ required: true, message: "请输入金额", trigger: "blur" }],
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
const handleOperateClick = (data: IObject) => {
|
|
const handleOperateClick = (data: IObject) => {
|
|
|
if (data.name === "edit") {
|
|
if (data.name === "edit") {
|
|
|
handleEditClick(data.row, async () => {
|
|
handleEditClick(data.row, async () => {
|
|
@@ -258,6 +370,50 @@ const handleOperateClick = (data: IObject) => {
|
|
|
firmId.value = parseInt(data.row.id);
|
|
firmId.value = parseInt(data.row.id);
|
|
|
firmName.value = data.row.name;
|
|
firmName.value = data.row.name;
|
|
|
}
|
|
}
|
|
|
|
|
+ if (data.name === "recharge") {
|
|
|
|
|
+ balanceDialogType.value = 1;
|
|
|
|
|
+ balanceForm.firmId = data.row.id;
|
|
|
|
|
+ balanceForm.firmName = data.row.name;
|
|
|
|
|
+ balanceForm.currentBalance = data.row.balance || 0;
|
|
|
|
|
+ balanceForm.amount = 0;
|
|
|
|
|
+ balanceForm.remark = "";
|
|
|
|
|
+ balanceDialogVisible.value = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (data.name === "deduct") {
|
|
|
|
|
+ balanceDialogType.value = 2;
|
|
|
|
|
+ balanceForm.firmId = data.row.id;
|
|
|
|
|
+ balanceForm.firmName = data.row.name;
|
|
|
|
|
+ balanceForm.currentBalance = data.row.balance || 0;
|
|
|
|
|
+ balanceForm.amount = 0;
|
|
|
|
|
+ balanceForm.remark = "";
|
|
|
|
|
+ balanceDialogVisible.value = true;
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// 提交上账/下账
|
|
|
|
|
+const handleBalanceSubmit = async () => {
|
|
|
|
|
+ if (!balanceFormRef.value) return;
|
|
|
|
|
+ await balanceFormRef.value.validate(async (valid: boolean) => {
|
|
|
|
|
+ if (valid) {
|
|
|
|
|
+ balanceLoading.value = true;
|
|
|
|
|
+ try {
|
|
|
|
|
+ if (balanceDialogType.value === 1) {
|
|
|
|
|
+ await FirmInfoAPI.recharge(balanceForm.firmId, balanceForm.amount, balanceForm.remark);
|
|
|
|
|
+ ElMessage.success("上账成功");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ await FirmInfoAPI.deduct(balanceForm.firmId, balanceForm.amount, balanceForm.remark);
|
|
|
|
|
+ ElMessage.success("下账成功");
|
|
|
|
|
+ }
|
|
|
|
|
+ balanceDialogVisible.value = false;
|
|
|
|
|
+ // 刷新列表
|
|
|
|
|
+ handleQueryClick();
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error("操作失败:", error);
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ balanceLoading.value = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// 二维码海报下载
|
|
// 二维码海报下载
|
|
@@ -291,3 +447,22 @@ const handleToolbarClick = (name: string) => {
|
|
|
console.log(name);
|
|
console.log(name);
|
|
|
};
|
|
};
|
|
|
</script>
|
|
</script>
|
|
|
|
|
+
|
|
|
|
|
+<style scoped>
|
|
|
|
|
+.money-text {
|
|
|
|
|
+ font-weight: bold;
|
|
|
|
|
+ font-size: 13px;
|
|
|
|
|
+}
|
|
|
|
|
+.money-text.primary {
|
|
|
|
|
+ color: #409eff;
|
|
|
|
|
+}
|
|
|
|
|
+.money-text.success {
|
|
|
|
|
+ color: #67c23a;
|
|
|
|
|
+}
|
|
|
|
|
+.money-text.danger {
|
|
|
|
|
+ color: #f56c6c;
|
|
|
|
|
+}
|
|
|
|
|
+.money-text.warning {
|
|
|
|
|
+ color: #e6a23c;
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|