From 2b66e1d7f84d6cad1cd427d27f0b4baaa88fe090 Mon Sep 17 00:00:00 2001 From: GaoHao <1210693421@qq.com> Date: Sat, 3 Aug 2024 10:50:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E4=BB=98=E7=95=8C=E9=9D=A2=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/cwx-keyboard/cwx-keyboard.vue | 12 +- components/payPasswordtwo - 副本.vue | 224 ---- components/payPasswordtwo.vue | 192 +-- pages/order/confirm_order.vue | 8 +- pages/order_food/order_food-s.vue | 1404 ---------------------- pages/order_food/order_food.vue | 40 +- 6 files changed, 86 insertions(+), 1794 deletions(-) delete mode 100644 components/payPasswordtwo - 副本.vue delete mode 100644 pages/order_food/order_food-s.vue diff --git a/components/cwx-keyboard/cwx-keyboard.vue b/components/cwx-keyboard/cwx-keyboard.vue index 61cb5b7..2af5b11 100644 --- a/components/cwx-keyboard/cwx-keyboard.vue +++ b/components/cwx-keyboard/cwx-keyboard.vue @@ -87,6 +87,7 @@ //不同按键处理逻辑 // -1 代表无效按键,直接返回 if (num == -1) return false; + switch (String(num)) { //小数点 case '.': @@ -140,9 +141,8 @@ //处理数字 _handleNumberKey(num) { - if (this.money.length == 6) { - return - } + + let S = this.money; //如果有小数点且小数点位数不小于2 // if (S.indexOf('.') > -1 && S.substring(S.indexOf('.') + 1).length < 2) @@ -157,6 +157,12 @@ // this.money = S + num; // } // } + console.log(this.money) + console.log(this.money,this.money.length) + if (this.money.length == 6) { + this.$emit('confirmEvent', this.money); //提交参数 + return + } }, //提交 diff --git a/components/payPasswordtwo - 副本.vue b/components/payPasswordtwo - 副本.vue deleted file mode 100644 index 18b348d..0000000 --- a/components/payPasswordtwo - 副本.vue +++ /dev/null @@ -1,224 +0,0 @@ - - - - - \ No newline at end of file diff --git a/components/payPasswordtwo.vue b/components/payPasswordtwo.vue index 6f4f795..8eb5a54 100644 --- a/components/payPasswordtwo.vue +++ b/components/payPasswordtwo.vue @@ -2,32 +2,31 @@ - {{form.password.length == 6?'请再次确认支付密码':"请设置新密码,用于支付验证"}} + + {{payAmount}} - {{consumeFee.slice(0,1)}} + - {{consumeFee.slice(1,2)}} + - {{consumeFee.slice(2,3)}} + - {{consumeFee.slice(3,4)}} + - {{consumeFee.slice(4,5)}} + - {{consumeFee.slice(5,6)}} + - + @@ -38,167 +37,50 @@ components: { cwxKeyboard }, + props: { + payAmount: { + default: 0, + type: Number + }, + }, data() { return { isPwd: uni.cache.get('userInfo').isPwd, - form: { - mobile: uni.cache.get('userInfo').telephone, - password: '', //密码 - payPassword: '', //二次密码 - checkCode: '' - }, - passwords: false, - payPasswords: false, - // 注册定时器 初始值 - second: 60, - showText: true, - Recapture: '发送验证码', consumeFee: '', //第一遍 - consumeFees: '', //第二遍 money: '' }; }, onLoad() { console.log(uni.cache.get('userInfo').isPwd) - if (uni.cache.get('userInfo').isPwd != 0) { - uni.setNavigationBarTitle({ - title: '忘记支付密码', // 标题文本,必须是字符串 - }); - } + }, watch: { consumeFee(newVal, oldVal) { - if (this.form.password.length == 6) { - this.form.payPassword = newVal - if (this.form.payPassword.length == 6) { - this.userInfosavePayPassword() - } - } else { - this.form.password = newVal - if (this.form.password.length == 6) { - this.$refs.keyboard._handleClearKey() //清空 - } - } + } }, methods: { - confirmEvent(e) { - console.log(e) + confirmEvent(val) { + + // uni.showModal({ + // title: '温馨提示', + // content: '输入密码是 = ' + JSON.stringify(this.passwordArr) + // }) + + // 判断是否等于6 + if (val.length === 6) { + this.$emit('accountPayevent', val) + this.money = ""; + } + this.$forceUpdate(); }, - async CodeRegister() { - const res = await this.api.phoneValidateCode({ - // post 手机验证码 - phone: this.form.mobile - }); - if (res) { - uni.showToast({ - title: '验证码获取成功', - icon: 'none' - }); - // 定时器 - this.showText = false; - this.Recapture = '重新获取'; - var interval = setInterval(() => { - let times = --this.second; - this.second = times < 10 ? '0' + times : times; //小于10秒补 0 - }, 1000); - setTimeout(() => { - clearInterval(interval); - this.second = 60; - this.showText = true; - }, 60000); - } - }, - async loginwxuserInfo() { - let res = await this.api.loginwxuserInfo({ - userId: uni.cache.get('userInfo').id - }) - if (res.code == 0) { - uni.cache.set('userInfo', res.data); - } - }, - async userInfosavePayPassword() { - if (this.form.mobile.length != 11 && this.isPwd == 0) { - uni.showToast({ - title: '手机号必须是11位', - icon: 'none' - }); - return false; - } - if (this.form.password == null || this.form.password == '') { - uni.showToast({ - title: '请输入密码', - icon: 'none' - }); - return false; - } - if (this.form.payPassword == null || this.form.payPassword == '') { - uni.showToast({ - title: '请输入确认密码', - icon: 'none' - }); - return false; - } - if (this.form.password.length != 6 || this.form.payPassword.length != 6) { - uni.showToast({ - title: '密码必须是6位', - icon: 'none' - }); - return false; - } - if (this.form.payPassword != this.form.password) { - this.$refs.keyboard._handleClearKey() //清空 - this.form.payPassword = '' - this.form.password = '' - uni.showToast({ - title: '密码和确认密码不一致', - icon: 'none' - }); - return false; - } - if (this.form.checkCode == null || this.form.checkCode == '') { - uni.showToast({ - title: '请输入验证码', - icon: 'none' - }); - return false; - } - let res = await this.api.loginresetPwd({ - pwd: this.form.password, - code: this.form.checkCode - }) - - if (res.code == 0) { - if (uni.cache.get('userInfo').isPwd != 0) { - uni.showToast({ - title: '修改成功', - icon: 'none' - }); - } else { - uni.showToast({ - title: '设置成功', - icon: 'none' - }); - } - // 获取用户信息 - this.loginwxuserInfo() - setTimeout(() => { - uni.navigateBack(); - }, 1000); - } else { - this.$refs.keyboard._handleClearKey() //清空 - this.form.payPassword = '' - this.form.password = '' - } - } + + } }; \ No newline at end of file diff --git a/pages/order_food/order_food.vue b/pages/order_food/order_food.vue index 8248899..a9edb25 100644 --- a/pages/order_food/order_food.vue +++ b/pages/order_food/order_food.vue @@ -169,7 +169,7 @@ {{cartLists.amount||'0.00'}} - 结算 + 去结算 @@ -519,9 +519,22 @@ * @param {Object} b */ shopAdd(item, index, index1, a, b) { + let flag = true; + if ( this.cartLists.data.length > 0) { + this.cartLists.data.forEach((v,e)=>{ + if ( v.productId == item.id) { + flag = false; + } + console.log(v) + }) + } + console.log(a) + console.log(this.amountcartNumber) + console.log(flag) + console.log(item) if ( a == "+" ){ - if ( this.amountcartNumber <= 0) { - this.amountcartNumber = this.amountcartNumber + item.suit; + if ( this.amountcartNumber <= 0 && flag) { + this.amountcartNumber = this.amountcartNumber + (item.suit==0?1:item.suit); }else { this.amountcartNumber++; } @@ -529,8 +542,8 @@ if ( this.amountcartNumber > 0 ) { console.log(item) - if ( this.amountcartNumber <= item.suit) { - this.amountcartNumber = this.amountcartNumber - item.suit + if ( this.amountcartNumber <= item.suit && flag) { + this.amountcartNumber = this.amountcartNumber - (item.suit==0?1:item.suit); } else { this.amountcartNumber = this.amountcartNumber - 1; } @@ -1411,18 +1424,17 @@ .btn { width: 160rpx; height: 64rpx; - background: #FEFAF7; + background: #E7AE7B; border-radius: 36rpx 36rpx 36rpx 36rpx; border: 2rpx solid #E8AD7B; display: flex; align-items: center; - justify-content: flex-end; + justify-content: center; .t { font-weight: bold; font-size: 28rpx; - color: #E8AD7B; - margin-right: 26rpx; + color: #FFFFFF; } } } @@ -1616,6 +1628,9 @@ font-weight: 400; font-size: 24rpx; color: #333333; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; &+.item { margin-top: 1px; @@ -1776,6 +1791,13 @@ color: #999999; margin-bottom: 8rpx; } + .describe,.name{ + width: 270rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .lookBack { color: #FF534B;