Commit 8d85c996 by zhangquan

bug修复

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