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
......@@ -48,15 +48,15 @@
</template>
<script type='text/ecmascript-6'>
import StepOne from './components/StepOne.vue'
import StepTwo from './components/StepTwo.vue'
import StepOne from './components/StepOne/index.vue'
import StepTwo from './components/StepTwo/index.vue'
export default {
components: { StepOne, StepTwo },
name: '',
data () {
return {
parsedData: [],
step: 1,
step: 2,
tabs: ['基本信息', '配置内容']
}
},
......@@ -77,7 +77,7 @@ export default {
if (valid) this.step = 2
})
} else {
console.log(stepTwo)
console.log(stepOne.configForm, stepTwo.configForm)
}
}
......@@ -95,6 +95,7 @@ export default {
.tabs {
height: 64px;
justify-content: center;
-webkit-user-select: none;
.tab {
font-size: 16px;
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
<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
<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
<template>
<el-scrollbar class="step-box">
<el-scrollbar
class="step-box"
ref="stepBox"
>
<div class="step-content">
<glsx-combi-form
ref="formRef"
:isEdit="true"
:isBlock="true"
:formObj="form"
:formObj="configForm"
:formData="formData"
:formRules="rule"
>
<template #merchantId>
<el-select
v-model="form.merchantId"
v-model="configForm.merchantId"
placeholder="请选择"
filterable
remote
......@@ -26,45 +29,56 @@
:label="item.confName"
:value="item.confId"
></el-option>
<template v-if="nothing">
<template v-if="merchantObj.nothing">
<div class="nothing">到底了!</div>
</template>
</el-select>
</template>
<template #activity>
<div class="tabs flex">
<template v-for="(i,index) in tabs">
<template v-for="(i,index) in tabsObj.data">
<template>
<div
<el-button
type="text"
@click="changeActivity(index)"
:class="['tab',{active:index == tabIndex}]"
:class="['tab',{active:index == tabsObj.index}]"
:key="index"
>{{i}}</div>
:disabled="index == 1"
>{{i}}</el-button>
</template>
</template>
</div>
<div
class="activity-box"
:key="activityKey"
:key="activityObj.key"
>
<template v-for="(i,index) in activityList">
<template>
<div
@click="chooseRed(i.id)"
:key="index"
:class="['item',{'active': form.activityId == i.id}]"
>
<div class="icon">
<img src="@/assets/red-radio.png" />
<template v-if="activityObj.flag">
<template v-if="activityObj.data.length">
<template v-for="(i,index) in activityObj.data">
<template>
<component
:key="index"
:is="{
0:'EquityItem',
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 class="title">{{ i.activityName }}</div>
<div class="type">活动形式:{{ {
0: '随机红包', 1: '九宫格', 2: '翻牌', 3: '大转盘'
}[i.activityType] }}</div>
<div class="time">活动时间:{{dayjs(i.activityStartTime).format('YYYY/MM/DD')}} - {{dayjs(i.activityEndTime).format('YYYY/MM/DD')}}</div>
<div class="status">状态:{{ {
0: '活动待进行', 1: '活动进行中', 2: '红包已用完', 3: '活动已结束'
}[i.activityStatus] }}</div>
</template>
</template>
<template v-else>
<div class="nothing">
<img src="@/assets/activity-nothing.png">
<div>暂无内容</div>
</div>
</template>
</template>
......@@ -76,17 +90,22 @@
</template>
<script type='text/ecmascript-6'>
import * as dayjs from 'dayjs'
import { getMerchantListMixin } from '@/mixins'
import EquityItem from './EquityItem.vue'
import CouponItem from './CouponItem.vue'
import RedEnvelopeItem from './RedEnvelopeItem.vue'
export default {
name: 'StepOne',
mixins:[getMerchantListMixin],
mixins: [getMerchantListMixin],
components: { RedEnvelopeItem, EquityItem, CouponItem },
data () {
return {
dayjs,
configForm: {
activityName: '',
merchantId: '',
activityImg: ''
activityTime: '',
activityImg: '',
activityId: ''
},
rule: {
activityName: [{ required: true, message: '请输入问卷名称', trigger: 'change' }],
......@@ -118,16 +137,23 @@ export default {
name: 'activityImg',
type: 'upload',
width: '320px',
// limitSize: 10,
limitSize: 10,
maxPhotoNum: 1,
suffixSlot: 'activityImg',
handleUpload: (e, file, targetItem) => {
const imgFile = e.target.result,
base64 = file.name.split('.')[file.name.split('.').length - 1] + '@' + imgFile.split(',')[1]
this.$apis.common.pictureUpload({ file: base64, fileType: 'image' }).then(res => {
this.configForm[targetItem.name] = res
this.formRef().validateField(targetItem.name)
})
handleUpload: async (e, file, targetItem) => {
try {
const imgFile = e.target.result,
arrBase64 = imgFile.split(',')[1],
str = file.name.split('.'),
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 {
addHtml: 'activity'
}
],
tabs: ['权益卡试用', '商城券', '红包活动'],
tabIndex: 0,
activityList: new Array(20).fill({}),
activityKey: Date.now(),
tabsObj: {
data: ['权益卡试用', '权益套餐', '商城券', '红包活动'],
index: 0
},
activityObj: {
data: [],
key: Date.now(),
flag: true,
pageNum: 1,
total: 0
},
merchantObj: {
nothing: false,
data: [],
......@@ -149,15 +182,69 @@ export default {
}
}
},
watch: {
'configForm.merchantId' (n) {
this.getActivityList()
}
},
mounted () {
this.onReachBottom(this)
},
methods: {
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) {
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 {
font-size: 14px;
color: #666666;
padding: 0 16px;
cursor: pointer;
transition: all 0.25s;
&:hover {
opacity: 0.85;
}
margin: 0;
}
.active {
background: #ffffff;
......@@ -222,52 +305,33 @@ export default {
font-weight: 500;
color: #5850ff;
}
.is-disabled {
color: #cfcfcf;
}
}
.activity-box {
display: flex;
gap: 16px;
flex-wrap: wrap;
margin-top: 16px;
.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;
.nothing {
margin-top: 24px;
font-weight: 500;
font-size: 16px;
color: #666666;
line-height: 20px;
position: relative;
.icon {
display: none;
}
div {
margin-top: 8px;
}
.title {
font-weight: 500;
font-size: 14px;
color: #333333;
padding-top: 4px;
}
&:hover {
opacity: 0.95;
text-align: center;
img {
width: 323px;
height: 92px;
margin-bottom: 16px;
}
}
.active {
border-color: #5850ff;
.icon {
display: block;
position: absolute;
right: 0;
bottom: 0;
width: 16px;
height: 16px;
background-color: #5850ff;
}
.nothing-text {
color: #666666;
text-align: center;
font-weight: 500;
font-size: 16px;
width: 100%;
}
}
}
......
<template>
<div class="step-box">
2
<el-scrollbar class="step-box">
<div class="step-content">
1
</div>
<!-- <input
type="file"
@change="handleFileUpload"
accept=".xlsx"
/> -->
</div>
</el-scrollbar>
</template>
<script type='text/ecmascript-6'>
......@@ -47,4 +49,19 @@ export default {
</script>
<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>
\ 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!