|
|
<template>
|
|
|
<div>
|
|
|
<el-form inline lable-width="100px" :modal="memberForm">
|
|
|
<el-form-item label="手机号码:">
|
|
|
<div class="form-width text-cyan flex justify-start align-center">
|
|
|
<!-- @blur="inputMember" -->
|
|
|
<el-input
|
|
|
maxlength="11"
|
|
|
v-model="memberForm.mobilePhone"
|
|
|
@change="inputMember"
|
|
|
style="height:100%;"
|
|
|
>
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
slot="append"
|
|
|
maxlength="11"
|
|
|
icon="el-icon-search"
|
|
|
@click="openMember"
|
|
|
style="height: 100%;"
|
|
|
></el-button>
|
|
|
</el-input>
|
|
|
<el-button
|
|
|
icon="el-icon-circle-plus-outline"
|
|
|
type="text"
|
|
|
@click="openAddMember"
|
|
|
style="height: 100%;"
|
|
|
></el-button>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
<el-form-item :label="cashNumber == 1 ? '会员名字' : '散客名字'">
|
|
|
<div class="form-width-sm text-cyan">
|
|
|
<el-input v-model="memberForm.memberName" style="height: 100%;">
|
|
|
<el-button
|
|
|
style="height: 100%;"
|
|
|
title="切换"
|
|
|
size="mini"
|
|
|
slot="append"
|
|
|
icon="el-icon-sort"
|
|
|
@click="changeMember()"
|
|
|
></el-button>
|
|
|
</el-input>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="性别">
|
|
|
<div class="text-bold flex justify-start align-center text-xss" style="height: 100%;">
|
|
|
男:
|
|
|
<el-input
|
|
|
style="height:100%;"
|
|
|
class="form-width-xss"
|
|
|
v-model="memberForm.manNumber"
|
|
|
type="number"
|
|
|
></el-input>
|
|
|
女:
|
|
|
<el-input
|
|
|
style="height:100%;"
|
|
|
class="form-width-xss"
|
|
|
v-model="memberForm.womanNumber"
|
|
|
type="number"
|
|
|
></el-input>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
<el-form-item
|
|
|
label="会员积分"
|
|
|
v-if="cashNumber == 1 && memberForm.integral > 0 && memberIntegral"
|
|
|
>
|
|
|
<div class="text-cyan">
|
|
|
{{ memberForm.integral }}
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
<el-form-item
|
|
|
label="以往欠款"
|
|
|
v-if="cashNumber == 1 && memberForm.debtMoney > 0"
|
|
|
>
|
|
|
<div class="form-width-sm text-red text-price ">
|
|
|
{{ memberForm.debtMoney }}
|
|
|
<el-button type="text" @click="goPayDebt">去还款</el-button>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
<el-popover
|
|
|
placement="bottom"
|
|
|
width="800"
|
|
|
trigger="hover"
|
|
|
v-if="cashNumber == 1"
|
|
|
>
|
|
|
<reccard ref="reccard" @reccardData="reccardData"></reccard>
|
|
|
<el-button slot="reference" style="height: 0.2rem;">充值卡</el-button>
|
|
|
</el-popover>
|
|
|
<el-popover
|
|
|
placement="bottom"
|
|
|
width="700"
|
|
|
trigger="hover"
|
|
|
v-if="cashNumber == 1"
|
|
|
>
|
|
|
<course ref="course" @courseData="courseData"></course>
|
|
|
<el-button slot="reference" style="height: 0.2rem;">项目包</el-button>
|
|
|
</el-popover>
|
|
|
<el-button v-if="cashNumber ===1 " @click="updataPassword" style="height: 0.2rem;">密码修改</el-button>
|
|
|
<el-button v-if="cashNumber ===1 " @click="vipShow" style="height: 0.2rem;">会员明细</el-button>
|
|
|
<el-form-item label="补单日期:" v-if="isAddition == 1">
|
|
|
<div class="activeFormDiv">
|
|
|
<el-date-picker
|
|
|
v-model="additionDate"
|
|
|
type="date"
|
|
|
:picker-options="pickerOptions"
|
|
|
format="yyyy-MM-dd"
|
|
|
placeholder="选择日期"
|
|
|
>
|
|
|
</el-date-picker>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div>
|
|
|
<div style="margin-bottom:20px">
|
|
|
<el-table
|
|
|
style="margin-top:3px;"
|
|
|
:data="list"
|
|
|
max-height="650"
|
|
|
ref="list"
|
|
|
@row-click="rowClick"
|
|
|
:row-class-name="rowClassName"
|
|
|
:row-key="getRowKeys"
|
|
|
@expand-change="expandSelect"
|
|
|
:expand-row-keys="expand"
|
|
|
stripe
|
|
|
:header-cell-style="{
|
|
|
background: 'linear-gradient(#6cb3ff, #1873d4)',
|
|
|
color: '#eeeeee'
|
|
|
}"
|
|
|
>
|
|
|
<el-table-column
|
|
|
show-overflow-tooltip
|
|
|
min-width="130"
|
|
|
align="center"
|
|
|
label="项目选项"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<div class="flex justify-between align-center" @click.stop="">
|
|
|
<el-input
|
|
|
v-model="scope.row.projectNum"
|
|
|
placeholder="编码"
|
|
|
@change="proBlur(scope.row, (proIndex = scope.$index))"
|
|
|
>
|
|
|
<el-button
|
|
|
title="门店项目"
|
|
|
size="mini"
|
|
|
slot="append"
|
|
|
icon="el-icon-tickets"
|
|
|
@click.stop="openPro((proIndex = scope.$index))"
|
|
|
></el-button>
|
|
|
</el-input>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
show-overflow-tooltip
|
|
|
min-width="110"
|
|
|
align="center"
|
|
|
prop="projectName"
|
|
|
label="项目名称"
|
|
|
>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
align="center"
|
|
|
prop="noDiscount"
|
|
|
label="卡付打折"
|
|
|
width="70"
|
|
|
>
|
|
|
<template slot-scope="scope">{{
|
|
|
scope.row.noDiscount == 0
|
|
|
? "是"
|
|
|
: scope.row.noDiscount == 1
|
|
|
? "否"
|
|
|
: "未设"
|
|
|
}}</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
show-overflow-tooltip
|
|
|
min-width="70"
|
|
|
align="center"
|
|
|
prop=""
|
|
|
label="支付类型"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<div v-if="scope.row.courseAccountId">
|
|
|
疗程付
|
|
|
</div>
|
|
|
<div v-else>
|
|
|
<div v-if="cashNumber ==1">
|
|
|
<div v-if=" scope.row.transactionPrice!=0">
|
|
|
<div>现付/卡付</div>
|
|
|
<!-- <el-radio v-model="scope.row.radio" label="1" @input="radioInput(scope.row)">现付</el-radio>
|
|
|
<el-radio v-model="scope.row.radio" label="2" @input="radioInput(scope.row)">卡付</el-radio> -->
|
|
|
</div>
|
|
|
<div v-else>现付</div>
|
|
|
</div>
|
|
|
<div v-else>现付</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
show-overflow-tooltip
|
|
|
min-width="100"
|
|
|
align="center"
|
|
|
prop="transactionPrice"
|
|
|
label="项目金额"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<div
|
|
|
@click.stop="transactionPrice = scope.row.transactionPrice"
|
|
|
v-if="scope.row.courseAccountId == null"
|
|
|
>
|
|
|
<el-input
|
|
|
@focus="transactionPrice = scope.row.transactionPrice"
|
|
|
type="number"
|
|
|
v-model="scope.row.transactionPrice"
|
|
|
@blur="endEditMoney(scope.row)"
|
|
|
placeholder="¥"
|
|
|
></el-input>
|
|
|
</div>
|
|
|
<div v-else>{{ scope.row.transactionPrice }}</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
show-overflow-tooltip
|
|
|
min-width="80"
|
|
|
align="center"
|
|
|
prop=""
|
|
|
label="充值卡付"
|
|
|
>
|
|
|
<template slot-scope="props">
|
|
|
<div v-if="props.row.isCardPay == 0">
|
|
|
<div
|
|
|
@click.stop="projectindex(props.$index)"
|
|
|
>
|
|
|
<el-popover
|
|
|
placement="bottom"
|
|
|
width="900"
|
|
|
@show="openRec(props.row,props.$index)"
|
|
|
v-model='props.row.popover'
|
|
|
>
|
|
|
<div v-if="props.row.courseAccountId == null">
|
|
|
<el-table
|
|
|
class=" border"
|
|
|
v-if="props.row.cashNumber == 1"
|
|
|
style="max-width:900px"
|
|
|
:data="props.row.rechargeAccountList"
|
|
|
:summary-method="getSummaries"
|
|
|
show-summary
|
|
|
max-height="400"
|
|
|
:header-cell-style="{
|
|
|
background: 'linear-gradient(#6cb3ff, #1873d4)',
|
|
|
color: '#eeeeee'
|
|
|
}"
|
|
|
>
|
|
|
<el-table-column
|
|
|
align="center"
|
|
|
prop="rechargeTypeName"
|
|
|
show-overflow-tooltip
|
|
|
label="卡付名称"
|
|
|
width="110"
|
|
|
></el-table-column>
|
|
|
<el-table-column align="center" label="类别" width="60">
|
|
|
<template slot-scope="scope">
|
|
|
<span v-if="scope.row.type == 1">折扣卡</span>
|
|
|
<span v-if="scope.row.type == 0">赠送卡</span>
|
|
|
<span v-if="scope.row.type == 2">活动卡</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
show-overflow-tooltip
|
|
|
min-width="70"
|
|
|
align="center"
|
|
|
prop="discount"
|
|
|
label="折扣(%)"
|
|
|
></el-table-column>
|
|
|
<el-table-column
|
|
|
align="center"
|
|
|
prop="spendMoney"
|
|
|
label="本次支付"
|
|
|
width="90"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<div
|
|
|
class="form-input-width"
|
|
|
v-if="recIndex != scope.$index"
|
|
|
@click="editcard(scope.row, scope.$index)"
|
|
|
>
|
|
|
{{ scope.row.spendMoney }}
|
|
|
<i class="text-cyan el-icon-edit"></i>
|
|
|
</div>
|
|
|
<!-- :disabled="scope.row.cardOvers == 0" -->
|
|
|
<el-input
|
|
|
v-else
|
|
|
v-focus
|
|
|
type="number"
|
|
|
size="samll"
|
|
|
class="form-input-width"
|
|
|
@blur="endEditcard(scope.row, scope.$index)"
|
|
|
v-model="scope.row.spendMoney"
|
|
|
></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
align="center"
|
|
|
prop="cardOvers"
|
|
|
label="可用余额"
|
|
|
width="70"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
{{ scope.row.cardOvers.toFixed(2) }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
align="center"
|
|
|
prop="giftConsumeMoney"
|
|
|
label="赠送可用"
|
|
|
width="70"
|
|
|
></el-table-column>
|
|
|
<el-table-column
|
|
|
show-overflow-tooltip
|
|
|
min-width="70"
|
|
|
align="center"
|
|
|
prop="discountFreeAmount"
|
|
|
label="折扣(%)"
|
|
|
></el-table-column>
|
|
|
<el-table-column
|
|
|
align="center"
|
|
|
prop="giftSpendMoney"
|
|
|
label="赠送支付"
|
|
|
width="70"
|
|
|
></el-table-column>
|
|
|
<el-table-column
|
|
|
align="center"
|
|
|
prop="cardGiftOvers"
|
|
|
label="赠送剩余"
|
|
|
width="70"
|
|
|
></el-table-column>
|
|
|
<el-table-column
|
|
|
align="center"
|
|
|
prop="storeName"
|
|
|
label="所属门店"
|
|
|
width="110"
|
|
|
show-overflow-tooltip
|
|
|
>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
<el-button slot="reference" >充值卡</el-button>
|
|
|
</el-popover>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div v-else>不允许卡付</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
show-overflow-tooltip
|
|
|
min-width="100"
|
|
|
align="center"
|
|
|
prop="collectionAmounts"
|
|
|
label="卡付抵扣金额"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<span>
|
|
|
{{ scope.row.collectionAmounts?scope.row.collectionAmounts:0 }}
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
show-overflow-tooltip
|
|
|
min-width="80"
|
|
|
align="center"
|
|
|
prop="collectionRechargeAmount"
|
|
|
label="卡付金额"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<span>
|
|
|
{{ scope.row.collectionRechargeAmount?scope.row.collectionRechargeAmount:0 }}
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
show-overflow-tooltip
|
|
|
width="100"
|
|
|
align="center"
|
|
|
prop="sex"
|
|
|
label="性别"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<el-select v-model="scope.row.sex" placeholder="">
|
|
|
<el-option label="男" :value="0"></el-option>
|
|
|
<el-option label="女" :value="1"></el-option>
|
|
|
</el-select>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="美发师" align="center" min-width="150">
|
|
|
<template slot-scope="scope">
|
|
|
<div class="flex align-center form-width-m">
|
|
|
<el-select
|
|
|
filterable
|
|
|
default-first-option
|
|
|
clearable
|
|
|
@clear="clear(scope.row, 'zhonggongList')"
|
|
|
v-model="scope.row.zhonggongLists"
|
|
|
placeholder="请选择"
|
|
|
:ref="'zhonggongList'+scope.$index"
|
|
|
@keyup.enter.native="selectBlur(scope.row.zhonggongLists,'zhonggongList',scope.$index)"
|
|
|
@change="
|
|
|
handleChange($event, scope.row, 'zhonggongList',scope.$index)
|
|
|
"
|
|
|
style="width:110px"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="(item, index) in options"
|
|
|
:key="index"
|
|
|
:label="item.label"
|
|
|
:value="item.id"
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
<div
|
|
|
class="el-icon-edit-outline text-xs text-cyan"
|
|
|
@click.stop="
|
|
|
openStaffRatio(
|
|
|
scope.row,
|
|
|
scope.$index,
|
|
|
'zhonggongList'
|
|
|
)
|
|
|
"
|
|
|
></div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="美容师" align="center" min-width="150">
|
|
|
<template slot-scope="scope">
|
|
|
<div class="flex align-center form-width-m">
|
|
|
<el-select
|
|
|
filterable
|
|
|
default-first-option
|
|
|
clearable
|
|
|
:ref="'largeList'+scope.$index"
|
|
|
@clear="clear(scope.row, 'largeList')"
|
|
|
@keyup.enter.native="selectBlur(scope.row.largeLists,'largeList',scope.$index)"
|
|
|
v-model="scope.row.largeLists"
|
|
|
placeholder="请选择"
|
|
|
@change="handleChange($event, scope.row, 'largeList',scope.$index)"
|
|
|
style="width:110px"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="(item, index) in options"
|
|
|
:key="index"
|
|
|
:label="item.label"
|
|
|
:value="item.id"
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
<div
|
|
|
class="el-icon-edit-outline text-xs text-cyan"
|
|
|
@click.stop="
|
|
|
openStaffRatio(scope.row, scope.$index, 'largeList')
|
|
|
"
|
|
|
></div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="技师" align="center" min-width="150">
|
|
|
<template slot-scope="scope">
|
|
|
<div class="flex align-center form-width-m">
|
|
|
<el-select
|
|
|
filterable
|
|
|
default-first-option
|
|
|
clearable
|
|
|
@clear="clear(scope.row, 'technicianLists')"
|
|
|
v-model="scope.row.technicianLists"
|
|
|
placeholder="请选择"
|
|
|
:ref="'technicianList'+scope.$index"
|
|
|
@keyup.enter.native="selectBlur(scope.row.technicianLists,'technicianList',scope.$index)"
|
|
|
@change="
|
|
|
handleChange($event, scope.row, 'technicianList',scope.$index)
|
|
|
"
|
|
|
style="width:110px"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="(item, index) in options"
|
|
|
:key="index"
|
|
|
:label="item.label"
|
|
|
:value="item.id"
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
<div
|
|
|
class="el-icon-edit-outline text-xs text-cyan"
|
|
|
@click.stop="
|
|
|
openStaffRatio(
|
|
|
scope.row,
|
|
|
scope.$index,
|
|
|
'technicianList'
|
|
|
)
|
|
|
"
|
|
|
></div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="助理" align="center" min-width="150">
|
|
|
<template slot-scope="scope">
|
|
|
<div class="flex align-center form-width-m">
|
|
|
<el-select
|
|
|
filterable
|
|
|
default-first-option
|
|
|
clearable
|
|
|
@clear="clear(scope.row, 'smallLists')"
|
|
|
v-model="scope.row.smallLists"
|
|
|
placeholder="请选择"
|
|
|
:ref="'smallList'+scope.$index"
|
|
|
@keyup.enter.native="selectBlur(scope.row.smallLists,'smallList',scope.$index)"
|
|
|
@change="handleChange($event, scope.row, 'smallList',scope.$index)"
|
|
|
style="width:110px"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="(item, index) in options"
|
|
|
:key="index"
|
|
|
:label="item.label"
|
|
|
:value="item.id"
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
<div
|
|
|
class="el-icon-edit-outline text-xs text-cyan"
|
|
|
@click.stop="
|
|
|
openStaffRatio(scope.row, scope.$index, 'smallList')
|
|
|
"
|
|
|
></div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="高管" align="center" min-width="150">
|
|
|
<template slot-scope="scope">
|
|
|
<div class="flex align-center form-width-m">
|
|
|
<el-select
|
|
|
filterable
|
|
|
default-first-option
|
|
|
clearable
|
|
|
@clear="clear(scope.row, 'managerLists')"
|
|
|
v-model="scope.row.managerLists"
|
|
|
placeholder="请选择"
|
|
|
:ref="'managerList'+scope.$index"
|
|
|
@keyup.enter.native="selectBlur(scope.row.managerLists,'managerList',scope.$index)"
|
|
|
@change="handleChange($event, scope.row, 'managerList',scope.$index)"
|
|
|
style="width:110px"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="(item, index) in managerOptions"
|
|
|
:key="index"
|
|
|
:label="item.label"
|
|
|
:value="item.id"
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
<div
|
|
|
class="el-icon-edit-outline text-xs text-cyan"
|
|
|
@click.stop="
|
|
|
openStaffRatio(scope.row, scope.$index, 'managerList')
|
|
|
"
|
|
|
></div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="管理层" align="center" min-width="150">
|
|
|
<template slot-scope="scope">
|
|
|
<div class="flex align-center form-width-m">
|
|
|
<el-select
|
|
|
filterable
|
|
|
default-first-option
|
|
|
clearable
|
|
|
@keyup.enter.native="selectBlur(scope.row.adminLists,'adminList',scope.$index)"
|
|
|
@clear="clear(scope.row, 'adminLists')"
|
|
|
v-model="scope.row.adminLists"
|
|
|
placeholder="请选择"
|
|
|
:ref="'adminList'+scope.$index"
|
|
|
@change.enter.native="handleChange($event, scope.row, 'adminList',scope.$index)"
|
|
|
style="width:110px"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="(item, index) in adminOptions"
|
|
|
:key="index"
|
|
|
:label="item.label"
|
|
|
:value="item.id"
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
<div
|
|
|
class="el-icon-edit-outline text-xs text-cyan"
|
|
|
@click.stop="
|
|
|
openStaffRatio(scope.row, scope.$index, 'adminList')
|
|
|
"
|
|
|
></div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
show-overflow-tooltip
|
|
|
min-width="80"
|
|
|
align="center"
|
|
|
prop="remark"
|
|
|
label="备注"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<div @click.stop="">
|
|
|
<el-input v-model="scope.row.remark"></el-input>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
show-overflow-tooltip
|
|
|
min-width="100"
|
|
|
align="center"
|
|
|
prop="storeName"
|
|
|
label="所属门店"
|
|
|
>
|
|
|
</el-table-column>
|
|
|
<el-table-column width="100" align="center" label="操作">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
:disabled="scope.row.editNumber == 1"
|
|
|
icon="el-icon-delete"
|
|
|
circle
|
|
|
size="mini"
|
|
|
type="primary"
|
|
|
@click.stop="delPro(scope.row)"
|
|
|
></el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="box-flex">
|
|
|
<div class="flexA">
|
|
|
<div class="center" style="margin-right:15px">
|
|
|
<el-table
|
|
|
style="margin-top:3px;width:100%"
|
|
|
:data="cardList"
|
|
|
:row-key="getRowKeys"
|
|
|
show-summary
|
|
|
:header-cell-style="{
|
|
|
background: 'linear-gradient(#6cb3ff, #1873d4)',
|
|
|
color: '#eeeeee'
|
|
|
}"
|
|
|
>
|
|
|
<el-table-column label="充值卡付" align="center">
|
|
|
<el-table-column
|
|
|
show-overflow-tooltip
|
|
|
min-width="80px"
|
|
|
align="center"
|
|
|
label="卡名"
|
|
|
prop="rechargeTypeName"
|
|
|
>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
show-overflow-tooltip
|
|
|
min-width="80px"
|
|
|
align="center"
|
|
|
label="折扣"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
{{ scope.row.discount+'' }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="用前金额" align="center">
|
|
|
<el-table-column
|
|
|
show-overflow-tooltip
|
|
|
align="center"
|
|
|
label="充值"
|
|
|
min-width="110"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
{{ scope.row.cardRestMoney?scope.row.cardRestMoney+'':0 }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
show-overflow-tooltip
|
|
|
align="center"
|
|
|
label="赠送"
|
|
|
min-width="110"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
{{ scope.row.giftConsumeMoney?scope.row.giftConsumeMoney+'':0 }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="使用金额" align="center">
|
|
|
<el-table-column
|
|
|
show-overflow-tooltip
|
|
|
align="center"
|
|
|
prop="numConsume"
|
|
|
min-width="110"
|
|
|
label="充值"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
{{ scope.row.numConsume?scope.row.numConsume:0 }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
show-overflow-tooltip
|
|
|
align="center"
|
|
|
prop="giveConsume"
|
|
|
min-width="110"
|
|
|
label="赠送"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
{{ scope.row.giveConsume?scope.row.giveConsume:0 }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="剩余金额" align="center">
|
|
|
<el-table-column
|
|
|
show-overflow-tooltip
|
|
|
align="center"
|
|
|
min-width="110"
|
|
|
label="充值"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
{{ scope.row.numRemainder+'' }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
show-overflow-tooltipprojectData
|
|
|
align="center"
|
|
|
min-width="110"
|
|
|
label="赠送"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
{{ scope.row.giveRemainder+'' }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table-column>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
<div class="right">
|
|
|
<el-form ref="form" label-width="65px">
|
|
|
<el-form-item label="疗程付:">
|
|
|
<span class="text-price text-red">{{ formMoneys.Course?formMoneys.Course:0 }}</span>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="卡付:">
|
|
|
<span class="text-price text-red">{{ formMoneys.card?formMoneys.card:0 }}</span>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="现付:">
|
|
|
<span class="text-price text-red">{{ formMoneys.cash?formMoneys.cash:0 }}</span>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="实收金额:">
|
|
|
<span class="text-price text-red">{{ formMoneys.total?formMoneys.total:0 }}</span>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="left" style="margin-right:15px">
|
|
|
<div
|
|
|
class="border-radius-10 border margin-left-xs bg-white padding-xs"
|
|
|
style="margin-right:2%"
|
|
|
>
|
|
|
<div
|
|
|
class="flex justify-center align-center text-bold padding-bottom-xs"
|
|
|
>
|
|
|
<div class="form-width-m ">
|
|
|
<!-- <span class=" ">总付金额:</span> -->
|
|
|
<span class="text-red ">
|
|
|
<!-- {{ total }} -->
|
|
|
</span>
|
|
|
</div>
|
|
|
<div class="form-width-m">
|
|
|
<span class=" ">现付金额:</span>
|
|
|
<span class="text-red text-price">
|
|
|
{{ appearPrices }}
|
|
|
</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<payment ref="payment" @paymentData="paymentData" :form='form' :payLists='payLists'></payment>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="flexB">
|
|
|
<div style="width:100%;margin-bottom:15px">
|
|
|
<el-button size="samll" icon="el-icon-add" type="primary" @click="addPro">添加项目</el-button>
|
|
|
</div>
|
|
|
<div style="width:100%;margin-bottom:15px">
|
|
|
<el-button size="samll" type="primary" plain @click="openList">收银列表</el-button>
|
|
|
</div>
|
|
|
<div style="width:100%;margin-bottom:15px">
|
|
|
<el-button size="samll" type="primary" plain @click="goBack">{{isAddition == 1 ? "收银操作" : " 补单操作"}}</el-button>
|
|
|
</div>
|
|
|
<div style="width:100%;margin-bottom:15px">
|
|
|
<el-button size="samll" type="primary" plain @click="notData" >清空页面</el-button>
|
|
|
</div>
|
|
|
<div style="width:100%;margin-bottom:15px">
|
|
|
<el-button size="samll" type="primary" @click="confirm()">确认收银</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<member ref="member" @memberData="memberData"></member>
|
|
|
<staffratio ref="staffratio" @staffratioData="staffratioData"></staffratio>
|
|
|
<passcode ref="passcode" @passcodeData="passcodeData"></passcode>
|
|
|
<project ref="project" @projectData="projectData"></project>
|
|
|
<repayment ref="repayment" @repaymentData="inputMember"></repayment>
|
|
|
<addmember ref="addmember"></addmember>
|
|
|
<orders ref="orders"></orders>
|
|
|
<message :message="message" ref="message"></message>
|
|
|
<captcha @handleSubimt='handleSubimt' @getCodeOperate='getCodeOperate' @handleNewPassword='handleNewPassword' ref="captcha"/>
|
|
|
<trading ref="trading" :mobilePhone='memberForm.mobilePhone'/>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import { Mixins } from './mixins'
|
|
|
import addmember from "@/components/member/edit/index";
|
|
|
import message from './detail/message.vue';
|
|
|
import captcha from './captcha.vue';
|
|
|
import { getCode,upcashPassword } from '@/api/login.js'
|
|
|
import {
|
|
|
selectList,
|
|
|
selectListType,
|
|
|
storeMemberOne,
|
|
|
ctlist,
|
|
|
cashdoCash,
|
|
|
couAccountList,
|
|
|
proOne,
|
|
|
addCash,
|
|
|
recAccountCashList,
|
|
|
QuerCompetent
|
|
|
} from "@/api/eashier.js";
|
|
|
import member from "@/components/member/index";
|
|
|
import project from "@/components/project/index";
|
|
|
import repayment from "@/components/repayment/index";
|
|
|
import reccard from "./reccard";
|
|
|
import course from "./course";
|
|
|
import payment from "./copyPayment";
|
|
|
import staffratio from "./staffratio";
|
|
|
import passcode from "./passcode";
|
|
|
import { propage } from "@/api/storeManage.js";
|
|
|
import recash from "./recash";
|
|
|
import orders from "./detail/detail";
|
|
|
import { partten } from "@/utils/partten/index.js";
|
|
|
export default {
|
|
|
name:"services",
|
|
|
mixins:[Mixins],
|
|
|
components: {
|
|
|
member,
|
|
|
reccard,
|
|
|
course,
|
|
|
payment,
|
|
|
staffratio,
|
|
|
passcode,
|
|
|
project,
|
|
|
addmember,
|
|
|
repayment,
|
|
|
recash,
|
|
|
orders,
|
|
|
message,
|
|
|
captcha
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
formMoneys:{},
|
|
|
cardList:[],
|
|
|
numlist:[{settlementNum:0,payNum:0}],
|
|
|
message:"",
|
|
|
pickerOptions: {
|
|
|
disabledDate(time) {
|
|
|
return time.getTime() > Date.now();
|
|
|
}
|
|
|
},
|
|
|
useRecharge:JSON.parse(sessionStorage.getItem("sessionStorageData")).useRecharge *1,
|
|
|
balance:JSON.parse(sessionStorage.getItem("sessionStorageData")).balance * 1 +0.01,
|
|
|
memberIntegral: JSON.parse(sessionStorage.getItem("sessionStorageData")).memberIntegral,
|
|
|
debtMoneys: 0,
|
|
|
list: [], //主数组
|
|
|
listCopy: [],
|
|
|
rowList: [],
|
|
|
payMoneysum: 0,
|
|
|
payMoneysums: 0,
|
|
|
form: {
|
|
|
collectionCashAmount: 0,
|
|
|
collectionCashAmounts: 0,
|
|
|
cashAmount: 0,
|
|
|
debtMoney: 0
|
|
|
},
|
|
|
projectIndex: 0,
|
|
|
recListCopy: [], //当前会员的最初充值卡包
|
|
|
recForm: {},
|
|
|
memberForm: {}, //会员对象
|
|
|
notMemberForm: {},
|
|
|
expand: [],
|
|
|
expandedRows: [],
|
|
|
payLists: [], //现付列表
|
|
|
rechargeAccountList: [], //卡付列表
|
|
|
editIndex: -1,
|
|
|
loading: false,
|
|
|
formData: new FormData(),
|
|
|
cashNumber: -1,
|
|
|
rowIndex: -1,
|
|
|
proIndex: -1,
|
|
|
editProIndex: -1,
|
|
|
isAddition: 0,
|
|
|
additionDate: null,
|
|
|
transactionPrice: 0,
|
|
|
options: [], //员工下拉选择列表
|
|
|
adminOptions: [], //管理员下拉选择列表
|
|
|
managerOptions: [], //高管下拉选择列表
|
|
|
recIndex: -1,
|
|
|
recGiftIndex: -1,
|
|
|
rowRecList: [],
|
|
|
copyPayList: [],
|
|
|
routeNumber: null,
|
|
|
copyAccountList: [],
|
|
|
projectMomey: 0,
|
|
|
money: 0,
|
|
|
card1: 0,
|
|
|
card2: 0,
|
|
|
card3: 0,
|
|
|
card4: 0,
|
|
|
copyList:[],
|
|
|
spendMoney:null
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
// 现付金额
|
|
|
appearPrices() {
|
|
|
/*
|
|
|
现付金额 = 项目金额transactionPrice - 卡付抵扣金额collectionAmounts
|
|
|
需要转换下number格式,不然是字符串拼接
|
|
|
*/
|
|
|
let num = this.list.reduce((pre, item) => {
|
|
|
console.log('这是总付金额---->',item)
|
|
|
item.transactionPrice = item.transactionPrice? (item.transactionPrice * 1).toFixed(2) * 1: 0; // 抵扣金额存在,项目金额存在
|
|
|
if (item.courseAccountId == null) {
|
|
|
item.collectionAmounts = (item.collectionAmounts * 1).toFixed(2) * 1;
|
|
|
} else {
|
|
|
item.collectionAmounts = (item.transactionPrice * 1).toFixed(2) * 1;
|
|
|
}
|
|
|
if (item.collectionAmounts) {
|
|
|
return pre + (item.transactionPrice - item.collectionAmounts);
|
|
|
} // 抵扣金额不存在,项目金额存在
|
|
|
else if (!item.collectionAmounts && item.transactionPrice) {
|
|
|
return item.transactionPrice + pre; // 项目金额不存在
|
|
|
} else {
|
|
|
return pre + 0;
|
|
|
}
|
|
|
}, 0);
|
|
|
this.$nextTick(()=>{
|
|
|
this.form.collectionCashAmounts = num.toFixed(2)*1
|
|
|
this.form.cashAmount = this.total
|
|
|
})
|
|
|
return num.toFixed(2)*1;
|
|
|
},
|
|
|
appearPrice() {
|
|
|
// 计算现金总和跟项目列表卡付抵扣金额总和
|
|
|
// let num = (eval(this.$refs.payment.payLists.map(item=>{return item.payMoney}).join("+")) + eval(this.list.map(item=>{return item.collectionAmounts?item.collectionAmounts:0}).join("+")))
|
|
|
// // 当金额等于总价时不让执行(处理现金付完还能卡付bug)
|
|
|
// let total = eval(this.list.map(item=>item.transactionPrice?item.transactionPrice:0.).join("+"))
|
|
|
// if( num === total*1 )return 0
|
|
|
try{
|
|
|
if(this.list){
|
|
|
let collectionAmounts =this.list[this.projectIndex].collectionAmounts
|
|
|
return (this.list[this.projectIndex].amount-(collectionAmounts?collectionAmounts*1:0)).toFixed(2)*1;
|
|
|
}
|
|
|
}catch(err){
|
|
|
return 0
|
|
|
}
|
|
|
},
|
|
|
// 总价金额
|
|
|
total() {
|
|
|
/*
|
|
|
项目金额transactionPrice 卡付抵扣金额collectionAmounts 卡付金额collectionRechargeAmount
|
|
|
总价=项目金额-卡付抵扣金额+卡付金额
|
|
|
需要转换下number格式,不然是字符串拼接
|
|
|
*/
|
|
|
let list = JSON.parse(JSON.stringify(this.list))
|
|
|
let total = list.reduce((pre, item) => {
|
|
|
item.transactionPrice = item.transactionPrice
|
|
|
? (item.transactionPrice * 1).toFixed(2) * 1
|
|
|
: 0; // 卡付金额/抵扣金额存在
|
|
|
if (item.transactionPrice && item.collectionAmounts) {
|
|
|
item.collectionRechargeAmount = item.collectionRechargeAmount
|
|
|
? (item.collectionRechargeAmount * 1).toFixed(2) * 1
|
|
|
: 0;
|
|
|
item.collectionAmounts = item.collectionAmounts
|
|
|
? (item.collectionAmounts * 1).toFixed(2) * 1
|
|
|
: 0;
|
|
|
return (
|
|
|
pre +
|
|
|
(
|
|
|
item.transactionPrice -
|
|
|
item.collectionAmounts +
|
|
|
item.collectionRechargeAmount * 1
|
|
|
).toFixed(2) *
|
|
|
1
|
|
|
); // 项目金额存在
|
|
|
} else if (item.transactionPrice) {
|
|
|
return pre + item.transactionPrice; // 项目金额不存在
|
|
|
} else {
|
|
|
return pre + 0;
|
|
|
}
|
|
|
}, 0);
|
|
|
return total.toFixed(2)*1;
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
selectBlur(val,text,index){
|
|
|
console.log('回车事件1')
|
|
|
this.$nextTick(()=>{
|
|
|
this.$refs[text+index].blur()
|
|
|
this.triggerInit(text,index)
|
|
|
})
|
|
|
},
|
|
|
vipShow(){
|
|
|
this.$refs.trading.dialogFormVisible = true
|
|
|
},
|
|
|
updataCollection(){
|
|
|
let card = 0; //卡付
|
|
|
let Course = 0; //疗程付
|
|
|
let cash = 0; //现付
|
|
|
let total = 0 //总价
|
|
|
if(this.list.length){
|
|
|
this.list.forEach(item=>{
|
|
|
if(item.transactionPrice){
|
|
|
if(item.collectionRechargeAmount){
|
|
|
// 卡付
|
|
|
// card+=(item.collectionRechargeAmount.toFixed(2)*1)
|
|
|
card = ((item.collectionRechargeAmount*1+card*1).toFixed(2)*1)
|
|
|
// item.rechargeAccountList.forEach(item=>{ //算上赠送金额
|
|
|
// item.giftSpendMoney?item.giftSpendMoney:0
|
|
|
// card+=item.giftSpendMoney
|
|
|
// card = card.toFixed(2)*1
|
|
|
// })
|
|
|
}
|
|
|
if(item.courseAccountId){
|
|
|
// 疗程付
|
|
|
Course+=((item.transactionPrice).toFixed(2)*1)
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
try{
|
|
|
cash = eval(this.$refs.payment.payLists.map(item=>{return item.payMoney?item.payMoney*1:0}).join("+")) //现付
|
|
|
}catch(err){}
|
|
|
}
|
|
|
total = ((card*1+Course*1+cash*1))
|
|
|
total = total.toFixed(2)*1
|
|
|
this.formMoneys = {
|
|
|
card,Course,cash,total
|
|
|
}
|
|
|
},
|
|
|
// 切换卡付/现付
|
|
|
radioInput(row){
|
|
|
if(row.radio==1){
|
|
|
// 现付
|
|
|
row.transactionPrice = row.price
|
|
|
// 如果有充值卡要清空并且把现付清空
|
|
|
this.$refs.payment.payLists.forEach(item=>item.payMoney = 0)
|
|
|
if(row.rechargeAccountList.length){ //充值卡存在
|
|
|
// 清空充值卡钱
|
|
|
row.rechargeAccountList.forEach(item=>{
|
|
|
item.spendMoney?item.spendMoney*1:0
|
|
|
item.giftSpendMoney?item.giftSpendMoney*1:0
|
|
|
item.cardOvers = (item.cardOvers + item.spendMoney).toFixed(2)*1 // 恢复可用金额
|
|
|
item.spendMoney = 0
|
|
|
item.cardGiftOvers = (item.cardGiftOvers + item.giftSpendMoney).toFixed(2)*1
|
|
|
item.giftSpendMoney =0
|
|
|
})
|
|
|
this.updataList()
|
|
|
}
|
|
|
}else{
|
|
|
// 卡付
|
|
|
row.transactionPrice = row.priceMember
|
|
|
console.log('点击了卡付--',row)
|
|
|
// 如果有充值卡要清空并且把现付重新清空
|
|
|
this.$refs.payment.payLists.forEach(item=>item.payMoney = 0)
|
|
|
if(row.rechargeAccountList.length){ //充值卡存在
|
|
|
// 清空充值卡钱
|
|
|
row.rechargeAccountList.forEach(item=>{
|
|
|
item.spendMoney?item.spendMoney*1:0
|
|
|
item.giftSpendMoney?item.giftSpendMoney*1:0
|
|
|
item.cardOvers = (item.cardOvers + item.spendMoney).toFixed(2)*1 // 恢复可用金额
|
|
|
item.spendMoney = 0
|
|
|
item.cardGiftOvers = (item.cardGiftOvers + item.giftSpendMoney).toFixed(2)*1
|
|
|
item.giftSpendMoney =0
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
this.list.push({})
|
|
|
this.list.pop()
|
|
|
this.updataList()
|
|
|
},
|
|
|
// 输入新密码
|
|
|
handleNewPassword(val){
|
|
|
let params = {
|
|
|
cashPassword:this.$refs.captcha.oldPassword,
|
|
|
cashPasswordnew1:this.$refs.captcha.newPassword,
|
|
|
cashPasswordnew2:this.$refs.captcha.newPassword2,
|
|
|
mobilePhone:this.memberForm.mobilePhone,
|
|
|
id:this.memberForm.id
|
|
|
}
|
|
|
upcashPassword(params).then(res=>{
|
|
|
this.$refs.captcha.passwordLoading = false
|
|
|
if(res.code == '000000'){
|
|
|
this.$message.success({ message: "密码更改成功" });
|
|
|
this.$refs.captcha.handleCloseCancel()
|
|
|
}else{
|
|
|
this.$alert(res.message, "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
type: "warning",
|
|
|
center: true,
|
|
|
callback: (action) => {},
|
|
|
});
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
// 点击密码修改
|
|
|
updataPassword(){
|
|
|
this.$refs.captcha.dialogVisible = true
|
|
|
},
|
|
|
// 获取验证码
|
|
|
getCodeOperate(){
|
|
|
let params = {
|
|
|
mobilePhone:this.memberForm.mobilePhone
|
|
|
}
|
|
|
getCode(params).then(res=>{
|
|
|
if(res.code == '000000'){
|
|
|
this.$message.success({ message: "验证码已发送,注意查看手机" });
|
|
|
}else if(res.code=='200007'){
|
|
|
this.$alert(res.message, "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
type: "warning",
|
|
|
center: true,
|
|
|
callback: (action) => {},
|
|
|
});
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
// 验证码修改密码提交
|
|
|
handleSubimt(val){
|
|
|
let params = {
|
|
|
codeMsg:this.$refs.captcha.inpt,
|
|
|
cashPasswordnew1:this.$refs.captcha.password,
|
|
|
cashPasswordnew2:this.$refs.captcha.password2,
|
|
|
mobilePhone:this.memberForm.mobilePhone,
|
|
|
id:this.memberForm.id
|
|
|
}
|
|
|
upcashPassword(params).then(res=>{
|
|
|
this.$refs.captcha.codeLoading = false
|
|
|
if(res.code == '000000'){
|
|
|
this.$message.success({ message: "密码修改成功" });
|
|
|
this.$refs.captcha.handleCloseCancel()
|
|
|
}else{
|
|
|
this.$alert(res.message, "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
type: "warning",
|
|
|
center: true,
|
|
|
callback: (action) => {},
|
|
|
});
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
// 动态处理充值卡付数据
|
|
|
cardListUpdata(){
|
|
|
this.cardList = this.recListCopy //由于第一次过滤掉了,第二次是空数组,需要重新赋值
|
|
|
this.cardList.forEach((item1)=>{
|
|
|
item1.numCard = 0 //卡付金额
|
|
|
item1.cardGive = 0 //卡付赠送
|
|
|
this.list.forEach((item2)=>{
|
|
|
item2.rechargeAccountList.forEach(item3=>{
|
|
|
if(item1.id === item3.id){
|
|
|
item3.spendMoney = item3.spendMoney?item3.spendMoney*1:0
|
|
|
item3.giftSpendMoney = item3.giftSpendMoney?item3.giftSpendMoney*1:0
|
|
|
item1.numCard += item3.spendMoney
|
|
|
item1.cardGive += item3.giftSpendMoney
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
this.$set(item1,'numConsume',(item1.numCard).toFixed(2)*1) //卡付金额使用
|
|
|
this.$set(item1,'giveConsume',(item1.cardGive).toFixed(2)*1) //卡付赠送使用
|
|
|
this.$set(item1,'numRemainder',(item1.cardRestMoney - item1.numCard).toFixed(2)*1) //卡付金额剩余
|
|
|
this.$set(item1,'giveRemainder',(item1.giftConsumeMoney - item1.cardGive).toFixed(2)*1) //卡付赠送剩余
|
|
|
})
|
|
|
this.updateNum()
|
|
|
// 过滤只要使用过的卡
|
|
|
this.cardList = this.cardList.filter(item=>{
|
|
|
return item.numConsume || item.giveConsume
|
|
|
})
|
|
|
},
|
|
|
// 处理echart数据层
|
|
|
updateNum(){
|
|
|
let total = eval(this.$refs.payment.payLists.map(item=>{return item.payMoney?item.payMoney*1:0}).join("+"))//现金总和
|
|
|
let collectionRechargeAmount = eval(this.list.map(item=>{return item.collectionRechargeAmount?item.collectionRechargeAmount*1:0}).join("+"))
|
|
|
if(this.list.length){
|
|
|
this.numlist=[{settlementNum:total+collectionRechargeAmount,payNum:total+collectionRechargeAmount}]
|
|
|
}else if(!collectionRechargeAmount&&total){
|
|
|
this.numlist=[{settlementNum:total,payNum:total}]
|
|
|
}else if(!total&&collectionRechargeAmount){
|
|
|
this.numlist=[{settlementNum:collectionRechargeAmount,payNum:collectionRechargeAmount}]
|
|
|
}else{
|
|
|
this.numlist=[{settlementNum:0,payNum:0}]
|
|
|
}
|
|
|
},
|
|
|
projectindex(index) {
|
|
|
this.projectIndex = index;
|
|
|
},
|
|
|
changeMember() {
|
|
|
if (this.cashNumber == 1) {
|
|
|
Object.assign(this.$data, this.$options.data.call(this));
|
|
|
this.cashNumber = 0;
|
|
|
} else {
|
|
|
Object.assign(this.$data, this.$options.data.call(this));
|
|
|
this.cashNumber = 1;
|
|
|
}
|
|
|
this.notData()
|
|
|
},
|
|
|
openList() {
|
|
|
this.$refs.orders.show();
|
|
|
},
|
|
|
clear(row, text) {
|
|
|
let form = { ...row };
|
|
|
form[text] = [];
|
|
|
this.list.splice(row.index, 1, form);
|
|
|
},
|
|
|
// 修改list每行抵扣金额/卡付金额
|
|
|
updataList(){
|
|
|
let collectionAmounts = 0
|
|
|
let collectionRechargeAmount = 0
|
|
|
if(this.list[this.projectIndex].noDiscount == 0){
|
|
|
// 可以打折的计算
|
|
|
this.list[this.projectIndex].rechargeAccountList.forEach(item=>{
|
|
|
collectionRechargeAmount += (item.spendMoney*1+ (item.giftSpendMoney?item.giftSpendMoney*1:0) )
|
|
|
collectionAmounts += ( ( (item.spendMoney*1)/ ((item.discount?item.discount:100)/100) ) + ((item.giftSpendMoney?item.giftSpendMoney*1:0)/(item.discountFreeAmount?item.discountFreeAmount/100:1)))
|
|
|
})
|
|
|
this.$set(this.list[this.projectIndex],'collectionRechargeAmount',collectionRechargeAmount.toFixed(2)*1)
|
|
|
this.$set(this.list[this.projectIndex],'collectionAmounts', collectionAmounts.toFixed(2)*1)
|
|
|
// 误差
|
|
|
if((this.list[this.projectIndex].transactionPrice-this.list[this.projectIndex].collectionAmounts)<=this.balance*1 ){
|
|
|
this.list[this.projectIndex].collectionAmounts = (this.list[this.projectIndex].transactionPrice).toFixed(2)*1
|
|
|
}
|
|
|
}else{
|
|
|
// 不能打折的计算
|
|
|
this.list[this.projectIndex].rechargeAccountList.forEach(item=>{
|
|
|
collectionRechargeAmount += (item.spendMoney*1+ (item.giftSpendMoney?item.giftSpendMoney*1:0) )
|
|
|
collectionAmounts += ((item.spendMoney*1) + (item.giftSpendMoney?item.giftSpendMoney*1:0))
|
|
|
})
|
|
|
this.$set(this.list[this.projectIndex],'collectionRechargeAmount',(collectionRechargeAmount).toFixed(2)*1)
|
|
|
this.$set(this.list[this.projectIndex],'collectionAmounts', (collectionAmounts).toFixed(2)*1)
|
|
|
if((this.list[this.projectIndex].transactionPrice-this.list[this.projectIndex].collectionAmounts)<=this.balance*1 ){
|
|
|
this.list[this.projectIndex].collectionAmounts = (this.list[this.projectIndex].transactionPrice).toFixed(2)*1
|
|
|
} //误差
|
|
|
}
|
|
|
this.cardListUpdata()
|
|
|
this.updataCollection()
|
|
|
},
|
|
|
//修改卡付金额
|
|
|
editcard(row, index) {
|
|
|
this.recIndex = index;
|
|
|
// 本次需要支付的金额
|
|
|
let appearPrice = this.list[this.projectIndex].transactionPrice - (this.list[this.projectIndex].collectionAmounts?this.list[this.projectIndex].collectionAmounts*1:0)
|
|
|
// 卡付抵扣金额collectionAmounts 卡付金额collectionRechargeAmount
|
|
|
// 本次支付spendMoney 可用金额cardConsumeMoney 可用余额cardOvers 可用折扣discount 赠送折扣discountFreeAmount 赠送支付giftSpendMoney 赠送剩余cardGiftOvers
|
|
|
// type:0折扣卡 1赠送卡 2活动卡 noDiscount 0 能打折 1 不打折 appearPrice当前需要支付多少
|
|
|
if( row.spendMoney ){
|
|
|
// 要修改
|
|
|
row.spendMoney = 0
|
|
|
row.cardOvers = row.CardCurrentUse
|
|
|
row.cardGiftOvers = (row.cardGiftOvers +(row.giftSpendMoney?row.giftSpendMoney*1:0)).toFixed(2)*1
|
|
|
row.giftSpendMoney = 0
|
|
|
this.list.push({})
|
|
|
this.list.pop()
|
|
|
return this.updataList()
|
|
|
}
|
|
|
if(this.useRecharge !== 1 && row.cardOvers ==0 && row.giftSpendMoney){ //可用余额不存在并且门店参数不等于1并且赠送支付存在触发
|
|
|
row.spendMoney = 0
|
|
|
row.cardGiftOvers = ((row.cardGiftOvers?row.cardGiftOvers*1:0) + (row.giftSpendMoney?row.giftSpendMoney*1:0)).toFixed(2)*1
|
|
|
row.giftSpendMoney = 0
|
|
|
// 不知名错误,别删
|
|
|
this.$set(this.list[this.projectIndex],'popover',false)
|
|
|
this.$set(this.list[this.projectIndex],'popover',true)
|
|
|
this.list.push({})
|
|
|
this.list.pop()
|
|
|
return this.updataList()
|
|
|
}
|
|
|
if(this.useRecharge == 1){ //门店参数 按比例支付
|
|
|
if(this.list[this.projectIndex].noDiscount == 0){
|
|
|
// 可以打折
|
|
|
if(!row.cardGiftOvers){ //没有赠送金额(赠送剩余)
|
|
|
// 获取当前值最大数
|
|
|
let total = row.cardOvers/(row.discount*1)*100
|
|
|
// 判断是否大于需要支付金额
|
|
|
if(appearPrice>total){
|
|
|
row.spendMoney = row.cardOvers
|
|
|
// this.updataList()
|
|
|
}else{
|
|
|
// 当前金额大于当前值
|
|
|
console.log('当前剩余金额-->',appearPrice,'折扣是多少-->',row.discount)
|
|
|
row.spendMoney = (appearPrice*(row.discount*1/100)).toFixed(2)*1
|
|
|
}
|
|
|
}else{
|
|
|
// 有赠送金额
|
|
|
let total = (row.cardOvers/(row.discount*1)*100 + ( row.cardGiftOvers/( (row.discountFreeAmount?row.discountFreeAmount:100)*1 )*100 )).toFixed(2)*1
|
|
|
let balanceProportion = (row.cardOvers*1)/(row.cardOvers*1 + row.cardGiftOvers*1) //可用余额比例
|
|
|
let giveProportion = (row.cardGiftOvers*1)/(row.cardOvers*1 + row.cardGiftOvers*1) //赠送金额比例
|
|
|
let balanceConverted = balanceProportion/(row.discount?(row.discount*1/100):1) //可用折算 (比例除以折扣)
|
|
|
let giveConverted = giveProportion/(row.discountFreeAmount?(row.discountFreeAmount*1/100):1) //赠送折算
|
|
|
let convertedNum = appearPrice/(balanceConverted+giveConverted) //消费金额折算份数
|
|
|
console.log('可用比例-->',balanceProportion,'赠送比例--->',giveProportion)
|
|
|
if(appearPrice<total){
|
|
|
// 够用按比例扣除
|
|
|
row.spendMoney = (convertedNum*balanceProportion).toFixed(2)*1
|
|
|
row.giftSpendMoney = (convertedNum*giveProportion).toFixed(2)*1
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1
|
|
|
console.log('剩了多少--->',row.cardGiftOvers)
|
|
|
}else{
|
|
|
// 如果总额不够付,扣掉所有的折扣可用余额并且把剩余金额也扣掉
|
|
|
console.log('我不够扣',total)
|
|
|
row.spendMoney = (row.cardOvers).toFixed(2)*1
|
|
|
row.giftSpendMoney = (row.cardGiftOvers).toFixed(2)*1
|
|
|
row.cardGiftOvers = 0
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
// 不能打折
|
|
|
let total = row.cardOvers + row.cardGiftOvers
|
|
|
console.log('还需支付多少--->',appearPrice)
|
|
|
if(total>appearPrice){ // 总额大于待支付金额
|
|
|
// 够付的情况按照比例扣除
|
|
|
row.spendMoney = (appearPrice*row.cardOvers/( row.cardGiftOvers+row.cardOvers )).toFixed(2)*1
|
|
|
row.giftSpendMoney = (appearPrice*row.cardGiftOvers/( row.cardGiftOvers+row.cardOvers )).toFixed(2)*1
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1
|
|
|
}else{
|
|
|
row.spendMoney = (row.cardOvers).toFixed(2)*1
|
|
|
row.giftSpendMoney = (row.cardGiftOvers).toFixed(2)*1
|
|
|
row.cardGiftOvers = 0
|
|
|
// this.updataList()
|
|
|
}
|
|
|
}
|
|
|
this.spendMoney = row.spendMoney
|
|
|
}else{ //先用实冲,再用赠送
|
|
|
console.log('来到了门店参数2--->')
|
|
|
//做法 扣除本次支付/赠送支付/赠送剩余
|
|
|
if(this.list[this.projectIndex].noDiscount == 0){ //可以打折
|
|
|
// 先算出折扣总额够不够支付项目金额
|
|
|
let total = ((row.cardOvers/(row.discount?row.discount*1:100))*100) + ((row.cardGiftOvers/(row.discountFreeAmount?row.discountFreeAmount:100))*100) //折后(赠送/可用)总和
|
|
|
console.log('总额是多少--->',total,'这个是多少--->',(row.cardOvers/(row.discount?(row.discount*1)/100:1)))
|
|
|
// 当可用余额为0并且赠送支付存在并在待支付金额存在触发
|
|
|
if(row.cardOvers === 0 && row.cardGiftOvers && appearPrice){ //当可用余额为0并且赠送金额存在时
|
|
|
this.$message.warning({ message: "当前卡付余额为0,将自动扣除赠送金额" });
|
|
|
if(total>appearPrice){ //当前赠送够支付
|
|
|
row.giftSpendMoney = (appearPrice*(row.discountFreeAmount?(row.discountFreeAmount*1)/100:1)).toFixed(2)*1
|
|
|
row.spendMoney = (row.giftSpendMoney).toFixed(2)*1
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1
|
|
|
}else{ //当前卡不够支付
|
|
|
row.spendMoney = (row.cardGiftOvers).toFixed(2)*1
|
|
|
row.giftSpendMoney = (row.cardGiftOvers).toFixed(2)*1
|
|
|
row.cardGiftOvers = 0
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
if( total>appearPrice ){ //折扣总额够支付项目,先扣除可用余额折扣,如果够扣,就只扣他自己,不够扣再扣赠送金额折扣
|
|
|
if( (row.cardOvers/(row.discount?(row.discount*1)/100:1)) > appearPrice ){ //自己本身折扣金额够扣,直接扣除本身
|
|
|
row.spendMoney = (appearPrice*(row.discount?(row.discount*1)/100:1)).toFixed(2)*1
|
|
|
}else{ //不够扣时,扣光自己的可用余额并且算上差价继续扣赠送金额
|
|
|
row.spendMoney = (row.cardOvers).toFixed(2)*1
|
|
|
let remainderCsee = appearPrice - ((row.spendMoney/row.discount)*100) //剩余支付
|
|
|
console.log('还需要支付多少--->',remainderCsee)
|
|
|
row.giftSpendMoney =( remainderCsee*(row.discountFreeAmount?(row.discountFreeAmount*1)/100:1)).toFixed(2)*1 //算出还需支付多少
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1
|
|
|
}
|
|
|
}else{ //折后金额总和不够支付项目金额,直接扣除
|
|
|
row.spendMoney = (row.cardOvers).toFixed(2)*1 // 支付金额 直接赋值支付金额
|
|
|
row.giftSpendMoney = (row.cardGiftOvers).toFixed(2)*1 //赠送支付-- 赋值所有赠送支付
|
|
|
row.cardGiftOvers = 0 //清空赠送剩余
|
|
|
}
|
|
|
}else{ //不能打折
|
|
|
let total = (row.cardOvers?row.cardOvers*1:0) + (row.cardGiftOvers?row.cardGiftOvers:0) //赠送跟卡付总和
|
|
|
if(row.cardOvers === 0 && row.cardGiftOvers && appearPrice){ //当可用余额为0并且赠送金额存在时
|
|
|
this.$message.warning({ message: "当前卡付余额为0,将自动扣除赠送金额" });
|
|
|
if( total>appearPrice ){ //当前卡够支付
|
|
|
row.spendMoney = appearPrice
|
|
|
row.giftSpendMoney = appearPrice
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - appearPrice).toFixed(2)*1
|
|
|
}else{ //当前卡剩余余额不够支付
|
|
|
row.spendMoney = (row.cardGiftOvers).toFixed(2)*1
|
|
|
row.giftSpendMoney = (row.cardGiftOvers).toFixed(2)*1
|
|
|
row.cardGiftOvers = 0
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
if(total>appearPrice){ //当前卡够支付项目金额
|
|
|
if(row.cardOvers>appearPrice){ //自己本身余额够支付项目,那就先扣除自己的
|
|
|
row.spendMoney = appearPrice
|
|
|
}else{ //需要算上差价
|
|
|
let remainderCsee = appearPrice - row.cardOvers //赠送还要补充多少
|
|
|
row.spendMoney = (row.cardOvers).toFixed(2)*1
|
|
|
row.giftSpendMoney = (remainderCsee).toFixed(2)*1
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - remainderCsee).toFixed(2)*1
|
|
|
}
|
|
|
}else{ //当前卡不够支付项目金额
|
|
|
row.spendMoney = (row.cardOvers).toFixed(2)*1
|
|
|
row.giftSpendMoney = (row.cardGiftOvers).toFixed(2)*1
|
|
|
row.cardGiftOvers = 0
|
|
|
}
|
|
|
}
|
|
|
this.spendMoney = row.spendMoney //判断上一次是否改变,只用来门店参数为2时使用
|
|
|
console.log('上一次的值是多少呢------>',this.spendMoney)
|
|
|
}
|
|
|
},
|
|
|
endEditcard(row, index) { //计算比较复杂,仔细看每一步
|
|
|
// 卡付抵扣金额collectionAmounts 卡付金额collectionRechargeAmount
|
|
|
// 本次支付spendMoney 可用金额cardConsumeMoney 可用余额cardOvers 可用折扣discount 赠送折扣discountFreeAmount 赠送支付giftSpendMoney 赠送剩余cardGiftOvers
|
|
|
// type:0折扣卡 1赠送卡 2活动卡 noDiscount 0 能打折 1 不打折
|
|
|
this.recIndex = -1
|
|
|
if((row.spendMoney*1) === 0){
|
|
|
row.cardGiftOvers = (row.cardGiftOvers*1 + row.giftSpendMoney*1).toFixed(2)*1
|
|
|
row.giftSpendMoney = 0
|
|
|
this.spendMoney = ''
|
|
|
return
|
|
|
}
|
|
|
let appearPrice = this.list[this.projectIndex].transactionPrice - (this.list[this.projectIndex].collectionAmounts?this.list[this.projectIndex].collectionAmounts*1:0) //本次需要支付的钱
|
|
|
if(this.useRecharge == 1){ //门店参数 按比例支付
|
|
|
// 上一次输入的没变
|
|
|
if(this.spendMoney === row.spendMoney){
|
|
|
// 上一次没改变
|
|
|
row.cardOvers = (row.cardOvers - (row.spendMoney*1)).toFixed(2)*1
|
|
|
this.updataList()
|
|
|
this.list.push({})
|
|
|
this.list.pop()
|
|
|
this.spendMoney = ''
|
|
|
return
|
|
|
}
|
|
|
if(this.list[this.projectIndex].noDiscount == 0){ //可以打折 0
|
|
|
row.spendMoney = row.spendMoney*1 //转化
|
|
|
if(row.spendMoney>row.cardOvers){ //如果输入的大于本身余额
|
|
|
this.$message.warning({ message: "支付金额大于卡付余额" });
|
|
|
// 如果输入金额大于可支付金额,则需要判断当前卡够不够支付,如果够支付,就扣除当前卡跟赠送,如果当前卡不够支付,扣除掉所有的赠送支付跟可用余额
|
|
|
// 注意!!! 需要还原之前的赠送
|
|
|
let total =( row.cardOvers*1/row.discount*100 ).toFixed(2)*1 + ( (row.giftSpendMoney?row.giftSpendMoney*1:0) + row.cardGiftOvers*1 ) //当前卡总额
|
|
|
console.log('当前卡总额--->',total,'还需支付--->',appearPrice)
|
|
|
if(total>appearPrice){//当前卡够支付
|
|
|
// 够支付,按比例扣除,可能赠送存在或者不存在
|
|
|
let balanceProportion = row.cardOvers*1/(row.cardOvers*1+( (row.giftSpendMoney?row.giftSpendMoney*1:0) + row.cardGiftOvers*1 )) //可用余额比例
|
|
|
let giveProportion = (row.cardGiftOvers*1 + (row.giftSpendMoney?row.giftSpendMoney*1:0))/(row.cardOvers*1+( (row.giftSpendMoney?row.giftSpendMoney*1:0) + row.cardGiftOvers*1 ))//赠送金额比例
|
|
|
let balanceConverted = balanceProportion/(row.discount?(row.discount*1/100):1) //可用折算 (比例除以折扣)
|
|
|
let giveConverted = giveProportion/(row.discountFreeAmount?(row.discountFreeAmount*1/100):1) //赠送折算
|
|
|
let convertedNum = appearPrice/(balanceConverted+giveConverted) //消费金额折算份数
|
|
|
row.spendMoney = ( convertedNum*balanceProportion ).toFixed(2)*1 //支付金额
|
|
|
row.cardGiftOvers = (row.giftSpendMoney?row.giftSpendMoney*1:0) + row.cardGiftOvers*1 //还原赠送支付
|
|
|
row.giftSpendMoney =( convertedNum*giveProportion ).toFixed(2)*1 //赠送金额
|
|
|
row.cardGiftOvers = (row.cardGiftOvers*1 - row.giftSpendMoney*1).toFixed(2)*1 // 赠送剩余= 赠送剩余原始值-赠送支付
|
|
|
// 有误差
|
|
|
if(row.cardGiftOvers<0){
|
|
|
row.cardGiftOvers = 0
|
|
|
}
|
|
|
row.cardOvers = (row.cardOvers - row.spendMoney).toFixed(2)*1 //可用余额=原始可用余额-支付金额
|
|
|
this.updataList()
|
|
|
console.log('可用余额比例-->',balanceProportion,'赠送金额比例-->',giveProportion)
|
|
|
}else{ //当前卡不够支付,扣掉所有的可用余额比例跟赠送余额
|
|
|
row.spendMoney = row.cardOvers //本次支付等于剩余余额
|
|
|
row.cardOvers = 0
|
|
|
row.giftSpendMoney = (row.giftSpendMoney?row.giftSpendMoney*1:0) + row.cardGiftOvers //扣除所有的赠送
|
|
|
row.cardGiftOvers = 0
|
|
|
this.updataList()
|
|
|
}
|
|
|
}else{ // 输入的值不大于本卡金额
|
|
|
// 输入的金额也要做判断,判断是否大于支付金额,如果大于支付金额,就拿支付金额按比例付款,小于则按输入金额付款
|
|
|
// !!!这里也需要还原之前的赠送!!!
|
|
|
row.cardGiftOvers = ((row.cardGiftOvers?row.cardGiftOvers*1:0) + (row.giftSpendMoney?row.giftSpendMoney*1:0)).toFixed(2)*1 //还原之前赠送金额
|
|
|
row.giftSpendMoney = 0 //还原赠送支付
|
|
|
let balanceProportion = row.cardOvers/(row.cardOvers + (row.cardGiftOvers?row.cardGiftOvers*1:0)) // 可用金额比例
|
|
|
let giveProportion = (row.cardGiftOvers?row.cardGiftOvers*1:0)/(row.cardOvers + (row.cardGiftOvers?row.cardGiftOvers*1:0)) // 可用赠送比例
|
|
|
let balanceConverted = balanceProportion/(row.discount?(row.discount*1/100):1) //可用折算 (比例除以折扣)
|
|
|
let giveConverted = giveProportion/(row.discountFreeAmount?(row.discountFreeAmount*1/100):1) //赠送折算
|
|
|
let convertedNum = appearPrice/(balanceConverted+giveConverted) //消费金额折算份数
|
|
|
// 先要判断输入金额是否大于项目金额
|
|
|
if(row.spendMoney > appearPrice){ // 输入的金额大于项目金额
|
|
|
this.$message.warning({ message: "支付金额大于成交金额" });
|
|
|
// 当输入金额大于项目金额时(就是比如说输入400的时候,而这个项目总价是350),帮它自动计算(比例扣除)
|
|
|
console.log('瞅瞅比例','可用---',balanceProportion,'赠送---',giveProportion)
|
|
|
// 自动计算
|
|
|
row.spendMoney = (convertedNum*balanceProportion).toFixed(2)*1
|
|
|
row.cardOvers = (row.cardOvers - row.spendMoney).toFixed(2)*1
|
|
|
row.giftSpendMoney = (convertedNum*giveProportion).toFixed(2)*1
|
|
|
row.cardGiftOvers =( row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1
|
|
|
// 有误差
|
|
|
if(row.cardGiftOvers<0){
|
|
|
row.cardGiftOvers = 0
|
|
|
}
|
|
|
this.updataList()
|
|
|
}else{ //支付金额不大于项目金额
|
|
|
// 这里要判断支付的金额加赠送是否大于项目金额,如果大于,帮他自动计算,不大于则扣除
|
|
|
console.log('来到了这里---')
|
|
|
// 先要判断输入的金额折扣是否大于项目金额,如果大于,帮他自动计算,
|
|
|
// 不大于的话,还要判断折扣金额跟折扣赠送是否大于项目金额,
|
|
|
let total = ((row.spendMoney/row.discount)*100).toFixed(2)*1 //获取当前输入值折扣
|
|
|
console.log('总价--->',total)
|
|
|
if(total > appearPrice){ //当前输入值折扣大于支付金额
|
|
|
// 按比例自动计算
|
|
|
this.$message.warning({ message: "支付金额大于项目金额" });
|
|
|
row.spendMoney =( convertedNum*balanceProportion ).toFixed(2)*1 //支付金额
|
|
|
row.giftSpendMoney = ( convertedNum*giveProportion ).toFixed(2)*1 //赠送支付
|
|
|
row.cardOvers = ( row.cardOvers - row.spendMoney ).toFixed(2)*1 //可用余额
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1 //赠送剩余
|
|
|
if(row.cardGiftOvers<0){
|
|
|
row.cardGiftOvers = 0
|
|
|
}
|
|
|
this.updataList()
|
|
|
}else{ // 不超过的情况
|
|
|
// 判断比例支付是否大于支付金额,如果大于,提示它并且帮它自动计算,不大于则扣除相应比例金额
|
|
|
let giveCase = (((row.spendMoney/(row.discount?row.discount/100:1))/balanceProportion)*giveProportion).toFixed(2)*1 //按照比例算出赠送金额为多少
|
|
|
console.log('你是多少--->',giveCase,total)
|
|
|
// giveCase+total)>= appearPrice
|
|
|
if( row.spendMoney>(convertedNum*balanceProportion) ){ //输入的值大于需要支付金额
|
|
|
console.log('误差是多少--->',giveCase+total,'待支付是多少--->',appearPrice)
|
|
|
this.$message.warning({ message: "支付金额大于项目金额" });
|
|
|
// 重新计算
|
|
|
row.spendMoney = (convertedNum*balanceProportion).toFixed(2)*1 //支付金额
|
|
|
row.giftSpendMoney = (convertedNum*giveProportion).toFixed(2)*1 //赠送支付
|
|
|
row.cardOvers = ( row.cardOvers - row.spendMoney ).toFixed(2)*1 //赠送支付
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1 //赠送剩余
|
|
|
// 有误差
|
|
|
if(row.cardGiftOvers<0){
|
|
|
row.cardGiftOvers = 0
|
|
|
}
|
|
|
this.updataList()
|
|
|
}else{ //按照输入扣除
|
|
|
// console.log('我到了这里呀!!!',giveProportion,balanceProportion)
|
|
|
let zsbl = row.spendMoney/(convertedNum*balanceProportion)
|
|
|
console.log('比例是多少---->',zsbl,'这个呢--->',convertedNum)
|
|
|
row.cardOvers = ( row.cardOvers - row.spendMoney ).toFixed(2)*1 //可用余额
|
|
|
row.giftSpendMoney = (convertedNum*giveProportion*zsbl).toFixed(2)*1
|
|
|
// row.giftSpendMoney = ((((row.spendMoney/(row.discount?row.discount/100:1))/balanceProportion)*giveProportion)*((row.discountFreeAmount?row.discountFreeAmount*1:100)/100)).toFixed(2)*1 //赠送支付(按比例公式--- 支付金额/支付折扣/支付比例*赠送比例*赠送折扣 ---)
|
|
|
console.log('赠送支付为多少---->',row.giftSpendMoney)
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1 //赠送剩余
|
|
|
// 有误差
|
|
|
if(row.cardGiftOvers<0){
|
|
|
row.cardGiftOvers = 0
|
|
|
}
|
|
|
this.updataList()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}else{ //不能打折
|
|
|
// 算出比例
|
|
|
let balanceProportion = row.cardOvers*1/(row.cardOvers*1+( (row.giftSpendMoney?row.giftSpendMoney*1:0) + row.cardGiftOvers*1 )) //可用余额比例
|
|
|
let giveProportion = (row.cardGiftOvers*1 + (row.giftSpendMoney?row.giftSpendMoney*1:0))/(row.cardOvers*1+( (row.giftSpendMoney?row.giftSpendMoney*1:0) + row.cardGiftOvers*1 ))//赠送金额比例
|
|
|
balanceProportion = balanceProportion.toFixed(4)*1
|
|
|
giveProportion = giveProportion.toFixed(4)*1
|
|
|
row.cardGiftOvers = ((row.giftSpendMoney?row.giftSpendMoney*1:0) + row.cardGiftOvers*1).toFixed(2)*1 //还原赠送支付
|
|
|
row.giftSpendMoney = 0 //清空赠送支付
|
|
|
console.log('现在的赠送余额是多少----->',row.cardGiftOvers,'比例是多少--->',balanceProportion,'另外一个比例---->',giveProportion)
|
|
|
if(row.spendMoney > row.cardOvers){ // 当输入的金额大于自身可用金额时
|
|
|
this.$message.warning({ message: "支付金额不能大于可用余额" });
|
|
|
// 自动计算
|
|
|
let total = row.cardOvers + row.cardGiftOvers
|
|
|
console.log('为多少--->',row.cardOvers,row.cardGiftOvers)
|
|
|
if(total>appearPrice){ //当(可用余额加上可用赠送)大于项目金额时,按比例自动扣除
|
|
|
// row.spendMoney = (appearPrice*balanceProportion).toFixed(2)*1 //支付金额
|
|
|
// row.cardOvers = row.cardOver - row.spendMoney //可用余额= 可用余额-支付金额
|
|
|
// row.giftSpendMoney = (appearPrice*giveProportion).toFixed(2)*1 //赠送支付金额
|
|
|
row.spendMoney = (appearPrice*row.cardOver/(row.cardOver+row.cardGiftOvers)).toFixed(2)*1
|
|
|
row.cardOvers = row.cardOver - row.spendMoney //可用余额= 可用余额-支付金额
|
|
|
row.giftSpendMoney = (appearPrice*row.cardGiftOvers/(row.cardOver+row.cardGiftOvers)).toFixed(2)*1
|
|
|
row.cardGiftOvers =( row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1 //赠送剩余 = 赠送剩余-赠送支付
|
|
|
this.updataList()
|
|
|
}else{ //(可用余额跟赠送支付)小于项目金额,自动扣除全部
|
|
|
row.spendMoney = row.cardOvers //支付金额=可用余额
|
|
|
row.cardOvers = 0 //清空可用余额
|
|
|
row.giftSpendMoney = row.cardGiftOvers //赠送支付 = 赠送剩余
|
|
|
row.cardGiftOvers = 0 //清空赠送剩余
|
|
|
this.updataList()
|
|
|
}
|
|
|
}else{ //输入金额不大于自己可用余额
|
|
|
// 需要判断输入金额是否大于项目金额,如果大于项目金额,帮他自动计算,如果不大于,则还需要判断(赠送比例+余额比例)是否够支付项目金额
|
|
|
if(row.spendMoney > appearPrice){ //如果支付金额大于项目金额
|
|
|
this.$message.warning({ message: "支付金额不能大于成交金额" });
|
|
|
// 大于的话自动计算
|
|
|
// row.spendMoney = (appearPrice*balanceProportion).toFixed(2)*1 //支付金额
|
|
|
// row.cardOvers = row.cardOvers - row.spendMoney //可用余额=可用余额-支付金额
|
|
|
// row.giftSpendMoney = (appearPrice*giveProportion).toFixed(2)*1 //赠送支付金额
|
|
|
row.spendMoney = (appearPrice*row.cardOvers/(row.cardOvers + row.cardGiftOvers)).toFixed(2)*1 //本次支付
|
|
|
row.giftSpendMoney = (appearPrice*row.cardGiftOvers/(row.cardGiftOvers + row.cardOvers)).toFixed(2)*1 //本次赠送支付
|
|
|
row.cardOvers = row.cardOvers - row.spendMoney //可用余额=可用余额-支付金额
|
|
|
row.cardGiftOvers = (row.cardOvers - row.giftSpendMoney).toFixed(2)*1 //赠送剩余= 赠送剩余-赠送支付
|
|
|
this.updataList()
|
|
|
}else{ //输入的金额不大于项目金额
|
|
|
// 需要判断比例总和是否大于项目金额
|
|
|
// let giveCase = ((row.spendMoney/balanceProportion)*giveProportion).toFixed(2)*1 //按比例算出的赠送支付
|
|
|
let giveCase = 0 //按照比例需要付赠送多少钱
|
|
|
let spendMoney= (appearPrice*row.cardOvers/(row.cardOvers + row.cardGiftOvers)).toFixed(2)*1
|
|
|
giveCase = ((row.spendMoney/spendMoney)*((appearPrice*row.cardGiftOvers/(row.cardGiftOvers + row.cardOvers))).toFixed(2)*1)
|
|
|
console.log('按比例是多少----->',row.spendMoney/spendMoney,'赠送呢--->',giveCase)
|
|
|
if(((row.spendMoney*1 + giveCase)*1) > appearPrice){
|
|
|
// 如果按比例之和大于项目金额,大于的情况一定是够支付的!!!
|
|
|
this.$message.warning({ message: "支付金额大于项目金额" }); //判断误差
|
|
|
// 自动计算
|
|
|
console.log('是多少-->',row.spendMoney,'总额-->',row.cardOvers)
|
|
|
row.spendMoney = (appearPrice*row.cardOvers/(row.cardOvers + row.cardGiftOvers)).toFixed(2)*1 //支付金额
|
|
|
row.giftSpendMoney = (appearPrice*row.cardGiftOvers/(row.cardGiftOvers + row.cardOvers)).toFixed(2)*1 //赠送支付金额
|
|
|
row.cardOvers = row.cardOvers - row.spendMoney //可用余额=可用余额-支付金额
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1 //赠送剩余= 赠送剩余-赠送支付
|
|
|
this.updataList()
|
|
|
}else{ //按比例支付总和不大于项目金额
|
|
|
row.spendMoney = row.spendMoney*1
|
|
|
row.giftSpendMoney = ((appearPrice*row.cardGiftOvers/(row.cardGiftOvers + row.cardOvers))*(row.spendMoney/spendMoney)).toFixed(2)*1 //赠送支付
|
|
|
row.cardOvers = row.cardOvers - row.spendMoney //可用余额
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1 //赠送剩余
|
|
|
this.updataList()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
this.list.push({})
|
|
|
this.list.pop()
|
|
|
}else{ //先用实充,再用赠送
|
|
|
if((row.spendMoney*1) === this.spendMoney){ //上一次的值没有改变
|
|
|
console.log('现在只执行这里---->!!!')
|
|
|
row.cardOvers = (row.cardOvers - row.spendMoney).toFixed(2)*1
|
|
|
this.updataList()
|
|
|
this.list.push({})
|
|
|
this.list.pop()
|
|
|
this.spendMoney = ''
|
|
|
return
|
|
|
}
|
|
|
if(this.list[this.projectIndex].noDiscount == 0){ //可以打折
|
|
|
// 还原原先赠送以及赠送支付
|
|
|
row.cardGiftOvers = (row.cardGiftOvers + row.giftSpendMoney).toFixed(2)*1 //还原赠送剩余
|
|
|
row.giftSpendMoney = 0 //还原赠送支付
|
|
|
// 只有可用余额为0并且赠送金额存在时触发
|
|
|
if(row.cardOvers === 0 && row.cardGiftOvers){ //当可用余额为0时,扣除赠送支付
|
|
|
let discountGive = (row.cardGiftOvers/(row.discountFreeAmount?(row.discountFreeAmount*1/100):1)).toFixed(2)*1
|
|
|
if(row.spendMoney>row.cardGiftOvers){ //当输出金额大于赠送金额时
|
|
|
this.$message.warning({ message: "支付金额大于卡付赠送余额" });
|
|
|
// 判断够不够支付
|
|
|
if(discountGive>appearPrice){ //当前卡够支付
|
|
|
row.giftSpendMoney = (appearPrice*(row.discountFreeAmount?(row.discountFreeAmount*1)/100:1)).toFixed(2)*1
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - row.discountFreeAmount).toFixed(2)*1
|
|
|
row.spendMoney = 0
|
|
|
row.cardOvers = 0
|
|
|
// 不知名错误,未展示扣除,需要关闭再打开
|
|
|
this.$set(this.list[this.projectIndex],'popover',false)
|
|
|
this.$set(this.list[this.projectIndex],'popover',true)
|
|
|
this.list.push({})
|
|
|
this.list.pop()
|
|
|
return this.updataList()
|
|
|
}else{ //当前赠送余额不够支付
|
|
|
// 扣除所有
|
|
|
row.giftSpendMoney = row.cardGiftOvers
|
|
|
row.cardGiftOvers = 0
|
|
|
row.spendMoney = 0
|
|
|
row.cardOvers = 0
|
|
|
// 不知名错误,未展示扣除,需要关闭再打开
|
|
|
this.$set(this.list[this.projectIndex],'popover',false)
|
|
|
this.$set(this.list[this.projectIndex],'popover',true)
|
|
|
this.list.push({})
|
|
|
this.list.pop()
|
|
|
return this.updataList()
|
|
|
}
|
|
|
}else{ //输入金额不大于赠送余额
|
|
|
if(row.spendMoney>appearPrice){ //当输入金额大于项目金额时
|
|
|
this.$message.warning({ message: "支付金额不能大于项目金额" });
|
|
|
let discountGive = (row.cardGiftOvers/(row.discountFreeAmount?(row.discountFreeAmount*1/100):1)).toFixed(2)*1 //赠送折扣总和
|
|
|
if(discountGive>appearPrice){ //折扣赠送总和够支付项目金额
|
|
|
row.giftSpendMoney = (appearPrice*(row.discountFreeAmount?(row.discountFreeAmount*1)/100:1)).toFixed(2)*1
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1
|
|
|
row.spendMoney = 0
|
|
|
row.cardOvers = 0
|
|
|
// 不知名错误,未展示扣除,需要关闭再打开
|
|
|
this.$set(this.list[this.projectIndex],'popover',false)
|
|
|
this.$set(this.list[this.projectIndex],'popover',true)
|
|
|
this.list.push({})
|
|
|
this.list.pop()
|
|
|
return this.updataList()
|
|
|
}else{ //当前赠送余额不够支付
|
|
|
// 扣除所有
|
|
|
row.giftSpendMoney = row.cardGiftOvers
|
|
|
row.cardGiftOvers = 0
|
|
|
row.spendMoney = 0
|
|
|
row.cardOvers = 0
|
|
|
// 不知名错误,未展示扣除,需要关闭再打开
|
|
|
this.$set(this.list[this.projectIndex],'popover',false)
|
|
|
this.$set(this.list[this.projectIndex],'popover',true)
|
|
|
this.list.push({})
|
|
|
this.list.pop()
|
|
|
return this.updataList()
|
|
|
}
|
|
|
}else{ //输入金额不大于项目金额
|
|
|
let paymentAmount = row.spendMoney/(row.discountFreeAmount?((row.discountFreeAmount*1)/100):1) //当前输入的值
|
|
|
if(paymentAmount>appearPrice){ //当前卡够支付
|
|
|
this.$message.warning({ message: "赠送金额大于项目金额" });
|
|
|
row.giftSpendMoney = (appearPrice*(row.discountFreeAmount?(row.discountFreeAmount*1)/100:1)).toFixed(2)*1
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1
|
|
|
row.spendMoney = 0
|
|
|
row.cardOvers = 0
|
|
|
// 不知名错误,未展示扣除,需要关闭再打开
|
|
|
this.$set(this.list[this.projectIndex],'popover',false)
|
|
|
this.$set(this.list[this.projectIndex],'popover',true)
|
|
|
this.list.push({})
|
|
|
this.list.pop()
|
|
|
return this.updataList()
|
|
|
}else{ //当前输入的值大大于项目金额
|
|
|
row.giftSpendMoney = row.spendMoney
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1
|
|
|
row.spendMoney = 0
|
|
|
row.cardOvers = 0
|
|
|
// 不知名错误,未展示扣除,需要关闭再打开
|
|
|
this.$set(this.list[this.projectIndex],'popover',false)
|
|
|
this.$set(this.list[this.projectIndex],'popover',true)
|
|
|
this.list.push({})
|
|
|
this.list.pop()
|
|
|
return this.updataList()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
// 至于为什么不在这里updataList,未排除原因没执行到着
|
|
|
}
|
|
|
if(row.spendMoney>row.cardOvers){ //如果输入的金额大于本身余额
|
|
|
// 提示并且重新计算
|
|
|
this.$message.warning({ message: "支付金额不能大于卡付余额" });
|
|
|
// 判断折扣总和是否够支付项目金额
|
|
|
let total = (row.cardOvers/((row.discount?row.discount*1:100)/100)) + (row.cardGiftOvers/((row.discountFreeAmount?row.discountFreeAmount*1:100)/100))
|
|
|
console.log('总额为多少----->',total)
|
|
|
if(total>appearPrice){ //两个折后价格够支付项目金额
|
|
|
if( (row.cardOvers/(row.discount?(row.discount*1)/100:1)) > appearPrice ){ //再判断自身余额是否够支付项目金额
|
|
|
row.spendMoney = (appearPrice*(row.discount?(row.discount*1)/100:1)).toFixed(2)*1 // 够支付扣除它自身
|
|
|
row.cardOvers =( row.cardOvers - row.spendMoney).toFixed(2)*1 //可用余额
|
|
|
this.updataList()
|
|
|
}else{ //不够扣时,扣光自己的可用余额并且算上差价继续扣赠送金额
|
|
|
row.spendMoney = row.cardOvers
|
|
|
row.cardOvers = 0
|
|
|
let remainderCsee = appearPrice - ((row.spendMoney/row.discount)*100) //剩余支付
|
|
|
row.giftSpendMoney = remainderCsee*(row.discountFreeAmount?(row.discountFreeAmount*1)/100:1) //算出还需支付多少
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1 //赠送剩余
|
|
|
this.updataList()
|
|
|
}
|
|
|
}else{ //两个折扣价格不够支付
|
|
|
console.log('两个不够支付---')
|
|
|
row.spendMoney = row.cardOvers //支付金额
|
|
|
row.cardOvers = 0 //可用余额
|
|
|
row.giftSpendMoney = row.cardGiftOvers //赠送支付
|
|
|
row.cardGiftOvers = 0 //赠送剩余
|
|
|
this.updataList()
|
|
|
}
|
|
|
}else{ //输入金额不大于本身余额
|
|
|
console.log('没超过本身余额--->')
|
|
|
// 判断输入金额是否大于项目金额
|
|
|
if(row.spendMoney>appearPrice){ //输入金额大于项目金额
|
|
|
this.$message.warning({ message: "支付金额大于项目金额" });
|
|
|
// 重新计算
|
|
|
let total = (row.cardOvers/((row.discount?row.discount*1:100)/100)) + (row.cardGiftOvers/((row.discountFreeAmount?row.discountFreeAmount*1:100)/100))
|
|
|
console.log('总额为多少----->',total)
|
|
|
if(total>appearPrice){ //两个折后价格够支付项目金额
|
|
|
if( (row.cardOvers/(row.discount?(row.discount*1)/100:1)) > appearPrice ){ //再判断自身余额是否够支付项目金额
|
|
|
row.spendMoney = (appearPrice*(row.discount?(row.discount*1)/100:1)).toFixed(2)*1 // 够支付扣除它自身
|
|
|
row.cardOvers =( row.cardOvers - row.spendMoney).toFixed(2)*1 //可用余额
|
|
|
this.updataList()
|
|
|
}else{ //不够扣时,扣光自己的可用余额并且算上差价继续扣赠送金额
|
|
|
row.spendMoney = row.cardOvers
|
|
|
row.cardOvers = 0
|
|
|
let remainderCsee = appearPrice - ((row.spendMoney/row.discount)*100) //剩余支付
|
|
|
row.giftSpendMoney = remainderCsee*(row.discountFreeAmount?(row.discountFreeAmount*1)/100:1) //算出还需支付多少
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1 //赠送剩余
|
|
|
this.updataList()
|
|
|
}
|
|
|
}else{ //两个折扣价格不够支付
|
|
|
console.log('两个不够支付---')
|
|
|
row.spendMoney = row.cardOvers //支付金额
|
|
|
row.cardOvers = 0 //可用余额
|
|
|
row.giftSpendMoney = row.cardGiftOvers //赠送支付
|
|
|
row.cardGiftOvers = 0 //赠送剩余
|
|
|
this.updataList()
|
|
|
}
|
|
|
}else{ //输入金额不大于项目金额
|
|
|
let discountCase = (row.spendMoney/((row.discount?((row.discount*1)/100):1).toFixed(2)*1)).toFixed(2)*1//折后金额
|
|
|
console.log('折后金额是多少--->',discountCase)
|
|
|
if(discountCase>appearPrice){ //金额折扣大于项目金额
|
|
|
if((discountCase-appearPrice)>=this.balance*1)this.$message.warning({ message: "支付金额大于项目金额" }); //计算误差
|
|
|
row.spendMoney = (appearPrice*(row.discount?(row.discount*1)/100:1)).toFixed(2)*1
|
|
|
row.cardOvers =( row.cardOvers - row.spendMoney).toFixed(2)*1 //可用余额
|
|
|
this.updataList()
|
|
|
}else{ //折扣不大于项目金额
|
|
|
row.cardOvers = row.cardOvers - (row.spendMoney*1)
|
|
|
this.updataList()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}else{ //不能打折
|
|
|
row.cardGiftOvers = (row.cardGiftOvers + row.giftSpendMoney).toFixed(2)*1 //还原赠送剩余
|
|
|
row.giftSpendMoney = 0 //还原赠送支付
|
|
|
let total = row.cardOvers + row.cardGiftOvers
|
|
|
|
|
|
if(row.cardOvers === 0 && row.cardGiftOvers){ //当可用余额为0,并且可用赠送存在时触发
|
|
|
if(row.spendMoney > row.cardGiftOvers){ //支付金额大于赠送金额
|
|
|
this.$message.warning({ message: "支付金额大于卡付赠送余额" });
|
|
|
// 重新计算
|
|
|
if(row.cardGiftOvers>appearPrice){ //当前赠送够支付项目金额
|
|
|
row.spendMoney = 0
|
|
|
row.giftSpendMoney = appearPrice
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - appearPrice).toFixed(2)*1
|
|
|
// 不知名错误,未展示扣除,需要关闭再打开
|
|
|
this.$set(this.list[this.projectIndex],'popover',false)
|
|
|
this.$set(this.list[this.projectIndex],'popover',true)
|
|
|
return this.updataList()
|
|
|
}else{ //当前赠送余额不够支付项目金额
|
|
|
row.spendMoney = 0
|
|
|
row.giftSpendMoney = row.cardGiftOvers
|
|
|
row.cardGiftOvers = 0
|
|
|
// 不知名错误,未展示扣除,需要关闭再打开
|
|
|
this.$set(this.list[this.projectIndex],'popover',false)
|
|
|
this.$set(this.list[this.projectIndex],'popover',true)
|
|
|
return this.updataList()
|
|
|
}
|
|
|
}else{ //支付金额不大于赠送金额
|
|
|
if(row.spendMoney>appearPrice){ //输入金额大于项目金额
|
|
|
this.$message.warning({ message: "支付金额不能大于项目金额" });
|
|
|
// 重新计算
|
|
|
if(row.cardGiftOvers>appearPrice){ //当前赠送够支付项目金额
|
|
|
row.spendMoney = 0
|
|
|
row.giftSpendMoney = appearPrice
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - appearPrice).toFixed(2)*1
|
|
|
// 不知名错误,未展示扣除,需要关闭再打开
|
|
|
this.$set(this.list[this.projectIndex],'popover',false)
|
|
|
this.$set(this.list[this.projectIndex],'popover',true)
|
|
|
return this.updataList()
|
|
|
}else{ //当前赠送余额不够支付项目金额
|
|
|
row.spendMoney = 0
|
|
|
row.giftSpendMoney = row.cardGiftOvers
|
|
|
row.cardGiftOvers = 0
|
|
|
// 不知名错误,未展示扣除,需要关闭再打开
|
|
|
this.$set(this.list[this.projectIndex],'popover',false)
|
|
|
this.$set(this.list[this.projectIndex],'popover',true)
|
|
|
return this.updataList()
|
|
|
}
|
|
|
}else{ //输入金额不大于项目金额
|
|
|
row.giftSpendMoney = row.spendMoney*1
|
|
|
row.cardGiftOvers = (row.cardGiftOvers - row.giftSpendMoney).toFixed(2)*1
|
|
|
row.spendMoney = 0
|
|
|
// 不知名错误,未展示扣除,需要关闭再打开
|
|
|
this.$set(this.list[this.projectIndex],'popover',false)
|
|
|
this.$set(this.list[this.projectIndex],'popover',true)
|
|
|
return this.updataList()
|
|
|
}
|
|
|
}
|
|
|
// 至于为什么不在这里用return---->未排查原因没执行到这里
|
|
|
}
|
|
|
|
|
|
if(row.spendMoney > row.cardOvers){ //输入金额大于卡付余额
|
|
|
this.$message.warning({ message: "支付金额大于卡付余额" });
|
|
|
//重新计算
|
|
|
if(total > appearPrice){ //当前卡够支付项目金额
|
|
|
if(row.cardOvers > appearPrice){ //当前卡余额够支付项目金额
|
|
|
row.spendMoney = appearPrice
|
|
|
row.cardOvers = row.cardOvers - row.spendMoney
|
|
|
this.updataList()
|
|
|
}else{ //算上差价
|
|
|
row.spendMoney = row.cardOvers
|
|
|
row.cardOvers = 0
|
|
|
row.giftSpendMoney = appearPrice - row.spendMoney
|
|
|
row.cardGiftOvers = (row.giftSpendMoney).toFixed(2)*1
|
|
|
this.updataList()
|
|
|
}
|
|
|
}else{
|
|
|
//当前卡不够支付项目金额
|
|
|
row.spendMoney = row.cardOvers
|
|
|
row.cardOvers = 0
|
|
|
row.giftSpendMoney = row.cardGiftOvers
|
|
|
row.cardGiftOvers = 0
|
|
|
this.updataList()
|
|
|
}
|
|
|
}else{ //输入金额不大于卡付余额
|
|
|
if(row.spendMoney>appearPrice){ //输入金额大于项目金额
|
|
|
this.$message.warning({ message: "支付金额大于项目金额" });
|
|
|
// 重新计算
|
|
|
if(total > appearPrice){ //当前卡够支付项目金额
|
|
|
if(row.cardOvers > appearPrice){ //当前卡余额够支付项目金额
|
|
|
row.spendMoney = appearPrice
|
|
|
row.cardOvers = row.cardOvers - row.spendMoney
|
|
|
this.updataList()
|
|
|
}else{ //算上差价
|
|
|
row.spendMoney = row.cardOvers
|
|
|
row.cardOvers = 0
|
|
|
row.giftSpendMoney = appearPrice - row.spendMoney
|
|
|
row.cardGiftOvers = (row.giftSpendMoney).topPrice(2)*1
|
|
|
this.updataList()
|
|
|
}
|
|
|
}else{
|
|
|
//当前卡不够支付项目金额
|
|
|
row.spendMoney = row.cardOvers
|
|
|
row.cardOvers = 0
|
|
|
row.giftSpendMoney = row.cardGiftOvers
|
|
|
row.cardGiftOvers = 0
|
|
|
this.updataList()
|
|
|
}
|
|
|
}else{ //输入金额不大于项目金额
|
|
|
row.spendMoney = row.spendMoney*1
|
|
|
row.cardOvers =( row.cardOvers - row.spendMoney ).toFixed(2)*1
|
|
|
this.updataList()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
this.list.push({})
|
|
|
this.list.pop()
|
|
|
}
|
|
|
},
|
|
|
sumNum() {
|
|
|
let spendMoney = 0;
|
|
|
let spendNumber = 0;
|
|
|
|
|
|
this.rowRecList.forEach(item => {
|
|
|
spendMoney =
|
|
|
(
|
|
|
spendMoney +
|
|
|
(item.discoutMoney * 1 + item.discoutGiftMoney * 1) * 1
|
|
|
).toFixed(2) * 1;
|
|
|
|
|
|
spendNumber =
|
|
|
(
|
|
|
spendNumber +
|
|
|
(item.spendMoney * 1 + item.giftSpendMoney * 1) * 1
|
|
|
).toFixed(2) * 1;
|
|
|
});
|
|
|
this.recForm.collectionRechargeAmount = spendNumber.toFixed(2) * 1;
|
|
|
this.recForm.collRecAmonnt = spendMoney.toFixed(2) * 1;
|
|
|
|
|
|
this.recForm.cashAmount =
|
|
|
(
|
|
|
this.recForm.collectionCashAmount +
|
|
|
this.recForm.collRecAmonnt +
|
|
|
this.recForm.collectionIntegralAmount
|
|
|
).toFixed(2) * 1;
|
|
|
this.recForm.payLists = this.payLists;
|
|
|
this.recForm.rechargeAccountList = JSON.parse(
|
|
|
JSON.stringify(this.rowRecList)
|
|
|
);
|
|
|
this.recForm.collectionAmount =
|
|
|
(
|
|
|
spendNumber +
|
|
|
this.recForm.collectionCashAmount +
|
|
|
this.recForm.collectionIntegralAmount
|
|
|
).toFixed(2) * 1;
|
|
|
console.log(
|
|
|
"🚀 ~ file: service.vue ~ line 1213 ~ sumNum ~ this.recForm",
|
|
|
this.recForm
|
|
|
);
|
|
|
this.recForm.collectionAmounts = spendMoney
|
|
|
? spendMoney.toFixed(2) * 1
|
|
|
: 0;
|
|
|
this.recForm.rechargeAmount = spendNumber.toFixed(2) * 1;
|
|
|
this.list.splice(this.recForm.index, 1, this.recForm);
|
|
|
let rList = [];
|
|
|
this.list.forEach(item => {
|
|
|
if (item.index == this.editProIndex) {
|
|
|
let rechargeAccountList = JSON.parse(
|
|
|
JSON.stringify(item.rechargeAccountList)
|
|
|
);
|
|
|
rechargeAccountList.forEach(item => {
|
|
|
item.giftSpendMoney = 0;
|
|
|
item.spendMoney = 0;
|
|
|
rList.push(item);
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
this.recListCopy = JSON.parse(JSON.stringify(rList));
|
|
|
|
|
|
this.list.forEach(item => {
|
|
|
if (item.index != this.editProIndex) {
|
|
|
let recArr = this.setRecList(item);
|
|
|
item.rechargeAccountList.forEach((item, index) => {
|
|
|
if (item.spendMoney > 0) {
|
|
|
this.sumAmont();
|
|
|
} else {
|
|
|
item.cardOver = recArr[index].cardOvers;
|
|
|
item.cardOvers = recArr[index].cardOvers;
|
|
|
item.giftConsumeMoney = recArr[index].cardGiftOvers;
|
|
|
item.cardGiftOvers = recArr[index].cardGiftOvers;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
this.sumAmont();
|
|
|
},
|
|
|
openRec(row,idx) {
|
|
|
// // 处理多个popover只显示一次
|
|
|
this.list.forEach((item,index)=>{
|
|
|
if(idx!==index){
|
|
|
this.$set(item,'popover',false)
|
|
|
}
|
|
|
})
|
|
|
this.$nextTick(()=>{
|
|
|
row = this.handleData(row)
|
|
|
this.recListCopy.forEach((firstItem,index)=>{
|
|
|
let list = []
|
|
|
this.list.forEach(twoItem=>{
|
|
|
twoItem.rechargeAccountList.forEach(threeItem=>{
|
|
|
if(threeItem.id === firstItem.id){
|
|
|
list.push(threeItem)
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
let total = firstItem.cardGiftOvers - eval(list.map(item=>item.giftSpendMoney?item.giftSpendMoney*1:0).join("+"))
|
|
|
row.rechargeAccountList[index].cardGiftOvers =( total?total.toFixed(2)*1:0 )
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
recashData(v) {
|
|
|
this.list = v.list;
|
|
|
let Vindex = v.form.index;
|
|
|
let recList = v.form.rechargeAccountList;
|
|
|
this.list.forEach((item, index) => {
|
|
|
if (Vindex < index) {
|
|
|
recList.forEach((rec, recIndex) => {
|
|
|
if (rec.spendMoney > 0) {
|
|
|
item.rechargeAccountList[recIndex].cardOver = rec.cardOvers;
|
|
|
item.rechargeAccountList[recIndex].cardOvers = rec.cardOvers;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
this.sumAmont();
|
|
|
},
|
|
|
proBlur(row) {
|
|
|
this.projectMomey = 0;
|
|
|
if (this.cashNumber == 1 && !this.memberForm.memberName) {
|
|
|
this.$message.warning({ message: "请先选择会员 !" });
|
|
|
} else {
|
|
|
let form = {
|
|
|
pageSize: 999,
|
|
|
projectNum: row.projectNum,
|
|
|
state: 1,
|
|
|
directConsumption: 1
|
|
|
};
|
|
|
propage(form).then(res => {
|
|
|
if (res.code == "000000") {
|
|
|
if (res.pageInfo.total == 1) {
|
|
|
if (!res.pageInfo.list[0].courseAccountId) {
|
|
|
res.pageInfo.list[0].courseAccountId = null;
|
|
|
res.pageInfo.list[0].courseProjectId = res.pageInfo.list[0].id;
|
|
|
res.pageInfo.list[0].courseMoney = 0;
|
|
|
} else {
|
|
|
res.pageInfo.list[0].courseMoney =
|
|
|
res.pageInfo.list[0].courseConsumePrice;
|
|
|
}
|
|
|
this.setProOne(res.pageInfo.list[0]);
|
|
|
} else {
|
|
|
this.$message.info({ message: "请输入正确的项目编码!" });
|
|
|
}
|
|
|
} else {
|
|
|
this.$alert(res.message, "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
type: "warning",
|
|
|
center: true,
|
|
|
callback: action => {}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
openAddMember() {
|
|
|
this.$refs.addmember.show("添加");
|
|
|
},
|
|
|
getRowKeys(row) {
|
|
|
return row.index;
|
|
|
},
|
|
|
|
|
|
endEditMoney(row) {
|
|
|
// transactionPrice
|
|
|
let form = { ...row };
|
|
|
if (this.cashNumber == 1) { //是会员的情况
|
|
|
console.log('--->',row.radio)
|
|
|
if(row.radio == '2'){
|
|
|
// 会员
|
|
|
console.log('---->',form.topPriceMember,form.transactionPrice * 1,form.minumumPriceMember)
|
|
|
if (form.topPriceMember < form.transactionPrice * 1 ||form.transactionPrice * 1 < form.minumumPriceMember){
|
|
|
this.$message.error({
|
|
|
message:
|
|
|
"价格不能低于" +
|
|
|
form.minumumPriceMember +
|
|
|
"高于" +
|
|
|
form.topPriceMember
|
|
|
});
|
|
|
form.transactionPrice = this.transactionPrice;
|
|
|
} else {
|
|
|
form.amount = row.transactionPrice;
|
|
|
}
|
|
|
}else{
|
|
|
// 散客
|
|
|
if (form.topPrice < form.transactionPrice * 1 ||form.transactionPrice * 1 < form.minumumPrice){
|
|
|
this.$message.error({
|
|
|
message: "价格不能低于" + form.minumumPrice + "高于" + form.topPrice
|
|
|
});
|
|
|
form.transactionPrice = this.transactionPrice;
|
|
|
} else {
|
|
|
form.amount = row.transactionPrice;
|
|
|
}
|
|
|
}
|
|
|
} else { //不是会员
|
|
|
if (form.topPrice < form.transactionPrice * 1 ||form.transactionPrice * 1 < form.minumumPrice) {
|
|
|
this.$message.error({
|
|
|
message: "价格不能低于" + form.minumumPrice + "高于" + form.topPrice
|
|
|
});
|
|
|
form.transactionPrice = this.transactionPrice;
|
|
|
} else {
|
|
|
form.amount = row.transactionPrice;
|
|
|
}
|
|
|
}
|
|
|
this.list.splice(row.index, 1, form);
|
|
|
this.sumAmont();
|
|
|
},
|
|
|
triggerInit(text,index){
|
|
|
switch (text){
|
|
|
case 'zhonggongList': //美发师
|
|
|
this.$nextTick(()=>{
|
|
|
this.$refs['largeList'+index].$el.querySelector('input').focus() //search里面的input获得焦点
|
|
|
this.$refs['largeList'+index].toggleMenu() //自动展示
|
|
|
})
|
|
|
break;
|
|
|
case 'largeList': //美容师
|
|
|
this.$nextTick(()=>{
|
|
|
this.$refs['technicianList'+index].$el.querySelector('input').focus()
|
|
|
this.$refs['technicianList'+index].toggleMenu() //自动展示
|
|
|
})
|
|
|
break;
|
|
|
case 'technicianList': //技师
|
|
|
this.$nextTick(()=>{
|
|
|
this.$refs['smallList'+index].$el.querySelector('input').focus()
|
|
|
this.$refs['smallList'+index].toggleMenu() //自动展示
|
|
|
})
|
|
|
break;
|
|
|
case 'smallList': //助理
|
|
|
this.$nextTick(()=>{
|
|
|
this.$refs['managerList'+index].$el.querySelector('input').focus()
|
|
|
this.$refs['managerList'+index].toggleMenu() //自动展示
|
|
|
})
|
|
|
break;
|
|
|
case 'managerList': //高管
|
|
|
this.$nextTick(()=>{
|
|
|
this.$refs['adminList'+index].$el.querySelector('input').focus()
|
|
|
this.$refs['adminList'+index].toggleMenu() //自动展示
|
|
|
})
|
|
|
break;
|
|
|
case 'adminLists': //管理层
|
|
|
break;
|
|
|
}
|
|
|
},
|
|
|
handleChange(data, row, text,index) {
|
|
|
// this.$refs.zhonggongList0.blur()
|
|
|
let form = { ...row };
|
|
|
if (text == "managerList") {
|
|
|
this.managerOptions.forEach((item, index) => {
|
|
|
if (item.id == data) {
|
|
|
item.ratio = 100;
|
|
|
form[text] = [];
|
|
|
form[text].push(item);
|
|
|
form.texts = item.label;
|
|
|
}
|
|
|
});
|
|
|
} else if (text == "adminList") {
|
|
|
this.adminOptions.forEach((item, index) => {
|
|
|
if (item.id == data) {
|
|
|
item.ratio = 100;
|
|
|
form[text] = [];
|
|
|
form[text].push(item);
|
|
|
form.texts = item.label;
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
this.options.forEach((item, index) => {
|
|
|
if (item.id == data) {
|
|
|
item.ratio = 100;
|
|
|
form[text] = [];
|
|
|
form[text].push(item);
|
|
|
form.texts = item.label;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
this.list.splice(row.index, 1, form);
|
|
|
// if(data)this.triggerInit(text,index)
|
|
|
},
|
|
|
goPayDebt() {
|
|
|
this.$refs.repayment.show(this.memberForm);
|
|
|
},
|
|
|
inputMember() {
|
|
|
if (partten.phoneNum.test(this.memberForm.mobilePhone)) {
|
|
|
storeMemberOne({
|
|
|
mobilePhone: this.memberForm.mobilePhone,
|
|
|
storeId: sessionStorage.getItem("parentId")
|
|
|
}).then(res => {
|
|
|
if (res.code == "000000") {
|
|
|
this.memberForm = {...res.data};
|
|
|
this.debtMoneys = res.data.debtMoneys;
|
|
|
this.cashNumber = 1;
|
|
|
this.list = [];
|
|
|
var this_ = this;
|
|
|
this.message = res.data.label
|
|
|
// 备注是否存在,存在让其显示,不存在不让显示
|
|
|
this.message?this.$refs.message.messageShow = true:""
|
|
|
setTimeout(() => {
|
|
|
this_.$refs.reccard.show(this_.memberForm);
|
|
|
this_.$refs.course.show(this_.memberForm);
|
|
|
}, 500);
|
|
|
this.getRecCard();
|
|
|
} else {
|
|
|
if (this.cashNumber == 1) {
|
|
|
this.$alert(res.message, "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
type: "warning",
|
|
|
center: true,
|
|
|
callback: action => {}
|
|
|
});
|
|
|
this.cashNumber = 0;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
this.$message.warning({ message: "请输入正确的手机号" });
|
|
|
}
|
|
|
},
|
|
|
passcodeData(v) {
|
|
|
if (v != null) {
|
|
|
this.formData.append("file", v);
|
|
|
}
|
|
|
this.addCashConfirm();
|
|
|
},
|
|
|
//打开选择会员充值卡包弹窗
|
|
|
openPro() {
|
|
|
this.projectMomey = 0;
|
|
|
if (this.cashNumber == 1 && !this.memberForm.memberName) {
|
|
|
this.$message.warning({ message: "请先选择会员 !" });
|
|
|
} else {
|
|
|
this.$refs.project.show(1);
|
|
|
}
|
|
|
},
|
|
|
openCrad() {
|
|
|
this.$refs.project.show(this.memberForm);
|
|
|
},
|
|
|
projectData(v) {
|
|
|
console.log('是这里没错了--->',v)
|
|
|
if (!v.courseAccountId) {
|
|
|
v.courseAccountId = null;
|
|
|
v.courseProjectId = v.id;
|
|
|
v.courseMoney = 0;
|
|
|
} else {
|
|
|
v.courseMoney = v.courseConsumePrice;
|
|
|
}
|
|
|
this.list.splice(this.proIndex,1,[])
|
|
|
this.setProOne(v);
|
|
|
this.updataCollection()
|
|
|
},
|
|
|
// cashAmount
|
|
|
setProOne(row) {
|
|
|
if (row.courseAccountId == null) {
|
|
|
row.courseMoney = 0;
|
|
|
} else {
|
|
|
row.courseMoney = row.courseConsumePrice;
|
|
|
}
|
|
|
let form = {};
|
|
|
proOne({
|
|
|
id: row.courseProjectId
|
|
|
}).then(res => {
|
|
|
if (res.code == "000000") {
|
|
|
// transactionPrice
|
|
|
form = {
|
|
|
payLists: this.payLists,
|
|
|
zhonggongList: [],
|
|
|
largeList: [],
|
|
|
smallList: [],
|
|
|
technicianList: [],
|
|
|
adminList: [],
|
|
|
managerList: [],
|
|
|
commissionZhonggong: res.data.commissionZhonggong,
|
|
|
commissionTechnician: res.data.commissionTechnician,
|
|
|
commissionSmall: res.data.commissionSmall,
|
|
|
commissionLarge: res.data.commissionLarge,
|
|
|
cardCommissionZhonggong: res.data.cardCommissionZhonggong,
|
|
|
cardCommissionTechnician: res.data.cardCommissionTechnician,
|
|
|
cardCommissionSmall: res.data.cardCommissionSmall,
|
|
|
cardCommissionLarge: res.data.cardCommissionLarge,
|
|
|
achievementLarge: res.data.achievementLarge,
|
|
|
achievementSmall: res.data.achievementSmall,
|
|
|
achievementTechnician: res.data.achievementTechnician,
|
|
|
achievementZhonggong: res.data.achievementZhonggong,
|
|
|
cardAchievementLarge: res.data.cardAchievementLarge,
|
|
|
cardAchievementSmall: res.data.cardAchievementSmall,
|
|
|
cardAchievementTechnician: res.data.cardAchievementTechnician,
|
|
|
cardAchievementZhonggong: res.data.cardAchievementZhonggong,
|
|
|
projectName: res.data.projectName,
|
|
|
projectNum: res.data.projectNum,
|
|
|
courseAccountId: row.courseAccountId,
|
|
|
courseMoney:row.courseAccountId?row.price:0,
|
|
|
noDiscount: res.data.noDiscount,
|
|
|
isCardPay: res.data.isCardPay,
|
|
|
amount: res.data.transactionPrice,
|
|
|
integral: 0,
|
|
|
integralMoney: 0,
|
|
|
collectionRechargeAmount: 0,
|
|
|
collRecAmonnt: 0,
|
|
|
collectionCashAmount: 0,
|
|
|
collectionIntegralAmount: 0,
|
|
|
collectionAmount: 0,
|
|
|
projectId: res.data.id,
|
|
|
storeId: res.data.storeId,
|
|
|
storeName: res.data.storeName,
|
|
|
price: res.data.price, //散客标价
|
|
|
topPrice: res.data.topPrice, //散客最高价
|
|
|
topPriceMember: res.data.topPriceMember, //会员最高价
|
|
|
priceMember: res.data.priceMember, // 会员标价
|
|
|
minumumPrice: res.data.minumumPrice, //散客最低价
|
|
|
minumumPriceMember: res.data.minumumPriceMember, //会员最低价
|
|
|
cashNumber: this.cashNumber,
|
|
|
numberTimes: 1,
|
|
|
minumumTimes: res.data.minumumTimes,
|
|
|
sex:0
|
|
|
// radio:'2' //默认卡付
|
|
|
};
|
|
|
this.setRecList(form);
|
|
|
if (this.cashNumber == 1) {
|
|
|
if (row.courseAccountId == null) {
|
|
|
form.transactionPrice = res.data.priceMember;
|
|
|
form.amount = res.data.priceMember;
|
|
|
if (res.data.priceMember == 0) {
|
|
|
form.amount = res.data.price;
|
|
|
form.transactionPrice = res.data.price;
|
|
|
}
|
|
|
} else {
|
|
|
form.amount = row.price;
|
|
|
form.transactionPrice = row.price;
|
|
|
}
|
|
|
form.memberId = this.memberForm.id;
|
|
|
form.integral = this.memberForm.integral;
|
|
|
form.rechargeAccountList = JSON.parse(JSON.stringify(this.recListCopy));
|
|
|
if(!form.courseAccountId){ //只有不是疗程才使用
|
|
|
if(!this.recListCopy.length){
|
|
|
// 没有充值卡,散客价格
|
|
|
form.radio = '1'
|
|
|
form.transactionPrice = form.price
|
|
|
console.log('没有充值卡--->散客价格')
|
|
|
}else{
|
|
|
console.log('充值卡存在---->',form.rechargeAccountList)
|
|
|
// 充值卡存在,判断卡里还有没有余额,有余额会员价,没余额散客价
|
|
|
// 可用余额cardOvers 赠送剩余cardGiftOvers
|
|
|
let list = [{cardConsumeMoney:0,cardGiftMoney:0},{cardConsumeMoney:1,cardGiftMoney:0}]
|
|
|
form.radio = '2'
|
|
|
form.transactionPrice = form.priceMember
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
form.amount = res.data.price;
|
|
|
form.transactionPrice = res.data.price;
|
|
|
form.rechargeAccountList = [];
|
|
|
}
|
|
|
form.memberName = this.memberForm.memberName;
|
|
|
form.mobilePhone = this.memberForm.mobilePhone;
|
|
|
|
|
|
if (form.courseAccountId == null) {
|
|
|
form.cashAmount = 0;
|
|
|
form.collectionAmount = 0;
|
|
|
} else {
|
|
|
form.cashAmount = form.amount.toFixed(2) * 1;
|
|
|
form.collectionAmount = form.cashAmount;
|
|
|
}
|
|
|
if (this.list.length > 0) {
|
|
|
if (!this.list[0].projectName) {
|
|
|
this.proIndex = 0;
|
|
|
}
|
|
|
}
|
|
|
if (this.proIndex != -1) {
|
|
|
form.index = this.proIndex;
|
|
|
console.log('form.index--->',form.index)
|
|
|
this.list.splice(this.proIndex, 1, form);
|
|
|
this.expand.push(this.proIndex);
|
|
|
this.expandedRows.push(this.list[this.proIndex]);
|
|
|
this.proIndex = -1;
|
|
|
} else {
|
|
|
this.list.push(form);
|
|
|
let i = this.list.length - 1;
|
|
|
form.index = i;
|
|
|
this.expand.push(i);
|
|
|
this.expandedRows.push(this.list[i]);
|
|
|
}
|
|
|
this.updataCollection()
|
|
|
this.openRec(form);
|
|
|
this.sumAmont();
|
|
|
} else {
|
|
|
this.$alert(res.message, "查询项目明细", {
|
|
|
confirmButtonText: "确定",
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
type: "warning",
|
|
|
center: true,
|
|
|
callback: action => {}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
setRecList(form) {
|
|
|
this.recListCopy.forEach(item => {
|
|
|
item.cardGiftOvers = 0;
|
|
|
item.spendMoney = 0;
|
|
|
item.giftSpendMoney = 0;
|
|
|
item.discoutMoney = 0;
|
|
|
item.discoutGiftMoney = 0;
|
|
|
if (!item.cardOver) {
|
|
|
item.cardOver = item.cardConsumeMoney;
|
|
|
item.cardOvers = item.cardConsumeMoney;
|
|
|
}
|
|
|
if (!item.cardGiftOvers) {
|
|
|
item.cardGiftOvers = item.giftConsumeMoney;
|
|
|
}
|
|
|
if (item.type == 0) {
|
|
|
item.discountFreeAmount = 100;
|
|
|
}
|
|
|
if (item.type != 1 && form.noDiscount == 0) {
|
|
|
item.offsetMoney =
|
|
|
(item.cardConsumeMoney / (item.discount / 100)).toFixed(2) * 1;
|
|
|
if (item.type == 2) {
|
|
|
item.offsetGiftMoney = item.giftConsumeMoney;
|
|
|
} else {
|
|
|
item.offsetGiftMoney =
|
|
|
(item.giftConsumeMoney / (item.discountFreeAmount / 100)).toFixed(
|
|
|
2
|
|
|
) * 1;
|
|
|
}
|
|
|
} else {
|
|
|
item.offsetMoney = item.giftConsumeMoney + item.cardConsumeMoney;
|
|
|
item.offsetGiftMoney = 0;
|
|
|
}
|
|
|
});
|
|
|
return this.recListCopy;
|
|
|
},
|
|
|
//确定返回方法
|
|
|
confirm() {
|
|
|
let flag = true;
|
|
|
if (!this.list.length) {
|
|
|
this.$alert("项目最少需要一个", "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
type: "warning",
|
|
|
center: true,
|
|
|
callback: action => {}
|
|
|
});
|
|
|
flag = false;
|
|
|
}
|
|
|
if (this.isAddition == 1 && !this.additionDate) {
|
|
|
flag = false;
|
|
|
this.$alert("请输入补单日期", "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
type: "warning",
|
|
|
center: true,
|
|
|
callback: action => {}
|
|
|
});
|
|
|
}
|
|
|
let total = eval(this.$refs.payment.payLists.map(item=>{return item.payMoney?item.payMoney*1:0}).join("+")) //现金支付总和
|
|
|
if(this.appearPrices*1 || total){
|
|
|
if(total>this.appearPrices*1){
|
|
|
this.formData = new FormData();
|
|
|
return this.$alert(`金额多出${total-this.appearPrices*1}元`, "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
type: "warning",
|
|
|
center: true,
|
|
|
callback: action => {}
|
|
|
});
|
|
|
}else if(total<this.appearPrices*1){
|
|
|
this.formData = new FormData();
|
|
|
return this.$alert(`金额还需支付${this.appearPrices*1 - total}`, "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
type: "warning",
|
|
|
center: true,
|
|
|
callback: action => {}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
if (flag) {
|
|
|
let passShow = false;
|
|
|
this.list.forEach((item, index) => {
|
|
|
if (index == 0) {
|
|
|
item.manNumber = this.notMemberForm.manNumber
|
|
|
? this.notMemberForm.manNumber
|
|
|
: this.memberForm.manNumber;
|
|
|
item.womanNumber = this.notMemberForm.womanNumber
|
|
|
? this.notMemberForm.womanNumber
|
|
|
: this.memberForm.womanNumber;
|
|
|
let man = this.list.filter(item=>item.sex === 0)
|
|
|
let woman = this.list.filter(item=>item.sex === 1)
|
|
|
if(man.length)item.man=man.length
|
|
|
if(woman.length)item.woman = woman.length
|
|
|
}
|
|
|
if (item.courseAccountId != null) {
|
|
|
passShow = true;
|
|
|
}
|
|
|
item.rechargeAccountList.forEach(items => {
|
|
|
if (items.spendMoney > 0 || items.giftSpendMoney) {
|
|
|
passShow = true;
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
if (passShow) {
|
|
|
this.$refs.passcode.show(this.memberForm);
|
|
|
} else {
|
|
|
this.addCashConfirm();
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
|
|
|
addCashConfirm() {
|
|
|
let list = [];
|
|
|
// collectionAmount
|
|
|
this.list.forEach(item => {
|
|
|
if (item.courseAccountId == null) {
|
|
|
item.collectionCashAmount =
|
|
|
(
|
|
|
item.amount - (item.collectionAmounts?item.collectionAmounts*1:0)
|
|
|
).toFixed(2) * 1;
|
|
|
item.cashAmount =
|
|
|
(
|
|
|
item.collRecAmonnt +
|
|
|
item.collectionIntegralAmount +
|
|
|
item.collectionCashAmount
|
|
|
).toFixed(2) * 1;
|
|
|
}
|
|
|
|
|
|
item.isAddition = this.isAddition;
|
|
|
if (this.isAddition == 1) {
|
|
|
item.additionDate = this.additionDate;
|
|
|
}
|
|
|
let salesmens = [];
|
|
|
item.managerList.forEach(items => {
|
|
|
if (items.id) {
|
|
|
items.staffType = 0;
|
|
|
salesmens.push(items);
|
|
|
}
|
|
|
});
|
|
|
item.adminList.forEach(items => {
|
|
|
if (items.id) {
|
|
|
items.staffType = 1;
|
|
|
salesmens.push(items);
|
|
|
}
|
|
|
});
|
|
|
item.salesmens = salesmens;
|
|
|
let payLists = [];
|
|
|
let rechargeAccountList = [];
|
|
|
this.payLists.forEach(item => {
|
|
|
if (item.payMoney > 0) {
|
|
|
let items = {
|
|
|
payMoney: item.payMoney,
|
|
|
payId: item.payId,
|
|
|
payName: item.payName
|
|
|
};
|
|
|
payLists.push(items);
|
|
|
}
|
|
|
});
|
|
|
item.payListsCopy = this.payLists;
|
|
|
item.payLists = payLists;
|
|
|
item.rechargeAccountList.forEach(item => {
|
|
|
if (item.spendMoney > 0 || item.giftSpendMoney) {
|
|
|
rechargeAccountList.push(item);
|
|
|
}
|
|
|
});
|
|
|
item.rechargeAccountList = rechargeAccountList;
|
|
|
if (item.courseAccountId != null) {
|
|
|
item.collectionAmount = item.amount;
|
|
|
}
|
|
|
if (item.projectId) {
|
|
|
list.push(item);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
let collectionAmountsum=0
|
|
|
list.forEach(item => {
|
|
|
collectionAmountsum+=(item.collectionAmount*1+collectionAmountsum*1);
|
|
|
});
|
|
|
this.formData.append("cashListRequestList", JSON.stringify(list));
|
|
|
addCash(this.formData).then(res => {
|
|
|
if (res.code == "000000") {
|
|
|
this.$message.success({
|
|
|
message: "验证成功 , 收银" + res.message
|
|
|
});
|
|
|
this.formData = new FormData();
|
|
|
this.notData();
|
|
|
this.updataCollection()
|
|
|
} else {
|
|
|
this.payLists = this.payListsCopy;
|
|
|
this.list.forEach(item => {
|
|
|
item.collectionCashAmount = 0;
|
|
|
});
|
|
|
this.$alert("收银" + res.message, "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
type: "warning",
|
|
|
center: true,
|
|
|
callback: action => {}
|
|
|
});
|
|
|
this.formData = new FormData();
|
|
|
}
|
|
|
});
|
|
|
// }
|
|
|
},
|
|
|
openStaffRatio(row, index, text) {
|
|
|
this.editIndex = index;
|
|
|
this.$refs.staffratio.show(row, text);
|
|
|
this.$refs.staffratio.showdetele();
|
|
|
localStorage.setItem("row", JSON.stringify(row));
|
|
|
localStorage.setItem("text", text);
|
|
|
},
|
|
|
staffratioData(v) {
|
|
|
let form = this.list[this.editIndex];
|
|
|
let texts = v.text + "s";
|
|
|
form[v.text] = v.list;
|
|
|
form[texts] = v.list[0].label;
|
|
|
this.list.splice(this.editIndex, 1, form);
|
|
|
},
|
|
|
addPro() {
|
|
|
let list = {
|
|
|
projectName: "",
|
|
|
largeList: [],
|
|
|
zhonggongList: [],
|
|
|
smallList: [],
|
|
|
technicianList: [],
|
|
|
managerList: [],
|
|
|
adminList: [],
|
|
|
payLists: this.payLists,
|
|
|
rechargeAccountList: [], //卡付列表
|
|
|
collectionCashAmounts: 0,
|
|
|
collectionAmounts: 0,
|
|
|
sex:0
|
|
|
};
|
|
|
this.projectMomey = 0;
|
|
|
this.recIndex = -1;
|
|
|
this.list.push(list);
|
|
|
},
|
|
|
delPro(row) {
|
|
|
//console.log("🚀 ~ file: service.vue ~ line 1761 ~ delPro ~ row", row)
|
|
|
row.rechargeAccountList.forEach(item => {
|
|
|
item.cardOvers = item.cardOvers + item.spendMoney;
|
|
|
item.cardGiftOvers = item.cardGiftOvers + item.giftSpendMoney;
|
|
|
});
|
|
|
|
|
|
// this.czRecList(row);
|
|
|
this.list.splice(row.index, 1);
|
|
|
|
|
|
this.form.cashAmount =
|
|
|
(this.form.cashAmount - row.amount + row.cashAmount).toFixed(2) * 1;
|
|
|
this.form.collectionCashAmounts =
|
|
|
this.form.cashAmount - row.amount + row.cashAmount;
|
|
|
this.form.collectionCashAmount = this.form.collectionCashAmounts;
|
|
|
this.payLists.forEach(item => {
|
|
|
item.payMoney = 0;
|
|
|
});
|
|
|
this.sumAmont();
|
|
|
this.cardListUpdata()
|
|
|
this.updataCollection()
|
|
|
},
|
|
|
//打开选择会员弹窗
|
|
|
openMember() {
|
|
|
this.cashNumber = 1;
|
|
|
this.$refs.member.show();
|
|
|
},
|
|
|
//选中会员返回方法
|
|
|
memberData(v) {
|
|
|
this.memberForm.mobilePhone = v.mobilePhone;
|
|
|
this.inputMember();
|
|
|
},
|
|
|
reccardData(v) {},
|
|
|
courseData(v) {
|
|
|
if (!v.courseAccountId) {
|
|
|
v.courseAccountId = null;
|
|
|
v.courseProjectId = v.id;
|
|
|
v.courseMoney = 0;
|
|
|
} else {
|
|
|
v.courseMoney = v.price;
|
|
|
}
|
|
|
this.setProOne(v);
|
|
|
},
|
|
|
paymentData(v) {
|
|
|
this.form = v.form;
|
|
|
this.payLists = v.list;
|
|
|
this.sumAmont();
|
|
|
if(this.list.length){
|
|
|
this.updateNum()
|
|
|
}else{
|
|
|
let total = eval(this.$refs.payment.payLists.map(item=>{return item.payMoney?item.payMoney*1:0}).join("+"))//现金/卡付总和
|
|
|
this.numlist=[{settlementNum:total,payNum:total}]
|
|
|
}
|
|
|
this.updataCollection()
|
|
|
},
|
|
|
rowClassName({ row, rowIndex }) {
|
|
|
row.index = rowIndex;
|
|
|
},
|
|
|
|
|
|
expandSelect: function(row, expandedRows) {
|
|
|
var that = this;
|
|
|
this.expandedRows = JSON.parse(JSON.stringify(expandedRows));
|
|
|
// if (expandedRows.length) {
|
|
|
// that.expand = [];
|
|
|
// if (row) {
|
|
|
// that.expand.push(row.index);
|
|
|
// }
|
|
|
// } else {
|
|
|
// that.expand = [];
|
|
|
// }
|
|
|
},
|
|
|
//点击选中
|
|
|
rowClick(row) {
|
|
|
this.$refs.list.toggleRowExpansion(row);
|
|
|
},
|
|
|
close() {
|
|
|
this.form = {};
|
|
|
this.rowList = [];
|
|
|
this.list = [];
|
|
|
this.memberForm = {};
|
|
|
},
|
|
|
//保存确定方法
|
|
|
save() {
|
|
|
this.close();
|
|
|
},
|
|
|
//获取数据
|
|
|
async getData() {
|
|
|
this.list.forEach(item => {
|
|
|
item.payLists = [...this.payLists];
|
|
|
item.rechargeAccountList = [];
|
|
|
});
|
|
|
//判断是否是会员
|
|
|
var itemForm = this.list[0];
|
|
|
this.notMemberForm = itemForm;
|
|
|
this.cashNumber = itemForm.cashNumber;
|
|
|
if (itemForm.cashNumber == 1) {
|
|
|
//会员
|
|
|
storeMemberOne({
|
|
|
mobilePhone: itemForm.mobilePhone,
|
|
|
storeId: sessionStorage.getItem("parentId")
|
|
|
}).then(res => {
|
|
|
if (res.code == "000000") {
|
|
|
this.memberForm = res.data;
|
|
|
this.$refs.reccard.show(this.memberForm);
|
|
|
this.$refs.course.show(this.memberForm);
|
|
|
var memberIds = {
|
|
|
memberId: itemForm.memberId
|
|
|
};
|
|
|
recAccountCashList({
|
|
|
memberId: this.memberForm.id
|
|
|
}).then(res => {
|
|
|
if (res.code == "000000") {
|
|
|
this.rechargeAccountList = res.rows;
|
|
|
this.list.forEach(item => {
|
|
|
item.rechargeAccountList = this.rechargeAccountList;
|
|
|
});
|
|
|
} else {
|
|
|
this.$alert(res.message, "查询会员卡包", {
|
|
|
confirmButtonText: "确定",
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
type: "warning",
|
|
|
center: true,
|
|
|
callback: action => {}
|
|
|
});
|
|
|
}
|
|
|
//查询当前会员下的所有项目疗程 如果有相对应的项目 就给courseAccountId赋值 没有的话 就是卡付现付
|
|
|
couAccountList(memberIds).then(res => {
|
|
|
if (res.code == "000000") {
|
|
|
if (res.rows.length != 0) {
|
|
|
this.list.forEach(items1 => {
|
|
|
res.rows.forEach(items => {
|
|
|
items.number = items.courseConsumeCount;
|
|
|
if (
|
|
|
items.courseProjectId == items1.projectId &&
|
|
|
items.number > 0
|
|
|
) {
|
|
|
if (items1.courseAccountId == null) {
|
|
|
items1.courseAccountId = items.id;
|
|
|
items.number = items.number * 1 - 1;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
this.$alert(res.message, "查询会员疗程", {
|
|
|
confirmButtonText: "确定",
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
type: "warning",
|
|
|
center: true,
|
|
|
callback: action => {}
|
|
|
});
|
|
|
}
|
|
|
let list = [];
|
|
|
this.list.forEach((itemList, index) => {
|
|
|
var itemLists = {
|
|
|
index: index,
|
|
|
id: itemList.id,
|
|
|
largeList: itemList.largeList,
|
|
|
zhonggongList: itemList.zhonggongList,
|
|
|
smallList: itemList.smallList,
|
|
|
technicianList: itemList.technicianList,
|
|
|
adminList: [],
|
|
|
managerList: [],
|
|
|
projectName: itemList.projectName,
|
|
|
payLists: itemList.payLists,
|
|
|
rechargeAccountList: this.setRecList(itemList),
|
|
|
courseAccountId: itemList.courseAccountId,
|
|
|
amount: itemList.transactionPrice,
|
|
|
noDiscount: itemList.noDiscount,
|
|
|
integral: 0,
|
|
|
integralMoney: 0,
|
|
|
payMoneys: 0,
|
|
|
spendMoneys: 0,
|
|
|
collectionRechargeAmount: 0,
|
|
|
collRecAmonnt: 0,
|
|
|
collectionCashAmount: 0,
|
|
|
collectionIntegralAmount: 0,
|
|
|
collectionAmount: 0,
|
|
|
projectId: itemList.projectId,
|
|
|
projectName: itemList.projectName,
|
|
|
memberName: itemList.memberName,
|
|
|
memberId: itemList.memberId,
|
|
|
cashNum: itemList.cashNum,
|
|
|
isCardPay: itemList.isCardPay,
|
|
|
storeName: itemList.storeName,
|
|
|
price: itemList.price,
|
|
|
priceMember: itemList.priceMember,
|
|
|
minumumPrice: itemList.minumumPrice,
|
|
|
minumumPriceMember: itemList.minumumPriceMember,
|
|
|
topPrice: itemList.topPrice,
|
|
|
topPriceMember: itemList.topPriceMember,
|
|
|
storeId: itemList.storeId,
|
|
|
transactionPrice: itemList.transactionPrice,
|
|
|
cashNumber: itemList.cashNumber,
|
|
|
numberTimes: 1,
|
|
|
mobilePhone: itemList.mobilePhone,
|
|
|
minumumTimes: itemList.minumumTimes,
|
|
|
commissionZhonggong: itemList.commissionZhonggong,
|
|
|
commissionTechnician: itemList.commissionTechnician,
|
|
|
commissionSmall: itemList.commissionSmall,
|
|
|
commissionLarge: itemList.commissionLarge,
|
|
|
cardCommissionZhonggong: itemList.cardCommissionZhonggong,
|
|
|
cardCommissionTechnician: itemList.cardCommissionTechnician,
|
|
|
cardCommissionSmall: itemList.cardCommissionSmall,
|
|
|
cardCommissionLarge: itemList.cardCommissionLarge,
|
|
|
achievementLarge: itemList.achievementLarge,
|
|
|
achievementSmall: itemList.achievementSmall,
|
|
|
achievementTechnician: itemList.achievementTechnician,
|
|
|
achievementZhonggong: itemList.achievementZhonggong,
|
|
|
cardAchievementLarge: itemList.cardAchievementLarge,
|
|
|
cardAchievementSmall: itemList.cardAchievementSmall,
|
|
|
cardAchievementTechnician:
|
|
|
itemList.cardAchievementTechnician,
|
|
|
cardAchievementZhonggong: itemList.cardAchievementZhonggong
|
|
|
};
|
|
|
|
|
|
if (itemLists.courseAccountId == null) {
|
|
|
itemLists.cashAmount = 0;
|
|
|
itemLists.collectionAmount = 0;
|
|
|
itemLists.courseMoney = 0;
|
|
|
} else {
|
|
|
itemLists.cashAmount = itemLists.amount;
|
|
|
itemLists.collectionAmount = itemLists.amount;
|
|
|
|
|
|
itemLists.courseMoney = itemLists.transactionPrice;
|
|
|
}
|
|
|
list.push(itemLists);
|
|
|
});
|
|
|
this.list = list;
|
|
|
this.setList();
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
//不是会员
|
|
|
let list = [];
|
|
|
this.list.forEach((itemList, index) => {
|
|
|
var itemLists = {
|
|
|
index: index,
|
|
|
id: itemList.id,
|
|
|
largeList: itemList.largeList,
|
|
|
zhonggongList: itemList.zhonggongList,
|
|
|
smallList: itemList.smallList,
|
|
|
technicianList: itemList.technicianList,
|
|
|
adminList: [],
|
|
|
managerList: [],
|
|
|
projectName: itemList.projectName,
|
|
|
payLists: itemList.payLists,
|
|
|
rechargeAccountList: this.rechargeAccountList,
|
|
|
courseAccountId: itemList.courseAccountId,
|
|
|
amount: itemList.transactionPrice,
|
|
|
integral: 0,
|
|
|
integralMoney: 0,
|
|
|
cashAmount: 0,
|
|
|
payMoneys: 0,
|
|
|
spendMoneys: 0,
|
|
|
noDiscount: itemList.noDiscount,
|
|
|
collectionRechargeAmount: 0,
|
|
|
collRecAmonnt: 0,
|
|
|
collectionCashAmount: 0,
|
|
|
collectionAmount: 0,
|
|
|
projectId: itemList.projectId,
|
|
|
isCardPay: itemList.isCardPay,
|
|
|
projectName: itemList.projectName,
|
|
|
memberName: itemList.memberName,
|
|
|
cashNum: itemList.cashNum,
|
|
|
storeName: itemList.storeName,
|
|
|
price: itemList.price,
|
|
|
priceMember: itemList.priceMember,
|
|
|
minumumPrice: itemList.minumumPrice,
|
|
|
minumumPriceMember: itemList.minumumPriceMember,
|
|
|
topPrice: itemList.topPrice,
|
|
|
topPriceMember: itemList.topPriceMember,
|
|
|
storeId: itemList.storeId,
|
|
|
transactionPrice: itemList.transactionPrice,
|
|
|
cashNumber: itemList.cashNumber,
|
|
|
numberTimes: 1,
|
|
|
mobilePhone: itemList.mobilePhone,
|
|
|
minumumTimes: itemList.minumumTimes,
|
|
|
commissionZhonggong: itemList.commissionZhonggong,
|
|
|
commissionTechnician: itemList.commissionTechnician,
|
|
|
commissionSmall: itemList.commissionSmall,
|
|
|
commissionLarge: itemList.commissionLarge,
|
|
|
cardCommissionZhonggong: itemList.cardCommissionZhonggong,
|
|
|
cardCommissionTechnician: itemList.cardCommissionTechnician,
|
|
|
cardCommissionSmall: itemList.cardCommissionSmall,
|
|
|
cardCommissionLarge: itemList.cardCommissionLarge,
|
|
|
achievementLarge: itemList.achievementLarge,
|
|
|
achievementSmall: itemList.achievementSmall,
|
|
|
achievementTechnician: itemList.achievementTechnician,
|
|
|
achievementZhonggong: itemList.achievementZhonggong,
|
|
|
cardAchievementLarge: itemList.cardAchievementLarge,
|
|
|
cardAchievementSmall: itemList.cardAchievementSmall,
|
|
|
cardAchievementTechnician: itemList.cardAchievementTechnician,
|
|
|
cardAchievementZhonggong: itemList.cardAchievementZhonggong
|
|
|
};
|
|
|
list.push(itemLists);
|
|
|
});
|
|
|
this.list = list;
|
|
|
this.setList();
|
|
|
}
|
|
|
},
|
|
|
setList() {
|
|
|
this.list.forEach(item => {
|
|
|
item.editNumber = 1;
|
|
|
if (item.largeList.length != 0) {
|
|
|
item.largeLists =
|
|
|
item.largeList[0].brandNumber + "-" + item.largeList[0].staffName;
|
|
|
item.largeList[0].ratio = 100;
|
|
|
} else {
|
|
|
item.largeLists = "";
|
|
|
}
|
|
|
if (item.zhonggongList.length != 0) {
|
|
|
item.zhonggongLists =
|
|
|
item.zhonggongList[0].brandNumber +
|
|
|
"-" +
|
|
|
item.zhonggongList[0].staffName;
|
|
|
item.zhonggongList[0].ratio = 100;
|
|
|
} else {
|
|
|
item.zhonggongLists = "";
|
|
|
}
|
|
|
if (item.smallList.length != 0) {
|
|
|
item.smallLists =
|
|
|
item.smallList[0].brandNumber + "-" + item.smallList[0].staffName;
|
|
|
item.smallList[0].ratio = 100;
|
|
|
} else {
|
|
|
item.smallLists = "";
|
|
|
}
|
|
|
if (item.technicianList.length != 0) {
|
|
|
item.technicianLists =
|
|
|
item.technicianList[0].brandNumber +
|
|
|
"-" +
|
|
|
item.technicianList[0].staffName;
|
|
|
item.technicianList[0].ratio = 100;
|
|
|
} else {
|
|
|
item.technicianLists = "";
|
|
|
}
|
|
|
if (item.adminList.length != 0) {
|
|
|
item.adminLists =
|
|
|
item.adminList[0].brandNumber + "-" + item.adminList[0].staffName;
|
|
|
item.adminList[0].ratio = 100;
|
|
|
} else {
|
|
|
item.adminLists = "";
|
|
|
}
|
|
|
if (item.managerList.length != 0) {
|
|
|
item.managerLists =
|
|
|
item.managerList[0].brandNumber +
|
|
|
"-" +
|
|
|
item.managerList[0].staffName;
|
|
|
item.managerList[0].ratio = 100;
|
|
|
} else {
|
|
|
item.managerLists = "";
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
|
|
|
goBack() {
|
|
|
if (this.isAddition == 0) {
|
|
|
this.orderNumber = 1;
|
|
|
this.isAddition = 1;
|
|
|
this.additionDate = this.formatTime(new Date(), "YYYY-MM-DD");
|
|
|
} else {
|
|
|
this.orderNumber = 0;
|
|
|
this.isAddition = 0;
|
|
|
}
|
|
|
},
|
|
|
getRecCard() {
|
|
|
recAccountCashList({
|
|
|
memberId: this.memberForm.id
|
|
|
}).then(res => {
|
|
|
if (res.code == "000000") {
|
|
|
this.rechargeAccountList = res.rows;
|
|
|
this.recListCopy = JSON.parse(JSON.stringify(res.rows));
|
|
|
this.cardList = res.rows
|
|
|
this.cardListUpdata()
|
|
|
this.list.forEach(item => {
|
|
|
item.rechargeAccountList = this.rechargeAccountList;
|
|
|
});
|
|
|
this.addPro();
|
|
|
} else {
|
|
|
this.$alert(res.message, "查询会员卡包", {
|
|
|
confirmButtonText: "确定",
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
type: "warning",
|
|
|
center: true,
|
|
|
callback: action => {}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
this.getCt();
|
|
|
},
|
|
|
getDetail() {
|
|
|
selectListType({ type: 0 }).then(res => {
|
|
|
if (res.code == "000000") {
|
|
|
res.rows.forEach(item => {
|
|
|
item.label = item.brandNumber + "-" + item.staffName;
|
|
|
item.ratio = 100;
|
|
|
delete item.state;
|
|
|
});
|
|
|
|
|
|
this.adminOptions = res.rows;
|
|
|
} else {
|
|
|
this.$alert(res.message, "加载员工提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
type: "warning",
|
|
|
center: true,
|
|
|
callback: action => {}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
QuerCompetent({ type: 0, pageSize: 999 }).then(res => {
|
|
|
if (res.code == "000000") {
|
|
|
res.pageInfo.list.forEach(item => {
|
|
|
item.label = item.brandNumber + "-" + item.staffName;
|
|
|
item.ratio = 100;
|
|
|
delete item.state;
|
|
|
});
|
|
|
this.managerOptions = res.pageInfo.list;
|
|
|
} else {
|
|
|
this.$alert(res.message, "加载高管提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
type: "warning",
|
|
|
center: true,
|
|
|
callback: action => {}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
selectList({ id: "" }).then(res => {
|
|
|
if (res.code == "000000") {
|
|
|
res.rows.forEach(item => {
|
|
|
item.label = item.brandNumber + "-" + item.staffName;
|
|
|
delete item.state;
|
|
|
item.ratio = 100;
|
|
|
});
|
|
|
this.options = Array.from(new Set(res.rows));
|
|
|
} else {
|
|
|
this.$alert(res.message, "加载员工列表", {
|
|
|
confirmButtonText: "确定",
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
type: "warning",
|
|
|
center: true,
|
|
|
callback: action => {}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
this.getCt();
|
|
|
this.updateNum()
|
|
|
},
|
|
|
getCt() {
|
|
|
ctlist({
|
|
|
state: 1
|
|
|
}).then(res => {
|
|
|
if (res.code == "000000") {
|
|
|
res.rows.forEach(item => {
|
|
|
item.payMoney = 0;
|
|
|
item.payId = item.id;
|
|
|
item.payName = item.collectionTypeName;
|
|
|
});
|
|
|
this.payLists = JSON.parse(JSON.stringify(res.rows));
|
|
|
this.copyPayList = JSON.parse(JSON.stringify(res.rows));
|
|
|
this.list.forEach(item => {
|
|
|
item.payLists = this.payLists;
|
|
|
item.rechargeAccountList = [];
|
|
|
});
|
|
|
this.form = {
|
|
|
collectionCashAmount: 0,
|
|
|
cashAmount: 0
|
|
|
};
|
|
|
this.sumAmont();
|
|
|
} else {
|
|
|
this.$alert(res.message, "加载现付列表", {
|
|
|
confirmButtonText: "确定",
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
type: "warning",
|
|
|
center: true,
|
|
|
callback: action => {}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
// cashAmount
|
|
|
sumAmont() {
|
|
|
let money = 0;
|
|
|
var payMoneys = 0;
|
|
|
this.payLists.forEach(item => {
|
|
|
payMoneys += item.payMoney;
|
|
|
});
|
|
|
if (this.form.collectionCashAmount <= 0) {
|
|
|
this.list.forEach(item => {
|
|
|
item.collectionCashAmount = 0;
|
|
|
if (item.rechargeAmount) {
|
|
|
item.collectionAmount =
|
|
|
(
|
|
|
item.rechargeAmount +
|
|
|
item.collectionIntegralAmount +
|
|
|
item.collectionCashAmount
|
|
|
).toFixed(2) * 1;
|
|
|
} else {
|
|
|
item.collectionAmount =
|
|
|
(
|
|
|
item.collectionIntegralAmount + item.collectionCashAmount
|
|
|
).toFixed(2) * 1;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
let collectionRechargeAmountg = 0;
|
|
|
this.list.forEach(item => {
|
|
|
let debtMoney = 0;
|
|
|
|
|
|
if (item.amount && item.courseAccountId == null) {
|
|
|
debtMoney =
|
|
|
(
|
|
|
item.amount -
|
|
|
item.collectionCashAmount -
|
|
|
item.collRecAmonnt -
|
|
|
item.collectionIntegralAmount
|
|
|
).toFixed(2) * 1;
|
|
|
money += debtMoney;
|
|
|
}
|
|
|
collectionRechargeAmountg =collectionRechargeAmountg+
|
|
|
(item.collectionRechargeAmount.toFixed(2) * 1);
|
|
|
|
|
|
});
|
|
|
|
|
|
// 总付金额计算
|
|
|
// this.form.cashAmount =
|
|
|
// money.toFixed(2) * 1 + collectionRechargeAmountg.toFixed(2) * 1;
|
|
|
// this.form.collectionCashAmounts = money.toFixed(2) * 1;
|
|
|
this.form.cashAmount = this.total
|
|
|
this.form.collectionCashAmounts = this.appearPrices
|
|
|
this.list.forEach(item => {
|
|
|
if (
|
|
|
this.form.cashAmount == this.form.collectionCashAmount &&
|
|
|
item.courseAccountId == null
|
|
|
) {
|
|
|
item.collectionCashAmount =
|
|
|
(
|
|
|
item.amount -
|
|
|
item.collRecAmonnt -
|
|
|
item.collectionIntegralAmount
|
|
|
).toFixed(2) * 1;
|
|
|
}
|
|
|
if (item.rechargeAmount) {
|
|
|
item.collectionAmount =
|
|
|
(
|
|
|
item.rechargeAmount +
|
|
|
item.collectionIntegralAmount +
|
|
|
item.collectionCashAmount
|
|
|
).toFixed(2) * 1;
|
|
|
} else {
|
|
|
item.collectionAmount =
|
|
|
(item.collectionIntegralAmount + item.collectionCashAmount).toFixed(
|
|
|
2
|
|
|
) * 1;
|
|
|
}
|
|
|
});
|
|
|
this.form.debtMoney =
|
|
|
(this.form.cashAmount - this.form.collectionCashAmount).toFixed(2) * 1;
|
|
|
this.form.cashAmount
|
|
|
var that = this;
|
|
|
that.$nextTick(() => {
|
|
|
that.$refs.payment.show(that.form, that.payLists);
|
|
|
});
|
|
|
},
|
|
|
//数组按对应字段合计返回方法
|
|
|
getSummaries(param) {
|
|
|
const { columns, data } = param;
|
|
|
const sums = [];
|
|
|
columns.forEach((column, index) => {
|
|
|
if (index === 0) {
|
|
|
sums[index] = "合计";
|
|
|
return;
|
|
|
}
|
|
|
const values = data.map(item => Number(item[column.property]));
|
|
|
if (column.property == "discoutMoney") {
|
|
|
sums[index] = values.reduce((prev, curr) => {
|
|
|
const value = Number(curr);
|
|
|
if (!isNaN(value)) {
|
|
|
return (prev + curr).toFixed(2) * 1;
|
|
|
} else {
|
|
|
sums[index] = "--";
|
|
|
}
|
|
|
}, 0);
|
|
|
sums[index] += " ";
|
|
|
} else if (column.property == "spendMoney") {
|
|
|
sums[index] = values.reduce((prev, curr) => {
|
|
|
const value = Number(curr);
|
|
|
if (!isNaN(value)) {
|
|
|
return (prev + curr).toFixed(2) * 1;
|
|
|
} else {
|
|
|
sums[index] = "--";
|
|
|
}
|
|
|
}, 0);
|
|
|
sums[index] += " ";
|
|
|
} else {
|
|
|
sums[index] = "--";
|
|
|
}
|
|
|
});
|
|
|
return sums;
|
|
|
},
|
|
|
notData() {
|
|
|
Object.assign(this.$data, this.$options.data.call(this));
|
|
|
var that = this;
|
|
|
setTimeout(() => {
|
|
|
that.$nextTick(() => {
|
|
|
that.$refs.payment.show(that.form, that.payLists);
|
|
|
if (that.$refs.course) {
|
|
|
that.$refs.course.show();
|
|
|
}
|
|
|
if (that.$refs.reccard) {
|
|
|
that.$refs.reccard.show();
|
|
|
}
|
|
|
});
|
|
|
}, 500);
|
|
|
this.setPage();
|
|
|
this.updataCollection()
|
|
|
},
|
|
|
setPage() {
|
|
|
this.getDetail();
|
|
|
}
|
|
|
},
|
|
|
activated() {
|
|
|
this.setPage();
|
|
|
},
|
|
|
beforeRouteEnter(to,from,next){
|
|
|
if(from){
|
|
|
if(window.service == 'false'){
|
|
|
next(vm=>Object.assign(vm.$data, vm.$options.data.call(vm)))
|
|
|
window.service = 'true'
|
|
|
}
|
|
|
}
|
|
|
console.log(window.service)
|
|
|
next()
|
|
|
},
|
|
|
created() {
|
|
|
this.notData()
|
|
|
},
|
|
|
// services
|
|
|
beforeRouteLeave(to, from, next) {
|
|
|
// 导航离开该组件的对应路由时调用
|
|
|
if (to.name == "services") {
|
|
|
//前往详情页面时缓存页面
|
|
|
from.meta.keepAlive = true;
|
|
|
} else {
|
|
|
// 是去 C 页面,缓存
|
|
|
from.meta.keepAlive = false;
|
|
|
}
|
|
|
next();
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
.box-flex{
|
|
|
display: flex;
|
|
|
width: 100%;
|
|
|
justify-content: space-between;
|
|
|
}
|
|
|
.flexA{
|
|
|
width: 90%;
|
|
|
overflow-x: auto;
|
|
|
display: -webkit-box;
|
|
|
-webkit-overflow-scrolling: touch;
|
|
|
display: flex;
|
|
|
}
|
|
|
.flexB{
|
|
|
text-align: center;
|
|
|
width: 8%;
|
|
|
}
|
|
|
.right{
|
|
|
margin-top: 15px;
|
|
|
padding: 0 40px 10px 0;
|
|
|
font-size: 12px;
|
|
|
line-height: 12px;
|
|
|
box-sizing: border-box;
|
|
|
border: 1px solid #ccc;
|
|
|
background: white;
|
|
|
border-radius: 10px;
|
|
|
height: 0.9rem;
|
|
|
width: 200px;
|
|
|
}
|
|
|
.el-icon-edit-outline {
|
|
|
padding-left: 5px;
|
|
|
}
|
|
|
|
|
|
.imgss {
|
|
|
width: 160px;
|
|
|
height: 60px;
|
|
|
border: 1px solid #333;
|
|
|
}
|
|
|
|
|
|
.esign {
|
|
|
border: #333 1px solid;
|
|
|
}
|
|
|
|
|
|
.el-form-item {
|
|
|
margin-bottom: 5px;
|
|
|
}
|
|
|
</style>
|