|
|
@@ -1,22 +1,27 @@
|
|
|
<template>
|
|
|
<view class="boardset-flowert">
|
|
|
<view class="flower-input_box">
|
|
|
-
|
|
|
<view class="flower-open_box">
|
|
|
<view @tap="checkCurrent(1)">
|
|
|
- <view class="desc">收款金额</view>
|
|
|
+ <view class="desc">订单金额</view>
|
|
|
<div class="flower-unit_box">
|
|
|
<text :class="{selected:checkType == 1}">{{price}}</text>
|
|
|
</div>
|
|
|
</view>
|
|
|
</view>
|
|
|
<input class="goods-name" v-model="name" placeholder="商品名称(选填)" placeholder-class="grey-color" />
|
|
|
-
|
|
|
- <view class="pay-style">
|
|
|
- <button :class="[hasPay===0?'selected':'']" @click="changeWay(0)">扫码</button>
|
|
|
- <button :class="[hasPay===1?'selected':'']" @click="changeWay(1)">现金</button>
|
|
|
+ <view class="flower-open_box">
|
|
|
+ <view @tap="checkCurrent(2)">
|
|
|
+ <view class="desc">
|
|
|
+ 收现金
|
|
|
+ <text v-if="Number(zl)>0" style="color:green;margin-left:3upx;">找零 {{zl}}</text>
|
|
|
+ <text style="color:red;margin-left:3upx;" v-if="Number(zl)<0">还差 {{-zl}}</text>
|
|
|
+ </view>
|
|
|
+ <div class="flower-unit_box">
|
|
|
+ <text :class="{selected:checkType == 2}">{{cash}}</text>
|
|
|
+ </div>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
-
|
|
|
</view>
|
|
|
<view class="keyboard-body_box">
|
|
|
<VKeyboard ref="keyboard" :pointIsShow="true" :digital="true" :disorderly="false" @typing="typing" @enter="enter" @cancel="cancel"> </VKeyboard>
|
|
|
@@ -31,22 +36,30 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
price:0,
|
|
|
- //0未全选 1全选
|
|
|
checkType:1,
|
|
|
+ fillType:1,
|
|
|
name:'',
|
|
|
- hasPay:0,
|
|
|
- payWay:4
|
|
|
+ cash:0
|
|
|
};
|
|
|
},
|
|
|
mounted(){
|
|
|
this.activeKeyboard()
|
|
|
},
|
|
|
+ computed:{
|
|
|
+ zl(){
|
|
|
+ let amount = 0
|
|
|
+ if(Number(this.cash) > 0 && Number(this.price) > 0){
|
|
|
+ amount = Number(this.cash) - Number(this.price)
|
|
|
+ amount = parseFloat(amount.toFixed(2))
|
|
|
+ }
|
|
|
+ return Number(amount)
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
- changeWay(val){
|
|
|
- this.hasPay = val
|
|
|
- },
|
|
|
checkCurrent(n){
|
|
|
- this.checkType = 1
|
|
|
+ this.$util.hitVoice()
|
|
|
+ this.checkType = n
|
|
|
+ this.fillType = n
|
|
|
},
|
|
|
cancel(){
|
|
|
this.$util.hitVoice()
|
|
|
@@ -57,18 +70,40 @@ export default {
|
|
|
},
|
|
|
typing(e) {
|
|
|
if (e.backspace) {
|
|
|
- if(this.checkType == 1){
|
|
|
- this.price = ''
|
|
|
- }else{
|
|
|
- if (this.price.length > 0) {
|
|
|
- this.price = this.price.substring(0, this.price.length - 1)
|
|
|
+ if(this.fillType == 1){
|
|
|
+ if(this.checkType == 1){
|
|
|
+ this.price = ''
|
|
|
+ }else{
|
|
|
+ if (this.price.length > 0) {
|
|
|
+ this.price = this.price.substring(0, this.price.length - 1)
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ }else if(this.fillType == 2){
|
|
|
+ if(this.checkType == 2){
|
|
|
+ this.cash = ''
|
|
|
+ }else{
|
|
|
+ if (this.cash.length > 0) {
|
|
|
+ this.cash = this.cash.substring(0, this.cash.length - 1)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+
|
|
|
+ }
|
|
|
}else {
|
|
|
- if(this.$util.isEmpty(this.price) || this.checkType == 1) {
|
|
|
- this.price = e.char
|
|
|
- }else {
|
|
|
- this.price += e.char;
|
|
|
+ if(this.fillType == 1){
|
|
|
+ if(this.$util.isEmpty(this.price) || this.checkType == 1) {
|
|
|
+ this.price = e.char
|
|
|
+ }else {
|
|
|
+ this.price += e.char
|
|
|
+ }
|
|
|
+ }else if(this.fillType == 2){
|
|
|
+ if(this.$util.isEmpty(this.cash) || this.checkType == 2) {
|
|
|
+ this.cash = e.char
|
|
|
+ }else {
|
|
|
+ this.cash += e.char
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
this.checkType = 0
|
|
|
@@ -78,7 +113,7 @@ export default {
|
|
|
this.$msg('请填写金额')
|
|
|
return
|
|
|
}
|
|
|
- this.$emit('confirmSelectPrice', {price:this.price,name:this.name,hasPay:this.hasPay,payWay:this.payWay})
|
|
|
+ this.$emit('confirmSelectPrice', {price:Number(this.price),name:this.name,cash:Number(this.cash)})
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -139,7 +174,7 @@ export default {
|
|
|
.goods-name{
|
|
|
border:1upx solid #EEEEEE;
|
|
|
width:150upx;
|
|
|
- margin:20upx auto 0 auto;
|
|
|
+ margin:10upx auto 0 auto;
|
|
|
height:30upx;
|
|
|
font-size:15upx;
|
|
|
text-align:center;
|