临时提交
This commit is contained in:
parent
2f63704062
commit
f1045364c8
src
router
views
|
@ -102,17 +102,17 @@ export const mchRoutes = [
|
||||||
icon: 'shopping'
|
icon: 'shopping'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
path: 'refund',
|
// path: 'refund',
|
||||||
component: () => import('@/views/mch/refund'),
|
// component: () => import('@/views/mch/refund'),
|
||||||
hidden: false,
|
// hidden: false,
|
||||||
name: "MchRefund",
|
// name: "MchRefund",
|
||||||
meta: {
|
// meta: {
|
||||||
noCache: false,
|
// noCache: false,
|
||||||
title: '订单退款',
|
// title: '订单退款',
|
||||||
icon: 'refund'
|
// icon: 'refund'
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
path: 'recharge/:billId',
|
path: 'recharge/:billId',
|
||||||
component: () => import('@/views/mch/recharge/detail.vue'),
|
component: () => import('@/views/mch/recharge/detail.vue'),
|
||||||
|
|
|
@ -212,7 +212,7 @@ import { parseTime } from '@/utils/ruoyi'
|
||||||
import { $view } from '@/utils/mixins'
|
import { $view } from '@/utils/mixins'
|
||||||
import UserLink from '@/components/Business/SmUser/UserLink.vue'
|
import UserLink from '@/components/Business/SmUser/UserLink.vue'
|
||||||
import StoreLink from '@/components/Business/Store/StoreLink.vue'
|
import StoreLink from '@/components/Business/Store/StoreLink.vue'
|
||||||
import { mchAddStore, mchDelStore, mchGetStore, mchListStore, mchUpdateStore } from '@/api/mch/store'
|
import { mchAddStore, mchCancelStore, mchDelStore, mchGetStore, mchListStore, mchUpdateStore } from '@/api/mch/store'
|
||||||
import MchStoreApplyDetail from '@/views/mch/storeApply/detail.vue'
|
import MchStoreApplyDetail from '@/views/mch/storeApply/detail.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
|
@ -52,16 +52,6 @@
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="warning"
|
|
||||||
plain
|
|
||||||
icon="el-icon-download"
|
|
||||||
size="mini"
|
|
||||||
@click="handleExport"
|
|
||||||
v-hasPermi="['ss:storeApply:export']"
|
|
||||||
>导出</el-button>
|
|
||||||
</el-col>
|
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
@ -103,6 +93,13 @@
|
||||||
icon="el-icon-view"
|
icon="el-icon-view"
|
||||||
@click="handleView(scope.row)"
|
@click="handleView(scope.row)"
|
||||||
>详情</el-button>
|
>详情</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-close"
|
||||||
|
@click="handleCancel(scope.row)"
|
||||||
|
v-if="canCancel(scope.row)"
|
||||||
|
>取消申请</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
@ -136,7 +133,8 @@ import StoreLink from '@/components/Business/Store/StoreLink.vue'
|
||||||
import UserLink from '@/components/Business/SmUser/UserLink.vue'
|
import UserLink from '@/components/Business/SmUser/UserLink.vue'
|
||||||
import StoreApplyDetail from '@/views/ss/storeApply/detail.vue'
|
import StoreApplyDetail from '@/views/ss/storeApply/detail.vue'
|
||||||
import MchStoreApplyDetail from '@/views/mch/storeApply/detail.vue'
|
import MchStoreApplyDetail from '@/views/mch/storeApply/detail.vue'
|
||||||
import { mchListStoreApply } from '@/api/mch/storeApply'
|
import { mchCancelStoreApply, mchListStoreApply } from '@/api/mch/storeApply'
|
||||||
|
import { StoreApplyStatus } from '@/utils/constants'
|
||||||
|
|
||||||
// 默认排序字段
|
// 默认排序字段
|
||||||
const defaultSort = {
|
const defaultSort = {
|
||||||
|
@ -157,6 +155,13 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
canCancel() {
|
||||||
|
return (row) => {
|
||||||
|
return row.status === StoreApplyStatus.WAIT_AUDIT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
showDetail: false,
|
showDetail: false,
|
||||||
|
@ -238,6 +243,20 @@ export default {
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleCancel(row) {
|
||||||
|
this.$confirm('确定要取消申请吗?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
mchCancelStoreApply(row.id).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.$message.success("取消成功");
|
||||||
|
this.getList();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
/** 当排序按钮被点击时触发 **/
|
/** 当排序按钮被点击时触发 **/
|
||||||
onSortChange(column) {
|
onSortChange(column) {
|
||||||
if (column.order == null) {
|
if (column.order == null) {
|
||||||
|
|
247
src/views/ss/suit/component/SuitEditDialog.vue
Normal file
247
src/views/ss/suit/component/SuitEditDialog.vue
Normal file
|
@ -0,0 +1,247 @@
|
||||||
|
<template>
|
||||||
|
<!-- 添加或修改套餐对话框 -->
|
||||||
|
<el-dialog :title="title" :visible="open" width="800px" append-to-body >
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-row>
|
||||||
|
<form-col :span="span" label="所属用户" prop="userId">
|
||||||
|
<user-input v-model="form.userId" @change="onChangeUser" :disabled="hasView(views.user)"/>
|
||||||
|
</form-col>
|
||||||
|
<form-col :span="span" label="套餐名称" prop="name">
|
||||||
|
<el-input v-model="form.name" placeholder="请输入套餐名称" />
|
||||||
|
</form-col>
|
||||||
|
<form-col :span="span" label="收费模式" prop="feeMode" >
|
||||||
|
<el-select v-model="form.feeMode" style="width: 100%" @change="onChangeFeeMode">
|
||||||
|
<el-option
|
||||||
|
v-for="option of dict.type.suit_fee_mode"
|
||||||
|
:key="option.value"
|
||||||
|
:label="option.label"
|
||||||
|
:value="option.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</form-col>
|
||||||
|
<form-col :span="span" label="收费方式" prop="feeType">
|
||||||
|
<el-select v-model="form.feeType" style="width: 100%">
|
||||||
|
<el-option
|
||||||
|
v-for="option of dict.type.suit_fee_type"
|
||||||
|
:key="option.value"
|
||||||
|
:label="option.label"
|
||||||
|
:value="option.value"
|
||||||
|
:disabled="disabledFeeType(option)"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</form-col>
|
||||||
|
<form-col :span="span" label="价格" prop="price" v-if="[SuitFeeType.TIMING, SuitFeeType.COUNT].includes(form.feeType)">
|
||||||
|
<el-input-number v-model="form.price" placeholder="请输入价格(元)" :min="0" :precision="2" controls-position="right" style="width: calc(100% - 2em)"/> 元
|
||||||
|
</form-col>
|
||||||
|
<form-col :span="span" label="押金" prop="price" v-else>
|
||||||
|
<el-input-number v-model="form.price" placeholder="请输入押金(元)" :min="0" :precision="2" controls-position="right" style="width: calc(100% - 2em)"/> 元
|
||||||
|
</form-col>
|
||||||
|
<form-col :span="span" label="通电时间" prop="value" v-if="form.feeType === SuitFeeType.TIMING">
|
||||||
|
<el-input v-model="form.value" placeholder="请输入通电时间" type="number">
|
||||||
|
<template #append>
|
||||||
|
<el-select v-model="form.timeUnit" style="width: 6em">
|
||||||
|
<el-option
|
||||||
|
v-for="option of dict.type.time_unit"
|
||||||
|
:key="option.value"
|
||||||
|
:label="option.label"
|
||||||
|
:value="option.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</form-col>
|
||||||
|
<form-col :span="span" label="度数" prop="value" v-else-if="form.feeType === SuitFeeType.COUNT">
|
||||||
|
<el-input v-model="form.value" placeholder="请输入度数" type="number">
|
||||||
|
<template #append>度</template>
|
||||||
|
</el-input>
|
||||||
|
</form-col>
|
||||||
|
<form-col :span="span * 2" label="详细说明" prop="description">
|
||||||
|
<el-input v-model="form.description" placeholder="请输入详细说明" type="textarea" />
|
||||||
|
</form-col>
|
||||||
|
<form-col :span="span" label-width="0" v-for="(item, index) of 4" v-if="[SuitFeeType.TIME_COUNT, SuitFeeType.TIME_TIMING].includes(form.feeType)" >
|
||||||
|
<el-tooltip effect="dark" :content="`单击设置${item}档电价,双击全部设置为${item}档电价`" placement="top">
|
||||||
|
<el-button
|
||||||
|
:plain="amountIndex !== index"
|
||||||
|
:type="indexStyle[index]"
|
||||||
|
@click="handleSetAmountIndex(index)"
|
||||||
|
@dblclick.native="handleAllSet(index)">
|
||||||
|
{{item}}档电价
|
||||||
|
</el-button>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-input-number v-model="form.gearAmount[index]" controls-position="right" placeholder="请输入电价" :precision="2" style="width: calc(100% - 11em)"/> {{gearUnit}}
|
||||||
|
</form-col>
|
||||||
|
<form-col :span="24" label-width="0" v-if="[SuitFeeType.TIME_COUNT, SuitFeeType.TIME_TIMING].includes(form.feeType)">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="6" v-for="(item, index) of 24" :key="index" v-if="!refresh">
|
||||||
|
<el-button plain style="width: 100%" :type="timeType(index)" @click="handleClickTimeItem(index)">{{index}} 时</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</form-col>
|
||||||
|
<form-col :span="span * 2" label="应用设备" prop="deviceIds">
|
||||||
|
<device-input v-model="form.deviceIds" multiple :before-open="beforeOpenDevice" :query="deviceQuery"/>
|
||||||
|
</form-col>
|
||||||
|
</el-row>
|
||||||
|
</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>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { SuitFeeType } from '@/utils/constants'
|
||||||
|
import DeviceInput from '@/components/Business/Device/DeviceInput.vue'
|
||||||
|
import { isEmpty } from '@/utils'
|
||||||
|
import { addSuit, updateSuit } from '@/api/ss/suit'
|
||||||
|
import { $view } from '@/utils/mixins'
|
||||||
|
import UserInput from '@/components/Business/SmUser/UserInput.vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "SuitEditDialog",
|
||||||
|
mixins: [$view],
|
||||||
|
components: { UserInput, DeviceInput },
|
||||||
|
computed: {
|
||||||
|
SuitFeeType() {
|
||||||
|
return SuitFeeType
|
||||||
|
},
|
||||||
|
// 设备查询条件
|
||||||
|
deviceQuery() {
|
||||||
|
return {
|
||||||
|
userId: this.form.userId
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 收费方式禁用的情况:单次收费,不支持分时段
|
||||||
|
disabledFeeType() {
|
||||||
|
return (option) => {
|
||||||
|
return this.isDisabled(this.form.feeMode, option.value);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 收费方式单位
|
||||||
|
gearUnit() {
|
||||||
|
return this.form.feeType === SuitFeeType.TIME_COUNT ? '元 / 度' : '元 / 时 '
|
||||||
|
},
|
||||||
|
// 时间显示类型
|
||||||
|
timeType() {
|
||||||
|
return (index) => {
|
||||||
|
if(this.form.gearTime[index] == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return this.indexStyle[this.form.gearTime[index]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
open: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
refresh: false,
|
||||||
|
// 当前设置电价的索引
|
||||||
|
amountIndex: null,
|
||||||
|
span: 12,
|
||||||
|
// 表单参数
|
||||||
|
form: {
|
||||||
|
gearAmount: [],
|
||||||
|
gearTime: []
|
||||||
|
},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
userId: [
|
||||||
|
{ required: true, message: "所属用户不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
name: [
|
||||||
|
{ required: true, message: "套餐名称不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
value: [
|
||||||
|
{ required: true, message: "通电时间不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
price: [
|
||||||
|
{ required: true, message: "价格不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
feeMode: [
|
||||||
|
{ required: true, message: "收费方式不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
feeType: [
|
||||||
|
{ required: true, message: "收费类型不能为空", trigger: "change" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.suitId != null) {
|
||||||
|
updateSuit(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addSuit(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 处理点击索引按钮
|
||||||
|
handleSetAmountIndex(index) {
|
||||||
|
if (this.amountIndex === index) {
|
||||||
|
this.amountIndex = null;
|
||||||
|
} else {
|
||||||
|
this.amountIndex = index;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onChangeUser(nv) {
|
||||||
|
if (!isEmpty(this.form.deviceIds)) {
|
||||||
|
this.$message.info("由于切换了用户,请重新选择应用设备")
|
||||||
|
this.form.deviceIds = []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeOpenDevice() {
|
||||||
|
if (this.form.userId == null) {
|
||||||
|
this.$message.warning("请先选择所属用户");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
|
onChangeFeeMode(nv) {
|
||||||
|
if(this.isDisabled(nv, this.form.feeType)) {
|
||||||
|
this.form.feeType = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 全部设置为某一个类型
|
||||||
|
handleAllSet(index) {
|
||||||
|
for(let i = 0; i < 24; i ++) {
|
||||||
|
this.form.gearTime[i] = index;
|
||||||
|
}
|
||||||
|
this.refreshItems();
|
||||||
|
},
|
||||||
|
handleClickTimeItem(index) {
|
||||||
|
if (this.amountIndex != null) {
|
||||||
|
this.form.gearTime[index] = this.amountIndex;
|
||||||
|
this.refreshItems();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 刷新列表
|
||||||
|
refreshItems() {
|
||||||
|
this.refresh = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.refresh = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -130,94 +130,8 @@
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 添加或修改套餐对话框 -->
|
<suit-edit-dialog :title="title" :open.sync="open"/>
|
||||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
||||||
<el-row>
|
|
||||||
<form-col :span="span" label="所属用户" prop="userId">
|
|
||||||
<user-input v-model="form.userId" @change="onChangeUser" :disabled="hasView(views.user)"/>
|
|
||||||
</form-col>
|
|
||||||
<form-col :span="span" label="套餐名称" prop="name">
|
|
||||||
<el-input v-model="form.name" placeholder="请输入套餐名称" />
|
|
||||||
</form-col>
|
|
||||||
<form-col :span="span" label="收费模式" prop="feeMode" >
|
|
||||||
<el-select v-model="form.feeMode" style="width: 100%" @change="onChangeFeeMode">
|
|
||||||
<el-option
|
|
||||||
v-for="option of dict.type.suit_fee_mode"
|
|
||||||
:key="option.value"
|
|
||||||
:label="option.label"
|
|
||||||
:value="option.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</form-col>
|
|
||||||
<form-col :span="span" label="收费方式" prop="feeType">
|
|
||||||
<el-select v-model="form.feeType" style="width: 100%">
|
|
||||||
<el-option
|
|
||||||
v-for="option of dict.type.suit_fee_type"
|
|
||||||
:key="option.value"
|
|
||||||
:label="option.label"
|
|
||||||
:value="option.value"
|
|
||||||
:disabled="disabledFeeType(option)"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</form-col>
|
|
||||||
<form-col :span="span" label="价格" prop="price" v-if="[SuitFeeType.TIMING, SuitFeeType.COUNT].includes(form.feeType)">
|
|
||||||
<el-input-number v-model="form.price" placeholder="请输入价格(元)" :min="0" :precision="2" controls-position="right" style="width: calc(100% - 2em)"/> 元
|
|
||||||
</form-col>
|
|
||||||
<form-col :span="span" label="押金" prop="price" v-else>
|
|
||||||
<el-input-number v-model="form.price" placeholder="请输入押金(元)" :min="0" :precision="2" controls-position="right" style="width: calc(100% - 2em)"/> 元
|
|
||||||
</form-col>
|
|
||||||
<form-col :span="span" label="通电时间" prop="value" v-if="form.feeType === SuitFeeType.TIMING">
|
|
||||||
<el-input v-model="form.value" placeholder="请输入通电时间" type="number">
|
|
||||||
<template #append>
|
|
||||||
<el-select v-model="form.timeUnit" style="width: 6em">
|
|
||||||
<el-option
|
|
||||||
v-for="option of dict.type.time_unit"
|
|
||||||
:key="option.value"
|
|
||||||
:label="option.label"
|
|
||||||
:value="option.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</template>
|
|
||||||
</el-input>
|
|
||||||
</form-col>
|
|
||||||
<form-col :span="span" label="度数" prop="value" v-else-if="form.feeType === SuitFeeType.COUNT">
|
|
||||||
<el-input v-model="form.value" placeholder="请输入度数" type="number">
|
|
||||||
<template #append>度</template>
|
|
||||||
</el-input>
|
|
||||||
</form-col>
|
|
||||||
<form-col :span="span * 2" label="详细说明" prop="description">
|
|
||||||
<el-input v-model="form.description" placeholder="请输入详细说明" type="textarea" />
|
|
||||||
</form-col>
|
|
||||||
<form-col :span="span" label-width="0" v-for="(item, index) of 4" v-if="[SuitFeeType.TIME_COUNT, SuitFeeType.TIME_TIMING].includes(form.feeType)" >
|
|
||||||
<el-tooltip effect="dark" :content="`单击设置${item}档电价,双击全部设置为${item}档电价`" placement="top">
|
|
||||||
<el-button
|
|
||||||
:plain="amountIndex !== index"
|
|
||||||
:type="indexStyle[index]"
|
|
||||||
@click="handleSetAmountIndex(index)"
|
|
||||||
@dblclick.native="handleAllSet(index)">
|
|
||||||
{{item}}档电价
|
|
||||||
</el-button>
|
|
||||||
</el-tooltip>
|
|
||||||
<el-input-number v-model="form.gearAmount[index]" controls-position="right" placeholder="请输入电价" :precision="2" style="width: calc(100% - 11em)"/> {{gearUnit}}
|
|
||||||
</form-col>
|
|
||||||
<form-col :span="24" label-width="0" v-if="[SuitFeeType.TIME_COUNT, SuitFeeType.TIME_TIMING].includes(form.feeType)">
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="6" v-for="(item, index) of 24" :key="index" v-if="!refresh">
|
|
||||||
<el-button plain style="width: 100%" :type="timeType(index)" @click="handleClickTimeItem(index)">{{index}} 时</el-button>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</form-col>
|
|
||||||
<form-col :span="span * 2" label="应用设备" prop="deviceIds">
|
|
||||||
<device-input v-model="form.deviceIds" multiple :before-open="beforeOpenDevice" :query="deviceQuery"/>
|
|
||||||
</form-col>
|
|
||||||
</el-row>
|
|
||||||
</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>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -230,48 +144,21 @@ import UserInput from '@/components/Business/SmUser/UserInput.vue'
|
||||||
import { $view } from '@/utils/mixins'
|
import { $view } from '@/utils/mixins'
|
||||||
import DeviceLink from '@/components/Business/Device/DeviceLink.vue'
|
import DeviceLink from '@/components/Business/Device/DeviceLink.vue'
|
||||||
import { SuitFeeMode, SuitFeeType } from '@/utils/constants'
|
import { SuitFeeMode, SuitFeeType } from '@/utils/constants'
|
||||||
|
import SuitEditDialog from '@/views/ss/suit/component/SuitEditDialog.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Suit",
|
name: "Suit",
|
||||||
mixins: [$view],
|
mixins: [$view],
|
||||||
dicts: ['time_unit', 'suit_fee_mode', 'suit_fee_type'],
|
dicts: ['time_unit', 'suit_fee_mode', 'suit_fee_type'],
|
||||||
computed: {
|
computed: {
|
||||||
SuitFeeType() {
|
|
||||||
return SuitFeeType
|
|
||||||
},
|
|
||||||
// 时长单位
|
// 时长单位
|
||||||
suitTimeUnit() {
|
suitTimeUnit() {
|
||||||
return (unit) => {
|
return (unit) => {
|
||||||
return findLabel(this.dict.type.time_unit, unit);
|
return findLabel(this.dict.type.time_unit, unit);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 设备查询条件
|
|
||||||
deviceQuery() {
|
|
||||||
return {
|
|
||||||
userId: this.form.userId
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 收费方式禁用的情况:单次收费,不支持分时段
|
|
||||||
disabledFeeType() {
|
|
||||||
return (option) => {
|
|
||||||
return this.isDisabled(this.form.feeMode, option.value);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 收费方式单位
|
|
||||||
gearUnit() {
|
|
||||||
return this.form.feeType === SuitFeeType.TIME_COUNT ? '元 / 度' : '元 / 时 '
|
|
||||||
},
|
|
||||||
// 时间显示类型
|
|
||||||
timeType() {
|
|
||||||
return (index) => {
|
|
||||||
if(this.form.gearTime[index] == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return this.indexStyle[this.form.gearTime[index]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
components: { DeviceLink, UserInput, UserLink, DeviceInput },
|
components: { SuitEditDialog, DeviceLink, UserInput, UserLink, DeviceInput },
|
||||||
props: {
|
props: {
|
||||||
query: {
|
query: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
@ -282,11 +169,7 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
refresh: false,
|
|
||||||
indexStyle: ['success', 'primary', 'warning', 'danger'],
|
indexStyle: ['success', 'primary', 'warning', 'danger'],
|
||||||
// 当前设置电价的索引
|
|
||||||
amountIndex: null,
|
|
||||||
span: 12,
|
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: true,
|
||||||
// 选中数组
|
// 选中数组
|
||||||
|
@ -317,32 +200,6 @@ export default {
|
||||||
description: null,
|
description: null,
|
||||||
deleted: null
|
deleted: null
|
||||||
},
|
},
|
||||||
// 表单参数
|
|
||||||
form: {
|
|
||||||
gearAmount: [],
|
|
||||||
gearTime: []
|
|
||||||
},
|
|
||||||
// 表单校验
|
|
||||||
rules: {
|
|
||||||
userId: [
|
|
||||||
{ required: true, message: "所属用户不能为空", trigger: "change" }
|
|
||||||
],
|
|
||||||
name: [
|
|
||||||
{ required: true, message: "套餐名称不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
value: [
|
|
||||||
{ required: true, message: "通电时间不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
price: [
|
|
||||||
{ required: true, message: "价格不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
feeMode: [
|
|
||||||
{ required: true, message: "收费方式不能为空", trigger: "change" }
|
|
||||||
],
|
|
||||||
feeType: [
|
|
||||||
{ required: true, message: "收费类型不能为空", trigger: "change" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -357,52 +214,6 @@ export default {
|
||||||
return feeMode === SuitFeeMode.SINGLE &&
|
return feeMode === SuitFeeMode.SINGLE &&
|
||||||
[SuitFeeType.TIME_COUNT, SuitFeeType.TIME_TIMING].includes(value)
|
[SuitFeeType.TIME_COUNT, SuitFeeType.TIME_TIMING].includes(value)
|
||||||
},
|
},
|
||||||
onChangeFeeMode(nv) {
|
|
||||||
if(this.isDisabled(nv, this.form.feeType)) {
|
|
||||||
this.form.feeType = null;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 全部设置为某一个类型
|
|
||||||
handleAllSet(index) {
|
|
||||||
for(let i = 0; i < 24; i ++) {
|
|
||||||
this.form.gearTime[i] = index;
|
|
||||||
}
|
|
||||||
this.refreshItems();
|
|
||||||
},
|
|
||||||
handleClickTimeItem(index) {
|
|
||||||
if (this.amountIndex != null) {
|
|
||||||
this.form.gearTime[index] = this.amountIndex;
|
|
||||||
this.refreshItems();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 刷新列表
|
|
||||||
refreshItems() {
|
|
||||||
this.refresh = true;
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.refresh = false
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 处理点击索引按钮
|
|
||||||
handleSetAmountIndex(index) {
|
|
||||||
if (this.amountIndex === index) {
|
|
||||||
this.amountIndex = null;
|
|
||||||
} else {
|
|
||||||
this.amountIndex = index;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onChangeUser(nv) {
|
|
||||||
if (!isEmpty(this.form.deviceIds)) {
|
|
||||||
this.$message.info("由于切换了用户,请重新选择应用设备")
|
|
||||||
this.form.deviceIds = []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
beforeOpenDevice() {
|
|
||||||
if (this.form.userId == null) {
|
|
||||||
this.$message.warning("请先选择所属用户");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
/** 查询套餐列表 */
|
/** 查询套餐列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
@ -473,26 +284,6 @@ export default {
|
||||||
this.title = "修改套餐";
|
this.title = "修改套餐";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
|
||||||
submitForm() {
|
|
||||||
this.$refs["form"].validate(valid => {
|
|
||||||
if (valid) {
|
|
||||||
if (this.form.suitId != null) {
|
|
||||||
updateSuit(this.form).then(response => {
|
|
||||||
this.$modal.msgSuccess("修改成功");
|
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
addSuit(this.form).then(response => {
|
|
||||||
this.$modal.msgSuccess("新增成功");
|
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const suitIds = row.suitId || this.ids;
|
const suitIds = row.suitId || this.ids;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user