123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284 |
- <template >
- <div class="app-container">
- <el-row>
- <el-col :xs="24" :sm="12" :lg="12">
- <div class="styl">现金钱包</div>
- </el-col>
- <el-col :xs="24" :sm="12" :lg="12">
- <div class="fr">
- <el-button size="small" type="primary" @click="generateFn"
- >一键生成钱包</el-button
- >
- </div>
- </el-col>
- </el-row>
- <el-divider></el-divider>
- <!-- 列表 -->
- <div class="mymain-container">
- <div class="table">
- <el-table
- v-loading="listLoading"
- :data="walletList"
- element-loading-text="Loading"
- border
- fit
- highlight-current-row
- stripe
- >
- <el-table-column
- align="center"
- label="经销商名称"
- prop="customerName"
- min-width="160"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="钱包类型"
- prop="mainName"
- min-width="160"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="钱包"
- prop="name"
- min-width="160"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="余额"
- prop="amount"
- min-width="160"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="可用信用额度"
- prop="freeCreditAmount"
- min-width="160"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="已用信用额度"
- prop="usedCreditAmount"
- min-width="160"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="更新时间"
- prop="updateTime"
- min-width="160"
- show-overflow-tooltip
- ></el-table-column>
- </el-table>
- </div>
- </div>
- <span>返利钱包</span>
- <el-divider></el-divider>
- <!-- 列表 -->
- <div class="mymain-container">
- <div class="table">
- <el-table
- v-loading="listLoading"
- :data="rebateList"
- element-loading-text="Loading"
- border
- fit
- highlight-current-row
- stripe
- >
- <el-table-column
- align="center"
- label="经销商名称"
- prop="customerName"
- min-width="160"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="返利钱包"
- prop="name"
- min-width="160"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="返利比例"
- prop="rebateRate"
- min-width="160"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="钱包余额"
- prop="amount"
- min-width="160"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="更新时间"
- prop="updateTime"
- min-width="160"
- show-overflow-tooltip
- ></el-table-column>
- <el-table-column
- align="center"
- label="操作"
- min-width="160"
- show-overflow-tooltip
- >
- <template v-slot="{ row }">
- <el-button type="text" class="textColor" @click="editFn(row)">
- 修改
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- <!-- 弹窗 -->
- <el-dialog
- title="配置返利比例"
- :visible.sync="dialogForm"
- width="30%"
- :show-close="false"
- :close-on-click-modal="false"
- >
- <el-form
- ref="addForm"
- :rules="rules"
- :model="addForm"
- label-width="100px"
- >
- <el-form-item label="返利比例" prop="rebateRate">
- <el-input
- v-model.number="addForm.rebateRate"
- oninput="if(value>100)value=100;if(value<0)value=0"
- ><i class="el-input__icon" slot="suffix">% </i></el-input
- >
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click="cancelFn">取 消</el-button>
- <el-button type="primary" @click="determineFn">确 定</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import { mapGetters } from "vuex";
- import {
- getfinanceInit,
- getWalletRebateRateUpdate,
- } from "@/api/finance/wallet";
- import { getWalletCustomerList } from "@/api/finance/change_apply";
- export default {
- data() {
- return {
- listLoading: false, // 列表加载loading
- walletList: [],
- rebateList: [],
- addForm: {
- rebateRate: null,
- },
- dialogForm: false,
- rules: {
- rebateRate: [
- {
- required: true,
- message: "请输入返利比例",
- trigger: "blur",
- },
- ],
- },
- };
- },
- created() {
- console.log(this.$route.query.id, 11, this.customerId);
- if (this.$route.query.id) {
- this.getDataWallet({
- customerId: this.$route.query.id,
- type: "COMMONLY",
- });
- this.getDataRebate({
- customerId: this.$route.query.id,
- type: "REBATE",
- });
- } else {
- this.getDataWallet({
- customerId: this.customerId,
- type: "COMMONLY",
- });
- this.getDataRebate({
- customerId: this.customerId,
- type: "REBATE",
- });
- }
- },
- computed: {
- ...mapGetters(["customerId"]),
- },
- methods: {
- //取消
- async cancelFn() {
- this.dialogForm = false;
- await this.$refs.addForm.clearValidate();
- },
- //确定
- async determineFn() {
- await this.$refs.addForm.validate();
- const res = this.addForm.rebateRate / 100;
- this.addForm.rebateRate = res;
- await getWalletRebateRateUpdate({ ...this.addForm });
- if (this.$route.query.id) {
- this.getDataRebate({
- customerId: this.$route.query.id,
- type: "REBATE",
- });
- } else {
- this.getDataRebate({
- customerId: this.customerId,
- type: "REBATE",
- });
- }
- this.$message.success("修改成功");
- this.dialogForm = false;
- },
- //修改
- editFn(v) {
- this.addForm.customerWalletId = v.customerWalletId;
- this.addForm.rebateRate = v.rebateRate * 100;
- this.dialogForm = true;
- },
- //一键生成
- async generateFn() {
- await getfinanceInit({ customerId: this.customerId });
- this.getDataWallet();
- this.getDataRebate();
- this.$message.success("已生成");
- },
- //
- async getDataRebate(data) {
- let res = await getWalletCustomerList(data);
- this.rebateList = res.data;
- },
- async getDataWallet(data) {
- let res = await getWalletCustomerList(data);
- this.walletList = res.data;
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .styl {
- padding-top: 14px;
- }
- </style>
|