套餐分期配置页面

This commit is contained in:
邱贞招 2023-12-24 16:12:22 +08:00
parent 35936a5919
commit f7315638ff
4 changed files with 123 additions and 52 deletions

View File

@ -5,9 +5,9 @@ import request from '@/utils/request';
* @param id
* @constructor
*/
export function DelInstallments(pram) {
export function DelInstallments(id) {
const data = {
id: pram.id,
id: id,
};
return request({
url: '/admin/installments/delete',
@ -58,18 +58,12 @@ export function ListInstallments(pram) {
*/
export function AddInstallments(pram) {
const data = {
author: pram.author,
cid: pram.cid,
content: pram.content,
imageInput: pram.imageInput,
isBanner: pram.isBanner,
isHot: pram.isHot,
shareSynopsis: pram.shareSynopsis,
shareTitle: pram.shareTitle,
sort: pram.sort,
synopsis: pram.synopsis,
title: pram.title,
url: pram.url,
name: pram.name,
installmentNumber: pram.installmentNumber,
amountComesUp: pram.amountComesUp,
downPaymentPercent: pram.downPaymentPercent,
downPaymentNumber: pram.downPaymentNumber,
cycle:pram.cycle
};
return request({
url: '/admin/installments/save',
@ -85,18 +79,12 @@ export function AddInstallments(pram) {
*/
export function UpdateInstallments(pram) {
const data = {
author: pram.author,
cid: pram.cid,
content: pram.content,
imageInput: pram.imageInput,
isBanner: pram.isBanner,
isHot: pram.isHot,
shareSynopsis: pram.shareSynopsis,
shareTitle: pram.shareTitle,
sort: pram.sort,
synopsis: pram.synopsis,
title: pram.title,
url: pram.url,
name: pram.name,
installmentNumber: pram.installmentNumber,
amountComesUp: pram.amountComesUp,
downPaymentPercent: pram.downPaymentPercent,
downPaymentNumber: pram.downPaymentNumber,
cycle:pram.cycle
};
return request({
url: '/admin/installments/update',

View File

@ -423,7 +423,7 @@ export default {
return {
options: [
{
value: 2,
value: 3,
label: '全部',
},
{
@ -434,6 +434,10 @@ export default {
value: 1,
label: '视频号订单',
},
{
value: 2,
label: '分期订单',
},
],
RefuseVisible: false,
RefuseData: {},

View File

@ -7,8 +7,8 @@
:before-close="handleClose"
>
<el-form :model="user" :rules="rules" ref="user" label-width="100px" class="demo-ruleForm" v-loading="loading">
<el-form-item label="商品名称" prop="productId">
<el-input v-model="user.productId" placeholder="请输入商品名称"></el-input>
<el-form-item label="分期名称" prop="name">
<el-input v-model="user.name" placeholder="请输入分期套餐名称"></el-input>
</el-form-item>
<el-form-item label="分期数" >
<el-select v-model="user.installmentNumber" placeholder="请选择" style="width: 20%">
@ -17,13 +17,45 @@
</el-select>
<span></span>
</el-form-item>
<el-form-item label="价格" >
<el-input-number
v-model="user.price"
<el-form-item label="周期" >
<el-input-number style="width: 60%"
v-model="user.cycle"
:min="0"
:step="1"
step-strictly
placeholder="请输入首付期数"
class="selWidthd mr20"
/>
</el-form-item>
<el-form-item label="上浮比例(%)" >
<el-input style="width: 30%;float: left"
v-model="user.amountComesUpStr"
:min="0"
:step="1"
step-strictly
placeholder="请输入价格"
placeholder="请输入上浮比例"
/>
<span class="el-input-group__append">%</span>
</el-form-item>
<el-form-item label="首付比例(%)" >
<el-input style="width: 30%;float: left"
v-model="user.downPaymentPercentStr"
:min="0"
:step="1"
step-strictly
placeholder="请输入首付比例"
/>
<span class="el-input-group__append">%</span>
</el-form-item>
<el-form-item label="首付期数" >
<el-input-number style="width: 60%"
v-model="user.downPaymentNumber"
:min="0"
:step="1"
step-strictly
placeholder="请输入首付期数"
class="selWidthd mr20"
/>
</el-form-item>
@ -34,7 +66,7 @@
<el-button
type="primary"
@click="submitForm('formValidate')"
v-hasPermi="['admin:system:user:level:update', 'admin:system:user:level:save']"
v-hasPermi="['admin:setting:update', 'admin:setting:save']"
> </el-button
>
</span>
@ -42,7 +74,7 @@
</template>
<script>
import { levelSaveApi, levelInfoApi, levelUpdateApi } from '@/api/user';
import { AddInstallments,UpdateInstallments} from '@/api/setting1';
import { Debounce } from '@/utils/validate';
const obj = {
name: '',
@ -72,7 +104,7 @@ export default {
formValidate: Object.assign({}, obj),
loading: false,
rules: {
productId: [{ required: true, message: '请输入商品名称', trigger: 'blur' }],
name: [{ required: true, message: '请输入分期套餐名称', trigger: 'blur' }],
// grade: [
// { required: true, message: '', trigger: 'blur' },
// { type: 'number', message: '' },
@ -88,6 +120,13 @@ export default {
};
},
methods: {
formatPercentage(value) {
if(value == "0.00" || value == "0.0" || value == "0" || value == 0 || value == null){
return "-";
}else {
return (value * 100).toFixed(2) + '%';
}
},
//
modalPicTap(tit, num) {
const _this = this;
@ -122,17 +161,20 @@ export default {
this.$refs.user.validate((valid) => {
if (valid) {
this.loading = true;
this.user.amountComesUp = (this.user.amountComesUpStr)/100;
this.user.downPaymentPercent = (this.user.downPaymentPercentStr)/100;
console.log("----------- "+JSON.stringify(this.user));
let data = {
discount: this.user.discount,
experience: this.user.experience,
grade: this.user.grade,
icon: this.user.icon,
id: this.user.id,
isShow: this.user.isShow,
name: this.user.name,
installmentNumber: this.user.installmentNumber,
amountComesUp: (this.user.amountComesUpStr)/100,
downPaymentPercent: (this.user.downPaymentPercentStr)/100,
downPaymentNumber: this.user.downPaymentNumber,
cycle: this.user.cycle,
id: this.user.id
};
this.user.id
? levelUpdateApi(this.user.id, data)
? UpdateInstallments(data)
.then((res) => {
this.$message.success('编辑成功');
this.loading = false;
@ -143,7 +185,7 @@ export default {
.catch(() => {
this.loading = false;
})
: levelSaveApi(this.user)
: AddInstallments(this.user)
.then((res) => {
this.$message.success('添加成功');
this.loading = false;
@ -171,4 +213,10 @@ export default {
};
</script>
<style scoped></style>
<style scoped>
.el-input-number .el-input-group__append {
padding: 0 12px;
line-height: 36px;
border-left: 1px solid #dcdfe6;
}
</style>

View File

@ -2,15 +2,30 @@
<div class="divBox">
<el-card class="box-card">
<div slot="header" class="clearfix">
<el-button type="primary" class="mr10" @click="add" size="small" v-hasPermi="['admin:system:user:level:save']"
<el-button type="primary" class="mr10" @click="add" size="small" v-hasPermi="['admin:setting:save']"
>添加分期配置</el-button>
</div>
<el-table v-loading="listLoading" :data="listData.list" style="width: 100%" size="mini">
<el-table-column prop="id" label="ID" min-width="50" />
<el-table-column prop="productId" label="商品名称" min-width="100" />
<el-table-column prop="name" label="分期套餐名称" min-width="100" />
<el-table-column prop="installmentNumber" label="分期数" min-width="100" />
<el-table-column prop="price" label="分期价格" min-width="100" />
<el-table-column prop="amountComesUp" label="上浮比例(%)" min-width="100" >
<template slot-scope="scope">
{{ formatPercentage(scope.row.amountComesUp) }}
</template>
</el-table-column>
<el-table-column prop="cycle" label="周期(天)" min-width="100" />
<el-table-column prop="downPaymentPercent" label="首付比例(%)" min-width="100" >
<template slot-scope="scope">
{{ formatPercentage(scope.row.downPaymentPercent) }}
</template>
</el-table-column>
<el-table-column prop="downPaymentNumber" label="首付期数" min-width="100" >
<template slot-scope="scope">
{{ formatNumber(scope.row.downPaymentNumber) }}
</template>
</el-table-column>
<el-table-column label="操作" min-width="120" fixed="right" align="center">
<template slot-scope="scope">
<el-button
@ -18,13 +33,13 @@
size="small"
@click="edit(scope.row)"
class="mr10"
v-hasPermi="['admin:system:user:level:update']"
v-hasPermi="['admin:setting:update']"
>编辑</el-button>
<el-button
type="text"
size="small"
@click="handleDelete(scope.row.id, scope.$index)"
v-hasPermi="['admin:system:user:level:delete']"
v-hasPermi="['admin:setting:delete']"
>删除</el-button>
</template>
</el-table-column>
@ -84,6 +99,20 @@ export default {
this.getList();
},
methods: {
formatPercentage(value) {
if(value == "0.00" || value == "0.0" || value == "0" || value == 0 || value == null){
return "-";
}else {
return (value * 100).toFixed(2) + '%';
}
},
formatNumber(value){
if(value == 0){
return "-";
}else {
return value + "期";
}
},
checkPermi,
seachList() {
this.getList();
@ -92,9 +121,11 @@ export default {
this.$refs.grades.dialogVisible = true;
this.userInfo = {};
},
edit(id) {
edit(user) {
// this.$refs.grades.info(id)
this.userInfo = id;
user.amountComesUpStr = user.amountComesUp*100;
user.downPaymentPercentStr = user.downPaymentPercent*100;
this.userInfo = user;
this.$refs.grades.dialogVisible = true;
},
//