Commit 8d85c996 by zhangquan

bug修复

1 parent 13d05848
...@@ -331,7 +331,7 @@ export default { ...@@ -331,7 +331,7 @@ export default {
padding: 0 17px; padding: 0 17px;
} }
.list_gifts { .list_gifts {
height: 61vh; height: 540px;
padding: 0 16px; padding: 0 16px;
overflow-y: scroll; overflow-y: scroll;
.gift_box{ .gift_box{
......
...@@ -2,17 +2,14 @@ ...@@ -2,17 +2,14 @@
<div class="container"> <div class="container">
<div class="nav"> <div class="nav">
<div style="display: inline-block;"> <div style="display: inline-block;">
<!-- v-if="curIdx>index || curIdx==-1" --> <div class="configItem" :ref="'tempRef'+index" v-for="(item,index) in rowList" :key="item.id" @click="selectedTemp(item)" :class="{curConfigItem:curConfigId==item.id}">{{ item.name }}</div>
<template v-for="item,index in rowList">
<div v-if="curIdx>index || curIdx==-1" class="configItem" :ref="'tempRef'+index" @click="selectedTemp(item)" :class="{curConfigItem:curConfigId==item.id}" :key="item.id">{{ item.name }}</div>
</template>
</div> </div>
<div v-if="showInput" class="inputArea"><el-input maxLength="15" ref="addInput" @blur="inputBlur" v-model="configName" class="input"></el-input></div> <div v-if="showInput" class="inputArea"><el-input maxLength="15" ref="addInput" @blur="inputBlur" v-model="configName" class="input"></el-input></div>
<div v-else class="configItem addBtn" style="cursor: pointer;" @click="addTemplate"><i class="el-icon-plus"></i></div> <div v-else class="configItem addBtn" style="cursor: pointer;" @click="addTemplate"><i class="el-icon-plus"></i></div>
<div v-if="curIdx > -1" class="configItem pullBtn" style="cursor: pointer;"> <div v-if="curIdx > -1" class="configItem pullBtn" style="cursor: pointer;">
<i class="el-icon-arrow-down"></i> <i class="el-icon-arrow-down"></i>
<div class="pullDownArea"> <div class="pullDownArea">
<div class="pullDownItem" @click="selectedTemp(item, 'sort')" :class="{curConfigItem:curConfigId==item.id}" v-for="item,index in colList" :key="item.id">{{ item.name }}</div> <div class="pullDownItem" @click="selectedTemp(item, 'sort')" :class="{curConfigItem:curConfigId==item.id}" v-for="item in colList" :key="item.id">{{ item.name }}</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -41,6 +38,7 @@ ...@@ -41,6 +38,7 @@
</template> </template>
<script> <script>
import { utils } from 'glsx-common'
import selectCouponDialog from './components/selectCouponDialog.vue' import selectCouponDialog from './components/selectCouponDialog.vue'
export default { export default {
name: 'index', name: 'index',
...@@ -124,10 +122,16 @@ import selectCouponDialog from './components/selectCouponDialog.vue' ...@@ -124,10 +122,16 @@ import selectCouponDialog from './components/selectCouponDialog.vue'
}, },
mounted(){ mounted(){
this.getTemplateList() this.getTemplateList()
window.addEventListener('resize', this.resizeDom);
}, },
beforeDestroy(){
window.removeEventListener('resize', this.resizeDom)
},
methods: { methods: {
resizeDom(){
this.calcWidth(true)
},
delCoupon(row){ delCoupon(row){
console.log(row)
this.$confirm('确认删除吗?', '提示', { this.$confirm('确认删除吗?', '提示', {
type: 'warning', type: 'warning',
callback: action => { callback: action => {
...@@ -175,22 +179,24 @@ import selectCouponDialog from './components/selectCouponDialog.vue' ...@@ -175,22 +179,24 @@ import selectCouponDialog from './components/selectCouponDialog.vue'
}, },
selectedTemp(item, isSort){ selectedTemp(item, isSort){
this.curConfigId = item.id this.curConfigId = item.id
if(isSort){ // if(isSort){
let idx = this.templateList.findIndex(row => row.id == item.id) // let idx = this.templateList.findIndex(row => row.id == item.id)
console.log(idx, item.id, this.templateList) // let arr = this.templateList.splice(idx, 1)
let arr = this.templateList.splice(idx, 1) // this.templateList.unshift(arr[0])
this.templateList.unshift(arr[0]) // this.calcWidth()
this.calcWidth() // }
}
this.handleOk() this.handleOk()
}, },
addCoupon(){ addCoupon(){
if(!this.curConfigId) return this.$message.error('请先选择模板'); if(!this.curConfigId) return this.$message.error('请先选择模板');
this.isVisible = true this.isVisible = true
}, },
calcWidth(){ calcWidth(resize){
if(resize){
this.rowList = this.templateList
}
let calculated = false let calculated = false
let mainW = this.$refs.main.offsetWidth let mainW = this.$refs?.main?.offsetWidth || 0
this.$nextTick(()=>{ this.$nextTick(()=>{
this.rowList.reduce((pre, cur,index) => { this.rowList.reduce((pre, cur,index) => {
let curW = this.$refs?.['tempRef'+index]?.[0]?.offsetWidth let curW = this.$refs?.['tempRef'+index]?.[0]?.offsetWidth
...@@ -227,7 +233,6 @@ import selectCouponDialog from './components/selectCouponDialog.vue' ...@@ -227,7 +233,6 @@ import selectCouponDialog from './components/selectCouponDialog.vue'
coupons: e.map(item => {return {couponId: item.id, couponAmount: item.couponAmount}}) coupons: e.map(item => {return {couponId: item.id, couponAmount: item.couponAmount}})
} }
this.$apis.goodsCouponApi.saveCouponInfo(params).then(res => { this.$apis.goodsCouponApi.saveCouponInfo(params).then(res => {
console.log(res)
if(res){ if(res){
this.$message.success('添加成功') this.$message.success('添加成功')
this.handleOk() this.handleOk()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!