123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601 |
- <template>
- <div class="app-container" style="padding-top: 5px;">
- <!--固态等级-->
- <p style="margin: 5px"><span class="textlineHeader">固定等级</span>
- <el-button class="settingButton" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['customer:setting:add']" >添加固定等级</el-button>
- </p>
- <div class="cutLine firstLine"></div>
- <el-table v-loading="loading" :data="settingList" >
- <el-table-column label="id" align="center" prop="id" v-if="false"/>
- <el-table-column label="油品名称" align="center" prop="oilName" />
- <el-table-column label="等级名称" align="center" prop="grade" />
- <el-table-column label="优惠方式" align="center" prop="discountWay" />
- <el-table-column label="会员条件" align="center" >
- <template slot-scope="scope">
- {{scope.row.memberConditStart}} - {{scope.row.memberConditEnd}}
- </template>
- </el-table-column>
- <el-table-column label="优惠/L" align="center" prop="gasoilDiscountLitre" />
- <el-table-column label="初始值" align="center" v-if="false" prop="memberConditStart" />
- <el-table-column label="结束值" align="center" v-if="false" prop="memberConditEnd" />
- <!-- <el-table-column label="柴油优惠/L" align="center" prop="dieseloilDiscountLitre" />-->
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="handleUpdate(scope.row)"
- v-hasPermi="['customer:setting:edit']"
- >修改</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-delete"
- @click="handleDelete(scope.row)"
- v-hasPermi="['customer:setting:remove']"
- >删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <!-- 添加或修改客户优惠等级设置对话框 -->
- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
- <el-form ref="form" :model="form" :rules="rules" label-width="90px">
- <el-form-item label="油站名称" prop="stationId">
- <el-select v-model="form.stationId"
- placeholder="请选择油站"
- clearable
- size="small"
- @change="onInstitutionChang"
- >
- <el-option
- v-for="item in stationOptions"
- :key="item.deptId"
- :label="item.deptName"
- :value="item.deptId"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="油站名称" v-show="false" prop="stationName" >
- <el-input v-model="form.stationName" placeholder="请输入油站名称" />
- </el-form-item>
- <el-form-item label="油品名称" prop="oilName">
- <el-select v-model="form.oilName" placeholder="油品名称" clearable size="small">
- <el-option
- v-for="dict in oilNameOptions"
- :key="dict.dictLabel"
- :label="dict.dictLabel"
- :value="dict.dictLabel"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="等级" prop="grade">
- <el-input v-model="form.grade" placeholder="请输入等级" />
- </el-form-item>
- <el-form-item label="优惠方式" prop="discountWay" v-show="false">
- <el-input v-model="form.discountWay" placeholder="请输入优惠方式" />
- </el-form-item>
- <el-form-item label="会员条件" >
- 初始值
- <el-input-number v-model="form.memberConditStart" size="mini" :min="0" />
- 终止值
- <el-input-number v-model="form.memberConditEnd" size="mini" :min="0" />
- </el-form-item>
- <el-form-item label="优惠/L" prop="gasoilDiscountLitre">
- <el-input v-model="form.gasoilDiscountLitre" placeholder="请输入汽油优惠/L" />
- </el-form-item>
- <!-- <el-form-item label="柴油优惠/L" prop="dieseloilDiscountLitre">-->
- <!-- <el-input v-model="form.dieseloilDiscountLitre" placeholder="请输入柴油优惠/L" />-->
- <!-- </el-form-item>-->
- <el-form-item label="类型" v-show="false" prop="growthValue">
- <el-input v-model="form.gradeType" value="1" />
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitForm">确 定</el-button>
- <el-button @click="cancel">取 消</el-button>
- </div>
- </el-dialog>
- <!--成长规则-->
- <!-- <p style="margin-left: 5px; margin-top: 25px; margin-bottom: 5px;">
- <span class="textlineHeader">成长规则</span>
- <el-button icon="el-icon-plus" size="mini" @click="handleAddGrouthRules" class="settingButton">添加成长规则</el-button>
- </p>
- <div class="cutLine secLine"></div>
- <el-table v-loading="loading" :data="grouthRuleList" >
- <el-table-column label="id" align="center" prop="id" v-if="false" />
- <el-table-column label="成长规则名称" align="center" prop="grouthValueName" />
- <el-table-column label="消费值" align="center" prop="grouthValueConsume" />
- <el-table-column label="成长值" align="center" prop="grouthValue" />
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
- <template slot-scope="scope2">
- <el-button
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="grouthRuleUpdate(scope2.row)"
- >修改</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-delete"
- @click="grouthRuleDelete(scope2.row)"
- >删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <!–添加或修改成长规则–>
- <el-dialog :title="title" :visible.sync="openGrouthRule" width="500px" append-to-body>
- <el-form ref="formGrouthRule" :model="formGrouthRule" :rules="grouthRules" label-width="100px">
- <el-form-item label="成长规则名称" prop="grouthValueName">
- <el-input v-model="formGrouthRule.grouthValueName" placeholder="请输入成长规则名称" />
- </el-form-item>
- <el-form-item label="消费值" prop="grouthValueConsume">
- <el-input v-model="formGrouthRule.grouthValueConsume" onkeyup="value=value.replace(/[^\d]/g,'')" placeholder="请输入消费值" />
- </el-form-item>
- <el-form-item label="成长值" prop="grouthValue">
- <el-input v-model="formGrouthRule.grouthValue" onkeyup="value=value.replace(/[^\d]/g,'')" placeholder="请输入成长值" />
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitFormGrouthRule">确 定</el-button>
- <el-button @click="cancelGrouthRule">取 消</el-button>
- </div>
- </el-dialog>
- <!–动态等级–>
- <p style="margin-left: 5px; margin-top: 25px; margin-bottom: 5px;"><span class="textlineHeader">动态等级</span>
- <el-button class="settingButton" icon="el-icon-plus" size="mini" @click="handleAddDT" v-hasPermi="['customer:setting:add']" >添加动态等级</el-button>
- </p>
- <div class="cutLine"></div>
- <el-table v-loading="loading" :data="DTsettingList" >
- <el-table-column label="id" align="center" prop="id" v-if="false" />
- <el-table-column label="等级名称" align="center" prop="grade" />
- <el-table-column label="成长值" align="center" prop="growthValue" />
- <el-table-column label="有效期" align="center" prop="date" width="180">
- <template slot-scope="scope1">
- <span>{{ parseTime(scope1.row.date, '{y}-{m}-{d}') }}</span>
- </template>
- </el-table-column>
- <el-table-column label="到期扣除成长值" align="center" prop="deductionGrowthValue" />
- <el-table-column label="汽油优惠/L" align="center" prop="gasoilDiscountLitre" />
- <el-table-column label="柴油优惠/L" align="center" prop="dieseloilDiscountLitre" />
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
- <template slot-scope="scope1">
- <el-button
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="handleUpdateDT(scope1.row)"
- v-hasPermi="['customer:setting:edit']"
- >修改</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-delete"
- @click="handleDeleteDT(scope1.row)"
- v-hasPermi="['customer:setting:remove']"
- >删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <!– 添加或修改动态客户优惠等级设置对话框 –>
- <el-dialog :title="title" :visible.sync="opendt" width="500px" append-to-body>
- <el-form ref="dtform" :model="dtform" :rules="dtrules" label-width="110px">
- <el-form-item label="等级" prop="grade">
- <el-input v-model="dtform.grade" placeholder="请输入等级" />
- </el-form-item>
- <el-form-item label="成长值" prop="growthValue">
- <el-input v-model="dtform.growthValue" placeholder="请输入成长值" />
- </el-form-item>
- <el-form-item label="类型" v-show="false" prop="gradeType">
- <el-input v-model="dtform.gradeType"/>
- </el-form-item>
- <el-form-item label="有效期" prop="date">
- <el-date-picker clearable size="small" style="width: 200px"
- v-model="dtform.date"
- type="date"
- value-format="yyyy-MM-dd"
- placeholder="选择有效期">
- </el-date-picker>
- </el-form-item>
- <el-form-item label="到期扣除成长值" prop="deductionGrowthValue">
- <el-input v-model="dtform.deductionGrowthValue" placeholder="请输入到期扣除成长值" />
- </el-form-item>
- <el-form-item label="汽油优惠/L" prop="gasoilDiscountLitre">
- <el-input v-model="dtform.gasoilDiscountLitre" placeholder="请输入汽油优惠/L" />
- </el-form-item>
- <el-form-item label="柴油优惠/L" prop="dieseloilDiscountLitre">
- <el-input v-model="dtform.dieseloilDiscountLitre" placeholder="请输入柴油优惠/L" />
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitFormDT">确 定</el-button>
- <el-button @click="cancelDT">取 消</el-button>
- </div>
- </el-dialog>-->
- </div>
- </template>
- <script>
- import { listSetting, getGrouthRuleList, addGrouthRule, editGrouthRule, delGrouthRule, getSetting, delSetting, addSetting, updateSetting, exportSetting } from "@/api/customer/setting";
- import {stationinfo} from "@/api/station/gun";
- export default {
- name: "Setting",
- data() {
- return {
- // 遮罩层
- loading: true,
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 客户优惠等级设置表格数据
- ruleList: [],
- grouthRuleList:[],
- settingList: [],
- DTsettingList: [],
- //下拉油品名称
- oilNameOptions:[],
- stationOptions:[],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- opendt: false,
- openGrouthRule: false,
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- grade: null,
- discountWay: null,
- gasoilDiscountLitre: null,
- dieseloilDiscountLitre: null,
- gradeType: null,
- grouthValueName: null,
- grouthValueConsume: null,
- grouthValue: null,
- // gasoilConsume: null,
- // gasoilGrowthValue: null,
- // dieseloilConsume: null,
- // dieseloilGrowthValue: null,
- date: null,
- deductionGrowthValue: null
- },// 查询参数
- selectParams: {
- pageNum: 1,
- pageSize: 10,
- grade: null,
- discountWay: null,
- gasoilDiscountLitre: null,
- dieseloilDiscountLitre: null,
- gradeType: null,
- grouthValueName: null,
- grouthValueConsume: null,
- grouthValue: null,
- // gasoilConsume: null,
- // gasoilGrowthValue: null,
- // dieseloilConsume: null,
- // dieseloilGrowthValue: null,
- date: null,
- deductionGrowthValue: null
- },
- // 表单参数
- form: {},
- formGrouthRule:{},
- dtform: {},
- ruleForm: {},
- // 表单校验
- rules: {
- },
- grouthRules: {},
- dtrules: {
- }
- };
- },
- created() {
- this.getList();
- //this.getRuleList();
- // this.getList2();
- this.getDicts("oil_name").then(response => {
- this.oilNameOptions = response.data;
- });
- stationinfo().then(response => {
- this.stationOptions = response.rows;
- });
- },
- methods: {
- /** 查询客户优惠等级设置列表 */
- getList() {
- this.queryParams.gradeType="1";
- this.loading = true;
- listSetting(this.queryParams).then(response => {
- this.settingList = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- },
- getList2() {
- this.selectParams.gradeType="3";
- this.loading = true;
- listSetting(this.selectParams).then(response => {
- this.DTsettingList = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- },
- onInstitutionChang(e){
- let obj = {};
- obj = this.stationOptions.find((item)=>{//这里的userList就是上面遍历的数据源
- return item.deptId === e;//筛选出匹配数据
- })
- this.form.stationNanme=obj.deptName;
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.reset();
- },
- // 取消按钮
- cancelDT() {
- this.opendt = false;
- this.reset();
- },
- // 表单重置
- reset() {
- this.form = {
- id: null,
- grade: null,
- discountWay: "直降",
- gasoilDiscountLitre: null,
- dieseloilDiscountLitre: null,
- gradeType: null,
- grouthValueName: null,
- grouthValueConsume: null,
- grouthValue: null,
- oilName:null,
- // gasoilConsume: null,
- // gasoilGrowthValue: null,
- // dieseloilConsume: null,
- // dieseloilGrowthValue: null,
- date: null,
- deductionGrowthValue: null
- };
- this.resetForm("form");
- //this.resetForm("formGrouthRule");
- },
- /** 新增按钮操作 */
- handleAdd() {
- this.reset();
- this.open = true;
- this.form.discountWay ="直降";
- this.title = "添加客户优惠等级设置";
- },
- /** 修改按钮操作 */
- handleUpdate(row) {
- this.reset();
- const id = row.id || this.ids
- getSetting(id).then(response => {
- this.form = response.data;
- this.open = true;
- this.title = "修改客户优惠等级设置";
- });
- },
- //查询成长规则列表
- getRuleList() {
- this.loading = true;
- getGrouthRuleList().then(response => {
- this.grouthRuleList = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- },
- //打开新增成长规则窗口
- handleAddGrouthRules(){
- //this.reset();
- this.formGrouthRule = {};
- this.openGrouthRule = true;
- this.title = "添加成长规则";
- },
- //打开修改成长规则窗口
- grouthRuleUpdate(row){
- this.reset();
- this.formGrouthRule = row;
- this.openGrouthRule = true;
- this.title = "修改成长规则";
- //const id = row.id
- // editGrouthRule(id).then(response => {
- // this.formGrouthRule = response.data;
- // this.openGrouthRule = true;
- // this.title = "修改成长规则"
- // });
- },
- //取消按钮
- cancelGrouthRule(){
- this.openGrouthRule = false;
- this.reset();
- },
- //提交新增和修改成长规则
- submitFormGrouthRule(){
- this.$refs['formGrouthRule'].validate(valid =>{
- if(valid){
- if(this.formGrouthRule.id != null){
- editGrouthRule(this.formGrouthRule).then(response =>{
- this.msgSuccess("修改成功")
- this.openGrouthRule = false;
- this.getRuleList();
- });
- }else{
- addGrouthRule(this.formGrouthRule).then(response =>{
- this.msgSuccess("新增成功");
- this.openGrouthRule =false;
- this.getRuleList();
- })
- }
- }
- });
- },
- //删除成长规则
- grouthRuleDelete(row){
- const ids = row.id || this.ids
- if(row.id !=null || this.ids != null){
- this.$confirm('是否删除该成长规则的数据项?', "警告",{
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function () {
- delGrouthRule(ids);
- }).then(() =>{
- this.msgSuccess("删除成功");
- this.getRuleList();
- })
- }
- },
- /** 新增按钮操作 */
- handleAddDT() {
- this.reset();
- this.opendt = true;
- this.title = "添加客户优惠等级设置";
- },
- /** 修改按钮操作 */
- handleUpdateDT(row) {
- this.reset();
- const id = row.id || this.ids
- getSetting(id).then(response => {
- this.dtform = response.data;
- this.opendt = true;
- this.title = "修改客户优惠等级设置";
- });
- },
- /** 提交按钮 */
- submitForm() {
- this.form.gradeType="1";
- this.$refs["form"].validate(valid => {
- if (valid) {
- if (this.form.id != null) {
- updateSetting(this.form).then(response => {
- this.msgSuccess("修改成功");
- this.open = false;
- this.getList();
- });
- } else {
- addSetting(this.form).then(response => {
- this.msgSuccess("新增成功");
- this.open = false;
- this.getList();
- });
- }
- }
- });
- },
- /** 提交按钮 */
- submitFormDT() {
- this.dtform.gradeType="3";
- this.$refs["dtform"].validate(valid => {
- if (valid) {
- if (this.dtform.id != null) {
- updateSetting(this.dtform).then(response => {
- this.msgSuccess("修改成功");
- this.opendt = false;
- this.getList2();
- });
- } else {
- addSetting(this.dtform).then(response => {
- this.msgSuccess("新增成功");
- this.opendt= false;
- this.getList2();
- });
- }
- }
- });
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- const ids = row.id || this.ids;
- this.$confirm('是否确认删除客户优惠等级设置编号为"' + ids + '"的数据项?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- return delSetting(ids);
- }).then(() => {
- this.getList();
- this.msgSuccess("删除成功");
- })
- },
- /** 删除按钮操作 */
- handleDeleteDT(row) {
- const ids = row.id || this.ids;
- this.$confirm('是否确认删除客户优惠等级设置编号为"' + ids + '"的数据项?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- return delSetting(ids);
- }).then(() => {
- this.getList2();
- this.msgSuccess("删除成功");
- })
- },
- /** 导出按钮操作 */
- handleExport() {
- const queryParams = this.queryParams;
- this.$confirm('是否确认导出所有客户优惠等级设置数据项?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- return exportSetting(queryParams);
- }).then(response => {
- this.download(response.msg);
- })
- }
- }
- };
- </script>
- <style>
- .two{
- margin-top: 30px;
- }
- .settingButton{
- border: 0px;
- float: right;
- }
- .cutLine{
- width: 65px;
- height: 2px;
- background: #71f332;
- /*margin-top: 5px;*/
- margin-left: 5px;
- margin-bottom: 20px;
- }
- .textlineHeader{
- /*margin-bottom: 20px;*/
- font-family: Bahnschrift;
- /*text-shadow: #32a9f3 1px 1px 1px;*/
- /*font-size: ;*/
- color: #32a9f3;
- }
- </style>
|