Sfoglia il codice sorgente

订单列表修改

zuypeng 1 anno fa
parent
commit
b92f02a737

+ 17 - 6
src/pages-order/detail/index.vue

@@ -4,9 +4,10 @@
       <view class="g-item"  style="padding-top: 10px;">
         <view class="right">
           <view class="price-box">
-            <text class="price">¥{{ ((state.detail.amount+state.detail.grantsAmount)/100).toFixed(2) }}</text>
+            <text class="font12">¥</text>
+            <text class="price">{{ ((state.detail.amount+state.detail.grantsAmount)/100).toFixed(2) }}</text>
           </view>
-          <block class="price">洗车消费</block>
+          <block class="price-dsc" >洗车消费</block>
         </view>
       </view>
     </view>
@@ -14,7 +15,7 @@
     <view class="yt-list" >
       <view class="yt-list-cell b-b">
         <text class="cell-tit clamp">订单编号</text>
-        <text class="cell-tip copy" @click="handleCopy">{{ state.detail.orderNo }}</text>
+        <text class="cell-tip copy" @click="handleCopy">{{ state.detail.orderNo }} <uv-icon name="info-circle"></uv-icon></text>
       </view>
       <view class="yt-list-cell b-b">
         <text class="cell-tit clamp">支付金额</text>
@@ -34,6 +35,10 @@
           {{fmtDictName('WalletDetail.status', state.detail.status)}}
         </text>
       </view>
+      <view class="yt-list-cell b-b">
+        <text class="cell-tit clamp">创建时间</text>
+        <text class="cell-tip">{{   fmtDateTime(state.detail.createTime)}}</text>
+      </view>
       <view class="yt-list-cell b-b">
         <text class="cell-tit clamp">交易时间</text>
         <text class="cell-tip">{{   fmtDateTime(state.detail.transactionTime)}}</text>
@@ -140,6 +145,7 @@ page {
       flex: 1;
       padding-left: 24rpx;
       overflow: hidden;
+      text-align: center;
     }
 
     .title {
@@ -153,14 +159,14 @@ page {
     }
 
     .price-box {
-      display: flex;
-      align-items: center;
-      font-size: 32rpx;
+      /* display: flex; */
+      /* align-items: center; */
       color: #303133;
       padding-top: 10rpx;
 
       .price {
         margin-bottom: 4rpx;
+        font-size: 48rpx;
       }
 
       .number {
@@ -170,6 +176,11 @@ page {
       }
     }
 
+    .price-dsc{
+      font-size:26rpx;
+      color:$uni-text-color-grey;
+    }
+
     .step-box {
       position: relative;
     }

+ 104 - 67
src/pages-order/list/index.vue

@@ -1,46 +1,32 @@
 <template>
   <view class="container">
-    <scroll-view scroll-y="true" class="orders-scroll1" v-for="(item,index) in state.orderList" :key="index">
-      <view class="wrapper">
-        <view class="order-list">
-          <view class="order">
-
-            <view class="header">
-              <view class="flex-fill font-size-medium"></view>
-              <view class="status">
-                <view>
-                  未支付
+    <scroll-view scroll-y="true" class="orders-scroll1">
+      <uv-list>
+        <uv-list-item
+            clickable show-arrow v-for="(item,index) in state.orderList" :key="index" @click="handleClickDetail(item)">
+          <template #default>
+            <view class="wallet-item">
+              <view class="wallet-item_header">
+                <view class="flex-inline">
+                  <text class="wallet-item_header-type">洗车消费</text>
+                  <uv-tags class="ml10" style="margin-left: 10px;" size="mini" plain
+                           :type="item.payStatus==0?'primary':(item.payStatus==1?'success':'error')"
+                           :text="fmtDictName('Order.pay', item.payStatus)"></uv-tags>
+
+<!--                  <uv-tags class="ml10" style="margin-left: 10px;" size="mini" plain
+                           :type="item.orderStatus==0?'primary':(item.orderStatus==1?'success':'error')"
+                           :text="fmtDictName('Order.status', item.orderStatus)"></uv-tags>-->
                 </view>
-
-                <uv-icon name="arrow-right" size="16"></uv-icon>
-              </view>
-            </view>
-            <view class="images">
-              <image src="/static/mock/zhuti.jpg"></image>
-              <view class="good_name">{{ item.name }}</view>
-            </view>
-            <view class="info">
-              <view class="left">
-                <view>订单编号:{{ item.number }}</view>
-                <view>下单时间:{{ item.time }}</view>
+                <text class="wallet-item_header-amt">{{ (item.amount / 100).toFixed(2) }}元</text>
               </view>
-              <view class="right">¥{{ item.money }}</view>
-            </view>
-            <view class="action" style="text-align: right;">
-              <uv-button plain type="primary" size="mini">{{ item.payment }}</uv-button>
-              <view class="ml10">
-                <uv-button type="error" size="mini" class="ml10" style="margin-left: 10px;">{{ item.delete }}</uv-button>
+              <view class="wallet-item_body">
+                <text class="wallet-item_body-order">{{ item.orderId }}</text>
+                <text class="wallet-item_body-time">{{ fmtDateTime(item.createTime) }}</text>
               </view>
-              <!--              <view class="button button_pay"
-                                  style="width: 36px;text-align:center;font-size: 10px;">{{ item.payment }}
-                            </view>
-                            <view class="button button_del" hover-class="none"
-                                  style="width: 25px;text-align:center;font-size: 10px;">{{ item.delete }}
-                            </view>-->
             </view>
-          </view>
-        </view>
-      </view>
+          </template>
+        </uv-list-item>
+      </uv-list>
     </scroll-view>
     <!--    <login-bar class="w100 text-center"></login-bar>-->
     <!--    <tab-bar :index="3"/>-->
@@ -49,44 +35,23 @@
 
 <script lang="ts" setup>
 import {reactive} from 'vue'
-import {onHide, onShow} from "@dcloudio/uni-app";
-import TabBar from "@/components/tab-bar/index.vue";
-import LoginBar from "@/components/login-bar/index.vue";
+import {onHide, onShow, onPullDownRefresh, onReachBottom,} from "@dcloudio/uni-app";
+import {get} from "@/utils/https";
+import {fmtDictName, fmtDateTime} from "@/utils/common";
 
 const initState = () => ({
-  orderList: [{
-    name: "菌满堂野生菌火锅",
-    number: "DB23473207638761",
-    time: "2021-11-23 14:02:00",
-    money: "239.20",
-    payment: "去支付",
-    delete: "删除"
+  orderList: [],
+  query: {
+    pageNum: 1,
+    pageSize: 10
   },
-    {
-
-      name: "菌满堂野生菌火锅",
-      number: "DB23473207638761",
-      time: "2021-11-23 14:02:00",
-      money: "239.20",
-      payment: "去支付",
-      delete: "删除"
-    },
-    {
-
-      name: "菌满堂野生菌火锅",
-      number: "DB23473207638761",
-      time: "2021-11-23 14:02:00",
-      money: "239.20",
-      payment: "去支付",
-      delete: "删除"
-    }
-  ]
+  hasNext: false
 })
 
 const state = reactive(initState())
 
 onShow(() => {
-  uni.setNavigationBarTitle({title: '我的订单'})
+  uni.setNavigationBarTitle({title: '洗车订单'})
   let gd = getApp<any>().globalData;
   if (!gd.token) {
     console.error(gd)
@@ -99,10 +64,37 @@ onHide(() => {
   Object.assign(state, initState());
 })
 
+onPullDownRefresh(() => {
+  setTimeout(function () {
+    state.query.pageNum = 1;
+    loadOrderList()
+  }, 100);
+})
+
+onReachBottom(() => {
+  if (state.hasNext) {
+    state.query.pageNum++
+    loadOrderList()
+  }
+})
+
 const loadOrderList = () => {
   //load order list
+  get(`/wash-order/listMyWashOrder`, state.query).then((res: any) => {
+    state.orderList = res.list;
+    state.hasNext = res.list.length == state.query.pageSize
+    uni.stopPullDownRefresh();
+  }).catch(e => {
+    uni.stopPullDownRefresh();
+  })
 }
 
+const handleClickDetail = (orderDetail: any) => {
+  uni.navigateTo({
+    url: `/pages-order/detail/index?id=${orderDetail.id}&type=3&orderNo=${orderDetail.orderId}`,
+  });
+};
+
 </script>
 
 <style lang="scss" scoped>
@@ -110,6 +102,51 @@ const loadOrderList = () => {
   background-color: #f6f6f6;
 }
 
+.wallet-item {
+  display: flex;
+  flex-direction: column;
+  padding: 14rpx;
+  border-radius: 8rpx;
+  margin: 10rpx 16 prx 10rpx 10rpx;
+
+
+  &_header {
+    display: inline-flex;
+    flex-wrap: nowrap;
+    justify-content: space-between;
+
+    &-type {
+      font-weight: 500;
+      font-size: 14px;
+      margin-right: 15rpx;
+    }
+
+
+    &-status {
+      font-size: 12px;
+      margin-left: 6px;
+      border: 1px solid $uni-color-primary;
+      border-radius: 2rpx;
+    }
+
+    &-amt {
+      font-weight: 500;
+      font-size: 17px;
+    }
+  }
+
+  &_body {
+    padding: 10rpx 0;
+    display: inline-flex;
+    justify-content: space-between;
+
+    &-order, &-time {
+      font-size: 12px;
+      color: $uni-color-subtitle
+    }
+  }
+}
+
 .font-size-lg {
   border: none;
   background-color: var(--theme_color);

+ 26 - 27
src/pages-user/wallet/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <view class="page flex-column">
+  <view class="page">
     <view class="wallet-header">
       <view class="wallet-header_title">
         <view class="wallet-header_title-left">
@@ -16,12 +16,12 @@
       <view class="wallet-header_pounds">
         <view>
           <text>充值余额:</text>
-          <text>{{ (account.rechargeBalance/100).toFixed(2) }}</text>
+          <text>{{ (account.rechargeBalance / 100).toFixed(2) }}</text>
         </view>
 
         <view>
           <text>赠款余额:</text>
-          <text>{{ (account.grantsBalance/100).toFixed(2) }}</text>
+          <text>{{ (account.grantsBalance / 100).toFixed(2) }}</text>
         </view>
       </view>
     </view>
@@ -30,7 +30,7 @@
       <uv-tabs :list="tabs" :current="tab" @click="handleTabClick"></uv-tabs>
       <uv-list>
         <uv-list-item
-            clickable :show-arrow="tab==3" v-for="(item,index) in dataList" :key="index" @click="handleClickDetail(item)">
+            clickable :show-arrow="item.type===3" v-for="(item,index) in dataList" :key="index" @click="handleClickDetail(item)">
           <template #default>
             <view class="wallet-item">
               <view class="wallet-item_header">
@@ -40,10 +40,10 @@
                            :type="item.status==0?'primary':(item.status==1?'success':'error')"
                            :text="fmtDictName('WalletDetail.status', item.status)"></uv-tags>
                 </view>
-                <text class="wallet-item_header-amt">{{ (item.amount/100).toFixed(2) }}元</text>
+                <text class="wallet-item_header-amt">{{ (item.amount / 100).toFixed(2) }}元</text>
               </view>
               <view class="wallet-item_body">
-                <text class="wallet-item_body-order">{{ item.orderNo}}</text>
+                <text class="wallet-item_body-order">{{ item.orderNo }}</text>
                 <text class="wallet-item_body-time">{{ fmtDateTime(item.transactionTime) }}</text>
               </view>
             </view>
@@ -64,12 +64,11 @@
 </template>
 
 <script setup lang="ts">
-import {onPullDownRefresh, onReachBottom, onShow,onLoad} from "@dcloudio/uni-app";
+import {onPullDownRefresh, onReachBottom, onShow, onLoad} from "@dcloudio/uni-app";
 import {ref} from "vue";
-import {rpxToPx} from "@/utils/device";
 import {body, get} from "@/utils/https";
 import {checkLogin} from "@/utils/auth";
-import {fmtDictName,fmtDateTime} from "@/utils/common";
+import {fmtDictName, fmtDateTime} from "@/utils/common";
 
 const account = ref();
 
@@ -100,13 +99,13 @@ const handleRefund = () => {
 }
 
 
-onLoad((options:any)=>{
-  if(options.tab){
+onLoad((options: any) => {
+  if (options.tab) {
     tab.value = options.tab;
   }
 })
 
-onShow((options:any) => {
+onShow((options: any) => {
   checkLogin().then(() => {
     loadData();
   })
@@ -161,6 +160,7 @@ const handleClickDetail = (walletDetail: any) => {
   display: flex;
   flex-direction: column;
 
+
   .wallet-header {
     border-radius: 20rpx;
     background-color: $uni-color-primary;
@@ -212,50 +212,53 @@ const handleClickDetail = (walletDetail: any) => {
   }
 
   .wallet-body {
+    flex: 1;
+    overflow-y: scroll;
+    overflow-x: hidden;
     margin: 20rpx 20rpx 60rpx 20rpx;
 
 
-    .wallet-item{
+    .wallet-item {
       display: flex;
       flex-direction: column;
       padding: 14rpx;
       border-radius: 8rpx;
-      margin: 10rpx 16prx 10rpx 10rpx;
+      margin: 10rpx 16 prx 10rpx 10rpx;
 
 
-      &_header{
+      &_header {
         display: inline-flex;
         flex-wrap: nowrap;
         justify-content: space-between;
 
-        &-type{
+        &-type {
           font-weight: 500;
           font-size: 14px;
           margin-right: 15rpx;
         }
 
 
-        &-status{
+        &-status {
           font-size: 12px;
           margin-left: 6px;
           border: 1px solid $uni-color-primary;
           border-radius: 2rpx;
         }
 
-        &-amt{
+        &-amt {
           font-weight: 500;
           font-size: 17px;
         }
       }
 
-      &_body{
+      &_body {
         padding: 10rpx 0;
         display: inline-flex;
         justify-content: space-between;
 
-        &-order,&-time{
-          font-size:12px ;
-          color:$uni-color-subtitle
+        &-order, &-time {
+          font-size: 12px;
+          color: $uni-color-subtitle
         }
       }
     }
@@ -263,14 +266,10 @@ const handleClickDetail = (walletDetail: any) => {
 
   .wallet-bottom {
     width: 100%;
-    position: absolute;
-    bottom: 20rpx;
-    left: 0;
+    height: 36px;
   }
 
 
-
-
 }
 
 </style>

+ 12 - 1
src/pages-wash/device/index.vue

@@ -2,7 +2,7 @@
   <view :class="['page']">
     <view class="device-header">
       <view class="device-header_name">
-        <text>洗车机编号:{{ state.device.shortId }}</text>
+        <text>洗车机编号:No.{{ state.device.shortId }}</text>
       </view>
       <view class="device-header_fun">
         <view class="device-header_func-tag" v-for="f in state.device.functionList" :key="f" style="margin-right: 10px;">
@@ -80,6 +80,17 @@ onLoad((options:any) => {
 
 const loadDeviceDetail = (id: number) => {
   get(`/wash-device/queryDevice/${id}`).then((res: any) => {
+    if(res.currentUserId && res.currentUserId!=getApp<any>().globalData.user.id){
+      uni.showToast({
+        title:'设备已被占用',
+        icon:'error'
+      })
+      setTimeout(()=>{
+        uni.redirectTo({
+          url:'/pages/index/index'
+        })
+      },2000)
+    }
     res.functionList = res.funcs.split("|")||[]
     state.device = res;
   }).catch(e => {

+ 15 - 6
src/pages-wash/station/index.vue

@@ -16,7 +16,7 @@
         </view>
         <view class="device-item_func">
           <view class="device-item_func-tag" v-for="f in device.functionList" :key="f">
-          <uv-tags :text="f"  size="mini"   plain plainFill bgColor="#19A497" color="white"> </uv-tags>
+            <uv-tags :text="f" size="mini" plain plainFill bgColor="#19A497" color="white"></uv-tags>
           </view>
         </view>
       </view>
@@ -24,7 +24,7 @@
     </view>
 
     <view class="scan-btn">
-      <uv-button type="primary" icon="scan"  iconColor="white"  color="#19A497" text="扫码洗车" @click="handleClickScan"></uv-button>
+      <uv-button type="primary" icon="scan" iconColor="white" color="#19A497" text="扫码洗车" @click="handleClickScan"></uv-button>
     </view>
   </view>
 </template>
@@ -40,7 +40,8 @@ const initState = () => ({
   deviceList: [] as any[],
   station: {
     id: 0
-  }
+  },
+  currentUserId: 0
 })
 
 const state = reactive(initState())
@@ -67,12 +68,13 @@ onShow((options) => {
     state.station.id = station.id;
     loadStationDeviceList();
   }
+  state.currentUserId = getApp<any>().globalData.user?.id;
 })
 
 
 const handleClickScan = () => {
   uni.navigateTo({
-    url:'/pages-wash/scan/index'
+    url: '/pages-wash/scan/index'
   })
 }
 
@@ -81,7 +83,7 @@ const loadStationDeviceList = () => {
     return;
   }
   get(`/wash-device/listWashDevice`, {stationId: state.station.stationId}).then((deviceList: any) => {
-    deviceList.forEach((item: any)=>{
+    deviceList.forEach((item: any) => {
       item.functionList = item.functions.split("|")
     })
     state.deviceList = deviceList;
@@ -95,6 +97,13 @@ const handleNavStation = () => {
 }
 
 const handleClickDevice = (device: any) => {
+  if (device.currentUserId && device.currentUserId != state.currentUserId) {
+    uni.showToast({
+      title: '设备已被他人占用',
+      icon: 'none'
+    })
+    return;
+  }
   getApp<any>().globalData.last.device = device;
   uni.navigateTo({
     url: '/pages-wash/device/index?shortId=' + device.shortId
@@ -162,7 +171,7 @@ const handleClickDevice = (device: any) => {
       color: #aaa;
     }
 
-    &-tag{
+    &-tag {
       margin-right: 10px;
     }
   }

+ 3 - 1
src/pages.json

@@ -148,7 +148,9 @@
           "style": {
             "navigationStyle": "default",
             "navigationBarTitleText": "订单列表",
-            "navigationBarBackgroundColor": "#ffffff"
+            "navigationBarBackgroundColor": "#ffffff",
+            "enablePullDownRefresh": true,
+            "onReachBottomDistance": 100
           }
         },
         {

+ 1 - 1
src/pages/user/index.vue

@@ -97,7 +97,7 @@ const menu = ref([
     },*/
   {
     title: "我的订单",
-    path: "/pages-user/wallet/index?tab=3",
+    path: "/pages-order/list/index",
 
     icon:  '/static/user/faq.png'
   },