Commit d0dfde16 by chenwq

格式化

1 parent 2a3a0053
<template> <template>
<div <div class="layout" v-loading="loading">
class="layout"
v-loading="loading"
>
<div class="content"> <div class="content">
<div class="title">积分充值</div> <div class="title">积分充值</div>
<el-scrollbar class="box"> <el-scrollbar class="box">
...@@ -21,59 +18,30 @@ ...@@ -21,59 +18,30 @@
</div> </div>
</div> </div>
</template> </template>
<glsx-combi-form <glsx-combi-form ref="fromRef" :isEdit="true" :isBlock="true" :formObj="configForm" :formData="formData" :formRules="rule">
ref="fromRef"
:isEdit="true"
:isBlock="true"
:formObj="configForm"
:formData="formData"
:formRules="rule"
>
<template #merchantId> <template #merchantId>
<div class="upload"> <div class="upload">
<div class="upload-btn"> <div class="upload-btn">
<el-button <el-button size="small" @click="relateStoreVisible = true" :disabled="pageObject.id">
size="small"
@click="relateStoreVisible = true"
:disabled="pageObject.id"
>
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
选择商户 选择商户
</el-button> </el-button>
</div> </div>
</div> </div>
<template v-if="configForm.merchantId"> <template v-if="configForm.merchantId">
<GLTable <GLTable :tableData="[configForm]" :tableParams="merchantParams" :hasPage="false" class="merchant-box"></GLTable>
:tableData="[configForm]"
:tableParams="merchantParams"
:hasPage="false"
class="merchant-box"
></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 <el-button size="small" :disabled="pageObject.disabled">
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" ref="file" accept=".xlsx, .xlc, .xlm, .xls" @change="uploadFile" :disabled="pageObject.disabled" :class="['input',{'is-disabled':pageObject.disabled}]" />
type="file"
ref="file"
accept=".xlsx, .xlc, .xlm, .xls"
@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" target="_blank">下载模板</a>
href="https://img01.glsx.com.cn/weapp/resource/saas/scrm/xlsx/客户积分导入模板.xlsx"
target="_blank"
>下载模板</a>
</div> </div>
<template v-if="importObject.detailList"> <template v-if="importObject.detailList">
<template v-if="importObject.name"> <template v-if="importObject.name">
...@@ -84,125 +52,65 @@ ...@@ -84,125 +52,65 @@
</template> </template>
<div class="table-box"> <div class="table-box">
<div class="table"> <div class="table">
<GLTable <GLTable :tableData="importObject.detailList[pageNum - 1]" :tableParams="tableParams" ref="listRef" :pageConf="pageConf" :tableTotal="totalForm.customerTotal" :pageSizes="[50]" @refreshTable="refreshTable">
:tableData="importObject.detailList[pageNum - 1]" <template slot="cashBackValue" slot-scope="scope">
:tableParams="tableParams"
ref="listRef"
:pageConf="pageConf"
:tableTotal="totalForm.customerTotal"
:pageSizes="[50]"
@refreshTable="refreshTable"
>
<template
slot="cashBackValue"
slot-scope="scope"
>
<template v-if="!pageObject.disabled"> <template v-if="!pageObject.disabled">
<el-input <el-input v-model.number.trim="scope.scope.cashBackValue" @blur="updateTotal(scope.scope, scope.index, 'cashBackValue')" maxLength="6"></el-input>
v-model.number.trim="scope.scope.cashBackValue"
@blur="updateTotal(scope.scope, scope.index, 'cashBackValue')"
maxLength="6"
></el-input>
</template> </template>
<template v-else> <template v-else>
{{scope.scope.cashBackValue || '-'}} {{scope.scope.cashBackValue || '-'}}
</template> </template>
</template> </template>
<template <template slot="buyValue" slot-scope="scope">
slot="buyValue"
slot-scope="scope"
>
<template v-if="!pageObject.disabled"> <template v-if="!pageObject.disabled">
<el-input <el-input v-model.number.trim="scope.scope.buyValue" @blur="updateTotal(scope.scope, scope.index,'buyValue')" maxLength="6"></el-input>
v-model.number.trim="scope.scope.buyValue"
@blur="updateTotal(scope.scope, scope.index,'buyValue')"
maxLength="6"
></el-input>
</template> </template>
<template v-else> <template v-else>
{{scope.scope.buyValue || '-'}} {{scope.scope.buyValue || '-'}}
</template> </template>
</template> </template>
<template <template slot="oilList" slot-scope="scope">
slot="oilList"
slot-scope="scope"
>
<template v-if="scope.scope.oilList && scope.scope.oilList.length"> <template v-if="scope.scope.oilList && scope.scope.oilList.length">
<div class="flex"> <div class="flex">
<span>{{ filterData(scope.scope.oilList,'oilList').slice(0, 1).join('、') }}</span> <span>{{ filterData(scope.scope.oilList,'oilList').slice(0, 1).join('、') }}</span>
<el-popover <el-popover placement="top" width="fit-content" trigger="hover">
placement="top" <div v-for="(item,index) in filterData(scope.scope.oilList,'oilList')" :key="index">
width="fit-content"
trigger="hover"
>
<div
v-for="(item,index) in filterData(scope.scope.oilList,'oilList')"
:key="index"
>
{{item}} {{item}}
</div> </div>
<span <span class="more-info" slot="reference">...({{ scope.scope.oilList.length }})</span>
class="more-info"
slot="reference"
>...({{ scope.scope.oilList.length }})</span>
</el-popover> </el-popover>
<template v-if="!pageObject.disabled"> <template v-if="!pageObject.disabled">
<el-button <el-button type="text" @click="showConfig(scope.scope, scope.index)">编辑</el-button>
type="text"
@click="showConfig(scope.scope, scope.index)"
>编辑</el-button>
</template> </template>
</div> </div>
</template> </template>
<template v-else> <template v-else>
<template v-if="!pageObject.disabled"> <template v-if="!pageObject.disabled">
<el-button <el-button type="text" @click="showConfig(scope.scope, scope.index)">配置</el-button>
type="text"
@click="showConfig(scope.scope, scope.index)"
>配置</el-button>
</template> </template>
<template v-else> <template v-else>
无 无
</template> </template>
</template> </template>
</template> </template>
<template <template slot="couponList" slot-scope="scope">
slot="couponList"
slot-scope="scope"
>
<template v-if="scope.scope.couponList && scope.scope.couponList.length"> <template v-if="scope.scope.couponList && scope.scope.couponList.length">
<div class="flex"> <div class="flex">
<span>{{ filterData(scope.scope.couponList,'couponList').slice(0, 1).join('、') }}</span> <span>{{ filterData(scope.scope.couponList,'couponList').slice(0, 1).join('、') }}</span>
<el-popover <el-popover placement="top" width="fit-content" trigger="hover">
placement="top" <div v-for="(item,index) in filterData(scope.scope.couponList,'couponList')" :key="index">
width="fit-content"
trigger="hover"
>
<div
v-for="(item,index) in filterData(scope.scope.couponList,'couponList')"
:key="index"
>
{{item}} {{item}}
</div> </div>
<span <span class="more-info" slot="reference">...({{ scope.scope.couponList.length }})</span>
class="more-info"
slot="reference"
>...({{ scope.scope.couponList.length }})</span>
</el-popover> </el-popover>
<template v-if="!pageObject.disabled"> <template v-if="!pageObject.disabled">
<el-button <el-button type="text" @click="showConfig(scope.scope, scope.index, 1)">编辑</el-button>
type="text"
@click="showConfig(scope.scope, scope.index, 1)"
>编辑</el-button>
</template> </template>
</div> </div>
</template> </template>
<template v-else> <template v-else>
<template v-if="!pageObject.disabled"> <template v-if="!pageObject.disabled">
<el-button <el-button type="text" @click="showConfig(scope.scope, scope.index, 1)">配置</el-button>
type="text"
@click="showConfig(scope.scope, scope.index, 1)"
>配置</el-button>
</template> </template>
<template v-else> <template v-else>
无 无
...@@ -211,21 +119,12 @@ ...@@ -211,21 +119,12 @@
</template> </template>
</GLTable> </GLTable>
</div> </div>
<div <div class="total" :key="totalKey">
class="total"
:key="totalKey"
>
<template v-for="(i, index) in totalFormData"> <template v-for="(i, index) in totalFormData">
<template> <template>
<div <div :key="index" class="item flex">
:key="index"
class="item flex"
>
<div class="label">{{ i.label }}:</div> <div class="label">{{ i.label }}:</div>
<div <div class="value" :ref="`value-${index}`">
class="value"
:ref="`value-${index}`"
>
<template v-if="i.formatter"> <template v-if="i.formatter">
{{ i.formatter(totalForm) }} {{ i.formatter(totalForm) }}
</template> </template>
...@@ -244,30 +143,12 @@ ...@@ -244,30 +143,12 @@
</el-scrollbar> </el-scrollbar>
</div> </div>
<GLFooter class="footer"> <GLFooter class="footer">
<el-button <el-button @click="$router.go(-1)" size="medium">取消</el-button>
@click="$router.go(-1)" <el-button v-if="!isWatchPage" type="primary" @click="handleConfirm" size="medium">确定</el-button>
size="medium"
>取消</el-button>
<el-button
v-if="!isWatchPage"
type="primary"
@click="handleConfirm"
size="medium"
>确定</el-button>
</GLFooter> </GLFooter>
<select-store <select-store :dialogVisible.sync="relateStoreVisible" :storeSelected="selectedList" :merchantInfo="configForm" @handleRelateStoreConfirm="handleRelateStoreConfirm" @handleRelateStoreClose="handleRelateStoreClose" />
:dialogVisible.sync="relateStoreVisible" <points-config :configParams.sync="configParams" :merchantId="configForm.merchantId" @confirm="changeRowConfig" />
:storeSelected="selectedList"
:merchantInfo="configForm"
@handleRelateStoreConfirm="handleRelateStoreConfirm"
@handleRelateStoreClose="handleRelateStoreClose"
/>
<points-config
:configParams.sync="configParams"
:merchantId="configForm.merchantId"
@confirm="changeRowConfig"
/>
<import-err-dialog :importObj.sync="importObj" /> <import-err-dialog :importObj.sync="importObj" />
</div> </div>
...@@ -292,7 +173,7 @@ export default { ...@@ -292,7 +173,7 @@ export default {
importErrDialog importErrDialog
}, },
name: '', name: '',
data () { data() {
return { return {
NP, NP,
loading: false, loading: false,
...@@ -461,19 +342,19 @@ export default { ...@@ -461,19 +342,19 @@ export default {
passageServiceCharge: 0 passageServiceCharge: 0
}, },
pageNum: 1, pageNum: 1,
isWatchPage:false isWatchPage: false
} }
}, },
mounted () { mounted() {
const { id, type } = this.$route.query const { id, type } = this.$route.query
if (id) this.getDetail(id, type) if (id) this.getDetail(id, type)
this.isWatchPage = !type this.isWatchPage = !type
}, },
methods: { methods: {
refreshTable ({ pageNum }) { refreshTable({ pageNum }) {
this.pageNum = pageNum this.pageNum = pageNum
}, },
async getDetail (id, type) { async getDetail(id, type) {
try { try {
this.loading = true this.loading = true
const res = await this.$apis.points.getIntegralDetail({ id }), const res = await this.$apis.points.getIntegralDetail({ id }),
...@@ -509,7 +390,7 @@ export default { ...@@ -509,7 +390,7 @@ export default {
setTimeout(() => this.$router.go(-1), 1e3) setTimeout(() => this.$router.go(-1), 1e3)
} }
}, },
handleConfirm () { handleConfirm() {
const { disabled, id } = this.pageObject const { disabled, id } = this.pageObject
if (disabled) return this.$router.go(-1) if (disabled) return this.$router.go(-1)
this.$refs.fromRef.$refs.formRef.validate(async valid => { this.$refs.fromRef.$refs.formRef.validate(async valid => {
...@@ -571,7 +452,7 @@ export default { ...@@ -571,7 +452,7 @@ export default {
} }
}) })
}, },
async uploadFile (e) { async uploadFile(e) {
try { try {
const [file] = e.srcElement.files const [file] = e.srcElement.files
if (!file) return if (!file) return
...@@ -625,7 +506,7 @@ export default { ...@@ -625,7 +506,7 @@ export default {
if (error) this.$message.error(error) if (error) this.$message.error(error)
} }
}, },
setTableHeight (detailList = []) { setTableHeight(detailList = []) {
const { listRef } = this.$refs const { listRef } = this.$refs
if (listRef) { if (listRef) {
let length = detailList.length let length = detailList.length
...@@ -636,13 +517,13 @@ export default { ...@@ -636,13 +517,13 @@ export default {
}, },
// 选择门店 // 选择门店
handleRelateStoreClose () { handleRelateStoreClose() {
this.relateStoreVisible = false this.relateStoreVisible = false
}, },
validateField (id) { validateField(id) {
this.$refs.fromRef.$refs.formRef.validateField(id) this.$refs.fromRef.$refs.formRef.validateField(id)
}, },
async handleRelateStoreConfirm (selectedData, isEdit) { async handleRelateStoreConfirm(selectedData, isEdit) {
selectedData.merchantId && (this.$set(this.configForm, 'merchantId', selectedData.merchantId)) selectedData.merchantId && (this.$set(this.configForm, 'merchantId', selectedData.merchantId))
selectedData.merchantName && (this.$set(this.configForm, 'merchantName', selectedData.merchantName)) selectedData.merchantName && (this.$set(this.configForm, 'merchantName', selectedData.merchantName))
this.validateField('merchantId') this.validateField('merchantId')
...@@ -665,7 +546,7 @@ export default { ...@@ -665,7 +546,7 @@ export default {
} }
}, },
showConfig (row, index, type = 0) { showConfig(row, index, type = 0) {
this.configParams = { this.configParams = {
show: true, show: true,
row, row,
...@@ -675,7 +556,7 @@ export default { ...@@ -675,7 +556,7 @@ export default {
couponList: JSON.parse(JSON.stringify(row.couponList || [])), couponList: JSON.parse(JSON.stringify(row.couponList || [])),
} }
}, },
setRowTotal (row, index) { setRowTotal(row, index) {
const { oilList, cashBackValue, buyValue } = row const { oilList, cashBackValue, buyValue } = row
let total = NP.plus((cashBackValue || 0), (buyValue || 0)) let total = NP.plus((cashBackValue || 0), (buyValue || 0))
oilList && oilList.map(i => total += NP.times((i.amount || 0), (i.salesPrice || 0), 0.01)) oilList && oilList.map(i => total += NP.times((i.amount || 0), (i.salesPrice || 0), 0.01))
...@@ -683,7 +564,7 @@ export default { ...@@ -683,7 +564,7 @@ export default {
this.totalForm.total[index] = total this.totalForm.total[index] = total
this.updateView() this.updateView()
}, },
changeRowConfig ({ changeRowConfig({
oilList, oilList,
couponList couponList
}) { }) {
...@@ -696,13 +577,13 @@ export default { ...@@ -696,13 +577,13 @@ export default {
this.setGasService(row, index) this.setGasService(row, index)
} }
}, },
setPassageService (row, index) { setPassageService(row, index) {
const { cashBackValue, buyValue } = row, const { cashBackValue, buyValue } = row,
passageService = NP.plus((cashBackValue || 0), (buyValue || 0)) passageService = NP.plus((cashBackValue || 0), (buyValue || 0))
this.totalForm.passageService[index] = passageService this.totalForm.passageService[index] = passageService
this.updateView() this.updateView()
}, },
setGasService (row, index) { setGasService(row, index) {
const { oilList } = row const { oilList } = row
let total = 0 let total = 0
if (oilList && oilList.length) oilList.map(i => { if (oilList && oilList.length) oilList.map(i => {
...@@ -711,13 +592,13 @@ export default { ...@@ -711,13 +592,13 @@ export default {
this.totalForm.gasService[index] = total this.totalForm.gasService[index] = total
this.updateView() this.updateView()
}, },
updateTotal (row, index, key) { updateTotal(row, index, key) {
if (key && !/^[0-9]\d*$/.test(row[key])) row[key] = '' if (key && !/^[0-9]\d*$/.test(row[key])) row[key] = ''
this.setRowTotal(row, index) this.setRowTotal(row, index)
this.setPassageService(row, index) this.setPassageService(row, index)
this.setGasService(row, index) this.setGasService(row, index)
}, },
updateView () { updateView() {
this.totalKey = Date.now() this.totalKey = Date.now()
const REF = this.$refs, const REF = this.$refs,
refLength = this.totalFormData.length refLength = this.totalFormData.length
...@@ -736,12 +617,12 @@ export default { ...@@ -736,12 +617,12 @@ export default {
} }
}) })
}, },
filterData (list, name) { filterData(list, name) {
return list?.map(i => { return list?.map(i => {
return name == 'oilList' ? `${i.aliasName}*${i.amount} (${NP.times(i.amount, i.salesPrice, 0.01)}积分)` : `${i.couponName}*${i.amount}` return name == 'oilList' ? `${i.aliasName}*${i.amount} (${NP.times(i.amount, i.salesPrice, 0.01)}积分)` : `${i.couponName}*${i.amount}`
}) || [] }) || []
}, },
splitArray (arr, size) { splitArray(arr, size) {
let result = [], let result = [],
newArr = JSON.parse(JSON.stringify(arr)) newArr = JSON.parse(JSON.stringify(arr))
for (let i = 0; i < newArr.length; i += size) { for (let i = 0; i < newArr.length; i += size) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!