Commit 8551ebe2 by 李伟康

提交需求

1 parent 5569516d
...@@ -6457,14 +6457,16 @@ ...@@ -6457,14 +6457,16 @@
} }
}, },
"glsx-components": { "glsx-components": {
"version": "1.5.2", "version": "1.5.7",
"resolved": "https://registry.npmjs.org/glsx-components/-/glsx-components-1.5.2.tgz", "resolved": "https://registry.npmjs.org/glsx-components/-/glsx-components-1.5.7.tgz",
"integrity": "sha512-5/LaPu0B1uT7Kzl6oyIqyFT/NXIz2w7HNstiRtHaUQN1waSrPPPtzRRwywJg6CSSL+p994NaqPRnX696NAYzKg==", "integrity": "sha512-WEWt1Ev7uf8VgILrEr15ZHxOreqWEVEY2WRP5EmZKzYKTVF/7dQU/oI84+Xo4vSmlz7ltblaATyrwm1U1LDnHg==",
"requires": { "requires": {
"@amap/amap-jsapi-loader": "^1.0.1",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"element-ui": "^2.15.6", "element-ui": "^2.15.6",
"glsx-common": "^1.4.9", "glsx-common": "^1.4.9",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-amap": "^0.5.10",
"vuedraggable": "^2.24.3" "vuedraggable": "^2.24.3"
}, },
"dependencies": { "dependencies": {
...@@ -6477,16 +6479,6 @@ ...@@ -6477,16 +6479,6 @@
"md5": "^2.3.0", "md5": "^2.3.0",
"qs": "^6.10.1", "qs": "^6.10.1",
"sha1": "^1.1.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 @@ ...@@ -14,8 +14,9 @@
"echarts": "^5.4.3", "echarts": "^5.4.3",
"el-tree-transfer": "^2.2.6", "el-tree-transfer": "^2.2.6",
"glsx-common": "^2.0.4", "glsx-common": "^2.0.4",
"glsx-components": "^1.2.5", "glsx-components": "^1.5.7",
"moment": "^2.29.4", "moment": "^2.29.4",
"number-precision": "^1.6.0",
"vod-js-sdk-v6": "^1.6.2", "vod-js-sdk-v6": "^1.6.2",
"wangeditor": "^4.7.15", "wangeditor": "^4.7.15",
"word-edit": "^1.3.3" "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 \ No newline at end of file
...@@ -902,3 +902,6 @@ html { ...@@ -902,3 +902,6 @@ html {
color: #5850ff; color: #5850ff;
} }
} }
.el-message{
z-index: 9999999 !important;
}
\ No newline at end of file \ No newline at end of file
...@@ -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">
<div class="text flex"> <template v-if="pageObject.id">
<div class="item flex"> <div class="text flex">
<div class="label">批次号:</div> <div class="item flex">
<div class="value">-</div> <div class="label">批次号:</div>
</div> <div class="value">{{ pageObject.batchNo || '-' }}</div>
<div class="item flex"> </div>
<div class="label">状态:</div> <div class="item flex">
<div class="value">-</div> <div class="label">状态:</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"
...@@ -27,7 +32,10 @@ ...@@ -27,7 +32,10 @@
<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>
...@@ -37,37 +45,157 @@ ...@@ -37,37 +45,157 @@
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">
<div class="el-icon-success"></div> <template v-if="importObject.name">
文件格式正确(客户名单.xlsx) <div class="el-icon-success"></div>
文件格式正确({{ importObject.name }})
</template>
</div> </div>
<div class="table-box">
<GLTable <template v-if="importObject.detailList">
:tableData="[]" <div class="table-box">
:tableParams="tableParams" <GLTable
> :tableData="importObject.detailList"
</GLTable> :tableParams="tableParams"
<div class="total"> :hasPage="false"
<template v-for="(i,index) in totalFormData"> >
<template> <template
<div slot="cashBackValue"
:key="index" slot-scope="scope"
class="item flex" >
> <template v-if="!pageObject.disabled">
<div class="label">{{i.label}}:</div> <el-input
<div class="value"></div> v-model.number.trim="scope.scope.cashBackValue"
</div> :disabled="pageObject.disabled"
@blur="updateTotal(scope.scope, scope.index)"
></el-input>
</template>
<template v-else>
{{scope.scope.buyValue || '-'}}
</template>
</template> </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>
<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">
<template v-if="i.formatter">
{{ i.formatter(totalForm) }}
</template>
<template v-else>
{{ totalForm[i.name] }}
</template>
</div>
</div>
</template>
</template>
</div>
</div> </div>
</div> </template>
</template> </template>
</glsx-combi-form> </glsx-combi-form>
</el-scrollbar> </el-scrollbar>
...@@ -87,138 +215,360 @@ ...@@ -87,138 +215,360 @@
:configParams.sync="configParams" :configParams.sync="configParams"
@confirm="changeRowConfig" @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 pointsConfig from './components/pointsConfig.vue' import pointsConfig from './components/pointsConfig.vue'
import importErrDialog from './components/importErrDialog.vue'
let chargeObject = {
gasCardServiceCharge: 0,
passageServiceCharge: 0
}
export default { export default {
components: { components: {
pointsConfig pointsConfig,
importErrDialog
}, },
name: '', name: '',
data () { data () {
return { return {
NP,
loading: false, loading: false,
configForm: {}, rule: {
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: {
merchantId: this.$globalState.session.merchantId,
merchantName: this.$globalState.session.merchantName,
},
formData: [ formData: [
{ {
label: '导入充值人群', label: '导入充值人群',
addHtml: 'table' addHtml: '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
console.log(total, '====')
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
}, },
] ]
}, },
configParams: { configParams: {},
show: true, 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)
// } this.getMerchantCharge()
}, },
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.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)
}
},
validateField (id) {
this.$refs.fromRef.$refs.formRef.validateField(id)
},
async getMerchantCharge () {
try {
const { merchantId } = this.configForm,
res = await this.$apis.points.getMerchantCharge({ 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)
}
}, },
changeRowConfig (e) { showConfig (row, index, type = 0) {
console.log(e) 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) {
console.log(row, index, '====')
this.setRowTotal(row, index)
this.setPassageService(row, index)
this.setGasService(row, index)
} }
} }
} }
...@@ -247,9 +597,10 @@ export default { ...@@ -247,9 +597,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 {
...@@ -301,6 +652,7 @@ export default { ...@@ -301,6 +652,7 @@ export default {
} }
} }
.file-info { .file-info {
height: 32px;
font-size: 14px; font-size: 14px;
color: #999999; color: #999999;
.el-icon-success { .el-icon-success {
...@@ -314,6 +666,13 @@ export default { ...@@ -314,6 +666,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="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: '赠送油券',
addHtml: 'oilList',
minWidth: 150,
},
{
label: '赠送自店服务',
addHtml: 'couponList',
minWidth: 150,
},
{
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
...@@ -5,11 +5,31 @@ ...@@ -5,11 +5,31 @@
:tableData="serviceList" :tableData="serviceList"
:tableParams="tableParams" :tableParams="tableParams"
@refreshTable="getServiceList" @refreshTable="getServiceList"
@select="handleSelectionServiceTable" @select="handleSelectionServiceTable(...arguments, 'oilCouponId')"
@select-all="handleSelectionServiceTableAll" @select-all="handleSelectionServiceTableAll(...arguments, 'oilCouponId')"
> >
<template <template
slot="residueAmount" 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" slot-scope="scope"
> >
<el-input-number <el-input-number
...@@ -17,7 +37,8 @@ ...@@ -17,7 +37,8 @@
:min="1" :min="1"
:max="10" :max="10"
:step="1" :step="1"
v-model="scope.scope.residueAmount" v-model="scope.scope.amount"
@change="changeAmount(...arguments,scope.scope,'oilCouponId')"
></el-input-number> ></el-input-number>
</template> </template>
</GLTable> </GLTable>
...@@ -28,6 +49,12 @@ import selectedMixin from '../mixins/selectedMixin' ...@@ -28,6 +49,12 @@ import selectedMixin from '../mixins/selectedMixin'
export default { export default {
name: 'gas', name: 'gas',
mixins: [selectedMixin], mixins: [selectedMixin],
props: {
selectedGasList: {
type: Array,
default: () => []
}
},
data () { data () {
return { return {
loading: false, loading: false,
...@@ -44,57 +71,55 @@ export default { ...@@ -44,57 +71,55 @@ export default {
tableColumns: [ tableColumns: [
{ {
label: '商品图片', label: '商品图片',
prop: 'couponName', addHtml: 'gasImageSlot',
width: 180 width: 100
}, },
{ {
label: '名称', label: '名称',
prop: 'anticipatedCost', prop: 'aliasName',
formatter: cellValue => {
return (cellValue.anticipatedCost / 100).toFixed(2)
}
}, },
{ {
label: '油卡面额/元', label: '油卡面额/元',
prop: 'effectiveType', prop: 'faceValue',
}, },
{ {
label: '售价/元', label: '售价/元',
prop: 'useType', formatter: cellValue => {
return cellValue.salesPrice ? Number(cellValue.salesPrice / 100).toFixed(2) : '--'
}
}, },
{ {
label: '选择数量', label: '选择数量',
prop: 'residueAmount', addHtml: 'amount'
addHtml: 'residueAmount'
} }
] ]
}, },
selectedGasList: [], selectedList: [],
selectedList: []
} }
}, },
mounted () { mounted () {
this.selectedList = this.selectedGasList
this.getServiceList() this.getServiceList()
}, },
methods: { methods: {
getServiceList () { getServiceList () {
const { page: { pageNum, pageSize } } = this.$refs.serviceRef, const { page: { pageNum, pageSize } } = this.$refs.serviceRef,
params = { params = {
status: 2,
discountType: 7,
merchantId: this.$globalState.session.merchantId,
limitStockFlag: 2,
pageNum, pageNum,
pageSize pageSize
} }
this.loading = true this.loading = true
this.$apis.giftBag.getghDirectionalGiftListApi(params).then(res => { this.$apis.points.getOilCouponList(params).then(res => {
this.loading = false this.loading = false
res.list.map(e => {
e.amount = 1
e.oilCouponId = e.id
})
// 重置分页组件 // 重置分页组件
this.serviceList = res.list this.serviceList = res.list
// this.fnCallBack = true
this.$refs.serviceRef.tableTotal = res.total this.$refs.serviceRef.tableTotal = res.total
this.selectedPreExisting(this.selectedList, this.serviceList, 'id', this.$refs.serviceRef) this.selectedPreExisting(this.selectedList, this.serviceList, 'oilCouponId', this.$refs.serviceRef)
this.setAmount(this.selectedList, this.serviceList, 'oilCouponId')
}).finally(() => { }).finally(() => {
this.loading = false this.loading = false
}) })
...@@ -105,4 +130,16 @@ export default { ...@@ -105,4 +130,16 @@ export default {
</script> </script>
<style scoped lang='scss'> <style scoped lang='scss'>
.img {
width: 36px;
height: 36px;
// img{
// width: 100%;
// height: 100%;
// }
}
.img-plus {
width: 200px;
height: 200px;
}
</style> </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'>
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%;
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
...@@ -13,16 +13,20 @@ ...@@ -13,16 +13,20 @@
v-model="currentComponent" v-model="currentComponent"
:tabPaneList="tabPaneList" :tabPaneList="tabPaneList"
></GLTabs> ></GLTabs>
<div class="component"> <template v-if="configParams.show">
<gas <div class="component">
v-show="currentComponent == 'gas'" <gas
ref="gasRef" v-show="currentComponent == 'gas'"
/> ref="gasRef"
<service :selectedGasList="configParams.row.oilList || []"
v-show="currentComponent == 'service'" />
ref="serviceRef" <service
/> v-show="currentComponent == 'service'"
</div> ref="serviceRef"
:selectedServiceList="configParams.row.couponList || []"
/>
</div>
</template>
</GLDialog> </GLDialog>
</template> </template>
...@@ -57,24 +61,38 @@ export default { ...@@ -57,24 +61,38 @@ export default {
] ]
} }
}, },
watch: {
'configParams.show' (n) {
if (n) this.currentComponent = this.configParams.type == 1 ? 'service' : 'gas'
}
},
mounted () { mounted () {
}, },
methods: { methods: {
handleGiftClose () { handleGiftClose () {
this.$emit('update:configParams', { this.$emit('update:configParams', {})
show: false
})
}, },
handleConfirm () { handleConfirm () {
const { gasRef, serviceRef } = this.$refs const { gasRef, serviceRef } = this.$refs,
this.$emit('confirm', [...gasRef.selectedList, ...serviceRef.selectedList].map(e => { oilList = gasRef.selectedList?.map(e => {
return { return {
couponId: e.id, oilCouponId: e.oilCouponId,
couponAmount: 1, amount: e.amount,
couponAnticipatedCost: e.denomination || e.anticipatedCost || e.couponAnticipatedCost faceValue: e.faceValue,
} aliasName: e.aliasName
})) }
this.handleGiftClose() }) || [],
couponList = serviceRef.selectedList?.map(e => {
return {
couponId: e.couponId,
amount: e.amount,
couponName: e.couponName
}
}) || []
this.$emit('confirm', {
oilList,
couponList
})
} }
} }
} }
......
...@@ -46,8 +46,8 @@ ...@@ -46,8 +46,8 @@
:tableData="serviceList" :tableData="serviceList"
:tableParams="tableParams" :tableParams="tableParams"
@refreshTable="getServiceList" @refreshTable="getServiceList"
@select="handleSelectionServiceTable" @select="handleSelectionServiceTable(...arguments, 'couponId')"
@select-all="handleSelectionServiceTableAll" @select-all="handleSelectionServiceTableAll(...arguments, 'couponId')"
> >
<template <template
slot="effectiveType" slot="effectiveType"
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
<span>{{ toRestrictLabelText(scope.scope) }}</span> <span>{{ toRestrictLabelText(scope.scope) }}</span>
</template> </template>
<template <template
slot="residueAmount" slot="amount"
slot-scope="scope" slot-scope="scope"
> >
<el-input-number <el-input-number
...@@ -76,14 +76,14 @@ ...@@ -76,14 +76,14 @@
:min="1" :min="1"
:max="10" :max="10"
:step="1" :step="1"
v-model="scope.scope.residueAmount" v-model="scope.scope.amount"
@change="changeAmount(...arguments,scope.scope,'couponId')"
></el-input-number> ></el-input-number>
</template> </template>
</GLTable> </GLTable>
</div> </div>
</template> </template>
</template> </template>
</div> </div>
</template> </template>
...@@ -93,9 +93,14 @@ import selectedMixin from '../mixins/selectedMixin' ...@@ -93,9 +93,14 @@ import selectedMixin from '../mixins/selectedMixin'
export default { export default {
name: 'service', name: 'service',
mixins: [selectedMixin], mixins: [selectedMixin],
props: {
selectedServiceList: {
type: Array,
default: () => []
}
},
data () { data () {
return { return {
selectedList: [],
serviceTabList: [ serviceTabList: [
{ label: '门店服务', type: 7 }, { label: '门店服务', type: 7 },
{ label: '折扣券', type: 2 }, { label: '折扣券', type: 2 },
...@@ -139,11 +144,12 @@ export default { ...@@ -139,11 +144,12 @@ export default {
}, },
{ {
label: '选择数量', label: '选择数量',
prop: 'residueAmount', prop: 'amount',
addHtml: 'residueAmount' addHtml: 'amount'
} }
] ]
} },
selectedList: []
} }
}, },
watch: { watch: {
...@@ -176,11 +182,16 @@ export default { ...@@ -176,11 +182,16 @@ export default {
this.loading = true this.loading = true
this.$apis.giftBag.getghDirectionalGiftListApi(params).then(res => { this.$apis.giftBag.getghDirectionalGiftListApi(params).then(res => {
this.loading = false this.loading = false
res.list.map(e => {
e.amount = 1
e.couponId = e.id
})
// 重置分页组件 // 重置分页组件
this.serviceList = res.list this.serviceList = res.list
// this.fnCallBack = true // this.fnCallBack = true
this.$refs['serviceRef' + discountType][0].tableTotal = res.total this.$refs['serviceRef' + discountType][0].tableTotal = res.total
this.selectedPreExisting(this.selectedList, this.serviceList, 'id', this.$refs['serviceRef' + this.discountType][0]) this.selectedPreExisting(this.selectedList, this.serviceList, 'couponId', this.$refs['serviceRef' + this.discountType][0])
this.setAmount(this.selectedList, this.serviceList, 'couponId')
}).finally(() => { }).finally(() => {
this.loading = false this.loading = false
}) })
......
...@@ -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,54 +52,60 @@ ...@@ -35,54 +52,60 @@
:buttonItem="scope.scope" :buttonItem="scope.scope"
:buttonNum="3" :buttonNum="3"
></GLTableButton> ></GLTableButton>
</span> </template>
</GLTable> </GLTable>
</div> </div>
<detail-dialog :detailObj.sync="detailObj" />
</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 { aToExport } from '@/common/constant'
export default { export default {
name: '', name: '',
components: {
detailDialog
},
data () { data () {
return { return {
url, pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
searchForm: { searchForm: {
merchantName: '', batchNo: '',
merchantId: '', policyNo: '',
staffName: '' customerName: '',
customerPhone: '',
createdDate: []
}, },
searchFormData: [ searchFormData: [
{ {
label: '批次', label: '批次',
name: 'activityName', name: 'batchNo',
type: 'input', type: 'input',
maxlength: 100 maxlength: 100
}, },
{ {
label: '保单号', label: '保单号',
name: 'merchantName', name: 'policyNo',
type: 'input', type: 'input',
maxlength: 100 maxlength: 100
}, },
{ {
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: 100
}, },
{ {
label: '发放时间', label: '发放时间',
name: 'showTime', name: 'createdDate',
type: 'datePicker', type: 'datePicker',
valueFormat: 'yyyy-MM-dd', valueFormat: 'yyyy-MM-dd',
isClear: true, isClear: true,
...@@ -97,44 +120,40 @@ export default { ...@@ -97,44 +120,40 @@ export default {
} }
}, },
], ],
getListApi: this.$apis.activity.activityPageList, getListApi: this.$apis.points.getIntegralList,
tableParams: { tableParams: {
listName: 'data', listName: 'list',
tableOption: true, tableOption: true,
tableColumns: [ tableColumns: [
{ {
label: '批次', label: '批次',
prop: 'wechatName', prop: 'batchNo',
minWidth: 100 minWidth: 100
}, },
{ {
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: 100,
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: 'createdBy',
minWidth: 150, minWidth: 150,
formatter: cell => {
// 0:随机红包;1:九宫格;2:翻牌;3:大转盘;
return { 0: '随机红包', 1: '九宫格', 2: '翻牌', 3: '大转盘' }[cell.activityType]
}
}, },
] ]
}, },
...@@ -145,6 +164,7 @@ export default { ...@@ -145,6 +164,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)
} }
...@@ -155,14 +175,14 @@ export default { ...@@ -155,14 +175,14 @@ 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, tableSearchForm: {},
tableSearchForm: {} detailObj: {}
} }
}, },
mounted () { mounted () {
...@@ -178,27 +198,21 @@ export default { ...@@ -178,27 +198,21 @@ 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) 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');
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({
...@@ -207,6 +221,22 @@ export default { ...@@ -207,6 +221,22 @@ export default {
$title: '客户积分充值', $title: '客户积分充值',
} }
}) })
},
openDetail (batchNo) {
this.detailObj = {
show: true,
batchNo
}
},
editForm (row, type = '') {
this.$router.push({
path: '/points/add',
query: {
$title: type ? '编辑客户积分充值' : '查看客户积分充值',
id: row.id,
type
}
})
} }
} }
...@@ -228,9 +258,27 @@ export default { ...@@ -228,9 +258,27 @@ export default {
.el-button { .el-button {
min-width: 60px; min-width: 60px;
} }
.el-button+.el-button{ .el-button + .el-button {
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 { export default {
methods: { methods: {
handleSelectionServiceTable (selection, row) { handleSelectionServiceTable (selection, row, id) {
if (selection && selection.find(item => item && item.id == row.id)) { if (selection && selection.find(item => item && item[id] == row[id])) {
this.addRows(this.selectedList, [row], 'id') this.addRows(this.selectedList, [row], id)
} else { } else {
this.selectedList = this.deleteRows(this.selectedList, [row], 'id') this.selectedList = this.deleteRows(this.selectedList, [row], id)
} }
}, },
handleSelectionServiceTableAll (selected) { handleSelectionServiceTableAll (selected, id) {
if (selected.length > 0) { if (selected.length > 0) {
this.addRows(this.selectedList, selected, 'id') this.addRows(this.selectedList, selected, id)
} else { } else {
this.selectedList = this.deleteRows(this.selectedList, this.serviceList, 'id') this.selectedList = this.deleteRows(this.selectedList, this.serviceList, id)
} }
}, },
//添加选中 //添加选中
...@@ -38,7 +38,7 @@ export default { ...@@ -38,7 +38,7 @@ export default {
//选中table已有数据 //选中table已有数据
selectedPreExisting (rows, list, val, refTabel) { selectedPreExisting (rows, list, val, refTabel) {
refTabel.$refs['listMutiTable'].clearSelection() refTabel.$refs['listMutiTable'].clearSelection()
if (rows?.length > 0) { if (rows?.length) {
//这里使用this.$nextTick是防止表格未渲染完成就执行,导致无法添加选中效果 //这里使用this.$nextTick是防止表格未渲染完成就执行,导致无法添加选中效果
this.$nextTick(() => { this.$nextTick(() => {
rows.forEach(row => { rows.forEach(row => {
...@@ -54,5 +54,22 @@ export default { ...@@ -54,5 +54,22 @@ export default {
refTabel.$refs['listMutiTable'].clearSelection() 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!