瀏覽代碼

✨ 订单物流:接入完成

YunaiV 1 年之前
父節點
當前提交
06b4e6b01e
共有 6 個文件被更改,包括 51 次插入195 次删除
  1. 0 10
      pages.json
  2. 5 5
      pages/order/detail.vue
  3. 0 104
      pages/order/express/list.vue
  4. 37 49
      pages/order/express/log.vue
  5. 4 4
      pages/order/list.vue
  6. 5 23
      sheep/api/trade/order.js

+ 0 - 10
pages.json

@@ -260,16 +260,6 @@
             "auth": true,
             "auth": true,
             "title": "物流轨迹"
             "title": "物流轨迹"
           }
           }
-        },
-        {
-          "path": "express/list",
-          "style": {
-            "navigationBarTitleText": "订单包裹"
-          },
-          "meta": {
-            "auth": true,
-            "title": "订单包裹"
-          }
         }
         }
       ]
       ]
     },
     },

+ 5 - 5
pages/order/detail.vue

@@ -299,10 +299,10 @@
     });
     });
   }
   }
 
 
-  // 查看物流 TODO 芋艿:待测试
-  async function onExpress(orderId) {
-    sheep.$router.go('/pages/order/express/list', {
-      orderId,
+  // 查看物流
+  async function onExpress(id) {
+    sheep.$router.go('/pages/order/express/log', {
+      id,
     });
     });
   }
   }
 
 
@@ -376,7 +376,7 @@
         merchant_trade_no: state.merchantTradeNo,
         merchant_trade_no: state.merchantTradeNo,
       });
       });
     } else {
     } else {
-      res = await sheep.$api.order.detail(id);
+      res = await OrderApi.getOrder(id);
     }
     }
     if (res.code === 0) {
     if (res.code === 0) {
       state.orderInfo = res.data;
       state.orderInfo = res.data;

+ 0 - 104
pages/order/express/list.vue

@@ -1,104 +0,0 @@
-<!-- 物流包裹-->
-<template>
-  <s-layout title="物流包裹">
-    <view class="express-wrap">
-      <su-sticky bgColor="#FFE2B6">
-        <view class="header ss-flex ss-p-l-24">{{ state.list.length }}个包裹已派送</view>
-      </su-sticky>
-      <view
-        class="express-box"
-        v-for="item in state.list"
-        :key="item.type"
-        @tap="sheep.$router.go('/pages/order/express/log', { id: item.id, orderId: state.orderId })"
-      >
-        <view class="express-box-header ss-flex ss-row-between">
-          <view class="express-box-header-type">{{ item.status_text }}</view>
-          <view class="express-box-header-num">{{
-            item.express_name + ' : ' + item.express_no
-          }}</view>
-        </view>
-        <view class="express-box-content">
-          <view class="content-address">{{ item.logs[0]?.content }}</view>
-          <view class="" v-if="item.items?.length">
-            <scroll-view class="scroll-box" scroll-x scroll-anchoring>
-              <view class="ss-flex">
-                <view v-for="i in item.items" :key="i" class="ss-m-r-20"
-                  ><image class="content-img" :src="sheep.$url.static(i.goods_image)" />
-                </view>
-              </view>
-            </scroll-view>
-          </view>
-        </view>
-        <view class="express-box-foot">共{{ item.items.length }}件商品</view>
-      </view>
-    </view>
-  </s-layout>
-</template>
-
-<script setup>
-  import sheep from '@/sheep';
-  import { onLoad } from '@dcloudio/uni-app';
-  import { computed, reactive } from 'vue';
-  const state = reactive({
-    list: [],
-    orderId: '',
-  });
-  async function getExpressList(id) {
-    const { data } = await sheep.$api.order.express(id, '');
-    state.list = data;
-  }
-  onLoad((Option) => {
-    state.orderId = Option.orderId;
-    getExpressList(state.orderId);
-  });
-</script>
-
-<style lang="scss" scoped>
-  .header {
-    height: 84rpx;
-    font-size: 30rpx;
-    font-weight: 500;
-    color: #a8700d;
-  }
-  .express-box {
-    background: #fff;
-    padding-bottom: 30rpx;
-    box-sizing: border-box;
-    margin-bottom: 20rpx;
-    .express-box-header {
-      height: 76rpx;
-      padding: 0 24rpx;
-      border-bottom: 2rpx solid rgba(#dfdfdf, 0.5);
-      .express-box-header-type {
-        font-size: 26rpx;
-        font-weight: 500;
-        color: #999;
-      }
-      .express-box-header-num {
-        font-size: 26rpx;
-        font-weight: 400;
-        color: #999999;
-      }
-    }
-    .express-box-content {
-      padding: 20rpx 24rpx;
-      .content-address {
-        font-size: 28rpx;
-        font-weight: 400;
-        color: #333333;
-        line-height: normal;
-        margin-bottom: 20rpx;
-      }
-      .content-img {
-        width: 180rpx;
-        height: 180rpx;
-      }
-    }
-    .express-box-foot {
-      padding: 0 24rpx;
-      font-size: 24rpx;
-      font-weight: 400;
-      color: #999999;
-    }
-  }
-</style>

+ 37 - 49
pages/order/express/log.vue

@@ -2,65 +2,46 @@
 <template>
 <template>
   <s-layout title="物流追踪">
   <s-layout title="物流追踪">
     <view class="log-wrap">
     <view class="log-wrap">
+      <!-- 商品信息 -->
       <view class="log-card ss-flex ss-m-20 ss-r-10" v-if="goodsImages.length > 0">
       <view class="log-card ss-flex ss-m-20 ss-r-10" v-if="goodsImages.length > 0">
         <uni-swiper-dot :info="goodsImages" :current="state.current" mode="round">
         <uni-swiper-dot :info="goodsImages" :current="state.current" mode="round">
-          <swiper class="swiper-box" @change="change">
+          <swiper class="swiper-box">
             <swiper-item v-for="(item, index) in goodsImages" :key="index">
             <swiper-item v-for="(item, index) in goodsImages" :key="index">
-              <image class="log-card-img" :src="sheep.$url.static(item.image)"></image>
+              <image class="log-card-img" :src="sheep.$url.static(item.image)" />
             </swiper-item>
             </swiper-item>
           </swiper>
           </swiper>
         </uni-swiper-dot>
         </uni-swiper-dot>
-
         <view class="log-card-msg">
         <view class="log-card-msg">
-          <view class="ss-flex ss-m-b-8">
-            <view>物流状态:</view>
-            <view class="warning-color">{{ state.info.status_text }}</view>
-          </view>
-          <view class="ss-m-b-8">快递单号:{{ state.info.express_no }}</view>
-          <view>快递公司:{{ state.info.express_name }}</view>
+          <!-- TODO 芋艿:优化点:展示状态 -->
+<!--          <view class="ss-flex ss-m-b-8">-->
+<!--            <view>物流状态:</view>-->
+<!--            <view class="warning-color">{{ state.info.status_text }}</view>-->
+<!--          </view>-->
+          <view class="ss-m-b-8">快递单号:{{ state.info.logisticsNo }}</view>
+          <view>快递公司:{{ state.info.logisticsName }}</view>
         </view>
         </view>
       </view>
       </view>
+
+      <!-- 物流轨迹 -->
       <view class="log-content ss-m-20 ss-r-10">
       <view class="log-content ss-m-20 ss-r-10">
         <view
         <view
           class="log-content-box ss-flex"
           class="log-content-box ss-flex"
-          v-for="(item, index) in state.info.logs"
+          v-for="(item, index) in state.tracks"
           :key="item.title"
           :key="item.title"
         >
         >
           <view class="log-icon ss-flex-col ss-col-center ss-m-r-20">
           <view class="log-icon ss-flex-col ss-col-center ss-m-r-20">
-            <text
-              v-if="state.info.logs[index].status === state.info.logs[index - 1]?.status"
-              class="cicon-title"
-            ></text>
-            <text
-              v-if="state.info.logs[index].status != state.info.logs[index - 1]?.status"
-              :class="[
-                index === 0 ? 'activity-color' : 'info-color',
-                item.status === 'transport'
-                  ? 'sicon-transport'
-                  : item.status === 'delivery'
-                  ? 'sicon-delivery'
-                  : item.status === 'collect'
-                  ? 'sicon-a-collectmaterials'
-                  : item.status === 'fail' || item.status === 'back' || item.status === 'refuse'
-                  ? 'sicon-circleclose'
-                  : item.status === 'signfor'
-                  ? 'sicon-circlecheck'
-                  : 'sicon-warning-outline',
-              ]"
-            ></text>
-            <view v-if="state.info.logs.length - 1 != index" class="line"></view>
+            <text class="cicon-title" />
+            <view v-if="state.tracks.length - 1 !== index" class="line" />
           </view>
           </view>
           <view class="log-content-msg">
           <view class="log-content-msg">
-            <view
-              v-if="
-                item.status_text &&
-                state.info.logs[index].status != state.info.logs[index - 1]?.status
-              "
-              class="log-msg-title ss-m-b-20"
-              >{{ item.status_text }}</view
-            >
+            <!-- TODO 芋艿:优化点:展示状态 -->
+<!--            <view class="log-msg-title ss-m-b-20">-->
+<!--              {{ item.status_text }}-->
+<!--            </view>-->
             <view class="log-msg-desc ss-m-b-16">{{ item.content }}</view>
             <view class="log-msg-desc ss-m-b-16">{{ item.content }}</view>
-            <view class="log-msg-date ss-m-b-40">{{ item.change_date }}</view>
+            <view class="log-msg-date ss-m-b-40">
+              {{ sheep.$helper.timeFormat(item.time, 'yyyy-mm-dd hh:MM:ss') }}
+            </view>
           </view>
           </view>
         </view>
         </view>
       </view>
       </view>
@@ -72,31 +53,38 @@
   import sheep from '@/sheep';
   import sheep from '@/sheep';
   import { onLoad } from '@dcloudio/uni-app';
   import { onLoad } from '@dcloudio/uni-app';
   import { computed, reactive } from 'vue';
   import { computed, reactive } from 'vue';
+  import OrderApi from '@/sheep/api/trade/order';
 
 
   const state = reactive({
   const state = reactive({
     info: [],
     info: [],
-    current: 0,
+    tracks: [],
   });
   });
+
   const goodsImages = computed(() => {
   const goodsImages = computed(() => {
     let array = [];
     let array = [];
     if (state.info.items) {
     if (state.info.items) {
       state.info.items.forEach((item) => {
       state.info.items.forEach((item) => {
         array.push({
         array.push({
-          image: item.goods_image,
+          image: item.picUrl,
         });
         });
       });
       });
     }
     }
     return array;
     return array;
   });
   });
-  function change(e) {
-    state.current = e.detail.current;
+
+  async function getExpressDetail(id) {
+    const { data } = await OrderApi.getOrderExpressTrackList(id);
+    state.tracks = data.reverse();
   }
   }
-  async function getExpressdetail(id, orderId) {
-    const { data } = await sheep.$api.order.express(id, orderId);
+
+  async function getOrderDetail(id) {
+    const { data } = await OrderApi.getOrder(id)
     state.info = data;
     state.info = data;
   }
   }
-  onLoad((Option) => {
-    getExpressdetail(Option.id, Option.orderId);
+
+  onLoad((options) => {
+    getExpressDetail(options.id);
+    getOrderDetail(options.id);
   });
   });
 </script>
 </script>
 
 

+ 4 - 4
pages/order/list.vue

@@ -228,10 +228,10 @@
 	}
 	}
 	// #endif
 	// #endif
 
 
-	// 查看物流 TODO 芋艿:待测试
-	async function onExpress(orderId) {
-		sheep.$router.go('/pages/order/express/list', {
-			orderId,
+	// 查看物流
+	async function onExpress(id) {
+		sheep.$router.go('/pages/order/express/log', {
+      id,
 		});
 		});
 	}
 	}
 
 

+ 5 - 23
sheep/api/trade/order.js

@@ -70,34 +70,16 @@ const OrderApi = {
       },
       },
     });
     });
   },
   },
-  // 取消订单
-  cancelOrder: (id) => {
+  // 获得交易订单的物流轨迹
+  getOrderExpressTrackList: (id) => {
     return request2({
     return request2({
-      url: `/app-api/trade/order/cancel`,
-      method: 'DELETE',
-      params: {
-        id,
-      },
-    });
-  },
-  // 删除订单
-  deleteOrder: (id) => {
-    return request2({
-      url: `/app-api/trade/order/delete`,
-      method: 'DELETE',
+      url: `/app-api/trade/order/get-express-track-list`,
+      method: 'GET',
       params: {
       params: {
         id,
         id,
       },
       },
     });
     });
-  },
-  // 创建单个评论
-  createOrderItemComment: (data) => {
-    return request2({
-      url: `/app-api/trade/order/item/create-comment`,
-      method: 'POST',
-      data,
-    });
-  },
+  }
 };
 };
 
 
 export default OrderApi;
 export default OrderApi;