Browse Source

refactor(订单): 重构订单详情页面和路由结构

将订单详情页面从子包移动到主包并优化路由配置
移除位置权限相关配置
添加页面基础样式防止溢出
优化快速订单组件定时器逻辑
调整订单列表按钮样式和交互
master
前端-胡立永 1 month ago
parent
commit
147e1a6d17
7 changed files with 65 additions and 43 deletions
  1. +34
    -3
      components/QuickOrderEntry.vue
  2. +2
    -9
      manifest.json
  3. +11
    -7
      pages.json
  4. +4
    -0
      pages/index/index.vue
  5. +1
    -1
      pages/index/order.vue
  6. +0
    -0
      pages/order/orderDetail.vue
  7. +13
    -23
      pages_order/order/fastOrderList.vue

+ 34
- 3
components/QuickOrderEntry.vue View File

@ -44,17 +44,26 @@ export default {
orderInfo: null,
innerHasNewMessage: false,
innerMessageCount: 0,
isInitialized: false
isInitialized: false,
timer: null // ID
}
},
mounted() {
this.getQuickOrderInfo()
// 30
this.startTimer()
},
beforeDestroy() {
//
this.clearTimer()
},
methods: {
//
handleClick() {
async handleClick() {
// 便
this.$emit('click');
await this.getQuickOrderInfo()
//
if (Array.isArray(this.orderInfo) && this.orderInfo.length > 0) {
@ -102,7 +111,7 @@ export default {
}
//
this.$api('getOrderInfo', {}, res => {
return this.$api('getOrderInfo', {}, res => {
if (res.code === 200 && res.result) {
//
const orderList = Array.isArray(res.result) ? res.result : [res.result];
@ -169,6 +178,28 @@ export default {
getMessageCount() {
return this.innerMessageCount;
},
//
startTimer() {
//
this.clearTimer()
// 30
this.timer = setInterval(() => {
// token
if (uni.getStorageSync('token')) {
this.getQuickOrderInfo()
}
}, 15000)
},
//
clearTimer() {
if (this.timer) {
clearInterval(this.timer)
this.timer = null
}
},
},
}
</script>


+ 2
- 9
manifest.json View File

@ -57,15 +57,8 @@
"urlCheck" : false
},
"usingComponents" : true,
"permission" : {
"scope.userLocation" : {
"desc" : "你的位置信息将用于小程序位置接口的效果展示"
},
"scope.userFuzzyLocation" : {
"desc" : "你的位置信息将用于小程序位置接口的效果展示"
}
},
"requiredPrivateInfos" : [ "chooseLocation", "getLocation" ]
"permission" : {},
"requiredPrivateInfos" : []
},
"mp-alipay" : {
"usingComponents" : true


+ 11
- 7
pages.json View File

@ -29,6 +29,12 @@
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/order/orderDetail",
"style": {
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/index/cart",
"style": {
@ -44,12 +50,7 @@
},
"subPackages": [{
"root": "pages_order",
"pages": [{
"path": "order/orderDetail",
"style": {
"navigationBarTextStyle": "white"
}
},
"pages": [
{
"path": "mine/purse",
"style": {
@ -73,7 +74,10 @@
"path": "product/productDetail"
},
{
"path": "product/productList"
"path": "product/productList",
"style": {
"enablePullDownRefresh": true
}
},
{
"path": "auth/wxLogin"


+ 4
- 0
pages/index/index.vue View File

@ -169,6 +169,10 @@ export default {
</script>
<style scoped lang="scss">
.page{
width: 100vw;
overflow: hidden;
}
.red-top {
position: relative;
height: 420rpx;


+ 1
- 1
pages/index/order.vue View File

@ -154,7 +154,7 @@ export default {
//
toOrderDetail(id) {
uni.navigateTo({
url: '/pages_order/order/orderDetail?id=' + id
url: '/pages/order/orderDetail?id=' + id
})
},
}


pages_order/order/orderDetail.vue → pages/order/orderDetail.vue View File


+ 13
- 23
pages_order/order/fastOrderList.vue View File

@ -23,7 +23,6 @@
class="order-item"
v-for="(order, index) in orderList"
:key="order.id"
@click="viewOrderDetail(order)"
>
<!-- 订单头部信息 -->
<view class="order-header">
@ -95,17 +94,18 @@
<view class="order-actions">
<view
class="action-btn cancel"
v-if="order.state === '0'"
v-if="order.status === '0'"
@click.stop="cancelOrder(order)"
>
<text>取消订单</text>
</view>
<!-- <view
class="action-btn detail"
@click.stop="viewOrderDetail(order)"
<view
class="action-btn pay"
v-if="order.status === '1'"
@click.stop="goToConfirmOrder(order)"
>
<text>查看详情</text>
</view> -->
</view>
</view>
</view>
</view>
@ -345,20 +345,9 @@
});
},
//
viewOrderDetail(order) {
//
if (order.status === '1') {
//
this.$utils.navigateTo(`/pages_order/order/firmOrder?orderId=${order.id}`);
} else {
//
uni.showModal({
title: '订单详情',
content: `订单号: ${order.orderNumber || order.id}\n状态: ${this.getStatusText(order.status)}\n下单方式: ${this.getTypeName(order.type)}\n创建时间: ${this.formatTime(order.createTime)}`,
showCancel: false
});
}
//
goToConfirmOrder(order) {
this.$utils.navigateTo(`/pages_order/order/firmOrder?orderId=${order.id}`);
},
//
@ -623,10 +612,11 @@
background-color: rgba(220, 53, 69, 0.05);
}
&.detail {
&.pay {
border-color: #D03F25;
color: #D03F25;
background-color: rgba(208, 63, 37, 0.05);
color: #ffffff;
background-color: #D03F25;
font-weight: 500;
}
}
}


Loading…
Cancel
Save