重构:补货额度管理重构

This commit is contained in:
wuhui_zzw 2024-06-04 17:02:23 +08:00
parent 19964f6528
commit 3e497356ac
2 changed files with 67 additions and 26 deletions

View File

@ -379,6 +379,10 @@ export function marginPaymentApi(id) {
export function marginDeductionForm(id) {
return request.get(`margin/set/${id}/form`)
}
// 商户补货额度 - 列表
export function merQuotaList(data) {
return request.post('system/merchant/quota/list', data)
}
// 商户补货额度 - 变更
export function merQuotaChange(data) {
return request.post('system/merchant/quota/change', data)

View File

@ -1,5 +1,5 @@
<template>
<div class="divBox" :loading="loading">
<div class="divBox">
<!--主要内容-->
<el-card class="box-card">
<!--顶部搜索-->
@ -18,9 +18,26 @@
<el-table v-loading="listLoading" :data="tableData.data" style="width: 100%" size="small" highlight-current-row class="switchTable">
<el-table-column prop="mer_id" label="ID" min-width="60" align="center"/>
<el-table-column prop="mer_name" :label="merchantTitle + '名称'" min-width="150" align="center"/>
<el-table-column prop="quota_total" label="总额度" min-width="150" align="center"/>
<el-table-column prop="quota_used" label="已使用额度" min-width="150" align="center"/>
<el-table-column prop="quota_surplus" label="剩余可用额度" min-width="150" align="center"/>
<el-table-column label="冠名品牌额度" align="center">
<el-table-column prop="title_brand_total" label="补货总量" min-width="100" align="center"/>
<el-table-column prop="title_brand_limit" label="总额度" min-width="100" align="center"/>
<el-table-column prop="title_brand_used" label="已使用" min-width="100" align="center"/>
<el-table-column label="剩余可用" min-width="100" align="center">
<template slot-scope="scope">
{{ (scope.row.title_brand_limit - scope.row.title_brand_used).toFixed(2) }}
</template>
</el-table-column>
</el-table-column>
<el-table-column label="其他品牌额度" align="center">
<el-table-column prop="other_brand_total" label="补货总量" min-width="100" align="center"/>
<el-table-column prop="other_brand_limit" label="总额度" min-width="100" align="center"/>
<el-table-column prop="other_brand_used" label="已使用" min-width="100" align="center"/>
<el-table-column label="剩余可用" min-width="100" align="center">
<template slot-scope="scope">
{{ (scope.row.other_brand_limit - scope.row.other_brand_used).toFixed(2) }}
</template>
</el-table-column>
</el-table-column>
<el-table-column label="操作" min-width="150" fixed="right" align="center">
<template slot-scope="scope">
<el-button type="text" size="small" @click="changeQuotaShow(scope.row)">额度变更</el-button>
@ -41,10 +58,14 @@
<el-radio :label="1">增加</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="变更数量" prop="change_quantity">
<el-input type="number" step="0.01" v-model="changeInfo.change_quantity" clearable maxlength="8">
<template slot="append"></template>
</el-input>
<el-form-item label="变更类型" prop="change_type" >
<el-radio-group v-model="changeInfo.quota_type">
<el-radio :label="0">冠名品牌额度</el-radio>
<el-radio :label="1">其他品牌额度</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="变更数量" prop="quantity">
<el-input type="number" step="0.01" v-model="changeInfo.quantity" clearable maxlength="8" />
</el-form-item>
</el-form>
<!-- 底部按钮 -->
@ -58,15 +79,21 @@
<!--列表-->
<el-table v-loading="recordLoading" :data="recordTableData.data" style="width: 100%" size="small" highlight-current-row class="switchTable">
<el-table-column prop="mer_id" label="ID" min-width="60" align="center"/>
<el-table-column label="变更前数量" prop="change_front" min-width="120" align="center"/>
<el-table-column label="变更类型" min-width="80" align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.change_type == 1" type="success" effect="dark">增加</el-tag>
<el-tag v-else type="danger" effect="dark">减少</el-tag>
</template>
</el-table-column>
<el-table-column label="变更前数量" prop="change_front" min-width="120" align="center"/>
<el-table-column label="变更数量" prop="change_quantity" min-width="120" align="center"/>
<el-table-column label="变更后数量" prop="change_after" min-width="120" align="center"/>
<el-table-column label="变更额度类型" min-width="80" align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.quota_type == 1" type="primary" effect="dark">其他品牌总额度</el-tag>
<el-tag v-else type="warning" effect="dark">冠名品牌总额度</el-tag>
</template>
</el-table-column>
<el-table-column label="变更来源" min-width="150" align="center">
<template slot-scope="scope">
<div v-if="scope.row.source == 0">后台手动处理</div>
@ -91,7 +118,7 @@
<script>
import {merchantTypeText} from "@/filters";
import {merchantListApi, merQuotaChange, merQuotaChangeRecord} from "@/api/merchant";
import {merQuotaList, merQuotaChange, merQuotaChangeRecord} from "@/api/merchant";
export default {
name: "MerchantQuotaList",
@ -99,13 +126,13 @@ export default {
data() {
return {
merchantTitle: '商户',
loading: false,
listLoading: true,
//
tableFrom: {
page: 1,
limit: 10,
merchant_type: '',// 0=1=2=3=4=5=6=7=
keyword: '',
},
//
tableData: {
@ -117,10 +144,11 @@ export default {
changeQuotaDiaLogStatus: false,
changeInfo: {
change_type: 1,// 0=1=
change_quantity: '',//
quota_type: 0,// 0=1=
quantity: '',//
},
changeInfoRules: {
change_quantity: [
quantity: [
{
required: true, validator: function (rule, value, callback) {
if (Number(value) <= 0) {
@ -167,7 +195,7 @@ export default {
getList(num) {
this.listLoading = true;
this.tableFrom.page = num ? num : this.tableFrom.page;
merchantListApi(this.tableFrom).then(res => {
merQuotaList(this.tableFrom).then(res => {
this.tableData.data = res.data.list;
this.tableData.total = res.data.count;
this.listLoading = false;
@ -200,17 +228,24 @@ export default {
//
_this.$refs['changeInfoFrom'].validate(valid => {
if (valid) {
_this.loading = true;
console.log('提交信息', changeInfo)
merQuotaChange(changeInfo).then(res => {
_this.getList('');
_this.loading = false;
_this.$message.success(res.message);
_this.changeQuotaClose();
}).catch(res => {
_this.loading = false;
_this.$message.error(res.message);
});
//
let changeTypeText = changeInfo.change_type == 1 ? '增加' : '减少';
let quotaType = changeInfo.quota_type == 0 ? '冠名品牌' : '其他品牌';
let tips = '是否确认'+ changeTypeText +'当前' + _this.merchantTitle + quotaType + '补货总额度';
this.$confirm(tips, '提示', {
confirmButtonText: '确认' + changeTypeText,
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
merQuotaChange(changeInfo).then(res => {
_this.getList('');
_this.$message.success(res.message);
_this.changeQuotaClose();
}).catch(res => {
_this.loading = false;
_this.$message.error(res.message);
});
}).catch(() => {});
}
});
},
@ -253,5 +288,7 @@ export default {
</script>
<style scoped lang="scss">
/deep/ .cell{
padding: 0!important;
}
</style>