完善订单管理,新增物流查询,删除,取消,支付等

This commit is contained in:
唐明明
2022-01-13 15:00:02 +08:00
parent 1968ae15bb
commit f4229dbe22
11 changed files with 340 additions and 6 deletions

View File

@@ -49,8 +49,7 @@ const sign = id => {
// 物流查询 // 物流查询
const logistic = id => { const logistic = id => {
return request({ return request({
url: 'mall/orders/' + id + '/logistic', url: 'mall/orders/' + id + '/logistic'
method: 'PUT'
}) })
} }

View File

@@ -286,6 +286,14 @@
} }
} }
} }
},{
"path": "pages/order/logistics",
"name": "OrderLogistics",
"style": {
"navigationBarTitleText": "物流查询",
"navigationBarBackgroundColor":"#FFFFFF",
"enablePullDownRefresh": false
}
}], }],
"tabBar": { "tabBar": {
"borderStyle": "white", "borderStyle": "white",

View File

@@ -54,6 +54,14 @@
page : 1 page : 1
}; };
}, },
onShow() {
if(this.$store.getters.getRefresh == 1) {
this.$store.commit('setRefresh', 0)
this.array = []
this.page = 1
this.getOrder()
}
},
mounted() { mounted() {
this.getOrder() this.getOrder()
}, },
@@ -87,8 +95,65 @@
this.getOrder() this.getOrder()
}, },
onType(e){ onType(e){
console.log(e) let orderNo = e.order.no
console.log(e.type) 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() { onReachBottom() {

38
pages/order/logistics.vue Normal file
View File

@@ -0,0 +1,38 @@
<template>
<view>
<oct-logistics
:info="info"
:logs="logs"
/>
</view>
</template>
<script>
import { logistic } from '@/apis/interfaces/order'
export default {
data() {
return {
info: {},
logs: []
};
},
mounted() {
logistic(this.$Route.query.orderNo).then(res =>{
console.log(res)
this.info = {
logo : res.orderExpress.logistic_cover,
no : res.orderExpress.express_no,
company : res.orderExpress.logistic_name
}
this.logs = res.logistics
}).catch(err =>{
uni.showToast({
title: err.message,
icon : 'none'
})
})
}
};
</script>
<style></style>

View File

@@ -69,12 +69,16 @@
orderInfo, orderInfo,
success: payRes => { success: payRes => {
console.log(payRes) console.log(payRes)
uni.showModal({ uni.showModal({
title: '支付成功', title: '支付成功',
content: '订单已支付,我们将尽快为您安排发货,可在订单管理查询订单动态', content: '订单已支付,我们将尽快为您安排发货,可在订单管理查询订单动态',
showCancel:false, showCancel:false,
success:onRes => { success:onRes => {
if(onRes.confirm){ if(onRes.confirm){
if(this.$Route.query.oepnType === 'order'){
this.$store.commit('setRefresh', 1)
}
this.$Router.back() this.$Router.back()
} }
} }

View File

@@ -13,7 +13,8 @@ Vue.use(Vuex)
export default new Vuex.Store({ export default new Vuex.Store({
state: { state: {
token : uni.getStorageSync('token') || '', token : uni.getStorageSync('token') || '',
address : {} address : {},
refresh : 0
}, },
getters: { getters: {
getToken: state => { getToken: state => {
@@ -21,6 +22,9 @@ export default new Vuex.Store({
}, },
getAddress: state => { getAddress: state => {
return state.address return state.address
},
getRefresh: state => {
return state.refresh
} }
}, },
mutations: { mutations: {
@@ -30,6 +34,9 @@ export default new Vuex.Store({
}, },
setAddress(state, value) { setAddress(state, value) {
state.address = value state.address = value
},
setRefresh(state, value) {
state.refresh = value
} }
} }
}) })

View File

View File

@@ -0,0 +1,132 @@
<template>
<view class="">
<view class="logistics--header">
<image class="logo" :src="info.logo" mode="aspectFill"></image>
<view class="info">
<view class="info--company">快递公司{{info.company}}</view>
<view class="info--no" @click="copyNo">{{info.no}}<text>复制</text></view>
</view>
</view>
<view class="logistics--logs">
<block v-for="(log, logIndex) in logs" :key="logIndex">
<view class="item">
<view class="">{{log.status}}</view>
<view class="">{{log.time}}</view>
<view class="">{{log.context}}</view>
</view>
</block>
</view>
</view>
</template>
<script>
export default{
props: {
logs: {
type: Array,
default: () => {
return []
}
},
info: {
type: Object,
default: () => {
return {
logo : "",
no : "",
company : ""
}
}
}
},
methods:{
copyNo(){
uni.setClipboardData({
data: this.info.no,
success: res => {
uni.showToast({
title: "单号已复制",
icon : "none"
})
}
})
}
}
}
</script>
<style lang="scss" scoped>
$margin: 30rpx;
$radius: 10rpx;
.logistics--header{
position: relative;
background: linear-gradient(to right, #34ce98, #22aa98);
color: white;
padding: $margin $margin $margin*2;
min-height: 88rpx;
.logo{
width: 88rpx;
height: 88rpx;
background: white;
vertical-align: top;
}
.info{
position: absolute;
left: $margin * 2 + 88rpx;
top: $margin;
font-size: 28rpx;
&--no{
line-height: 44rpx;
font-weight: normal;
text{
margin-left: $margin/2;
}
}
&--company{
height: 44rpx;
line-height: 40rpx;
font-weight: normal;
}
}
}
.logistics--logs{
position: relative;
margin-top: -$margin;
background: white;
border-radius: $radius $radius 0 0;
z-index: 9;
padding: $margin;
overflow: hidden;
.item{
position: relative;
margin-top: $margin;
padding-left: 50rpx;
font-size: 28rpx;
color: #444;
&::after,
&::before{
position: absolute;
content: " ";
}
&::before{
top: 10rpx;
left: 10rpx;
background-color: #ddd;
height: 200%;
width: 2rpx;
}
&::after{
width: 22rpx;
height: 22rpx;
background-color: #ddd;
left: 0;
top: 10rpx;
border-radius: 50%;
}
&:first-child{
margin-top: 0;
&::after{
background-color: #34CE98;
}
}
}
}
</style>

View File

@@ -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"
}
}
}
}
}

View File

@@ -0,0 +1 @@
# oct-logistics

View File

@@ -49,7 +49,7 @@
<view v-show="orderInfo.cans.delete" class="item item--delete" @click="$emit('onBtn', {type: 'delete', order: orderInfo})">删除订单</view> <view v-show="orderInfo.cans.delete" class="item item--delete" @click="$emit('onBtn', {type: 'delete', order: orderInfo})">删除订单</view>
<view v-show="orderInfo.cans.logistic_show" class="item item--logistic" @click="$emit('onBtn', {type: 'logistic', order: orderInfo})">查看物流</view> <view v-show="orderInfo.cans.logistic_show" class="item item--logistic" @click="$emit('onBtn', {type: 'logistic', order: orderInfo})">查看物流</view>
<view v-show="orderInfo.cans.pay" class="item item--pay" @click="$emit('onBtn', {type: 'pay', order: orderInfo})">立即支付</view> <view v-show="orderInfo.cans.pay" class="item item--pay" @click="$emit('onBtn', {type: 'pay', order: orderInfo})">立即支付</view>
<view v-show="orderInfo.cans.sign" class="item item--sign" @click="$emit('onBtn', {type: 'sign', order: orderInfo})">签收</view> <view v-show="orderInfo.cans.sign" class="item item--sign" @click="$emit('onBtn', {type: 'sign', order: orderInfo})">确认签收</view>
</view> </view>
</slot> </slot>
</view> </view>