123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273 |
- <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-select
- class="selectStyle"
- filterable
- v-model="searchForm.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-col>
- <el-col :xs="24" :sm="24" :lg="12" class="tr">
- <el-form-item label="">
- <el-button size="small" @click="clearFn">清空</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" v-if="false" 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"
- v-if="$checkBtnRole('edit', $route.meta.roles)"
- @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
- class="selectStyle"
- 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,
- getWalletDetail,
- } 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;
- },
- //清空
- async clearFn() {
- await this.$refs.searchForm.resetFields();
- },
- //搜索
- searchFn() {
- this.getDataList({ ...this.searchForm });
- },
- //获取产品品类列表
- async getCategoryList() {
- const res = await getProductCategory();
- this.categoryList = res.data;
- },
- //设置产品大类
- async setFn(value) {
- console.log(value);
- this.walletId = value.id;
- // this.addForm.name = value.name;
- // this.addForm.number = value.number;
- let res = await getWalletDetail({ walletId: value.id });
- console.log(res);
- this.addForm.name = res.data.name;
- this.addForm.number = res.data.number;
- this.addForm.mainId = res.data.mainId;
- this.addForm.isRebate = res.data.isRebate;
- this.addForm.isZr = res.data.isZr;
- this.dialogForm = true;
- },
- //获取列表数据
- async getDataList(data) {
- const res = await getWalletList(data);
- this.dataList = res.data;
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .selectStyle {
- width: 100%;
- }
- </style>
|