Commit 6f2e33dc by 前端

提交

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