代客下单计算器

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>
<div class="key-line"> <div class="key-line">
<div class="key" @click="clearFunction"> <div class="key" @click="clearFunction">
<slot name="clear"> </slot> <slot name="clear"></slot>
</div> </div>
<div class="key" @click="keyboradAdd('0')">0</div> <div class="key" @click="keyboradAdd('0')">0</div>
<div <div

View File

@ -31,26 +31,12 @@
<slot name="clear"> </slot> <slot name="clear"> </slot>
</div> </div>
<div class="key" @click="keyboradAdd('0')">0</div> <div class="key" @click="keyboradAdd('0')">0</div>
<div <div class="key" style="font-size: 31px" @click="keyboradReduce">
class="key" <svg t="1723453480343" class="icon" viewBox="0 0 1664 1024" version="1.1"
style="font-size: 31px" xmlns="http://www.w3.org/2000/svg" p-id="1467" width="32" height="32">
@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 <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" 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" fill="#333333" p-id="1468"></path>
p-id="1468"
></path>
</svg> </svg>
</div> </div>
</div> </div>
@ -80,7 +66,7 @@ export default {
default: false, default: false,
}, },
max: { max: {
type: [Number,String], type: [Number, String],
default: Infinity, default: Infinity,
}, },
value: { value: {
@ -108,22 +94,23 @@ export default {
}, },
methods: { methods: {
clearFunction() { clearFunction() {
if(this.isFloat){ if (this.isFloat) {
return this.keyboradAdd('.') return this.keyboradAdd('.')
} }
this.$emit("clear", this.number); // this.$emit("clear", this.number);
}, },
keyboradAdd(n) { keyboradAdd(n) {
if(n=='.'&& `${this.number}`.includes('.')){ if (n == '.' && `${this.number}`.includes('.')) {
return return
} }
if (Number(this.number) == 0) { if (Number(this.number) == 0) {
return (this.number = n); if (n == '.') {
return (this.number = 0 + n);
}
} }
const newval = this.number + n; const newval = this.number + n;
console.log(newval) if (newval * 1 > this.max * 1) {
if (newval*1 > this.max*1) { return this.$message(this.maxTips);
return this.$message( this.maxTips);
} }
this.number = newval; this.number = newval;
}, },
@ -143,7 +130,7 @@ export default {
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.yd-keyboard { .yd-keyboard {
justify-content: center; justify-content: center;
margin-bottom: 20px; margin-bottom: 20px;
@ -172,9 +159,11 @@ export default {
border-radius: 0; border-radius: 0;
margin-left: 0; margin-left: 0;
} }
.mini-number-box1 .mini-number .key:hover { .mini-number-box1 .mini-number .key:hover {
background-color: #dcdfe6; background-color: #dcdfe6;
} }
.mini-number-box1 .mini-number .key:not(:last-child) { .mini-number-box1 .mini-number .key:not(:last-child) {
border-right: 1px solid #dcdfe6; border-right: 1px solid #dcdfe6;
} }
@ -237,6 +226,7 @@ export default {
-ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
} }
.simple-Keyboard-number, .simple-Keyboard-number,
.simple-Keyboard-weight { .simple-Keyboard-weight {
min-width: 410px; min-width: 410px;
@ -244,6 +234,7 @@ export default {
border-radius: 4px; border-radius: 4px;
overflow: hidden; overflow: hidden;
} }
.submit { .submit {
width: 366px; width: 366px;
height: 44px; height: 44px;
@ -262,6 +253,7 @@ export default {
margin-bottom: 40px; margin-bottom: 40px;
cursor: pointer; cursor: pointer;
} }
.disabled-box { .disabled-box {
position: absolute; position: absolute;
inset: 0; inset: 0;

View File

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

View File

@ -2356,12 +2356,20 @@ export default {
this.$refs.refQuanHexiao.open() this.$refs.refQuanHexiao.open()
}, },
// //
refWeightGoodsShow() { refWeightGoodsShow(item) {
this.$refs.refWeightGoods.open(); 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) { guazhangPayConfirm(guazhangren, price) {
@ -3707,6 +3715,9 @@ export default {
name = name.substring(0, name.length - 1); name = name.substring(0, name.length - 1);
// const item = this.selGoods.data.specList.find((v) => v.specSnap === name); // const item = this.selGoods.data.specList.find((v) => v.specSnap === name);
const item = this.selGoods.skuMap[name]; const item = this.selGoods.skuMap[name];
console.log(this.selGoods,'调试1')
console.log(name,'调试2')
console.log(item,'调试1')
if (!item.isGrounding) { if (!item.isGrounding) {
// //
return this.$notify({ return this.$notify({
@ -4063,7 +4074,7 @@ export default {
// return this.$message.error(""); // return this.$message.error("");
// } // }
if(item.type=='weigh'){ if(item.type=='weigh'){
return this.refWeightGoodsShow() return this.refWeightGoodsShow(item)
} }
if (item.typeEnum === "sku") { if (item.typeEnum === "sku") {
this.selGoods.data = item; this.selGoods.data = item;