浏览代码

钱包管理

chen 3 年之前
父节点
当前提交
ddce6bdf07
共有 3 个文件被更改,包括 273 次插入0 次删除
  1. 26 0
      src/api/basic_data/wallet_list.js
  2. 5 0
      src/views/basic_data/wallet.vue
  3. 242 0
      src/views/basic_data/wallet/wallet_list.vue

+ 26 - 0
src/api/basic_data/wallet_list.js

@@ -0,0 +1,26 @@
+import request from '@/utils/request'
+
+//钱包列表(非返利钱包)
+export function getWalletList(params) {
+  return request({
+    url: '/wallet/list',
+    method: 'get',
+    params
+  })
+}
+//产品品类列表
+export function getProductCategory(params) {
+  return request({
+    url: '/product-category/list',
+    method: 'get',
+    params
+  })
+}
+//绑定品类
+export function getWalletBiandMain(params) {
+  return request({
+    url: '/wallet/bindMain',
+    method: 'post',
+    params
+  })
+}

+ 5 - 0
src/views/basic_data/wallet.vue

@@ -0,0 +1,5 @@
+<template>
+  <div>
+    <router-view />
+  </div>
+</template>

+ 242 - 0
src/views/basic_data/wallet/wallet_list.vue

@@ -0,0 +1,242 @@
+<template>
+  <div class="app-container">
+    <!-- 筛选条件 -->
+    <div>
+      <el-form
+        ref="searchForm"
+        :model="searchForm"
+        label-width="100px"
+        size="small"
+        label-position="left"
+      >
+        <el-row :gutter="20">
+          <el-col :xs="24" :sm="12" :lg="6">
+            <el-form-item label="名称" prop="walletName">
+              <el-input
+                v-model="searchForm.walletName"
+                placeholder="请输入"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :xs="24" :sm="12" :lg="6">
+            <el-form-item label="产品大类" prop="mainId">
+              <el-input
+                v-model="searchForm.mainId"
+                placeholder="请输入"
+              ></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :xs="24" :sm="12" :lg="12" class="tr">
+            <el-form-item label="">
+              <el-button size="small">清空</el-button>
+              <el-button size="small" type="primary" @click="searchFn"
+                >搜索</el-button
+              >
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+    </div>
+    <!-- 按钮 -->
+    <div class="btn-group clearfix">
+      <div class="fl">
+        <el-button type="primary" size="small">更新</el-button>
+      </div>
+      <div class="fr">
+        <el-button type="primary" size="small">导出</el-button>
+      </div>
+    </div>
+    <!-- 列表 -->
+    <div class="mymain-container">
+      <div class="table">
+        <el-table
+          v-loading="listLoading"
+          :data="dataList"
+          element-loading-text="Loading"
+          border
+          fit
+          highlight-current-row
+          stripe
+        >
+          <el-table-column
+            align="center"
+            label="编码"
+            prop="number"
+            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="mainName"
+            min-width="160"
+            show-overflow-tooltip
+          ></el-table-column>
+
+          <el-table-column
+            align="center"
+            label="操作"
+            prop="caozuo"
+            min-width="160"
+            show-overflow-tooltip
+          >
+            <template slot-scope="scope"
+              ><el-button
+                type="text"
+                class="textColor"
+                @click="setFn(scope.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" :model="addForm" label-width="120px">
+        <el-form-item label="现金钱包名称" prop="customerId">
+          <el-input disabled v-model="addForm.name"></el-input>
+        </el-form-item>
+        <el-form-item label="编码" prop="customerId">
+          <el-input disabled v-model="addForm.number"></el-input>
+        </el-form-item>
+        <el-form-item label="对应产品大类" prop="customerId">
+          <el-select v-model="addForm.mainId" placeholder="名称">
+            <el-option
+              v-for="item in categoryList"
+              :key="item.productCategoryNumber"
+              :label="item.productCategoryName"
+              :value="item.productCategoryNumber"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="折让钱包" prop="customerId">
+          <el-radio-group v-model="addForm.isZr">
+            <el-radio :label="true">是</el-radio>
+            <el-radio :label="false">否</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item label="是否使用返利" prop="customerId">
+          <el-radio-group v-model="addForm.isRebate">
+            <el-radio :label="true">是</el-radio>
+            <el-radio :label="false">否</el-radio>
+          </el-radio-group>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="cancelFn">取 消</el-button>
+        <el-button type="primary" @click="btnOK">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {
+  getWalletList,
+  getProductCategory,
+  getWalletBiandMain,
+} from "@/api/basic_data/wallet_list";
+export default {
+  data() {
+    return {
+      listLoading: false, // 列表加载loading
+      searchForm: {
+        walletName: "",
+        mainId: "",
+      },
+      listTotal: 0, // 列表总数
+      dataList: [],
+      dialogForm: false,
+      categoryList: [],
+      addForm: {
+        id: "",
+        isRebate: null,
+        isZr: null,
+        mainId: "",
+        mainName: "",
+        name: "",
+        number: "",
+      },
+      walletId: null, //钱包ID
+    };
+  },
+  created() {
+    this.getDataList();
+    this.getCategoryList();
+  },
+  methods: {
+    //确定
+    async btnOK() {
+      console.log(this.addForm);
+      console.log(this.categoryList);
+      const res = this.categoryList.filter(
+        (v) => v.productCategoryNumber == this.addForm.mainId
+      );
+
+      let data = {
+        id: this.walletId,
+        isRebate: this.addForm.isRebate,
+        isZr: this.addForm.isZr,
+        mainId: this.addForm.mainId,
+        mainName: res[0].productCategoryName,
+      };
+      await getWalletBiandMain(data);
+      this.addForm.isRebate = null;
+      this.addForm.isZr = null;
+      this.addForm.mainId = "";
+      this.getDataList();
+      this.$message.success("设置成功");
+      this.dialogForm = false;
+    },
+    //取消
+    cancelFn() {
+      this.addForm.isRebate = null;
+      this.addForm.isZr = null;
+      this.addForm.mainId = "";
+      this.dialogForm = false;
+    },
+    //搜索
+    searchFn() {
+      this.getDataList({ ...this.searchForm });
+    },
+    //获取产品品类列表
+    async getCategoryList() {
+      const res = await getProductCategory();
+      this.categoryList = res.data;
+    },
+    //设置产品大类
+    setFn(value) {
+      console.log(value);
+      this.walletId = value.id;
+      this.addForm.name = value.name;
+      this.addForm.number = value.number;
+      this.dialogForm = true;
+    },
+    //获取列表数据
+    async getDataList(data) {
+      const res = await getWalletList(data);
+      this.dataList = res.data;
+    },
+  },
+};
+</script>
+
+<style>
+</style>