Commit 66a16fcb by 李伟康

11月底需求

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