|
|
<template>
|
|
|
<div>
|
|
|
<el-form inline lable-width="100px" :modal="memberForm">
|
|
|
<el-form-item label="手机号码:" @submit.native.prevent>
|
|
|
<div class="form-width text-cyan flex justify-start align-center">
|
|
|
<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-button v-if="cashNumber === 1" @click="refundApplication" style="height: 0.2rem;">退款申请</el-button>
|
|
|
</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 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-column show-overflow-tooltip min-width="160" 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="120" align="center" prop="projectName" label="项目名称">
|
|
|
</el-table-column>
|
|
|
<el-table-column show-overflow-tooltip min-width="140" align="center" prop="anotherName" label="别名">
|
|
|
<template slot-scope="scope">
|
|
|
<el-input v-model="scope.row.anotherName"></el-input>
|
|
|
</template>
|
|
|
</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="100" align="center" label="次数">
|
|
|
<template slot-scope="scope">
|
|
|
<span>
|
|
|
{{ scope.row.numberTimes ? scope.row.numberTimes : scope.row.projectName ? 1 : '' }}
|
|
|
</span>
|
|
|
</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="100" 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' trigger="click">
|
|
|
<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 v-if="useRecharge == 3" align="center" prop="spendMoney" label="本次支付" width="90">
|
|
|
<!-- 分开扣 -->
|
|
|
<template slot-scope="scope">
|
|
|
<div class="form-input-width" v-if="recIndex != scope.$index"
|
|
|
@click="editPaycard(scope.row, scope.$index)">
|
|
|
{{ scope.row.spendMoney }}
|
|
|
<i class="text-cyan el-icon-edit"></i>
|
|
|
</div>
|
|
|
<el-input v-else v-focus type="number" size="samll" class="form-input-width"
|
|
|
@blur="endEditPaycard(scope.row, scope.$index)" v-model="scope.row.spendMoney"></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column v-else 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>
|
|
|
<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">
|
|
|
<template slot-scope="scope">
|
|
|
<div v-if="useRecharge == 3">
|
|
|
<div class="form-input-width" v-if="giveIndex != scope.$index"
|
|
|
@click="editGivecard(scope.row, scope.$index)">
|
|
|
{{ scope.row.giftSpendMoney }}
|
|
|
<i class="text-cyan el-icon-edit"></i>
|
|
|
</div>
|
|
|
<el-input v-else v-focus type="number" size="samll" class="form-input-width"
|
|
|
@blur="endEditGivecard(scope.row, scope.$index)"
|
|
|
v-model="scope.row.giftSpendMoney"></el-input>
|
|
|
</div>
|
|
|
<div v-else>
|
|
|
{{ scope.row.giftSpendMoney }}
|
|
|
</div>
|
|
|
</template>
|
|
|
</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" type="primary">充值卡</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">
|
|
|
<!-- @keyup.enter.native="selectBlur(scope.row.zhonggongLists,'zhonggongList',scope.$index)"
|
|
|
-->
|
|
|
<el-select filterable default-first-option clearable @clear="clear(scope.row, 'zhonggongList')"
|
|
|
v-model="scope.row.zhonggongLists" placeholder="请选择" :ref="'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">
|
|
|
<!-- @keyup.enter.native="selectBlur(scope.row.largeLists,'largeList',scope.$index)"
|
|
|
-->
|
|
|
<el-select filterable default-first-option clearable :ref="'largeList' + scope.$index"
|
|
|
@clear="clear(scope.row, 'largeList')" 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">
|
|
|
<!-- @keyup.enter.native="selectBlur(scope.row.technicianLists,'technicianList',scope.$index)"
|
|
|
-->
|
|
|
<el-select filterable default-first-option clearable @clear="clear(scope.row, 'technicianLists')"
|
|
|
v-model="scope.row.technicianLists" placeholder="请选择" :ref="'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">
|
|
|
<!--
|
|
|
@keyup.enter.native="selectBlur(scope.row.smallLists,'smallList',scope.$index)" -->
|
|
|
<el-select filterable default-first-option clearable @clear="clear(scope.row, 'smallLists')"
|
|
|
v-model="scope.row.smallLists" placeholder="请选择" :ref="'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">
|
|
|
<!-- @keyup.enter.native="selectBlur(scope.row.managerLists,'managerList',scope.$index)" -->
|
|
|
<el-select filterable default-first-option clearable @clear="clear(scope.row, 'managerLists')"
|
|
|
v-model="scope.row.managerLists" placeholder="请选择" :ref="'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">
|
|
|
<!--
|
|
|
@keyup.enter.native="selectBlur(scope.row.adminLists,'adminList',scope.$index)" -->
|
|
|
<el-select filterable default-first-option clearable @clear="clear(scope.row, 'adminLists')"
|
|
|
v-model="scope.row.adminLists" placeholder="请选择" :ref="'adminList' + scope.$index"
|
|
|
@change="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>
|
|
|
</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="120px" align="center" label="卡名" prop="rechargeTypeName">
|
|
|
</el-table-column>
|
|
|
<el-table-column show-overflow-tooltip min-width="60px" 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="70">
|
|
|
<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="70">
|
|
|
<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="70" 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="70" 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="70" label="充值">
|
|
|
<template slot-scope="scope">
|
|
|
{{ scope.row.numRemainder + '' }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column show-overflow-tooltipprojectData align="center" min-width="70" 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-rigth">
|
|
|
<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" :isAdd="true"></project>
|
|
|
<repayment ref="repayment" @repaymentData="inputMember"></repayment>
|
|
|
<addmember ref="addmember" @addUserConfirm="addUserConfirm"></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'/>
|
|
|
<printform ref="printform" />
|
|
|
<refund ref="refund"/>
|
|
|
</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 refund from './refund.vue'
|
|
|
import {
|
|
|
selectList,
|
|
|
selectListType,
|
|
|
storeMemberOne,
|
|
|
ctlist,
|
|
|
proOne,
|
|
|
addCash,
|
|
|
cashListByStore,
|
|
|
QuerCompetent,
|
|
|
getMemberPageNew
|
|
|
} 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 printform from './detail/printform.vue'
|
|
|
export default {
|
|
|
name: "services",
|
|
|
mixins: [Mixins],
|
|
|
components: {
|
|
|
member,
|
|
|
reccard,
|
|
|
course,
|
|
|
payment,
|
|
|
staffratio,
|
|
|
passcode,
|
|
|
project,
|
|
|
addmember,
|
|
|
repayment,
|
|
|
recash,
|
|
|
orders,
|
|
|
message,
|
|
|
captcha,
|
|
|
printform,
|
|
|
refund
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
giveIndex: null,
|
|
|
keyIndex: undefined,
|
|
|
refText: "",
|
|
|
numberTimes: 1,
|
|
|
formMoneys: {},
|
|
|
cardList: [],
|
|
|
numlist: [{ settlementNum: 0, payNum: 0 }],
|
|
|
message: "",
|
|
|
pickerOptions: {
|
|
|
disabledDate(time) {
|
|
|
// return time.getTime() > Date.now();
|
|
|
let date = new Date()
|
|
|
let month = date.getMonth() + 1 //当前月份
|
|
|
let year = date.getFullYear() //当前年份
|
|
|
let strDate = date.getDate() //当前日
|
|
|
if (month == 1) { //跨年
|
|
|
month = 12
|
|
|
year -= 1
|
|
|
} else {
|
|
|
month -= 1
|
|
|
}
|
|
|
let days = new Date(year, month, 0).getDate() //上个月一共多少天
|
|
|
let num = (strDate + days - 1) //上月至今
|
|
|
const day = num * 24 * 3600 * 1000
|
|
|
return time.getTime() > Date.now() || time.getTime() < (Date.now() - 8.64e7) - day
|
|
|
}
|
|
|
},
|
|
|
useRecharge: JSON.parse(sessionStorage.getItem("sessionStorageData")).useRecharge * 1,
|
|
|
balance: JSON.parse(sessionStorage.getItem("sessionStorageData")).balance * 1,
|
|
|
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: {
|
|
|
getMonDayTotal() {
|
|
|
return 30
|
|
|
},
|
|
|
isApartDeduct() {
|
|
|
|
|
|
},
|
|
|
// 现付金额
|
|
|
appearPrices() {
|
|
|
/*
|
|
|
现付金额 = 项目金额transactionPrice - 卡付抵扣金额collectionAmounts
|
|
|
需要转换下number格式,不然是字符串拼接
|
|
|
*/
|
|
|
let num = this.list.reduce((pre, 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: {
|
|
|
refundApplication(){
|
|
|
this.$refs.refund.show(this.memberForm)
|
|
|
},
|
|
|
// 卡打折处理
|
|
|
editPaycard(row, index) {
|
|
|
// 本次支付spendMoney 可用金额cardConsumeMoney 可用余额cardOvers 可用折扣discount 赠送折扣discountFreeAmount 赠送支付giftSpendMoney 赠送剩余cardGiftOvers
|
|
|
this.recIndex = index
|
|
|
let discount = row.discount ? row.discount / 100 : 1 //赠送折扣
|
|
|
let appearPrice = this.list[this.projectIndex].transactionPrice - (this.list[this.projectIndex].collectionAmounts ? this.list[this.projectIndex].collectionAmounts * 1 : 0)//本次需要支付多少
|
|
|
let total = (row.cardOvers / discount).toFixed(2) * 1 //总价
|
|
|
if (row.spendMoney) {
|
|
|
row.cardOvers += row.spendMoney
|
|
|
row.spendMoney = 0
|
|
|
this.updataList()
|
|
|
return
|
|
|
}
|
|
|
if (this.list[this.projectIndex].noDiscount == 0) { // 可以打折
|
|
|
if (total > appearPrice) { //够支付够支付本次项目
|
|
|
row.spendMoney = (appearPrice * discount).toFixed(2) * 1
|
|
|
} else { //不够支付本次项目
|
|
|
row.spendMoney = row.cardOvers.toFixed(2)*1
|
|
|
}
|
|
|
} else { // 不能打折
|
|
|
if (row.cardOvers > appearPrice) { //余额够支付,支付等于本次支付
|
|
|
row.spendMoney = appearPrice
|
|
|
} else { //余额不够支付,直接扣除全部
|
|
|
row.spendMoney = row.cardOvers.toFixed(2)*1
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
endEditPaycard(row, index) {
|
|
|
// 本次支付spendMoney 可用金额cardConsumeMoney 可用余额cardOvers 可用折扣discount 赠送折扣discountFreeAmount 赠送支付giftSpendMoney 赠送剩余cardGiftOvers
|
|
|
let appearPrice = this.list[this.projectIndex].transactionPrice - (this.list[this.projectIndex].collectionAmounts ? this.list[this.projectIndex].collectionAmounts * 1 : 0) //本次支付
|
|
|
let discount = row.discount ? row.discount / 100 : 1 //赠送折扣
|
|
|
if (this.list[this.projectIndex].noDiscount == 0) {
|
|
|
if (row.spendMoney > row.cardOvers) { //输入的值大于剩余,重新计算总额是否够支付本次项目
|
|
|
let total = (row.cardOvers / discount).toFixed(2) * 1 //总价
|
|
|
this.$message.warning({ message: "支付金额超出剩余金额" });
|
|
|
if (total > appearPrice) { //余额够支付本次项目,扣除标价*赠送比例
|
|
|
row.spendMoney = (appearPrice * discount).toFixed(2) * 1
|
|
|
row.cardOvers -= row.spendMoney
|
|
|
} else { //不够支付本次项目,扣除掉自己所有剩余
|
|
|
row.spendMoney = row.cardOvers.toFixed(2)*1
|
|
|
row.cardOvers = 0
|
|
|
}
|
|
|
} else { //不超出余额
|
|
|
let total = (row.spendMoney / discount).toFixed(2) * 1 //支付总价
|
|
|
if (total > appearPrice) {
|
|
|
this.$message.warning({ message: "本次支付大于项目金额" });
|
|
|
// 超出的情况下肯定够付
|
|
|
row.spendMoney = (appearPrice * discount).toFixed(2) * 1
|
|
|
row.cardOvers -= row.spendMoney
|
|
|
} else {
|
|
|
// 算出本次支付总共多少钱,是否超出
|
|
|
let giveTotal = (row.spendMoney / discount).toFixed(2) * 1
|
|
|
if (giveTotal > appearPrice) { //超出的情况帮忙重算
|
|
|
this.$message.warning({ message: "本次支付大于项目金额" });
|
|
|
// 超出的情况下肯定够付
|
|
|
row.spendMoney = (appearPrice * discount).toFixed(2) * 1
|
|
|
row.cardOvers -= row.spendMoney
|
|
|
} else {
|
|
|
row.cardOvers -= row.spendMoney
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else { //项目不打折
|
|
|
// 首先判断输入的是否超过卡余额,其次判断输入的值是否大于项目金额
|
|
|
if (row.spendMoney > row.cardOvers) {
|
|
|
this.$message.warning({ message: "支付金额超出剩余金额" });
|
|
|
if (row.cardOvers > appearPrice) { //够支付
|
|
|
row.spendMoney = appearPrice
|
|
|
row.cardOvers -= row.spendMoney
|
|
|
} else { //不够支付
|
|
|
row.spendMoney = row.cardOvers
|
|
|
row.cardOvers = 0
|
|
|
}
|
|
|
} else { //输入的值不大于卡余额,继续判断是否超出本次支付
|
|
|
if (row.spendMoney > appearPrice) {
|
|
|
this.$message.warning({ message: "本次支付大于项目金额" });
|
|
|
row.spendMoney = appearPrice
|
|
|
row.cardOvers -= row.spendMoney
|
|
|
} else {
|
|
|
row.cardOvers -= row.spendMoney
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
this.recIndex = null
|
|
|
this.updataList()
|
|
|
},
|
|
|
// 赠卡处理
|
|
|
editGivecard(row, index) {
|
|
|
// 本次支付spendMoney 可用金额cardConsumeMoney 可用余额cardOvers 可用折扣discount 赠送折扣discountFreeAmount 赠送支付giftSpendMoney 赠送剩余cardGiftOvers
|
|
|
this.giveIndex = index
|
|
|
let discountFreeAmount = row.discountFreeAmount ? row.discountFreeAmount / 100 : 1 //赠送折扣
|
|
|
let appearPrice = (this.list[this.projectIndex].transactionPrice - (this.list[this.projectIndex].collectionAmounts ? this.list[this.projectIndex].collectionAmounts * 1 : 0)).toFixed(2)*1//本次需要支付多少
|
|
|
let total = (row.cardGiftOvers / discountFreeAmount).toFixed(2) * 1 //总价
|
|
|
if (row.giftSpendMoney) {
|
|
|
row.cardGiftOvers += row.giftSpendMoney.toFixed(2)*1
|
|
|
row.giftSpendMoney = 0
|
|
|
this.updataList()
|
|
|
return
|
|
|
}
|
|
|
if (this.list[this.projectIndex].noDiscount == 0) { // 可以打折
|
|
|
if (total > appearPrice) { //够支付够支付本次项目
|
|
|
row.giftSpendMoney = (appearPrice * discountFreeAmount).toFixed(2) * 1
|
|
|
} else { //不够支付本次项目
|
|
|
row.giftSpendMoney = row.cardGiftOvers.toFixed(2)*1
|
|
|
}
|
|
|
} else { // 不能打折
|
|
|
if (row.cardGiftOvers > appearPrice) { //余额够支付,支付等于本次支付
|
|
|
row.giftSpendMoney = appearPrice
|
|
|
} else { //余额不够支付,直接扣除全部
|
|
|
row.giftSpendMoney = row.cardGiftOvers.toFixed(2)*1
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
endEditGivecard(row, index) {
|
|
|
let appearPrice = this.list[this.projectIndex].transactionPrice - (this.list[this.projectIndex].collectionAmounts ? this.list[this.projectIndex].collectionAmounts * 1 : 0) //本次支付
|
|
|
let discountFreeAmount = row.discountFreeAmount ? row.discountFreeAmount / 100 : 1 //赠送折扣
|
|
|
if (this.list[this.projectIndex].noDiscount == 0) { //项目打折
|
|
|
if (row.giftSpendMoney > row.cardGiftOvers) { //输入的值大于剩余
|
|
|
let total = (row.cardGiftOvers / discountFreeAmount).toFixed(2) * 1 //总价
|
|
|
this.$message.warning({ message: "赠送支付金额超出赠送剩余金额" });
|
|
|
if (total > appearPrice) { //够支付够支付本次项目
|
|
|
row.giftSpendMoney = (appearPrice * discountFreeAmount).toFixed(2) * 1
|
|
|
row.cardGiftOvers -= row.giftSpendMoney
|
|
|
row.cardGiftOvers = row.cardGiftOvers.toFixed(2)*1
|
|
|
} else { //不够支付本次项目
|
|
|
row.giftSpendMoney = row.cardGiftOvers.toFixed(2)*1
|
|
|
row.cardGiftOvers = 0
|
|
|
}
|
|
|
} else { //不超出余额
|
|
|
let total = (row.giftSpendMoney / discountFreeAmount).toFixed(2) * 1 //支付总价
|
|
|
if (total > appearPrice) {
|
|
|
this.$message.warning({ message: "本次支付大于项目金额" });
|
|
|
// 超出的情况下肯定够付
|
|
|
row.giftSpendMoney = (appearPrice * discountFreeAmount).toFixed(2) * 1
|
|
|
row.cardGiftOvers -= row.giftSpendMoney
|
|
|
row.cardGiftOvers = row.cardGiftOvers.toFixed(2)*1
|
|
|
} else {
|
|
|
// 算出本次支付总共多少钱,是否超出
|
|
|
let giveTotal = (row.giftSpendMoney / discountFreeAmount).toFixed(2) * 1
|
|
|
if (giveTotal > appearPrice) { //超出的情况帮忙重算
|
|
|
this.$message.warning({ message: "本次支付大于项目金额" });
|
|
|
// 超出的情况下肯定够付
|
|
|
row.giftSpendMoney = (appearPrice * discountFreeAmount).toFixed(2) * 1
|
|
|
row.cardGiftOvers -= row.giftSpendMoney
|
|
|
row.cardGiftOvers = row.cardGiftOvers.toFixed(2)*1
|
|
|
} else {
|
|
|
row.cardGiftOvers -= row.giftSpendMoney
|
|
|
row.cardGiftOvers = row.cardGiftOvers.toFixed(2)*1
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else { //项目不打折
|
|
|
// 首先判断输入的是否超过卡余额,其次判断输入的值是否大于项目金额
|
|
|
if (row.giftSpendMoney > row.cardGiftOvers) {
|
|
|
this.$message.warning({ message: "赠送支付金额超出赠送剩余金额" });
|
|
|
if (row.cardGiftOvers > appearPrice) { //够支付
|
|
|
row.giftSpendMoney = appearPrice
|
|
|
row.cardGiftOvers -= row.giftSpendMoney
|
|
|
row.cardGiftOvers = row.cardGiftOvers.toFixed(2)*1
|
|
|
} else { //不够支付
|
|
|
row.giftSpendMoney = row.cardGiftOvers
|
|
|
row.cardGiftOvers = 0
|
|
|
}
|
|
|
} else { //输入的值不大于卡余额,继续判断是否超出本次支付
|
|
|
if (row.giftSpendMoney > appearPrice) {
|
|
|
this.$message.warning({ message: "本次支付大于项目金额" });
|
|
|
console.log('--->', appearPrice)
|
|
|
row.giftSpendMoney = appearPrice
|
|
|
row.cardGiftOvers -= row.giftSpendMoney
|
|
|
row.cardGiftOvers = row.cardGiftOvers.toFixed(2)*1
|
|
|
} else {
|
|
|
row.cardGiftOvers -= row.giftSpendMoney
|
|
|
row.cardGiftOvers = row.cardGiftOvers.toFixed(2)*1
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
this.giveIndex = null
|
|
|
this.updataList()
|
|
|
},
|
|
|
addUserConfirm(phone) {
|
|
|
this.memberForm.mobilePhone = phone
|
|
|
this.inputMember()
|
|
|
},
|
|
|
selectBlur(val, 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 * 1 + card * 1).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
|
|
|
// 如果有充值卡要清空并且把现付重新清空
|
|
|
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.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()
|
|
|
this.list.push({})
|
|
|
this.list.pop()
|
|
|
},
|
|
|
//修改卡付金额
|
|
|
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)).toFixed(2)*1
|
|
|
// 卡付抵扣金额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时使用
|
|
|
}
|
|
|
},
|
|
|
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)).toFixed(2)*1 //本次需要支付的钱
|
|
|
console.log(this.useRecharge)
|
|
|
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) { //如果输入的大于本身余额
|
|
|
// 如果输入金额大于可支付金额,则需要判断当前卡够不够支付,如果够支付,就扣除当前卡跟赠送,如果当前卡不够支付,扣除掉所有的赠送支付跟可用余额
|
|
|
// 注意!!! 需要还原之前的赠送
|
|
|
let total = (row.cardOvers * 1 / row.discount * 100).toFixed(2) * 1 + ((row.giftSpendMoney ? row.giftSpendMoney * 1 : 0) + row.cardGiftOvers * 1) //当前卡总额
|
|
|
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()
|
|
|
} else { //当前卡不够支付,扣掉所有的可用余额比例跟赠送余额
|
|
|
row.spendMoney = row.cardOvers.toFixed(2)*1 //本次支付等于剩余余额
|
|
|
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),帮它自动计算(比例扣除)
|
|
|
// 自动计算
|
|
|
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 { //支付金额不大于项目金额
|
|
|
// 这里要判断支付的金额加赠送是否大于项目金额,如果大于,帮他自动计算,不大于则扣除
|
|
|
// 先要判断输入的金额折扣是否大于项目金额,如果大于,帮他自动计算,
|
|
|
// 不大于的话,还要判断折扣金额跟折扣赠送是否大于项目金额,
|
|
|
let total = ((row.spendMoney / row.discount) * 100).toFixed(2) * 1 //获取当前输入值折扣
|
|
|
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 //按照比例算出赠送金额为多少
|
|
|
// giveCase+total)>= appearPrice
|
|
|
if (row.spendMoney > (convertedNum * balanceProportion)) { //输入的值大于需要支付金额
|
|
|
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)
|
|
|
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 //赠送支付(按比例公式--- 支付金额/支付折扣/支付比例*赠送比例*赠送折扣 ---)
|
|
|
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 //清空赠送支付
|
|
|
if (row.spendMoney > row.cardOvers) { // 当输入的金额大于自身可用金额时
|
|
|
this.$message.warning({ message: "支付金额不能大于可用余额" });
|
|
|
// 自动计算
|
|
|
let total = 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.toFixed(2) * 1//支付金额=可用余额
|
|
|
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)
|
|
|
if (((row.spendMoney * 1 + giveCase) * 1) > appearPrice) {
|
|
|
// 如果按比例之和大于项目金额,大于的情况一定是够支付的!!!
|
|
|
this.$message.warning({ message: "支付金额大于项目金额" }); //判断误差
|
|
|
// 自动计算
|
|
|
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) { //上一次的值没有改变
|
|
|
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()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
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.toFixed(2)*1
|
|
|
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 { //两个折扣价格不够支付
|
|
|
row.spendMoney = row.cardOvers.toFixed(2)*1 //支付金额
|
|
|
row.cardOvers = 0 //可用余额
|
|
|
row.giftSpendMoney = row.cardGiftOvers //赠送支付
|
|
|
row.cardGiftOvers = 0 //赠送剩余
|
|
|
this.updataList()
|
|
|
}
|
|
|
} else { //输入金额不大于本身余额
|
|
|
// 判断输入金额是否大于项目金额
|
|
|
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))
|
|
|
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.toFixed(2)*1
|
|
|
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 { //两个折扣价格不够支付
|
|
|
row.spendMoney = row.cardOvers.toFixed(2)*1 //支付金额
|
|
|
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//折后金额
|
|
|
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()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
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.toFixed(2)*1
|
|
|
row.cardOvers = 0
|
|
|
row.giftSpendMoney = appearPrice - row.spendMoney
|
|
|
row.cardGiftOvers = (row.giftSpendMoney).toFixed(2) * 1
|
|
|
this.updataList()
|
|
|
}
|
|
|
} else {
|
|
|
//当前卡不够支付项目金额
|
|
|
row.spendMoney = row.cardOvers.toFixed(2)*1
|
|
|
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.toFixed(2)*1
|
|
|
row.cardOvers = 0
|
|
|
row.giftSpendMoney = appearPrice - row.spendMoney
|
|
|
row.cardGiftOvers = (row.giftSpendMoney).topPrice(2) * 1
|
|
|
this.updataList()
|
|
|
}
|
|
|
} else {
|
|
|
//当前卡不够支付项目金额
|
|
|
row.spendMoney = row.cardOvers.toFixed(2)*1
|
|
|
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;
|
|
|
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.numberTimes = 1
|
|
|
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) {
|
|
|
this.$refs[this.refText + this.keyIndex].blur() //让自己失焦
|
|
|
switch (text) {
|
|
|
case 'zhonggongList': //美发师
|
|
|
this.$nextTick(() => {
|
|
|
this.refText = 'largeList'
|
|
|
this.$refs['largeList' + index].$el.querySelector('input').focus() //search里面的input获得焦点
|
|
|
this.$refs['largeList' + index].toggleMenu() //自动展示
|
|
|
})
|
|
|
break;
|
|
|
case 'largeList': //美容师
|
|
|
this.$nextTick(() => {
|
|
|
this.refText = 'technicianList'
|
|
|
this.$refs['technicianList' + index].$el.querySelector('input').focus()
|
|
|
this.$refs['technicianList' + index].toggleMenu() //自动展示
|
|
|
})
|
|
|
break;
|
|
|
case 'technicianList': //技师
|
|
|
this.$nextTick(() => {
|
|
|
this.refText = 'smallList'
|
|
|
this.$refs['smallList' + index].$el.querySelector('input').focus()
|
|
|
this.$refs['smallList' + index].toggleMenu() //自动展示
|
|
|
})
|
|
|
break;
|
|
|
case 'smallList': //助理
|
|
|
this.$nextTick(() => {
|
|
|
this.refText = 'managerList'
|
|
|
this.$refs['managerList' + index].$el.querySelector('input').focus()
|
|
|
this.$refs['managerList' + index].toggleMenu() //自动展示
|
|
|
})
|
|
|
break;
|
|
|
case 'managerList': //高管
|
|
|
this.$nextTick(() => {
|
|
|
this.refText = 'adminList'
|
|
|
this.$refs['adminList' + index].$el.querySelector('input').focus()
|
|
|
this.$refs['adminList' + index].toggleMenu() //自动展示
|
|
|
})
|
|
|
break;
|
|
|
case 'adminLists': //管理层
|
|
|
break;
|
|
|
}
|
|
|
},
|
|
|
handleChange(data, row, text, index) {
|
|
|
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[row.index] = form
|
|
|
// this.list.splice(row.index, 1, form);
|
|
|
this.keyIndex = index
|
|
|
this.refText = text
|
|
|
this.triggerInit(text, index)
|
|
|
this.list.push({})
|
|
|
this.list.pop()
|
|
|
},
|
|
|
goPayDebt() {
|
|
|
this.$refs.repayment.show(this.memberForm);
|
|
|
},
|
|
|
inputMember() {
|
|
|
if(!this.memberForm.mobilePhone){
|
|
|
this.$alert('请输入手机号', "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
type: "warning",
|
|
|
center: true,
|
|
|
callback: action => {
|
|
|
this.notData()
|
|
|
}
|
|
|
});
|
|
|
return this.cashNumber = 0;
|
|
|
}
|
|
|
// 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 };
|
|
|
if (this.memberForm.sex) {
|
|
|
this.$set(this.memberForm, 'manNumber', 1)
|
|
|
} else {
|
|
|
this.$set(this.memberForm, 'womanNumber', 1)
|
|
|
}
|
|
|
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 : ""
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.reccard.show(this_.memberForm);
|
|
|
this.$refs.course.show(this_.memberForm);
|
|
|
})
|
|
|
this.getRecCard();
|
|
|
} else {
|
|
|
if (this.cashNumber == 1) {
|
|
|
this.$alert(res.message, "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
type: "warning",
|
|
|
center: true,
|
|
|
callback: action => {
|
|
|
this.notData()
|
|
|
}
|
|
|
});
|
|
|
this.cashNumber = 0;
|
|
|
} else {
|
|
|
this.$confirm(res.message + ",请先注册!", "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
|
cancelButtonClass: "cancelbtnFalses",
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
type: "warning",
|
|
|
}).then(() => {
|
|
|
this.openAddMember();
|
|
|
this.memberForm.mobilePhone = ''
|
|
|
}).catch(() => {
|
|
|
this.memberForm.mobilePhone = ''
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
// } 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) {
|
|
|
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.numberTimes = v.addNum * 1
|
|
|
this.setProOne({ ...v });
|
|
|
this.updataCollection()
|
|
|
},
|
|
|
setProOne(row) {
|
|
|
if (row.courseAccountId == null) {
|
|
|
row.courseMoney = 0;
|
|
|
} else {
|
|
|
row.courseMoney = row.courseConsumePrice;
|
|
|
}
|
|
|
let form = {};
|
|
|
proOne({
|
|
|
id: row.courseProjectId,
|
|
|
}).then(res => {
|
|
|
// cashAmount
|
|
|
if (res.code == "000000") {
|
|
|
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,
|
|
|
anotherName: 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 * this.numberTimes).toFixed(2) * 1,
|
|
|
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 * this.numberTimes).toFixed(2) * 1, //散客标价
|
|
|
topPrice: (res.data.topPrice * this.numberTimes).toFixed(2) * 1, //散客最高价
|
|
|
topPriceMember: (res.data.topPriceMember * this.numberTimes).toFixed(2) * 1, //会员最高价
|
|
|
priceMember: (res.data.priceMember * this.numberTimes).toFixed(2) * 1, // 会员标价
|
|
|
minumumPrice: (res.data.minumumPrice * this.numberTimes).toFixed(2) * 1, //散客最低价
|
|
|
minumumPriceMember: (res.data.minumumPriceMember * this.numberTimes).toFixed(2) * 1, //会员最低价
|
|
|
cashNumber: this.cashNumber,
|
|
|
numberTimes: this.numberTimes,
|
|
|
minumumTimes: res.data.minumumTimes,
|
|
|
// sex:0,
|
|
|
sex: this.memberForm.sex == 1 ? 0 : this.memberForm.sex == 0 ? 1 : 0 //会员是否存在,存在会员性别,不存在默认男
|
|
|
};
|
|
|
this.setRecList(form);
|
|
|
if (this.cashNumber == 1) {
|
|
|
if (row.courseAccountId == null) {
|
|
|
form.transactionPrice = res.data.priceMember;
|
|
|
form.amount = form.priceMember;
|
|
|
if (res.data.priceMember == 0) {
|
|
|
form.amount = form.price;
|
|
|
form.transactionPrice = res.data.price;
|
|
|
}
|
|
|
} else {
|
|
|
form.amount = form.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
|
|
|
} else {
|
|
|
// 充值卡存在,判断卡里还有没有余额,有余额会员价,没余额散客价
|
|
|
// 可用余额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 * this.numberTimes).toFixed(2) * 1;
|
|
|
form.transactionPrice = (res.data.price * this.numberTimes).toFixed(2) * 1;
|
|
|
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;
|
|
|
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]);
|
|
|
}
|
|
|
console.log('cashAmount-->',form.cashAmount,'amount-->',form.amount,'transactionPrice-->',form.transactionPrice)
|
|
|
this.updataCollection()
|
|
|
this.openRec(form);
|
|
|
this.sumAmont();
|
|
|
this.list = this.list.filter(item => item.projectName)
|
|
|
let index = this.list.findIndex(item => !item.projectName)
|
|
|
if (index == -1) this.addPro()
|
|
|
} 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.discountFreeAmount) {
|
|
|
item.discountFreeAmount = 100
|
|
|
}
|
|
|
// 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();
|
|
|
if ((total - this.appearPrices * 1).toFixed(2) * 1 > this.balance) {
|
|
|
return this.$alert(`金额多出${(total - this.appearPrices * 1).toFixed(2) * 1}元`, "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
type: "warning",
|
|
|
center: true,
|
|
|
callback: action => { }
|
|
|
});
|
|
|
} else {
|
|
|
|
|
|
}
|
|
|
} else if (total < this.appearPrices * 1) {
|
|
|
this.formData = new FormData();
|
|
|
if ((this.appearPrices * 1 - total).toFixed(2) * 1 > this.balance) {
|
|
|
return this.$alert(`金额还需支付${(this.appearPrices * 1 - total).toFixed(2) * 1}`, "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
confirmButtonClass: "confirmbtnFalses",
|
|
|
type: "warning",
|
|
|
center: true,
|
|
|
callback: action => { }
|
|
|
});
|
|
|
} else {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (flag) {
|
|
|
let passShow = false;
|
|
|
this.list = this.list.filter(item => item.projectName)
|
|
|
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() {
|
|
|
// collectionRechargeAmount
|
|
|
let list = [];
|
|
|
this.list.forEach(item => {
|
|
|
if (item.courseAccountId == null) {
|
|
|
item.collectionCashAmount = ((item.amount - (item.collectionAmounts ? item.collectionAmounts * 1 : 0)).toFixed(2) * 1);
|
|
|
if (item.collectionCashAmount <= this.balance) {
|
|
|
item.collectionCashAmount = 0
|
|
|
}
|
|
|
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 * item.numberTimes).toFixed(2) * 1;
|
|
|
}
|
|
|
if (item.projectId) {
|
|
|
list.push(item);
|
|
|
}
|
|
|
});
|
|
|
let collectionAmountsum = 0
|
|
|
list.forEach(item => {
|
|
|
collectionAmountsum += (item.collectionAmount * 1 + collectionAmountsum * 1);
|
|
|
});
|
|
|
console.log(this.list)
|
|
|
// this.formData.append("cashListRequestList", JSON.stringify(list));
|
|
|
this.$confirm('是否发送短信?', '短信', {
|
|
|
distinguishCancelAndClose: true,
|
|
|
confirmButtonText: '是',
|
|
|
cancelButtonText: '否'
|
|
|
}).then(() => {
|
|
|
list[0].isSendSms = 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()
|
|
|
this.printInie()
|
|
|
} 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.notData();
|
|
|
}
|
|
|
});
|
|
|
this.formData = new FormData();
|
|
|
}
|
|
|
});
|
|
|
}).catch(() => {
|
|
|
list[0].isSendSms = 0
|
|
|
this.formData.append("cashListRequestList", JSON.stringify(list));
|
|
|
// this.formData.append("isSendSms", 0);
|
|
|
addCash(this.formData).then(res => {
|
|
|
if (res.code == "000000") {
|
|
|
this.$message.success({
|
|
|
message: "验证成功 , 收银" + res.message
|
|
|
});
|
|
|
this.formData = new FormData();
|
|
|
this.notData();
|
|
|
this.updataCollection()
|
|
|
this.printInie()
|
|
|
} 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.notData();
|
|
|
}
|
|
|
});
|
|
|
this.formData = new FormData();
|
|
|
}
|
|
|
});
|
|
|
})
|
|
|
},
|
|
|
openStaffRatio(row, index, text) {
|
|
|
console.log(this.list)
|
|
|
this.editIndex = index;
|
|
|
this.$refs.staffratio.show({ ...row }, text);
|
|
|
this.$refs.staffratio.showdetele();
|
|
|
let tRow = { ...row }
|
|
|
let tText = text
|
|
|
localStorage.setItem("row", JSON.stringify(tRow));
|
|
|
localStorage.setItem("text", tText);
|
|
|
},
|
|
|
staffratioData(v) {
|
|
|
console.log(v, this.list)
|
|
|
let form = this.list[this.editIndex];
|
|
|
let texts = v.text + "s";
|
|
|
form[v.text] = v.list;
|
|
|
form[texts] = v.list[0].label;
|
|
|
this.list[this.editIndex] = form
|
|
|
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
|
|
|
sex: this.memberForm.sex == 1 ? 0 : this.memberForm.sex == 0 ? 1 : 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) {
|
|
|
console.log(v)
|
|
|
this.memberForm.mobilePhone = v.mobilePhone;
|
|
|
this.inputMember();
|
|
|
},
|
|
|
reccardData(v) { },
|
|
|
courseData(v) {
|
|
|
console.log('vvv--->',v)
|
|
|
if (!v.courseAccountId) {
|
|
|
v.courseAccountId = null;
|
|
|
v.courseProjectId = v.id;
|
|
|
v.courseMoney = 0;
|
|
|
} else {
|
|
|
v.courseMoney = v.price;
|
|
|
}
|
|
|
this.numberTimes = 1
|
|
|
let index = this.list.findIndex(item => {
|
|
|
return item.courseAccountId == v.courseAccountId
|
|
|
})
|
|
|
this.setProOne(v);
|
|
|
},
|
|
|
paymentData(v) {
|
|
|
this.list.pop()
|
|
|
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()
|
|
|
this.addPro()
|
|
|
},
|
|
|
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();
|
|
|
},
|
|
|
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() {
|
|
|
let index = JSON.parse(sessionStorage.getItem("list")).findIndex(item => item.id === 5002005)
|
|
|
if (index != -1) {
|
|
|
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() {
|
|
|
cashListByStore({
|
|
|
memberId: this.memberForm.id,
|
|
|
storeId: sessionStorage.getItem("storeId")
|
|
|
}).then(res => {
|
|
|
if (res.code == "000000") {
|
|
|
this.rechargeAccountList = res.rows;
|
|
|
console.log('this.rechargeAccountList--->', this.rechargeAccountList)
|
|
|
this.recListCopy = JSON.parse(JSON.stringify(res.rows));
|
|
|
this.cardList = res.rows
|
|
|
this.cardListUpdata()
|
|
|
this.list.forEach(item => {
|
|
|
item.rechargeAccountList = JSON.parse(JSON.stringify(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();
|
|
|
},
|
|
|
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 => { }
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
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 ? item.collectionRechargeAmount.toFixed(2) * 1 : 0);
|
|
|
});
|
|
|
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();
|
|
|
}
|
|
|
},
|
|
|
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()
|
|
|
this.addPro()
|
|
|
},
|
|
|
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 {
|
|
|
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>
|