代客下单计算器

This commit is contained in:
duan 2024-12-03 11:17:43 +08:00
parent 1ec393fcf5
commit c5f4688432
4 changed files with 85 additions and 74 deletions

View File

@ -27,7 +27,7 @@
</div>
<div class="key-line">
<div class="key" @click="clearFunction">
<slot name="clear"> </slot>
<slot name="clear"></slot>
</div>
<div class="key" @click="keyboradAdd('0')">0</div>
<div

View File

@ -31,26 +31,12 @@
<slot name="clear"> </slot>
</div>
<div class="key" @click="keyboradAdd('0')">0</div>
<div
class="key"
style="font-size: 31px"
@click="keyboradReduce"
>
<svg
t="1723453480343"
class="icon"
viewBox="0 0 1664 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="1467"
width="32"
height="32"
>
<div class="key" style="font-size: 31px" @click="keyboradReduce">
<svg t="1723453480343" class="icon" viewBox="0 0 1664 1024" version="1.1"
xmlns="http://www.w3.org/2000/svg" p-id="1467" width="32" height="32">
<path
d="M1526.08 1.6H459.84L41.28 416c-53.76 53.248-53.76 139.52 0 192.64l418.624 414.592v-0.064h1066.176a136.96 136.96 0 0 0 137.6-136.256V137.792a136.96 136.96 0 0 0-137.6-136.192z m-331.392 631.168c26.816 26.624 26.816 69.76 0 96.384-26.88 26.56-70.4 26.56-97.28 0l-121.28-120.128-123.328 122.112a69.76 69.76 0 0 1-97.92 0 68.096 68.096 0 0 1 0-96.96L878.208 512l-121.28-120.064a67.648 67.648 0 0 1 0-96.32c26.88-26.624 70.4-26.624 97.28 0l121.216 120.064 122.24-120.96a69.696 69.696 0 0 1 97.92 0 68.032 68.032 0 0 1 0 96.96l-122.24 120.96 121.344 120.064z"
fill="#333333"
p-id="1468"
></path>
fill="#333333" p-id="1468"></path>
</svg>
</div>
</div>
@ -80,7 +66,7 @@ export default {
default: false,
},
max: {
type: [Number,String],
type: [Number, String],
default: Infinity,
},
value: {
@ -108,22 +94,23 @@ export default {
},
methods: {
clearFunction() {
if(this.isFloat){
if (this.isFloat) {
return this.keyboradAdd('.')
}
this.$emit("clear", this.number);
// this.$emit("clear", this.number);
},
keyboradAdd(n) {
if(n=='.'&& `${this.number}`.includes('.')){
if (n == '.' && `${this.number}`.includes('.')) {
return
}
if (Number(this.number) == 0) {
return (this.number = n);
if (n == '.') {
return (this.number = 0 + n);
}
}
const newval = this.number + n;
console.log(newval)
if (newval*1 > this.max*1) {
return this.$message( this.maxTips);
if (newval * 1 > this.max * 1) {
return this.$message(this.maxTips);
}
this.number = newval;
},
@ -143,7 +130,7 @@ export default {
};
</script>
<style lang="scss" scoped>
<style lang="scss" scoped>
.yd-keyboard {
justify-content: center;
margin-bottom: 20px;
@ -172,9 +159,11 @@ export default {
border-radius: 0;
margin-left: 0;
}
.mini-number-box1 .mini-number .key:hover {
background-color: #dcdfe6;
}
.mini-number-box1 .mini-number .key:not(:last-child) {
border-right: 1px solid #dcdfe6;
}
@ -237,6 +226,7 @@ export default {
-ms-user-select: none;
user-select: none;
}
.simple-Keyboard-number,
.simple-Keyboard-weight {
min-width: 410px;
@ -244,6 +234,7 @@ export default {
border-radius: 4px;
overflow: hidden;
}
.submit {
width: 366px;
height: 44px;
@ -262,6 +253,7 @@ export default {
margin-bottom: 40px;
cursor: pointer;
}
.disabled-box {
position: absolute;
inset: 0;

View File

@ -4,52 +4,37 @@
<div class="select_desk_dialog u-p-b-20">
<key-board isCanEmpty v-model="number" isFloat @clear="clear">
<div slot="clear">.</div>
<div
slot="input"
class="u-font-14 u-row-between u-flex w-full u-text-left"
>
<div slot="input" class="u-font-14 u-row-between u-flex w-full u-text-left">
<div class="">
<div>单价</div>
<div class="u-m-t-10">
<el-tag type="primary" size="medium">1/</el-tag>
<el-tag type="primary" size="medium">{{ item.lowPrice }}/{{ item.unitName }}</el-tag>
</div>
</div>
<div>
<div class="u-font-14">重量</div>
<div class="u-m-t-10">
<el-input
placeholder="请输入挂账金额"
v-model="number"
@input="inputNumber"
@change="inputChange"
@focus="inputFocus"
@blur="inputBlur"
:type="focus ? 'number' : 'text'"
>
<template slot="append"></template>
<el-input placeholder="请输入挂账金额" v-model="number" @input="inputNumber" @change="inputChange"
@focus="inputFocus" @blur="inputBlur" :type="focus ? 'number' : 'text'">
<template slot="append">{{ item.unitName }}</template>
</el-input>
</div>
</div>
</div>
</key-board>
<div class="price u-text-left w-full"> {{ 11 }}</div>
<div class="price u-text-left w-full"> {{ item.lowPrice * number }}</div>
<div class="confirm_btns u-flex u-m-t-20">
<el-button style="width: 100%;" type="primary" size="medium" @click="confirm"
>确定</el-button
>
<el-button style="width: 100%;" type="primary" size="medium" @click="confirm">确定</el-button>
</div>
</div>
</el-dialog>
<choose-guazhang
ref="refChooseGuazhang"
@confirm="chooseGuazhangConfirm"
></choose-guazhang>
<choose-guazhang ref="refChooseGuazhang" @confirm="chooseGuazhangConfirm"></choose-guazhang>
</div>
</template>
<script>
<script>
import keyBoard from "./keyboard.vue";
import chooseGuazhang from "./choose-guazhang.vue";
export default {
@ -69,12 +54,16 @@ export default {
loading: false,
tips: "",
focus: false,
data:{}
data: {},
item: ""
};
},
watch: {
number(newval) {
console.log(newval);
//
// if (newval == '.' || newval == '0.') {
// this.number = newval;
// } else {
if (newval * 1 > this.payMoney * 1) {
this.number = this.payMoney;
this.number = newval;
@ -87,6 +76,7 @@ export default {
this.tips =
shengyu > 0 ? "还需额外支付" + shengyu.toFixed(2) + "元" : "";
}
// }
},
},
methods: {
@ -120,19 +110,20 @@ export default {
this.number = "";
},
confirm() {
if (this.number * 1 > this.payMoney * 1) {
return this.$message("已超出未结账金额");
}
if (this.number * 1 <= 0) {
return this.$message("支付金额不正确");
}
if (!this.guazhangRen) {
return this.$message("请选择挂账人");
}
this.$emit("confirm", this.guazhangRen, this.number);
// if (this.number * 1 > this.payMoney * 1) {
// return this.$message("");
// }
// if (this.number * 1 <= 0) {
// return this.$message("");
// }
// if (!this.guazhangRen) {
// return this.$message("");
// }
this.$emit("confirm", this.item, this.number);
this.close();
},
open(number) {
open(item) {
this.item = item
this.number = this.payMoney * 1;
this.show = true;
this.tips = "还需额外支付" + this.payMoney + "元";
@ -142,57 +133,70 @@ export default {
this.number = "";
},
},
mounted() {},
mounted() { },
};
</script>
<style lang="scss" scoped>
<style lang="scss" scoped>
::v-deep.el-button {
padding: 12px 20px;
}
::v-deep .carts .box_status {
border: none;
}
::v-deep .select_desk_dialog .el-input__inner {
// border: none;
}
::v-deep .el-input__inner::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
::v-deep .el-input__inner::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
::v-deep .el-button--success {
border-color: #22bf64;
background-color: #22bf64;
}
.select_desk .btn {
height: 34px;
}
.tags {
font-size: 16px;
&.using {
color: rgb(234, 64, 37);
}
&.wait {
color: rgb(252, 236, 79);
}
&.idle {
color: rgb(137, 234, 71);
}
&.closed {
color: rgb(221, 221, 221);
filter: grayscale(1);
}
}
::v-deep .inputs .el-input__inner {
border-color: transparent !important;
color: rgba(0, 0, 0, 0.8);
letter-spacing: 1.25px;
font-size: 20px;
}
.select_desk .select_desk_dialog {
display: flex;
@ -248,12 +252,14 @@ export default {
font-size: 20px;
position: relative;
}
.price {
font-size: 18px;
text-align: left;
color: rgb(255, 81, 82);
font-weight: 600;
}
.select_desk .select_desk_dialog .inputs .close {
color: #aaa;
position: absolute;
@ -265,6 +271,7 @@ export default {
margin-top: -15px;
cursor: pointer;
}
.guazhangren {
padding: 12px 10px;
border: 1px solid #dcdfe6;
@ -273,6 +280,7 @@ export default {
min-height: 58px;
color: #999;
cursor: pointer;
.name {
color: #3f9eff;
}

View File

@ -2356,12 +2356,20 @@ export default {
this.$refs.refQuanHexiao.open()
},
//
refWeightGoodsShow() {
this.$refs.refWeightGoods.open();
refWeightGoodsShow(item) {
this.$refs.refWeightGoods.open(item);
},
//
refWeightGoodsConfirm(){
async refWeightGoodsConfirm(item,number){
let {masterId} =await this.getMasterId()
let obj = {
num:number *1,
masterId,
productId: this.selGoods.data.id,
}
// console.log(obj,'obj')
// console.log(this.selGoods,'')
this.chooseSkuConfirm()
},
//
guazhangPayConfirm(guazhangren, price) {
@ -3707,6 +3715,9 @@ export default {
name = name.substring(0, name.length - 1);
// const item = this.selGoods.data.specList.find((v) => v.specSnap === name);
const item = this.selGoods.skuMap[name];
console.log(this.selGoods,'调试1')
console.log(name,'调试2')
console.log(item,'调试1')
if (!item.isGrounding) {
//
return this.$notify({
@ -4063,7 +4074,7 @@ export default {
// return this.$message.error("");
// }
if(item.type=='weigh'){
return this.refWeightGoodsShow()
return this.refWeightGoodsShow(item)
}
if (item.typeEnum === "sku") {
this.selGoods.data = item;