Commit 38742cf3 by 前端

Merge branch 'v3.22.1' into 'master'

合并V3.22.1

See merge request !18
2 parents 6243d4dd 7a13d84b
......@@ -6457,14 +6457,16 @@
}
},
"glsx-components": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/glsx-components/-/glsx-components-1.5.2.tgz",
"integrity": "sha512-5/LaPu0B1uT7Kzl6oyIqyFT/NXIz2w7HNstiRtHaUQN1waSrPPPtzRRwywJg6CSSL+p994NaqPRnX696NAYzKg==",
"version": "1.5.7",
"resolved": "https://registry.npmjs.org/glsx-components/-/glsx-components-1.5.7.tgz",
"integrity": "sha512-WEWt1Ev7uf8VgILrEr15ZHxOreqWEVEY2WRP5EmZKzYKTVF/7dQU/oI84+Xo4vSmlz7ltblaATyrwm1U1LDnHg==",
"requires": {
"@amap/amap-jsapi-loader": "^1.0.1",
"core-js": "^3.6.5",
"element-ui": "^2.15.6",
"glsx-common": "^1.4.9",
"vue": "^2.6.11",
"vue-amap": "^0.5.10",
"vuedraggable": "^2.24.3"
},
"dependencies": {
......@@ -6477,16 +6479,6 @@
"md5": "^2.3.0",
"qs": "^6.10.1",
"sha1": "^1.1.1"
},
"dependencies": {
"axios": {
"version": "0.21.4",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",
"integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==",
"requires": {
"follow-redirects": "^1.14.0"
}
}
}
}
}
......
......@@ -14,8 +14,9 @@
"echarts": "^5.4.3",
"el-tree-transfer": "^2.2.6",
"glsx-common": "^2.0.4",
"glsx-components": "^1.2.5",
"glsx-components": "^1.5.7",
"moment": "^2.29.4",
"number-precision": "^1.6.0",
"vod-js-sdk-v6": "^1.6.2",
"wangeditor": "^4.7.15",
"word-edit": "^1.3.3"
......
import { http } from '@/main'
/**自店服务 */
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
})
}
export default {
getghDirectionalGiftListApi,
importCustomerIntegral,
updateCustomerIntegral,
getOilCouponList,
getMerchantCharge,
getIntegralList,
exportIntegralList,
getIntegralDetail,
getCustomerIntegralList,
}
\ No newline at end of file
......@@ -902,3 +902,6 @@ html {
color: #5850ff;
}
}
.el-message{
z-index: 9999999 !important;
}
\ No newline at end of file
<template>
<div
class="layout"
v-loading="loading"
>
<div class="content">
<div class="title">积分充值</div>
<el-scrollbar class="box">
<template v-if="pageObject.id">
<div class="text flex">
<div class="item flex">
<div class="label">批次号:</div>
<div class="value">{{ pageObject.batchNo || '-' }}</div>
</div>
<div class="item flex">
<div class="label">状态:</div>
<div class="value flex">
<span :class="['status', `status-${pageObject.status}`]"></span>
{{ { 0: '待充值', 1: '充值成功' }[pageObject.status] || '-' }}
</div>
</div>
</div>
</template>
<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"
:disabled="pageObject.disabled"
>
<i class="el-icon-plus"></i>
上传名单
</el-button>
<input
type="file"
ref="file"
accept=".xlsx, .xlc, .xlm, .xls"
@change="uploadFile"
:disabled="pageObject.disabled"
:class="['input',{'is-disabled':pageObject.disabled}]"
/>
</div>
<a
href="https://img01.glsx.com.cn/weapp/resource/saas/scrm/xlsx/客户积分导入模板.xlsx"
target="_blank"
>下载模板</a>
</div>
<template v-if="importObject.detailList">
<template v-if="importObject.name">
<div class="file-info flex">
<div class="el-icon-success"></div>
文件格式正确({{ importObject.name }})
</div>
</template>
<div class="table-box">
<GLTable
:tableData="importObject.detailList[pageNum - 1]"
:tableParams="tableParams"
ref="listRef"
:pageConf="pageConf"
:tableTotal="totalForm.customerTotal"
:pageSizes="[50]"
@refreshTable="refreshTable"
>
<template
slot="cashBackValue"
slot-scope="scope"
>
<template v-if="!pageObject.disabled">
<el-input
v-model.number.trim="scope.scope.cashBackValue"
@blur="updateTotal(scope.scope, scope.index,'cashBackValue')"
maxLength="6"
></el-input>
</template>
<template v-else>
{{scope.scope.cashBackValue || '-'}}
</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,'buyValue')"
maxLength="6"
></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">
<span>{{ filterData(scope.scope.oilList,'oilList').slice(0, 1).join('、') }}</span>
<el-popover
placement="top"
width="fit-content"
trigger="hover"
>
<div
v-for="(item,index) in filterData(scope.scope.oilList,'oilList')"
:key="index"
>
{{item}}
</div>
<span
class="more-info"
slot="reference"
>...({{ scope.scope.oilList.length }})</span>
</el-popover>
<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">
<span>{{ filterData(scope.scope.couponList,'couponList').slice(0, 1).join('、') }}</span>
<el-popover
placement="top"
width="fit-content"
trigger="hover"
>
<div
v-for="(item,index) in filterData(scope.scope.couponList,'couponList')"
:key="index"
>
{{item}}
</div>
<span
class="more-info"
slot="reference"
>...({{ scope.scope.couponList.length }})</span>
</el-popover>
<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>
<div
class="total"
:key="totalKey"
>
<template v-for="(i, index) in totalFormData">
<template>
<div
:key="index"
class="item flex"
>
<div class="label">{{ i.label }}:</div>
<div
class="value"
:ref="`value-${index}`"
>
<template v-if="i.formatter">
{{ i.formatter(totalForm) }}
</template>
<template v-else>
{{ totalForm[i.name] }}
</template>
</div>
</div>
</template>
</template>
</div>
</div>
</template>
</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"
/>
<import-err-dialog :importObj.sync="importObj" />
</div>
</template>
<script type='text/ecmascript-6'>
import NP from 'number-precision'
import pointsConfig from './components/pointsConfig.vue'
import importErrDialog from './components/importErrDialog.vue'
const truncateDecimal = (number, decimalPlaces = 2) => {
let [integer, decimals] = String(number).split('.')
if (!decimals) decimals = '00'
if (decimals.length > 2) decimals = decimals.substring(0, decimalPlaces)
if (decimals.length == 1) decimals += '0'
return `${integer}.${decimals}`
}
export default {
components: {
pointsConfig,
importErrDialog
},
name: '',
data () {
return {
NP,
loading: false,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
rule: {
table: [{
required: true, trigger: 'change', validator: (rule, value, callback) => {
const { detailList } = this.importObject
if (detailList && detailList.length) {
detailList.map(i => {
i.map(e => {
if (e.cashBackValue < 1 && e.buyValue < 1) callback(new Error('返现金额和商品兑换积分二者至少需填写一个正整数的数值'))
})
})
callback()
} else callback(new Error('请导入充值人群'))
}
}]
},
configForm: {
merchantId: this.$globalState.session.merchantId,
merchantName: this.$globalState.session.merchantName,
},
formData: [
{
label: '导入充值人群',
addHtml: 'table',
name: 'table'
},
],
totalForm: {
customerTotal: 0,
total: [],
passageService: [],
gasService: []
},
totalFormData: [
{
label: '客户数量',
name: 'customerTotal',
},
{
label: '充值积分小计',
name: 'total',
formatter: (cell) => {
const { total } = cell
return total.reduce((acc, cur) => acc + cur, 0)
}
},
{
label: `通道手续费(0%)`,
name: 'passageServiceCharge',
formatter: (cell) => {
const { passageService } = cell,
{ passageServiceCharge } = this.chargeObject,
passageSum = passageService.reduce((acc, cur) => acc + cur, 0),
sum = truncateDecimal(NP.times(passageSum, passageServiceCharge, 0.01))
return `${passageSum}*${passageServiceCharge}%=${sum}`
}
},
{
label: `油卡手续费(0%)`,
name: 'gasCardServiceCharge',
formatter: (cell) => {
const { gasService } = cell,
{ gasCardServiceCharge } = this.chargeObject,
gasCardSum = gasService.reduce((acc, cur) => acc + cur, 0),
sum = truncateDecimal(NP.times(gasCardSum, gasCardServiceCharge, 0.01))
return `${gasCardSum}*${gasCardServiceCharge}%=${sum}`
}
},
{
label: '总数',
name: 'sum',
formatter: (cell) => {
const { total, gasService, passageService } = cell,
{ gasCardServiceCharge, passageServiceCharge } = this.chargeObject,
gasPrice = NP.times(gasService.reduce((acc, cur) => acc + cur, 0), gasCardServiceCharge, 0.01),
passagePrice = NP.times(passageService.reduce((acc, cur) => acc + cur, 0), passageServiceCharge, 0.01),
totalPrice = total.reduce((acc, cur) => acc + cur, 0)
return truncateDecimal(NP.plus(gasPrice, passagePrice, totalPrice))
}
},
],
tableParams: {
tableColumns: [
{
label: '保单号',
prop: 'policyNo',
minWidth: 200
},
{
label: '用户姓名',
prop: 'customerName',
minWidth: 100
},
{
label: '身份证号',
prop: 'idCardNo',
minWidth: 200
},
{
label: '用户手机号',
minWidth: 150,
prop: 'customerPhone',
},
{
label: '返现金额',
minWidth: 128,
addHtml: 'cashBackValue',
},
{
label: '商品兑换积分',
addHtml: 'buyValue',
minWidth: 128
},
{
label: '赠送油券',
minWidth: 260,
addHtml: 'oilList'
},
{
label: '赠送自店服务',
minWidth: 260,
addHtml: 'couponList'
},
{
label: '充值积分小计',
prop: 'total',
minWidth: 150
},
]
},
configParams: {},
importObj: {
},
importObject: {},
totalKey: Date.now(),
pageObject: {
id: '',
disabled: false,
batchNo: '',
status: ''
},
chargeObject: {
gasCardServiceCharge: 0,
passageServiceCharge: 0
},
pageNum: 1
}
},
mounted () {
const { id, type } = this.$route.query
if (id) this.getDetail(id, type)
else this.getMerchantCharge()
},
methods: {
refreshTable ({ pageNum }) {
this.pageNum = pageNum
},
async getDetail (id, type) {
try {
this.loading = true
const res = await this.$apis.points.getIntegralDetail({ id }),
{ detailList, merchantId, merchantName } = res
this.configForm = {
merchantId,
merchantName
}
this.getMerchantCharge({
gasCardServiceCharge: res.oilCouponRate,
passageServiceCharge: res.integralRate
})
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.totalForm.customerTotal = detailList.length
const list = this.splitArray(detailList, 50)
this.importObject = {
detailList: list
}
this.loading = false
this.pageNum = 1
this.setTableHeight(detailList)
} catch (error) {
this.loading = false
setTimeout(() => this.$router.go(-1), 1e3)
}
},
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 = true
const { merchantId, merchantName } = this.configForm,
list = this.importObject.detailList
let detailList = []
list.map(i => {
i.map(e => {
let oilList = [], couponList = []
e.oilList?.map(o => {
oilList.push({
oilCouponId: o.oilCouponId,
amount: o.amount,
salesPrice: o.salesPrice,
aliasName: o.aliasName
})
})
e.couponList?.map(c => {
couponList.push({
couponId: c.couponId,
amount: c.amount,
couponName: c.couponName
})
})
detailList.push({
policyNo: e.policyNo,
customerName: e.customerName,
customerPhone: e.customerPhone,
idCardNo: e.idCardNo,
cashBackValue: e.cashBackValue || 0,
buyValue: e.buyValue || 0,
oilList,
couponList
})
})
})
let params = {
merchantId,
merchantName,
detailList
}
if (id) params.id = id
const res = await this.$apis.points.updateCustomerIntegral(params)
if (res) {
this.$message({
message: id ? '编辑成功' : '创建成功',
type: 'success'
})
setTimeout(() => this.$router.go(-1), 1e3)
}
this.loading = false
} catch (error) {
this.loading = false
this.$message.error(error || '操作失败')
}
}
})
},
async uploadFile (e) {
try {
const [file] = e.srcElement.files
if (!file) return
const reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = async event => {
this.loading = true
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 })
this.loading = false
if (code == 0) {
const { importStatue,
detailList,
errorCount,
errorUrl,
successCount } = data
if (importStatue == 0) {
detailList.map((row, index) => {
this.updateTotal(row, index)
})
const list = this.splitArray(detailList, 50)
this.importObject = {
detailList: list,
name: file.name
}
this.$message({
message: '导入成功',
type: 'success'
})
this.totalForm.customerTotal = detailList.length
this.pageNum = 1
this.validateField('table')
this.setTableHeight(detailList)
} else this.importObj = {
errorCount,
errorUrl,
successCount,
show: true
}
}
else this.$message.error(message)
}
} catch (error) {
this.loading = false
this.$refs.file.value = ''
if (error) this.$message.error(error)
}
},
setTableHeight (detailList = []) {
const { listRef } = this.$refs
if (listRef) {
let length = detailList.length
listRef.tableHeightValues = `${(length > 10 ? 10 : length) * 56 + 56}px`
} else setTimeout(() => {
this.setTableHeight(detailList)
}, 100)
},
validateField (id) {
this.$refs.fromRef.$refs.formRef.validateField(id)
},
async getMerchantCharge (isEdit) {
console.log(isEdit)
try {
const { merchantId } = this.configForm,
res = isEdit ? isEdit : await this.$apis.points.getMerchantCharge({ merchantId })
if (res) {
this.totalFormData.map(e => {
if (['gasCardServiceCharge', 'passageServiceCharge'].includes(e.name)) {
const val = res[e.name] || 0
e.label = e.label.replace(/\d+/g, val)
this.chargeObject[e.name] = val
}
})
this.updateView()
}
} catch (error) {
if (error) this.$message.error(error)
}
},
showConfig (row, index, type = 0) {
this.configParams = {
show: true,
row,
type,
index,
oilList: JSON.parse(JSON.stringify(row.oilList || [])),
couponList: JSON.parse(JSON.stringify(row.couponList || [])),
}
},
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.salesPrice || 0), 0.01))
row.total = total
this.totalForm.total[index] = total
this.updateView()
},
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.updateView()
},
setGasService (row, index) {
const { oilList } = row
let total = 0
if (oilList && oilList.length) oilList.map(i => {
total += NP.times((i.amount || 0), (i.salesPrice || 0), 0.01)
})
this.totalForm.gasService[index] = total
this.updateView()
},
updateTotal (row, index, key) {
if (key && !/^[0-9]\d*$/.test(row[key])) row[key] = ''
this.setRowTotal(row, index)
this.setPassageService(row, index)
this.setGasService(row, index)
},
updateView () {
this.totalKey = Date.now()
const REF = this.$refs,
refLength = this.totalFormData.length
this.$nextTick(() => {
let widthList = []
for (let i = 0; i < refLength; i++) {
let [item] = REF[`value-${i}`] || []
if (item) widthList.push(item.offsetWidth)
}
if (widthList.length) {
const width = Math.max.apply(null, widthList)
for (let i = 0; i < refLength; i++) {
let [item] = REF[`value-${i}`] || []
if (item) item.style.width = `${width}px`
}
}
})
},
filterData (list, name) {
return list?.map(i => {
return name == 'oilList' ? `${i.aliasName}*${i.amount} (${NP.times(i.amount, i.salesPrice,0.01)}积分)` : `${i.couponName}*${i.amount}`
}) || []
},
splitArray (arr, size) {
let result = [],
newArr = JSON.parse(JSON.stringify(arr))
for (let i = 0; i < newArr.length; i += size) {
result.push(newArr.slice(i, i + size))
}
return result
}
}
}
</script>
<style scoped lang='scss'>
.layout {
position: absolute;
width: 100%;
height: calc(100vh - 48px);
top: 0;
left: 0;
.box {
width: 100%;
height: calc(100% - 78px);
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;
margin-bottom: 32px;
}
.text {
padding: 0 0 20px 20px;
font-size: 14px;
color: #666666;
.label {
width: 154px;
text-align: right;
}
.value {
min-width: 232px;
.status {
width: 6px;
height: 6px;
border-radius: 4px;
background: #fdb757;
margin-right: 8px;
}
.status-1 {
background: #2cca74;
}
}
}
}
.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;
opacity: 0;
}
.is-disabled {
cursor: not-allowed;
}
}
a {
margin-left: 8px;
color: #5850ff;
font-size: 14px;
cursor: pointer;
}
}
.file-info {
height: 20px;
font-size: 14px;
color: #999999;
align-items: center;
margin-top: 10px;
.el-icon-success {
color: #67c23a;
line-height: 20px;
margin-right: 4px;
}
}
.table-box {
min-width: 864px;
max-width: calc(100vw - 446px);
background: #f9f9f9;
border-radius: 4px;
padding: 20px;
margin-top: 10px;
/deep/ .el-input {
width: 100%;
}
.flex {
display: flex;
align-items: center;
}
}
.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;
color: #333333;
}
}
}
.flex {
display: flex;
align-items: center;
}
.more-info {
white-space: nowrap;
color: #5850ff;
cursor: pointer;
}
/deep/.el-pagination__sizes {
width: 88px;
.el-select {
width: 100%;
.el-input {
width: 100%;
}
}
}
</style>
\ 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">
<span>{{ filterData(scope.scope.oilList,'oilList').slice(0, 1).join('、') }}</span>
<el-popover
placement="top"
width="fit-content"
trigger="hover"
>
<div
v-for="(item,index) in filterData(scope.scope.oilList,'oilList')"
:key="index"
>
{{item}}
</div>
<span
class="more-info"
slot="reference"
>...({{ scope.scope.oilList.length }})</span>
</el-popover>
</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">
<span>{{ filterData(scope.scope.couponList,'couponList').slice(0, 1).join('、') }}</span>
<el-popover
placement="top"
width="fit-content"
trigger="hover"
>
<div
v-for="(item,index) in filterData(scope.scope.couponList,'couponList')"
:key="index"
>
{{item}}
</div>
<span
class="more-info"
slot="reference"
>...({{ scope.scope.couponList.length }})</span>
</el-popover>
</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: 200
},
{
label: '用户姓名',
prop: 'customerName',
minWidth: 100
},
{
label: '身份证号',
minWidth: 200,
prop: 'idCardNo',
},
{
label: '用户手机号',
minWidth: 150,
prop: 'customerPhone',
},
{
label: '返现金额',
minWidth: 150,
prop: 'cashBackValue'
},
{
label: '商品兑换积分',
prop: 'buyValue',
minWidth: 150,
},
{
label: '赠送油券',
addHtml: 'oilList',
minWidth: 260,
},
{
label: '赠送自店服务',
addHtml: 'couponList',
minWidth: 260,
},
{
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.salesPrice, 0.01))
return total
}
},
]
},
}
},
mounted () {
},
methods: {
beforeSearchFn () {
return new Promise(resolve => {
this.searchForm.recordId = this.detailObj.recordId
this.loading = false
resolve()
})
},
handleClose () {
this.$emit('update:detailObj', {})
},
filterData (list, name) {
return list?.map(i => {
return name == 'oilList' ? `${i.aliasName}*${i.amount} (${NP.times(i.amount, i.salesPrice, 0.01)}积分)` : `${i.couponName}*${i.amount}`
}) || []
},
}
}
</script>
<style scoped lang='scss'>
.more-info {
white-space: nowrap;
color: #5850ff;
cursor: pointer;
}
</style>
\ 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="scope.scope.maxStock"
: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 => {
let maxStock = e.stock - e.usedStock
e.amount = 1
e.oilCouponId = e.id
e.maxStock = maxStock > 10 ? 10 : maxStock
})
// 重置分页组件
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
<template>
<GLDialog
mode="small"
title="操作结果"
:visible.sync="importObj.show"
:before-close="handleClose"
>
<template #default>
<div class="importObj-content">
<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'>
import { aToExport } from '@/common/constant'
export default {
name: '',
props: {
importObj: {
type: Object,
default: () => { }
}
},
data () {
return {
loading: false,
checked: false
}
},
mounted () {
},
methods: {
handleClose () {
this.$emit('update:importObj', {})
},
handleConfirm () {
aToExport(this.importObj.errorUrl)
this.handleClose()
}
}
}
</script>
<style scoped lang='scss'>
.importObj-content {
height: 100%;
display: flex;
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
<template>
<GLDialog
mode="big"
class="points-panel"
bigTitle="选择"
okText="提交"
@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"
:selectedGasList="configParams.oilList"
/>
<service
v-show="currentComponent == 'service'"
ref="serviceRef"
:selectedServiceList="configParams.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: () => { }
}
},
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,
salesPrice: e.salesPrice,
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>
<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="scope.scope.maxStock"
: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 { openTab } from '@/utils/index'
import selectedMixin from '../mixins/selectedMixin'
export default {
name: 'service',
mixins: [selectedMixin],
props: {
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.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
res.list.map(e => {
let maxStock = e.residueAmount
e.amount = 1
e.couponId = e.id
e.maxStock = maxStock > 10 ? 10 : maxStock
})
// 重置分页组件
this.serviceList = res.list
// this.fnCallBack = true
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 () {
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"
size="small"
>客户积分充值</el-button>
<el-button
@click="handleExport"
size="small"
>导出
</el-button>
</div>
<div class="tabelList">
<GLTable
ref="listRef"
:getListApi="getListApi"
:searchForm="tableSearchForm"
:tableParams="tableParams"
:pageConf="pageConf"
:beforeSearchFn="beforeSearchFn"
>
<template
slot="customerNumber"
slot-scope="scope"
>
<div
class="link"
@click="openDetail(scope.scope.id)"
>{{scope.scope.customerNumber}}</div>
</template>
<template
slot="totalIntegral"
slot-scope="scope"
>
<div class="totalIntegral">
{{scope.scope.totalIntegral}}
<div class="service">(含{{scope.scope.totalIntegral}}%手续费)</div>
</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-scope="scope"
>
<GLTableButton
:buttonList="tableButtonList"
:buttonItem="scope.scope"
:buttonNum="3"
></GLTableButton>
</template>
</GLTable>
</div>
<detail-dialog :detailObj.sync="detailObj" />
</div>
</template>
<script type='text/ecmascript-6'>
import detailDialog from './components/detailDialog.vue'
import * as dayjs from 'dayjs'
import { aToExport } from '@/common/constant'
export default {
name: '',
components: {
detailDialog
},
data () {
return {
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
searchForm: {
batchNo: '',
policyNo: '',
customerName: '',
customerPhone: '',
auditDate: [],
merchantId: this.$globalState.session.merchantId
},
searchFormData: [
{
label: '批次',
name: 'batchNo',
type: 'input',
maxlength: 100
},
{
label: '保单号',
name: 'policyNo',
type: 'input',
maxlength: 100
},
{
label: '用户姓名',
name: 'customerName',
type: 'input',
maxlength: 100
},
{
label: '用户手机号',
name: 'customerPhone',
type: 'input',
maxlength: 100
},
{
label: '发放时间',
name: 'auditDate',
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.points.getIntegralList,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '批次',
prop: 'batchNo',
minWidth: 100
},
{
label: '客户数量',
addHtml: 'customerNumber',
minWidth: 100
},
{
label: '充值积分总数',
minWidth: 120,
prop: 'totalIntegral',
},
{
label: '状态',
minWidth: 100,
addHtml: 'status',
},
{
label: '创建时间',
minWidth: 150,
formatter: cell => dayjs(cell.createdDate).format('YYYY/MM/DD hh:mm:ss')
},
{
label: '操作人',
prop: 'updatedBy',
minWidth: 150,
},
]
},
tableButtonList: [
{
type: 'el-button',
name: '详情',
attrs: {
type: 'text',
},
condition: row => row.status == 1,
listeners: {
click: row => this.editForm(row)
}
},
{
type: 'el-button',
name: '编辑',
attrs: {
type: 'text',
},
condition: row => row.status == 0,
listeners: {
click: row => this.editForm(row, 'edit')
}
},
],
tableSearchForm: {},
detailObj: {}
}
},
mounted () {
},
methods: {
beforeSearchFn () {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
resolve()
})
},
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.exportIntegralList({ ...params, ...this.$refs.listRef.page }).then(res => {
aToExport(res)
})
},
getParams () {
let params = JSON.parse(JSON.stringify(this.searchForm))
this.setTimeFormat(params, 'auditDate', 'auditDateBegin', 'auditDateEnd')
return params
},
setTimeFormat (target, name, start, end) {
if (target[name] && target[name].length) {
target[start] = `${dayjs(target[name][0]).format('YYYY-MM-DD')} 00:00:00`
target[end] = `${dayjs(target[name][1]).format('YYYY-MM-DD')} 23:59:59`
delete target[name]
}
},
jump () {
this.$router.push({
path: '/points/add',
query: {
$title: '客户积分充值',
}
})
},
openDetail (recordId) {
this.detailObj = {
show: true,
recordId
}
},
editForm (row, type = '') {
this.$router.push({
path: '/points/add',
query: {
$title: type ? '编辑客户积分充值' : '查看客户积分充值',
id: row.id,
type
}
})
}
}
}
</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;
}
}
.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>
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
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!