From ac11e4fcc0e002df15d81e056101fdfaa715f084 Mon Sep 17 00:00:00 2001 From: duan <1004387497@qq.com> Date: Thu, 23 May 2024 13:50:20 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/js/api.js | 4 ++ pages/order_detail/order_detail.vue | 74 +++++++++++++++++++++-------- pages/product/placeOrder.vue | 2 +- 3 files changed, 59 insertions(+), 21 deletions(-) diff --git a/common/js/api.js b/common/js/api.js index 598dcac..13ba547 100644 --- a/common/js/api.js +++ b/common/js/api.js @@ -71,6 +71,10 @@ export default { shopUserInfo(data) { return uni.api.get("/user/shopUserInfo", data); }, + // 优惠券数量 + userCoupon(data) { + return uni.api.get("/user/userCoupon", data); + }, // 优惠加倍 yhqDouble(data) { //查询订单支付状态 return uni.api.post("/order/yhqDouble", data); diff --git a/pages/order_detail/order_detail.vue b/pages/order_detail/order_detail.vue index 3dee1c0..50b08a2 100644 --- a/pages/order_detail/order_detail.vue +++ b/pages/order_detail/order_detail.vue @@ -82,10 +82,10 @@ - 红包/低佣券 + 红包/抵用券 - + 可用优惠券{{couponAmount}}张 @@ -118,7 +118,8 @@ - 会员卡余额{{ amountVIP.amount}} 去充值 @@ -197,7 +198,9 @@ amountVIP: null, radiovalue1: '1', vipId: null, - orderInfo: '' + orderInfo: '', + // 可用优惠券数据 + couponAmount: 0 }; }, @@ -213,9 +216,10 @@ this.handlemessage() uni.$on('message', this.getMessage) -// 获取余额 -this.getAount() - + // 获取余额 + this.getAount() + // 获取可用优惠券数量 + this.getcoupon() this.vipId = uni.cache.get('userInfo').id }, onShow() { @@ -223,32 +227,39 @@ this.getAount() }, created() { uni.$on('emitclickorderfood', (num) => { - console.log(num) - // 总金额 couponsAmount 优惠卷购买金额 couponsPrice优惠金额 + // 总金额 couponsAmount 优惠卷购买金额 couponsPrice优惠金额 等于1是团购/不等于1 if (num.clickiconone == 1) { - this.listinfo.amount = (Number(this.listinfo.amounts) - Number(num.couponsPrice)).toFixed(2) + this.listinfo.amount = (Number(this.listinfo.amounts) + Number(num.couponsPrice) - Number(num + .couponsAmount)).toFixed(2) } else { - this.listinfo.amount = (Number(this.listinfo.amounts) + Number(num.couponsAmount) - Number(num - .couponsPrice)).toFixed(2) + this.listinfo.amount = (Number(this.listinfo.amounts) - Number(num.couponsAmount)).toFixed(2) } this.emitorderfoodform = num // this.num += num }) }, methods: { - async getAount(){ + async getcoupon() { + let res = await this.api.userCoupon({ + "orderNum": this.listinfo.amount, + "userId": uni.cache.get('userInfo').id, + }) + if (res.code == 0) { + this.couponAmount = res.data + } + }, + async getAount() { let res = await this.api.shopUserInfo({ // shopId:店铺ID "shopId": uni.cache.get('shopUser'), "userId": uni.cache.get('userInfo').id, }) - if(res.code==0){ - + if (res.code == 0) { + this.amountVIP = res.data } }, getMessage(msg) { - console.log('tiaoshi1', msg) if (msg.status != 'success') { uni.showToast({ title: msg.msg, @@ -260,7 +271,6 @@ this.getAount() } else { switch (msg.type) { case 'createOrder': //去结算 - console.log('tiaoshi2', msg) this.listinfoid = msg.data.id //下单需要的id this.orderInfo = msg.data this.showpopupclickdd() @@ -330,23 +340,38 @@ this.getAount() }, // 去充值 goRecharge() { - uni.pro.navigateTo('/pages/member/index') + uni.pro.navigateTo('/pages/member/index', { + shopId_id: uni.cache.get('shopUser') + }) }, // 余额支付 async accountPayevent(id) { + console.log(this.amountVIP, '会员信息') + let res = await this.api.accountPay({ orderId: id, memberId: this.vipId }) console.log(res, '调试12') if (res) { - + this.ispayPws() } else { setTimeout(() => { this.goRecharge() }, 1000) } }, + // 是否有支付密码 + ispayPws() { + // 先判断是否设置支付密码。0是没设置。没设置的情况下跳转到设置页面。有的话输入支付密码 + if (this.amountVIP.isPwd == 0) { + uni.pro.navigateTo('/pages/user/repairpassword', { + shopId_id: uni.cache.get('shopUser') + }) + } else { + + } + }, async showpopupclickdd(i) { let res = await this.api.payorderPay({ orderId: this.listinfoid @@ -400,7 +425,16 @@ this.getAount() } }); } else { - this.accountPayevent(this.listinfoid) + // 判断是否有绑定支付密码 + let isVip = uni.cache.get('userInfo').isPwd + console.log(isVip,'调试 123') + if (isVip == 0) { + uni.pro.navigateTo('/pages/user/repairpassword', { + shopId_id: uni.cache.get('shopUser') + }) + } else { + this.accountPayevent(this.listinfoid) + } } // #endif diff --git a/pages/product/placeOrder.vue b/pages/product/placeOrder.vue index 3fa5e09..36c8e68 100644 --- a/pages/product/placeOrder.vue +++ b/pages/product/placeOrder.vue @@ -31,7 +31,7 @@ - 红包/低佣券 + 红包/抵用券 {{info.couponDetail.name}} From dd5adf82b8b8e7db63cef583e0dc4db5c4b4ac94 Mon Sep 17 00:00:00 2001 From: duan <1004387497@qq.com> Date: Thu, 23 May 2024 16:39:56 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E6=89=AB=E7=A0=81=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- framework/11-api.js | 1 + pages.json | 2 +- pages/order_detail/components/payPassword.vue | 192 +++++++++++++++ pages/order_detail/order_detail.vue | 135 ++++++---- uni_modules/cc-defineKeyboard/changelog.md | 8 + .../cc-defineKeyboard/cc-defineKeyboard.scss | 43 ++++ .../cc-defineKeyboard/cc-defineKeyboard.vue | 115 +++++++++ uni_modules/cc-defineKeyboard/package.json | 87 +++++++ uni_modules/cc-defineKeyboard/readme.md | 232 ++++++++++++++++++ 9 files changed, 761 insertions(+), 54 deletions(-) create mode 100644 pages/order_detail/components/payPassword.vue create mode 100644 uni_modules/cc-defineKeyboard/changelog.md create mode 100644 uni_modules/cc-defineKeyboard/components/cc-defineKeyboard/cc-defineKeyboard.scss create mode 100644 uni_modules/cc-defineKeyboard/components/cc-defineKeyboard/cc-defineKeyboard.vue create mode 100644 uni_modules/cc-defineKeyboard/package.json create mode 100644 uni_modules/cc-defineKeyboard/readme.md diff --git a/framework/11-api.js b/framework/11-api.js index 21865c5..fa274dc 100644 --- a/framework/11-api.js +++ b/framework/11-api.js @@ -127,6 +127,7 @@ async function request(options) { } }) } + return res } } else { uni.hideLoading() diff --git a/pages.json b/pages.json index bfa7aea..607816b 100644 --- a/pages.json +++ b/pages.json @@ -231,7 +231,7 @@ "style": { "navigationBarTitleText": "订单详情" } - } + } ], "globalStyle": { "navigationBarTextStyle": "black", diff --git a/pages/order_detail/components/payPassword.vue b/pages/order_detail/components/payPassword.vue new file mode 100644 index 0000000..08be0cd --- /dev/null +++ b/pages/order_detail/components/payPassword.vue @@ -0,0 +1,192 @@ + + + + + \ No newline at end of file diff --git a/pages/order_detail/order_detail.vue b/pages/order_detail/order_detail.vue index b96d81e..9cf03ad 100644 --- a/pages/order_detail/order_detail.vue +++ b/pages/order_detail/order_detail.vue @@ -176,12 +176,18 @@ + + + + diff --git a/uni_modules/cc-defineKeyboard/package.json b/uni_modules/cc-defineKeyboard/package.json new file mode 100644 index 0000000..39fc622 --- /dev/null +++ b/uni_modules/cc-defineKeyboard/package.json @@ -0,0 +1,87 @@ +{ + "id": "cc-defineKeyboard", + "displayName": "自定义支付密码输入键盘Keyboard和支付设置输入框Input", + "version": "2.0", + "description": "自定义支付密码输入键盘Keyboard和支付设置输入框Input", + "keywords": [ + "支付密码", + "键盘", + "", + "支付密码输入键盘", + "Keyboard", + "", + "自定义键盘" +], + "repository": "", + "engines": { + "HBuilderX": "^3.7.0" + }, + "dcloudext": { + "type": "component-vue", + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "" + }, + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "Vue": { + "vue2": "y", + "vue3": "y" + }, + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y", + "钉钉": "y", + "快手": "y", + "飞书": "y", + "京东": "y" + }, + "快应用": { + "华为": "y", + "联盟": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/cc-defineKeyboard/readme.md b/uni_modules/cc-defineKeyboard/readme.md new file mode 100644 index 0000000..34182fd --- /dev/null +++ b/uni_modules/cc-defineKeyboard/readme.md @@ -0,0 +1,232 @@ +# cc-defineKeyboard + + +#### 使用方法 +```使用方法 + + + +/** * 唤起键盘 */ +onPayUp() { + this.$refs.CodeKeyboard.show(); +}, + +/*** 支付键盘回调* @param {Object} val */ + +KeyInfo(val) { + + if (val.index >= 6) { + return; + } + // 判断是否输入的是删除键 + if (val.keyCode === 8) { + // 删除最后一位 + this.passwordArr.splice(val.index + 1, 1) + } + // 判断是否输入的是. + else if (val.keyCode == 190) { + // 输入.无效 + } else { + this.passwordArr.push(val.key); + } + + uni.showModal({ + title: '温馨提示', + content: '输入密码是 = ' + JSON.stringify(this.passwordArr) + }) +} + + +``` + +#### HTML代码实现部分 +```html + + + + + + + + +``` From 7cea9eb62848fd4d73448118b298d971df20306c Mon Sep 17 00:00:00 2001 From: duan <1004387497@qq.com> Date: Fri, 24 May 2024 09:28:14 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E6=94=AF=E4=BB=98=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components => components}/payPassword.vue | 0 manifest.json | 220 +++++++++--------- pages/index/index.vue | 2 +- pages/order_detail/order_detail.vue | 95 ++++---- pages/product/placeOrder.vue | 101 ++++++-- .../cc-defineKeyboard/cc-defineKeyboard.vue | 6 +- .../{ => 新建文件夹}/uni-scss/changelog.md | 0 .../{ => 新建文件夹}/uni-scss/index.scss | 0 .../{ => 新建文件夹}/uni-scss/package.json | 0 .../{ => 新建文件夹}/uni-scss/readme.md | 0 .../uni-scss/styles/index.scss | 0 .../uni-scss/styles/setting/_border.scss | 0 .../uni-scss/styles/setting/_color.scss | 0 .../uni-scss/styles/setting/_radius.scss | 0 .../uni-scss/styles/setting/_space.scss | 0 .../uni-scss/styles/setting/_styles.scss | 0 .../uni-scss/styles/setting/_text.scss | 0 .../uni-scss/styles/setting/_variables.scss | 0 .../uni-scss/styles/tools/functions.scss | 0 .../{ => 新建文件夹}/uni-scss/theme.scss | 0 .../{ => 新建文件夹}/uni-scss/variables.scss | 0 21 files changed, 254 insertions(+), 170 deletions(-) rename {pages/order_detail/components => components}/payPassword.vue (100%) rename uni_modules/{ => 新建文件夹}/uni-scss/changelog.md (100%) rename uni_modules/{ => 新建文件夹}/uni-scss/index.scss (100%) rename uni_modules/{ => 新建文件夹}/uni-scss/package.json (100%) rename uni_modules/{ => 新建文件夹}/uni-scss/readme.md (100%) rename uni_modules/{ => 新建文件夹}/uni-scss/styles/index.scss (100%) rename uni_modules/{ => 新建文件夹}/uni-scss/styles/setting/_border.scss (100%) rename uni_modules/{ => 新建文件夹}/uni-scss/styles/setting/_color.scss (100%) rename uni_modules/{ => 新建文件夹}/uni-scss/styles/setting/_radius.scss (100%) rename uni_modules/{ => 新建文件夹}/uni-scss/styles/setting/_space.scss (100%) rename uni_modules/{ => 新建文件夹}/uni-scss/styles/setting/_styles.scss (100%) rename uni_modules/{ => 新建文件夹}/uni-scss/styles/setting/_text.scss (100%) rename uni_modules/{ => 新建文件夹}/uni-scss/styles/setting/_variables.scss (100%) rename uni_modules/{ => 新建文件夹}/uni-scss/styles/tools/functions.scss (100%) rename uni_modules/{ => 新建文件夹}/uni-scss/theme.scss (100%) rename uni_modules/{ => 新建文件夹}/uni-scss/variables.scss (100%) diff --git a/pages/order_detail/components/payPassword.vue b/components/payPassword.vue similarity index 100% rename from pages/order_detail/components/payPassword.vue rename to components/payPassword.vue diff --git a/manifest.json b/manifest.json index 4b6f8c1..64b255c 100644 --- a/manifest.json +++ b/manifest.json @@ -1,111 +1,111 @@ { - "name": "cashier_weapp", - "appid": "__UNI__8092421", - "description": "", - "versionName": "1.0.0", - "versionCode": "100", - "transformPx": false, - /* 5+App特有相关 */ - "app-plus": { - "usingComponents": true, - "nvueStyleCompiler": "uni-app", - "compilerVersion": 3, - "splashscreen": { - "alwaysShowBeforeRender": true, - "waiting": true, - "autoclose": true, - "delay": 0 - }, - /* 模块配置 */ - "modules": { - "Barcode": {} - }, - /* 应用发布信息 */ - "distribute": { - /* android打包配置 */ - "android": { - "permissions": [ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "" - ] - }, - /* ios打包配置 */ - "ios": { - "dSYMs": false - }, - /* SDK配置 */ - "sdkConfigs": { - "ad": {} - } - } - }, - /* 快应用特有相关 */ - "quickapp": {}, - /* 小程序特有相关 */ - "mp-weixin": { - "appid": "wxd88fffa983758a30", - "setting": { - "urlCheck": false, - "minified": true, - "es6": true, - "postcss": true - }, - "usingComponents": true, - "libVersion": "latest", - "permission": { - "scope.userLocation": { - "desc": "你的位置信息将用于小程序位置接口的效果展示" - } - }, - "requiredPrivateInfos": ["getLocation", "onLocationChange", "chooseLocation", "chooseAddress"] - }, - "h5": { - "devServer": { - "https": false, - "disableHostCheck": false, - "proxy": { - "/api": { - "target": "https://wxcashiertest.sxczgkj.cn/cashierService", - // "target" : "https://ky.sxczgkj.cn", - "ws": false, - "changeOrigin": true, //是否跨域 - "secure": false, // 设置支持https协议的代理 - "pathRewrite": { - "^/api": "" //需要rewrite重写的, - } - } - } - }, - "template": "template.h5.html", - "router": { - "mode": "history", - "base": "/h5/" - } - }, - "mp-alipay": { - "usingComponents": true - }, - "mp-baidu": { - "usingComponents": true - }, - "mp-toutiao": { - "usingComponents": true - }, - "uniStatistics": { - "enable": false - }, - "vueVersion": "2" -} \ No newline at end of file + "name" : "cashier_weapp", + "appid" : "__UNI__8092421", + "description" : "", + "versionName" : "1.0.0", + "versionCode" : "100", + "transformPx" : false, + /* 5+App特有相关 */ + "app-plus" : { + "usingComponents" : true, + "nvueStyleCompiler" : "uni-app", + "compilerVersion" : 3, + "splashscreen" : { + "alwaysShowBeforeRender" : true, + "waiting" : true, + "autoclose" : true, + "delay" : 0 + }, + /* 模块配置 */ + "modules" : { + "Barcode" : {} + }, + /* 应用发布信息 */ + "distribute" : { + /* android打包配置 */ + "android" : { + "permissions" : [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + /* ios打包配置 */ + "ios" : { + "dSYMs" : false + }, + /* SDK配置 */ + "sdkConfigs" : { + "ad" : {} + } + } + }, + /* 快应用特有相关 */ + "quickapp" : {}, + /* 小程序特有相关 */ + "mp-weixin" : { + "appid" : "wxd88fffa983758a30", + "setting" : { + "urlCheck" : false, + "minified" : true, + "es6" : true, + "postcss" : true + }, + "usingComponents" : true, + "libVersion" : "latest", + "permission" : { + "scope.userLocation" : { + "desc" : "你的位置信息将用于小程序位置接口的效果展示" + } + }, + "requiredPrivateInfos" : [ "getLocation", "onLocationChange", "chooseLocation", "chooseAddress" ] + }, + "h5" : { + "devServer" : { + "https" : false, + "disableHostCheck" : false, + "proxy" : { + "/api" : { + "target" : "https://wxcashiertest.sxczgkj.cn/cashierService", + // "target" : "https://ky.sxczgkj.cn", + "ws" : false, + "changeOrigin" : true, //是否跨域 + "secure" : false, // 设置支持https协议的代理 + "pathRewrite" : { + "^/api" : "" //需要rewrite重写的, + } + } + } + }, + "template" : "template.h5.html", + "router" : { + "mode" : "history", + "base" : "/h5/" + } + }, + "mp-alipay" : { + "usingComponents" : true + }, + "mp-baidu" : { + "usingComponents" : true + }, + "mp-toutiao" : { + "usingComponents" : true + }, + "uniStatistics" : { + "enable" : false + }, + "vueVersion" : "2" +} diff --git a/pages/index/index.vue b/pages/index/index.vue index d73ef17..046b8e2 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -137,7 +137,7 @@ - + diff --git a/pages/order_detail/order_detail.vue b/pages/order_detail/order_detail.vue index 9cf03ad..328b037 100644 --- a/pages/order_detail/order_detail.vue +++ b/pages/order_detail/order_detail.vue @@ -183,7 +183,7 @@