型号新增默认服务费

This commit is contained in:
墨大叔 2024-07-23 17:33:51 +08:00
parent 97ccb2aa06
commit ec4933fd12
6 changed files with 90 additions and 54 deletions

View File

@ -64,3 +64,15 @@ export const $showColumns = {
}
},
}
// 服务费
export const $serviceType = {
computed: {
// 服务费单位
serviceUnit() {
return (type) => {
return type === '2' ? '元' : '%';
}
}
}
}

View File

@ -74,7 +74,7 @@
<el-descriptions-item label="服务费">
<template v-if="deviceData.serviceRate == null">跟随用户</template>
<template v-else>
<dict-tag :options="dict.type.device_service_type" :value="deviceData.serviceType" size="mini"/>
<dict-tag :options="dict.type.service_type" :value="deviceData.serviceType" size="mini"/>
{{deviceData.serviceRate}} {{serviceUnit(deviceData.serviceType)}}
</template>
</el-descriptions-item>
@ -168,9 +168,11 @@ import RecordTime from '@/views/ss/time/index.vue'
import { toDescriptionFromSecond } from '@/utils/date'
import StoreLink from '@/components/Business/Store/StoreLink.vue'
import UserLink from '@/components/Business/SmUser/UserLink.vue'
import { $serviceType } from '@/utils/mixins'
export default {
name: 'deviceDetail',
mixins: [$serviceType],
components: {
UserLink,
StoreLink,
@ -178,7 +180,7 @@ export default {
Suit,
SuitList,
TenantList, ResetRecord, BindRecord, ReadingRecord, MeterRecordReport, QrCode, RechargeRecord, LineChart},
dicts: ['sm_device_status', 'sm_device_outage_way', 'sm_device_notice_way', 'sm_model_tag', 'sm_device_online_status', 'device_service_type'],
dicts: ['sm_device_status', 'sm_device_outage_way', 'sm_device_notice_way', 'sm_model_tag', 'sm_device_online_status', 'service_type'],
data() {
return {
loading: false,
@ -211,12 +213,6 @@ export default {
},
isOpen() {
return this.deviceData != null && this.deviceData.powerStatus === '1';
},
//
serviceUnit() {
return (type) => {
return type === '2' ? '元' : '%';
}
}
},
created() {

View File

@ -177,7 +177,7 @@
<template slot-scope="d">
<template v-if="d.row.serviceRate == null">跟随用户</template>
<template v-else>
<dict-tag :options="dict.type.device_service_type" :value="d.row.serviceType"/>
<dict-tag :options="dict.type.service_type" :value="d.row.serviceType"/>
{{d.row.serviceRate}} {{serviceUnit(d.row.serviceType)}}
</template>
</template>
@ -262,7 +262,7 @@
<template #prepend>
<el-select v-model="form.serviceType" placeholder="请选择服务费收取方式" style="width: 10em">
<el-option
v-for="dict in dict.type.device_service_type"
v-for="dict in dict.type.service_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
@ -316,11 +316,13 @@ import ModelDialog from '@/components/Business/Model/modelDialog.vue'
import UserLink from '@/components/Business/SmUser/UserLink.vue'
import StoreLink from '@/components/Business/Store/StoreLink.vue'
import DeviceLink from '@/components/Business/Device/DeviceLink.vue'
import { $serviceType } from '@/utils/mixins'
export default {
name: "Device",
mixins: [$serviceType],
components: { DeviceLink, StoreLink, UserLink, ModelDialog, UserInput, StoreInput, SnInput, QrCode, SmUserSelect, ModelSelect},
dicts: ['sm_device_online_status', 'sm_device_status', 'sm_device_outage_way','sm_device_notice_way', 'device_service_type'],
dicts: ['sm_device_online_status', 'sm_device_status', 'sm_device_outage_way','sm_device_notice_way', 'service_type'],
data() {
return {
//
@ -390,12 +392,6 @@ export default {
return getWxIndexUrl({ s: device.deviceNo});
}
},
//
serviceUnit() {
return (type) => {
return type === '2' ? '元' : '%';
}
}
},
created() {
this.getList();
@ -441,6 +437,11 @@ export default {
//
onSubmitModel(model) {
this.form.model = model?.modelName;
//
if (this.form.deviceId == null) {
this.form.serviceType = model?.serviceType;
this.form.serviceRate = model?.serviceRate;
}
},
/** 查询设备列表 */
getList() {

View File

@ -113,33 +113,54 @@
/>
<!-- 添加或修改型号列表对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="型号名称" prop="modelName">
<el-input v-model="form.modelName" placeholder="请输入型号名称" />
</el-form-item>
<el-form-item label="型号" prop="model">
<el-input v-model="form.model" placeholder="请输入型号"/>
</el-form-item>
<el-form-item label="型号标签" prop="tags">
<el-select v-model="form.tags" placeholder="请选择型号标签" style="width: 100%" multiple>
<el-option
v-for="option of dict.type.sm_model_tag"
:label="option.label"
:key="option.value"
:value="option.value"
/>
</el-select>
</el-form-item>
<el-form-item label="图片" prop="picture">
<image-upload v-model="form.picture"/>
</el-form-item>
<el-form-item label="产品介绍" prop="introduce">
<el-input v-model="form.introduce" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-row>
<form-col :span="span" label="图片" prop="picture">
<image-upload v-model="form.picture" :limit="1"/>
</form-col>
<form-col :span="span" label="型号名称" prop="modelName">
<el-input v-model="form.modelName" placeholder="请输入型号名称" />
</form-col>
<form-col :span="span" label="型号" prop="model">
<el-input v-model="form.model" placeholder="请输入型号"/>
</form-col>
<form-col :span="span * 2" label="型号功能" prop="tags">
<!-- <el-select v-model="form.tags" placeholder="请选择型号功能" style="width: 100%" multiple>-->
<!-- <el-option-->
<!-- v-for="option of dict.type.sm_model_tag"-->
<!-- :label="option.label"-->
<!-- :key="option.value"-->
<!-- :value="option.value"-->
<!-- />-->
<!-- </el-select>-->
<el-checkbox-group v-model="form.tags">
<el-checkbox v-for="option of dict.type.sm_model_tag" :label="option.value" :key="option.value">{{option.label}}</el-checkbox>
</el-checkbox-group>
</form-col>
<form-col :span="span * 2" label="产品介绍" prop="introduce">
<el-input v-model="form.introduce" type="textarea" placeholder="请输入内容" />
</form-col>
<form-col :span="span * 2" label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</form-col>
<form-col :span="span * 2" label="默认服务费" prop="serviceRate" label-width="7em">
<el-input v-model="form.serviceRate" placeholder="请输入服务费">
<template #prepend>
<el-select v-model="form.serviceType" placeholder="请选择服务费收取方式" style="width: 10em">
<el-option
v-for="dict in dict.type.service_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</template>
<template #append>{{serviceUnit(form.serviceType)}}</template>
</el-input>
</form-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
@ -151,12 +172,15 @@
<script>
import {listModel, getModel, addModel, updateModel, logicDelModel} from "@/api/system/model";
import { $serviceType } from '@/utils/mixins'
export default {
name: "Model",
dicts: ['sm_model_tag'],
mixins: [$serviceType],
dicts: ['sm_model_tag', 'service_type'],
data() {
return {
span: 12,
//
loading: true,
//
@ -241,7 +265,10 @@ export default {
createTime: null,
updateBy: null,
updateTime: null,
remark: null
remark: null,
serviceType: "1",
serviceRate: null,
tags: [],
};
this.resetForm("form");
},

View File

@ -22,7 +22,7 @@
<el-descriptions-item label="服务费费率">
<template v-if="userData.serviceRate == null">跟随渠道</template>
<template v-else>
<dict-tag :options="dict.type.user_service_type" :value="userData.serviceType" size="mini"/>
<dict-tag :options="dict.type.service_type" :value="userData.serviceType" size="mini"/>
{{userData.serviceRate}} {{serviceUnit(userData.serviceType)}}
</template>
</el-descriptions-item>
@ -64,15 +64,15 @@ import UserDevice from "@/views/system/smUser/components/userDevice.vue";
import UserAccount from "@/views/system/smUser/components/userAccount.vue";
import UserRechargeReport from "@/views/system/smUser/components/userRechargeReport.vue";
import Access from '@/views/ss/access/index.vue'
import { $view } from '@/utils/mixins'
import { $serviceType, $view } from '@/utils/mixins'
import Store from '@/views/ss/store/index.vue'
import RecordBalance from '@/views/ss/recordBalance/index.vue'
export default {
name: 'deviceDetail',
mixins: [$view],
mixins: [$view, $serviceType],
components: { RecordBalance, Store, Access, UserRechargeReport, UserAccount, UserDevice, LineChart},
dicts: ['sm_user_type', 'user_service_type'],
dicts: ['sm_user_type', 'service_type'],
computed: {
serviceUnit() {
return (type) => {

View File

@ -106,7 +106,7 @@
<template v-else-if="column.key === 'serviceRate'">
<template v-if="d.row.serviceRate == null">跟随渠道</template>
<template v-else>
<dict-tag :options="dict.type.user_service_type" :value="d.row.serviceType"/>
<dict-tag :options="dict.type.service_type" :value="d.row.serviceType"/>
{{d.row.serviceRate}} {{serviceUnit(d.row.serviceType)}}
</template>
</template>
@ -195,7 +195,7 @@
<template #prepend>
<el-select v-model="form.serviceType" placeholder="请选择服务费收取方式" style="width: 10em">
<el-option
v-for="dict in dict.type.user_service_type"
v-for="dict in dict.type.service_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
@ -224,7 +224,7 @@
<script>
import { listSmUser, getSmUser, addSmUser, updateSmUser, delSmUser, updateServiceRate } from '@/api/system/smUser'
import ServiceRateForm from '@/views/system/smUser/components/serviceRateForm.vue'
import { $showColumns } from '@/utils/mixins'
import { $serviceType, $showColumns } from '@/utils/mixins'
import UserLink from '@/components/Business/SmUser/UserLink.vue'
const defaultSort = {
@ -234,9 +234,9 @@ const defaultSort = {
export default {
name: "SmUser",
mixins: [$showColumns],
mixins: [$showColumns, $serviceType],
components: { UserLink, ServiceRateForm },
dicts: ['sm_user_status', 'user_type', 'sys_user_sex', 'user_service_type'],
dicts: ['sm_user_status', 'user_type', 'sys_user_sex', 'service_type'],
computed: {
serviceUnit() {
return (type) => {