完善订单管理,新增物流查询,删除,取消,支付等
This commit is contained in:
@@ -49,8 +49,7 @@ const sign = id => {
|
||||
// 物流查询
|
||||
const logistic = id => {
|
||||
return request({
|
||||
url: 'mall/orders/' + id + '/logistic',
|
||||
method: 'PUT'
|
||||
url: 'mall/orders/' + id + '/logistic'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -286,6 +286,14 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},{
|
||||
"path": "pages/order/logistics",
|
||||
"name": "OrderLogistics",
|
||||
"style": {
|
||||
"navigationBarTitleText": "物流查询",
|
||||
"navigationBarBackgroundColor":"#FFFFFF",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
}],
|
||||
"tabBar": {
|
||||
"borderStyle": "white",
|
||||
|
||||
@@ -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() {
|
||||
|
||||
38
pages/order/logistics.vue
Normal file
38
pages/order/logistics.vue
Normal 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>
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
0
uni_modules/oct-logistics/changelog.md
Normal file
0
uni_modules/oct-logistics/changelog.md
Normal 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>
|
||||
80
uni_modules/oct-logistics/package.json
Normal file
80
uni_modules/oct-logistics/package.json
Normal 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1
uni_modules/oct-logistics/readme.md
Normal file
1
uni_modules/oct-logistics/readme.md
Normal file
@@ -0,0 +1 @@
|
||||
# oct-logistics
|
||||
@@ -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.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.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>
|
||||
</slot>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user