Commit 3af1f79a by 李伟康

Merge branch 'dev_lwk' into 'v3.24.0'

上线合并

See merge request !29
2 parents caac0e8f 91141fe2
...@@ -70,7 +70,6 @@ ...@@ -70,7 +70,6 @@
</template> </template>
<template #prizeId> <template #prizeId>
<prize-box <prize-box
:value.sync="configForm.prizeType"
:form="configForm" :form="configForm"
@choose="choose" @choose="choose"
ref="prizeRef" ref="prizeRef"
...@@ -118,7 +117,8 @@ export default { ...@@ -118,7 +117,8 @@ export default {
winningTime: '', winningTime: '',
groupType: 0, groupType: 0,
groupList: [], groupList: [],
prizeId: '' prizeId: '',
prizeType: ''
}, },
rule: rule(this), rule: rule(this),
formData: formData(this), formData: formData(this),
...@@ -129,6 +129,11 @@ export default { ...@@ -129,6 +129,11 @@ export default {
watch: { watch: {
'configForm.merchantId' (n) { 'configForm.merchantId' (n) {
this.$refs.prizeRef.reset() this.$refs.prizeRef.reset()
this.configForm.groupList = []
this.choose({
prizeId: '',
prizeType: ''
})
}, },
'configForm.maxNumber' (n) { 'configForm.maxNumber' (n) {
this.configForm.winningNumber = 0 this.configForm.winningNumber = 0
...@@ -143,6 +148,11 @@ export default { ...@@ -143,6 +148,11 @@ export default {
} }
} }
}, },
computed: {
formRef () {
return this.$refs.formRef.$refs.formRef
}
},
mounted () { mounted () {
}, },
methods: { methods: {
...@@ -170,21 +180,19 @@ export default { ...@@ -170,21 +180,19 @@ export default {
console.log(error) console.log(error)
this.$loading().close() this.$loading().close()
} }
}, },
choose (e) { choose ({ prizeId, prizeType }) {
this.configForm.prizeId = e this.configForm.prizeId = prizeId
this.configForm.prizeType = this.$refs.prizeRef.prizeType this.configForm.prizeType = prizeType
this.FromRef().clearValidate('prizeId') this.formRef.clearValidate('prizeId')
}, },
handleConfirm () { handleConfirm () {
this.FromRef().validate(valid => { this.formRef.validate(valid => {
console.log(valid) console.log(valid)
}) })
}, },
FromRef(){
return this.$refs.formRef.$refs.formRef
}
} }
} }
</script> </script>
......
import * as dayjs from 'dayjs'
const generateOptionsArray = function (count = 9) { const generateOptionsArray = function (count = 9) {
return Array.from({ length: count }, (_, index) => ({ return Array.from({ length: count }, (_, index) => ({
optionId: Number(index + 1), optionId: Number(index + 1),
...@@ -69,7 +70,7 @@ export const formData = that => { ...@@ -69,7 +70,7 @@ export const formData = that => {
that.$loading().close() that.$loading().close()
if (res) { if (res) {
config[targetItem.name] = res config[targetItem.name] = res
that.formRef().validateField(targetItem.name) that.formRef.validateField(targetItem.name)
} else throw '上传失败' } else throw '上传失败'
} catch (error) { } catch (error) {
that.$loading().close() that.$loading().close()
...@@ -159,13 +160,38 @@ export const rule = that => { ...@@ -159,13 +160,38 @@ export const rule = that => {
endTimeType: [{ endTimeType: [{
required, required,
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
if (value == 1 && !that.configForm.endTime) { try {
callback(new Error('请选择接龙结束时间')) if (value == 1) {
if (!that.configForm.endTime) throw '请选择接龙结束时间'
else {
if (dayjs(that.configForm.endTime).valueOf() < dayjs().valueOf()) throw '接龙结束时间需大于当前时间'
}
}
callback()
} catch (error) {
callback(new Error(error))
} }
callback()
}, },
}], }],
winningTime: [{ required, message: '请选择接龙开奖时间', trigger }], winningTime: [{
required, trigger,
validator: (rule, value, callback) => {
try {
if (!value) throw '请选择接龙开奖时间'
else {
if (that.configForm.endTimeType != 1) {
if (dayjs(value).valueOf() < dayjs().valueOf()) throw '接龙开奖时间需大于当前时间'
} else {
if (dayjs(value).valueOf() < dayjs(that.configForm.endTime).valueOf()) throw '接龙开奖时间需大于或等于接龙结束时间'
}
}
callback()
} catch (error) {
callback(new Error(error))
}
},
}],
groupType: [{ groupType: [{
required, required,
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
......
...@@ -60,7 +60,6 @@ export default { ...@@ -60,7 +60,6 @@ export default {
name: 'prize-box', name: 'prize-box',
components: { RedEnvelopeItem, EquityItem, CouponItem }, components: { RedEnvelopeItem, EquityItem, CouponItem },
props: { props: {
value: [String, Number],
form: { form: {
type: Object, type: Object,
default: () => { } default: () => { }
...@@ -144,22 +143,20 @@ export default { ...@@ -144,22 +143,20 @@ export default {
if (!merchantId) return if (!merchantId) return
try { try {
this.$loading() this.$loading()
// this.activityObj.loading = true
const res = await this.$apis.questionnaire[targetApi](params) const res = await this.$apis.questionnaire[targetApi](params)
let data = res let data = res
this.dataList[index].list = index == 2 ? data.list : data this.dataList[index].list = index == 2 ? data.list : data
// if (index == 2) {
// data = [...this.activityObj.data, ...res.list]
// this.activityObj.total = res.total
// }
this.$loading().close() this.$loading().close()
} catch (error) { } catch (error) {
console.log(error) console.log(error)
this.$loading().close() this.$loading().close()
} }
}, },
choose (e) { choose (prizeId) {
this.$emit('choose', e) this.$emit('choose', {
prizeId,
prizeType: this.prizeType
})
} }
} }
} }
......
<template> <template>
<div> <div class="layout">
<div class="fixed-content">
<template v-for="(i,index) in fixedForm">
<template>
<div
:key="index"
class="item flex"
>
<div class="label">{{i.label}}:</div>
<div class="value">
<template v-if="i.formatter">
{{i.formatter(data)}}
</template>
<template v-else>
{{ data[i.key] || '--'}}
</template>
</div>
</div>
</template>
</template>
</div>
<div class="container">
<div class="sticky">
<GLCombiForm
ref="showSearch"
:rowNumber="2"
:formObj="searchForm"
:formData="searchFormData"
@handleOk="handleSearch"
@handleRest="handleReset"
></GLCombiForm>
<div class="sticky-btns">
<div class="btns">
<el-button
type="default"
@click="handleExport"
>导出</el-button>
</div>
</div>
</div>
<div class="tabelList">
<GLTable
ref="listRef"
:getListApi="getListApi"
:searchForm="searchForm"
:noDataImg="url"
:tableParams="tableParams"
:pageConf="pageConf"
>
<template
slot="status"
slot-scope="scope"
>
<div :class="`status status-${scope.scope.status}`">
{{{
'0':'未领取',
'1':'已领取'
}[scope.scope.status]}}
</div>
</template>
</GLTable>
</div>
</div>
</div> </div>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
export default { import url from '@/assets/empty.png'
name: '', import { exportFn } from '@/common/constant'
data () { import util from '@/utils/util'
return { const solitaireTableColumns = [
} {
label: '手机号码',
prop: 'name',
minWidth: 120
},
{
label: '用户名称',
prop: 'cardTitle',
minWidth: 100
},
{
label: '接龙数字',
prop: 'cardTitle',
minWidth: 100
},
{
label: '接龙时间',
prop: 'cardTitle',
minWidth: 100
},
], winningTableColumns = [
{
label: '手机号码',
prop: 'name',
minWidth: 120
},
{
label: '用户名称',
prop: 'cardTitle',
minWidth: 100
},
{
label: '接龙数字',
prop: 'cardTitle',
minWidth: 100
},
{
label: '接龙时间',
prop: 'cardTitle',
minWidth: 100
},
{
label: '状态',
minWidth: 100,
addHtml: 'status'
},
]
export default {
name: 'Questionnaire',
data () {
return {
url,
data: {},
fixedForm: [
{
label: '卡片标题',
key: ''
},
{
label: '创建时间',
formatter (cell) {
return cell
}
},
{
label: '开奖时间',
formatter (cell) {
return cell
}
},
{
label: '中奖数字',
key: ''
},
{
label: '关联奖品',
key: ''
},
{
label: '所属渠道',
key: ''
},
],
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'count' },
searchForm: {
phone: '',
name: '',
activityTime: ''
},
searchFormData: [
{
label: '手机号码',
name: 'phone',
type: 'input',
maxlength: 11
},
{
label: '用户名称',
name: 'name',
type: 'input',
maxlength: 100
},
{
label: '接龙时间',
name: 'activityTime',
type: 'datePicker',
isClear: true,
valueFormat: 'yyyy-MM-dd',
customPickerOptions: {
disabledDate (date) {
const yesterday = new Date(new Date().setDate(new Date().getDate()))
return date > yesterday
}
}
},
],
getListApi: this.$apis.questionnaire.getQuestionnaireList,
tableParams: {
listName: 'data',
tableColumns: this.$route.query.type ? winningTableColumns : solitaireTableColumns
},
}
},
mounted () {
},
methods: {
handleSearch () {
this.$refs.listRef.refreshTable()
}, },
mounted () { handleReset () {
this.searchForm = this.$options.data.call(this).searchForm
this.handleSearch()
},
handleExport () {
this.$apis.questionnaire.exportQuestionnaireList({ ...this.searchForm, ...this.$refs.listRef.page }).then(res => {
exportFn(res)
})
},
download (url) {
util.downloadIamge(url)
}, },
methods: {
}
} }
}
</script> </script>
<style scoped lang='scss'> <style scoped lang='scss'>
.layout {
height: calc(100vh - 80px);
.fixed-content {
height: 100px;
background: #ffffff;
margin-bottom: 16px;
display: grid;
grid-template-columns: repeat(3, 1fr);
font-size: 14px;
color: #666666;
.item {
line-height: 20px;
.label {
width: 154px;
text-align: right;
flex-shrink: 0;
}
.value {
color: #333333;
}
}
}
.container {
height: calc(100% - 116px);
background-color: #fff;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding: 20px;
overflow-y: scroll;
.sticky {
position: relative;
z-index: 2;
/deep/.el-tag--info {
max-width: 50%;
}
&-btns {
position: absolute;
right: 0;
bottom: 10px;
overflow: hidden;
.el-button + .el-button {
margin-left: 8px;
}
.btns {
transition: all 0.25s;
.el-button {
padding: 8px 15px;
min-width: 60px;
}
}
}
}
.qr {
width: 36px;
height: 36px;
img {
width: 100%;
height: 100%;
vertical-align: top;
}
}
}
}
.img-plus {
width: 200px;
height: 200px;
}
.download-img {
cursor: pointer;
margin-top: 10px;
font-size: 14px;
font-weight: 600;
color: #5850ff;
line-height: 20px;
text-align: center;
}
.status {
display: flex;
align-items: center;
&::before {
content: '';
width: 8px;
height: 8px;
border-radius: 100%;
margin-right: 8px;
background: #999999;
}
}
.status-0 {
&::before {
background: #f8b757;
}
}
.status-1 {
&::before {
background: #4aca74;
}
}
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -251,7 +251,7 @@ export default { ...@@ -251,7 +251,7 @@ export default {
type: 'text', type: 'text',
}, },
listeners: { listeners: {
// click: row => click: row => this.jumpDetail(row)
} }
}, },
{ {
...@@ -262,7 +262,7 @@ export default { ...@@ -262,7 +262,7 @@ export default {
}, },
condition: row => row.status == 0, condition: row => row.status == 0,
listeners: { listeners: {
// click: row => click: row => this.jumpDetail(row, 1)
} }
}, },
], ],
...@@ -326,6 +326,16 @@ export default { ...@@ -326,6 +326,16 @@ export default {
type type
} }
}) })
},
jumpDetail (row, type) {
this.$router.push({
path: '/solitaire/detail',
query: {
$title: type ? '中奖明细' : '接龙明细',
id: row.id,
type
}
})
} }
} }
} }
...@@ -407,22 +417,4 @@ export default { ...@@ -407,22 +417,4 @@ export default {
background: #4aca74; background: #4aca74;
} }
} }
/deep/.copy-box {
display: flex;
flex-direction: column;
justify-content: center;
height: 100%;
font-size: 16px;
color: #333333;
.input {
transform: translateY(-4px);
margin: 0 auto;
}
.tips {
font-size: 12px;
color: #5850ff;
margin-left: 148px;
width: fit-content;
}
}
</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!