|
@@ -1,81 +1,106 @@
|
|
<template>
|
|
<template>
|
|
<div class="config-page" v-loading="loading" element-loading-text="加载中" element-loading-spinner="el-icon-loading">
|
|
<div class="config-page" v-loading="loading" element-loading-text="加载中" element-loading-spinner="el-icon-loading">
|
|
<el-row>
|
|
<el-row>
|
|
- <el-col :span="24" style="padding:0 20px;">
|
|
|
|
|
|
+ <el-col :span="4" style="padding:0 20px;">
|
|
<h3>地区维护+预约次数配置</h3>
|
|
<h3>地区维护+预约次数配置</h3>
|
|
</el-col>
|
|
</el-col>
|
|
|
|
+ <el-col :span="3" style="padding:0 20px;">
|
|
|
|
+ <el-button type="primary" size="mini" style="margin:18px 0" @click="handleRefresh">刷新</el-button>
|
|
|
|
+ </el-col>
|
|
</el-row>
|
|
</el-row>
|
|
<el-row>
|
|
<el-row>
|
|
<el-col :span="24" style="padding:0 20px;">
|
|
<el-col :span="24" style="padding:0 20px;">
|
|
<el-table :data="tableData" border stripe style="width: 100%" size="small" max-height="700">
|
|
<el-table :data="tableData" border stripe style="width: 100%" size="small" max-height="700">
|
|
- <el-table-column prop="province" label="省"></el-table-column>
|
|
|
|
- <el-table-column prop="city" label="市"></el-table-column>
|
|
|
|
- <el-table-column prop="county" label="区"></el-table-column>
|
|
|
|
- <el-table-column prop="status" label="状态"></el-table-column>
|
|
|
|
- <el-table-column prop="times" label="预约次数配置">
|
|
|
|
|
|
+ <el-table-column type="index" align="center" label="序号"></el-table-column>
|
|
|
|
+ <el-table-column prop="province" label="省" align="center"></el-table-column>
|
|
|
|
+ <el-table-column prop="city" label="市" align="center"></el-table-column>
|
|
|
|
+ <el-table-column prop="county" label="区" align="center"></el-table-column>
|
|
|
|
+ <el-table-column label="状态" align="center">
|
|
|
|
+ <!-- 状态 true 启用 false 禁用 -->
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <span v-if="scope.row.status" style="color:#45A6B5">启用</span>
|
|
|
|
+ <span v-else style="color:#F56C6C">禁用</span>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column prop="times" label="预约次数配置" align="center">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<el-button type="text" size="small" @click="handleEdit(scope.row)">编辑</el-button>
|
|
<el-button type="text" size="small" @click="handleEdit(scope.row)">编辑</el-button>
|
|
<el-button type="text" size="small" @click="handleView(scope.row)">查看</el-button>
|
|
<el-button type="text" size="small" @click="handleView(scope.row)">查看</el-button>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="操作">
|
|
|
|
|
|
+ <!-- <el-table-column label="操作">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<el-button type="text" size="small" @click="handleOpen(scope.row)">开启</el-button>
|
|
<el-button type="text" size="small" @click="handleOpen(scope.row)">开启</el-button>
|
|
<el-button type="text" size="small" @click="handleClose(scope.row)">关闭</el-button>
|
|
<el-button type="text" size="small" @click="handleClose(scope.row)">关闭</el-button>
|
|
</template>
|
|
</template>
|
|
- </el-table-column>
|
|
|
|
|
|
+ </el-table-column> -->
|
|
</el-table>
|
|
</el-table>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
- <el-dialog :title=" isEdit ? '编辑预约次数' : '查看预约次数'" :visible.sync="dialogVisible" width="35%">
|
|
|
|
- <h3>浙江省杭州市上城区:</h3>
|
|
|
|
|
|
+ <el-dialog :title=" isEdit ? '编辑预约次数' : '查看预约次数'" :visible.sync="dialogVisible" width="35%" @close="handleDialogClose" @open="handleDialogOpen">
|
|
|
|
+ <h3>{{editObj.province}}{{editObj.city}}{{editObj.county}}:</h3>
|
|
<div class="8-12 dialog-item">
|
|
<div class="8-12 dialog-item">
|
|
- <span>08:00-12:00,预约</span>
|
|
|
|
|
|
+ <span>08:30-12:00,预约</span>
|
|
<el-input-number :disabled="!isEdit" v-model="firstVal" size="small" class="num-input" controls-position="right" :min="1" :max="1000"></el-input-number>
|
|
<el-input-number :disabled="!isEdit" v-model="firstVal" size="small" class="num-input" controls-position="right" :min="1" :max="1000"></el-input-number>
|
|
<span>次</span>
|
|
<span>次</span>
|
|
</div>
|
|
</div>
|
|
<div class="13-18 dialog-item">
|
|
<div class="13-18 dialog-item">
|
|
- <span>13:00-18:00,预约</span>
|
|
|
|
|
|
+ <span>12:30-17:00,预约</span>
|
|
<el-input-number :disabled="!isEdit" v-model="secendVal" size="small" class="num-input" controls-position="right" :min="1" :max="1000"></el-input-number>
|
|
<el-input-number :disabled="!isEdit" v-model="secendVal" size="small" class="num-input" controls-position="right" :min="1" :max="1000"></el-input-number>
|
|
<span>次</span>
|
|
<span>次</span>
|
|
</div>
|
|
</div>
|
|
<div class="19-21 dialog-item">
|
|
<div class="19-21 dialog-item">
|
|
- <span>19:00-21:00,预约</span>
|
|
|
|
|
|
+ <span>18:30-21:30,预约</span>
|
|
<el-input-number :disabled="!isEdit" v-model="threeVal" size="small" class="num-input" controls-position="right" :min="1" :max="1000"></el-input-number>
|
|
<el-input-number :disabled="!isEdit" v-model="threeVal" size="small" class="num-input" controls-position="right" :min="1" :max="1000"></el-input-number>
|
|
<span>次</span>
|
|
<span>次</span>
|
|
</div>
|
|
</div>
|
|
<span slot="footer" class="dialog-footer">
|
|
<span slot="footer" class="dialog-footer">
|
|
<el-button @click="dialogVisible = false" size="small" style="width:100px;">取 消</el-button>
|
|
<el-button @click="dialogVisible = false" size="small" style="width:100px;">取 消</el-button>
|
|
- <el-button type="primary" @click="dialogVisible = false" size="small" style="width:100px;">确 定</el-button>
|
|
|
|
|
|
+ <el-button type="primary" :loading="configLoading" @click="handleSubmitConfig" size="small" style="width:100px;">确 定</el-button>
|
|
</span>
|
|
</span>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
+import { getRegionList, setRegionConfig } from '@/request/request'
|
|
export default {
|
|
export default {
|
|
name: 'config',
|
|
name: 'config',
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
loading: false,
|
|
loading: false,
|
|
|
|
+ configLoading: false,
|
|
dialogVisible: false,
|
|
dialogVisible: false,
|
|
- tableData: [
|
|
|
|
- {
|
|
|
|
- province: '河南省',
|
|
|
|
- city: '信阳市',
|
|
|
|
- county: '固始县'
|
|
|
|
- }
|
|
|
|
- ],
|
|
|
|
|
|
+ tableData: [],
|
|
isEdit: false,
|
|
isEdit: false,
|
|
firstVal: '',
|
|
firstVal: '',
|
|
secendVal: '',
|
|
secendVal: '',
|
|
- threeVal: ''
|
|
|
|
|
|
+ threeVal: '',
|
|
|
|
+ editObj: {
|
|
|
|
+ province: '',
|
|
|
|
+ city: '',
|
|
|
|
+ county: '',
|
|
|
|
+ configId: ''
|
|
|
|
+ }
|
|
};
|
|
};
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
-
|
|
|
|
|
|
+ this.getRegionListFn()
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ handleRefresh () {
|
|
|
|
+ this.getRegionListFn()
|
|
|
|
+ },
|
|
|
|
+ getRegionListFn() {
|
|
|
|
+ this.loading = true
|
|
|
|
+ getRegionList({}).then(res => {
|
|
|
|
+ this.loading = false
|
|
|
|
+ this.tableData = res.data || []
|
|
|
|
+ }).catch(e => {
|
|
|
|
+ this.loading = false
|
|
|
|
+ console.log(e);
|
|
|
|
+ })
|
|
|
|
+ },
|
|
handleOpen () {
|
|
handleOpen () {
|
|
this.$confirm('确定开启吗?').then( _=> {
|
|
this.$confirm('确定开启吗?').then( _=> {
|
|
console.log('ok')
|
|
console.log('ok')
|
|
@@ -86,13 +111,71 @@ export default {
|
|
console.log('ok')
|
|
console.log('ok')
|
|
}).catch(_ => {});
|
|
}).catch(_ => {});
|
|
},
|
|
},
|
|
- handleView () {
|
|
|
|
|
|
+ handleDialogClose () {
|
|
|
|
+ this.firstVal = 1
|
|
|
|
+ this.secendVal = 1
|
|
|
|
+ this.threeVal = 1
|
|
|
|
+ },
|
|
|
|
+ handleDialogOpen () {
|
|
|
|
+ this.firstVal = this.findDurationTotal(1)
|
|
|
|
+ this.secendVal = this.findDurationTotal(2)
|
|
|
|
+ this.threeVal = this.findDurationTotal(3)
|
|
|
|
+ },
|
|
|
|
+ handleView (row) {
|
|
|
|
+ this.editObj = { ...row }
|
|
|
|
+ this.firstVal = this.findDurationTotal(1)
|
|
|
|
+ this.secendVal = this.findDurationTotal(2)
|
|
|
|
+ this.threeVal = this.findDurationTotal(3)
|
|
this.dialogVisible = true
|
|
this.dialogVisible = true
|
|
this.isEdit = false
|
|
this.isEdit = false
|
|
},
|
|
},
|
|
- handleEdit () {
|
|
|
|
|
|
+ handleEdit (row) {
|
|
|
|
+ this.editObj = { ...row }
|
|
this.dialogVisible = true
|
|
this.dialogVisible = true
|
|
this.isEdit = true
|
|
this.isEdit = true
|
|
|
|
+ },
|
|
|
|
+ handleSubmitConfig () {
|
|
|
|
+ if (this.isEdit) {
|
|
|
|
+ let configData = {
|
|
|
|
+ configId: this.editObj.configId,
|
|
|
|
+ configValList:[
|
|
|
|
+ {
|
|
|
|
+ duration:1,
|
|
|
|
+ total: this.firstVal
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ duration:2,
|
|
|
|
+ total: this.secendVal
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ duration:3,
|
|
|
|
+ total: this.threeVal
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
|
|
+ }
|
|
|
|
+ this.configLoading = true
|
|
|
|
+ setRegionConfig(configData).then(res => {
|
|
|
|
+ this.configLoading = false
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '配置成功',
|
|
|
|
+ type: 'success'
|
|
|
|
+ })
|
|
|
|
+ this.dialogVisible = false
|
|
|
|
+ this.getRegionListFn()
|
|
|
|
+ }).catch(e => {
|
|
|
|
+ console.log(e)
|
|
|
|
+ this.configLoading = false
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ this.dialogVisible = false
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ findDurationTotal (duration) {
|
|
|
|
+ let configValue = this.editObj.configValue
|
|
|
|
+ let item = configValue.find(item => {
|
|
|
|
+ return item.duration == duration
|
|
|
|
+ })
|
|
|
|
+ return item.total
|
|
}
|
|
}
|
|
},
|
|
},
|
|
};
|
|
};
|