Commit a01ed0b5 by 李伟康

提交

1 parent df24f7d1
import { http } from '@/main'
const url = '/rop-scrm-marketing/router'
export default {
/**权益卡试用 */
getEquityActivityList (params) {
params.method = 'scrm.api.equity.open.card.price.list.by.merchantid'
return http({
url: '/rop-scrm-equity/router',
data: params
})
},
/**商城券 */
getMerchantCouponList (params) {
const data = {
method: 'scrm.api.coupon.list.merchant',
validType: 'valid',
directionalFlag: 1,
pageSize: 9,
discountTypes: [2, 3, 4],
status: 2,
...params
}
return http({
url: '/rop-scrm-coupon/router',
data
})
},
/**
* 查询门店红包活动列表
*/
getActivityRedEnvelopeList (params) {
params.method = 'marketing.api.activityRedEnvelope.merchant.list'
return http({
url,
data: params,
})
}
}
\ No newline at end of file \ No newline at end of file
...@@ -48,15 +48,15 @@ ...@@ -48,15 +48,15 @@
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import StepOne from './components/StepOne.vue' import StepOne from './components/StepOne/index.vue'
import StepTwo from './components/StepTwo.vue' import StepTwo from './components/StepTwo/index.vue'
export default { export default {
components: { StepOne, StepTwo }, components: { StepOne, StepTwo },
name: '', name: '',
data () { data () {
return { return {
parsedData: [], parsedData: [],
step: 1, step: 2,
tabs: ['基本信息', '配置内容'] tabs: ['基本信息', '配置内容']
} }
}, },
...@@ -77,7 +77,7 @@ export default { ...@@ -77,7 +77,7 @@ export default {
if (valid) this.step = 2 if (valid) this.step = 2
}) })
} else { } else {
console.log(stepTwo) console.log(stepOne.configForm, stepTwo.configForm)
} }
} }
...@@ -95,6 +95,7 @@ export default { ...@@ -95,6 +95,7 @@ export default {
.tabs { .tabs {
height: 64px; height: 64px;
justify-content: center; justify-content: center;
-webkit-user-select: none;
.tab { .tab {
font-size: 16px; font-size: 16px;
color: #000000a6; color: #000000a6;
......
<template>
<div
@click="chooseRed(data.id)"
:class="['item',{'active':configForm.activityId == data.id}]"
>
<div class="icon">
<img src="@/assets/red-radio.png" />
</div>
<div class="title">{{ data.couponName }}</div>
<template v-if="[2,3,6].includes(data.effectiveType)">
<div class="type">有效期:
<template v-if="data.effectiveType == 2">
{{ data.effectiveStartTime ? data.effectiveStartTime.split(' ')[0] : '' }}~{{ data.effectiveEndTime ? data.effectiveEndTime.split(' ')[0] : '' }}
</template>
<template v-if="data.effectiveType == 3">
无限制
</template>
<template v-if="data.effectiveType == 6">
{{ data.effectiveDays }}天
</template>
</div>
</template>
<div class="time">使用途径: {{ data.useChannel == 1 ? '线上商品' : '到店核销' }}</div>
<div class="status flex">数量:<span>{{ data.residueAmount || 0 }}</span></div>
</div>
</template>
<script type='text/ecmascript-6'>
import * as dayjs from 'dayjs'
export default {
name: '',
props: {
data: {
type: Object,
default: () => { }
},
configForm: {
type: Object,
default: () => { }
}
},
data () {
return {
dayjs,
}
},
mounted () {
},
methods: {
chooseRed (id) {
const {activityId} = this.configForm
if(activityId == id) id = ''
this.$emit('choose', id)
}
}
}
</script>
<style scoped lang='scss'>
.item {
width: 282px;
height: 132px;
background: #f9f9f9;
border-radius: 4px;
border: 2px solid #f9f9f9;
box-sizing: border-box;
cursor: pointer;
padding: 0 16px;
font-size: 14px;
color: #666666;
line-height: 20px;
position: relative;
user-select: none;
.icon {
display: none;
}
div {
margin-top: 8px;
span {
color: #5850ff;
font-size: 20px;
}
}
.title {
font-weight: 500;
font-size: 14px;
color: #333333;
padding-top: 4px;
}
&:hover {
opacity: 0.95;
}
}
.active {
border-color: #5850ff;
.icon {
display: block;
position: absolute;
right: 0;
bottom: 0;
width: 16px;
height: 16px;
background-color: #5850ff;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div
@click="chooseRed(data.id)"
:class="['item',{'active':configForm.activityId == data.id}]"
>
<div class="icon">
<img src="@/assets/red-radio.png" />
</div>
<div class="title">{{ data.equityName }}</div>
<div class="time">领取方式:免费领用</div>
<div class="status flex">试用天数:<span>{{data.freeDay }}天</span></div>
</div>
</template>
<script type='text/ecmascript-6'>
import * as dayjs from 'dayjs'
export default {
name: '',
props: {
data: {
type: Object,
default: () => { }
},
configForm: {
type: Object,
default: () => { }
}
},
data () {
return {
dayjs,
}
},
mounted () {
},
methods: {
chooseRed (id) {
const {activityId} = this.configForm
if(activityId == id) id = ''
this.$emit('choose', id)
}
}
}
</script>
<style scoped lang='scss'>
.item {
width: 282px;
height: 132px;
background: #f9f9f9;
border-radius: 4px;
border: 2px solid #f9f9f9;
box-sizing: border-box;
cursor: pointer;
padding: 0 16px;
font-size: 14px;
color: #666666;
line-height: 20px;
position: relative;
user-select: none;
.icon {
display: none;
}
div {
margin-top: 8px;
}
.title {
font-size: 16px;
font-weight: 600;
color: #333;
line-height: 25px;
margin-bottom: 5px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.status {
margin-top: 28px;
span {
color: #5850ff;
font-size: 20px;
}
}
&:hover {
opacity: 0.95;
}
}
.active {
border-color: #5850ff;
.icon {
display: block;
position: absolute;
right: 0;
bottom: 0;
width: 16px;
height: 16px;
background-color: #5850ff;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div
@click="chooseRed(data.id)"
:class="['item',{'active':configForm.activityId == data.id}]"
>
<div class="icon">
<img src="@/assets/red-radio.png" />
</div>
<div class="title">{{ data.activityName }}</div>
<div class="type">活动形式:{{ {0: '随机红包', 1: '九宫格', 2: '翻牌', 3: '大转盘' }[data.activityType] }}</div>
<div class="time">活动时间:{{dayjs(data.activityStartTime).format('YYYY/MM/DD')}} - {{dayjs(data.activityEndTime).format('YYYY/MM/DD')}}</div>
<div class="status">状态:{{ {0: '活动待进行', 1: '活动进行中', 2: '红包已用完', 3: '活动已结束' }[data.activityStatus] }}</div>
</div>
</template>
<script type='text/ecmascript-6'>
import * as dayjs from 'dayjs'
export default {
name: '',
props: {
data: {
type: Object,
default: () => { }
},
configForm: {
type: Object,
default: () => { }
}
},
data () {
return {
dayjs,
}
},
mounted () {
},
methods: {
chooseRed (id) {
const {activityId} = this.configForm
if(activityId == id) id = ''
this.$emit('choose', id)
}
}
}
</script>
<style scoped lang='scss'>
.item {
width: 282px;
height: 132px;
background: #f9f9f9;
border-radius: 4px;
border: 2px solid #f9f9f9;
box-sizing: border-box;
cursor: pointer;
padding: 0 16px;
font-size: 14px;
color: #666666;
line-height: 20px;
position: relative;
user-select: none;
.icon {
display: none;
}
div {
margin-top: 8px;
}
.title {
font-weight: 500;
font-size: 14px;
color: #333333;
padding-top: 4px;
}
&:hover {
opacity: 0.95;
}
}
.active {
border-color: #5850ff;
.icon {
display: block;
position: absolute;
right: 0;
bottom: 0;
width: 16px;
height: 16px;
background-color: #5850ff;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<el-scrollbar class="step-box"> <el-scrollbar
class="step-box"
ref="stepBox"
>
<div class="step-content"> <div class="step-content">
<glsx-combi-form <glsx-combi-form
ref="formRef" ref="formRef"
:isEdit="true" :isEdit="true"
:isBlock="true" :isBlock="true"
:formObj="form" :formObj="configForm"
:formData="formData" :formData="formData"
:formRules="rule" :formRules="rule"
> >
<template #merchantId> <template #merchantId>
<el-select <el-select
v-model="form.merchantId" v-model="configForm.merchantId"
placeholder="请选择" placeholder="请选择"
filterable filterable
remote remote
...@@ -26,45 +29,56 @@ ...@@ -26,45 +29,56 @@
:label="item.confName" :label="item.confName"
:value="item.confId" :value="item.confId"
></el-option> ></el-option>
<template v-if="nothing"> <template v-if="merchantObj.nothing">
<div class="nothing">到底了!</div> <div class="nothing">到底了!</div>
</template> </template>
</el-select> </el-select>
</template> </template>
<template #activity> <template #activity>
<div class="tabs flex"> <div class="tabs flex">
<template v-for="(i,index) in tabs"> <template v-for="(i,index) in tabsObj.data">
<template> <template>
<div <el-button
type="text"
@click="changeActivity(index)" @click="changeActivity(index)"
:class="['tab',{active:index == tabIndex}]" :class="['tab',{active:index == tabsObj.index}]"
:key="index" :key="index"
>{{i}}</div> :disabled="index == 1"
>{{i}}</el-button>
</template> </template>
</template> </template>
</div> </div>
<div <div
class="activity-box" class="activity-box"
:key="activityKey" :key="activityObj.key"
> >
<template v-for="(i,index) in activityList"> <template v-if="activityObj.flag">
<template> <template v-if="activityObj.data.length">
<div <template v-for="(i,index) in activityObj.data">
@click="chooseRed(i.id)" <template>
:key="index" <component
:class="['item',{'active': form.activityId == i.id}]" :key="index"
> :is="{
<div class="icon"> 0:'EquityItem',
<img src="@/assets/red-radio.png" /> 2:'CouponItem',
3:'RedEnvelopeItem'
}[tabsObj.index]"
:configForm="configForm"
:data="i"
@choose="choose"
></component>
</template>
</template>
<template v-if="activityObj.nothing">
<div class="nothing-text">
到底了!
</div> </div>
<div class="title">{{ i.activityName }}</div> </template>
<div class="type">活动形式:{{ { </template>
0: '随机红包', 1: '九宫格', 2: '翻牌', 3: '大转盘' <template v-else>
}[i.activityType] }}</div> <div class="nothing">
<div class="time">活动时间:{{dayjs(i.activityStartTime).format('YYYY/MM/DD')}} - {{dayjs(i.activityEndTime).format('YYYY/MM/DD')}}</div> <img src="@/assets/activity-nothing.png">
<div class="status">状态:{{ { <div>暂无内容</div>
0: '活动待进行', 1: '活动进行中', 2: '红包已用完', 3: '活动已结束'
}[i.activityStatus] }}</div>
</div> </div>
</template> </template>
</template> </template>
...@@ -76,17 +90,22 @@ ...@@ -76,17 +90,22 @@
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import * as dayjs from 'dayjs'
import { getMerchantListMixin } from '@/mixins' import { getMerchantListMixin } from '@/mixins'
import EquityItem from './EquityItem.vue'
import CouponItem from './CouponItem.vue'
import RedEnvelopeItem from './RedEnvelopeItem.vue'
export default { export default {
name: 'StepOne', name: 'StepOne',
mixins:[getMerchantListMixin], mixins: [getMerchantListMixin],
components: { RedEnvelopeItem, EquityItem, CouponItem },
data () { data () {
return { return {
dayjs,
configForm: { configForm: {
activityName: '',
merchantId: '', merchantId: '',
activityImg: '' activityTime: '',
activityImg: '',
activityId: ''
}, },
rule: { rule: {
activityName: [{ required: true, message: '请输入问卷名称', trigger: 'change' }], activityName: [{ required: true, message: '请输入问卷名称', trigger: 'change' }],
...@@ -118,16 +137,23 @@ export default { ...@@ -118,16 +137,23 @@ export default {
name: 'activityImg', name: 'activityImg',
type: 'upload', type: 'upload',
width: '320px', width: '320px',
// limitSize: 10, limitSize: 10,
maxPhotoNum: 1, maxPhotoNum: 1,
suffixSlot: 'activityImg', suffixSlot: 'activityImg',
handleUpload: (e, file, targetItem) => { handleUpload: async (e, file, targetItem) => {
const imgFile = e.target.result, try {
base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1] const imgFile = e.target.result,
this.$apis.common.pictureUpload({ file: base64, fileType: 'image' }).then(res => { arrBase64 = imgFile.split(',')[1],
this.configForm[targetItem.name] = res str = file.name.split('.'),
this.formRef().validateField(targetItem.name) base64 = str.at(-1) + '@' + arrBase64,
}) res = await this.$apis.common.pictureUpload({ file: base64, fileType: 'image' })
if (res) {
this.configForm[targetItem.name] = res
this.formRef().validateField(targetItem.name)
} else throw '上传失败'
} catch (error) {
this.$message(error)
}
} }
}, },
{ {
...@@ -135,10 +161,17 @@ export default { ...@@ -135,10 +161,17 @@ export default {
addHtml: 'activity' addHtml: 'activity'
} }
], ],
tabs: ['权益卡试用', '商城券', '红包活动'], tabsObj: {
tabIndex: 0, data: ['权益卡试用', '权益套餐', '商城券', '红包活动'],
activityList: new Array(20).fill({}), index: 0
activityKey: Date.now(), },
activityObj: {
data: [],
key: Date.now(),
flag: true,
pageNum: 1,
total: 0
},
merchantObj: { merchantObj: {
nothing: false, nothing: false,
data: [], data: [],
...@@ -149,15 +182,69 @@ export default { ...@@ -149,15 +182,69 @@ export default {
} }
} }
}, },
watch: {
'configForm.merchantId' (n) {
this.getActivityList()
}
},
mounted () { mounted () {
this.onReachBottom(this)
}, },
methods: { methods: {
formRef () { formRef () {
return this.$refs.formRef.$refs.formRef return this.$refs.formRef.$refs.formRef
}, },
onReachBottom (_this) {
this.$refs.stepBox.wrap.addEventListener('scroll', function () {
const condition = this.scrollHeight - this.scrollTop - 20 <= this.clientHeight,
{ index } = _this.tabsObj,
{ total, pageNum } = _this.activityObj
if (condition) {
if (index == 2) {
if (Math.ceil(total / 9) > pageNum) {
_this.activityObj.pageNum += 1
_this.getActivityList()
} else _this.activityObj.nothing = true
}
}
})
},
changeActivity (index) { changeActivity (index) {
this.tabIndex = index const { merchantId } = this.configForm
if (this.tabsObj.index == index) return
if (!merchantId) return this.$message.error('请先选择所属渠道')
this.tabsObj.index = index
this.configForm.activityId = ''
this.activityObj.pageNum = 1
this.activityObj.nothing = false
this.activityObj.flag = false
this.getActivityList()
},
async getActivityList () {
const { index } = this.tabsObj,
{ merchantId } = this.configForm,
{ pageNum } = this.activityObj,
targetApi = {
0: 'getEquityActivityList',
2: 'getMerchantCouponList',
3: 'getActivityRedEnvelopeList'
}[index],
params = {
merchantId
}
if (index == 2) params.pageNum = pageNum
const res = await this.$apis.questionnaire[targetApi](params)
let data = res
if (index == 2) {
data = [...this.activityObj.data, ...res.list]
this.activityObj.total = res.total
}
console.log(data)
this.activityObj.data = data
this.activityObj.flag = true
},
choose (e) {
this.configForm.activityId = e
} }
}, },
...@@ -210,11 +297,7 @@ export default { ...@@ -210,11 +297,7 @@ export default {
font-size: 14px; font-size: 14px;
color: #666666; color: #666666;
padding: 0 16px; padding: 0 16px;
cursor: pointer; margin: 0;
transition: all 0.25s;
&:hover {
opacity: 0.85;
}
} }
.active { .active {
background: #ffffff; background: #ffffff;
...@@ -222,52 +305,33 @@ export default { ...@@ -222,52 +305,33 @@ export default {
font-weight: 500; font-weight: 500;
color: #5850ff; color: #5850ff;
} }
.is-disabled {
color: #cfcfcf;
}
} }
.activity-box { .activity-box {
display: flex; display: flex;
gap: 16px; gap: 16px;
flex-wrap: wrap; flex-wrap: wrap;
margin-top: 16px; margin-top: 16px;
.item { .nothing {
width: 282px; margin-top: 24px;
height: 132px; font-weight: 500;
background: #f9f9f9; font-size: 16px;
border-radius: 4px;
border: 2px solid #f9f9f9;
box-sizing: border-box;
cursor: pointer;
padding: 0 16px;
font-size: 14px;
color: #666666; color: #666666;
line-height: 20px; text-align: center;
position: relative; img {
.icon { width: 323px;
display: none; height: 92px;
} margin-bottom: 16px;
div {
margin-top: 8px;
}
.title {
font-weight: 500;
font-size: 14px;
color: #333333;
padding-top: 4px;
}
&:hover {
opacity: 0.95;
} }
} }
.active { .nothing-text {
border-color: #5850ff; color: #666666;
.icon { text-align: center;
display: block; font-weight: 500;
position: absolute; font-size: 16px;
right: 0; width: 100%;
bottom: 0;
width: 16px;
height: 16px;
background-color: #5850ff;
}
} }
} }
} }
......
<template> <template>
<div class="step-box"> <el-scrollbar class="step-box">
2 <div class="step-content">
1
</div>
<!-- <input <!-- <input
type="file" type="file"
@change="handleFileUpload" @change="handleFileUpload"
accept=".xlsx" accept=".xlsx"
/> --> /> -->
</div> </el-scrollbar>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
...@@ -47,4 +49,19 @@ export default { ...@@ -47,4 +49,19 @@ export default {
</script> </script>
<style scoped lang='scss'> <style scoped lang='scss'>
.step-box {
width: 100%;
height: 100%;
box-sizing: border-box;
/deep/.el-scrollbar__wrap {
&::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
}
}
.step-content {
padding-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!