Commit fc90098d by 前端

style:代码优化

1 parent cac1ee5e
...@@ -11,52 +11,14 @@ ...@@ -11,52 +11,14 @@
</GLTable> </GLTable>
<!-- 生成弹窗 --> <!-- 生成弹窗 -->
<GLDialog title="生成无忧卡" mode="mid" v-if="addDialog" :visible.sync="addDialog" :before-close="handleClose" @onOk="submitForm('detailForm')" @onCancel="cancelDetailDialog"> <GLDialog title="生成无忧卡" mode="mid" v-if="addDialog" :visible.sync="addDialog" :before-close="handleClose" @onOk="submitForm('detailForm')" @onCancel="cancelDetailDialog">
<el-form :inline="true" :model="addDialogForm" :rules="addDialogRules" ref="detailForm" label-width="120px" class="detailForm"> <glsx-combi-form ref="product" labelWidth="154px" defaultWidth="360px" formRef="detailForm" :formObj="addDialogForm" :formData="addDialogFormData" :formRules="addDialogRules"></glsx-combi-form>
<div class="form">
<el-row>
<el-form-item label="版本:" prop="batchType">
<el-select v-model="addDialogForm.batchType" placeholder="请选择" size="small">
<el-option v-for="(item, index) in dialogEditOptions" :key="index" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="适用类型:" prop="packageCode">
<el-select @change="changePgCode" v-model="addDialogForm.packageCode" placeholder="请选择" size="small">
<el-option v-for="(item, index) in dialogTypeOptions" :key="index" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="数量:" prop="quantity">
<el-input v-model="addDialogForm.quantity" placeholder="请输入1-5000的数字" size="small"></el-input>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="具体价格(万)" prop="actualPrice">
<el-input v-model="addDialogForm.actualPrice" placeholder="请输入" size="small"></el-input>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="使用年限:" prop="servicePeriod">
<el-select v-model="addDialogForm.servicePeriod" placeholder="请选择" size="small">
<el-option v-for="(item, index) in dialogYearOptions" :key="index" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="备注" prop="remark">
<el-input type="textarea" v-model="addDialogForm.remark" maxlength="200" style="width: 320px" placeholder="请输入活动详情或规则"></el-input>
</el-form-item>
</el-row>
</div>
</el-form>
</GLDialog> </GLDialog>
</div> </div>
</div> </div>
</template> </template>
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
import glsxCombiForm from '@/components/glsx-combi-form'
function date_format(date) { function date_format(date) {
var date2 = new Date(date) var date2 = new Date(date)
var YY = date2.getFullYear() + '-' var YY = date2.getFullYear() + '-'
...@@ -102,6 +64,9 @@ const validatorQuantity = (rule, value, callback) => { ...@@ -102,6 +64,9 @@ const validatorQuantity = (rule, value, callback) => {
} }
export default { export default {
name: '', name: '',
components:{
glsxCombiForm
},
data() { data() {
return { return {
date_format, date_format,
...@@ -128,50 +93,99 @@ export default { ...@@ -128,50 +93,99 @@ export default {
servicePeriod: '', servicePeriod: '',
remark: '' remark: ''
}, },
addDialog: false, addDialogFormData: [
addPageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
dialogEditOptions: [
{ {
value: '1', label: '版本',
label: '尊享版' name: 'batchType',
type: 'select',
optionList: [
{
value: '1',
label: '尊享版'
},
{
value: '2',
label: '畅享版'
}
],
optionId: 'value',
optionLabel: 'label'
}, },
{ {
value: '2', label: '适用类型',
label: '畅享版' name: 'packageCode',
} type: 'select',
], optionList: [
dialogTypeOptions: [ {
{ value: 'PC0005',
value: 'PC0005', label: '盗抢全损无忧'
label: '盗抢全损无忧' },
{
value: 'PC0006',
label: '轮胎无忧'
},
{
value: 'PC0007',
label: '整车全损无忧'
},
{
value: 'PC0008',
label: '碰撞无忧'
}
],
optionId: 'value',
optionLabel: 'label',
changeAttr:(e)=>{
this.changePgCode(e)
}
}, },
{ {
value: 'PC0006', type: 'input',
label: '轮胎无忧' label: '数量',
placeholder:'请输入1-5000的数字',
name: 'quantity',
isClear: true
}, },
{ {
value: 'PC0007', type: 'input',
label: '整车全损无忧' label: '具体价格(万)',
name: 'actualPrice',
isClear: true
}, },
{ {
value: 'PC0008', label: '使用年限',
label: '碰撞无忧' name: 'servicePeriod',
} type: 'select',
], isClear: true,
dialogYearOptions: [ optionList: [
{ {
value: '1', value: '1',
label: '1年' label: '1年'
}, },
{ {
value: '2', value: '2',
label: '2年' label: '2年'
},
{
value: '3',
label: '3年'
}
],
optionId: 'value',
optionLabel: 'label'
}, },
{ {
value: '3', type: 'input',
label: '3年' label: '备注',
inputType:'textarea',
name: 'remark',
isClear: true,
placeholder:'请输入活动详情或规则',
maxlength: 200
} }
], ],
addDialog: false,
addPageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
addDialogRules: { addDialogRules: {
batchType: [{ required: true, message: '请选择版本', trigger: 'change' }], batchType: [{ required: true, message: '请选择版本', trigger: 'change' }],
packageCode: [{ required: true, message: '请选择适应类型', trigger: 'change' }], packageCode: [{ required: true, message: '请选择适应类型', trigger: 'change' }],
...@@ -213,7 +227,7 @@ export default { ...@@ -213,7 +227,7 @@ export default {
mounted() {}, mounted() {},
methods: { methods: {
changePgCode(e){ changePgCode(e){
let arr = [ { const arr = [{
value: '1', value: '1',
label: '1年' label: '1年'
}, },
...@@ -225,8 +239,7 @@ export default { ...@@ -225,8 +239,7 @@ export default {
value: '3', value: '3',
label: '3年' label: '3年'
}] }]
if(e=='PC0005' || e=='PC0007'){ const moreArr = [{
this.dialogYearOptions = [ ...arr, {
value: '4', value: '4',
label: '4年' label: '4年'
}, },
...@@ -234,9 +247,8 @@ export default { ...@@ -234,9 +247,8 @@ export default {
value: '5', value: '5',
label: '5年' label: '5年'
}] }]
}else{ const target = this.addDialogFormData.find(item => item.name=='servicePeriod')
this.dialogYearOptions = [...arr] target.optionList = (e=='PC0005' || e=='PC0007') ? [ ...arr, ...moreArr] : [...arr]
}
this.addDialogForm.servicePeriod = '' this.addDialogForm.servicePeriod = ''
}, },
//批量下载 //批量下载
...@@ -269,7 +281,7 @@ export default { ...@@ -269,7 +281,7 @@ export default {
} }
}, },
submitForm(formName) { submitForm(formName) {
this.$refs[formName].validate(valid => { this.$refs.product.$refs[formName].validate(valid => {
if (valid) { if (valid) {
this.$apis.addWorryFree.addCards(this.addDialogForm).then(res => { this.$apis.addWorryFree.addCards(this.addDialogForm).then(res => {
if (res.code == '0') { if (res.code == '0') {
...@@ -305,24 +317,6 @@ export default { ...@@ -305,24 +317,6 @@ export default {
padding: 8px 16px; padding: 8px 16px;
// margin-bottom: 20px; // margin-bottom: 20px;
} }
/deep/ .el-dialog {
.el-dialog__body {
padding: 40px 20px;
display: flex;
justify-content: center;
.el-form-item__label {
color: #333;
}
input {
height: 36px;
width: 320px;
font-size: 14px;
}
}
}
/deep/ .contain .el-input--small .el-input__inner {
width: 215px;
}
.row-btns { .row-btns {
margin-top: 5px; margin-top: 5px;
margin-bottom: 10px; margin-bottom: 10px;
......
...@@ -2,24 +2,9 @@ ...@@ -2,24 +2,9 @@
<div class="equity-wrap"> <div class="equity-wrap">
<el-button type="primary" icon="el-icon-plus" size="small" @click="showDialog('add')"><span style="margin-left: 5px">新增特别约定</span></el-button> <el-button type="primary" icon="el-icon-plus" size="small" @click="showDialog('add')"><span style="margin-left: 5px">新增特别约定</span></el-button>
<div class="equity-wrap contain" style="margin-top: 10px"> <div class="equity-wrap contain" style="margin-top: 10px">
<!-- <el-form :inline="true" label-width="auto" label-position="right" class="selectForm">
<el-row style="align-items: center">
<el-form-item label="特约名称">
<el-input v-model="appointmentForm.spaName" placeholder="请输入" size="small"></el-input>
</el-form-item>
<el-form-item label="特约内容">
<el-input v-model="appointmentForm.spaContent" placeholder="请输入" size="small"></el-input>
</el-form-item>
<el-form-item size="small" style="float: right; margin-right: 0px !important">
<el-button plain size="small" @click="seletTable('reset')" class="selectBtn">重置</el-button>
<el-button type="primary" size="small" @click="seletTable('select')" class="selectBtn">查询</el-button>
<el-button plain size="small" @click="exportTable" class="selectBtn">导出</el-button>
</el-form-item>
</el-row>
</el-form> -->
<GLCombiForm :rowNumber="1" ref="showSearch" :formObj="appointmentForm" :formData="searchFormData" @handleOk="submitForm('modifyForm')" @handleRest="seletTable('reset')"></GLCombiForm> <GLCombiForm :rowNumber="1" ref="showSearch" :formObj="appointmentForm" :formData="searchFormData" @handleOk="submitForm('modifyForm')" @handleRest="seletTable('reset')"></GLCombiForm>
<el-button style="float:right;margin-bottom:10px;" size="small" @click="exportTable" class="selectBtn">导出</el-button> <el-button style="float:right;margin-bottom:10px;" size="small" @click="exportTable" class="selectBtn">导出</el-button>
<GLTable ref="appointmentTable" style="margin-top:10px" :searchForm="appointmentForm" :tableParams="tableParams" :pageConf="tablePageConf" :getListApi="getAppointmentList"> <GLTable ref="appointmentTable" :searchForm="appointmentForm" :tableParams="tableParams" :pageConf="tablePageConf" :getListApi="getAppointmentList">
<span slot="auth-button" slot-scope="scope" :data="scope.scope"> <span slot="auth-button" slot-scope="scope" :data="scope.scope">
<!-- 批次管理详情弹窗按钮 --> <!-- 批次管理详情弹窗按钮 -->
<!-- <el-button type="text" @click="showDialog(scope.scope)">修改</el-button> <!-- <el-button type="text" @click="showDialog(scope.scope)">修改</el-button>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<!-- <el-button fn="开通配置" class="addGood" type="primary" icon="el-icon-plus" @click="jump('add')">开通配置</el-button> --> <!-- <el-button fn="开通配置" class="addGood" type="primary" icon="el-icon-plus" @click="jump('add')">开通配置</el-button> -->
<div class="equity-wrap contain merchant-select"> <div class="equity-wrap contain merchant-select">
<GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :searchSelectObj="searchSelectObj" :formData="searchFormData" @handleOk="selConfig" @handleRest="selConfig('reset')"></GLCombiForm> <GLCombiForm ref="showSearch" :rowNumber="1" :formObj="searchForm" :searchSelectObj="searchSelectObj" :formData="searchFormData" @handleOk="selConfig" @handleRest="selConfig('reset')"></GLCombiForm>
<div class="row-btns" style="margin-top: 20px"> <div class="row-btns">
<!-- <el-button size="small" @click="toggleAll">全选</el-button> --> <!-- <el-button size="small" @click="toggleAll">全选</el-button> -->
<!-- <el-checkbox v-model="checkbox" @change="toggleAll" style="margin-left:20px">全选</el-checkbox> --> <!-- <el-checkbox v-model="checkbox" @change="toggleAll" style="margin-left:20px">全选</el-checkbox> -->
<div style="float: right;" class="primary_plain_btn"> <div style="float: right;" class="primary_plain_btn">
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="equity-wrap"> <div class="equity-wrap">
<div class="equity-wrap contain"> <div class="equity-wrap contain">
<GLCombiForm ref="showSearch" :formObj="detailForm" :formData="detailFormData" @handleOk="detailSelect('select')" @handleRest="detailSelect('reset')"></GLCombiForm> <GLCombiForm ref="showSearch" :formObj="detailForm" :formData="detailFormData" @handleOk="detailSelect('select')" @handleRest="detailSelect('reset')"></GLCombiForm>
<el-alert style="margin-top: 20px" :closable="false" type="info" show-icon>总计{{ line.total }}张,已使用{{ line.usedAmount }}张</el-alert> <el-alert :closable="false" type="info" show-icon>总计{{ line.total }}张,已使用{{ line.usedAmount }}张</el-alert>
<GLTable ref="detailTable" :searchForm="detailForm" :tableParams="detailParams" :pageConf="detailPageConf" :getListApi="getDetailList" :beforeSearchFn="check" style="margin-top: 10px"> <GLTable ref="detailTable" :searchForm="detailForm" :tableParams="detailParams" :pageConf="detailPageConf" :getListApi="getDetailList" :beforeSearchFn="check" style="margin-top: 10px">
<span slot="auth-button" slot-scope="scope" :data="scope.scope"> <span slot="auth-button" slot-scope="scope" :data="scope.scope">
<!-- <el-button type="text" @click="modify(scope.scope)" :disabled="scope.scope.status">修改</el-button> --> <!-- <el-button type="text" @click="modify(scope.scope)" :disabled="scope.scope.status">修改</el-button> -->
...@@ -11,46 +11,14 @@ ...@@ -11,46 +11,14 @@
</GLTable> </GLTable>
</div> </div>
<!-- 详情弹窗 --> <!-- 详情弹窗 -->
<GLDialog title="修改无忧卡" v-if="detailDialog" :visible.sync="detailDialog" mode="mid" :before-close="handleClose"> <GLDialog title="修改无忧卡" v-if="detailDialog" :visible.sync="detailDialog" mode="mid" :before-close="handleClose" @onOk="submitForm('detailForm')" @onCancel="cancelDetailDialog">
<el-form :inline="true" :model="detailDialogForm" :rules="detailDialogRules" ref="detailForm" label-width="120px" class="detailForm"> <glsx-combi-form ref="product" labelWidth="154px" defaultWidth="360px" formRef="detailForm" :formObj="detailDialogForm" :formData="addDialogFormData" :formRules="addDialogRules"></glsx-combi-form>
<div class="form">
<el-row>
<el-form-item label="版本:" prop="batchType">
<el-select v-model="detailDialogForm.batchType" placeholder="请选择" size="small">
<el-option v-for="(item, index) in dialogEditOptions" :key="index" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="适用类型:" prop="packageCode">
<el-select @change="changePgCode" v-model="detailDialogForm.packageCode" placeholder="请选择" size="small">
<el-option v-for="(item, index) in dialogTypeOptions" :key="index" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="具体价格(万)" prop="actualPrice">
<el-input v-model="detailDialogForm.actualPrice" placeholder="请输入" size="small"></el-input>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="使用年限:" prop="servicePeriod">
<el-select v-model="detailDialogForm.servicePeriod" placeholder="请选择" size="small">
<el-option v-for="(item, index) in dialogYearOptions" :key="index" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
</el-row>
</div>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="cancelDetailDialog">取 消</el-button>
<el-button size="small" type="primary" @click="submitForm('detailForm')">确 定</el-button>
</span>
</GLDialog> </GLDialog>
</div> </div>
</template> </template>
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
import glsxCombiForm from '@/components/glsx-combi-form'
function date_format(date) { function date_format(date) {
var date2 = new Date(date) var date2 = new Date(date)
var YY = date2.getFullYear() + '-' var YY = date2.getFullYear() + '-'
...@@ -79,6 +47,9 @@ const validatorActualPrice = (rule, value, callback) => { ...@@ -79,6 +47,9 @@ const validatorActualPrice = (rule, value, callback) => {
} }
export default { export default {
name: '', name: '',
components:{
glsxCombiForm
},
data() { data() {
return { return {
date_format, date_format,
...@@ -241,6 +212,81 @@ export default { ...@@ -241,6 +212,81 @@ export default {
actualPrice: '', actualPrice: '',
servicePeriod: '' servicePeriod: ''
}, },
addDialogFormData: [
{
label: '版本',
name: 'batchType',
type: 'select',
optionList: [
{
value: '1',
label: '尊享版'
},
{
value: '2',
label: '畅享版'
}
],
optionId: 'value',
optionLabel: 'label'
},
{
label: '适用类型',
name: 'packageCode',
type: 'select',
optionList: [
{
value: 'PC0005',
label: '盗抢全损无忧'
},
{
value: 'PC0006',
label: '轮胎无忧'
},
{
value: 'PC0007',
label: '整车全损无忧'
},
{
value: 'PC0008',
label: '碰撞无忧'
}
],
optionId: 'value',
optionLabel: 'label',
changeAttr:(e)=>{
this.changePgCode(e)
}
},
{
type: 'input',
label: '具体价格(万)',
name: 'actualPrice',
isClear: true
},
{
label: '使用年限',
name: 'servicePeriod',
type: 'select',
isClear: true,
optionList: [
{
value: '1',
label: '1年'
},
{
value: '2',
label: '2年'
},
{
value: '3',
label: '3年'
}
],
optionId: 'value',
optionLabel: 'label'
}
],
editOptions: [ editOptions: [
{ {
value: '', value: '',
...@@ -441,7 +487,7 @@ export default { ...@@ -441,7 +487,7 @@ export default {
}, },
methods: { methods: {
changePgCode(e){ changePgCode(e){
let arr = [ { const arr = [{
value: '1', value: '1',
label: '1年' label: '1年'
}, },
...@@ -453,8 +499,7 @@ export default { ...@@ -453,8 +499,7 @@ export default {
value: '3', value: '3',
label: '3年' label: '3年'
}] }]
if(e=='PC0005' || e=='PC0007'){ const moreArr = [{
this.dialogYearOptions = [ ...arr, {
value: '4', value: '4',
label: '4年' label: '4年'
}, },
...@@ -462,9 +507,8 @@ export default { ...@@ -462,9 +507,8 @@ export default {
value: '5', value: '5',
label: '5年' label: '5年'
}] }]
}else{ const target = this.addDialogFormData.find(item => item.name=='servicePeriod')
this.dialogYearOptions = [...arr] target.optionList = (e=='PC0005' || e=='PC0007') ? [ ...arr, ...moreArr] : [...arr]
}
this.detailDialogForm.servicePeriod = '' this.detailDialogForm.servicePeriod = ''
}, },
check() { check() {
...@@ -529,8 +573,7 @@ export default { ...@@ -529,8 +573,7 @@ export default {
this.detailDialogForm = {} this.detailDialogForm = {}
}, },
submitForm(formName) { submitForm(formName) {
console.log(this.detailDialogForm) this.$refs.product.$refs[formName].validate(valid => {
this.$refs[formName].validate(valid => {
if (valid) { if (valid) {
if (this.detailDialogForm.batchType == '尊享版') { if (this.detailDialogForm.batchType == '尊享版') {
this.detailDialogForm.batchType = '1' this.detailDialogForm.batchType = '1'
...@@ -569,28 +612,6 @@ export default { ...@@ -569,28 +612,6 @@ export default {
margin-left: 40px; margin-left: 40px;
padding: 8px 16px; padding: 8px 16px;
} }
/deep/ .el-dialog {
.el-dialog__body {
padding: 40px 20px;
display: flex;
justify-content: center;
.el-form-item__label {
color: #333;
}
input {
height: 36px;
width: 320px;
font-size: 14px;
}
}
.el-dialog__footer {
height: 70px;
.el-button {
width: 72px;
margin: 0 10px;
}
}
}
.row-btns { .row-btns {
margin-top: 5px; margin-top: 5px;
margin-bottom: 10px; margin-bottom: 10px;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!