From c45996fdd8cc17cd20496350a41fe1c3e5c64ade Mon Sep 17 00:00:00 2001 From: fhysy <1149505133@qq.com> Date: Thu, 20 Mar 2025 17:41:33 +0800 Subject: [PATCH] =?UTF-8?q?feat(order):=20=E4=BC=98=E5=8C=96=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增获取微信openid和生成支付订单的API接口 - 修改登录逻辑,保存公众号appid - 优化AiDrama页面,接入新的AI生成接口 - 屏蔽商品tabbar - 完善素材编辑页面,增加修改意见展示 --- App.vue | 2 + common/api/config.js | 43 +- common/api/module/orderApi.js | 22 + manifest.json | 15 +- package.json | 21 +- pages.json | 14 +- pages/auth/codeLogin.vue | 57 ++- pages/auth/passwordLogin.vue | 62 +-- pages/fun/AiDrama.vue | 311 ++++++++---- pages/fun/materialEdit.vue | 50 +- pages/order/detail.vue | 888 ++++++++++++++++++++-------------- utils/jweixin-1.6.0.js | 1 + 12 files changed, 887 insertions(+), 599 deletions(-) create mode 100644 utils/jweixin-1.6.0.js diff --git a/App.vue b/App.vue index 52887c6..042617a 100644 --- a/App.vue +++ b/App.vue @@ -9,6 +9,7 @@ export default { onLaunch: function() { console.log('App Launch'); + // #ifdef MP-WEIXIN const updateManager = uni.getUpdateManager(); updateManager.onCheckForUpdate(function (res) { @@ -33,6 +34,7 @@ updateManager.onUpdateFailed(function (res) { // 新的版本下载失败 }); + // #endif }, onShow: function() { console.log('App Show'); diff --git a/common/api/config.js b/common/api/config.js index 908c9d8..ed227ba 100644 --- a/common/api/config.js +++ b/common/api/config.js @@ -1,51 +1,14 @@ export default{ cdnImgUrl:'http://static.drgyen.com/app/hc-app-power/images', // 正式 - // baseUrl: 'https://ny-core.dieruen-iot.com', - // imgUrl: 'https://ny-core.dieruen-iot.com', + // baseUrl: 'https://platform-core.059000.xyz', + // imgUrl: 'https://platform-core.059000.xyz', // wsUrl: 'wss://ny-core.dieruen-iot.com', - // 弃用 - // iotOsBaseUrl:"https://iot.gkiiot.com/prod-api", - // 德润正式 - // baseUrl: 'https://digital-core.dieruen-iot.com', - // imgUrl: 'https://digital-core.dieruen-iot.com', - // wsUrl: 'wss://digital-core.dieruen-iot.com', - // 谷云正式 - // baseUrl: 'https://digital-core.drgyen.com', - // imgUrl: 'https://digital-core.drgyen.com', - // wsUrl: 'wss://digital-core.drgyen.com', - // 商城本地测试环境 baseUrl: 'http://192.168.1.17:8080', imgUrl: 'http://192.168.1.17:8080', wsUrl: 'wss://digital-core.drgyen.com', - // 长城 - // baseUrl: 'https://zhny.snc.cn/prod-api/', - // imgUrl: 'https://zhny.snc.cn/prod-api/', - // wsUrl: 'wss://zhny.snc.cn/prod-api/', - // 线下 - // baseUrl: 'http://192.168.1.17:8899', - // imgUrl: 'http://192.168.1.17:8899', - // wsUrl: 'ws://192.168.1.17:8899', - // iotOsBaseUrl:"http://192.168.18.139:8080", - - // 本地 - // baseUrl: 'http://192.168.18.134:9988/dev-api', - // imgUrl: 'http://192.168.18.134:9988/dev-api', - // iotOsBaseUrl:"http://iot.gkiiot.com:8080", - - // #ifdef MP-WEIXIN - // mqttUrl:'wx://iot.gkiiot.com:8083/mqtt', - // mqttUrl:'wxs://iot.gkiiot.com/mqtt-ws/mqtt', - // mqttUrl:'wx://192.168.18.139:8083/mqtt', - // mqttUrl:'wx://iot.gkiiot.com:8083/mqtt', - //#endif - - // #ifndef MP-WEIXIN - // mqttUrl:'ws://iot.gkiiot.com:8083/mqtt', - // mqttUrl:'ws://192.168.18.139:8083/mqtt', - // mqttUrl:'wx://iot.gkiiot.com:8083/mqtt', - // #endif + // 客户端id clientId: 'e5cd7e4891bf95d1d19206ce24a7b32e', } \ No newline at end of file diff --git a/common/api/module/orderApi.js b/common/api/module/orderApi.js index e6ef2c2..6bbae68 100644 --- a/common/api/module/orderApi.js +++ b/common/api/module/orderApi.js @@ -166,4 +166,26 @@ export default { }) }) }, + // 获取openid + getWxOpenid(data){ + return new Promise((resolve, reject) => { + request.get('/wx/offiaccount/getAccessToken',data) + .then((res) =>{ + resolve(res); + }).catch(err =>{ + reject(err); + }) + }) + }, + // 生成支付订单 + addPayOrder(data){ + return new Promise((resolve, reject) => { + request.post('/mall/order/pay',data) + .then((res) =>{ + resolve(res); + }).catch(err =>{ + reject(err); + }) + }) + }, } \ No newline at end of file diff --git a/manifest.json b/manifest.json index f16f8be..acaa27f 100644 --- a/manifest.json +++ b/manifest.json @@ -122,17 +122,22 @@ "h5" : { "devServer" : { "https" : false, - "port" : 8055, - "disableHostCheck" : true // 禁用 Host 检查 打包时改成false + "port" : 8055 }, + "disableHostCheck" : true, // 禁用 Host 检查 打包时改成false "router" : { - "mode" : "hash", - "base" : "" + "mode" : "hash" }, + "base" : "", + // "base" : "/app/", "optimization" : { "treeShaking" : { - "enable" : false + "enable" : true } } } } +// "port" : 8055 +// "disableHostCheck" : true, // 禁用 Host 检查 打包时改成false +// "base" : "/app/" + diff --git a/package.json b/package.json index b7a2155..0967ef4 100644 --- a/package.json +++ b/package.json @@ -1,20 +1 @@ -{ - "name": "hc-zhyd-app", - "version": "1.0.0", - "main": "main.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "flyio": "^0.6.14", - "mqtt": "^3.0.0" - }, - "repository": { - "type": "git", - "url": "https://e.coding.net/fengsl/zhihuiyongdian/hc-app-power.git" - }, - "description": "" -} +{} diff --git a/pages.json b/pages.json index 6ea0085..62d9515 100644 --- a/pages.json +++ b/pages.json @@ -120,12 +120,14 @@ "text": "消息", "iconPath": "static/images/toolbar/new.png", "selectedIconPath": "static/images/toolbar/new-active.png" - }, { - "pagePath": "pages/tabBar/product", - "text": "商品", - "iconPath": "static/images/toolbar/product.png", - "selectedIconPath": "static/images/toolbar/product-active.png" - }, { + }, + // { + // "pagePath": "pages/tabBar/product", + // "text": "商品", + // "iconPath": "static/images/toolbar/product.png", + // "selectedIconPath": "static/images/toolbar/product-active.png" + // }, + { "pagePath": "pages/tabBar/order", "text": "订单", "iconPath": "static/images/toolbar/order.png", diff --git a/pages/auth/codeLogin.vue b/pages/auth/codeLogin.vue index 61900c8..200d43c 100644 --- a/pages/auth/codeLogin.vue +++ b/pages/auth/codeLogin.vue @@ -124,6 +124,7 @@ smsLoading:false, loading:false, icpLicense:'', + homePage:"/pages/tabBar/order" } }, computed: { @@ -161,7 +162,7 @@ console.log("userToken", userToken) if (userToken) { uni.switchTab({ - url: "../tabBar/product" + url: this.homePage }) } else { // this.getCode(); @@ -368,7 +369,7 @@ smsCode: this.form.smsCode, }, header: { - UserType: this.usetTypeValue == "普通用户" ? "PERSONAL" : "TENANT", + // UserType: this.usetTypeValue == "普通用户" ? "PERSONAL" : "TENANT", }, success: (res) => { console.log(res); @@ -379,29 +380,29 @@ }) this.$store.dispatch('setLogin', res.data.token); uni.setStorage({ - key: 'userType', - data: this.usetTypeValue, + key: 'appIdPublic', + data: this.appConfig.appIdPublic, + }).then(res => { + return uni.setStorage({ + key: 'tenantId', + data: this.form.tenantId, + }) }).then(res => { return uni.setStorage({ key: 'phonenumber', data: this.form.phonenumber, }) - }).then(res => { - return uni.setStorage({ - key: 'smsCode', - data: this.form.smsCode, - }) }).then(res => { setTimeout(() => { - if (this.usetTypeValue == "普通用户") { - uni.reLaunch({ - url: "../oneselfUser/index" - }) - } else { + // if (this.usetTypeValue == "普通用户") { + // uni.reLaunch({ + // url: "../oneselfUser/index" + // }) + // } else { uni.switchTab({ - url: "../tabBar/product" + url: this.homePage }) - } + // } }, 1000) }) } else { @@ -440,8 +441,13 @@ }) this.$store.dispatch('setLogin', res.data.data.access_token); uni.setStorage({ - key: 'userType', - data: this.usetTypeValue, + key: 'appIdPublic', + data: this.appConfig.appIdPublic, + }).then(res => { + return uni.setStorage({ + key: 'tenantId', + data: this.form.tenantId, + }) }).then(res => { return uni.setStorage({ key: 'phonenumber', @@ -449,15 +455,16 @@ }) }).then(res => { setTimeout(() => { - if (this.usetTypeValue == "普通用户") { - uni.reLaunch({ - url: "../oneselfUser/index" - }) - } else { + // if (this.usetTypeValue == "普通用户") { + // uni.reLaunch({ + // url: "../oneselfUser/index" + // }) + // } else { + console.log("this.homePage",this.homePage) uni.switchTab({ - url: "../tabBar/product" + url: this.homePage }) - } + // } }, 1000) }) } else { diff --git a/pages/auth/passwordLogin.vue b/pages/auth/passwordLogin.vue index cf0b05c..9995deb 100644 --- a/pages/auth/passwordLogin.vue +++ b/pages/auth/passwordLogin.vue @@ -127,6 +127,7 @@ isTenant: true, appIdMini:'', icpLicense:'', + homePage:"/pages/tabBar/order" } }, computed: { @@ -159,20 +160,20 @@ if(e.mode == '1'){ //mode:1 带密码参数直接登录 this.form.username = e.user || ''; this.form.password = e.pwd || ''; - this.autoLogin() + // this.autoLogin() }else{ userToken = uni.getStorageSync('userToken'); console.log("userToken", userToken) if (userToken) { uni.switchTab({ - url: "../tabBar/product" + url: this.homePage }) } else { // this.getCodeImageFn(); } } - this.usetTypeValue = e.userType == "user" ? "普通用户" : "企业用户"; + // this.usetTypeValue = e.userType == "user" ? "普通用户" : "企业用户"; }, onShow() { @@ -339,11 +340,11 @@ url: '/pages/tabBar/my/userPolicy' }) }, - goForgotPasswordFn() { - uni.navigateTo({ - url: `./forgotPassword?userType=${this.usetTypeValue=="普通用户"?"user":"company"}` - }) - }, + // goForgotPasswordFn() { + // uni.navigateTo({ + // url: `./forgotPassword?userType=${this.usetTypeValue=="普通用户"?"user":"company"}` + // }) + // }, // 获取验证码 getCodeImageFn() { this.$get("/captchaImage").then((res) => { @@ -361,7 +362,7 @@ password: this.form.password, }, header: { - UserType: this.usetTypeValue == "普通用户" ? "PERSONAL" : "TENANT", + // UserType: this.usetTypeValue == "普通用户" ? "PERSONAL" : "TENANT", }, success: (res) => { console.log(res); @@ -372,8 +373,8 @@ }) this.$store.dispatch('setLogin', res.data.token); uni.setStorage({ - key: 'userType', - data: this.usetTypeValue, + key: 'appIdPublic', + data: this.appConfig.appIdPublic, }).then(res => { return uni.setStorage({ key: 'username', @@ -386,15 +387,15 @@ }) }).then(res => { setTimeout(() => { - if (this.usetTypeValue == "普通用户") { - uni.reLaunch({ - url: "../oneselfUser/index" - }) - } else { + // if (this.usetTypeValue == "普通用户") { + // uni.reLaunch({ + // url: "../oneselfUser/index" + // }) + // } else { uni.switchTab({ - url: "../tabBar/product" + url: this.homePage }) - } + // } }, 1000) }) } else { @@ -425,6 +426,7 @@ }, success: (res) => { console.log(res); + if (res.data.code == 200 && res.data.data.access_token) { this.$refs.uToast.show({ title: '登录成功', @@ -432,8 +434,13 @@ }) this.$store.dispatch('setLogin', res.data.data.access_token); uni.setStorage({ - key: 'tenantId', - data: this.form.tenantId, + key: 'appIdPublic', + data: this.appConfig.appIdPublic, + }).then(res => { + return uni.setStorage({ + key: 'tenantId', + data: this.form.tenantId, + }) }).then(res => { return uni.setStorage({ key: 'username', @@ -445,16 +452,17 @@ data: this.form.password, }) }).then(res => { + setTimeout(() => { - if (this.usetTypeValue == "普通用户") { - uni.reLaunch({ - url: "../oneselfUser/index" - }) - } else { + // if (this.usetTypeValue == "普通用户") { + // uni.reLaunch({ + // url: "../oneselfUser/index" + // }) + // } else { uni.switchTab({ - url: "../tabBar/product" + url: this.homePage }) - } + // } }, 1000) }) } else { diff --git a/pages/fun/AiDrama.vue b/pages/fun/AiDrama.vue index 93e169b..7c91cb6 100644 --- a/pages/fun/AiDrama.vue +++ b/pages/fun/AiDrama.vue @@ -87,6 +87,7 @@ + .product-quantity { + font-size: 26rpx; + color: #666; + } + + .product-price { + font-size: 32rpx; + color: #333; + font-weight: 500; + } + + .amount-info { + margin-top: 30rpx; + padding-top: 30rpx; + border-top: 1rpx solid #eee; + } + + .amount-item { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 20rpx; + font-size: 28rpx; + + &:last-child { + margin-bottom: 0; + } + + .price { + font-weight: 500; + + &.paid { + color: #19be6b; + } + } + } + + .payment-method { + display: flex; + align-items: center; + gap: 10rpx; + color: #333; + } + + .source { + display: flex; + align-items: center; + gap: 10rpx; + } + + .status { + color: #19be6b; + } + + .btn-box { + display: flex; + justify-content: space-around; + align-items: center; + height: 120rpx; + position: fixed; + left: 0; + right: 0; + bottom: 0; + background: #fff; + z-index: 999; + + button { + width: 680rpx; + height: 85rpx; + border-radius: 10rpx; + display: flex; + justify-content: center; + align-items: center; + } + } + \ No newline at end of file diff --git a/utils/jweixin-1.6.0.js b/utils/jweixin-1.6.0.js new file mode 100644 index 0000000..05e996b --- /dev/null +++ b/utils/jweixin-1.6.0.js @@ -0,0 +1 @@ +((e,n)=>{"function"==typeof define&&(define.amd||define.cmd)?define(function(){return n(e)}):n(e,!0)})(this,function(r,e){var a,c,n,i,t,o,s,d,l,u,p,f,m,g,h,S,y,I,v,_,w,T;if(!r.jWeixin)return a={config:"preVerifyJSAPI",onMenuShareTimeline:"菜单:分享:时间线",onMenuShareAppMessage:"菜单:分享:appmessage",onMenuShareQQ:"菜单:分享:qq",onMenuShareWeibo:"菜单:分享:weiboApp",onMenuShareQZone:"菜单:分享:QZone",previewImage:"imagePreview",getLocation:"geoLocation",openProductSpecificView:"openProductViewWithPid",addCar d:"batchAddCard",openCard:"batchViewCard",chooseWXPay:"getBrandWCPayRequest",openEnterpriseRedPacket:"getRecevieBizHongBaoRequest",startSearchBeacons:"startMonitoringBeacons",stopSearchBeacons:"stopMonitoringBeacons",onSearchBeacons:"onBeaconsInRange",consumeAndShareCard:"consumedShareCard",openAddress:"editAddress"},c=(()=>{var e,n={};for(e in a)n[a[e]]=e;return n})(),i=(n=r.document).title,t=navigator.userAgent.toLowerCase(),f=navigator.platform.toLowerCase(),o=!(!f.match("mac")&&!f.match("win")),s=-1!=t.indexOf("wxdebugger"),d=-1!=t.indexOf("micromessenger"),l=-1!=t.indexOf("android"),u=-1!=t.indexOf("iphone")||-1!=t.indexOf("ipad"),p=(f=t.match(/micromessenger\/(\d+\.\d+\.\d+)/)||t.match(/micromessenger\/(\d+\.\d+)/))?f [1]:“”,m={initStartTime:L(),initEndTime:0,preVerifyStartTime:0,preVerifyEndTime:0},g={version:1,appId:“”,initTime:0,preVerifyTime:0,networkType:“”,isPreVerifyOk:1,systemType:u?1:l?2:-1,clientVersion:p,url:encodeURIComponent(location.href)},h={},S={_completes:[]},y={state:0,data:{}},O(function(){m.initEndTime=L()}),I=!1,v=[],_={config:function(e){C("config",h=e);var o=!1!==h.check;O(function(){if(o)k(a.config,{verifyJsApiList:A(h.jsApiList),verifyOpenTagList:A(h.openTagList)},(S._complete=function(e){m.preVerifyEndTime=L(),y.state=1,y.data=e},S.success=function(e){g.isPreVerifyOk=0},S.fail=function(e){S._fail?S._fail(e):y.state=-1},(t=S._completes).push(function(){B()}),S.complete=function(e){for(var n=0,i=t.length;n{var n;如果("string"==typeof e&&0{var i,t=c[e];return t&&(e=t),t="ok",n&&(i=n.indexOf(":"),"access被拒绝"!=(t=(t=(t=-1!=(t=-1!=(t="失败"==(t="确认"==(t=n.substring(i+1)),"ok":t),"失败":t).indexOf("失败_")?t.substring(7):t).indexOf("失败_")?t.substring(5):t).replace(/_/g," ")).toLowerCase())&&"没有执行权限"!=t||(t="权限被拒绝"),""==(t="配置"==e&&"函数不存在"==t,"ok":t))&&(t="失败"),n=e+":"+t})(e,t),n.errMsg=t),(i=i||{})._complete&&(i._complete(n),删除i._complete),t=n.errMsg||"",h.debug&&!i.isInnerInvoke&&alert(JSON.stringify(n)),t.indexOf(":"));switch(t.substring(e+1)){case"ok":i.success&&i.success(n);break;case"cancel":i.cancel&&i.cancel(n);break;default:i.fail&&i.fail(n)}i.complete&&i.complete(n)}function A(e){if(e){for(var n=0,i=e.length;n