<template> <div class="app-center"> <!-- 支付金额、会员登录--> <div class="center-left"> <div class="center-vh"> <div class="center-left-top"> <div class="vip-bottom" v-if="isMember == false" @click="queryUser"> <div>会员搜索</div> </div> <div v-else style="width: 96%;margin: 0 auto;display: flex;justify-content: space-between"> <div style="display: flex;color: white;justify-content: space-around;width: 55%; height: 90%;border-radius: 10px; padding-top: 10px; background-color: rgb(67,119,204)"> <div> <template> <img v-if="member.avatar" class="list-avatar" :src="baseUrl + member.avatar"> <img v-else class="list-avatar" src="@/assets/images/avatar.png"> </template> </div> <div style="text-align: center"> <span style="margin-bottom: 10px">{{ member.name }}</span><br/> <span>{{ member.mobile }}</span> </div> <div style="background-color: rgba(46,82,142,0.65);width: 50px;height: 45px;padding-top: 5px; border-radius: 5px;text-align: center"> <el-tooltip placement="top"> <div slot="content"> <p>会员储值账户余额:{{ member.cardBalance }}</p> <p>积分余额:{{ member.points }}</p> </div> <i class="el-icon-bank-card" style="font-size: 35px"></i> </el-tooltip> </div> <div style="background-color: rgba(46,82,142,0.65);width: 50px;height: 45px;padding-top: 5px; border-radius: 5px;text-align: center"> <el-tooltip placement="top"> <div slot="content"> 会员等级:{{ gradeName }} </div> <i class="el-icon-medal" style="font-size: 35px"></i> </el-tooltip> </div> </div> <div class="vip-bottom" style="height: 40px;margin-top: 10px" @click="resetMember"> <div>重置会员</div> </div> </div> </div> <!-- --> <div class="center-left-hj"> <div class="hj-box" style="justify-content: left">油品:¥{{ oilAmount.toFixed(2) }}</div> <div class="hj-box" style="border-left: 1px solid #d1d1d4; border-right: 1px solid #d1d1d4;">商品:¥{{ goodsAmount.toFixed(2) }}</div> <div class="hj-box" style="justify-content: flex-end">合计: ¥{{ (oilAmount + goodsAmount).toFixed(2) }}</div> </div> <div style="overflow-y: scroll;height: 42vh"> <div class="center-left-hj" v-show="isMember && refuelMoney && refuelMoney.length>0"> <div> 囤油卡 <div style="margin: 5px 0" v-for="(item,index) in refuelMoney" :key="index"> ({{ item.type }}卡 锁价:{{ item.lockupPrice ? item.lockupPrice : 0.00 }}元/L) </div> </div> <div v-if="oilCardAmount>0">- ¥{{ oilCardAmount }}</div> </div> <div class="center-left-hj"> <div> <el-popover placement="bottom-start" width="400" trigger="click"> <div> <div v-if="fullReduceDiscount.length>0"> <el-checkbox-group v-model="checkedCities1" @change="handleCheckedCitiesChange1"> <el-checkbox v-for="(item,index) in fullReduceDiscount" :label="item.gunName" :key="index"> <div style="display: flex;justify-content: space-between;height: 40px;line-height: 40px;"> <div style="width: 200px">{{ getName(oilNameList,item.oilName) }}_{{getName1(gunList,item.gunName)}}</div> <div style="line-height: 20px;width:150px;font-size: 12px;text-align: right"> <div style="color: red">-¥{{ item.discount }}</div> <div style="color: grey" v-if="item.type!=2">满减优惠</div> <div style="color: grey" v-if="item.type!=1">折扣优惠</div> </div> </div> </el-checkbox> </el-checkbox-group> </div> <div v-else> 暂无满减油品信息 </div> </div> <div slot="reference"> <el-checkbox :disabled="fullReduceDiscount.length==0" style="color: black;font-size: 16px" v-model="checkAll1" @change="handleCheckAllChange1"> </el-checkbox><!--:indeterminate="isIndeterminate1"--> 活动优惠 </div> </el-popover> </div> <div>-¥{{ fullReduction.toFixed(2) }}</div> </div> <div class="center-left-hj" v-show="isMember && gradeDiscount.length>0"> <div> <el-popover placement="bottom-start" width="400" trigger="click"> <div> <el-checkbox-group v-model="checkedCities2" @change="handleCheckedCitiesChange2"> <el-checkbox v-for="(item,index) in gradeDiscount" :label="item.gunName" :key="index"> <div style="display: flex;justify-content: space-between;height: 40px;line-height: 40px;"> <div style="width: 200px">{{ getName(oilNameList,item.oilName) }}_{{getName1(gunList,item.gunName)}}</div> <div style="line-height: 20px;width:150px;font-size: 12px;text-align: right"> <div style="color: red">-¥{{ item.discount }}</div> </div> </div> </el-checkbox> </el-checkbox-group> </div> <div slot="reference"> <el-checkbox style="color: black;font-size: 16px" v-model="checkAll2" @change="handleCheckAllChange2"> </el-checkbox> 等级优惠 </div> </el-popover> </div> <div>-¥{{ oilDiscount.toFixed(2) }}</div> </div> <div class="center-left-hj" v-show="isMember"> <div> <el-checkbox style="color: black;font-size: 16px" :disabled="balance==0" v-model="checkAll4" @change="handleCheckAllChange4"> </el-checkbox> 储值卡 <span>(账户余额:{{ balance }}元)</span> </div> <div>-¥{{ consumeAmount }}</div> </div> <div class="center-left-hj" v-show="isMember && couponDiscount.length>0"> <div> <el-popover placement="bottom-start" width="400" trigger="click"> <div slot="reference"> <el-checkbox style="color: black;font-size: 16px" v-model="checkAll5" @change="handleCheckAllChange5"> </el-checkbox><!-- :indeterminate="isIndeterminate5"--> 优惠券 </div> </el-popover> </div> <div>-¥{{ couponAmount.toFixed(2) }}</div> </div> <div class="center-left-th"> <div class="th-box"> <div>扫码支付</div> <div class="bule">{{ ((+oilActualPay) + (+goodsActualPay)).toFixed(2) }}</div> </div> <div class="th-box"> <div>找零</div> <div class="bule">{{ seekZero.toFixed(2) }}</div> </div> <div class="th-box" @click="getStaffList"> <div>加油员</div> <div style="cursor: pointer;color: crimson" >{{ staff ? staff.realName : "--" }}</div> </div> </div> </div> </div> <div class="bottom-posi"> <div class="center-left-wrap"> <div class="wrap-box" value="balance" @click="payMethod('balance')" :class="{ 'wrap-box2': 'balance' == payType }" > <span>储值卡</span> </div> <div class="wrap-box" v-for="item in payList" :key="item.dictValue" :value="item.dictValue" :class="{ 'wrap-box2': item.dictValue == payType }" @click="payMethod(item.dictValue)"> <span>{{ item.dictLabel }}</span> </div> <div class="wrap-box" value="credit" @click="addCredits('credit')" :class="{ 'wrap-box2': 'credit' == payType }" > <span>挂账</span> </div> </div> <div class="center-left-bottom"> <div> <div class="bottom-price">¥{{ ((+oilActualPay) + (+goodsActualPay)).toFixed(2) }}</div> <div class="price-red">优惠合计:{{ (oilDiscount + goodsDiscount + fullReduction + couponAmount).toFixed(2) }}元<!--/{{consumeRefuelMoney.toFixed(2)}}L--></div> </div> <el-button class="center-left-lv" :disabled="(oilAmount + goodsAmount)==0" @click="settlement">立即结算</el-button> </div> </div> </div> <!-- 油品选择--> <div class="center-right"> <div class="center-top"> <div class="center-top-tab"> <el-tabs v-model="activeName" @tab-click="handleClick"> <el-tab-pane label="全部" name="-1"></el-tab-pane> <!-- <el-tab-pane v-for="item in oilNameList" :key="item.id"--> <!-- :label="item.oilName" :name="item.id+''"></el-tab-pane>--> <el-tab-pane v-for="(item,index) in oilNumberList" :key="index" :label="getOilNamess(oilNameList,item.oilName)" :name="item.oilName+''"> <!-- {{getOilNamess(oilNameList,item.oilName)}}--> </el-tab-pane> </el-tabs> </div> <div class="center-top-data"> <div class="center-top-of"> <div class="wrap-wrap"> <div class="of-box" v-for="(item,index) in gunList" :key="index" :style="{'background-color': colorList[index%4].color}" @click="refuel(item)"> <div :style="{'color': colorList[index%4].border}" >{{ getName(oilNameList,getOilNames(oilNumberList,item.numberId)) }}</div> <!-- <div>{{ getOilNames(oilNumberList,item.numberId) }}</div>--> <!-- <div>{{ item.oilNumber }</div>--> <div class="of-title" >{{item.gunName}}</div> <div style="display: flex;justify-content: space-between ;font-size: 12px" > <img src="../../../assets/images/jya.png" style="width: 18px;height: 18px;"> <span :style="{'color': colorList[index%4].border}" >{{ item.tankName }}</span> </div> </div> </div> </div> <!-- --> <div class="content-top-bottom"> <div>订单笔数 <span class="bule">{{ oilTotal }}件</span> </div> <div>订单金额 <span class="bule">¥{{ oilAmount.toFixed(2) }}</span> </div> </div> </div> </div> <div class="center-left-bottom"> <div class="bottom-qk" @click="resetting">重置</div> <!-- <div class="bottom-qk">解锁</div>--> </div> </div> <!-- 商品选择--> <div class="center-app"> <div class="center-top"> <div class="center-top-title">非油商品</div> <div class="center-top-input"> <template> <el-autocomplete popper-class="my-autocomplete" style="width: 94%" v-model="goods" :fetch-suggestions="querySearch" :trigger-on-focus="false" placeholder="商品名称,商品关键词,商品条码" @select="changeGoods"> <template slot-scope="{ item }"> <div style="display: flex;justify-content: space-between"> <span class="name">{{ item.name }}</span> <span v-if="isMember" class="addr">{{ item.memberPrice }}</span> <span v-else class="addr">{{ item.retailPrice }}</span> </div> </template> </el-autocomplete> </template> </div> <div class="center-top-data"> <div class="data-top"> <div class="data-top-title">商品</div> <div class="data-top-three"> <div>库存</div> <div>单价</div> <div v-if="isMember">会员价</div> <div style="width: 135px;text-align: center">数量</div> <div>操作</div> </div> </div> <div class="data-top-box" v-for="(item,index) in goodsOrder" :key="index"> <div class="data-top-title">{{ item.name }}</div> <div class="data-top-three"> <div>{{ item.stock }}</div> <div>{{ item.retailPrice }}</div> <div v-if="isMember">{{ item.memberPrice }}</div> <div> <el-input-number v-model="item.num" size="small" controls-position="right" @change="handleChange" :min="1" :max="item.stock"></el-input-number> </div> <div @click="delGoods(index)"><i class="el-icon-circle-close" style="font-size: 22px"></i></div> </div> </div> <div class="content-top-bottom"> <div>商品数量 <span class="bule">{{ goodsTotal }}件</span> </div> <div>商品总额 <span class="bule">¥{{ goodsAmount.toFixed(2) }}</span> </div> </div> </div> </div> <div class="center-left-bottom"> <div class="bottom-qk" @click="empty">清空</div> <div style="display: flex"> <div class="bottom-qd" @click="dialogTakeOrder = true">取单</div> <div class="bottom-gd" @click="dialogRegistration = true">挂单</div> </div> </div> </div> <!-- 加油员姓名--> <el-dialog title="选择加油员" :visible.sync="dialogVisible" width="30%" :close-on-click-modal="false"> <div class="wrap-wrap" v-if="staffList.length>0"> <div class="of-box" v-for="(item,index) in staffList" :key="index" @click="chooseStaff(item)" :style="{'background-color': item.color}"> <div class="of-title">{{ item.realName }}</div> <div style="text-align: center;font-size: 17px">{{ item.mobile }}</div> </div> </div> <div class="wrap-wrap" v-else> <span>暂未配置加油员</span> </div> <span slot="footer" class="dialog-footer"> <el-button @click="dialogVisible = false">关 闭</el-button> <!-- <el-button type="primary" @click="dialogVisible = false">确 定</el-button>--> </span> </el-dialog> <!-- 挂单--> <el-dialog title="挂单提示" :visible.sync="dialogRegistration" width="20%" style="margin-top: 200px" :close-on-click-modal="false"> <div class="wrap-wrap"> <p> 挂单只可将非油商品进行挂单,挂单成功后可在取单页面进行取单操作、挂单备注为选填 </p> <div> <el-input type="textarea" :rows="2" style="width: 180%" placeholder="请输入挂单备注(选填)" v-model="registrationRemark"> </el-input> </div> </div> <span slot="footer" class="dialog-footer"> <el-button @click="dialogRegistration = false">关 闭</el-button> <el-button type="primary" @click="registration">确 定</el-button> </span> </el-dialog> <!-- 挂单成功提示--> <el-dialog title="挂单成功" :visible.sync="dialogSuccess" width="20%" style="margin-top: 200px" :close-on-click-modal="false"> <span>商品记录挂单成功</span> <span slot="footer" class="dialog-footer"> <!-- <el-button @click="dialogVisible = false">取 消</el-button>--> <el-button type="primary" @click="dialogSuccess = false">确 定</el-button> </span> </el-dialog> <!-- 取单提示--> <el-dialog title="取单" :visible.sync="dialogTakeOrder" width="50%" :close-on-click-modal="false"> <div style="height: 500px"> <el-row class="tac"> <el-col :span="6"> <el-input v-model="putRemark" placeholder="挂单备注检索" style="margin-bottom: 20px;width: 80%"></el-input> <el-menu default-active="2" v-for="(item,index) in registrationList" :key="index" class="el-menu-vertical-demo"> <el-menu-item :index="index+''" @click="getTakeGoods(item,index)"> <span slot="title">{{ item.menu }}</span> </el-menu-item> </el-menu> </el-col> <el-col :span="18"> <el-table ref="tables" :data="takeList"> <el-table-column label="商品名称" align="center" prop="name" /> <el-table-column label="零售价" align="center" prop="retailPrice"/> <el-table-column label="数量" align="center" prop="num"/> <el-table-column label="金额" align="center"> <template slot-scope="scope"> <span>{{ (scope.row.retailPrice * scope.row.num).toFixed(2) }}</span> </template> </el-table-column> </el-table> </el-col> </el-row> </div> <span style="display: flex;justify-content: space-between"> <el-button class="elBut" @click="dialogTakeOrder = false" round>返 回</el-button> <span> <el-button class="elBut" :disabled="registrationList.length==0" type="danger" @click="cancel" round>作 废</el-button> <el-button class="elBut" :disabled="registrationList.length==0" type="success" @click="pickOrder" round>取 单</el-button> </span> </span> </el-dialog> <!-- 立即结算--> <el-dialog title="扫码支付" :visible.sync="dialogVisiblej" width="30%" :close-on-click-modal="false"> <div v-if="isPay==false" v-loading="loading"> <div style="text-align: center;font-size: 15px;font-weight: bold">应收金额</div> <div style="text-align: center;font-size: 30px;font-weight: bold;color: red;margin: 10px 0"> ¥{{ ((+oilActualPay) + (+goodsActualPay)).toFixed(2) }} </div> <div style="text-align: center;margin-bottom: 10px"> 合计金额:{{ (oilAmount + goodsAmount).toFixed(2) }}元、优惠合计{{ (oilDiscount + goodsDiscount + fullReduction + couponAmount).toFixed(2) }}元 </div> <div v-if="map.payType != 'CASH'"> <div> <el-input v-model="authCode" v-focus :key="inputKey" @keydown.enter.native="collection" placeholder="扫描或输入付款码、支持微信、支付宝、云闪付"> <i slot="suffix"> <svg t="1697791915471" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1479" width="32" height="32"><path d="M149.333333 170.858667A21.546667 21.546667 0 0 1 170.858667 149.333333H384V106.666667H170.858667A64.213333 64.213333 0 0 0 106.666667 170.858667V384h42.666666V170.858667zM170.858667 874.666667A21.546667 21.546667 0 0 1 149.333333 853.141333V640H106.666667v213.141333A64.213333 64.213333 0 0 0 170.858667 917.333333H384v-42.666666H170.858667zM853.12 149.333333A21.546667 21.546667 0 0 1 874.666667 170.858667V384h42.666666V170.858667A64.213333 64.213333 0 0 0 853.141333 106.666667H640v42.666666h213.141333zM874.666667 853.141333A21.546667 21.546667 0 0 1 853.141333 874.666667H640v42.666666h213.141333A64.213333 64.213333 0 0 0 917.333333 853.141333V640h-42.666666v213.141333zM106.666667 490.666667h810.666666v42.666666H106.666667v-42.666666z" fill="#3D3D3D" p-id="1480"></path></svg> </i> </el-input> </div> <div class="demo-image"></div> <div class="block" style="text-align: center"> <el-image style="width: 200px; height: 200px" fit="cover" src="https://oil.wudb.cn/static/img/scan-demo.fcb8b1ab.png"></el-image> </div> </div> <div v-else> <div> <el-input v-model="authCode" v-focus ref="getFocus" :key="inputKey" maxlength="10" @input="changeSeekZero" @keydown.enter.native="collection" oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" placeholder="请输入收款金额"> </el-input> </div> <div style="text-align: right;margin: 10px 0"> <span>应找零</span> <span style="color: red;font-size: 18px"> ¥{{ seekZero.toFixed(2) }}</span> </div> </div> <el-divider></el-divider> <span slot="footer" class="dialog-footer" style="display: flex;justify-content: space-around"> <el-button @click="clear" class="but">取 消</el-button> <el-button type="primary" class="but" @click="collection">确 定 收 款</el-button> </span> </div> <div v-else> <div v-if="isPaySuccess"> <el-result icon="success" title="收款成功"> <template slot="extra"> <el-button type="primary" @click="handClose">关 闭</el-button> </template> </el-result> </div> <div v-else> <el-result icon="error" title="支付失败,请重新支付"> <template slot="extra"> <el-button type="primary" @click="handClose">关 闭</el-button> </template> </el-result> </div> </div> </el-dialog> <!-- 立即结算--> <el-dialog title="扫码支付" :visible.sync="dialogVisiblejLoading" width="30%" :close-on-click-modal="false"> <div> <el-result icon="info" title="支付状态未查询成功,请移至订单查看"> <template slot="extra"> <el-button type="primary" @click="handClose">关 闭</el-button> </template> </el-result> </div> </el-dialog> <!-- 会员登录--> <el-dialog title="会员信息" :visible.sync="dialogVisiblevip" width="30%" :close-on-click-modal="false"> <div > <el-input placeholder="会员手机号、用户昵称" v-model="userNo" clearable @keyup.enter.native="getUser" class="input-with-select" style="text-align: center;"> <el-select v-model="select1" slot="prepend" placeholder="请选择" style="width: 120px"> <el-option label="会员手机号" value="会员手机号"></el-option> <el-option label="用户昵称" value="用户昵称"></el-option> </el-select> <el-button slot="append" @click="getUser">查询</el-button> </el-input> </div> <el-row> <el-descriptions title="会员信息" :column="2"> <el-descriptions-item label="手机号">{{member.mobile ? member.mobile : "--"}}</el-descriptions-item> <el-descriptions-item label="会员昵称">{{member.name ? member.name : "--"}}</el-descriptions-item> <el-descriptions-item label="积分">{{member.points ? member.points : "--"}}</el-descriptions-item> <!-- <el-descriptions-item label="加油金余额">0</el-descriptions-item>--> <el-descriptions-item label="车牌号">{{member.carNo ? member.carNo : "--"}}</el-descriptions-item> <el-descriptions-item label="会员备注">{{member.remark ? member.remark : "--"}}</el-descriptions-item> </el-descriptions> <el-descriptions title="会员等级"> <el-descriptions-item label="等级名称">{{member.gradeId ? getGradeName(gradeList,member.gradeId) : "--"}}</el-descriptions-item> </el-descriptions> <el-descriptions title="储值余额" :column="1"> <template slot="extra"> <span style="color: red;margin-right: 20px" @click="userRecharge">余额充值</span> <span style="font-weight: bold">¥{{member.cardBalance ? member.cardBalance : "0"}}</span> </template> <el-descriptions-item label="账户余额">{{member.cardBalance ? member.cardBalance : 0}}元</el-descriptions-item> <!-- <el-descriptions-item label="囤油卡余额" v-if="refuelMoney">--> <!-- <div style="margin: 5px 0" v-for="(item,index) in refuelMoney" :key="index">--> <!-- {{ item.type }}卡--> <!-- <!– <span style="color: #00afff">{{ item.oilType }}</span>–>--> <!-- 余额:{{ item.refuelMoney ? item.refuelMoney : 0.00 }}L;--> <!-- </div>--> <!-- </el-descriptions-item>--> </el-descriptions> </el-row> <span slot="footer" class="dialog-footer"> <el-button @click="dialogVisiblevip = false">取 消</el-button> <el-button type="primary" :disabled="isSure==false" @click="chooseUser(member)">确 定</el-button> </span> </el-dialog> <!-- 会员充值--> <el-dialog :close-on-click-modal="false" width="60%" title="会员充值" :visible.sync="openRecharge" append-to-body> <template> <el-tabs v-model="activeRecharge" type="card" @tab-click="handleClick"> <el-tab-pane label="电子储值卡" name="balance"> <div style="font-size: 14px"> <div style="font-size: 14px;height: 50px;line-height: 50px">充值金额</div> <div v-if="cardValueList.length>0" style="display: flex;margin: 13px 5px;box-sizing: border-box;flex-wrap: wrap; "> <div class="mon" v-for="(item,index) in cardValueList" :key="index" :class="activeKey === index ? 'select2' : ''" @click="rechargeCard(index)"> <div class="top1"><span class="amount1">{{ item.rechargeBalance }}</span>元</div> <div>赠送<span style="color: #00afff">{{ item.giftBalance }}</span>元</div> </div> </div> <div style="font-size: 16px;width: 30%;margin-left: 13px;margin-top: 8px;" :class="activeKey === cardValueList.length ? 'select2' : ''" @click="rechargeCard(cardValueList.length,-1)"> <el-input placeholder="请输入充值金额" size="medium" v-model="cardValueForm.amount" @input="valueAmoutChange(cardValueForm.amount)" oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" > <template slot="prepend">自定义</template> <template slot="append">元</template> </el-input> </div> <!-- <el-row>--> <!-- <el-col :span="24">--> <div style="display: flex;justify-content: space-between;margin: 20px 0;"> <div class="jine"> <div class="zeng">赠送金额</div> <div> <el-input placeholder="0.00" v-model="cardValueForm.giftBalance" disabled> <template slot="append">元</template> </el-input> <span class="bom">赠送金额 自定义金额模式下将按照距离自定义金额最近的充值活动信息进行赠送</span> </div> </div> <div class="jine"> <div class="zeng">赠送积分</div> <div> <el-input placeholder="0" v-model="cardValueForm.points" disabled> <template slot="append">积分</template> </el-input> <span class="bom">赠送积分 自定义金额模式下将按照距离自定义金额最近的充值活动信息进行赠送</span> </div> </div> <div class="jine"> <div class="zeng">赠成长值</div> <div> <el-input placeholder="0" v-model="cardValueForm.growthValue" disabled> <template slot="append">成长值</template> </el-input> <span class="bom">赠送成长值 自定义金额模式下将按照距离自定义金额最近的充值活动信息进行赠送</span> </div> </div> <div class="jine"> <div class="zeng" style="width: 30%">提成员工</div> <div> <el-input :readonly="true" placeholder="请选择提成员工" v-model="cardValueForm.realName"> <el-button slot="append" @click="openStaff = true">选择员工</el-button> </el-input> <!-- <span class="bom">仅系统储值档次支持提成员工选择、自定义充值金额匹配低一档次</span>--> </div> </div> </div> <!-- </el-col>--> <!-- </el-row>--> <el-row> <el-col :span="24"> <div style="display: flex;margin-top: 20px"> <div style="font-size: 14px;width: 7%">充值备注</div> <el-input type="textarea" placeholder="" v-model="cardValueForm.remark" maxlength="255" show-word-limit > </el-input> </div> </el-col> </el-row> <el-row> <el-col :span="24"> <div style="display: flex;margin: 20px 0"> <div style="font-size: 14px;width: 7%">支付方式</div> <div> <el-radio v-for="dict in payList" v-model="cardValueForm.paymentType" v-if="dict.dictValue!='APPLET_CODE'" :key="dict.dictValue" :label="dict.dictValue" :value="dict.dictValue" border> {{ dict.dictLabel }} </el-radio> </div> </div> </el-col> </el-row> <div style="margin: 20px 0;text-align: center"> <el-button type="primary" @click="confirm(1)">确认充值</el-button> <el-button @click="cancel1">取 消</el-button> </div> </div> </el-tab-pane> <el-tab-pane label="电子囤油卡" name="literCard"> <el-row> <el-col :span="24"> <div style="display: flex"> <div style="font-size: 14px;width: 7%;line-height: 40px">油品类型</div> <el-radio-group v-model="tabOilType" style="margin-bottom: 30px;"> <el-radio-button v-for="(item,index) in oilTypeList" :label="item.oilType" @click.native="tabOilTypeClick(item.oilType)"> {{ item.type }} </el-radio-button> </el-radio-group> </div> </el-col> </el-row> <el-row> <el-col :span="1.5"> <div style="font-size: 14px;height: 50px;line-height: 50px;">充值金额</div> </el-col> <el-col :span="22"> <div style="display: flex;margin: 20px 5px;box-sizing: border-box;flex-wrap: wrap;"> <div class="mon2" v-for="(item,index) in cardFuelDieselList" :key="index" :class="activeKey === index ? 'select2' : ''" @click="recharge(index)"> <!-- <div class="top1"><span class="amount1">{{ item.incomeLitres }}</span>L</div>--> <div style="font-size: 14px">售价<span style="color: #00afff;">{{ item.rechargeBalance }}</span>元</div> <div style="font-size: 14px">锁价<span style="color: #00afff;">{{ item.lockPrice }}</span>/升</div> </div> </div> </el-col> </el-row> <!-- <el-row>--> <!-- <el-col :span="24">--> <div style="display: flex;margin-top: 60px"> <div class="jine"> <div class="zeng">赠送积分</div> <div> <el-input placeholder="0" disabled v-model="cardFuelDieselForm.points"> <template slot="append">积分</template> </el-input> <span class="bom">升数卡充值不支持自定义积分,选择对应充值活动获得对应积分</span> </div> </div> <div style="display:flex;margin-left: 20px"> <div style="font-size: 14px;line-height: 40px;width: 20%">提成员工</div> <div> <el-input :readonly="true" placeholder="请选择提成员工" v-model="cardFuelDieselForm.realName"> <el-button slot="append" @click="openStaff = true">选择员工</el-button> </el-input> </div> </div> </div> <!-- </el-col>--> <!-- </el-row>--> <el-row> <el-col :span="24"> <div style="display: flex"> <div style="font-size: 14px;width: 7%">充值备注</div> <el-input type="textarea" placeholder="" v-model="rechargeDesc" maxlength="255" show-word-limit > </el-input> </div> </el-col> </el-row> <el-row> <el-col :span="24"> <div style="display: flex;margin: 20px 0"> <div style="font-size: 14px;width: 7%">支付方式</div> <div> <el-radio v-for="dict in payList" v-model="cardFuelDieselForm.paymentType" v-if="dict.dictValue!=='APPLET_CODE'" :key="dict.dictValue" :label="dict.dictValue" :value="dict.dictValue" border>{{ dict.dictLabel }} </el-radio> </div> </div> </el-col> </el-row> <div style="margin: 20px 0;text-align: center"> <el-button type="primary" @click="confirm(2)">确认充值</el-button> <el-button @click="cancel1">取 消</el-button> </div> </el-tab-pane> <el-tab-pane label="礼品卡兑换电子储值卡余额" name="giftCard"> <el-form ref="form3" :model="form3" :rules="rules2" label-width="120px"> <el-row> <el-col :span="24"> <el-form-item label="卡号" prop="number" style="width: 500px"> <el-input v-model="form3.number" placeholder="请输入卡号" maxlength="30" /> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="24"> <el-form-item label="卡密" prop="cardPassword" style="width: 500px"> <el-input v-model="form3.cardPassword" placeholder="请输入卡密" maxlength="30" /> </el-form-item> </el-col> </el-row> </el-form> <div style="margin: 20px 0;text-align: center"> <el-button type="primary" @click="confirm1()">确认充值</el-button> <el-button @click="cancel1">取 消</el-button> </div> </el-tab-pane> </el-tabs> </template> </el-dialog> <!-- 确认充值--> <el-dialog :close-on-click-modal="false" title="确认充值" :visible.sync="openConfirm" width="500px" append-to-body> <div v-if="isPay" v-loading="loading"> <div style="text-align: center;font-size: 15px;font-weight: bold">付款金额</div> <div style="text-align: center;font-size: 30px;font-weight: bold;color: red;margin: 10px 0"> ¥{{ realyPayBills }} <!-- <el-tag effect="dark"> 汽油 </el-tag> --> </div> <!-- <div style="text-align: center;margin-bottom: 10px">赠送金额</div> --> <div v-if="(cardValueForm.paymentType !== 'CASH' && flag === 1) || (cardFuelDieselForm.paymentType !== 'CASH' && flag ===2) "> <div> <el-input v-model="authCode" v-focus ref="getFocus" autofocus @keydown.enter.native="collection1" placeholder="扫描或输入付款码、支持微信、支付宝、云闪付"> <i slot="suffix"> <svg t="1697791915471" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1479" width="32" height="32"> <path d="M149.333333 170.858667A21.546667 21.546667 0 0 1 170.858667 149.333333H384V106.666667H170.858667A64.213333 64.213333 0 0 0 106.666667 170.858667V384h42.666666V170.858667zM170.858667 874.666667A21.546667 21.546667 0 0 1 149.333333 853.141333V640H106.666667v213.141333A64.213333 64.213333 0 0 0 170.858667 917.333333H384v-42.666666H170.858667zM853.12 149.333333A21.546667 21.546667 0 0 1 874.666667 170.858667V384h42.666666V170.858667A64.213333 64.213333 0 0 0 853.141333 106.666667H640v42.666666h213.141333zM874.666667 853.141333A21.546667 21.546667 0 0 1 853.141333 874.666667H640v42.666666h213.141333A64.213333 64.213333 0 0 0 917.333333 853.141333V640h-42.666666v213.141333zM106.666667 490.666667h810.666666v42.666666H106.666667v-42.666666z" fill="#3D3D3D" p-id="1480"></path> </svg> </i> </el-input> </div> <div class="demo-image"> <div class="block" style="text-align: center"> <el-image style="width: 200px; height: 200px" fit="cover" src="https://oil.wudb.cn/static/img/scan-demo.fcb8b1ab.png"></el-image> </div> </div> </div> <div v-else> <div> <el-input v-model="authCode" v-focus ref="getFocus" autofocus maxlength="10" @input="changeSeekZero1" @keydown.enter.native="collection1" oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" placeholder="请输入收款金额"> </el-input> </div> <div style="text-align: right;margin: 10px 0"> <span>应找零</span> <span style="color: red;font-size: 18px"> ¥{{ seekZero }}</span> </div> </div> <el-divider></el-divider> <div style="display: flex;justify-content: space-around"> <el-button @click="cancelCollection">取消收款</el-button> <el-button type="primary" @click="collection1">确定收款</el-button> </div> </div> <div v-else> <div v-if="isPaySuccess"> <el-result icon="success" title="收款成功"> <template slot="extra"> <el-button type="primary" @click="handClose1">关 闭</el-button> </template> </el-result> </div> <div v-else-if="isAwait"> <el-result icon="warning" title="支付等待超时,请前往订单列表查看是否支付成功!"> <template slot="extra"> <el-button type="primary" @click="handClose1">关 闭</el-button> </template> </el-result> </div> <div v-else> <el-result icon="error" title="支付失败,请重新支付"> <template slot="extra"> <el-button type="primary" @click="handClose1">关 闭</el-button> </template> </el-result> </div> </div> </el-dialog> <!-- 选择员工--> <el-dialog :close-on-click-modal="false" width="50%" height="50%" title="选择员工" :visible.sync="openStaff" append-to-body> <select-staff @send-data="handleDataFromChild"> </select-staff> </el-dialog> <!-- 加油枪加油金额--> <el-dialog title="加油金额" :close-on-click-modal="false" :visible.sync="dialogVisibleamount" width="30%"> <div class="amount"> <span>已选油品</span> <span class="amountBlue">{{ getName(oilNameList,form.oilName) }}</span> </div> <div class="amount"> <span>已选油枪</span> <span class="amountBlue">{{ form.gunNames }}</span> </div> <div class="amount"> <span>油品单价</span> <span class="amountBlue">{{ form.oilPrice }}元/{{ form.unit }}</span> </div> <div > <el-input v-model="form.amount" v-focus @input="inputAmount" oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" maxlength="10" placeholder="请输入加油金额" style="font-weight: 700;text-align: center;font-size: 20px;"> <el-select v-model="select" style="width: 70px" @change="changeSelect" slot="append" placeholder="请选择"> <el-option label="元" value="元"></el-option> <el-option label="L" value="L"></el-option> </el-select> </el-input> <!-- <el-input v-model="form.amount"></el-input>--> </div> <el-row :gutter="20"> <el-col :span="6" v-for="(item,index) in rise" :key="index"> <el-button class="grid-content bg-purple" @click="changeAmount(item.value)">{{ item.value }}</el-button> </el-col> </el-row> <span slot="footer" class="dialog-footer" style="display: flex;justify-content: space-around"> <el-button @click="dialogVisibleamount = false" class="but">取 消</el-button> <el-button type="primary" @click="getOilOrder" class="but">确 定</el-button> </span> </el-dialog> <!-- 模糊查询会员列表信息--> <el-dialog title="请选择会员" :visible.sync="dialogVisibleMember" :close-on-click-modal="false"> <div class="wrap-wrap" style="height:700px;overflow-y: scroll;"> <el-table ref="tables" :data="memberList"> <el-table-column label="ID" align="center" prop="id" width="80" /> <el-table-column label="头像" align="center" width="70"> <template slot-scope="scope"> <img v-if="scope.row.avatar" class="list-avatar" :src="baseUrl + scope.row.avatar"> <img v-else class="list-avatar" src="@/assets/images/avatar.png"> </template> </el-table-column> <el-table-column label="姓名" align="center" prop="name" /> <el-table-column label="手机号" align="center" prop="mobile"/> <el-table-column label="注册时间" align="center" prop="createTime"> <template slot-scope="scope"> <span>{{ parseTime(scope.row.createTime) }}</span> </template> </el-table-column> <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <template slot-scope="scope"> <el-button type="primary" round @click="handleChoose(scope.row)" >选择</el-button> </template> </el-table-column> </el-table> </div> </el-dialog> <!-- 新增挂账信息--> <el-dialog title="挂账" width="700px" :visible.sync="dialogVisibleCredit" :close-on-click-modal="false"> <el-form ref="form" :model="form1" :rules="rules" label-width="120px"> <el-row> <el-col :span="24"> <el-form-item label="挂账单位" prop="unitName" style="width: 420px"> <el-autocomplete popper-class="my-autocomplete" v-model="form1.unitName" style="width: 180%" :fetch-suggestions="querySearch1" :trigger-on-focus="false" placeholder="请选择挂账单位" @select="changeUnit"> <template slot-scope="{ item }"> <div style="display: flex;justify-content: space-between"> {{item.unitName}}({{item.personCredit}} {{item.contactMobile}}) </div> </template> <!-- <el-button slot="append" @click="open1 = true">新增挂账单位</el-button>--> </el-autocomplete> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="24"> <el-form-item label="可用额度" prop="creditLimit"> <el-input v-model="form1.residueCreditLimit" placeholder="请先选择挂账单位" disabled> <template slot="append">元</template> </el-input> <span style="font-size: 12px;color: grey;"> 可用额度为挂账人的最大可用额度,如挂账金额大于可用额度,将无法进行挂账 </span> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="24"> <el-form-item label="挂账金额" prop="amount"> <el-input v-model="form1.amount" placeholder="请输入挂账金额" maxlength="30" > <template slot="append">元</template> </el-input> </el-form-item> </el-col> </el-row> <el-form-item label="备注信息" prop="remark"> <el-input v-model="form1.remark" type="textarea" placeholder="请输入内容"></el-input> </el-form-item> </el-form> <span slot="footer" class="dialog-footer"> <el-button @click="dialogVisibleCredit = false">取 消</el-button> <el-button type="primary" @click="addHangbill">确 定</el-button> </span> </el-dialog> <!-- 新增挂账单位信息--> <el-dialog title="新增挂账单位" :visible.sync="open1" width="700px" append-to-body> <el-form ref="formName" :model="form2" :rules="rules1" label-width="120px"> <el-row> <el-col :span="24"> <el-form-item label="挂账单位" prop="unitName"> <el-input v-model="form2.unitName" show-word-limit placeholder="请输入挂账单位名称" maxlength="50" /> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="24"> <el-form-item label="负责人" prop="personCredit"> <el-input v-model="form2.personCredit" show-word-limit placeholder="请输入挂账单位负责人姓名" maxlength="10" /> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="24"> <el-form-item label="联系电话" prop="contactMobile"> <el-input v-model="form2.contactMobile" show-word-limit placeholder="请输入挂账单位联系电话" maxlength="15" /> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="24"> <el-form-item label="挂账额度" prop="creditLimit"> <el-input v-model="form2.creditLimit" placeholder="请输入挂账额度,为0则不限额" maxlength="30"> <template slot="append">元</template> </el-input> <span style="font-size: 12px;color: grey;"> 额度为当前单位最大可挂账金额,如已挂账金额归还,额度将也同步返还 </span> </el-form-item> </el-col> </el-row> <el-form-item label="备注信息" prop="remark"> <el-input v-model="form2.remark" type="textarea" placeholder="请输入内容"></el-input> </el-form-item> <el-row> <el-col :span="24"> <el-form-item label="单位状态" prop="status"> <el-radio-group v-model="form2.status"> <el-radio label="qy" value="qy">启用</el-radio> <el-radio label="jy" value="jy">禁用</el-radio> </el-radio-group> </el-form-item> </el-col> </el-row> </el-form> <span slot="footer" class="dialog-footer"> <el-button @click="open1 = false">取 消</el-button> <el-button type="primary" @click="addCredit">确 定</el-button> </span> </el-dialog> <!-- 支付成功后小票打印内容 收银台订单--> <div id="reportSuccess" ref="report" class="box-center" v-show="false"> <div class="box-title">订单统计</div> <div class="box-ge"> <div class="input-box" v-for="(item,index) in oilOrder" :key="index"> <div>{{ getName(oilNameList,item.oilName) }}_{{getName1(gunList,item.gunName)}}</div> <div>¥{{ item.amount }}</div> </div> <div class="input-box" v-for="(item,index) in goodsOrder" :key="index"> <div>{{ item.name }}</div> <div v-if="isMember == false">{{ item.retailPrice }}</div> <div v-else>¥{{ item.memberPrice }}</div> </div> <div class="input-box"> <div>支付方式</div> <div v-if="payType == 'CASH'">现金</div> <div v-else-if="payType == 'WECHAT'">微信</div> <div v-else-if="payType == 'ALIPAY'">支付宝</div> <div v-else-if="payType == 'UNIONPAY'">银联二维码</div> <div v-else-if="payType == 'credit'">挂账</div> <!-- <div v-else-if="payType == 'oilCard'">囤油卡</div>--> <div v-else-if="payType == 'balance'">储值卡</div> <div v-else>小程序码</div> </div> <div class="input-box1"> <div v-if="payType == 'credit'">挂账单位</div> <div>{{ form1.unitName }}</div> </div> <div class="input-box"> <div v-if="payType != 'credit'">合计</div> <div v-else>挂账金额</div> <div>¥{{ (oilAmount+(+goodsAmount)).toFixed(2) }}</div> </div> <div class="input-box" v-if="(oilDiscount + goodsDiscount + fullReduction + couponAmount)>0"> <div>优惠合计</div> <div>¥{{ (oilDiscount + goodsDiscount + fullReduction + couponAmount).toFixed(2) }}</div> </div> <div class="input-box" v-if="isMember && consumeAmount>0"> <div>储值卡付款</div> <div>¥{{ consumeAmount }}</div> </div> <!-- <div class="input-box" v-if="isMember && consumeRefuelMoney>0"> <div>囤油卡付款</div> <div>¥{{ consumeRefuelMoney.toFixed(2) }}</div> </div>--> <div class="input-box"> <div>实付款</div> <div v-if="payType == 'credit'">¥0.00</div> <div v-else>¥{{ ((+oilActualPay)+(+goodsActualPay)).toFixed(2) }}</div> </div> <div class="input-box" v-if="seekZero>0"> <div>找零</div> <div>¥{{ seekZero.toFixed(2) }}</div> </div> </div> </div> <!-- 支付成功后小票打印内容 充值订单--> <div id="reportSuccess" ref="report1" class="box-center" v-show="false"> <div class="box-title">订单统计</div> <div class="box-ge"> <div class="input-box"> <div>充值金额</div> <div>¥{{ realyPayBills }}</div> </div> <div class="input-box" v-if="cardValueForm.giftBalance"> <div>赠送金额</div> <div>¥{{ cardValueForm.giftBalance }}</div> </div> <div class="input-box"> <div>到账金额</div> <div>¥{{ cardValueForm.giftBalance + realyPayBills }}</div> </div> <div class="input-box"> <div>支付方式</div> <div v-if="cardValueForm.paymentType == 'CASH'">现金</div> <div v-else-if="cardValueForm.paymentType == 'WECHAT'">微信</div> <div v-else-if="cardValueForm.paymentType == 'ALIPAY'">支付宝</div> <div v-else-if="cardValueForm.paymentType == 'UNIONPAY'">银联二维码</div> </div> <div class="input-box"> <div>实付款</div> <div v-if="cardValueForm.paymentType == 'CASH'">¥{{ authCode }}</div> <div v-else>¥{{ realyPayBills }}</div> </div> <div class="input-box" v-if="seekZero>0"> <div>找零</div> <div>¥{{ seekZero.toFixed(2) }}</div> </div> </div> </div> <!-- 支付成功后小票打印内容 充值订单--> <div id="reportSuccess" ref="report2" class="box-center" v-show="false"> <div class="box-title">订单统计</div> <div class="box-ge"> <div class="input-box"> <div>充值油品</div> <div>{{ cardFuelDieselForm.type }}</div> </div> <div class="input-box"> <div>充值升数</div> <div>{{ cardFuelDieselForm.incomeLitres }}L</div> </div> <div class="input-box"> <div>订单金额</div> <div>¥{{ realyPayBills }}</div> </div> <div class="input-box"> <div>锁价金额</div> <div>¥{{ cardFuelDieselForm.lockupPrice }}</div> </div> <div class="input-box"> <div>支付方式</div> <div v-if="cardFuelDieselForm.paymentType == 'CASH'">现金</div> <div v-else-if="cardFuelDieselForm.paymentType == 'WECHAT'">微信</div> <div v-else-if="cardFuelDieselForm.paymentType == 'ALIPAY'">支付宝</div> <div v-else-if="cardFuelDieselForm.paymentType == 'UNIONPAY'">银联二维码</div> </div> <div class="input-box"> <div>实付款</div> <div>¥{{ realyPayBills }}</div> </div> <div class="input-box" v-if="seekZero>0"> <div>找零</div> <div>¥{{ seekZero.toFixed(2) }}</div> </div> </div> </div> </div> </template> <script> import {getDicts} from "@/api/dict/data"; import {getOilNameList, getOilNumGun, listOilNumGun} from "@/api/cashier/oilnumgun"; import {listgoods} from "@/api/cashier/ljgoods"; import {getRecord, getUserInfoMobile, getUserVoMobile, getUserVoName} from "@/api/cashier/user"; import {queryStaffList, queryStaffs, staffInfo} from "@/api/cashier/staff"; import {addFavorable, addLJGoods, goodsOrder, oilOrder, scanAppletQrCode} from "@/api/cashier/oilorder"; import {getUserGrade, listUserGrade, userGradeInfo} from "@/api/cashier/usergrade"; import {getOilGun, getOilTank} from "@/api/cashier/oilGuns"; import {listCardFavorableRecord} from "@/api/cashier/cardfavorablerecord"; import {getOilNumberById, oilNumberList} from "@/api/cashier/oilnumber"; import {getPaymentActive, selectCoupon, selectPreferential, usePaymentActive} from "@/api/cashier/preferential"; import {addHangBill} from "@/api/cashier/hangbill"; import {addCreditUnit, listCreditUnit} from "@/api/cashier/creditunit"; import {cashierOrderByOrderNo} from "@/api/cashier/cashierorder"; import {getLodop,connectFlag} from "@/api/LodopFuncs"; import {giftCardExchange} from "@/api/cashier/giftCard/giftcard"; import BigNumber from "bignumber.js"; import { getCardValueListApi, getCheckTheStatusOfYourPaymentApi, getCheckTheStatusOfYourPaymentByFuelApi, getCountOilTypeApi, getList, getPrepaidCardTopUpApi, getPrepaidFuelTopUpApi } from "@/api/cashier/cardSet"; import SelectStaff from "@/components/local/selectStaff.vue"; import { getReturnCode, printCardValueReport, printFuelDieselReport, printOilOrderReport, sendPrintIndex } from "@/api/print"; const cityOptions = ['上海', '北京']; export default { name: "homeindex", components: {SelectStaff}, data(){ return{ rechargeBalCard:false, rechargeOilCard:false, openStaff:false, cardFuelDieselForm: { mtStaffId: '', realName: '', staffMobile: '', points: '', remark: '', rechargeBalance: '', //实际支付 paymentType: 'WECHAT', payType:'', oilType: '', type: '', chainStorId: '', incomeLitres: '', }, cardValueForm: { cardValueId: '', // 储值卡id mtStaffId: '', // realName: '', staffMobile: '', amount: '', // 自定义充值字段 bidBalance: '', // 储值卡面值 rechargeBalance: '', // 实际支付 giftBalance: '',// 赠送金额 points: '', //赠送积分 growthValue: '', // 赠送成长值 remark: '', paymentType: 'WECHAT', // 支付方式 payType:'', royaltyType: '',// 提成类型 percentageCommissions: null, amountCommission: null, rechargeType: '0' }, realyPayBills: 0, flag: null, isAwait: false, // 充值余额列表 cardValueList: [], activeKey: 0, tabOilType: '92', oilTypeList: {}, // 充值备注 rechargeDesc: '', // 存油卡列表 cardFuelDieselList: [], activeRecharge: 'balance', gunIndex:[], inputKey:'111', autofocus:false, baseUrl:process.env.VUE_APP_BASE_API, // 满减全选 checkAll1: false, isIndeterminate1: true, checkedCities1: [], cities1: cityOptions, fullReduceDiscount: [], // 等级全选 checkAll2: false, isIndeterminate2: true, checkedCities2: [], cities2: cityOptions, gradeDiscount: [], // 囤油卡全选 checkAll3: false, isIndeterminate3: true, checkedCities3: [], cities3: cityOptions, // 储值卡全选 checkAll4: false, isIndeterminate4: true, checkedCities4: [], cities4: cityOptions, // 优惠券全选 checkAll5: false, isIndeterminate5: true, checkedCities5: "", cities5: cityOptions, couponDiscount: [], // 优惠券列表 couponList:[], // 消费升数 consumeRefuelMoney:0, // 满减优惠 fullReduction:0, oilGunId:null, // 囤油卡信息 refuelMoney:null, refuelMoney1:[], paymentActive:{ type: 0, amount: 0, oilId: "", storeId: "", mtUserLevel: "", userId: "", }, // 会员消费金额(储值卡需要减少的金额) consumeAmount:0, // 囤油卡优惠金额 oilCardAmount:0, // 账户余额 balance:0, // 绑定金额数据 amount:"", // 找零金额 seekZero:0, // 等待中 loading:false, openRecharge:false, openConfirm:false, // 油号 oilType:'', oilNameID:'', // 油品类型 type:"", // 取单列表 takeList:[], // 挂单备注检索 putRemark:"", // 挂单备注 registrationRemark:"", // 挂单列表 registrationList:[], // 油品订单 oilOrder:[], // 油品金额 oilAmount:0, // 油品订单数 oilTotal:0, // 油品实付金额 oilActualPay:0, // 油品优惠金额 oilDiscount:0, // 扣除升数后需要消费的金额 hoardAmount:0, // 是否使用囤油卡 isOilStorageCard:false, // 商品优惠金额 goodsDiscount:0, // 商品实付金额 goodsActualPay:0, // 商品订单 goodsOrder:[], // 商品金额 goodsAmount:0, // 商品订单数 goodsTotal:0, cardFavorableId:"", recordId:"", // 加油金额 rise:[ {value:"¥100"}, {value:"¥150"}, {value:"¥200"}, {value:"¥300"}, ], // 会员信息 member:{id:""}, // 会员等级信息 grade:{}, // 会员列表信息 memberList:[], select1:'会员手机号', storeId:"", // 查询会员信息参数 userNo:"", // 查询的商品信息 goods:"", select:"元", form:{ amount : "",exist:false }, form1:{ amount:"", }, form2:{ unitName:"", personCredit:"", contactMobile:"", creditLimit:0, remark:'', status:'qy', }, form3: {}, oilNumGunList:[], authCode:'', // 油号列表 oilNumList:[], // 商品列表 goodsList:[], // 油枪列表 oilGunList:[], // 支付方式列表 payList:[], // 倒计时 timestamp: 15, dialogVisible: false, dialogVisiblej: false, dialogVisiblejLoading: false, dialogVisiblevip:false, dialogVisibleamount:false, dialogVisibleMember:false, dialogRegistration:false, dialogSuccess:false, dialogTakeOrder:false, dialogVisibleCredit:false, open1:false, activeName: '-1', tabarr:[ {name:'收银台',icon:'el-icon-s-platform'}, {name:'充值',icon: 'el-icon-s-finance'}, {name:'订单',icon: 'el-icon-s-order'}, {name:'会员',icon: 'el-icon-s-custom'}, {name:'核销',icon: 'el-icon-s-check'}, {name:'挂账',icon:'el-icon-s-claim'}, {name:'积分',icon:'el-icon-s-data'}, {name:'交班',icon: 'el-icon-s-flag'}, ], leftindex:0, oilList:[], colorList:[ {color:'#e5f0ff',border:"#fe8c4a"}, {color:'#fff2e5',border:"#FF9655"}, {color:'#ecfae5',border:"#0DC291"}, {color:'#fff8e7',border:"#FFB519"} ], restaurants:'', num: 1, // 油号名称 oilNameList:'', // 员工列表 staffList:[], isMember: false, // 员工信息 staff:"", // 优惠券id couponIds:[], // 使用的优惠券id useCouponIds:"", payType:"WECHAT", map:{ allAmount:0, // 用户支付条码信息 authCode:'', // 油品订单 oilOrder:"", // 商品订单 goodsOrder:"", // 支付方式 payType:"WECHAT", // 油品订单金额 oilAmount:0, // 商品订单金额 goodsAmount:0, // 油品实付金额 oilActualPay:0, // 商品实付金额 goodsActualPay:0, // 付款用户 payUser:"", // 油品优惠金额 oilDiscount:0, // 商品优惠金额 goodsDiscount:0, // 员工id staffId:"", // 优惠券id couponId:"", // 会员id userId:"", // 提成金额 commissionAmount:0, // 使用积分数量 usePoint:0, // 积分金额 pointAmount:0, // 终端 terminal:"PC", // 商品数量 goodsNum:0, // 会员消费金额(储值卡需要减少的金额) consumeAmount:0, // 消费后的升数json refuelMoney:"", // 找零金额 seekZero:0, }, // 会员等级名称 gradeName:"", // 会员等级列表 gradeList:"", menu:1, index:0, // 是否支付 isPay:false, isPaySuccess:false, // 订单号 orderNo:'', timer: null, // 是否一直查询 isQuery:true, // 油枪列表 gunList:[], // 油号列表 oilNumberList:[], // 是否可以点会员确定按钮 isSure:false, // 优惠券消费金额 couponAmount:0, // 是否为满减互斥 isUseFull:false, // 是否为储值卡互斥 isUseBalance:false, // 互斥限制 -1没有限制 0满减互斥 1储值卡互斥 exclusion:-1, isExistOilOrder:false, // 是否存在固定等级会员优惠 isFixingLevel:false, // 是否为 isFixingBalance:false, // 查询优惠活动信息所需参数 preferentialData:{ userId:"", storeId:"", gradeId:"", oilName:"", oilPrice:"", oilLiters:"", }, jishuqi:0, preferentialData1:{}, oilPreferentialData:[], // 挂账单位信息 unitList:[], // 表单校验 rules: { unitName: [ { required: true, message: "请选择挂账单位", trigger: "blur" }, ], amount: [{ required: true, message: "请输入挂账金额", trigger: "blur" }], creditLimit: [{ required: true, message: "可用额度不可为空", trigger: "blur" }], }, rules1: { unitName: [ { required: true, message: "请填写挂账单位名称", trigger: "blur" }, ], personCredit: [{ required: true, message: "请填写挂账单位负责人姓名", trigger: "blur" }], contactMobile: [ { required: true, message: "请填写挂账单位联系电话", trigger: "blur" }, ], creditLimit: [ { required: true, message: "请填写挂账额度", trigger: "blur" }, ], status: [ { required: true, message: "请选择挂账单位状态", trigger: "blur" }, ], }, continuePolling: true, // 控制轮询的变量 // 表单校验 rules2: { number: [{required: true, message: "请输入卡号", trigger: "blur"}], cardPassword: [{required: true, message: "请输入卡密", trigger: "blur"}], } } }, created() { this.getPayList(); this.getOilName(); this.getGoods(); // this.getStaffList(); // this.getStaff(); this.getList(); this.getCouponList(); // this.getUnitList(); }, directives: { // 注册一个局部的自定义指令 v-focus focus: { // 指令的定义 inserted: function (el) { // 聚焦元素 el.querySelector('input').focus() // this.$nextTick( () =>{ // this.$refs.getFocus.focus() // }) }, }, }, watch: { dialogVisiblej(newValue) { if (!newValue) { this.handClose() this.resetting1() } } }, methods:{ queryUser(){ this.refuelMoney = null this.dialogVisiblevip = true }, handleDataFromChild(data) { this.openStaff = false // this.cardFuelDieselForm= { // mtStaffId: data.mtStaffId, // realName: data.realName, // staffMobile: data.staffMobile, // }, // this.cardValueForm= { // mtStaffId: data.mtStaffId, // realName: data.realName, // staffMobile: data.staffMobile, // }, this.cardFuelDieselForm.mtStaffId = data.mtStaffId this.cardFuelDieselForm.realName = data.realName this.cardFuelDieselForm.staffMobile = data.staffMobile this.cardValueForm.mtStaffId = data.mtStaffId this.cardValueForm.realName = data.realName this.cardValueForm.staffMobile = data.staffMobile }, // 存油卡查询 async getCardFuelDieselList() { let quy = { pageNo: 1, pageSize: 10000, activeStatus: 1, status: 1, activityProgress: 1 } await getList(quy).then(res => { this.sourceCardFuelDieselList = res.data.records }) }, // 储值卡查询 async getCardValueList() { let quy = { pageNo: 1, pageSize: 10000, isonline: 0, activeStatus: 1 } await getCardValueListApi(quy).then(res => { this.cardValueList = res.data.records; this.cardValueList.sort((a, b) => a.rechargeBalance - b.rechargeBalance); }) if (this.cardValueList.length > 0) { // 过滤 if (this.grade && this.grade.name) { this.cardValueList = this.cardValueList.filter(item => { return item.groupOriented === "1" || item.membershipLevel.includes(this.grade.id); }); this.rechargeCard(0); } else { this.cardValueList = this.cardValueList.filter(item => { return item.groupOriented === "1"; }); if (this.cardValueList.length > 0) { this.rechargeCard(0); } } } this.$forceUpdate(); }, // 关闭支付窗口 handClose1() { this.isPay = true, this.isPaySuccess = false, this.isQuery = true this.openConfirm = false this.openRecharge = false // this.isPaySuccess = false; this.authCode = null this.activeRecharge = 'balance' this.seekZero = 0 this.iniz() this.cardFuelDieselForm = {} this.childComponentKey = this.childComponentKey+1 }, // 查询参加存油卡油品 getCountOilType() { getCountOilTypeApi().then(res => { this.oilTypeList = res.data if (this.oilTypeList.length > 0) { // 默认选中第一个 this.tabOilType = this.oilTypeList[0].oilType this.selectOilType(this.oilTypeList[0].status, this.oilTypeList[0].oilType); } }) }, inputAmount(){ this.$forceUpdate(); }, selectOilType(status, oilType) { this.tabOilType = oilType; this.tabOilTypeClick(oilType); }, // 会员充值 async userRecharge() { if (!this.isSure){ // if (this.member){ this.$message.error("请先选择会员") return; } if (this.member && this.member.gradeId){ await getUserGrade(this.member.gradeId).then(res => { this.grade = res.data }) } await this.getCardFuelDieselList() await this.getCardValueList() await this.getCountOilType() await this.getPayList(); this.openRecharge = true; // 存油卡列表 }, valueAmoutChange(data) { // this.cardValueForm.amount = null this.$set(this.cardValueForm, 'amount', data); if (!data) { this.cardValueForm.amount = '' } else { this.cardValueForm.amount = data } this.cardValueForm.points = '' this.cardValueForm.bidBalance = '' this.cardValueForm.giftBalance = '' this.cardValueForm.growthValue = '' this.cardValueForm.rechargeBalance = '' this.cardValueForm.royaltyType = '' this.cardValueForm.percentageCommissions = '' this.cardValueForm.amountCommission = '' this.cardValueForm.rechargeType = 1 this.cardValueForm.rechargeBalance = data if (this.cardValueList.length > 0) { // const changeList = this.cardValueList this.cardValueList.forEach(change => { if (data >= change.rechargeBalance) { this.cardValueForm.points = change.points this.cardValueForm.bidBalance = change.bidBalance this.cardValueForm.giftBalance = change.giftBalance this.cardValueForm.growthValue = change.growthValue this.cardValueForm.rechargeBalance = change.rechargeBalance this.cardValueForm.royaltyType = change.royaltyType this.cardValueForm.percentageCommissions = change.percentageCommissions this.cardValueForm.amountCommission = change.amountCommission this.cardValueForm.cardValueId = change.id // this.cardValueForm.rechargeBalance // 计算员工提成金额 if (change.royaltyType === "3") { // 当按比例提成时 计算对应的金额 const percentageCommissions = new BigNumber(change.percentageCommissions); const totalAmount = new BigNumber(data); const commissionAmount = totalAmount.multipliedBy(percentageCommissions).dividedBy(100).decimalPlaces(2); this.cardValueForm.amountCommission = commissionAmount } } }) } }, // 充值后更新会员信息 async getMemberAfter(){ await getUserInfoMobile({mobile:this.member.mobile}).then(res => { if (res.data){ this.member = res.data // if (res.data.refuelMoney){ // this.refuelMoney = JSON.parse(res.data.refuelMoney) // } this.rechargeBalCard = false this.rechargeOilCard = false } }) }, async collection1() { let actualPayment = 0 let makeChange = 0 let userForm = this.member if (this.flag === 1) { if (!this.authCode && this.cardValueForm.paymentType !== "CASH") { this.$message.error('请先扫码'); return }else { if (this.authCode<this.cardValueForm.amount || this.seekZero<0){ this.$modal.msgError("请输入正确的金额"); return; } if (!this.authCode){ this.$modal.msgError("请输入正确的金额"); return; } actualPayment = this.authCode makeChange = this.seekZero } // 会员id 会员名字会员手机号码 this.cardValueForm.mtUserId = userForm.id this.cardValueForm.name = userForm.name this.cardValueForm.mobile = userForm.mobile // 支付码 this.cardValueForm.authCode = this.authCode this.cardValueForm.realyPayBills = this.realyPayBills this.cardValueForm.actualPayment = actualPayment this.cardValueForm.makeChange = makeChange let id; await getPrepaidCardTopUpApi(this.cardValueForm).then(response => { if (response.data != null) { this.loading = true; id = response.data.id } }); let this_ = this // let timer = setInterval(async () => { await getCheckTheStatusOfYourPaymentApi(id).then(async response => { if (response.data != null) { const payStatus = response.data.payStatus if (payStatus === "unpaid") { this_.isQuery = true; } else if (payStatus === "paid") { // 当支付成功时 this_.isPaySuccess = true; this_.isQuery = false; this_.rechargeBalCard = true // await this_.printLocally1() await this_.cardValueReport() await this_.getMemberAfter(); clearInterval(timer); } else if (payStatus === "payFail") { this_.isPaySuccess = false; this_.isQuery = false; clearInterval(timer); } } await this_.getMemberAfter(); }) }, 1000); let timer2 = setInterval(function () { if (!this_.isQuery || !this_.openConfirm) { this_.loading = false; this_.isPay = false; clearInterval(timer); clearTimeout(timer3); } }, 500) var timer3 = setTimeout(function () { clearInterval(timer2); clearInterval(timer); this_.loading = false; this_.isPay = false; this_.isPaySuccess = false; this_.isAwait = true; }, 15000) } else if (this.flag === 2) { if (!this.authCode && this.cardFuelDieselForm.paymentType !== "CASH") { this.$message.error('请先扫码'); return }else { if (this.authCode<this.cardValueForm.amount || this.seekZero<0){ this.$modal.msgError("请输入正确的金额"); return; } if (!this.authCode){ this.$modal.msgError("请输入正确的金额"); return; } actualPayment = this.authCode makeChange = this.seekZero } this.cardFuelDieselForm.mtUserId = userForm.id this.cardFuelDieselForm.name = userForm.name this.cardFuelDieselForm.mobile = userForm.mobile this.cardFuelDieselForm.authCode = this.authCode this.cardFuelDieselForm.actualPayment = actualPayment this.cardFuelDieselForm.makeChange = makeChange let id; await getPrepaidFuelTopUpApi(this.cardFuelDieselForm).then(response => { if (response.data != null) { this.loading = true; id = response.data.id } }); let timer = setInterval(async () => { getCheckTheStatusOfYourPaymentByFuelApi(id).then(async response => { if (response.data != null) { if (response.data.payStatus == "unpaid") { this_.isQuery = true; } if (response.data.payStatus == "paid") { this_.isPaySuccess = true; this_.isQuery = false; this_.rechargeOilCard = true // await this.printLocally2() await this.fuelDieselReport() await this.getMemberAfter(); clearInterval(timer); } if (response.data.payStatus == "payFail") { this_.isPaySuccess = false; this_.isQuery = false; clearInterval(timer); } } }) }, 500); let timer2 = setInterval(function () { if (this_.isQuery == false || !this_.openConfirm) { this_.loading = false; this_.isPay = false; clearInterval(timer); clearInterval(timer2); } }, 500) setTimeout(function () { clearInterval(timer2); clearInterval(timer); this_.loading = false; this_.isPay = false; this_.isPaySuccess = false; this_.isAwait = true; }, 15000) let this_ = this } this.$forceUpdate(); }, cancelCollection() { this.openConfirm = false; this.continuePolling = false; }, // 选择余额充值金额 rechargeCard(index, item) { // this.cardValueForm.amount = null, this.cardValueForm.rechargeType = 0 this.activeKey = index; if (item === -1) { this.cardValueForm.points = 0 this.cardValueForm.giftBalance = 0 this.cardValueForm.growthValue = 0 this.cardValueForm.bidBalance = 0 // this.cardValueForm.bidBalance = 1 // this.cardValueForm.amount = 0 } else { if (this.cardValueList <= 0) return let file = {} // 拿到金额 file = this.cardValueList[index] this.realyPayBills = file.rechargeBalance this.cardValueForm.rechargeBalance = file.rechargeBalance this.cardValueForm.bidBalance = file.bidBalance this.cardValueForm.points = file.points this.cardValueForm.giftBalance = file.giftBalance this.cardValueForm.growthValue = file.growthValue this.cardValueForm.cardValueId = file.id this.cardValueForm.amount = null this.cardValueForm.royaltyType = file.royaltyType this.cardValueForm.percentageCommissions = file.percentageCommissions this.cardValueForm.amountCommission = file.amountCommission // 计算员工提成金额 if (file.royaltyType === "3") { // 当按比例提成时 计算对应的金额 const percentageCommissions = new BigNumber(file.percentageCommissions); const totalAmount = new BigNumber(file.rechargeBalance); const commissionAmount = totalAmount.multipliedBy(percentageCommissions).dividedBy(100).decimalPlaces(2); this.cardValueForm.amountCommission = commissionAmount } } }, // 根据油品过滤查询存油卡 async tabOilTypeClick(data) { await this.getCardFuelDieselList() this.cardFuelDieselList = this.sourceCardFuelDieselList.filter(item => { return item.oilType === data; }); if (this.cardFuelDieselList.length > 0) { this.recharge(0) } }, confirm1(){ this.$refs["form3"].validate(valid => { if (valid) { this.form3.userId = this.member.id let cardGift = this.form3 giftCardExchange(cardGift).then(res => { if (res.data.id == '' || res.data.id == null) { this.$message.error('兑换失败!'); } else { this.$message.success('兑换成功!'); this.openRecharge = false this.form3.number = '' this.form3.cardPassword = '' this.getMemberAfter(); } }) } }) }, // 取消按钮 cancel1() { this.openRecharge = false; this.isPay = true; this.openConfirm = false this.openRecharge = false this.isPaySuccess = false; this.authCode = null this.activeRecharge = 'balance' this.cardValueForm = {} this.cardFuelDieselForm = {} this.continuePolling = false this.iniz() }, iniz() { this.cardValueForm = { cardValueId: '', // 储值卡id mtStaffId: '', // realName: '', staffMobile: '', amount: '', // 自定义充值字段 bidBalance: '', // 储值卡面值 rechargeBalance: '', // 实际支付 giftBalance: '',// 赠送金额 points: '', //赠送积分 growthValue: '', // 赠送成长值 remark: '', paymentType: 'WECHAT', // 支付方式 royaltyType: '',// 提成类型 percentageCommissions: null, amountCommission: null, rechargeType: '0' } }, // 选择充值金额 recharge(index, item) { this.activeKey = index; let file = {} // 拿到金额 file = this.cardFuelDieselList[index] this.cardFuelDieselForm.points = file.points this.cardFuelDieselForm.rechargeBalance = file.rechargeBalance this.cardFuelDieselForm.oilType = file.oilType this.cardFuelDieselForm.type = file.type this.cardFuelDieselForm.chainStorId = file.chainStorId this.cardFuelDieselForm.incomeLitres = file.incomeLitres this.cardFuelDieselForm.lockupPrice = file.lockPrice this.cardFuelDieselForm.cardFuelId = file.id this.cardFuelDieselForm.expireTime = file.expireTime // this.realyPayBills = file.rechargeBalance }, // 确认充值 async confirm(flag) { this.flag = flag if (flag === 1) { if (this.cardValueForm.paymentType === '') { this.$message.error('请选择支付方式'); return } if (this.cardValueForm.amount != null) { this.cardValueForm.rechargeType = 1 if (!this.cardValueForm.amount || this.cardValueForm.amount < 0) { this.$message.error('请选择输入自定义金额'); return } this.realyPayBills = this.cardValueForm.amount } else { this.cardValueForm.rechargeType = 0 this.realyPayBills = this.cardValueForm.rechargeBalance } } else if (flag === 2) { if (this.cardFuelDieselForm.paymentType === '') { this.$message.error('请选择支付方式'); return } this.realyPayBills = this.cardFuelDieselForm.rechargeBalance } // 发送扫码机请求(易联云网络下发) await this.getSendPrintIndex(this.realyPayBills); this.openConfirm = true; this.isPay = true this.getCode(this.realyPayBills,1) }, printLocally() { if (!connectFlag){ return } try { //初始化打印函数 let LODOP = getLodop(); // 初始化打印 if (LODOP) { LODOP.PRINT_INIT(); var bodyStyle = `<style> .input-box{ width: 100%; display: flex; align-items: center; justify-content: space-between; font-size: 14px; margin: 5px 0px; } .input-box1{ width: 100%; font-size: 14px; margin: 5px 0px; } .box-ge{ border-bottom: 1px solid #000000 ; box-sizing: border-box; padding: 10px; } .box-title{ font-size: 18px; text-align: center; align-items: center; margin-top: 15px; } .input-hui{ width: 100%; display: flex; align-items: center; justify-content: space-between; font-size: 14px; margin: 15px 0px; background: #b2b2b2; box-sizing: border-box; padding: 5px 0px; } .input-hui-frou{ width: 100%; display: flex; align-items: center; justify-content: space-between; font-size: 14px; margin: 15px 0px; background: #b2b2b2; box-sizing: border-box; padding: 5px 0px; div{ width: 25%; text-align: left; } } .input-box-frou{ width: 100%; display: flex; align-items: center; justify-content: space-between; font-size: 14px; margin: 5px 0px; div{ width: 25%; text-align: left; } } .box-center{ height: 500px; } </style> ` var fromHtml = bodyStyle + this.$refs.report.innerHTML LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", fromHtml); LODOP.SET_PRINT_MODE("FULL_WIDTH_FOR_OVERFLOW", true); // LODOP.ADD_PRINT_BARCODE(10,40,100,100,'QRCode','123456789'); // let preview = LODOP.PREVIEW(); LODOP.PRINT(); } }catch (e){ console.log(e,'打印机报错') } }, async printLocally1() { if (!connectFlag){ return } //初始化打印函数 let LODOP = getLodop(); // 初始化打印 if (LODOP) { LODOP.PRINT_INIT(); var bodyStyle = `<style> .input-box{ width: 100%; display: flex; align-items: center; justify-content: space-between; font-size: 14px; margin: 5px 0px; } .input-box1{ width: 100%; font-size: 14px; margin: 5px 0px; } .box-ge{ border-bottom: 1px solid #000000 ; box-sizing: border-box; padding: 10px; } .box-title{ font-size: 18px; text-align: center; align-items: center; margin-top: 15px; } .input-hui{ width: 100%; display: flex; align-items: center; justify-content: space-between; font-size: 14px; margin: 15px 0px; background: #b2b2b2; box-sizing: border-box; padding: 5px 0px; } .input-hui-frou{ width: 100%; display: flex; align-items: center; justify-content: space-between; font-size: 14px; margin: 15px 0px; background: #b2b2b2; box-sizing: border-box; padding: 5px 0px; div{ width: 25%; text-align: left; } } .input-box-frou{ width: 100%; display: flex; align-items: center; justify-content: space-between; font-size: 14px; margin: 5px 0px; div{ width: 25%; text-align: left; } } .box-center{ height: 500px; } </style> ` var fromHtml = bodyStyle + this.$refs.report1.innerHTML LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", fromHtml); LODOP.SET_PRINT_MODE("FULL_WIDTH_FOR_OVERFLOW", true); // LODOP.ADD_PRINT_BARCODE(10,40,100,100,'QRCode','123456789'); // let preview = LODOP.PREVIEW(); LODOP.PRINT(); } }, async printLocally2() { if (!connectFlag){ return } //初始化打印函数 let LODOP = getLodop(); // 初始化打印 if (LODOP) { LODOP.PRINT_INIT(); var bodyStyle = `<style> .input-box{ width: 100%; display: flex; align-items: center; justify-content: space-between; font-size: 14px; margin: 5px 0px; } .input-box1{ width: 100%; font-size: 14px; margin: 5px 0px; } .box-ge{ border-bottom: 1px solid #000000 ; box-sizing: border-box; padding: 10px; } .box-title{ font-size: 18px; text-align: center; align-items: center; margin-top: 15px; } .input-hui{ width: 100%; display: flex; align-items: center; justify-content: space-between; font-size: 14px; margin: 15px 0px; background: #b2b2b2; box-sizing: border-box; padding: 5px 0px; } .input-hui-frou{ width: 100%; display: flex; align-items: center; justify-content: space-between; font-size: 14px; margin: 15px 0px; background: #b2b2b2; box-sizing: border-box; padding: 5px 0px; div{ width: 25%; text-align: left; } } .input-box-frou{ width: 100%; display: flex; align-items: center; justify-content: space-between; font-size: 14px; margin: 5px 0px; div{ width: 25%; text-align: left; } } .box-center{ height: 500px; } </style> ` var fromHtml = bodyStyle+this.$refs.report2.innerHTML LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", fromHtml); LODOP.SET_PRINT_MODE("FULL_WIDTH_FOR_OVERFLOW",true); // LODOP.ADD_PRINT_BARCODE(10,40,100,100,'QRCode','123456789'); // let preview = LODOP.PREVIEW(); LODOP.PRINT(); } }, clear(){ // this.autofocus = false this.dialogVisiblej = false this.continuePolling = false this.seekZero = 0 let mobile = this.member.mobile getUserInfoMobile({mobile:mobile}).then( response => { if (response.data){ this.member = response.data // if (response.data.refuelMoney){ // this.refuelMoney = JSON.parse(response.data.refuelMoney) // }else { // this.refuelMoney = null // } this.storeId = response.data.storeId this.isSure = true } }) }, getOilNames(list,id){ let name = "" let _this = this; if(list!=null && list!=""){ list.forEach(item => { if (item.numberId == id){ name = item.oilName; // _this.oilType = item.oilName; } }) } return name; }, getOilNamess(list,id){ let name = "" if(list!=null && list!=""){ list.forEach(item => { if (item.id == id){ name = item.oilName; } }) } return name; }, // 挂账 addCredits(type){ if (this.oilAmount==0){ this.$message.error("请先选择挂账订单") return; } this.typeIdex = type this.map.payType = "credit" this.payType = "credit" this.dialogVisibleCredit = true this.form1.amount = this.oilAmount + this.goodsAmount }, // 获取挂账单位列表 getUnitList(){ let obj = {}; let _this = this; listCreditUnit().then( response => { response.data.forEach(item => { obj = item; obj.value = `${item.unitName}(${item.personCredit} ${item.contactMobile})` _this.unitList.push(obj) }) }) }, // 添加挂账单位信息 addCredit(){ this.$refs["formName"].validate((valid) => { if (valid) { addCreditUnit(this.form2).then( response => { this.$modal.msgSuccess("挂账单位信息创建成功"); this.open1 = false; this.getUnitList(); }) }else { return false; } }) }, // 添加挂账记录 addHangbill(){ this.$refs["form"].validate((valid) => { if (valid) { addHangBill(this.form1).then( async response => { if (response.data==1){ await this.addOrder(); this.$modal.msgSuccess("挂账记录添加成功"); this.dialogVisibleCredit = false; this.printLocally() this.oilOrderReport() this.form1.unitName = "" this.payType = "WECHAT" this.resetMember(); this.resetting(); this.empty(); }else { this.$modal.msgError("挂账单位可用额度不足,无法进行挂账"); } }) }else { return false; } }) }, // 添加挂账订单信息 async addOrder() { this.map.seekZero = this.seekZero; this.map.oilAmount = this.oilAmount; this.map.payType = this.payType; this.map.goodsAmount = this.goodsAmount; this.map.oilActualPay = this.oilActualPay; this.map.goodsActualPay = this.goodsActualPay; this.map.oilDiscount = 0.0; this.map.goodsDiscount = 0.0; this.map.goodsNum = this.goodsTotal; this.map.balanceAmount = 0.0; this.map.oilCardAmount = 0.0; this.map.oilOrder = JSON.stringify(this.oilOrder); this.map.goodsOrder = JSON.stringify(this.goodsOrder); this.map.authCode = this.authCode; this.map.allAmount = +this.oilActualPay + +this.goodsActualPay this.map.consumeAmount = 0.0; // this.map.refuelMoney = JSON.stringify(this.refuelMoney) this.map.couponId = this.useCouponIds if (this.staff){ this.map.staffId = this.staff.id } this.map.cardFavorableId = this.cardFavorableId this.map.recordId = this.recordId this.map.userId = this.member.id await addLJGoods(this.map).then(response => { }) }, // 选择挂账单位 changeUnit(val){ this.form1.creditUnitId = val.id; this.form1.creditLimit = val.creditLimit this.form1.residueCreditLimit = val.residueCreditLimit return val.id }, async querySearch1(queryString, cb) { await this.getUnitList(); let _this = this; let obj = {}; let results = _this.unitList if (queryString){ _this.unitList.forEach(item => { results = []; if (item.unitName.includes(queryString)){ obj = item; obj.value = `${item.unitName}(${item.personCredit} ${item.contactMobile})` results.push(obj) return; } if (item.personCredit.includes(queryString)){ obj = item; obj.value = `${item.unitName}(${item.personCredit} ${item.contactMobile})` results.push(obj) return; } if (item.contactMobile.includes(queryString)){ obj = item; obj.value = `${item.unitName}(${item.personCredit} ${item.contactMobile})` results.push(obj) return; } }) } cb(results); }, // 计算找零金额 changeSeekZero(){ this.seekZero = this.authCode - this.oilActualPay - this.goodsActualPay }, // 计算找零金额 changeSeekZero1(){ this.seekZero = this.authCode - this.realyPayBills }, // 获取会员等级id getGradeName(list,id){ let name = ""; list.forEach(item => { if (item.id == id){ name = item.name } }) this.gradeName = name; return name; }, // 选择优惠信息 handleCheckAllChange1(val) { let list = [] this.fullReduceDiscount.forEach(item => { list.push(item.gunName) }) if (val){ this.fullReduction = 0; this.fullReduceDiscount.forEach(item => { this.fullReduction += +item.discount }) this.checkAll3 = false this.consumeRefuelMoney = 0; this.isOilStorageCard = false; }else { this.fullReduction = 0; } this.checkedCities1 = val ? list : []; this.isIndeterminate1 = false; this.countAmountFull(); }, handleCheckedCitiesChange1(value) { if (value.length>0){ this.checkAll3 = false this.consumeRefuelMoney = 0; this.isOilStorageCard = false; } this.fullReduction = 0; this.fullReduceDiscount.forEach(item => { let reduces = 0 for (let i = 0; i < value.length; i++){ if (item.gunName == value[i]){ reduces = item.discount } } this.fullReduction += +reduces }) let checkedCount = value.length; this.checkAll1 = checkedCount === this.fullReduceDiscount.length; this.isIndeterminate1 = checkedCount > 0 && checkedCount < this.fullReduceDiscount.length; this.countAmountFull(); }, handleCheckAllChange2(val) { let list = [] this.gradeDiscount.forEach(item => { list.push(item.gunName) }) if (val){ this.oilDiscount = 0 this.gradeDiscount.forEach(item => { this.oilDiscount += +item.discount }) this.checkAll3 = false this.consumeRefuelMoney = 0; this.isOilStorageCard = false; }else { this.oilDiscount = 0 } this.checkedCities2 = val ? list : []; this.isIndeterminate2 = false; this.countAmountFull(); }, handleCheckedCitiesChange2(value) { if (value.length>0){ this.checkAll3 = false this.consumeRefuelMoney = 0; this.isOilStorageCard = false; } this.oilDiscount = 0 this.gradeDiscount.forEach(item => { let reduces = 0 for (let i = 0; i < value.length; i++){ if (item.gunName == value[i]){ reduces = item.discount } } this.oilDiscount += +reduces }) let checkedCount = value.length; this.checkAll2 = checkedCount === this.gradeDiscount.length; this.isIndeterminate2 = checkedCount > 0 && checkedCount < this.gradeDiscount.length; this.countAmountFull(); }, handleCheckAllChange3(val) { if (val==false){ this.consumeRefuelMoney = 0; // this.hoardAmount = 0; this.isOilStorageCard = false; if (this.balance>0){ this.checkAll4 = true if (this.goodsOrder.length==0) { this.payType = "balance" } }else { this.payType = "WECHAT" } }else { this.checkAll4 = false this.payType = "oilCard" // this.isOilStorageCard = true; this.changeRefuelMoney() } this.isDefaultUseCard(); }, handleCheckAllChange4(val) { if (val==false){ this.payType = "WECHAT" this.countAmountUnBalance(); this.consumeAmount = 0; this.isUseBalance = true; }else { this.checkAll3 = false this.isOilStorageCard = false; this.consumeRefuelMoney = 0; if (this.goodsOrder.length==0) { this.payType = "balance" } this.countAmountFull(); this.isUseBalance = false; } if (!this.isFixingLevel){ this.getOilCoupon() } }, handleCheckAllChange5(val) { if (val){ // this.couponAmount = 0 this.couponDiscount.forEach(item => { this.couponAmount = item.discount }) this.checkAll3 = false this.consumeRefuelMoney = 0; this.isOilStorageCard = false; }else { this.couponAmount = 0 if (this.balance>0){ this.checkAll4 = true if (this.goodsOrder.length==0) { this.payType = "balance" } } } this.countAmountFull(); }, handleCheckedCitiesChange5(value) { if (value.length>0){ this.checkAll3 = false this.consumeRefuelMoney = 0; this.isOilStorageCard = false; } this.couponAmount = 0; this.couponDiscount.forEach(item => { let reduces = 0 if (item.gunName == value){ reduces = item.discount } this.couponAmount = reduces }) // let checkedCount = value.length; this.checkAll5 = true; this.checkedCities5 = value // this.isIndeterminate5 = checkedCount > 0 && checkedCount < this.couponDiscount.length; this.countAmountFull(); }, // 模糊查询商品信息 async querySearch(queryString, cb) { await this.getGoods() let _this = this; let results = _this.goodsList; if (queryString != ""){ results = []; _this.goodsList.forEach(item => { if(item.name.includes(queryString)){ results.push(item) return; } if(item.goodsNo.includes(queryString)){ results.push(item) return; } }) } cb(results); }, // 取单 pickOrder(){ let list = this.takeList this.goodsOrder = list; let num = 0; let amount = 0; let _this = this; list.forEach(item => { num += item.num; if (_this.isMember){ amount += +item.memberPrice; }else { amount += +item.retailPrice; } }) this.goodsTotal = num; this.goodsAmount = amount; this.goodsActualPay = this.goodsAmount - this.goodsDiscount; this.dialogTakeOrder = false; }, // 作废 cancel(){ this.registrationList.splice(this.index,1); this.takeList = []; }, // 取单列表 getTakeGoods(data,index){ this.takeList = data.children; this.index = index; }, // 挂单 registration(){ this.dialogRegistration = false; this.registrationRemark = ""; this.registrationList.push({menu:this.menu,children:this.goodsOrder}) this.menu++; this.goodsOrder = []; this.goodsTotal = 0; this.goodsAmount = 0; this.goodsActualPay = this.goodsAmount - this.goodsDiscount; this.getTakeGoods(this.registrationList[0]); this.dialogSuccess = true; }, // 重置会员 resetMember(){ this.member = {}; this.isMember = false; this.map.payUser == ""; this.balance = 0; this.oilDiscount = 0; this.goodsDiscount = 0; this.userNo = ""; this.oilActualPay = (this.oilAmount - this.oilDiscount).toFixed(2) this.goodsActualPay = this.goodsAmount - this.goodsDiscount this.isSure = false; this.handleChange(); // 数据清零 this.refuelMoney = null this.oilDiscount = 0 this.couponAmount = 0 this.fullReduction = 0 this.fullReduceDiscount = [] this.gradeDiscount = [] this.couponDiscount = [] this.oilPreferentialData = [] }, // 根据会员等级信息获取等级优惠信息 async getGrade(userId,gradeId){ this.isFixingLevel = false let _this = this; this.oilDiscount = 0; this.gradeDiscount = []; await userGradeInfo({userId:userId,gradeId:gradeId,storeId:""}).then(response => { let gasolineDiscount = 0; let dieselDiscount = 0; let naturalGasDiscount = 0; _this.gradeDiscount = []; if (response.data) { _this.oilOrder.forEach(item => { let discount = {type:"",discount:0,oilName:item.oilName,gunName:item.gunName} if (item.type == "汽油") { if (response.data.fixingLevel){ _this.isFixingLevel = true let gasolineRule = JSON.parse(response.data.fixingLevel.gasolineRule).sort((a, b) => a.gasolineRule1 - b.gasolineRule1); if (response.data.fixingLevel.discountType == '自定义优惠' && response.data.fixingLevel.status == 'qy') { if (response.data.fixingLevel.gasolineDiscount == "满减优惠") { let oilDiscount = 0; for (let i = 1; i <= gasolineRule.length; i++) { // 将满减条件加入等级优惠列表 if (gasolineRule.length > 1) { if (item.amount >= gasolineRule[gasolineRule.length - 1].gasolineRule1) { oilDiscount = gasolineRule[gasolineRule.length - 1].gasolineRule2 break; } if (item.amount >= gasolineRule[i - 1].gasolineRule1 && item.amount < gasolineRule[i].gasolineRule1) { oilDiscount = gasolineRule[i - 1].gasolineRule2 } } else { if (item.amount >= gasolineRule[i - 1].gasolineRule1) { oilDiscount = gasolineRule[i - 1].gasolineRule2 } } } gasolineDiscount += +oilDiscount discount.discount = gasolineDiscount } else if (response.data.fixingLevel.gasolineDiscount == "每升优惠") { let oilDiscount = 0; for (let i = 1; i <= gasolineRule.length; i++) { // 将满减条件加入等级优惠列表 if (gasolineRule.length > 1) { if (item.amount >= gasolineRule[gasolineRule.length - 1].gasolineRule1) { oilDiscount = (item.liters * gasolineRule[gasolineRule.length - 1].gasolineRule3).toFixed(2); break; } if (item.amount >= gasolineRule[i - 1].gasolineRule1 && item.amount < gasolineRule[i].gasolineRule1) { oilDiscount = (item.liters * gasolineRule[i - 1].gasolineRule3).toFixed(2) } } else { if (item.amount >= gasolineRule[i - 1].gasolineRule1) { oilDiscount = (item.liters * gasolineRule[i - 1].gasolineRule3).toFixed(2) } } } gasolineDiscount += +oilDiscount discount.discount = gasolineDiscount } else { gasolineDiscount = 0; } } // // if (response.data.fixingLevel.storeValue=="no" && _this.consumeAmount>0){ // _this.oilDiscount = 0 // _this.checkAll4 = false // }else { _this.oilDiscount += discount.discount _this.gradeDiscount.push(discount) _this.checkAll2 = true _this.checkedCities2.push(discount.gunName) // } } } if (item.type == "柴油") { if (response.data.fixingLevel){ _this.isFixingLevel = true let dieselRule = JSON.parse(response.data.fixingLevel.dieselRule).sort((a, b) => a.dieselRule1 - b.dieselRule1); if (response.data.fixingLevel.discountType == '自定义优惠' && response.data.fixingLevel.status == 'qy') { if (response.data.fixingLevel.dieselDiscount == "满减优惠") { let oilDiscount = 0; for (let i = 1; i <= dieselRule.length; i++) { // 将满减条件加入等级优惠列表 if (dieselRule.length > 1) { if (item.amount >= dieselRule[dieselRule.length - 1].dieselRule1) { oilDiscount = dieselRule[dieselRule.length - 1].dieselRule2 break; } if (item.amount >= dieselRule[i - 1].dieselRule1 && item.amount < dieselRule[i].dieselRule1) { oilDiscount = dieselRule[i - 1].dieselRule2 } } else { if (item.amount >= dieselRule[i - 1].dieselRule1) { oilDiscount = dieselRule[i - 1].dieselRule2 } } } dieselDiscount += +oilDiscount discount.discount = dieselDiscount } else if (response.data.fixingLevel.dieselDiscount == "每升优惠") { let oilDiscount = 0; for (let i = 1; i <= dieselRule.length; i++) { // 将满减条件加入等级优惠列表 if (dieselRule.length > 1) { if (item.amount >= dieselRule[dieselRule.length - 1].dieselRule1) { oilDiscount = (item.liters * dieselRule[dieselRule.length - 1].dieselRule3).toFixed(2); break; } if (item.amount >= dieselRule[i - 1].dieselRule1 && item.amount < dieselRule[i].dieselRule1) { oilDiscount = (item.liters * dieselRule[i - 1].dieselRule3).toFixed(2) } } else { if (item.amount >= dieselRule[i - 1].dieselRule1) { oilDiscount = (item.liters * dieselRule[i - 1].dieselRule3).toFixed(2) } } } dieselDiscount += +oilDiscount discount.discount = dieselDiscount } else { dieselDiscount = 0; } } // if (response.data.fixingLevel.storeValue=="no" && _this.consumeAmount>0){ // _this.oilDiscount = 0 // _this.checkAll4 = false // }else { _this.oilDiscount += discount.discount _this.gradeDiscount.push(discount) _this.checkAll2 = true _this.checkedCities2.push(discount.gunName) // } } } if (item.type == "天然气") { if (response.data.fixingLevel){ _this.isFixingLevel = true let naturalGasRule = JSON.parse(response.data.fixingLevel.naturalGasRule).sort((a, b) => a.naturalGas1 - b.naturalGas1); if (response.data.fixingLevel.discountType == '自定义优惠' && response.data.fixingLevel.status == 'qy') { if (response.data.fixingLevel.naturalGasDiscount == "满减优惠") { let oilDiscount = 0; for (let i = 1; i <= naturalGasRule.length; i++) { // 将满减条件加入等级优惠列表 if (naturalGasRule.length > 1) { if (item.amount >= naturalGasRule[naturalGasRule.length - 1].naturalGas1) { oilDiscount = naturalGasRule[naturalGasRule.length - 1].naturalGas2; break; } if (item.amount >= naturalGasRule[i - 1].naturalGas1 && item.amount < naturalGasRule[i].naturalGas1) { oilDiscount = naturalGasRule[i - 1].naturalGas2 } } else { if (item.amount >= naturalGasRule[i - 1].naturalGas1) { oilDiscount = naturalGasRule[i - 1].naturalGas2 } } } naturalGasDiscount += +oilDiscount discount.discount = naturalGasDiscount } else if (response.data.fixingLevel.naturalGasDiscount == "每单位优惠") { let oilDiscount = 0; for (let i = 1; i <= naturalGasRule.length; i++) { // 将满减条件加入等级优惠列表 if (naturalGasRule.length > 1) { if (item.amount >= naturalGasRule[naturalGasRule.length - 1].naturalGas1) { oilDiscount = (item.liters * naturalGasRule[naturalGasRule.length - 1].naturalGas3).toFixed(2) break; } if (item.amount >= naturalGasRule[i - 1].naturalGas1 && item.amount < naturalGasRule[i].naturalGas1) { oilDiscount = (item.liters * naturalGasRule[i - 1].naturalGas3).toFixed(2) } } else { if (item.amount >= naturalGasRule[i - 1].naturalGas1) { oilDiscount = (item.liters * naturalGasRule[i - 1].naturalGas3).toFixed(2) } } } naturalGasDiscount += +oilDiscount discount.discount = naturalGasDiscount } else { naturalGasDiscount = 0; } } // if (response.data.fixingLevel.storeValue=="no" && _this.consumeAmount>0){ // _this.oilDiscount = 0 // _this.checkAll4 = false // }else { _this.oilDiscount += discount.discount _this.gradeDiscount.push(discount) _this.checkAll2 = true _this.checkedCities2.push(discount.gunName) // } } } }) } // _this.oilDiscount = gasolineDiscount + dieselDiscount + naturalGasDiscount // _this.checkAll2 = true; // _this.isDefaultUseCard(); }) }, // 选择会员 async chooseUser(data){ this.dialogVisiblevip = false this.isMember = true; this.goodsAllAmount(); this.map.payUser = data.mobile; this.map.userId = data.id; this.balance = this.member.cardBalance; await this.getGrade(this.member.id,this.member.gradeId) // 使用囤油卡 await this.changeRefuelMoney(); if (this.balance>0 && this.oilAmount>0 || this.isOilStorageCard){ this.checkAll4 = true if (this.goodsOrder.length==0){ this.payType = "balance" } this.countAmountFull() } if (!this.isFixingLevel && !this.isOilStorageCard){ await this.getOilCoupon() } }, // 选择会员时商品总价的变化 goodsAllAmount(){ this.goodsDiscount = 0 this.goodsAmount = 0 this.goodsOrder.forEach(item => { if (this.isMember){ // this.goodsAmount += +(item.memberPrice*item.num).toFixed(2); this.goodsDiscount += +((item.retailPrice-item.memberPrice)*item.num).toFixed(2) } this.goodsAmount += +(item.retailPrice*item.num).toFixed(2); // } }) this.goodsActualPay = this.goodsAmount - this.goodsDiscount; }, async getOilCoupon() { let type = 0; // if (this.consumeAmount==0){ if (this.consumeRefuelMoney > 0) { type = 1; } else { if (this.consumeAmount > 0) { type = 0; } else { type = 2; } } // 数据清零 this.oilDiscount = 0 this.couponAmount = 0 this.fullReduction = 0 this.fullReduceDiscount = [] this.gradeDiscount = [] this.couponDiscount = [] this.oilPreferentialData = [] this.paymentActive.type = type this.paymentActive.mtUserLevel = this.member.gradeId this.paymentActive.userId = this.member.id let _this = this for (const item of this.oilOrder) { _this.paymentActive.amount = item.amount _this.paymentActive.oilId = item.oilName _this.paymentActive.storeId = item.storeId await getPaymentActive(_this.paymentActive).then(async res => { item.activeId = res.data.activeId item.type = res.data.type let discount = { type: "", discount: 0, oilName: item.oilName, gunName: item.gunName } let oilData = { oilName: item.oilName, oilPreferential: {} } // this.preferentialData1 = res.data oilData.oilPreferential = res.data _this.oilPreferentialData.push(oilData) // if (_this.consumeRefuelMoney==0){ if (res.data.memberFavorableAmount) { discount.discount = res.data.memberFavorableAmount _this.gradeDiscount.push(discount) if (!this.isOilStorageCard) { _this.oilDiscount = res.data.memberFavorableAmount _this.checkAll2 = true this.checkedCities2.push(discount.gunName) } } if (res.data.cardFavorableAmount) { discount.discount = res.data.cardFavorableAmount _this.couponDiscount.push(discount) if (!this.isOilStorageCard) { _this.cardFavorableId = res.data.cardFavorableId _this.recordId = res.data.recordId _this.couponAmount = res.data.cardFavorableAmount _this.checkAll5 = true } } if (res.data.activeFavorableAmount) { discount.discount = res.data.activeFavorableAmount discount.type = res.data.type _this.fullReduceDiscount.push(discount) if (!this.isOilStorageCard) { _this.fullReduction = res.data.activeFavorableAmount _this.checkAll1 = true this.checkedCities1.push(discount.gunName) } } // } console.log(_this.oilDiscount, _this.couponAmount, _this.fullReduction, 3239) this.countAmountFull() if (this.isOilStorageCard) { await this.countAmountFull() } if (type == 1) { await this.countAmountUnBalance() } if (type == 0) { await this.countAmountFull() } }) } }, // 调用优惠券接口 getCoupon(){ let _this = this; _this.oilOrder.forEach(item1 => { _this.preferentialData.oilName = item1.oilName; _this.preferentialData.oilPrice = item1.oilPrice; _this.preferentialData.oilLiters = item1.liters; _this.couponDiscount =[]; _this.couponIds = []; selectCoupon(_this.preferentialData).then(response => { _this.couponAmount = 0; _this.couponIds = response.data if (response.data.length>0){ response.data.forEach(item => { _this.useCouponIds = item.id let discount = {type:item.type,discountType:item.discountType,name:item.name,oilName:item1.oilName,full:0,reduce:0,discount:0} discount.full = item.satisfiedAmount if (item.type==0){ // 油品券 if (item.discountType==0){ // 满减券 discount.reduce = item.discountAmount }else { // 折扣券 discount.discount = item.specialDiscount discount.reduce = item.discountOffset } }else if (item.type==1){ // 商品券 if (item.discountType==0){ // 满减券 discount.reduce = item.discountAmount }else { // 折扣券 discount.discount = item.specialDiscount discount.reduce = item.discountOffset } }else { // 通用券 if (item.discountType==0){ // 满减券 discount.reduce = item.discountAmount }else { // 折扣券 discount.discount = item.specialDiscount discount.reduce = item.discountOffset } } if (discount.reduce!=0){ if (_this.couponDiscount.length!=0){ _this.couponDiscount.forEach(item2 => { if (item2.oilName!=discount.oilName) { _this.couponDiscount.push(discount) _this.checkedCities5 = item.name _this.couponAmount = discount.reduce } if (item2.name!=discount.name && item2.oilName==discount.oilName) { _this.couponDiscount.push(discount) _this.checkedCities5 = item.name _this.couponAmount = discount.reduce } }) }else { _this.couponDiscount.push(discount) _this.checkedCities5 = item.name _this.couponAmount = discount.reduce } } if (item.exclusiveFunction == 0){ // 满减互斥 _this.checkAll1 = false _this.checkAll4 = true; if (_this.goodsOrder.length==0) { _this.payType = "balance" } _this.fullReduction = 0 _this.isUseFull = true; }else { // 储值卡付款互斥 _this.checkAll1 = true _this.checkAll4 = false; _this.consumeAmount = 0; _this.isUseBalance = true; } _this.exclusion = item.exclusiveFunction }) } _this.checkAll5 = true; _this.isDefaultUseCard(); }) }) }, // 使用囤油卡 囤油卡不参与任何优惠 countOilCard(){ if (this.hoardAmount>0){ this.checkAll4 = true if (this.balance!=0 && this.balance >= this.hoardAmount){ this.oilActualPay = 0 this.consumeAmount = this.hoardAmount }else { this.oilActualPay = (this.hoardAmount - this.balance).toFixed(2) this.consumeAmount = this.balance } }else { this.oilActualPay = 0 this.consumeAmount = 0 } console.log("使用囤油卡",this.hoardAmount) }, // 不使用囤油卡 countAmountFull(){ if (this.isMember){ // if (this.balance>0){ // this.checkAll4 = true // } if (this.checkAll4) { if (this.balance >= (this.oilAmount - this.oilDiscount - this.couponAmount - this.fullReduction - this.oilCardAmount)) { this.oilActualPay = 0 this.consumeAmount = this.oilAmount - this.oilDiscount - this.couponAmount - this.fullReduction - this.oilCardAmount } else { this.oilActualPay = this.oilAmount - this.oilDiscount - this.couponAmount - this.fullReduction - this.oilCardAmount - this.balance this.consumeAmount = this.balance } }else { this.oilActualPay = this.oilAmount - this.oilDiscount - this.couponAmount - this.fullReduction - this.oilCardAmount this.consumeAmount = 0 } }else { this.oilActualPay = this.oilAmount.toFixed(2) } console.log("不使用囤油卡", this.consumeAmount ,this.oilAmount, this.oilDiscount,this.couponAmount,this.fullReduction,this.oilCardAmount) }, // 不使用储值卡 countAmountUnBalance(){ if (this.isMember){ this.oilActualPay = (this.oilAmount - this.fullReduction - this.oilDiscount - this.couponAmount).toFixed(2) }else { this.oilActualPay = (this.oilAmount - this.oilDiscount).toFixed(2) } this.consumeAmount = 0 console.log("不使用储值卡",this.oilAmount , this.fullReduction , this.oilDiscount , this.couponAmount) }, // 使用储值卡不使用优惠券 || 使用满减不使用优惠券 countAmountBalance(){ if (this.isMember){ if (this.balance >= (this.oilAmount - this.oilDiscount - this.fullReduction)){ this.oilActualPay = 0 this.consumeAmount = (this.oilAmount*100 - this.oilDiscount*100 - this.fullReduction*100)/100 }else { this.oilActualPay = (this.oilAmount -this.balance - this.oilDiscount - this.fullReduction).toFixed(2) this.consumeAmount = this.balance } }else { this.oilActualPay = (this.oilAmount - this.oilDiscount).toFixed(2) } console.log("储值卡满减",this.oilAmount, this.oilDiscount,this.fullReduction) }, // 判断互斥限制 isExclusion(){ }, // 默认使用囤油卡 isDefaultUseCard(){ if (this.isOilStorageCard){ this.checkAll3 = true; if (this.goodsOrder.length==0){ this.payType = "oilCard" } this.checkAll1 = false; this.fullReduction = 0; this.checkAll2 = false; this.checkedCities2 = []; this.oilDiscount = 0; this.checkAll5 = false; this.couponAmount = 0; this.countOilCard(); if (this.hoardAmount>0 && this.balance > 0){ this.checkAll4 = true; } }else { this.countAmountFull() } }, // 调用优惠参数接口 preferential(){ let _this = this; // _this.fullReduction = 0; let fullReduction = 0; _this.fullReduction = 0; _this.oilOrder.forEach(item1 => { _this.preferentialData.oilName = item1.oilName; _this.preferentialData.oilPrice = item1.oilPrice; _this.preferentialData.oilLiters = item1.liters; selectPreferential(_this.preferentialData).then( response => { if (response.data.length>0){ _this.fullReduceDiscount = [] response.data.forEach(item => { if (item.participationCondition==1){ _this.exclusion = 0 } let discount = {type:item.name,full:0,reduce:0,discount:0,exclusion:item.participationCondition} let activeList = item.activeDiscountChildList; if (activeList.length>0) { for (let i = 1; i <= activeList.length; i++) { if (activeList.length > 0) { if (activeList[0].discount != null) { // 折扣营销 if (item1.amount >= activeList[0].amount) { discount.full = activeList[0].amount; discount.discount = activeList[0].discount; discount.reduce = item1.amount - (item1.amount * (activeList[0].discount / 10)).toFixed(2) fullReduction = item1.amount - (item1.amount * (activeList[0].discount / 10)).toFixed(2); } } else { // 满减 if (item1.amount >= activeList[0].amount) { discount.full = activeList[0].amount; discount.reduce = activeList[0].deductionAmount; fullReduction = activeList[0].deductionAmount; } } } } } if (activeList.length==0){ fullReduction = 0 } if (discount.reduce!=0){ _this.fullReduceDiscount.push(discount) _this.checkedCities1.push(item.name) _this.checkAll1 = true; } _this.fullReduction += +fullReduction }) } if (_this.isUseFull){ _this.checkAll1 = false; _this.checkedCities1 = [] _this.fullReduction = 0 } _this.isDefaultUseCard(); }) }) }, // 选择会员信息 handleChoose(data) { this.isSure = true; this.member = data; // if (data.refuelMoney){ // this.refuelMoney = JSON.parse(data.refuelMoney) // }else { // this.refuelMoney = null // } this.dialogVisibleMember = false; }, // 清空商品订单列表 empty(){ this.goodsOrder = []; this.goodsTotal = 0; this.goodsAmount = 0; this.goodsActualPay = 0; this.goodsDiscount = 0; }, // 获取当前账户信息 getStaff(){ staffInfo().then( response => { this.staff = response.data; this.map.staffId = this.staff.id; }) }, // 选择员工信息 chooseStaff(data){ this.staff = data; this.map.staffId = this.staff.id; this.dialogVisible = false }, // 删除商品列表信息 delGoods(index){ this.goodsOrder.splice(index,1) this.handleChange() }, // 添加商品列表信息 changeGoods(val){ this.payType = "WECHAT" let result = true; let goods = this.goodsOrder; let _this = this; // this.goodsDiscount = 0 if (this.goodsOrder.length > 0) { let amount = 0; for (let i = 0; i < goods.length; i++) { if (goods[i].id == val.id) { if (val.stock<goods[i].num + 1){ this.$modal.msgError("商品库存不足,请重新选择商品") result = false; break; } goods[i].num = goods[i].num + 1; goods[i].retailPrice = val.retailPrice; goods[i].memberPrice = val.memberPrice; val.num = goods[i].num + 1; this.goodsTotal += 1; if (_this.isMember) { this.goodsDiscount += +((goods[i].retailPrice-goods[i].memberPrice)*goods[i].num).toFixed(2) } amount += goods[i].retailPrice * goods[i].num result = false; break; } else { result = true; } } // this.goodsAmount = amount; // this.goodsActualPay = this.goodsAmount - this.goodsDiscount; } else { result = true; } if (result) { if (val.stock==0){ this.$modal.msgError("商品库存不足,请重新选择商品") return; } val.num = 1; if (_this.isMember) { this.goodsDiscount += (val.retailPrice - val.memberPrice) } this.goodsAmount += +val.retailPrice this.goodsActualPay = this.goodsAmount - this.goodsDiscount; this.goodsOrder.push(val); this.goodsTotal += 1; }else { if (val.stock==0){ this.$modal.msgError("商品库存不足,请重新选择商品") return; } // if (_this.isMember) { // this.goodsDiscount += (val.retailPrice - val.memberPrice) * val.num // } // this.goodsAmount += val.retailPrice * val.num // this.goodsActualPay = this.goodsAmount - this.goodsDiscount; _this.goodsDiscount = 0 _this.goodsAmount = 0 if (this.goodsOrder.length > 0) { goods.forEach(item => { // if (item.id != val.id){ if (_this.isMember) { _this.goodsDiscount += (item.retailPrice - item.memberPrice) * item.num } _this.goodsAmount += item.retailPrice * item.num _this.goodsActualPay = _this.goodsAmount - _this.goodsDiscount; // } }) } } this.goods = "" }, // 立即结算 async settlement(){ // 发送扫码机请求(易联云网络下发)this.realyPayBills await this.getSendPrintIndex(((+this.oilActualPay) + (+this.goodsActualPay)).toFixed(2)); // this.autofocus = true if (this.payType=="APPLET_CODE") { if (this.goodsOrder.length > 0) { this.$modal.msgError("非油商品不可使用小程序码支付") return; } } this.authCode = "" this.seekZero = 0; this.isPay = false let inputKey = Math.random(); if (this.inputKey==inputKey){ this.inputKey==inputKey+"a" }else { this.inputKey=inputKey } this.dialogVisiblej = true this.getCode(((+this.oilActualPay) + (+this.goodsActualPay)).toFixed(2),2); }, // 网络下发之后获取条码 getCode(amount,flag) { if (this.payType == "CASH" && flag == 1) { return } if (this.cardValueForm.paymentType == "CASH" && flag == 1) this.jishuqi++; if (this.jishuqi == 30) { this.jishuqi = 0 return } this.continuePolling = true; getReturnCode ({payAmount:amount}).then(res=>{ if (res.data === "300" && this.continuePolling) { setTimeout(() => { this.getCode(amount); // 重新发起请求 }, 1000); // 停顿一秒 }else { this.authCode = res.data } }) }, getSendPrintIndex(amount) { sendPrintIndex({payAmount:amount}).then(ress=>{ if (ress.data != "success") { this.$modal.msgError("扫码机发起付款失败!") return; } }) }, // 打印商品支付后的订单 oilOrderReport () { let oilOrderR = [] this.oilOrder.forEach(order=>{ let o = { oilName : this.getName(this.oilNameList, order.oilName) + "-" + this.getName1(this.gunList, order.gunName), amount : order.amount.toString() } oilOrderR.push(o) }) let goodsOrderR = [] this.goodsOrder.forEach(order=>{ let o = { oilName : order.name, unit : order.num+order.unit, // amount : order.memberPrice.toString() amount : order.retailPrice.toString() } goodsOrderR.push(o) }) // 支付方式 const payTypeMap = { 'CASH': '现金', 'WECHAT': '微信', 'ALIPAY': '支付宝', 'UNIONPAY': '银联二维码', 'credit': '挂账', 'oilCard': '囤油卡', 'balance': '储值卡' }; let payTypeText = payTypeMap[this.payType] || '小程序码'; let f ={ oilOrder:oilOrderR, goodsOrder:goodsOrderR, payType:payTypeText, unitName:this.form1.unitName, // 挂账单位 // consumeAmount:this.consumeAmount, creditAmount: (this.oilAmount+(+this.goodsAmount)).toFixed(2),//挂账金额 // 优惠合计 discount:(this.oilDiscount + this.goodsDiscount + this.fullReduction + this.couponAmount).toFixed(2), // 油惠合计 // 储值卡付款 consumeAmount:this.consumeAmount, // 屯油卡付款 consumeRefuelMoney:this.consumeRefuelMoney.toFixed(2), // 实付款 actualPay : ((+this.oilActualPay)+(+this.goodsActualPay)).toFixed(2), // 找零 seekZero:this.seekZero.toFixed(2), } printOilOrderReport(f).then(res=>{ }) }, cardValueReport() { // 支付方式 const payTypeMap = { 'CASH': '现金', 'WECHAT': '微信', 'ALIPAY': '支付宝', 'UNIONPAY': '银联二维码', 'credit': '挂账', 'oilCard': '囤油卡', 'balance': '储值卡' }; let payTypeText = payTypeMap[this.cardValueForm.paymentType] let actualPay = this.cardValueForm.paymentType == 'CASH' ? this.authCode:this.realyPayBills let a = { // 充值金额 realyPayBills:this.realyPayBills, //赠送金额 giftBalance:this.cardValueForm.giftBalance, // 到账金额 getAmount:this.cardValueForm.giftBalance + this.realyPayBills, payType:payTypeText, // 实付款 actualPay: actualPay, // 找零 seekZero:this.seekZero.toFixed(2), } printCardValueReport(a).then(res=>{ }) }, fuelDieselReport() { // 支付方式 const payTypeMap = { 'CASH': '现金', 'WECHAT': '微信', 'ALIPAY': '支付宝', 'UNIONPAY': '银联二维码', 'credit': '挂账', 'oilCard': '囤油卡', 'balance': '储值卡' }; let payTypeText = payTypeMap[this.cardFuelDieselForm.paymentType] let a = { // 充值油品 oilType:this.cardFuelDieselForm.type, // 充值升数 incomeLitres:this.cardFuelDieselForm.incomeLitres, // 订单金额 realyPayBills:this.realyPayBills, // 锁价金额 lockupPrice:this.cardFuelDieselForm.lockupPrice, // 支付方式 payType:payTypeText, // 实付款 // 找零 seekZero:this.seekZero.toFixed(2), } printFuelDieselReport(a).then(res=>{ }) }, // 重置油品订单 resetting(){ this.seekZero = 0; this.oilOrder = []; this.oilActualPay = 0; this.oilTotal = 0; this.oilAmount = 0; this.oilDiscount = 0; this.consumeAmount = 0; this.consumeRefuelMoney = 0; this.fullReduction = 0; this.couponAmount = 0; this.fullReduceDiscount = []; this.gradeDiscount = []; this.couponDiscount = []; this.checkAll4 = false; this.isExistOilOrder = false // if (this.member.refuelMoney!=null){ // this.refuelMoney = JSON.parse(this.member.refuelMoney) // } this.amount = 0; }, // 获取员工列表 getStaffList(){ queryStaffList({storeId:""}).then( response => { this.dialogVisible = true this.staffList = response.data }) }, // 油品订单信息 async getOilOrder(){ this.dialogVisibleamount = false this.form.oilType = this.oilNameID; this.form.type = this.type; let amount = this.form.amount || 0; // 计算油的升数 if (this.select == "元"){ let num = amount/(this.form.oilPrice ? this.form.oilPrice : 1) this.form.liters = (Math.ceil(num*100)/100).toFixed(2) }else { this.form.liters = amount this.form.amount = (this.form.oilPrice * amount).toFixed(2) } if (this.form.tankId) // 校验油罐内油是否足够 await getOilTank(this.form.tankId).then(async res => { if (res.data.storedQuantity-this.form.liters<0){ this.$modal.msgError("所加油的升数大于油罐内的升数,请重新选择加油升数") return; }else { // 判断此油品是否被加购 if (this.isExistOilOrder){ for (let i = 0; i<this.oilOrder.length;i++){ if (this.oilOrder[i].id == this.form.id){ this.oilOrder.splice(i,1,this.form) } } }else { this.oilOrder.push(this.form) } this.oilAmount = 0 this.oilOrder.forEach(item => { this.oilAmount += +item.amount }) this.oilActualPay = (this.oilAmount - this.oilDiscount).toFixed(2); this.oilTotal = this.oilOrder.length; this.select = "元"; if (this.isMember){ await this.getGrade(this.member.id,this.member.gradeId) // if (this.refuelMoney){ // 使用囤油卡 await this.changeRefuelMoney(); // } if (this.balance>0 && this.oilAmount>0 || !this.isOilStorageCard){ this.checkAll4 = true if (this.goodsOrder.length==0) { this.payType = "balance" } this.countAmountFull() } if (!this.isFixingLevel && !this.isOilStorageCard){ await this.getOilCoupon() } } } }) }, // 囤油卡变化后总金额的变化 changeRefuelMoney(){ this.isOilStorageCard = false getRecord({mtUserId:this.member.id}).then(res => { this.oilCardAmount = 0 let oilAmount = 0 this.refuelMoney = res.data // 修改油品的单价 this.oilOrder.forEach(item => { let amount = 0; let flag = false; this.refuelMoney.forEach(i => { if (item.oilName==i.oilType){ item.lockupPrice = i.lockupPrice amount = item.lockupPrice * item.liters if (amount>0) this.isOilStorageCard = true flag = false }else { flag = true } }) // oilCardAmount if (flag) amount = item.amount oilAmount += amount }) console.log("3903", this.isOilStorageCard) if (oilAmount>0) this.oilCardAmount = this.oilAmount - oilAmount this.countAmountFull() }) }, changeBalance(hoardAmount,id){ if (this.balance>0 && id != ""){ this.oilOrder.forEach(item => { if (this.balance >= item.amount){ this.consumeAmount = item.amount }else { this.consumeAmount = this.balance this.oilActualPay = item.amount - this.balance } }) } }, // 选择“元”或“L” changeSelect(){ if(this.select == "元"){ this.rise = [ {value:"¥100"}, {value:"¥150"}, {value:"¥200"}, {value:"¥300"}, ]; }else { this.rise = [ {value:"100L"}, {value:"150L"}, {value:"200L"}, {value:"300L"}, ]; } }, // 改变加油金额 changeAmount(amount){ if (this.select == "元"){ this.form.amount = amount.slice(1) }else { this.form.amount = amount.slice(0,3) } this.$forceUpdate(); }, // 获取油号名称 getName(oilNameList,id){ let name = "" let oilType = "" let _this = this; if(oilNameList!=null && oilNameList!=""){ oilNameList.forEach(item => { if (item.id == id){ name = item.oilName; oilType = item.oilType; _this.oilType = item.oilName; _this.oilNameID = item.id; _this.type = item.oilType; } }) } return oilType+" "+name; }, // 获取油号信息 getOilName(){ getOilNameList().then( response => { this.oilNameList = response.data; }) }, // 根据手机号查询会员信息 getUser(){ if(this.select1=="会员手机号"){ if (!this.userNo) { this.$message.error("请先输入手机号") return; } getUserInfoMobile({mobile:this.userNo}).then( response => { if (response.data){ this.member = response.data this.storeId = response.data.storeId this.isSure = true }else { this.$modal.msgError("会员信息不存在") } }) }else { this.dialogVisibleMember = true; getUserVoName({name:this.userNo}).then( response => { this.memberList = response.data.userVo this.storeId = response.data.storeId }) } }, // 查询所有商品信息 getGoods(){ listgoods().then( response => { this.goodsList = response.data }) }, // 加油金额 refuel(data){ // this.gunIndex.push(data.id) this.select = "元"; this.rise = [ {value:"¥100"}, {value:"¥150"}, {value:"¥200"}, {value:"¥300"}, ]; this.amount = 0 let result = false this.isExistOilOrder = false; // 判断是否存在此油品的数据 this.oilOrder.forEach(item => { if (item.id==data.id){ this.amount = item.amount this.form = item result = true this.isExistOilOrder = true; } }) if (result){ return; } if (this.oilOrder.length==1){ this.$message.error("只能选择一个油枪信息") return; } this.dialogVisibleamount = true; getOilNumberById(data.numberId).then( response => { this.form = response.data; this.form.tankId = data.tankId this.gunList.forEach(item => { if (item.id==data.id){ this.form.id = item.id this.form.gunName = item.id this.oilGunId = item.id this.form.gunNames = item.gunName } }) }) }, // 确定收款 async collection(){ if (this.payType=="CASH"){ if (this.authCode<((+this.oilActualPay) + (+this.goodsActualPay)) || this.seekZero<0){ this.$modal.msgError("请输入正确的金额"); return; } if (!this.authCode && ((+this.oilActualPay) + (+this.goodsActualPay))>0){ this.$modal.msgError("请输入正确的金额"); return; } } if (!this.authCode && ((+this.oilActualPay) + (+this.goodsActualPay))>0){ this.$modal.msgError("请先扫码"); return; } this.loading = true; // JSON.parse() this.map.seekZero = this.seekZero; this.map.oilAmount = this.oilAmount; this.map.payType = this.payType; this.map.goodsAmount = this.goodsAmount; this.map.oilActualPay = this.oilActualPay; this.map.goodsActualPay = this.goodsActualPay; this.map.oilDiscount = (this.oilDiscount + this.fullReduction + this.couponAmount + this.oilCardAmount).toFixed(2) ; this.map.goodsDiscount = this.goodsDiscount; this.map.goodsNum = this.goodsTotal; this.map.balanceAmount = this.consumeAmount; this.map.oilCardAmount = this.consumeRefuelMoney; this.map.oilCardAmount1 = this.oilCardAmount; this.map.oilOrder = JSON.stringify(this.oilOrder); this.map.goodsOrder = JSON.stringify(this.goodsOrder); this.map.authCode = this.authCode; this.map.allAmount = +this.oilActualPay + +this.goodsActualPay this.map.consumeAmount = this.consumeAmount; this.map.couponId = this.useCouponIds if (this.staff) { this.map.staffId = this.staff.id } this.map.cardFavorableId = this.cardFavorableId this.map.recordId = this.recordId this.map.userId = this.member.id this.map.payUser = this.member.mobile this.map.levelAmount = this.oilDiscount this.map.activeAmount = this.fullReduction this.map.oilGunId = this.oilGunId let _this = this; if (this.payType=="APPLET_CODE"){ if (this.goodsOrder.length>0){ this.$modal.msgError("非油商品不可使用小程序码支付") return; } await scanAppletQrCode(_this.map).then( resp => { if (resp.data.success=='success'){ setTimeout(function (){ _this.loading = false; _this.isPaySuccess = true; _this.isPay = true; // _this.printLocally() _this.oilOrderReport() _this.resetting1(); },3000) }else { setTimeout(function (){ _this.loading = false; _this.isPaySuccess = false; _this.isPay = true; _this.resetting1(); this.$modal.msgError(resp.data.error) },3000) } }) return; } let isPaySuccess = false; await addLJGoods(_this.map).then( async response => { _this.orderNo = response.data.orderNo; if (response.data.oilOrder != null) { if (response.data.oilOrder.orderStatus == "paid") { _this.isPaySuccess = true; isPaySuccess = true _this.isPay = true; _this.loading = false; _this.printLocally() _this.oilOrderReport() _this.resetting1() return; } } if (response.data.goodsOrder != null) { if (response.data.goodsOrder.status == "paid") { _this.isPaySuccess = true; isPaySuccess = true _this.isPay = true; _this.loading = false; _this.printLocally() _this.oilOrderReport() _this.resetting1() return; } } if (response.data.error == 1) { this.$modal.msgError("商品库存不足,请重新选择商品") this.loading = false; this.autofocus = false this.dialogVisiblej = false; return; } if (response.data.error == "请先配置支付通道") { this.$modal.msgError(response.data.error) this.loading = false; // this.dialogVisiblej = false; return; } }) this.loading = true; if ( !isPaySuccess ){ await _this.queryPayStatus(); _this.resetting1(); } }, resetting1(){ let _this = this; this.authCode = ""; if (_this.isPaySuccess == true){ // _this.isPay = false; _this.oilAmount = 0; _this.oilActualPay = 0; _this.oilDiscount = 0; _this.goodsAmount = 0; _this.goodsActualPay = 0; _this.goodsDiscount = 0; _this.consumeAmount = 0; _this.consumeRefuelMoney = 0; _this.oilTotal = 0; _this.goodsTotal = 0; _this.oilCardAmount = 0; _this.isMember = false; _this.isSure = false; _this.oilOrder = [] _this.goodsOrder = [] _this.amount = 0 _this.seekZero = 0; _this.fullReduction = 0; _this.fullReduceDiscount = [] _this.checkAll1 = false _this.gradeDiscount = [] _this.checkAll2 = false _this.checkAll3 = false _this.checkAll4 = false _this.checkAll5 = false }; this.userNo = "" this.map = { allAmount:0, // 用户支付条码信息 authCode:'', // 油品订单 oilOrder:"", // 商品订单 goodsOrder:"", // 支付方式 payType:"WECHAT", // 油品订单金额 oilAmount:0, // 商品订单金额 goodsAmount:0, // 油品实付金额 oilActualPay:0, // 商品实付金额 goodsActualPay:0, // 付款用户 payUser:"", // 油品优惠金额 oilDiscount:0, // 商品优惠金额 goodsDiscount:0, // 优惠券id couponId:"", // 提成金额 commissionAmount:0, // 使用积分数量 usePoint:0, // 积分金额 pointAmount:0, // 终端 terminal:"PC", // 商品数量 goodsNum:0, // 会员消费金额(储值卡需要减少的金额) consumeAmount:0, typeIdex:'', }; this.payType = "WECHAT" }, updateRefuelMoney(){ let _this = this; _this.oilOrder.forEach(item => { if (_this.refuelMoney!=null){ _this.refuelMoney.forEach(i => { if (i.oilType==item.oilType){ if ((i.refuelMoney-item.liters)>=0){ let refuelMoney = i.refuelMoney; i.refuelMoney = (refuelMoney-item.liters).toFixed(2) }else { i.refuelMoney = 0 } } }) } }) }, // 查询订单支付状态 queryPayStatus(){ let _this = this; let timer = setInterval(function (){ // "234520231228115544f073f4" cashierOrderByOrderNo({orderNo:_this.orderNo}).then( response => { if (response.data){ if (response.data.status == "paid"){ _this.isPay = true; _this.isPaySuccess = true; _this.isQuery = false; _this.amount = 0 _this.loading = false; _this.printLocally() _this.oilOrderReport() _this.resetting1(); if (response.data.oilOrderAmount>0){ // for (let i =0;i<_this.oilPreferentialData.length;i++){ // _this.oilPreferentialData[i].oilPreferential.storeId = response.data.storeId // _this.oilPreferentialData[i].oilPreferential.orderAmount = response.data.oilOrderAmount // _this.oilPreferentialData[i].oilPreferential.userId = response.data.userId // _this.oilPreferentialData[i].oilPreferential.oilId = response.data.oils // _this.oilPreferentialData[i].oilPreferential.mtUserLevel = _this.member.gradeId // _this.oilPreferentialData[i].oilPreferential.cardFavorableId = _this.oilPreferentialData[_this.oilPreferentialData.length-1].cardFavorableId // usePaymentActive(_this.oilPreferentialData[i].oilPreferential).then(res => {}) // } } clearInterval(timer); } if (response.data.status == "payFail"){ _this.isPaySuccess = false; // _this.isPay = true; _this.isQuery = false; _this.loading = false; clearInterval(timer); } if (response.data.status == "unpaid"){ _this.isQuery = true; _this.dialogVisiblejLoading = true } } // _this.resetting1(); }) },1000) // 如果是为支付状态15后打开去订单页查询的接口 // if (_this.isQuery){ // setTimeout(function () { // },10000) // } let timer2 = setInterval(function () { if (!_this.isQuery || !_this.dialogVisiblej) { _this.loading = false; // _this.isPay = true; // _this.countdown() clearInterval(timer); clearTimeout(timer3); } }, 1000) var timer3 = setTimeout(function () { clearInterval(timer2); clearInterval(timer); _this.loading = false; _this.isPay = true; this.isPaySuccess = false; }, 15000) }, // 倒计时刷新 countdown(){ let _this = this let timer = setInterval(() => { // countdown减1 _this.timestamp--; // 如果倒计时为0,清除定时器 if(_this.timestamp === 0) { clearInterval(timer) _this.timestamp = 15 } }, 1000); }, handClose(){ this.loading = false this.dialogVisiblejLoading = false // this.resetting1() this.authCode = ""; this.continuePolling = false; this.userNo = "" this.map = { allAmount:0, // 用户支付条码信息 authCode:'', // 油品订单 oilOrder:"", // 商品订单 goodsOrder:"", // 支付方式 payType:"WECHAT", // 油品订单金额 oilAmount:0, // 商品订单金额 goodsAmount:0, // 油品实付金额 oilActualPay:0, // 商品实付金额 goodsActualPay:0, // 付款用户 payUser:"", // 油品优惠金额 oilDiscount:0, // 商品优惠金额 goodsDiscount:0, // 优惠券id couponId:"", // 提成金额 commissionAmount:0, // 使用积分数量 usePoint:0, // 积分金额 pointAmount:0, // 终端 terminal:"PC", // 商品数量 goodsNum:0, // 会员消费金额(储值卡需要减少的金额) consumeAmount:0, typeIdex:'', }; this.member = {}; this.isPaySuccess = false; this.isPay = false; this.autofocus = false this.dialogVisiblej = false }, // 支付方式 payMethod(payType){ if (payType == 'oilCard'){ if (this.isMember){ if (this.goodsOrder.length>0){ this.$message.error("商品不可使用囤油卡付款") return; } if (this.refuelMoney1.length>0){ this.checkAll3 = true this.handleCheckAllChange3(true) }else { this.$message.error("请先充值!!") return; } }else { this.$message.error("请先选择会员") return } } if (payType == 'balance'){ if (this.isMember){ if (this.goodsOrder.length>0){ this.$message.error("商品不可使用储值卡付款") return; } if (this.balance>0){ this.checkAll4 = true this.handleCheckAllChange4(true) }else { this.$message.error("请先充值!!") return; } }else { this.$message.error("请先选择会员") return; } } if (payType == 'APPLET_CODE'){ if (this.goodsOrder.length>0){ this.$message.error("商品不可使用储值卡付款") return; } } this.typeIdex = payType this.map.payType = payType; this.payType = payType; }, // 获取支付方式 getPayList(){ getDicts("payment_type").then( response => { this.payList = response.data; }) // 获取油号列表信息 listOilNumGun().then( response => { this.oilNumList = response.data }) // 获取油号油枪对应信息 getOilNumGun({oilNum : "全部"}).then( response => { this.oilNumGunList = response.data }) }, handleClose(done) { this.$confirm('确认关闭?') .then(_ => { done(); }) .catch(_ => {}); }, handleChange(value) { let goods = this.goodsOrder; let num = 0; let amount = 0; let _this = this; this.goodsDiscount = 0 goods.forEach(item => { num += item.num if (_this.isMember){ // amount += +(item.memberPrice*item.num).toFixed(2); this.goodsDiscount += +((item.retailPrice-item.memberPrice)*item.num).toFixed(2) } amount += +(item.retailPrice*item.num).toFixed(2); // } }) this.goodsTotal = num; this.goodsAmount = amount; this.goodsActualPay = this.goodsAmount - this.goodsDiscount; }, handleClick(tab, event) { let oilNum = "" this.oilNumberList.forEach(item => { if (item.oilName == tab.name){ oilNum = item.numberId } }) if (tab.label == "全部"){ oilNum = "" } this.getList(oilNum) // getOilNumGun({oilNum : oilNum}).then( response => { // this.oilNumGunList = response.data // }) }, gocomponents(index){ this.leftindex = index }, // 获取优惠券列表信息 getCouponList(){ listCardFavorableRecord().then(response => { this.couponList = response.data.records }) let map = { page:1, pageSize:20, } listUserGrade(map).then(response => { this.gradeList = response.data.records }) }, // 获取油枪列表信息 getList(numberId){ getOilGun({numberId:numberId}).then(response => { this.gunList = response.data.records; }) oilNumberList().then(response => { this.oilNumberList = response.data.records; }) },// 获取油枪名称 getName1(oilNameList,id){ let name = "" let _this = this; if(oilNameList!=null && oilNameList!=""){ oilNameList.forEach(item => { if (item.id == id){ name = item.gunName; } }) } return name; }, }, } </script> <style scoped lang="scss"> .after-box{ width: 31%; margin-right: 10px; margin-bottom: 10px; border-radius: 8px; box-sizing: border-box; background-color: #0270ff; height: 110px; padding: 10px; color: white; } .but{ width: 150px; height: 50px; border-radius: 50px; font-size: 20px; } .amountBlue{ color: #00afff; font-weight: bold; } .amount{ display: flex; justify-content: space-between; font-size: 16px; width: 100%; padding: 0 10px; margin: 10px auto; height: 50px; line-height: 50px; background-color: #f6f6f6; border-radius: 5px; } .app-center{ width: 100%; display: flex; box-sizing: border-box; padding: 10px; } .center-left{ width: 33%; border-radius: 8px; overflow: hidden; height: 98vh; position: relative; } .bottom-posi{ width: 100%; position: absolute; bottom: 0px; } .center-app{ width: 33%; border-radius: 8px; overflow: hidden; /*background: white;*/ } .center-right{ width: 33%; border-radius: 8px; overflow: hidden; margin: 0px 10px; } .center-top{ width: 100%; height: 86vh; background: white; margin-bottom: 10px; box-sizing: border-box; padding: 10px; position: relative; } .center-top-title{ box-sizing: border-box; padding: 10px 0px; padding-bottom: 15px; border-bottom: 1px solid #ececec; font-size: 18px; margin-bottom: 10px; } .center-top-tab{ box-sizing: border-box; padding: 15px 0px; } .center-top-input{ width: 100%; height: 60px; background: #f8f8f8; border-radius: 50px; display: flex; align-items: center; justify-content: center; input{ width: 90%; font-size: 18px; border: none; outline: none; background-color:transparent; } } .center-top-data{ width: 100%; border-radius: 8px; overflow: hidden; margin-top: 10px; /*background-color: #f8f8f8;*/ } .center-top-of{ width: 100%; /*background-color: #99a9bf;*/ height: 70vh; overflow: auto; } .wrap-wrap{ display: flex; flex-wrap: wrap; } .of-box{ width: 31%; margin-right: 10px; margin-bottom: 10px; border-radius: 8px; box-sizing: border-box; background-color: #b4d5ff; //height: 110px; padding: 10px; color: #3e4f60; } .of-box2{ width: 31%; margin-right: 10px; margin-bottom: 10px; border-radius: 8px; box-sizing: border-box; background-color: #2773fc; height: 110px; padding: 10px; color: #3e4f60; } .of-title{ font-weight: bold; font-size: 26px; text-align: center; font-family: YouSheBiaoTiHei; margin: 13px; } .data-top{ width: 100%; background-color: #ededed; box-sizing: border-box; padding: 15px 10px; display: flex; align-items: center; justify-content: space-between; } .data-top-box{ width: 100%; /*background-color: #ededed;*/ box-sizing: border-box; padding: 15px 10px; display: flex; align-items: center; justify-content: space-between; } .data-top-three{ width: 55%; display: flex; align-items: center; justify-content: space-between; } .data-top-title{ width: 45%; overflow: hidden; } .content-top-bottom{ position: absolute; bottom:-16px; width: 98%; border-top: 1px solid #ececec; height: 40px; display: flex; align-items: center; justify-content: space-between; transform: translate(-50%,-50%); left: 50%; color: #2c3e50; font-size: 18px; box-sizing: border-box; padding: 15px ; background-color: white; } .top1 { font-size: 16px; } .center-left-top{ width: 100%; background: #FF9655; height: 70px; display: flex; align-items: center; justify-content: center; } .center-vh{ /*height: 68vh;*/ } .center-left-hj{ background: white; display: flex; justify-content: space-between; align-items: center; box-sizing: border-box; padding: 15px; margin-bottom: 2px; } .center-left-th{ background: white; box-sizing: border-box; padding: 15px; margin: 10px auto; } .center-left-wrap{ display: flex; justify-content: space-between; flex-wrap: wrap; /*margin-top: 280px;*/ } .wrap-box{ width: 31%; background: #ffffff; border-radius: 10px; height: 40px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; cursor: pointer; border: 1px solid #30a1ff; } .center-left-bottom{ width: 100%; background-color: white; border-radius: 8px; box-sizing: border-box; padding: 10px; display: flex; align-items: center; justify-content: space-between; } .center-left-lv{ width: 60%; height: 80px; background: linear-gradient( 312deg, #FF945B 0%, #FEB37C 100%); color: white; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 22px; } .wrap-box2{ background: #30a1ff !important; color: white; //width: 100%; //height: 100%; //border-radius: 8px; //height: 80px; //display: flex; //align-items: center; //justify-content: center; //border: 1px solid #20b400; //cursor: pointer; //color: #20b400; } //.wrap-box :hover{ // /*background: #00afff !important;*/ // width: 100%; // height: 100%; // border-radius: 8px; // height: 80px; // display: flex; // align-items: center; // justify-content: center; // border: 1px solid #00afff; // cursor: pointer; // /*color: white;*/ //} .box-center{ width: 100%; //height: 10px; background-color: white; margin: 10px auto; box-sizing: border-box; overflow: auto; } .bottom-qk{ border: 1px solid #99a9bf; box-sizing: border-box; padding: 10px 20px; border-radius: 10px; color: #99a9bf; margin: 15px 0px ; } .bottom-qd{ border: 1px solid #13ce66; background: linear-gradient( 312deg, #9CDCA0 0%, #5BC557 100%); box-sizing: border-box; padding: 14px 20px; border-radius: 8px; color: #ffffff; margin: 15px 10px ; } .bottom-gd{ border: 1px solid #02AAFE; background: linear-gradient( 312deg, #70CAFD 0%, #0BADFE 100%, #02AAFE 100%); box-sizing: border-box; padding: 14px 20px; border-radius: 8px; color: #ffffff; margin: 15px 10px ; } .input-box{ width: 100%; display: flex; align-items: center; justify-content: space-between; font-size: 14px; margin: 5px 0px; } .box-title{ font-size: 18px; text-align: center; align-items: center; margin-top: 15px; } .bottom-price{ font-size: 26px; font-weight: bold; } .price-red{ color: red; } .th-box{ width: 100%; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #f6f8f9; box-sizing: border-box; padding: 10px 0px; } .hj-box{ width: 33%; display: flex; align-items: center; justify-content: center; } .bule{ font-weight: 700; color: #FF9655 !important; } .vip-bottom{ border: 1px solid #ffffff; box-sizing: border-box; padding: 5px 15px; border-radius: 50px; display: flex; align-items: center; justify-content: center; color: white; cursor: pointer; } .amount { color: #00afff; } .el-row { margin-top: 20px; margin-bottom: 20px; &:last-child { margin-bottom: 0; } } .el-col { border-radius: 2px; text-align: center; font-size: 20px; height: 50px; line-height: 50px; } .bg-purple-dark { background: #eeeeee; } .bg-purple { background: #d3dce6; } .bg-purple-light { background: #e5e9f2; } .grid-content { height: 50px; font-size: 20px; width: 120px; border-radius: 4px; min-height: 36px; } .row-bg { padding: 10px 0; background-color: #eeeeee; } .elBut{ width: 85px; height: 50px; font-size: 18px; } .addr{ color: grey; font-size: 12px; } .mon { width: 20%; height: 50px; border: 0.5px #dadfe6 solid; line-height: 25px; border-radius: 5px; text-align: center; margin: 0 10px; margin-bottom: 10px; } .amount1 { color: #00afff; font-size: 20px; } .select2 { position: relative; background-color: #fff; box-shadow: 0px 2px 7px 0px rgba(85, 110, 97, 0.35); border-radius: 5px; border: 1px solid #00aaff; } .select2:before { content: ''; position: absolute; right: 0; bottom: 0; border: 10px solid #00aaff; border-top-color: transparent; border-left-color: transparent; } .select2:after { content: ''; width: 4px; height: 6px; position: absolute; right: 4px; bottom: 3px; border: 2px solid #fff; border-top-color: transparent; border-left-color: transparent; transform: rotate(45deg); } .jine { width: 24%; display: flex; } .bom { font-size: 12px; color: grey; height: 60px !important; line-height: 12px !important; } .zeng { width: 255px; line-height: 40px; font-size: 14px; } .mon2 { width: 20%; height: 70px; border: 0.5px #dadfe6 solid; line-height: 35px; border-radius: 5px; text-align: center; margin: 0 10px; margin-bottom: 20px; } .box{ width: 200px; box-sizing: border-box; padding: 10px; background: #f9f9f9; height: 86px; margin-right: 10px; } .size-hui{ font-size: 14px; margin-bottom: 10px; margin-top: 10px; color: grey; } .size-bole{ font-weight: 400; font-size: 20px; } </style>