Commit 66a16fcb by 李伟康

11月底需求

1 parent 440bbf78
......@@ -94,7 +94,7 @@ export default {
method: 'scrm.api.coupon.list.merchant',
validType: 'valid',
directionalFlag: 1,
pageSize: 20,
pageSize: 100,
discountTypes: [2, 3, 4],
status: 2,
...params
......
......@@ -134,5 +134,6 @@ img{
.tips {
font-size: 14px;
color: #666666;
max-width: 80%;
}
}
\ No newline at end of file
......@@ -30,12 +30,13 @@
<step-one
v-show="step == 1"
ref="stepOne"
:readonly="readonly"
:disabled="disabled"
/>
<step-two
v-show="step == 2"
ref="stepTwo"
:readonly="readonly"
:disabled="disabled"
:userInfoFieldList="userInfoFieldList"
/>
</div>
<GLFooter class="footer">
......@@ -47,7 +48,7 @@
type="primary"
@click="handleConfirm"
size="medium"
>{{step == 1?'下一步': readonly ? '返回' :'提交'}}</el-button>
>{{step == 1?'下一步': disabled ? '返回' :'提交'}}</el-button>
</GLFooter>
</div>
</template>
......@@ -65,19 +66,21 @@ export default {
step: 1,
tabs: ['基本信息', '配置内容'],
loading: false,
readonly: false,
disabled: false,
fromId: '',
isEdit: false
isEdit: false,
userInfoFieldList: []
}
},
mounted () {
const { id, type } = this.$route.query
if (id) {
this.fromId = id
this.readonly = !type
this.disabled = !type
this.getQuestionnaireDetail()
this.isEdit = type
}
this.getUserInfoFieldList()
},
methods: {
async getQuestionnaireDetail () {
......@@ -92,6 +95,11 @@ export default {
this.setStepOneData(stepOne, data)
this.setStepTwoData(stepTwo, data)
},
async getUserInfoFieldList () {
if (this.disabled) return
const res = await this.$apis.questionnaire.getUserInfoFieldList()
this.userInfoFieldList = res || []
},
setStepOneData (stepOne, data) {
stepOne.merchantObj.data = [{
confId: data.merchantId,
......@@ -113,7 +121,7 @@ export default {
3: 3
}[data.activityType]
}
if (!this.readonly || data.activityId) stepOne.getActivityList()
if (!this.disabled || data.activityId) stepOne.getActivityList()
},
setStepTwoData (stepTwo, res) {
stepTwo.configForm = {
......@@ -137,16 +145,19 @@ export default {
text: e.text,
userInfoField: e.userInfoField,
option,
data
data,
itemValue: type == 2 || type == 5 ? [] : ''
})
})
console.log(stepTwo.questionsList)
},
handleCancel () {
const { step } = this
step == 1 ? this.$router.go(-1) : this.step = 1
},
handleConfirm (autoJump = true) {
const { step, isEdit, fromId, readonly, $refs: {
const { step, isEdit, fromId, disabled, $refs: {
stepOne,
stepTwo
} } = this,
......@@ -156,7 +167,7 @@ export default {
if (valid) this.step = 2
})
} else {
if (readonly) return this.$router.go(-1)
if (disabled) return this.$router.go(-1)
stepTwo.formRef().validate(async valid => {
if (valid) {
this.loading = true
......
......@@ -23,7 +23,7 @@
v-reachbottom="onReachBottom"
@focus="selectFocus"
:loading="loading"
:disabled="readonly"
:disabled="disabled"
@change="change"
>
<el-option
......@@ -46,7 +46,7 @@
@click="changeActivity(index)"
:class="['tab',{active:index == tabsObj.index}]"
:key="index"
:disabled="index == 1 || readonly"
:disabled="index == 1 || disabled"
>{{i}}</el-button>
</template>
</template>
......@@ -68,7 +68,7 @@
}[tabsObj.index]"
:configForm="configForm"
:data="i"
:readonly="readonly"
:disabled="disabled"
@choose="choose"
></component>
</template>
......@@ -103,7 +103,7 @@ export default {
mixins: [getMerchantListMixin],
components: { RedEnvelopeItem, EquityItem, CouponItem },
props: {
readonly: Boolean
disabled: Boolean
},
data () {
return {
......@@ -193,7 +193,7 @@ export default {
}
},
watch: {
'readonly' (n) {
'disabled' (n) {
this.formData.map(e => {
e.isDisabled = n
})
......@@ -221,7 +221,7 @@ export default {
{ total, pageNum } = _this.activityObj
if (condition) {
if (index == 2) {
if (Math.ceil(total / 20) > pageNum) {
if (Math.ceil(total / 100) > pageNum) {
_this.activityObj.pageNum += 1
_this.getActivityList()
} else {
......
......@@ -111,20 +111,20 @@
<template #label>
<span class="tips-block">
<span class="tips-label">选项</span>
<el-popover
placement="top"
:width="200"
trigger="hover"
>
<div>
{{configForm.type != 5?'各选项之间需回车换行':'最多支持3级,各级间使用“/”进行分隔。如: 广东省/深圳市/南山区'}}
</div>
<img
slot="reference"
class="tips-icon"
src="@/assets/icon-tip.png"
/>
</el-popover>:
<template v-if="configForm.type != 5">
<el-popover
placement="top"
:width="200"
trigger="hover"
>
各选项之间需回车换行
<img
slot="reference"
class="tips-icon"
src="@/assets/icon-tip.png"
/>
</el-popover>
</template>:
</span>
</template>
<template v-if="configForm.type == 5">
......@@ -149,6 +149,7 @@
target="_blank"
>下载模板</a>
</div>
<div class="tips">最多支持3级,各级间使用“/”进行分隔。如:广东省/深圳市/南山区</div>
</template>
<el-input
style="width:580px"
......@@ -447,8 +448,8 @@ export default {
}
.tips-icon {
display: inline-block;
width: 14px;
height: 14px;
width: 13px;
height: 13px;
margin-right: 0px !important;
vertical-align: middle;
cursor: pointer;
......@@ -473,7 +474,8 @@ export default {
.btn-box {
display: flex;
align-items: center;
margin-bottom: 10px;
height: 32px;
margin-top: 4px;
a {
margin-left: 8px;
color: #5850ff;
......@@ -496,6 +498,12 @@ export default {
}
}
}
.tips {
font-size: 14px;
color: #999999;
line-height: 20px;
padding: 8px 0;
}
.error {
width: 580px;
height: 40px;
......
......@@ -18,7 +18,7 @@
v-model="configForm.title"
placeholder="请输入"
maxlength="8"
:disabled="readonly"
:disabled="disabled"
></el-input>
</el-form-item>
<el-form-item
......@@ -34,7 +34,7 @@
placeholder="请输入"
maxlength="50"
show-word-limit
:disabled="readonly"
:disabled="disabled"
></el-input>
</el-form-item>
<el-form-item
......@@ -42,34 +42,36 @@
prop="questions"
class="m-t-20"
>
<div class="config-box">
<template v-for="(i,index) in questionsList">
<div
class="config-box"
ref="itemBox"
>
<template v-for="(i, index) in questionsList">
<template>
<div
:key="index"
class="item"
:ref="`item-${index}`"
>
<div :class="['label',{'required':i.required}]">
{{i.text}}:
</div>
<div :class="['label', { required: i.required }]">{{ i.text }}:</div>
<template v-if="i.type == 1">
<el-radio-group
v-model="i.itemValue"
class="radio"
>
<template v-for="(item,ind) in i.data">
<template v-for="(item, ind) in i.data">
<template>
<el-radio
:key="ind"
:label="item"
>{{item}}</el-radio>
>{{ item }}</el-radio>
</template>
</template>
</el-radio-group>
</template>
<template v-if="i.type == 2">
<el-checkbox-group v-model="i.itemValue">
<template v-for="(item,ind) in i.data">
<template v-for="(item, ind) in i.data">
<template>
<el-checkbox
:label="item"
......@@ -85,9 +87,10 @@
v-model="i.itemValue"
placeholder="请输入"
type="textarea"
:autosize="{ minRows: 3,maxRows:3}"
:autosize="{ minRows: 3, maxRows: 3 }"
:maxlength="i.data"
show-word-limit
resize="none"
></el-input>
</template>
<template v-if="i.type == 4">
......@@ -97,7 +100,7 @@
style="width:432px;"
>
<el-option
v-for="(item,ind) in i.data"
v-for="(item, ind) in i.data"
:key="ind"
:label="item"
:value="item"
......@@ -112,15 +115,15 @@
></el-cascader>
</template>
<div class="control-box">
<template v-for="(c,ind) in controlOptions">
<template v-for="(c, ind) in controlOptions">
<template>
<el-button
:key="ind"
type="text"
@click="controlClick(index,ind)"
:disabled="controlDisabled(index,ind) || readonly"
@click="controlClick(index, ind)"
:disabled="controlDisabled(index, ind) || disabled"
>
{{c}}
{{ c }}
</el-button>
</template>
</template>
......@@ -132,7 +135,7 @@
icon="el-icon-plus"
size="small"
@click="editQuestionsObj.show = true"
:disabled="readonly"
:disabled="disabled"
>添加题目</el-button>
</div>
</el-form-item>
......@@ -154,20 +157,27 @@
<div class="over-box">
<div class="el-icon-warning"></div>
请确认是否删除以下题目?
<div class="tips">题目名称:{{delObj.text}}</div>
<div class="tips">题目名称:{{ delObj.text }}</div>
</div>
</template>
</GLDialog>
</el-scrollbar>
</template>
<script type='text/ecmascript-6'>
<script type="text/ecmascript-6">
import EditQuestions from './EditQuestions.vue'
const marginBottom = 16,
translateY = (val, size) => `translateY(${val}px) `
// ${size == 1 ? 'scale(1.01)' : ''}
export default {
name: 'StepTwo',
components: { EditQuestions },
props: {
readonly: Boolean
disabled: Boolean,
userInfoFieldList: {
type: Array,
default: () => []
}
},
data () {
return {
......@@ -185,14 +195,12 @@ export default {
show: false
},
questionsList: [],
userInfoFieldList: [],
controlOptions: ['编辑', '删除', '上移', '下移', '最前', '最后'],
delObj: {},
delList: []
}
},
mounted () {
this.getUserInfoFieldList()
this.addEvent()
},
methods: {
......@@ -207,7 +215,6 @@ export default {
_this.questionsList.splice(index, 0, questionsList)
_this.configForm.questions.splice(index, 0, questions)
delList.pop()
_this.updateQuestionnaire()
}
}
})
......@@ -215,10 +222,6 @@ export default {
formRef () {
return this.$refs.formRef
},
async getUserInfoFieldList () {
const res = await this.$apis.questionnaire.getUserInfoFieldList()
this.userInfoFieldList = res || []
},
async addQuestions (params, index) {
params.itemValue = params.type == 2 || params.type == 5 ? [] : ''
const obj = {
......@@ -251,14 +254,7 @@ export default {
},
controlClick (index, ind) {
const { questionsList } = this,
{ questions } = this.configForm,
moveItem = (array, originalIndex, newIndex) => {
if (originalIndex < 0 || originalIndex >= array.length || newIndex < 0 || newIndex >= array.length) return array
const elementToMove = array[originalIndex]
array.splice(originalIndex, 1)
array.splice(newIndex, 0, elementToMove)
return array
}
{ questions } = this.configForm
if (ind == 0) this.editQuestionsObj = {
show: true,
data: questionsList[index],
......@@ -270,14 +266,8 @@ export default {
index
}
else {
const targetIndex = {
2: index - 1,
3: index + 1,
4: 0,
5: questionsList.length - 1
}[ind]
moveItem(questionsList, index, targetIndex)
moveItem(questions, index, targetIndex)
this.moveItem(questionsList, index, ind, true)
this.moveItem(questions, index, ind)
}
},
delItem () {
......@@ -293,19 +283,82 @@ export default {
this.delObj = {
show: false
}
this.updateQuestionnaire()
},
controlDisabled (index, ind) {
const { questionsList } = this
let disabled = false
if ((index == 0 && (ind == 2 || ind == 4)) || (index == questionsList.length - 1 && (ind == 3 || ind == 5))) disabled = true
return disabled
},
async moveItem (array, originalIndex, targetIndex, moveElement = false) {
const LENGTH = array.length,
newIndex = {
2: originalIndex - 1,
3: originalIndex + 1,
4: 0,
5: LENGTH - 1
}[targetIndex],
elementToMove = array[originalIndex],
items = [],
moveUP = targetIndex < 4,
delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
if (moveElement) {
const refs = this.$refs
// 获取所有元素的引用
for (let i = 0; i < LENGTH; i++) {
const [item] = refs[`item-${i}`]
item.className = 'item move'
items.push(item)
}
const originalEl = items[originalIndex],
targetEl = items[newIndex],
originalOffsetTop = originalEl.offsetTop,
targetOffsetTop = targetEl.offsetTop,
originalOffsetHeight = originalEl.offsetHeight + marginBottom,
targetOffsetHeight = targetEl.offsetHeight + marginBottom
if (originalOffsetTop > targetOffsetTop) {
if (moveUP) {
//上移
originalEl.style.transform = translateY(-targetOffsetHeight)
targetEl.style.transform = translateY(originalOffsetHeight)
} else {
//最前
originalEl.style.transform = translateY(-originalOffsetTop)
for (let i = 0; i < originalIndex; i++) {
items[i].style.transform = translateY(originalOffsetHeight)
}
}
} else {
if (moveUP) {
// 下移
originalEl.style.transform = translateY(targetOffsetHeight)
targetEl.style.transform = translateY(-originalOffsetHeight)
} else {
//最后
originalEl.style.transform = translateY(targetOffsetTop - originalOffsetTop - Math.abs(targetOffsetHeight - originalOffsetHeight))
for (let i = originalIndex + 1; i < LENGTH; i++) {
items[i].style.transform = translateY(-originalOffsetHeight)
}
}
}
}
await delay(500)
// 清空元素的样式和位置
items.length && items.map(e => {
e.className = 'item'
e.style.transform = ''
})
// 移动元素到新位置
array.splice(originalIndex, 1)
array.splice(newIndex, 0, elementToMove)
return array
}
}
}
</script>
<style scoped lang='scss'>
<style scoped lang="scss">
.step-box {
width: 100%;
height: 100%;
......@@ -326,6 +379,10 @@ export default {
}
.config-box {
width: 100%;
position: relative;
}
.move {
transition: all 0.5s ease;
}
.item {
width: 990px;
......@@ -333,6 +390,7 @@ export default {
display: flex;
margin-bottom: 16px;
padding: 20px;
position: relative;
.label {
font-size: 14px;
color: #333333;
......@@ -367,4 +425,4 @@ export default {
}
}
}
</style>
\ No newline at end of file
</style>
......@@ -112,6 +112,40 @@
</div>
</template>
</GLDialog>
<GLDialog
title="复制问卷"
@onCancel="copyParmas.show = false"
:visible.sync="copyParmas.show"
mode="small"
hasFooter
>
<template #default>
<div class="over-box">
<div class="flex">
<div class="label">问卷名称:</div>
<div class="input">
<el-input
placeholder="请输入"
size="small"
v-model="test"
maxlength="50"
>
</el-input>
<el-button class="tips" type="text" @click="test = copyParmas.name">使用原问卷名称</el-button>
</div>
</div>
</div>
</template>
<template #footer>
<div>
<el-button
type="primary"
:size="btnSize"
@click="copyQiestion"
>提交</el-button>
</div>
</template>
</GLDialog>
</div>
</template>
......@@ -252,7 +286,14 @@ export default {
type: 'text',
},
listeners: {
click: row => this.copy(row)
click: row => {
this.copyParmas = {
show: true,
id: row.id,
name: row.name
}
this.test = ''
}
}
},
{
......@@ -272,7 +313,11 @@ export default {
},
issueParmas: {
show: false
}
},
copyParmas: {
show: false
},
test: ''
}
},
mounted () {
......@@ -316,6 +361,11 @@ export default {
show: false
}
},
async copyQiestion () {
this.copyParmas = {
show: false
}
},
handleExport () {
this.$apis.questionnaire.exportQuestionnaireList({ ...this.searchForm, ...this.$refs.listRef.page }).then(res => {
exportFn(res)
......@@ -416,4 +466,24 @@ export default {
background: #4aca74;
}
}
/deep/.over-box {
.flex {
font-size: 14px;
color: #333333;
transform: translateY(-50%);
.input {
position: relative;
width: 284px;
height: 32px;
.tips {
position: absolute;
font-size: 12px;
color: #5850ff;
margin-top: 8px;
left: 0;
top: 32px;
}
}
}
}
</style>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!