Commit 6f2e33dc by 前端

提交

1 parent 523c7dc5
......@@ -28,6 +28,7 @@
size="small"
@change="changeMerchant"
@focus="selectMerchant"
:loading="merchantLoading"
>
<el-option
v-for="(item, index) in merchantList"
......@@ -44,6 +45,7 @@
size="small"
@focus="openActivityDia"
:disabled="isEditor"
readonly
></el-input>
</el-form-item>
<el-form-item label="任务指定人群:" prop="crowd">
......@@ -177,7 +179,10 @@
:prop="'missionList.' + index1 + '.rewardType'"
:rules="taskFormRules.rewardType"
>
<el-radio-group v-model="itm.rewardType">
<el-radio-group
v-model="itm.rewardType"
@change="rewardTypeChange(itm)"
>
<el-radio :label="1">累计奖励</el-radio>
<el-radio :label="2">排名奖励</el-radio>
</el-radio-group>
......@@ -188,7 +193,10 @@
:prop="'missionList.' + index1 + '.rewardCount'"
:rules="taskFormRules.rewardCount"
>
<el-radio-group v-model="itm.rewardCount">
<el-radio-group
v-model="itm.rewardCount"
@change="rewardCountChange(itm)"
>
<el-radio :label="1">单次</el-radio>
<el-radio :label="2">重复累计</el-radio>
</el-radio-group>
......@@ -286,6 +294,7 @@
import { commonApi } from '../../../api/commonApi'
import { taskApi } from '../../../api/task'
import ActivityDia from './components/activityDia.vue'
import { utils } from 'glsx-common'
export default {
components: {
ActivityDia,
......@@ -329,18 +338,19 @@ export default {
activityDiaVisible: false,
// 活动日期天数
taskDateNum: 0,
merchantLoading: false,
btnList: [
{
name: '表情',
funcName: '',
type: 'expression',
limitSize: 10,
limitNum: 9,
},
{
name: '图片',
funcName: '',
type: 'img',
limitNum: 9,
uploadApi: commonApi.uploadImgApi,
},
{
......@@ -381,25 +391,25 @@ export default {
// 分享指标任务类型
shareObj: {
missionMaterialList: [],
rewardType: '0',
rewardCount: '0',
rewardType: '',
rewardCount: '',
triggerValue: '',
},
// 浏览指标任务类型
browseObj: {
rewardType: '0',
rewardCount: '0',
rewardType: '',
rewardCount: '',
repeatCount: '',
triggerValue: '',
},
// 访客指标任务类型
visitorObj: {
rewardType: '0',
triggerValue: '0',
rewardType: '',
triggerValue: '',
},
// 成单指标任务类型
orderObj: {
rewardType: '0',
rewardType: '',
triggerValue: '',
},
// 编辑任务计划数据
......@@ -510,12 +520,16 @@ export default {
})
return
}
this.merchantLoading = true
let params = {}
params.merchantAccountType = 4
params.merchantName = query
taskApi.findMerchantByScene(params).then((res) => {
console.log(res)
this.merchantList = res.data
if (res.code == 0) {
this.merchantList = res.data
}
this.merchantLoading = false
})
},
// 商户改变获取商户名
......@@ -523,13 +537,17 @@ export default {
this.basicForm.merchantName =
val &&
this.merchantList.find((item) => item.merchantId == val).merchantName
// 清空活动
this.basicForm.activityId = ''
this.basicForm.activityName = ''
this.taskList = []
},
// 根据商户名搜索商户
filterMethod(query) {
if (query !== '') {
this.selectMerchant(query)
}
},
filterMethod: utils.debounce(function (val) {
this.searchValue = val
this.basicForm.merchantName = val
this.selectMerchant(val)
}, 500),
// 选择活动
selectActivity(selectItem) {
console.log(selectItem)
......@@ -596,8 +614,8 @@ export default {
})
// 如果是编辑/复制页面,任务计划回显
if (this.isEditor || this.isClone) this.dealEcho()
// 如果是编辑,还需处理是否可编辑处理
if (this.isEditor) this.getEditTaskList()
// 如果是如果是编辑/新建页面,还需处理当前日期之前是否可编辑处理
if (!this.isClone) this.getEditTaskList()
// 如果是克隆,还需处理克隆时间
if (this.isClone && !this.basicForm.activityName) this.getCloneTaskList()
return this.taskList
......@@ -804,6 +822,17 @@ export default {
}
})
},
// 奖励模式切换
rewardTypeChange(itm) {
itm.rewardCount = ''
itm.triggerValue = ''
},
// 奖励次数切换
rewardCountChange(itm) {
itm.repeatCount = ''
itm.triggerValue = ''
console.log(itm)
},
// 基础信息表单验证
basicFormValidate() {
this.$refs['basicForm'].validate((valid) => {
......@@ -812,23 +841,20 @@ export default {
},
// 任务计划表单验证
taskFormValidate() {
var validFlag = 0
var dayIndex = 0
this.taskList.every((item, index) => {
var validFlag = 0
this.$refs['taskForm'][index].validate((valid) => {
if (!valid) validFlag = validFlag + 1
})
dayIndex = index
console.log(validFlag, '000')
// 检测到未填写跳转到未填写页面
if (validFlag > 0) {
this.$alert('第' + (index + 1) + '天填写未完成', '警告', {
confirmButtonText: '知道了',
callback: (action) => {
this.activeName = index + ''
},
})
return false
}
return true
})
return [validFlag, dayIndex]
},
// 任务计划是否为空验证
taskFormEmptyValidate() {
......@@ -846,7 +872,17 @@ export default {
// 提交任务
submitTask() {
this.basicFormValidate()
this.taskFormValidate()
let validFlag = this.taskFormValidate()
console.log(validFlag, '11')
if (validFlag[0] > 0) {
this.$alert('第' + (validFlag[1] + 1) + '天填写未完成', '警告', {
confirmButtonText: '知道了',
callback: (action) => {
this.activeName = validFlag[1] + ''
},
})
return
}
this.taskFormEmptyValidate()
let params = JSON.parse(JSON.stringify(this.basicForm))
params.startTime = this.startTime
......@@ -864,19 +900,19 @@ export default {
console.log(params, 'params')
// 创建
if (!this.isEditor) {
taskApi.creatMission(params).then((res) => {
console.log(res)
if (res && res.code == 0) {
this.$root.close('*添加任务模板')
this.$root.to([
'任务中心',
'任务平台',
'任务管理',
'任务模板管理',
'任务管理列表',
])
}
})
// taskApi.creatMission(params).then((res) => {
// console.log(res)
// if (res && res.code == 0) {
// this.$root.close('*添加任务模板')
// this.$root.to([
// '任务中心',
// '任务平台',
// '任务管理',
// '任务模板管理',
// '任务管理列表',
// ])
// }
// })
return
}
// 编辑
......
......@@ -266,7 +266,13 @@ export default {
type,
}
this.$root.to(
['任务中心', '任务平台', '任务管理', '任务模板管理', '*添加任务模板'],
[
'任务中心(自测)',
'任务平台',
'任务管理',
'任务模板管理',
'*添加任务模板',
],
para
)
// console.log(this.$root)
......@@ -310,14 +316,26 @@ export default {
// 跳转查看详情
handleViewDetail(scope) {
this.$root.to(
['任务中心', '任务平台', '任务管理', '任务模板管理', '*查看任务'],
[
'任务中心(自测)',
'任务平台',
'任务管理',
'任务模板管理',
'*查看任务',
],
{ taskId: scope.id }
)
},
// 任务分析
handleAnalyze(scope) {
this.$root.to(
['任务中心', '任务平台', '任务管理', '任务模板管理', '*任务分析'],
[
'任务中心(自测)',
'任务平台',
'任务管理',
'任务模板管理',
'*任务分析',
],
{ taskId: scope.id }
)
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!