Commit 5569516d by 李伟康

提交

1 parent aa2f1dcb
<template>
<div
class="layout"
v-loading="loading"
>
<div class="content">
<div class="title">积分充值</div>
<el-scrollbar class="box">
<div class="text flex">
<div class="item flex">
<div class="label">批次号:</div>
<div class="value">-</div>
</div>
<div class="item flex">
<div class="label">状态:</div>
<div class="value">-</div>
</div>
</div>
<glsx-combi-form
ref="fromRef"
:isEdit="true"
:isBlock="true"
:formObj="configForm"
:formData="formData"
:formRules="rule"
>
<template #table>
<div class="upload">
<div class="upload-btn">
<el-button size="small">
<i class="el-icon-plus"></i>
上传名单
</el-button>
<input
type="file"
style="opacity: 0"
ref="file"
accept=".xlsx, .xlc, .xlm, .xls"
@change="uploadFile"
/>
</div>
<a
href="https://img01.glsx.com.cn/weapp/resource/saas/scrm/xlsx/红包链接.xlsx"
target="_blank"
>下载模板</a>
</div>
<div class="file-info flex">
<div class="el-icon-success"></div>
文件格式正确(客户名单.xlsx)
</div>
<div class="table-box">
<GLTable
:tableData="[]"
:tableParams="tableParams"
>
</GLTable>
<div class="total">
<template v-for="(i,index) in totalFormData">
<template>
<div
:key="index"
class="item flex"
>
<div class="label">{{i.label}}:</div>
<div class="value"></div>
</div>
</template>
</template>
</div>
</div>
</template>
</glsx-combi-form>
</el-scrollbar>
</div>
<GLFooter class="footer">
<el-button
@click="$router.go(-1)"
size="medium"
>取消</el-button>
<el-button
type="primary"
@click="handleConfirm"
size="medium"
>确定</el-button>
</GLFooter>
<points-config
:configParams.sync="configParams"
@confirm="changeRowConfig"
/>
</div>
</template>
<script type='text/ecmascript-6'>
import * as dayjs from 'dayjs'
import pointsConfig from './components/pointsConfig.vue'
export default {
components: {
pointsConfig
},
name: '',
data () {
return {
loading: false,
configForm: {},
formData: [
{
label: '导入充值人群',
addHtml: 'table'
},
],
totalForm: {},
totalFormData: [
{
label: '客户数量',
name: 'goodsName',
type: 'showTxt'
},
{
label: '充值积分小计',
name: 'goodsName',
type: 'showTxt'
},
{
label: '通道手续费(2%)',//(每个客户的返现金额+兑换商品积分)*手续费比例(保留两位小数)
name: 'goodsName',
type: 'showTxt'
},
{
label: '油卡手续费(2%)',//(配置的所有油卡销售价之和)*手续费比例(保留两位小数)
name: 'goodsName',
type: 'showTxt'
},
{
label: '总数',
name: 'goodsName',
type: 'showTxt'
},
],
tableParams: {
tableColumns: [
{
label: '保单号',
prop: 'userPhone',
minWidth: 100
},
{
label: '用户姓名',
prop: 'wechatName',
minWidth: 100
},
{
label: '身份证号',
prop: 'activityName',
minWidth: 100
},
{
label: '用户手机号',
minWidth: 150,
prop: 'activityName',
},
{
label: '返现金额',
minWidth: 100,
prop: 'activityName',
},
{
label: '商品兑换积分',
minWidth: 150,
formatter: cell => `${dayjs(cell.activityStartTime).format('YYYY/MM/DD')}-${dayjs(cell.activityEndTime).format('YYYY/MM/DD')}`
},
{
label: '赠送油券',
prop: 'activityType',
minWidth: 150,
formatter: cell => {
// 0:随机红包;1:九宫格;2:翻牌;3:大转盘;
return { 0: '随机红包', 1: '九宫格', 2: '翻牌', 3: '大转盘' }[cell.activityType]
}
},
{
label: '赠送自店服务',
prop: 'activityType',
minWidth: 150,
formatter: cell => {
// 0:随机红包;1:九宫格;2:翻牌;3:大转盘;
return { 0: '随机红包', 1: '九宫格', 2: '翻牌', 3: '大转盘' }[cell.activityType]
}
},
{
label: '充值积分小计',
prop: 'link',
minWidth: 150
},
]
},
configParams: {
show: true,
}
}
},
mounted () {
const { id, type } = this.$route.query
// if (id) {
// }
},
methods: {
async getQuestionnaireDetail () {
try {
const data = await this.$apis.questionnaire.getQuestionnaireDetail()
this.loading = false
} catch (error) {
setTimeout(() => this.$router.go(-1), 1.5e3)
}
},
handleConfirm () {
},
uploadFile () {
},
changeRowConfig (e) {
console.log(e)
}
}
}
</script>
<style scoped lang='scss'>
.layout {
position: absolute;
width: 100%;
height: calc(100vh - 48px);
top: 0;
left: 0;
.box {
width: 100%;
height: calc(100% - 46px);
box-sizing: border-box;
}
.content {
height: calc(100% - 88px);
background-color: #fff;
margin: 16px 24px 0;
border-radius: 0 4px 4px 4px;
.title {
border-bottom: 1px solid #e5e5e5;
padding: 15px 0 14px 20px;
font-weight: 500;
font-size: 16px;
color: #333333;
}
.text {
padding: 32px 0 20px 20px;
font-size: 14px;
color: #666666;
.label {
width: 154px;
text-align: right;
}
.value {
min-width: 232px;
}
}
}
.footer {
padding: 16px 0;
}
}
.upload {
display: flex;
width: 500px;
.upload-btn {
position: relative;
width: 110px;
height: 32px;
&:hover {
.el-button {
color: var(--primaryColor, #5850ff);
border-color: #cdcbff;
background-color: #eef;
}
}
.el-button--small {
width: 100%;
height: 100%;
}
input {
cursor: pointer;
position: absolute;
height: 100%;
width: 100%;
top: 0px;
left: 0px;
font-size: 0px;
}
}
a {
margin-left: 8px;
color: #5850ff;
font-size: 14px;
cursor: pointer;
}
}
.file-info {
font-size: 14px;
color: #999999;
.el-icon-success {
color: #67c23a;
line-height: 32px;
margin-right: 4px;
}
}
.table-box {
width: 864px;
background: #f9f9f9;
border-radius: 4px;
padding: 20px;
}
.total {
display: flex;
flex-direction: column;
font-size: 14px;
color: #666666;
.item {
justify-content: flex-end;
line-height: 20px;
margin-top: 10px;
.label {
width: 154px;
text-align: right;
}
.value {
min-width: 90px;
}
}
}
.flex {
display: flex;
align-items: center;
}
</style>
\ No newline at end of file
<template>
<GLTable
v-loading="loading"
ref="serviceRef"
:tableData="serviceList"
:tableParams="tableParams"
@refreshTable="getServiceList"
@select="handleSelectionServiceTable"
@select-all="handleSelectionServiceTableAll"
>
<template
slot="residueAmount"
slot-scope="scope"
>
<el-input-number
size="small"
:min="1"
:max="10"
:step="1"
v-model="scope.scope.residueAmount"
></el-input-number>
</template>
</GLTable>
</template>
<script type='text/ecmascript-6'>
import selectedMixin from '../mixins/selectedMixin'
export default {
name: 'gas',
mixins: [selectedMixin],
data () {
return {
loading: false,
serviceList: [],
tableParams: {
listName: 'list',
// 行数据的key
mutiSelectUniqueKey: 'packageCode',
checkSelectKey: 'id',
checkSelectVal: '',
checkSelectable: null,
// 多选ref的名称
mutiSelectName: 'list',
tableColumns: [
{
label: '商品图片',
prop: 'couponName',
width: 180
},
{
label: '名称',
prop: 'anticipatedCost',
formatter: cellValue => {
return (cellValue.anticipatedCost / 100).toFixed(2)
}
},
{
label: '油卡面额/元',
prop: 'effectiveType',
},
{
label: '售价/元',
prop: 'useType',
},
{
label: '选择数量',
prop: 'residueAmount',
addHtml: 'residueAmount'
}
]
},
selectedGasList: [],
selectedList: []
}
},
mounted () {
this.getServiceList()
},
methods: {
getServiceList () {
const { page: { pageNum, pageSize } } = this.$refs.serviceRef,
params = {
status: 2,
discountType: 7,
merchantId: this.$globalState.session.merchantId,
limitStockFlag: 2,
pageNum,
pageSize
}
this.loading = true
this.$apis.giftBag.getghDirectionalGiftListApi(params).then(res => {
this.loading = false
// 重置分页组件
this.serviceList = res.list
// this.fnCallBack = true
this.$refs.serviceRef.tableTotal = res.total
this.selectedPreExisting(this.selectedList, this.serviceList, 'id', this.$refs.serviceRef)
}).finally(() => {
this.loading = false
})
},
}
}
</script>
<style scoped lang='scss'>
</style>
\ No newline at end of file
<template>
<GLDialog
mode="big"
class="points-panel"
bigTitle="选择"
okText="提交"
:before-close="handleGiftClose"
@onCancel="handleGiftClose"
@onOk="handleConfirm"
:visible.sync="configParams.show"
>
<GLTabs
v-model="currentComponent"
:tabPaneList="tabPaneList"
></GLTabs>
<div class="component">
<gas
v-show="currentComponent == 'gas'"
ref="gasRef"
/>
<service
v-show="currentComponent == 'service'"
ref="serviceRef"
/>
</div>
</GLDialog>
</template>
<script type='text/ecmascript-6'>
import service from './service.vue'
import gas from './gas.vue'
export default {
name: '',
components: {
service,
gas
},
props: {
configParams: {
type: Object,
default: () => { }
}
},
data () {
return {
giftVisible: true,
currentComponent: 'gas',
tabPaneList: [
{
label: '油卡',
name: 'gas'
},
{
label: '自店服务',
name: 'service'
}
]
}
},
mounted () {
},
methods: {
handleGiftClose () {
this.$emit('update:configParams', {
show: false
})
},
handleConfirm () {
const { gasRef, serviceRef } = this.$refs
this.$emit('confirm', [...gasRef.selectedList, ...serviceRef.selectedList].map(e => {
return {
couponId: e.id,
couponAmount: 1,
couponAnticipatedCost: e.denomination || e.anticipatedCost || e.couponAnticipatedCost
}
}))
this.handleGiftClose()
}
}
}
</script>
<style scoped lang='scss'>
.points-panel {
/deep/.el-dialog__wrapper {
.el-dialog__body {
padding-top: 0;
}
}
}
.component {
padding-top: 20px;
}
</style>
<template>
<div class="service-box">
<div class="service-flex">
<div class="service-tab">
<template v-for="(item) in serviceTabList">
<template>
<div
:class="['tab-item',{ active: discountType == item.type }]"
:key="item.type"
@click="discountType = item.type"
>
{{ item.label }}
</div>
</template>
</template>
<div
class="tab-border"
:style="setLeft"
></div>
</div>
<!-- <div class="service-tip">(仅支持引用无限库存券)</div> -->
<div class="tab-right">
<div
class="refresh-btn"
@click="getServiceList"
>
<i class="el-icon-refresh-right"></i>
刷新列表
</div>
<div
class="add-btn"
@click="addCoupon"
>
<i class="el-icon-plus"></i>
新建
</div>
</div>
</div>
<template v-for="(item, index) in serviceTabList">
<template>
<div :key="index">
<GLTable
v-loading="loading"
v-show="discountType == item.type"
:ref="'serviceRef' + item.type"
:tableData="serviceList"
:tableParams="tableParams"
@refreshTable="getServiceList"
@select="handleSelectionServiceTable"
@select-all="handleSelectionServiceTableAll"
>
<template
slot="effectiveType"
slot-scope="scope"
>
<span>{{ toLabelText(scope.scope) }}</span>
</template>
<template
slot="stock"
slot-scope="scope"
>
<span>{{ scope.scope.limitStockFlag == 1 ? scope.scope.stock : '无限制' }}</span>
</template>
<template
slot="useType"
slot-scope="scope"
>
<span>{{ toRestrictLabelText(scope.scope) }}</span>
</template>
<template
slot="residueAmount"
slot-scope="scope"
>
<el-input-number
size="small"
:min="1"
:max="10"
:step="1"
v-model="scope.scope.residueAmount"
></el-input-number>
</template>
</GLTable>
</div>
</template>
</template>
</div>
</template>
<script type='text/ecmascript-6'>
import { openTab } from '@/utils/index'
import selectedMixin from '../mixins/selectedMixin'
export default {
name: 'service',
mixins: [selectedMixin],
data () {
return {
selectedList: [],
serviceTabList: [
{ label: '门店服务', type: 7 },
{ label: '折扣券', type: 2 },
{ label: '代金券', type: 3 },
{ label: '兑换券', type: 4 }
],
discountType: 7,
loading: false,
serviceList: [],
tableParams: {
listName: 'list',
// 行数据的key
mutiSelectUniqueKey: 'packageCode',
checkSelectKey: 'id',
checkSelectVal: '',
checkSelectable: null,
// 多选ref的名称
mutiSelectName: 'list',
tableColumns: [
{
label: '名称',
prop: 'couponName',
width: 180
},
{
label: '车主展示价/元',
prop: 'anticipatedCost',
formatter: cellValue => {
return (cellValue.anticipatedCost / 100).toFixed(2)
}
},
{
label: '有效期',
prop: 'effectiveType',
addHtml: 'effectiveType'
},
{
label: '使用限制',
prop: 'useType',
addHtml: 'useType'
},
{
label: '选择数量',
prop: 'residueAmount',
addHtml: 'residueAmount'
}
]
}
}
},
watch: {
discountType () {
this.serviceList = []
this.getServiceList()
}
},
computed: {
setLeft () {
const { discountType } = this
return { left: (discountType == 7 ? 0 : discountType - 1) * 88 + 2 + 'px' }
}
},
mounted () {
this.getServiceList()
},
methods: {
getServiceList () {
const { discountType } = this,
{ page: { pageNum, pageSize } } = this.$refs[`serviceRef${discountType}`][0],
params = {
status: 2,
discountType: discountType,
merchantId: this.$globalState.session.merchantId,
limitStockFlag: 2,
pageNum,
pageSize
}
this.loading = true
this.$apis.giftBag.getghDirectionalGiftListApi(params).then(res => {
this.loading = false
// 重置分页组件
this.serviceList = res.list
// this.fnCallBack = true
this.$refs['serviceRef' + discountType][0].tableTotal = res.total
this.selectedPreExisting(this.selectedList, this.serviceList, 'id', this.$refs['serviceRef' + this.discountType][0])
}).finally(() => {
this.loading = false
})
},
//格式化数据
toLabelText (row) {
return {
3: '永久有效',
2: row.effectiveStartTime ? row.effectiveStartTime.split(' ')[0] + '-' + row.effectiveEndTime.split(' ')[0] : '',
1: row.effectiveDays + '天'
}[row.effectiveType]
},
toRestrictLabelText (row) {
return {
0: '无限制',
1: '有效期内可使用' + row.useAmount + '次',
2: '每' + row.useLimitDays + '天可以使用' + row.useAmount + '次'
}[row.useType]
},
addCoupon () {
openTab('/tools/couponManage/index')
},
}
}
</script>
<style scoped lang='scss'>
.service-flex {
display: flex;
align-items: center;
margin-bottom: 10px;
.service-tip {
color: #999;
margin-left: 8px;
}
.tab-right {
display: flex;
margin-left: auto;
.refresh-btn {
cursor: pointer;
color: #666666;
}
.add-btn {
cursor: pointer;
margin-left: 10px;
color: #5850ff;
}
}
.service-tab {
height: 36px;
background: #f8f8f8;
border-radius: 4px;
display: flex;
// max-width: 352px;
position: relative;
.tab-border {
position: absolute;
left: 2px;
top: 2px;
z-index: 1;
width: 84px;
height: 32px;
background: #ffffff;
transition: all 0.25s;
border-radius: 4px;
}
.tab-item {
width: 88px;
z-index: 2;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
&.active {
border-radius: 3px;
color: #5850ff;
}
}
}
}
</style>
\ No newline at end of file
<template>
<div class="container">
<GLCombiForm
ref="showSearch"
:rowNumber="2"
:formObj="searchForm"
:formData="searchFormData"
@handleOk="handleSearch"
@handleRest="handleReset"
></GLCombiForm>
<div class="sticky-btns">
<el-button
type="default"
plain
@click="jump"
>客户积分充值</el-button>
<el-button @click="handleExport">导出
</el-button>
</div>
<div class="tabelList">
<GLTable
ref="listRef"
:getListApi="getListApi"
:searchForm="tableSearchForm"
:noDataImg="url"
:tableParams="tableParams"
:pageConf="pageConf"
>
<span
slot="auth-button"
slot-scope="scope"
>
<GLTableButton
:buttonList="tableButtonList"
:buttonItem="scope.scope"
:buttonNum="3"
></GLTableButton>
</span>
</GLTable>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
import url from '@/assets/empty.png'
import * as dayjs from 'dayjs'
export default {
name: '',
data () {
return {
url,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
searchForm: {
merchantName: '',
merchantId: '',
staffName: ''
},
searchFormData: [
{
label: '批次',
name: 'activityName',
type: 'input',
maxlength: 100
},
{
label: '保单号',
name: 'merchantName',
type: 'input',
maxlength: 100
},
{
label: '用户姓名',
name: 'wechatName',
type: 'input',
maxlength: 100
},
{
label: '用户手机号',
name: 'wechatName',
type: 'input',
maxlength: 100
},
{
label: '发放时间',
name: 'showTime',
type: 'datePicker',
valueFormat: 'yyyy-MM-dd',
isClear: true,
customPickerOptions: {
disabledDate (date) {
const yesterday = new Date(new Date().setDate(new Date().getDate()))
if (date > yesterday) {
return true
}
return false
}
}
},
],
getListApi: this.$apis.activity.activityPageList,
tableParams: {
listName: 'data',
tableOption: true,
tableColumns: [
{
label: '批次',
prop: 'wechatName',
minWidth: 100
},
{
label: '客户数量',
prop: 'activityName',
minWidth: 100
},
{
label: '充值积分总数',
minWidth: 100,
prop: 'activityName',
},
{
label: '状态',
minWidth: 100,
prop: 'activityName',
},
{
label: '创建时间',
minWidth: 150,
formatter: cell => `${dayjs(cell.activityStartTime).format('YYYY/MM/DD')}-${dayjs(cell.activityEndTime).format('YYYY/MM/DD')}`
},
{
label: '操作人',
prop: 'activityType',
minWidth: 150,
formatter: cell => {
// 0:随机红包;1:九宫格;2:翻牌;3:大转盘;
return { 0: '随机红包', 1: '九宫格', 2: '翻牌', 3: '大转盘' }[cell.activityType]
}
},
]
},
tableButtonList: [
{
type: 'el-button',
name: '详情',
attrs: {
type: 'text',
},
listeners: {
click: row => this.editForm(row)
}
},
{
type: 'el-button',
name: '编辑',
attrs: {
type: 'text',
},
condition: row => true,
listeners: {
click: row => this.editForm(row, 'edit')
}
},
],
showImportRecord: false,
tableSearchForm: {}
}
},
mounted () {
},
methods: {
handleSearch () {
this.tableSearchForm = this.getParams()
this.$refs.listRef.refreshTable()
},
handleReset () {
this.searchForm = this.$options.data.call(this).searchForm
this.handleSearch()
},
handleExport () {
const params = this.getParams()
this.$apis.points.orderExport(params).then(res => {
this.$utils.aToExport(res)
})
},
getParams () {
let params = JSON.parse(JSON.stringify(this.searchForm))
this.updateParams(params, 'showTime', 'showTime', 'startShowTime', 'endShowTime');
this.updateParams(params, 'lotteryDrawTime', 'lotteryDrawTime', 'startLotteryDrawTime', 'endLotteryDrawTime');
return params
},
updateParams (params, paramKey, formKey, beginKey, endKey) {
if (params[paramKey]) {
params[beginKey] = this.searchForm[formKey][0];
params[endKey] = this.searchForm[formKey][1];
delete params[paramKey];
} else {
delete params[beginKey];
delete params[endKey];
}
// delete params[paramKey];
return params
},
jump () {
this.$router.push({
path: '/points/add',
query: {
$title: '客户积分充值',
}
})
}
}
}
</script>
<style scoped lang='scss'>
.container {
height: 100%;
background-color: #fff;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding: 20px;
.sticky-btns {
margin-bottom: 10px;
display: flex;
justify-content: flex-end;
.el-button {
min-width: 60px;
}
.el-button+.el-button{
margin-left: 10px;
}
}
}
</style>
export default {
methods: {
handleSelectionServiceTable (selection, row) {
if (selection && selection.find(item => item && item.id == row.id)) {
this.addRows(this.selectedList, [row], 'id')
} else {
this.selectedList = this.deleteRows(this.selectedList, [row], 'id')
}
},
handleSelectionServiceTableAll (selected) {
if (selected.length > 0) {
this.addRows(this.selectedList, selected, 'id')
} else {
this.selectedList = this.deleteRows(this.selectedList, this.serviceList, 'id')
}
},
//添加选中
addRows (selectedItems, rows, val) {
rows.forEach(row => {
//过滤,当selectedItems有此条数据时,则直接返回,不执行添加
if (selectedItems.find(item => item[val] == row[val])) {
return
}
selectedItems.push(row)
})
},
//取消选中
deleteRows (selectedItems, rows, val) {
//当selectedItems为空数组时,不执行删除
if (selectedItems.length == 0) {
return
}
rows.forEach(row => {
selectedItems = selectedItems.filter(item => item[val] != row[val])
})
return selectedItems
},
//选中table已有数据
selectedPreExisting (rows, list, val, refTabel) {
refTabel.$refs['listMutiTable'].clearSelection()
if (rows?.length > 0) {
//这里使用this.$nextTick是防止表格未渲染完成就执行,导致无法添加选中效果
this.$nextTick(() => {
rows.forEach(row => {
//判断row是存在当前tableData
list.forEach(i => {
if (i[val] == row[val]) {
refTabel.$refs['listMutiTable'].toggleRowSelection(i, true)
}
})
})
})
} else {
refTabel.$refs['listMutiTable'].clearSelection()
}
},
}
}
\ 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!