Commit c51d0f95 by 李伟康

提交需求

1 parent 070d671b
...@@ -1960,7 +1960,7 @@ ...@@ -1960,7 +1960,7 @@
} }
}, },
"vue-loader-v16": { "vue-loader-v16": {
"version": "npm:vue-loader@16.8.3", "version": "npm:vue-loader-v16@16.8.3",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz", "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz",
"integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==", "integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
"dev": true, "dev": true,
...@@ -8896,6 +8896,11 @@ ...@@ -8896,6 +8896,11 @@
"integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==", "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==",
"dev": true "dev": true
}, },
"number-precision": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/number-precision/-/number-precision-1.6.0.tgz",
"integrity": "sha512-05OLPgbgmnixJw+VvEh18yNPUo3iyp4BEWJcrLu4X9W05KmMifN7Mu5exYvQXqxxeNWhvIF+j3Rij+HmddM/hQ=="
},
"oauth-sign": { "oauth-sign": {
"version": "0.9.0", "version": "0.9.0",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
"element-ui": "^2.4.5", "element-ui": "^2.4.5",
"glsx-common": "^2.0.9", "glsx-common": "^2.0.9",
"glsx-components": "^1.5.7", "glsx-components": "^1.5.7",
"number-precision": "^1.6.0",
"vue": "^2.6.10", "vue": "^2.6.10",
"vue-router": "^3.1.3", "vue-router": "^3.1.3",
"vuex": "^3.1.2" "vuex": "^3.1.2"
......
...@@ -113,4 +113,132 @@ const getIntegralDetailExport = params => { ...@@ -113,4 +113,132 @@ const getIntegralDetailExport = params => {
sign: true sign: true
}) })
} }
export default { getList, getOrderDetail, orderExport, orderImport, integralorderSettle, getIntegralCustomerList, getIntegralCustomerExport, getIntegralDetailList, customerDetail, getIntegralDetailExport }
/**自店服务 */
const getghDirectionalGiftListApi = params => {
params.method = 'scrm.api.coupon.gh.group.equity.coupon.list'
return http({
url: 'rop-scrm-coupon/router',
method: 'GET',
data: params,
sign: true
})
}
/**
* 客户积分导入
*/
const importCustomerIntegral = params => {
params.method = 'scrm.api.shopmall.integral.import.excel.analysis'
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true,
noSignAttr: ['file'],
returnAll: true
})
}
/**
* 客户积分充值
*/
const updateCustomerIntegral = params => {
params.method = 'scrm.api.shopmall.integral.import.save.or.update'
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true
})
}
/**
* 获取油劵列表
*/
const getOilCouponList = params => {
params.method = 'scrm.api.shopmall.goods.oil.coupon.list'
params.status = 1
return http({
url: 'rop-scrm-shopmall/router',
data: params
})
}
/**
* 查询门店的通道手续费和油卡费率设置
*/
const getMerchantCharge = params => {
params.method = 'scrm.api.shopmall.integral.import.charge.config.query'
return http({
url: 'rop-scrm-shopmall/router',
method: 'POST',
data: params,
sign: true
})
}
/**
* 客户积分导入记录分页查询
*/
const getIntegralList = params => {
params.method = 'scrm.api.shopmall.integral.import.record.page'
return http({
url: 'rop-scrm-shopmall/router',
data: params
})
}
/**
* 客户积分导入数据详情
*/
const getIntegralDetail = params => {
params.method = 'scrm.api.shopmall.integral.import.record.detail'
return http({
url: 'rop-scrm-shopmall/router',
data: params
})
}
/**
* 客户积分导入明细数据分页查询
*/
const getCustomerIntegralList = params => {
params.method = 'scrm.api.shopmall.integral.import.detail.page'
return http({
url: 'rop-scrm-shopmall/router',
data: params
})
}
/**
* 客户积分导入记录导出
*/
const exportIntegralList = params => {
params.method = 'scrm.api.shopmall.integral.import.record.export'
return http({
url: 'rop-scrm-shopmall/router',
data: params
})
}
/**
* 客户积分审核
*/
const auditIntegral = params => {
params.method = 'scrm.api.shopmall.integral.import.audit'
return http({
url: 'rop-scrm-shopmall/router',
data: params
})
}
export default {
getList, getOrderDetail, orderExport, orderImport, integralorderSettle, getIntegralCustomerList, getIntegralCustomerExport, getIntegralDetailList, customerDetail, getIntegralDetailExport,
getghDirectionalGiftListApi,
importCustomerIntegral,
updateCustomerIntegral,
getOilCouponList,
getMerchantCharge,
getIntegralList,
exportIntegralList,
getIntegralDetail,
getCustomerIntegralList,
auditIntegral
}
...@@ -74,3 +74,7 @@ p{ ...@@ -74,3 +74,7 @@ p{
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.el-message{
z-index: 9999999 !important;
}
\ No newline at end of file \ No newline at end of file
function debounce(func, wait = 200) { function debounce (func, wait = 200) {
let timeout let timeout
return function(event) { return function (event) {
clearTimeout(timeout) clearTimeout(timeout)
timeout = setTimeout(() => { timeout = setTimeout(() => {
func.call(this, event) func.call(this, event)
...@@ -8,7 +8,7 @@ function debounce(func, wait = 200) { ...@@ -8,7 +8,7 @@ function debounce(func, wait = 200) {
} }
} }
function dateFormat(dateTime, format = 'YYYY-MM-DD HH:mm') { function dateFormat (dateTime, format = 'YYYY-MM-DD HH:mm') {
const date = new Date(dateTime) const date = new Date(dateTime)
const config = { const config = {
YYYY: date.getFullYear(), YYYY: date.getFullYear(),
...@@ -26,7 +26,7 @@ function dateFormat(dateTime, format = 'YYYY-MM-DD HH:mm') { ...@@ -26,7 +26,7 @@ function dateFormat(dateTime, format = 'YYYY-MM-DD HH:mm') {
/** /**
* 校验手机号码格式 * 校验手机号码格式
*/ */
function checkPhone(mobile) { function checkPhone (mobile) {
const myreg = /^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/ const myreg = /^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/
return myreg.test(mobile) return myreg.test(mobile)
} }
...@@ -37,7 +37,7 @@ function checkPhone(mobile) { ...@@ -37,7 +37,7 @@ function checkPhone(mobile) {
* hasAll Boolean 是否需要添加“全部”属性 * hasAll Boolean 是否需要添加“全部”属性
* refreshSigle String 更新特定的属性的options * refreshSigle String 更新特定的属性的options
*/ */
function getOptionsList(that, formName, hasAll = true, refreshSigle) { function getOptionsList (that, formName, hasAll = true, refreshSigle) {
if (refreshSigle) { if (refreshSigle) {
var item = that[formName].find(k => k.name == refreshSigle) var item = that[formName].find(k => k.name == refreshSigle)
var index = that[formName].findIndex(k => k.name == refreshSigle) var index = that[formName].findIndex(k => k.name == refreshSigle)
...@@ -64,7 +64,7 @@ function getOptionsList(that, formName, hasAll = true, refreshSigle) { ...@@ -64,7 +64,7 @@ function getOptionsList(that, formName, hasAll = true, refreshSigle) {
} }
/** 二次确认封装 */ /** 二次确认封装 */
function secondConfirm(that, title, txt, apiModule, apiName, apiParams, type = 'warning', fn) { function secondConfirm (that, title, txt, apiModule, apiName, apiParams, type = 'warning', fn) {
that.$confirm(txt, title, { that.$confirm(txt, title, {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
...@@ -86,7 +86,7 @@ function secondConfirm(that, title, txt, apiModule, apiName, apiParams, type = ' ...@@ -86,7 +86,7 @@ function secondConfirm(that, title, txt, apiModule, apiName, apiParams, type = '
}) })
} }
function aToExport(url) { function aToExport (url) {
var a = document.createElement('a') var a = document.createElement('a')
a.setAttribute('id', 'exportToExport') a.setAttribute('id', 'exportToExport')
a.setAttribute('href', url) a.setAttribute('href', url)
...@@ -95,11 +95,19 @@ function aToExport(url) { ...@@ -95,11 +95,19 @@ function aToExport(url) {
a.click() a.click()
} }
function openTab (url) {
const link = document.createElement('a')
link.href = url
link.target = '_blank'
link.rel = 'opener'
link.click()
}
export default { export default {
debounce, debounce,
dateFormat, dateFormat,
checkPhone, checkPhone,
getOptionsList, getOptionsList,
secondConfirm, secondConfirm,
aToExport aToExport,
openTab
} }
...@@ -6,16 +6,21 @@ ...@@ -6,16 +6,21 @@
<div class="content"> <div class="content">
<div class="title">积分充值</div> <div class="title">积分充值</div>
<el-scrollbar class="box"> <el-scrollbar class="box">
<template v-if="pageObject.id">
<div class="text flex"> <div class="text flex">
<div class="item flex"> <div class="item flex">
<div class="label">批次号:</div> <div class="label">批次号:</div>
<div class="value">-</div> <div class="value">{{ pageObject.batchNo || '-' }}</div>
</div> </div>
<div class="item flex"> <div class="item flex">
<div class="label">状态:</div> <div class="label">状态:</div>
<div class="value">-</div> <div class="value flex">
<span :class="['status', `status-${pageObject.status}`]"></span>
{{ { 0: '待充值', 1: '充值成功' }[pageObject.status] || '-' }}
</div> </div>
</div> </div>
</div>
</template>
<glsx-combi-form <glsx-combi-form
ref="fromRef" ref="fromRef"
:isEdit="true" :isEdit="true"
...@@ -30,6 +35,7 @@ ...@@ -30,6 +35,7 @@
<el-button <el-button
size="small" size="small"
@click="relateStoreVisible = true" @click="relateStoreVisible = true"
:disabled="pageObject.disabled"
> >
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
选择商户 选择商户
...@@ -42,55 +48,174 @@ ...@@ -42,55 +48,174 @@
:tableParams="merchantParams" :tableParams="merchantParams"
:hasPage="false" :hasPage="false"
class="merchant-box" class="merchant-box"
> ></GLTable>
</GLTable>
</template> </template>
</template> </template>
<template #table> <template #table>
<div class="upload"> <div class="upload">
<div class="upload-btn"> <div class="upload-btn">
<el-button size="small"> <el-button
size="small"
:disabled="pageObject.disabled"
>
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
上传名单 上传名单
</el-button> </el-button>
<input <input
type="file" type="file"
style="opacity: 0"
ref="file" ref="file"
accept=".xlsx, .xlc, .xlm, .xls" accept=".xlsx, .xlc, .xlm, .xls"
@change="uploadFile" @change="uploadFile"
:disabled="pageObject.disabled"
:class="['input',{'is-disabled':pageObject.disabled}]"
/> />
</div> </div>
<a <a
href="https://img01.glsx.com.cn/weapp/resource/saas/scrm/xlsx/红包链接.xlsx" href="https://img01.glsx.com.cn/weapp/resource/saas/scrm/xlsx/客户积分导入模板.xlsx"
target="_blank" target="_blank"
>下载模板</a> >下载模板</a>
</div> </div>
<div class="file-info flex"> <div class="file-info flex">
<template v-if="importObject.name">
<div class="el-icon-success"></div> <div class="el-icon-success"></div>
文件格式正确(客户名单.xlsx) 文件格式正确({{ importObject.name }})
</template>
</div> </div>
<template v-if="importObject.detailList">
<div class="table-box"> <div class="table-box">
<GLTable <GLTable
:tableData="[]" :tableData="importObject.detailList"
:tableParams="tableParams" :tableParams="tableParams"
:hasPage="false"
>
<template
slot="cashBackValue"
slot-scope="scope"
>
<template v-if="!pageObject.disabled">
<el-input
v-model.number.trim="scope.scope.cashBackValue"
:disabled="pageObject.disabled"
@blur="updateTotal(scope.scope, scope.index)"
></el-input>
</template>
<template v-else>
{{scope.scope.buyValue || '-'}}
</template>
</template>
<template
slot="buyValue"
slot-scope="scope"
>
<template v-if="!pageObject.disabled">
<el-input
v-model.number.trim="scope.scope.buyValue"
@blur="updateTotal(scope.scope, scope.index)"
></el-input>
</template>
<template v-else>
{{scope.scope.buyValue || '-'}}
</template>
</template>
<template
slot="oilList"
slot-scope="scope"
>
<template v-if="scope.scope.oilList && scope.scope.oilList.length">
<div class="flex">
<div class="list">
<template v-for="(i, index) in scope.scope.oilList">
<template>
<div
:key="index"
class="item flex"
>{{ i.aliasName }}*{{ i.amount }} ({{ NP.times(i.amount, i.faceValue) }}积分)</div>
</template>
</template>
</div>
<template v-if="!pageObject.disabled">
<el-button
type="text"
@click="showConfig(scope.scope, scope.index)"
>编辑</el-button>
</template>
</div>
</template>
<template v-else>
<template v-if="!pageObject.disabled">
<el-button
type="text"
@click="showConfig(scope.scope, scope.index)"
>配置</el-button>
</template>
<template v-else>
无
</template>
</template>
</template>
<template
slot="couponList"
slot-scope="scope"
> >
<template v-if="scope.scope.couponList && scope.scope.couponList.length">
<div class="flex">
<div class="list">
<template v-for="(i, index) in scope.scope.couponList">
<template>
<div
:key="index"
class="item flex"
>{{ i.couponName }}*{{ i.amount }}</div>
</template>
</template>
</div>
<template v-if="!pageObject.disabled">
<el-button
type="text"
@click="showConfig(scope.scope, scope.index, 1)"
>编辑</el-button>
</template>
</div>
</template>
<template v-else>
<template v-if="!pageObject.disabled">
<el-button
type="text"
@click="showConfig(scope.scope, scope.index, 1)"
>配置</el-button>
</template>
<template v-else>
无
</template>
</template>
</template>
</GLTable> </GLTable>
<div class="total"> <div
<template v-for="(i,index) in totalFormData"> class="total"
:key="totalKey"
>
<template v-for="(i, index) in totalFormData">
<template> <template>
<div <div
:key="index" :key="index"
class="item flex" class="item flex"
> >
<div class="label">{{i.label}}:</div> <div class="label">{{ i.label }}:</div>
<div class="value"></div> <div class="value">
<template v-if="i.formatter">
{{ i.formatter(totalForm) }}
</template>
<template v-else>
{{ totalForm[i.name] }}
</template>
</div>
</div> </div>
</template> </template>
</template> </template>
</div> </div>
</div> </div>
</template> </template>
</template>
</glsx-combi-form> </glsx-combi-form>
</el-scrollbar> </el-scrollbar>
</div> </div>
...@@ -107,120 +232,166 @@ ...@@ -107,120 +232,166 @@
</GLFooter> </GLFooter>
<select-store <select-store
ref="relateStore"
:dialogVisible.sync="relateStoreVisible" :dialogVisible.sync="relateStoreVisible"
:storeSelected="selectedList" :storeSelected="selectedList"
:merchantInfo="configForm.merchantId" :merchantInfo="configForm.merchantId"
@handleRelateStoreConfirm="handleRelateStoreConfirm" @handleRelateStoreConfirm="handleRelateStoreConfirm"
@handleRelateStoreClose="handleRelateStoreClose" @handleRelateStoreClose="handleRelateStoreClose"
/> />
<points-config
:configParams.sync="configParams"
:merchantId="configForm.merchantId"
@confirm="changeRowConfig"
/>
<import-err-dialog :importObj.sync="importObj" />
</div> </div>
</template> </template>
<script type='text/ecmascript-6'> <script type="text/ecmascript-6">
import * as dayjs from 'dayjs' import NP from 'number-precision'
import selectStore from './components/selectStore' import selectStore from './components/selectStore'
import pointsConfig from './components/pointsConfig.vue'
import importErrDialog from './components/importErrDialog.vue'
let chargeObject = {
gasCardServiceCharge: 0,
passageServiceCharge: 0
}
export default { export default {
components: { components: {
selectStore selectStore,
pointsConfig,
importErrDialog
}, },
name: '', name: '',
data () { data () {
return { return {
NP,
loading: false, loading: false,
relateStoreVisible: false, relateStoreVisible: false,
rule: {
merchantId: [{ required: true, message: '请选择商户', trigger: 'change' }],
table: [{
required: true, trigger: 'change', validator: (rule, value, callback) => {
const { detailList } = this.importObject
if (detailList && detailList.length) {
detailList.map(e => {
if (!e.cashBackValue && !e.buyValue) callback(new Error('返现金额和商品兑换积分二者至少需填写一个正整数的数值'))
})
callback()
} else callback(new Error('请导入充值人群'))
}
}]
},
configForm: {}, configForm: {},
formData: [ formData: [
{ {
label: '选择商户', label: '选择商户',
addHtml: 'merchantId' addHtml: 'merchantId',
name: 'merchantId'
}, },
{ {
label: '导入充值人群', label: '导入充值人群',
addHtml: 'table' addHtml: 'table',
name: 'table'
}, },
], ],
totalForm: {}, totalForm: {
customerTotal: 0,
total: [],
passageService: [],
gasService: []
},
totalFormData: [ totalFormData: [
{ {
label: '客户数量', label: '客户数量',
name: 'goodsName', name: 'customerTotal',
type: 'showTxt'
}, },
{ {
label: '充值积分小计', label: '充值积分小计',
name: 'goodsName', name: 'total',
type: 'showTxt' formatter: (cell) => {
const { total } = cell
return total.reduce((acc, cur) => acc + cur, 0)
}
}, },
{ {
label: '通道手续费(2%)', label: `通道手续费(0%)`,
name: 'goodsName', name: 'passageServiceCharge',
type: 'showTxt' formatter: (cell) => {
const { passageService } = cell,
{ passageServiceCharge } = chargeObject
return NP.times(passageService.reduce((acc, cur) => acc + cur, 0), passageServiceCharge).toFixed(2)
}
}, },
{ {
label: '通道手续费(2%)', label: `油卡手续费(0%)`,
name: 'goodsName', name: 'gasCardServiceCharge',
type: 'showTxt' formatter: (cell) => {
const { gasService } = cell,
{ gasCardServiceCharge } = chargeObject
return NP.times(gasService.reduce((acc, cur) => acc + cur, 0), gasCardServiceCharge).toFixed(2)
}
}, },
{ {
label: '总数', label: '总数',
name: 'goodsName', name: 'sum',
type: 'showTxt' formatter: (cell) => {
const { total, gasService, passageService } = cell,
{ gasCardServiceCharge, passageServiceCharge } = chargeObject,
gasPrice = NP.times(gasService.reduce((acc, cur) => acc + cur, 0), gasCardServiceCharge),
passagePrice = NP.times(passageService.reduce((acc, cur) => acc + cur, 0), passageServiceCharge),
totalPrice = total.reduce((acc, cur) => acc + cur, 0)
return NP.plus(gasPrice, passagePrice, totalPrice).toFixed(2)
}
}, },
], ],
tableParams: { tableParams: {
tableColumns: [ tableColumns: [
{ {
label: '保单号', label: '保单号',
prop: 'userPhone', prop: 'policyNo',
minWidth: 100 minWidth: 100
}, },
{ {
label: '用户姓名', label: '用户姓名',
prop: 'wechatName', prop: 'customerName',
minWidth: 100 minWidth: 100
}, },
{ {
label: '身份证号', label: '身份证号',
prop: 'activityName', prop: 'idCardNo',
minWidth: 100 minWidth: 100
}, },
{ {
label: '用户手机号', label: '用户手机号',
minWidth: 150, minWidth: 150,
prop: 'activityName', prop: 'customerPhone',
}, },
{ {
label: '返现金额', label: '返现金额',
minWidth: 100, minWidth: 200,
prop: 'activityName', addHtml: 'cashBackValue',
}, },
{ {
label: '商品兑换积分', label: '商品兑换积分',
minWidth: 150, addHtml: 'buyValue',
formatter: cell => `${dayjs(cell.activityStartTime).format('YYYY/MM/DD')}-${dayjs(cell.activityEndTime).format('YYYY/MM/DD')}` minWidth: 200
}, },
{ {
label: '赠送油券', label: '赠送油券',
prop: 'activityType', minWidth: 200,
minWidth: 150, addHtml: 'oilList'
formatter: cell => {
// 0:随机红包;1:九宫格;2:翻牌;3:大转盘;
return { 0: '随机红包', 1: '九宫格', 2: '翻牌', 3: '大转盘' }[cell.activityType]
}
}, },
{ {
label: '赠送自店服务', label: '赠送自店服务',
prop: 'activityType', minWidth: 200,
minWidth: 150, addHtml: 'couponList'
formatter: cell => {
// 0:随机红包;1:九宫格;2:翻牌;3:大转盘;
return { 0: '随机红包', 1: '九宫格', 2: '翻牌', 3: '大转盘' }[cell.activityType]
}
}, },
{ {
label: '充值积分小计', label: '充值积分小计',
prop: 'link', prop: 'total',
minWidth: 150 minWidth: 150
}, },
] ]
...@@ -238,43 +409,231 @@ export default { ...@@ -238,43 +409,231 @@ export default {
minWidth: 100 minWidth: 100
}, },
] ]
},
configParams: {
},
importObj: {
},
importObject: {},
totalKey: Date.now(),
pageObject: {
id: '',
disabled: false,
batchNo: '',
status: ''
} }
} }
}, },
mounted () { mounted () {
const { id, type } = this.$route.query const { id, type } = this.$route.query
// if (id) { if (id) this.getDetail(id, type)
// }
}, },
methods: { methods: {
async getQuestionnaireDetail () { async getDetail (id, type) {
try { try {
const data = await this.$apis.questionnaire.getQuestionnaireDetail() const res = await this.$apis.points.getIntegralDetail({ id }),
this.loading = false { detailList } = res
detailList.map((row, index) => {
this.setRowTotal(row, index)
this.setPassageService(row, index)
this.setGasService(row, index)
})
this.pageObject = {
id,
disabled: !type,
batchNo: res.batchNo,
status: res.status
}
this.handleRelateStoreConfirm({
merchantId: res.merchantId,
merchantName: res.merchantName
})
this.totalForm.customerTotal = detailList.length
this.importObject = {
detailList
}
} catch (error) { } catch (error) {
setTimeout(() => this.$router.go(-1), 1.5e3) setTimeout(() => this.$router.go(-1), 1e3)
} }
}, },
handleConfirm () { handleConfirm () {
const { disabled, id } = this.pageObject
if (disabled) return this.$router.go(-1)
this.$refs.fromRef.$refs.formRef.validate(async valid => {
if (valid) {
try {
this.$loading()
const { merchantId, merchantName } = this.configForm,
list = this.importObject.detailList
let detailList = []
list.map(e => {
detailList.push({
policyNo: e.policyNo,
customerName: e.customerName,
customerPhone: e.customerPhone,
idCardNo: e.idCardNo,
cashBackValue: e.cashBackValue,
buyValue: e.buyValue,
oilList: e.oilList || [],
couponList: e.couponList || []
})
})
let params = {
merchantId,
merchantName,
detailList
}
if (id) params.id = id
const res = await this.$apis.points.updateCustomerIntegral(params)
if (res) {
this.$loading().close()
this.$message({
message: id ? '编辑成功' : '创建成功',
type: 'success'
})
setTimeout(() => this.$router.go(-1), 1e3)
} else throw '创建失败'
} catch (error) {
this.$loading().close()
if (error) this.$message.error(error)
}
}
})
}, },
uploadFile () { async uploadFile (e) {
try {
const [file] = e.srcElement.files
if (!file) return
const reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = async event => {
this.$refs.file.value = ''
const imgFile = event.target.result,
[, arrBase64] = imgFile.split(','),
splitStr = file.name.split('.'),
fileUrl = splitStr.at(-1) + '@' + arrBase64,
{ code, message, data } = await this.$apis.points.importCustomerIntegral({ file: fileUrl })
if (code == 0) {
const { importStatue,
detailList,
errorCount,
errorUrl,
successCount } = data
if (importStatue == 0) {
detailList.map((row, index) => {
this.updateTotal(row, index)
})
this.importObject = {
detailList,
name: file.name
}
this.$message({
message: '导入成功',
type: 'success'
})
this.totalForm.customerTotal = detailList.length
this.validateField('table')
} else this.importObj = {
errorCount,
errorUrl,
successCount,
show: true
}
}
else throw message || ''
}
} catch (error) {
this.$refs.file.value = ''
if (error) this.$message.error(error)
}
}, },
// 选择门店 // 选择门店
handleRelateStoreClose () { handleRelateStoreClose () {
this.relateStoreVisible = false this.relateStoreVisible = false
}, },
handleRelateStoreConfirm (selectedData) { validateField (id) {
console.log(selectedData, '===') this.$refs.fromRef.$refs.formRef.validateField(id)
selectedData.merchantId && (this.configForm.merchantId = selectedData.merchantId) },
selectedData.merchantName && (this.configForm.merchantName = selectedData.merchantName) async handleRelateStoreConfirm (selectedData) {
selectedData.merchantId && (this.$set(this.configForm, 'merchantId', selectedData.merchantId))
selectedData.merchantName && (this.$set(this.configForm, 'merchantName', selectedData.merchantName))
this.validateField('merchantId')
this.handleRelateStoreClose() this.handleRelateStoreClose()
try {
const res = await this.$apis.points.getMerchantCharge({ merchantId: selectedData.merchantId })
if (res) {
this.totalFormData.map(e => {
if (['gasCardServiceCharge', 'passageServiceCharge'].includes(e.name)) {
const val = NP.divide(res[e.name] || 0, 100)
e.label = e.label.replace(/\d+/g, val)
chargeObject[e.name] = val
}
})
this.totalKey = Date.now()
}
} catch (error) {
if (error) this.$message.error(error)
}
},
showConfig (row, index, type = 0) {
row.oilList ||= []
row.couponList ||= []
this.configParams = {
show: true,
row,
type,
index
}
},
setRowTotal (row, index) {
const { oilList, cashBackValue, buyValue } = row
let total = NP.plus((cashBackValue || 0), (buyValue || 0))
oilList && oilList.map(i => total += NP.times((i.amount || 0), (i.faceValue || 0)))
row.total = total
this.totalForm.total[index] = total
this.totalKey = Date.now()
},
changeRowConfig ({
oilList,
couponList
}) {
const { row, index } = this.configParams
row.oilList = oilList
row.couponList = couponList
this.configParams = this.$options.data.call(this).configParams
if (oilList && oilList.length) {
this.setRowTotal(row, index)
this.setGasService(row, index)
}
},
setPassageService (row, index) {
const { cashBackValue, buyValue } = row,
passageService = NP.plus((cashBackValue || 0), (buyValue || 0))
this.totalForm.passageService[index] = passageService
this.totalKey = Date.now()
}, },
setGasService (row, index) {
const { oilList } = row
let total = 0
if (oilList && oilList.length) oilList.map(i => {
total += NP.times((i.amount || 0), (i.faceValue || 0))
})
this.totalForm.gasService[index] = total
this.totalKey = Date.now()
},
updateTotal (row, index) {
this.setRowTotal(row, index)
this.setPassageService(row, index)
this.setGasService(row, index)
}
} }
} }
</script> </script>
<style scoped lang='scss'> <style scoped lang="scss">
.layout { .layout {
position: absolute; position: absolute;
width: 100%; width: 100%;
...@@ -297,9 +656,10 @@ export default { ...@@ -297,9 +656,10 @@ export default {
font-weight: 500; font-weight: 500;
font-size: 16px; font-size: 16px;
color: #333333; color: #333333;
margin-bottom: 32px;
} }
.text { .text {
padding: 32px 0 20px 20px; padding: 0 0 20px 20px;
font-size: 14px; font-size: 14px;
color: #666666; color: #666666;
.label { .label {
...@@ -308,6 +668,17 @@ export default { ...@@ -308,6 +668,17 @@ export default {
} }
.value { .value {
min-width: 232px; min-width: 232px;
align-items: center;
.status {
width: 6px;
height: 6px;
border-radius: 4px;
background: #fdb757;
margin-right: 8px;
}
.status-1 {
background: #2cca74;
}
} }
} }
} }
...@@ -333,7 +704,7 @@ export default { ...@@ -333,7 +704,7 @@ export default {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
input { .input {
cursor: pointer; cursor: pointer;
position: absolute; position: absolute;
height: 100%; height: 100%;
...@@ -341,6 +712,10 @@ export default { ...@@ -341,6 +712,10 @@ export default {
top: 0px; top: 0px;
left: 0px; left: 0px;
font-size: 0px; font-size: 0px;
opacity: 0;
}
.is-disabled {
cursor: not-allowed;
} }
} }
a { a {
...@@ -350,10 +725,11 @@ export default { ...@@ -350,10 +725,11 @@ export default {
cursor: pointer; cursor: pointer;
} }
} }
.merchant-box{ .merchant-box {
margin-top: 10px; margin-top: 10px;
} }
.file-info { .file-info {
height: 32px;
font-size: 14px; font-size: 14px;
color: #999999; color: #999999;
.el-icon-success { .el-icon-success {
...@@ -367,6 +743,13 @@ export default { ...@@ -367,6 +743,13 @@ export default {
background: #f9f9f9; background: #f9f9f9;
border-radius: 4px; border-radius: 4px;
padding: 20px; padding: 20px;
/deep/ .el-input {
width: 100%;
}
.flex {
display: flex;
align-items: center;
}
} }
.total { .total {
display: flex; display: flex;
......
<template>
<div v-if="auditObj.show">
<GLDialog
mode="small"
title="批次审核"
:visible.sync="auditObj.show"
:before-close="handleClose"
>
<template #default>
<div class="audit-content flex">
<div class="title">请和财务确认是否已收到以下门店积分打款</div>
<div class="info flex">{{auditObj.row.merchantName}}:
<div class="price flex">
{{auditObj.row.totalIntegral}}<div class="unit">元</div>
</div>
</div>
<el-checkbox
v-model="checked"
class="check-box"
>
已确认收款
</el-checkbox>
<div class="tips">审核通过后客户积分将实时发放,无法撤销。</div>
</div>
</template>
<template #footer>
<el-button
size="small"
@click="handleClose"
>否,未收到款项,关闭弹窗</el-button>
<el-button
type="primary"
size="small"
@click="handleConfirm"
>是,已确认收到款项,赠送积分</el-button>
</template>
</GLDialog>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: '',
props: {
auditObj: {
type: Object,
default: () => { }
}
},
data () {
return {
loading: false,
checked: false
}
},
mounted () {
},
methods: {
handleClose () {
this.$emit('update:auditObj', {})
},
async handleConfirm () {
const { checked } = this,
{ id } = this.auditObj.row
if (checked) {
this.$loading()
try {
const res = await this.$apis.points.auditIntegral({ id })
if (res) {
this.$loading().close()
this.handleClose()
this.$message.success('操作成功')
this.$parent.handleSearch()
}
} catch (error) {
this.$loading().close()
if (error) this.$message.error(error)
}
} else this.$message.error('请先勾选确认收款')
}
}
}
</script>
<style scoped lang='scss'>
.audit-content {
flex-direction: column;
justify-content: center;
align-items: center;
.title {
font-size: 16px;
color: #333333;
}
.check-box {
font-size: 14px;
color: #333333;
}
.info {
align-items: center;
font-size: 16px;
color: #333333;
margin: 16px 0 10px;
.price {
align-items: center;
font-weight: 600;
font-size: 26px;
color: #eb4e4e;
.unit {
font-weight: 400;
font-size: 16px;
}
}
}
.tips {
font-size: 14px;
color: #999999;
margin-top: 10px;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<div v-if="detailObj.show">
<GLDialog
mode="big"
bigTitle="查看"
:visible.sync="detailObj.show"
:hasFooter="false"
:before-close="handleClose"
>
<GLTable
v-loading="loading"
ref="serviceRef"
:getListApi="getListApi"
:searchForm="searchForm"
:tableParams="tableParams"
:pageConf="pageConf"
:beforeSearchFn="beforeSearchFn"
>
<template
slot="oilList"
slot-scope="scope"
>
<template v-if="scope.scope.oilList && scope.scope.oilList.length">
<div class="flex">
<div class="list">
<template v-for="(i,index) in scope.scope.oilList">
<template>
<div
:key="index"
class="item flex"
>
{{i.aliasName}}*{{i.amount}} ({{NP.times(i.amount, i.faceValue)}}积分)
</div>
</template>
</template>
</div>
</div>
</template>
<template v-else>
无
</template>
</template>
<template
slot="couponList"
slot-scope="scope"
>
<template v-if="scope.scope.couponList && scope.scope.couponList.length">
<div class="flex">
<div class="list">
<template v-for="(i,index) in scope.scope.couponList">
<template>
<div
:key="index"
class="item flex"
>
{{i.couponName}}*{{i.amount}}
</div>
</template>
</template>
</div>
</div>
</template>
<template v-else>
无
</template>
</template>
</GLTable>
</GLDialog>
</div>
</template>
<script type='text/ecmascript-6'>
import NP from 'number-precision'
export default {
name: '',
props: {
detailObj: {
type: Object,
default: () => { }
}
},
data () {
return {
NP,
loading: false,
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
getListApi: this.$apis.points.getCustomerIntegralList,
searchForm: {},
tableParams: {
listName: 'list',
tableColumns: [
{
label: '保单号',
prop: 'policyNo',
minWidth: 100
},
{
label: '用户姓名',
prop: 'customerName',
minWidth: 100
},
{
label: '身份证号',
minWidth: 100,
prop: 'idCardNo',
},
{
label: '用户手机号',
minWidth: 150,
prop: 'customerPhone',
},
{
label: '返现金额',
minWidth: 150,
prop: 'cashBackValue'
},
{
label: '商品兑换积分',
prop: 'buyValue',
minWidth: 150,
},
{
label: '赠送油券',
minWidth: 150,
addHtml: 'oilList'
},
{
label: '赠送自店服务',
minWidth: 150,
addHtml: 'couponList'
},
{
label: '充值积分小计',
minWidth: 150,
formatter: cell => {
const { oilList, cashBackValue, buyValue } = cell
let total = NP.plus((cashBackValue || 0), (buyValue || 0))
oilList && oilList.map(i => total += NP.times(i.amount, i.faceValue))
return total
}
},
]
},
}
},
mounted () {
},
methods: {
beforeSearchFn () {
return new Promise(resolve => {
this.searchForm.batchNo = this.detailObj.batchNo
this.loading = false
resolve()
})
},
handleClose () {
this.$emit('update:detailObj', {})
}
}
}
</script>
<style scoped lang='scss'>
</style>
\ No newline at end of file \ No newline at end of file
<template>
<GLTable
v-loading="loading"
ref="serviceRef"
:tableData="serviceList"
:tableParams="tableParams"
@refreshTable="getServiceList"
@select="handleSelectionServiceTable(...arguments, 'oilCouponId')"
@select-all="handleSelectionServiceTableAll(...arguments, 'oilCouponId')"
>
<template
slot="gasImageSlot"
slot-scope="scope"
>
<el-popover
placement="top"
trigger="hover"
>
<img
class="img-plus"
:src="scope.scope.aliasUrl"
/>
<template slot="reference">
<img
:src="scope.scope.aliasUrl"
class="img"
>
</template>
</el-popover>
</template>
<template
slot="amount"
slot-scope="scope"
>
<el-input-number
size="small"
:min="1"
:max="10"
:step="1"
v-model="scope.scope.amount"
@change="changeAmount(...arguments,scope.scope,'oilCouponId')"
></el-input-number>
</template>
</GLTable>
</template>
<script type='text/ecmascript-6'>
import selectedMixin from '../mixins/selectedMixin'
export default {
name: 'gas',
mixins: [selectedMixin],
props: {
selectedGasList: {
type: Array,
default: () => []
}
},
data () {
return {
loading: false,
serviceList: [],
tableParams: {
listName: 'list',
// 行数据的key
mutiSelectUniqueKey: 'packageCode',
checkSelectKey: 'id',
checkSelectVal: '',
checkSelectable: null,
// 多选ref的名称
mutiSelectName: 'list',
tableColumns: [
{
label: '商品图片',
addHtml: 'gasImageSlot',
width: 100
},
{
label: '名称',
prop: 'aliasName',
},
{
label: '油卡面额/元',
prop: 'faceValue',
},
{
label: '售价/元',
formatter: cellValue => {
return cellValue.salesPrice ? Number(cellValue.salesPrice / 100).toFixed(2) : '--'
}
},
{
label: '选择数量',
addHtml: 'amount'
}
]
},
selectedList: [],
}
},
mounted () {
this.selectedList = this.selectedGasList
this.getServiceList()
},
methods: {
getServiceList () {
const { page: { pageNum, pageSize } } = this.$refs.serviceRef,
params = {
pageNum,
pageSize
}
this.loading = true
this.$apis.points.getOilCouponList(params).then(res => {
this.loading = false
res.list.map(e => {
e.amount = 1
e.oilCouponId = e.id
})
// 重置分页组件
this.serviceList = res.list
this.$refs.serviceRef.tableTotal = res.total
this.selectedPreExisting(this.selectedList, this.serviceList, 'oilCouponId', this.$refs.serviceRef)
this.setAmount(this.selectedList, this.serviceList, 'oilCouponId')
}).finally(() => {
this.loading = false
})
},
}
}
</script>
<style scoped lang='scss'>
.img {
width: 36px;
height: 36px;
// img{
// width: 100%;
// height: 100%;
// }
}
.img-plus {
width: 200px;
height: 200px;
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<GLDialog
mode="small"
title="操作结果"
:visible.sync="importObj.show"
:before-close="handleClose"
>
<template #default>
<div class="importObj-content flex">
<div class="success item">
<div class="num">{{importObj.successCount}}</div>
有效数据
</div>
<div class="line"></div>
<div class="error item">
<div class="num">{{importObj.errorCount}}</div>
异常数据
</div>
</div>
</template>
<template #footer>
<el-button
size="small"
@click="handleClose"
>确定</el-button>
<el-button
type="primary"
size="small"
@click="handleConfirm"
>导出错误结果</el-button>
</template>
</GLDialog>
</template>
<script type='text/ecmascript-6'>
export default {
name: '',
props: {
importObj: {
type: Object,
default: () => { }
}
},
data () {
return {
loading: false,
checked: false
}
},
mounted () {
},
methods: {
handleClose () {
this.$emit('update:importObj', {})
},
handleConfirm () {
this.$utils.aToExport(this.importObj.errorUrl)
this.handleClose()
}
}
}
</script>
<style scoped lang='scss'>
.importObj-content {
height: 100%;
align-items: center;
.item {
flex: 1;
text-align: center;
.num {
font-weight: 700;
font-size: 26px;
line-height: 32px;
margin-bottom: 10px;
}
}
.error{
.num{
color: #EB4E4E;
}
}
.success{
.num{
color: #2CCA74;
}
}
.line {
width: 1px;
height: 56px;
background: #e8e8ea;
}
}
</style>
\ No newline at end of file \ 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>
<template v-if="configParams.show">
<div class="component">
<gas
v-show="currentComponent == 'gas'"
ref="gasRef"
:merchantId="merchantId"
:selectedGasList="configParams.row.oilList || []"
/>
<service
v-show="currentComponent == 'service'"
ref="serviceRef"
:merchantId="merchantId"
:selectedServiceList="configParams.row.couponList || []"
/>
</div>
</template>
</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: () => { }
},
merchantId: [Number, String]
},
data () {
return {
giftVisible: true,
currentComponent: 'gas',
tabPaneList: [
{
label: '油卡',
name: 'gas'
},
{
label: '自店服务',
name: 'service'
}
]
}
},
watch: {
'configParams.show' (n) {
if (n) this.currentComponent = this.configParams.type == 1 ? 'service' : 'gas'
}
},
mounted () {
},
methods: {
handleGiftClose () {
this.$emit('update:configParams', {})
},
handleConfirm () {
const { gasRef, serviceRef } = this.$refs,
oilList = gasRef.selectedList?.map(e => {
return {
oilCouponId: e.oilCouponId,
amount: e.amount,
faceValue: e.faceValue,
aliasName: e.aliasName
}
}) || [],
couponList = serviceRef.selectedList?.map(e => {
return {
couponId: e.couponId,
amount: e.amount,
couponName: e.couponName
}
}) || []
this.$emit('confirm', {
oilList,
couponList
})
}
}
}
</script>
<style scoped lang='scss'>
.points-panel {
/deep/.el-dialog__wrapper {
.el-dialog__body {
padding-top: 0;
}
}
}
.component {
padding-top: 20px;
}
</style>
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
</glsx-combi-form> </glsx-combi-form>
<GLTable <GLTable
ref="storeRef" ref="storeRef"
:noDataImg="url"
:tableTotal="total" :tableTotal="total"
:searchForm="searchForm" :searchForm="searchForm"
:tableParams="tableParams" :tableParams="tableParams"
...@@ -54,19 +53,16 @@ ...@@ -54,19 +53,16 @@
</GLDialog> </GLDialog>
</template> </template>
<script> <script>
import url from '@/assets/empty.png'
export default { export default {
name: 'selectStore', name: 'selectStore',
data () { data () {
return { return {
url: url,
searchForm: { searchForm: {
merchantId: '', merchantId: '',
merchantName: '' merchantName: ''
}, },
total: 0, total: 0,
storeList: [], storeList: [],
heightBox: 200,
merchantId: '', merchantId: '',
merchantName: '', merchantName: '',
// 搜索 // 搜索
...@@ -163,8 +159,6 @@ export default { ...@@ -163,8 +159,6 @@ export default {
}, },
methods: { methods: {
init () { init () {
let clientHeight = document.documentElement.clientHeight
this.heightBox = clientHeight - 0.15 * clientHeight - 425
this.merchantId = this.merchantInfo this.merchantId = this.merchantInfo
this.getList() this.getList()
}, },
......
<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(...arguments, 'couponId')"
@select-all="handleSelectionServiceTableAll(...arguments, 'couponId')"
>
<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="amount"
slot-scope="scope"
>
<el-input-number
size="small"
:min="1"
:max="10"
:step="1"
v-model="scope.scope.amount"
@change="changeAmount(...arguments,scope.scope,'couponId')"
></el-input-number>
</template>
</GLTable>
</div>
</template>
</template>
</div>
</template>
<script type='text/ecmascript-6'>
import util from '@/utils/index'
import selectedMixin from '../mixins/selectedMixin'
export default {
name: 'service',
mixins: [selectedMixin],
props: {
merchantId: [Number, String],
selectedServiceList: {
type: Array,
default: () => []
}
},
data () {
return {
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: 'amount',
addHtml: 'amount'
}
]
},
selectedList: []
}
},
watch: {
discountType () {
this.serviceList = []
this.getServiceList()
}
},
computed: {
setLeft () {
const { discountType } = this
return { left: (discountType == 7 ? 0 : discountType - 1) * 88 + 2 + 'px' }
}
},
mounted () {
this.selectedList = this.selectedServiceList
this.getServiceList()
},
methods: {
getServiceList () {
const { discountType, merchantId } = this,
{ page: { pageNum, pageSize } } = this.$refs[`serviceRef${discountType}`][0],
params = {
status: 2,
discountType,
merchantId,
limitStockFlag: 2,
pageNum,
pageSize
}
this.loading = true
this.$apis.points.getghDirectionalGiftListApi(params).then(res => {
this.loading = false
res.list.map(e => {
e.amount = 1
e.couponId = e.id
})
// 重置分页组件
this.serviceList = res.list
this.$refs['serviceRef' + discountType][0].tableTotal = res.total
this.selectedPreExisting(this.selectedList, this.serviceList, 'couponId', this.$refs['serviceRef' + this.discountType][0])
this.setAmount(this.selectedList, this.serviceList, 'couponId')
}).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 () {
util.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 \ No newline at end of file
...@@ -22,11 +22,28 @@ ...@@ -22,11 +22,28 @@
ref="listRef" ref="listRef"
:getListApi="getListApi" :getListApi="getListApi"
:searchForm="tableSearchForm" :searchForm="tableSearchForm"
:noDataImg="url"
:tableParams="tableParams" :tableParams="tableParams"
:pageConf="pageConf" :pageConf="pageConf"
> >
<span <template
slot="customerNumber"
slot-scope="scope"
>
<div
class="link"
@click="openDetail(scope.scope.batchNo)"
>{{scope.scope.customerNumber}}</div>
</template>
<template
slot="status"
slot-scope="scope"
>
<div class="status-box">
<span :class="['status',`status-${scope.scope.status}`]"></span>
{{{0:'待充值',1:'充值成功'}[scope.scope.status]}}
</div>
</template>
<template
slot="auth-button" slot="auth-button"
slot-scope="scope" slot-scope="scope"
> >
...@@ -35,30 +52,40 @@ ...@@ -35,30 +52,40 @@
:buttonItem="scope.scope" :buttonItem="scope.scope"
:buttonNum="3" :buttonNum="3"
></GLTableButton> ></GLTableButton>
</span> </template>>
</GLTable> </GLTable>
</div> </div>
<detail-dialog :detailObj.sync="detailObj" />
<audit-dialog :auditObj.sync="auditObj" />
</div> </div>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import url from '@/assets/empty.png' import detailDialog from './components/detailDialog.vue'
import * as dayjs from 'dayjs' import * as dayjs from 'dayjs'
import auditDialog from './components/auditDialog.vue'
export default { export default {
name: 'RedEnvelopeConfig', name: '',
components: {
detailDialog,
auditDialog
},
data () { data () {
return { return {
url, pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
searchForm: { searchForm: {
batchNo: '',
merchantName: '', merchantName: '',
merchantId: '', customerName: '',
staffName: '' customerPhone: '',
createdDate: [],
auditDate: [],
status: ''
}, },
searchFormData: [ searchFormData: [
{ {
label: '批次', label: '批次',
name: 'activityName', name: 'batchNo',
type: 'input', type: 'input',
maxlength: 100 maxlength: 100
}, },
...@@ -70,19 +97,19 @@ export default { ...@@ -70,19 +97,19 @@ export default {
}, },
{ {
label: '用户姓名', label: '用户姓名',
name: 'wechatName', name: 'customerName',
type: 'input', type: 'input',
maxlength: 100 maxlength: 100
}, },
{ {
label: '用户手机号', label: '用户手机号',
name: 'wechatName', name: 'customerPhone',
type: 'input', type: 'input',
maxlength: 100 maxlength: 13
}, },
{ {
label: '创建时间', label: '创建时间',
name: 'showTime', name: 'createdDate',
type: 'datePicker', type: 'datePicker',
valueFormat: 'yyyy-MM-dd', valueFormat: 'yyyy-MM-dd',
isClear: true, isClear: true,
...@@ -98,23 +125,20 @@ export default { ...@@ -98,23 +125,20 @@ export default {
}, },
{ {
label: '状态', label: '状态',
name: 'statuses', name: 'status',
type: 'select', type: 'select',
maxlength: 100, maxlength: 100,
optionList: [ optionList: [
{ text: '全部', id: '-1,0,1' }, { text: '全部', id: '' },
{ text: '待付款', id: '0' }, { text: '待充值 ', id: '0' },
{ text: '已取消', id: '1' }, { text: '充值成功', id: '1' }
{ text: '发放中', id: '-1' },
{ text: '发放成功', id: '-2' },
{ text: '发放失败', id: '-3' },
], ],
optionId: 'id', optionId: 'id',
optionLabel: 'text' optionLabel: 'text'
}, },
{ {
label: '审核时间', label: '审核时间',
name: 'showTime', name: 'auditDate',
type: 'datePicker', type: 'datePicker',
valueFormat: 'yyyy-MM-dd', valueFormat: 'yyyy-MM-dd',
isClear: true, isClear: true,
...@@ -129,54 +153,50 @@ export default { ...@@ -129,54 +153,50 @@ export default {
} }
}, },
], ],
getListApi: this.$apis.points.getList, getListApi: this.$apis.points.getIntegralList,
tableParams: { tableParams: {
listName: 'list', listName: 'list',
tableOption: true, tableOption: true,
tableColumns: [ tableColumns: [
{ {
label: '商户名称', label: '商户名称',
prop: 'userPhone', prop: 'merchantName',
minWidth: 100 minWidth: 150
}, },
{ {
label: '批次', label: '批次',
prop: 'wechatName', prop: 'batchNo',
minWidth: 100 minWidth: 120
}, },
{ {
label: '客户数量', label: '客户数量',
prop: 'activityName', addHtml: 'customerNumber',
minWidth: 100 minWidth: 100
}, },
{ {
label: '充值积分数', label: '充值积分数',
minWidth: 100, minWidth: 120,
prop: 'activityName', prop: 'totalIntegral',
}, },
{ {
label: '状态', label: '状态',
minWidth: 100, minWidth: 120,
prop: 'activityName', addHtml: 'status',
}, },
{ {
label: '创建时间', label: '创建时间',
minWidth: 150, minWidth: 150,
formatter: cell => `${dayjs(cell.activityStartTime).format('YYYY/MM/DD')}-${dayjs(cell.activityEndTime).format('YYYY/MM/DD')}` formatter: cell => dayjs(cell.createdDate).format('YYYY/MM/DD hh:mm:ss')
}, },
{ {
label: '审核人', label: '审核人',
prop: 'activityType', prop: 'auditBy',
minWidth: 150, minWidth: 150,
formatter: cell => {
// 0:随机红包;1:九宫格;2:翻牌;3:大转盘;
return { 0: '随机红包', 1: '九宫格', 2: '翻牌', 3: '大转盘' }[cell.activityType]
}
}, },
{ {
label: '审核时间', label: '审核时间',
prop: 'link', minWidth: 150,
minWidth: 150 formatter: cell => cell.auditDate ? dayjs(cell.auditDate).format('YYYY/MM/DD hh:mm:ss') : ''
}, },
] ]
}, },
...@@ -187,11 +207,11 @@ export default { ...@@ -187,11 +207,11 @@ export default {
attrs: { attrs: {
type: 'text', type: 'text',
}, },
condition: row => row.status != 0, condition: row => row.status == 0,
listeners: { listeners: {
click: row => this.dataObj = { click: row => this.auditObj = {
show: true, show: true,
...row row
} }
} }
}, },
...@@ -201,6 +221,7 @@ export default { ...@@ -201,6 +221,7 @@ export default {
attrs: { attrs: {
type: 'text', type: 'text',
}, },
condition: row => row.status == 1,
listeners: { listeners: {
click: row => this.editForm(row) click: row => this.editForm(row)
} }
...@@ -211,14 +232,16 @@ export default { ...@@ -211,14 +232,16 @@ export default {
attrs: { attrs: {
type: 'text', type: 'text',
}, },
condition: row => true, condition: row => row.status == 0,
listeners: { listeners: {
click: row => this.editForm(row, 'edit') click: row => this.editForm(row, 'edit')
} }
}, },
], ],
showImportRecord: false, showImportRecord: false,
tableSearchForm: {} tableSearchForm: {},
detailObj: {},
auditObj: {}
} }
}, },
mounted () { mounted () {
...@@ -234,27 +257,22 @@ export default { ...@@ -234,27 +257,22 @@ export default {
}, },
handleExport () { handleExport () {
const params = this.getParams() const params = this.getParams()
this.$apis.points.orderExport(params).then(res => { this.$apis.points.exportIntegralList({ ...params, ...this.$refs.listRef.page }).then(res => {
this.$utils.aToExport(res) this.$utils.aToExport(res)
}) })
}, },
getParams () { getParams () {
let params = JSON.parse(JSON.stringify(this.searchForm)) let params = JSON.parse(JSON.stringify(this.searchForm))
this.updateParams(params, 'showTime', 'showTime', 'startShowTime', 'endShowTime'); this.setTimeFormat(params, 'createdDate', 'createdDateBegin', 'createdDateEnd')
this.updateParams(params, 'lotteryDrawTime', 'lotteryDrawTime', 'startLotteryDrawTime', 'endLotteryDrawTime'); this.setTimeFormat(params, 'auditDate', 'auditDateBegin', 'auditDateEnd')
return params return params
}, },
updateParams (params, paramKey, formKey, beginKey, endKey) { setTimeFormat (target, name, start, end) {
if (params[paramKey]) { if (target[name] && target[name].length) {
params[beginKey] = this.searchForm[formKey][0]; target[start] = `${dayjs(target[name][0]).format('YYYY-MM-DD')} 00:00:00`
params[endKey] = this.searchForm[formKey][1]; target[end] = `${dayjs(target[name][1]).format('YYYY-MM-DD')} 23:59:59`
delete params[paramKey]; delete target[name]
} else {
delete params[beginKey];
delete params[endKey];
} }
// delete params[paramKey];
return params
}, },
jump () { jump () {
this.$router.push({ this.$router.push({
...@@ -263,6 +281,22 @@ export default { ...@@ -263,6 +281,22 @@ export default {
$title: '门店客户积分充值', $title: '门店客户积分充值',
} }
}) })
},
openDetail (batchNo) {
this.detailObj = {
show: true,
batchNo
}
},
editForm (row, type = '') {
this.$router.push({
path: '/storeCredit/add',
query: {
$title: type ? '编辑门店客户积分充值' : '查看门店客户积分充值',
id: row.id,
type
}
})
} }
} }
...@@ -288,5 +322,23 @@ export default { ...@@ -288,5 +322,23 @@ export default {
margin-left: 10px; margin-left: 10px;
} }
} }
.link {
color: #5850ff;
cursor: pointer;
}
}
.status-box {
display: flex;
align-items: center;
.status {
width: 6px;
height: 6px;
border-radius: 4px;
background: #fdb757;
margin-right: 8px;
}
.status-1 {
background: #2cca74;
}
} }
</style> </style>
export default {
methods: {
handleSelectionServiceTable (selection, row, id) {
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, id) {
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) {
//这里使用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()
}
},
setAmount (rows, list, val) {
if (rows?.length) {
this.$nextTick(() => {
rows.forEach(row => {
list.forEach(i => {
if (i[val] == row[val]) this.$set(i, 'amount', row.amount)
})
})
})
}
},
changeAmount () {
const [amount, , row, id] = arguments,
{ selectedList } = this,
that = selectedList.find(e => e[id] == row[id])
that.amount = amount
}
}
}
\ 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!