1.计费方式中增加价格说明

This commit is contained in:
邱贞招 2024-09-03 16:51:50 +08:00
parent 61cbf02877
commit 8f0af93d04
4 changed files with 87 additions and 35 deletions

View File

@ -8,7 +8,7 @@ ENV = 'development'
# VUE_APP_BASE_API = 'https://dche.ccttiot.com/prod-api'
# VUE_APP_BASE_API = 'https://che.chuangtewl.com/prod-api'
VUE_APP_BASE_API = 'http://localhost:8080'
VUE_APP_BASE_API = 'http://localhost:8088'
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true

View File

@ -19,14 +19,6 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="用户" prop="userName">-->
<!-- <el-input-->
<!-- v-model="queryParams.userName"-->
<!-- placeholder="请输入用户"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
<el-option
@ -92,6 +84,7 @@
<el-table v-loading="loading" :data="couponList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="优惠券id" align="center" prop="couponId" />
<el-table-column label="名称" align="center" prop="name" />
<el-table-column label="类型" align="center" prop="type">
<template slot-scope="scope">
<dict-tag :options="dict.type.et_coupon_type" :value="scope.row.type"/>
@ -104,13 +97,8 @@
</el-table-column>
<el-table-column label="折扣比例" align="center" prop="discountPercent" :formatter="formatDiscountPercent"/>
<el-table-column label="运营区" align="center" prop="areaName" />
<!-- <el-table-column label="用户" align="center" prop="userName" />-->
<el-table-column label="抵扣金额" align="center" prop="discountAmount" :formatter="formatDiscountAmount"/>
<!-- <el-table-column label="有效时间" align="center" prop="expirationTime" width="180">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.expirationTime, '{y}-{m}-{d}') }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="零售价" align="center" prop="retailPrice" :formatter="formatRetailPrice"/>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
@ -147,6 +135,20 @@
<!-- 添加或修改优惠券对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="运营区" prop="areaId">
<el-select v-model="form.areaId">
<el-option
filterable
v-for="item in areaOptions"
:key="item.areaId"
:label="item.areaName"
:value="item.areaId"
/>
</el-select>
</el-form-item>
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" placeholder="请输入名称" />
</el-form-item>
<el-form-item label="类型" prop="type">
<el-select v-model="form.type" placeholder="请选择类型">
<el-option
@ -157,26 +159,40 @@
></el-option>
</el-select>
</el-form-item>
<el-form-item label="折扣比例" prop="discountPercent">
<el-input v-model="form.discountPercent" placeholder="请输入折扣比例" />
<el-form-item label="次数" prop="limitNum" v-if="form.type == 3 || form.type == 4">
<el-select v-model="form.limitNum" placeholder="请选择次数">
<el-option
v-for="dict in dict.type.et_coupon_time_limit"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="运营区" prop="areaId">
<el-input v-model="form.areaId" placeholder="请输入运营区" />
<el-form-item label="折扣比例" prop="discountPercent" v-if="form.type == 3">
<el-input-number v-model='form.discountPercent' :precision="2" :step="0.1" />%
</el-form-item>
<!-- <el-form-item label="用户" prop="userId">-->
<!-- <el-input v-model="form.userId" placeholder="请输入用户" />-->
<el-form-item label="抵扣金额" prop="discountAmount" v-if="form.type == 4">
<el-input-number v-model='form.discountAmount' :precision="2" :step="0.1" />
</el-form-item>
<el-form-item label="零售价" prop="retailPrice">
<el-input-number v-model='form.retailPrice' :precision="2" :step="0.1" />
</el-form-item>
<el-row>
<el-col :span="12">
<el-form-item label="是否热门" prop="isHot">
<el-switch v-model="form.isHot" class="drawer-switch" />
</el-form-item>
</el-col>
</el-row>
<!-- <el-form-item label="有效时间" prop="expirationTime">-->
<!-- <el-date-picker clearable-->
<!-- v-model="form.expirationTime"-->
<!-- type="date"-->
<!-- value-format="yyyy-MM-dd HH:mm:ss"-->
<!-- placeholder="请选择有效时间">-->
<!-- </el-date-picker>-->
<!-- </el-form-item>-->
<el-form-item label="抵扣金额" prop="discountAmount">
<el-input v-model="form.discountAmount" placeholder="请输入抵扣金额" />
</el-form-item>
<el-form-item label="有效时间" prop="expirationTime">
<el-date-picker clearable
v-model="form.expirationTime"
type="date"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择有效时间">
</el-date-picker>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
@ -188,6 +204,7 @@
<script>
import { listCoupon, getCoupon, delCoupon, addCoupon, updateCoupon } from "@/api/system/coupon";
import { optionselect as getAreaOptionselect } from '@/api/system/area'
export default {
name: "Coupon",
@ -212,6 +229,8 @@ export default {
title: "",
//
open: false,
//
areaOptions:[],
//
queryParams: {
pageNum: 1,
@ -221,6 +240,7 @@ export default {
areaId: null,
userId: null,
discountAmount: null,
retailPrice: null,
expirationTime: null,
status: null
},
@ -236,8 +256,26 @@ export default {
},
created() {
this.getList();
getAreaOptionselect().then(response => {
this.areaOptions = response.data;
});
},
methods: {
// discountPercent
convertDiscountPercentToInteger() {
// discountPercent
if (this.form.discountPercent !== null && this.form.discountPercent !== '' && !isNaN(this.form.discountPercent)) {
this.form.discountPercent = Math.round(this.form.discountPercent * 100);
} else {
this.form.discountPercent = ''; //
}
},
formatRetailPrice(row){
if (row.retailPrice === null || row.retailPrice === '') {
return '';
}
return row.retailPrice + '元';
},
formatDiscountAmount(row){
if (row.discountAmount === null || row.discountAmount === '') {
return '';
@ -308,6 +346,8 @@ export default {
const couponId = row.couponId || this.ids
getCoupon(couponId).then(response => {
this.form = response.data;
this.form.isHot = this.form.isHot === 'true';
this.convertDiscountPercentToInteger(); //
this.open = true;
this.title = "修改优惠券";
});
@ -316,6 +356,13 @@ export default {
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
// discountPercent
if (this.form.discountPercent !== null && this.form.discountPercent !== '' && !isNaN(this.form.discountPercent)) {
// discountPercent
this.form.discountPercent = this.form.discountPercent / 100;
} else {
this.form.discountPercent = null; // null
}
if (this.form.couponId != null) {
updateCoupon(this.form).then(response => {
this.$modal.msgSuccess("修改成功");

View File

@ -55,8 +55,11 @@
<el-table-column label="应用运营区" align="center" prop="areaName"/>
<el-table-column label="套餐名称" align="center" prop="name" />
<el-table-column label="说明" :show-overflow-tooltip="true" align="center" prop="instructions" />
<!-- <el-table-column label="时间(小时)" align="center" prop="time" />
<el-table-column label="费用(元)" align="center" prop="fee" /> -->
<el-table-column label="价格说明" align="left" prop="description" >
<template slot-scope="scope">
<div v-html="appUserNameFormatter(scope.row.description)"></div>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status" />
@ -475,6 +478,9 @@ export default {
});
},
methods: {
appUserNameFormatter(value){
return value ? value.split(',').join('<br>') : '';
},
getAreaListByDeptId(deptId){
console.log('---------------deptId:', deptId)
if(deptId){

View File

@ -149,7 +149,6 @@
<template slot-scope="scope">
<span class="link-type" @click="handleBandSysUser(scope.row.userId)">
<div v-html="appUserNameFormatter(scope.row.appUserName)"></div>
<!-- {{ appUserNameFormatter(scope.row.appUserName) }}-->
</span>
</template>
</el-table-column>