diff --git a/apis/interfaces/order.js b/apis/interfaces/order.js index 57565b4..fa8969d 100644 --- a/apis/interfaces/order.js +++ b/apis/interfaces/order.js @@ -49,8 +49,7 @@ const sign = id => { // 物流查询 const logistic = id => { return request({ - url: 'mall/orders/' + id + '/logistic', - method: 'PUT' + url: 'mall/orders/' + id + '/logistic' }) } diff --git a/pages.json b/pages.json index 400dee0..ece1cc3 100644 --- a/pages.json +++ b/pages.json @@ -286,6 +286,14 @@ } } } + },{ + "path": "pages/order/logistics", + "name": "OrderLogistics", + "style": { + "navigationBarTitleText": "物流查询", + "navigationBarBackgroundColor":"#FFFFFF", + "enablePullDownRefresh": false + } }], "tabBar": { "borderStyle": "white", diff --git a/pages/order/index.vue b/pages/order/index.vue index 41d9a24..62f2e33 100644 --- a/pages/order/index.vue +++ b/pages/order/index.vue @@ -54,6 +54,14 @@ page : 1 }; }, + onShow() { + if(this.$store.getters.getRefresh == 1) { + this.$store.commit('setRefresh', 0) + this.array = [] + this.page = 1 + this.getOrder() + } + }, mounted() { this.getOrder() }, @@ -87,8 +95,65 @@ this.getOrder() }, onType(e){ - console.log(e) - console.log(e.type) + let orderNo = e.order.no + let onFount + + switch (e.type){ + case 'delete': + onFount = del(orderNo) + break; + case 'cancel': + onFount = cancel(orderNo) + break; + case 'logistic': + this.$Router.push({ + name: 'OrderLogistics', + params: { + orderNo + }, + }) + break; + case 'pay': + this.$Router.push({ + name: 'Pay', + params: { + orderNo : orderNo, + price : e.order.price, + oepnType: 'order' + } + }) + break; + case 'sign': + onFount = sign(orderNo) + break; + } + + if(!onFount) return + + onFount.then(res =>{ + let orderIndex = this.array.findIndex(val => val.no === e.order.no) + if(e.type === 'delete' || e.type === 'sign'){ + this.array.splice(orderIndex, 1) + return + } + if(e.type === 'cancel'){ + this.array.splice(orderIndex, 1, { + no : res.order_no, + cover : res.items[0].sku.cover, + name : res.items[0].sku.goods_name, + price : res.items[0].price, + sum : res.items[0].qty, + stateText : res.state, + cans : res.can + }) + return + } + }).catch(err => { + uni.showToast({ + title: err.message, + icon : 'none' + }) + }) } }, onReachBottom() { diff --git a/pages/order/logistics.vue b/pages/order/logistics.vue new file mode 100644 index 0000000..5600036 --- /dev/null +++ b/pages/order/logistics.vue @@ -0,0 +1,38 @@ + + + + + diff --git a/pages/pay/pay.vue b/pages/pay/pay.vue index 083c134..84cdc42 100644 --- a/pages/pay/pay.vue +++ b/pages/pay/pay.vue @@ -69,12 +69,16 @@ orderInfo, success: payRes => { console.log(payRes) + uni.showModal({ title: '支付成功', content: '订单已支付,我们将尽快为您安排发货,可在订单管理查询订单动态', showCancel:false, success:onRes => { if(onRes.confirm){ + if(this.$Route.query.oepnType === 'order'){ + this.$store.commit('setRefresh', 1) + } this.$Router.back() } } diff --git a/store/index.js b/store/index.js index eddf8ed..fadb080 100644 --- a/store/index.js +++ b/store/index.js @@ -13,7 +13,8 @@ Vue.use(Vuex) export default new Vuex.Store({ state: { token : uni.getStorageSync('token') || '', - address : {} + address : {}, + refresh : 0 }, getters: { getToken: state => { @@ -21,6 +22,9 @@ export default new Vuex.Store({ }, getAddress: state => { return state.address + }, + getRefresh: state => { + return state.refresh } }, mutations: { @@ -30,6 +34,9 @@ export default new Vuex.Store({ }, setAddress(state, value) { state.address = value + }, + setRefresh(state, value) { + state.refresh = value } } }) diff --git a/uni_modules/oct-logistics/changelog.md b/uni_modules/oct-logistics/changelog.md new file mode 100644 index 0000000..e69de29 diff --git a/uni_modules/oct-logistics/components/oct-logistics/oct-logistics.vue b/uni_modules/oct-logistics/components/oct-logistics/oct-logistics.vue new file mode 100644 index 0000000..55a87d7 --- /dev/null +++ b/uni_modules/oct-logistics/components/oct-logistics/oct-logistics.vue @@ -0,0 +1,132 @@ + + + diff --git a/uni_modules/oct-logistics/package.json b/uni_modules/oct-logistics/package.json new file mode 100644 index 0000000..ef626ad --- /dev/null +++ b/uni_modules/oct-logistics/package.json @@ -0,0 +1,80 @@ +{ + "id": "oct-logistics", + "displayName": "oct-logistics", + "version": "1.0.0", + "description": "oct-logistics", + "keywords": [ + "oct-logistics" +], + "repository": "", + "engines": { + "HBuilderX": "^3.1.0" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "", + "data": "", + "permissions": "" + }, + "npmurl": "" + }, + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "u", + "aliyun": "u" + }, + "client": { + "Vue": { + "vue2": "u", + "vue3": "u" + }, + "App": { + "app-vue": "u", + "app-nvue": "u" + }, + "H5-mobile": { + "Safari": "u", + "Android Browser": "u", + "微信浏览器(Android)": "u", + "QQ浏览器(Android)": "u" + }, + "H5-pc": { + "Chrome": "u", + "IE": "u", + "Edge": "u", + "Firefox": "u", + "Safari": "u" + }, + "小程序": { + "微信": "u", + "阿里": "u", + "百度": "u", + "字节跳动": "u", + "QQ": "u" + }, + "快应用": { + "华为": "u", + "联盟": "u" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/oct-logistics/readme.md b/uni_modules/oct-logistics/readme.md new file mode 100644 index 0000000..cd5013e --- /dev/null +++ b/uni_modules/oct-logistics/readme.md @@ -0,0 +1 @@ +# oct-logistics \ No newline at end of file diff --git a/uni_modules/oct-order/components/oct-order/oct-order.vue b/uni_modules/oct-order/components/oct-order/oct-order.vue index 688cfce..86f1a88 100644 --- a/uni_modules/oct-order/components/oct-order/oct-order.vue +++ b/uni_modules/oct-order/components/oct-order/oct-order.vue @@ -49,7 +49,7 @@ 删除订单 查看物流 立即支付 - 签收 + 确认签收