diff --git a/pages.json b/pages.json index f2e5725..d86519f 100644 --- a/pages.json +++ b/pages.json @@ -249,8 +249,19 @@ "navigationBarTitleText" : "订单状态", "navigationStyle": "custom" } + }, + { + "path" : "user/bindTel", + "style" : { + "navigationBarTitleText" : "修改姓名" + } + }, + { + "path" : "user/changeNickname", + "style" : { + "navigationBarTitleText" : "修改手机号" + } } - ] }], "tabBar": { diff --git a/pages/login/login.vue b/pages/login/login.vue index fe74898..180cfab 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -9,6 +9,10 @@ 我已阅读并同意 《用户服务协议》、《隐私政策》 + + + + @@ -20,6 +24,26 @@ } }, methods: { + decryptPhoneNumber(e){ + if( e.detail.errMsg == "getPhoneNumber:ok" ){ //成功 + this.$refs.popup.close() + this.Post({ + code: e.detail.code, + encryptedData: e.detail.encryptedData, + iv: e.detail.iv, + token: uni.getStorageSync('token1') + },'/api/mini_program/bindPhoneNumber').then(res => { + this.$store.commit('changeUserInfo', res.data.userinfo) + if (this.$store.state.user.toPath.includes('user/user')) { + uni.switchTab({ + url: this.$store.state.user.toPath + }) + } else { + uni.navigateBack({}) + } + }) + } + }, getUserInfo() { if(!this.flag) return; @@ -38,12 +62,17 @@ wechat_qrcode: uni.getStorageSync('wechat_qrcode')?uni.getStorageSync('wechat_qrcode'):'' }, '/api/mini_program/login').then(resTwo => { _this.$store.commit('changeUserInfo', resTwo.data.userinfo) - if (_this.$store.state.user.toPath.includes('user/user')) { - uni.switchTab({ - url: _this.$store.state.user.toPath - }) - } else { - uni.navigateBack({}) + if(resTwo.data.userinfo.mobile){ + if (_this.$store.state.user.toPath.includes('user/user')) { + uni.switchTab({ + url: _this.$store.state.user.toPath + }) + } else { + uni.navigateBack({}) + } + }else{ + uni.setStorageSync('token1', resTwo.data.userinfo.token) + _this.$refs.popup.open('bottom') } }) } diff --git a/pages/user/user.vue b/pages/user/user.vue index af68274..ec39fd7 100644 --- a/pages/user/user.vue +++ b/pages/user/user.vue @@ -137,7 +137,8 @@ } }, onShow() { - this.userInfo = this.$store.state.user.userInfo || {} + this.userInfo = JSON.parse(uni.getStorageSync('userInfo')) || this.$store.state.user.userInfo || {} + console.log(this.userInfo) // this.dfkList = [] // this.nowDateTime = parseInt(new Date().getTime() / 1000) // this.Post({}, "/api/user/userInfo").then((res) => { @@ -156,9 +157,15 @@ // 个人信息或登录 gotoProfile() { // 有token去个人信息,没有去登录 - uni.navigateTo({ - url: '/subPackages/user/profile' - }) + if(this.userInfo.token) { + uni.navigateTo({ + url: '/subPackages/user/profile' + }) + }else { + uni.navigateTo({ + url: '/pages/login/login' + }) + } }, timeup(index) { // return this.dfkList.splice(index,1) diff --git a/store/modules/user.js b/store/modules/user.js index 3855524..2fa2e3c 100644 --- a/store/modules/user.js +++ b/store/modules/user.js @@ -1,9 +1,7 @@ export default { // 类似 vue 的 data state: { - userInfo: { - token: "" - }, //保存用户登录信息, + userInfo: {}, //保存用户登录信息, toPath: "", //要跳转过去的页面, foodInfo:"", //美食套餐信息 }, diff --git a/subPackages/food/foodDetail.vue b/subPackages/food/foodDetail.vue index ba2720d..a93cfdb 100644 --- a/subPackages/food/foodDetail.vue +++ b/subPackages/food/foodDetail.vue @@ -42,7 +42,7 @@ 联系电话 {{info.tel}} - + @@ -50,7 +50,7 @@ 商家地址 {{info.address}} - + @@ -69,7 +69,7 @@ - + {{tag}} | diff --git a/subPackages/food/foodOrder.vue b/subPackages/food/foodOrder.vue index 05bd1c1..cc6186d 100644 --- a/subPackages/food/foodOrder.vue +++ b/subPackages/food/foodOrder.vue @@ -133,7 +133,7 @@ }, '/api/order/place' ).then(res => { - if (res.code == 200) { + if (res.code == 1) { this.Post( { order_id: res.data.order_id, diff --git a/subPackages/order/detail.vue b/subPackages/order/detail.vue index 63b7728..f47268a 100644 --- a/subPackages/order/detail.vue +++ b/subPackages/order/detail.vue @@ -48,7 +48,7 @@ - + @@ -203,7 +203,7 @@ - + 商家信息 店铺名称 @@ -212,7 +212,7 @@ 营业时间 - 全年周一至周日 10:00-21:00 + {{merchantInfo.open_time}} @@ -269,10 +269,14 @@ {{info.pay_money/100}} - + 取消订单 + + 关闭订单 + + 再次购买 @@ -330,7 +334,7 @@ lat: uni.getStorageSync('location').lat || '36.95286642085422', specifications_id: this.info.order_child[0].specifications_id },'/api/extract/getMerchantExtractStoreList').then(res => { - this.merchantInfo = res.data[0] + this.merchantInfo = res.data[0] || {} }) } @@ -404,12 +408,38 @@ gotoDetail() { }, - // 取消订单 + // 申请退款 + refund(id) { + let that = this; + uni.showModal({ + title: '提示', + content: '是否申请退款?', + success: successRes => { + if (successRes.confirm) { + that.Post({ + order_id: id + }, + '/api/order/applyRefund' + ).then(res => { + if (res.code == 1) { + uni.showToast({ + title: '申请成功', + icon: 'success' + }); + this.getDetail() + uni.$emit("updateDataByConnect", {msgType:'updateOrderTrades',data:{}}) + } + }); + } + } + }); + }, + // 关闭订单 closeOrder(id, index) { let that = this; uni.showModal({ title: '提示', - content: '确认取消订单?', + content: '确认关闭订单?', success: successRes => { if (successRes.confirm) { that.Post({ @@ -421,6 +451,7 @@ icon: 'success' }); that.getDetail(); + uni.$emit("updateDataByConnect", {msgType:'updateOrderTrades',data:{}}) } }); } @@ -443,8 +474,9 @@ paySign: res.data.paySign, signType: res.data.signType, timeStamp: res.data.timeStamp, - complete:()=>{ + success:()=>{ that.getDetail(); + uni.$emit("updateDataByConnect", {msgType:'updateOrderTrades',data:{}}) } }); } diff --git a/subPackages/order/trades.vue b/subPackages/order/trades.vue index daa8f9e..c3736b2 100644 --- a/subPackages/order/trades.vue +++ b/subPackages/order/trades.vue @@ -25,10 +25,6 @@ 订单号:{{ item.order_id }} - {{ item.status_text }} @@ -42,12 +38,6 @@ ¥{{ pro.pay_money / 100 }} x{{ pro.num }} - @@ -59,7 +49,7 @@ 申请退款 关闭订单 确认收货 - 立即支付 + 立即支付 @@ -153,18 +143,6 @@ export default { this.typeIndex = index; this.onReload(); }, - // 去详情 - goOrderDetail(item) { - console.log(item); - this.orderId = item.order_id; - // (item.order_child[0].consignee || item.order_child[0].extract) - let url = item.order_child[0] && item.order_child[0].consignee ? `/subPages/order/postOrderInfo?id=${item.order_id}` : `/subPages/order/orderInfo?id=${item.order_id}`; - if (item.status && item.status == 'WAIT_PAYMENT') url += `&status=WAIT_PAYMENT`; - console.log(url); - uni.navigateTo({ - url: url - }); - }, setOrderId(id) { let that = this; that.orderId = id; @@ -183,8 +161,10 @@ export default { paySign: res.data.paySign, signType: res.data.signType, timeStamp: res.data.timeStamp, - complete:()=>{ - that.getDetail(); + complete() { + that.list = []; + that.finished = false; + that.getList() } }); } @@ -204,7 +184,7 @@ export default { }, '/api/order/confirmPost' ).then(res => { - if (res.code == 200) { + if (res.code == 1) { list[index].order_child.map(item => { item.status = 'WAIT_COMMENT'; }); @@ -237,7 +217,7 @@ export default { }, '/api/order/closeOrder' ).then(res => { - if (res.code == 200) { + if (res.code == 1) { uni.showToast({ title: '关闭成功', icon: 'success' @@ -265,7 +245,7 @@ export default { }, '/api/order/delOrder' ).then(res => { - if (res.code == 200) { + if (res.code == 1) { uni.showToast({ title: '删除成功', icon: 'success' @@ -294,7 +274,7 @@ export default { }, '/api/order/applyRefund' ).then(res => { - if (res.code == 200) { + if (res.code == 1) { uni.showToast({ title: '申请成功', icon: 'success' @@ -322,35 +302,6 @@ export default { name: this.keywords }; this.Post(data, '/api/order/orderList').then(res => { - // this.list = res.data; - // let arr = res.data; - // arr.forEach(item => { - // item.order_child.forEach((itemX, index) => { - // if (index > 0) { - // item.order_child[0].data = [...item.order_child[0].data, ...itemX.data]; - // } else { - // itemX.f_order_id = item.order_id; - // itemX.f_status_text = item.status_text; - // itemX.f_status = item.status; - // itemX.f_pay_money = item.pay_money; - // console.log(itemX); - // this.list.push(itemX); - // } - // }); - // }); - // console.log(this.list); - // res.data.map(item => { - // let num = 0, - // postFlag = true; - // item.order_child.map(order => { - // num = num + order.num; - // if (order.status != 'POST') { - // postFlag = false - // } - // }) - // item.postFlag = postFlag; - // item.totalNumber = num; - // }) this.list = [...this.list, ...res.data] if (res.data.length < 5) { this.finished = true; diff --git a/subPackages/user/bindTel.vue b/subPackages/user/bindTel.vue new file mode 100644 index 0000000..9672cee --- /dev/null +++ b/subPackages/user/bindTel.vue @@ -0,0 +1,164 @@ + + + + + \ No newline at end of file diff --git a/subPackages/user/changeNickname.vue b/subPackages/user/changeNickname.vue new file mode 100644 index 0000000..d37e3ad --- /dev/null +++ b/subPackages/user/changeNickname.vue @@ -0,0 +1,87 @@ + + + + + \ No newline at end of file diff --git a/subPackages/user/profile.vue b/subPackages/user/profile.vue index ea8ae9c..b5a8997 100644 --- a/subPackages/user/profile.vue +++ b/subPackages/user/profile.vue @@ -21,10 +21,10 @@ - + 手机号 {{info.mobile}} - + 生日 @@ -99,7 +99,7 @@ this.email = this.info.email this.birthday = this.info.birthday this.gender = this.info.gender - this.info.token = JSON.parse(uni.getStorageSync('userInfo')).token || this.$store.state.user.userInfo.token || '2dd9b712-f118-41f6-b3a8-602e4fbb0ce3' + this.info.token = JSON.parse(uni.getStorageSync('userInfo')).token || this.$store.state.user.userInfo.token console.log(this.info) this.$store.commit('changeUserInfo', this.info) })