zuypeng пре 1 година
родитељ
комит
f2c8bc39b2

+ 18 - 2
src/pages-order/detail/index.vue

@@ -26,11 +26,13 @@
       </view>
       <view class="yt-list-cell desc-cell">
         <text class="cell-tit clamp">备注</text>
-        {{ state.detail.remarks }}
+        {{ state.detail.remark }}
       </view>
       <view class="yt-list-cell b-b">
         <text class="cell-tit clamp">交易状态</text>
-        <text class="cell-tip">{{   fmtDictName('WalletDetail.status',state.detail.status)}}</text>
+        <text class="cell-tip" :class="state.detail.status==0?'primary':(state.detail.status==1?'success':'error')">
+          {{fmtDictName('WalletDetail.status', state.detail.status)}}
+        </text>
       </view>
       <view class="yt-list-cell b-b">
         <text class="cell-tit clamp">交易时间</text>
@@ -471,4 +473,18 @@ page {
     }
   }
 }
+
+.primary{
+  color: $uni-color-primary !important;
+}
+
+
+.success{
+  color: $uni-color-success !important;
+}
+
+
+.error{
+  color: $uni-color-error !important;
+}
 </style>

+ 1 - 1
src/pages-order/process/index.vue

@@ -44,7 +44,7 @@
       <image
           class="width-96"
           mode="widthFix"
-          src="/static/images/contact-customer.png"
+          src="/static/contact-customer.png"
       />
       <view class="mt-16 color-666 fs-28">电话客服</view>
     </view>

+ 18 - 97
src/pages-user/faq/index.vue

@@ -1,52 +1,10 @@
 <template>
   <view class="page">
-    <view v-if="state.questions.length <= 0" class="flex-center mt-40 animation-loading">
-      <uv-icon name="photo"></uv-icon>
-    </view>
-    <view class="sheet">
-      <view class="sheet_bar" v-for="(item, index) in state.questions" :key="index">
-        <view class="head" @click="toggle(index)">
-          <view class="pt-32 pb-32 flex-align-center">
-            <view class="fs-28 fw-500 color-000">{{ item.question }}</view>
-            <view
-                class="width-40 ml-auto flex-end flex-shrink transition"
-                :style="{
-                transform: item.open ? 'rotate(180deg)' : 'rotate(0deg)',
-              }"
-            >
-              <uv-icon name="arrow-down"></uv-icon>
-
-            </view>
-          </view>
-        </view>
-        <view :class="['body', item.open ? 'body-open' : 'body-hidden']">
-          <view
-              v-for="(answerItem, answerIndex) in item.answer"
-              :key="answerIndex"
-              :class="[
-              'fs-28',
-              'lh-48',
-              'color-666',
-              answerIndex === 0 ? 'mt-0' : 'mt-10',
-            ]"
-          >{{ answerItem }}
-          </view
-          >
-        </view>
-      </view>
-    </view>
-    <view
-        class="flex-center flex-column contact mt-20"
-        hover-class="hover-scale"
-        @click="call"
-        v-if="state.questions.length"    >
-      <image
-          class="width-96"
-          mode="widthFix"
-          src="/static/contact-customer.png"
-      />
-      <view class="mt-16 color-666 fs-28">电话客服</view>
-    </view>
+    <uv-collapse @change="handleChange" @close="close" @open="open">
+      <uv-collapse-item :title="(index+1)+'.'+item.question" :name="item.question"  v-for="(item, index) in state.questions" :key="index">
+        <uv-parse :content="item.answer" :selectable="true"></uv-parse>
+      </uv-collapse-item>
+    </uv-collapse>
   </view>
 </template>
 
@@ -63,6 +21,18 @@ const initState = () => ({
 
 const state = reactive(initState())
 
+const handleChange = () => {
+
+}
+
+const close = () => {
+
+}
+
+const open = () => {
+
+}
+
 const call = () => {
   uni.makePhoneCall({
     phoneNumber: state.servicerPhone,
@@ -95,58 +65,9 @@ onHide(() => {
 <style lang="scss">
 .page {
   min-height: 100vh;
-  background: #f6f7fa;
+  background: #fff;
   box-sizing: border-box;
   padding: 40rpx 32rpx;
 }
 
-.contact {
-  height: 216rpx;
-  border-radius: 24rpx;
-  background: #fff;
-}
-
-.sheet {
-  box-sizing: border-box;
-  border-radius: 24rpx;
-  background: #fff;
-  overflow: hidden;
-
-  &_bar {
-    .head {
-      padding: 0rpx 24rpx;
-      box-sizing: border-box;
-
-      & > view {
-        border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
-      }
-    }
-
-    .body {
-      box-sizing: border-box;
-      background-color: rgba(52, 125, 255, 0.06);
-      transition: all 0.3s;
-      padding: 0rpx 24rpx;
-    }
-
-    .body-hidden {
-      height: 0px;
-      overflow: hidden;
-    }
-
-    .body-open {
-      height: auto;
-      padding-top: 24rpx;
-      padding-bottom: 24rpx;
-    }
-
-    &:last-child {
-      .head {
-        & > view {
-          border-bottom: none;
-        }
-      }
-    }
-  }
-}
 </style>

+ 14 - 9
src/pages-user/feedback/add.vue

@@ -14,7 +14,7 @@
           </uv-input>
         </uv-form-item>
         <uv-form-item label="问题类别" prop="type" @click="handleShowAction">
-          <uv-input v-model="state.ruleForm.type" disabled disabledColor="#ffffff" placeholder="请选择" border="none">
+          <uv-input v-model="state.ruleForm.typeName" disabled disabledColor="#ffffff" placeholder="请选择" border="none">
           </uv-input>
           <template v-slot:right>
             <uv-icon name="arrow-right"></uv-icon>
@@ -45,13 +45,15 @@
       </uv-form>
 
       <view class="w100 flex-inline flex-justify-center">
-        <uv-button type="info" @click="close" hairline> 取 消</uv-button>
-        <uv-button type="primary" @click="handleSubmit" hairline class="ml10" customStyle="{'width':'120px','margin-left':'10px'}" v-if="state.mode==='add'">
+        <uv-button type="info" size="mini" @click="close" hairline> 取 消</uv-button>
+        <uv-button type="primary" size="mini" @click="handleSubmit" hairline class="ml10" customStyle="{'width':'120px','margin-left':'10px'}" v-if="state.mode==='add'">
           提 交</uv-button>
       </view>
     </uv-popup>
 
-    <uv-action-sheet ref="type_select_ref" :actions="state.feedbackTypeList" title="请选择问题类型" description="选择本次上报问题的类型"
+    <uv-action-sheet ref="type_select_ref"
+
+                     :actions="state.feedbackTypeList" title="请选择问题类型" description="选择本次上报问题的类型"
                      @select="handleTypeSelect">
     </uv-action-sheet>
   </view>
@@ -71,6 +73,7 @@ const initState = () => ({
     content: '',
     replay: '',
     type: '',
+    typeName: '',
     attachList: [] as any[]
   },
   rules: {
@@ -114,11 +117,12 @@ const handleSubmit = () => {
 
 
 const handleUpload = (event: any) => {
-  let file = event.file;
-  upload(`/file/upload`).then((res: any) => {
+  console.log(event)
+  let file = event.file[0];
+  upload(`/file/upload`,file).then((res: any) => {
     state.ruleForm.attachList.push({
       name: file.name,
-      url: formatUrl(res.url)
+      url: res.url
     })
   })
 }
@@ -129,8 +133,8 @@ const handleDelete = (event: any) => {
 }
 
 const loadDict = () => {
-  body(`/dict/list`, {type: 'Feedback.type'}).then((res: any) => {
-    state.feedbackTypeList = res.list;
+  body(`/dict/list`, {code: 'Feedback.type'}).then((res: any) => {
+    state.feedbackTypeList = res;
   })
 }
 
@@ -142,6 +146,7 @@ const handleShowAction = () => {
 const handleTypeSelect = (e: any) => {
   console.log(e)
   state.ruleForm.type = e.value;
+  state.ruleForm.typeName = e.name;
 }
 
 

+ 13 - 16
src/pages-user/feedback/index.vue

@@ -1,8 +1,5 @@
 <template>
   <view class="page">
-    <view v-if="state.feedbackList.length <= 0" class="flex-center mt40 animation-loading">
-      <uv-icon name="photo"></uv-icon>
-    </view>
     <view class="sheet">
       <uv-list border>
         <uv-list-item
@@ -25,12 +22,12 @@
         class="flex-center flex-column contact mt-20"
         hover-class="hover-scale"
         @click="call"
-        v-if="state.feedbackList.length">
+   >
 
       <image
           class="width-96"
           mode="widthFix"
-          src="/static/images/contact-customer.png"/>
+          src="/static/contact-customer.png"/>
 
       <view class="mt-16 color-666 fs-28">电话客服</view>
     </view>
@@ -49,23 +46,23 @@ import {onHide, onShow} from "@dcloudio/uni-app";
 import {reactive, ref} from "vue";
 import {body} from "@/utils/https"
 
-import add from '@/pages-user/feedback/add'
+import add from '@/pages-user/feedback/add.vue';
 
 const add_ref = ref()
 const detail_ref = ref()
 
 const initState = () => ({
   feedbackList: [
-    {
-      title: '洗车扣费异常问题',
-      status: 1,
-      createTime: '2022-09-01 10:00:00',
-    },
-    {
-      title: '洗车扣费异常问题',
-      status: 1,
-      createTime: '2022-09-01 10:00:00',
-    }
+    // {
+    //   title: '洗车扣费异常问题',
+    //   status: 1,
+    //   createTime: '2022-09-01 10:00:00',
+    // },
+    // {
+    //   title: '洗车扣费异常问题',
+    //   status: 1,
+    //   createTime: '2022-09-01 10:00:00',
+    // }
   ] as any[],
   servicerPhone: "",
 })

+ 20 - 22
src/pages-user/wallet/index.vue

@@ -27,16 +27,18 @@
     </view>
 
     <view class="wallet-body">
-      <uv-tabs :list="tabs" @click="handleTabClick"></uv-tabs>
+      <uv-tabs :list="tabs" :current="tab" @click="handleTabClick"></uv-tabs>
       <uv-list>
         <uv-list-item
             clickable show-arrow v-for="(item,index) in dataList" :key="index" @click="handleClickDetail(item)">
           <template #default>
             <view class="wallet-item">
               <view class="wallet-item_header">
-                <view class="flex">
+                <view class="flex-inline">
                   <text class="wallet-item_header-type">{{ fmtDictName('WalletDetail.type', item.type) }}</text>
-                  <text class="wallet-item_header-status">{{ fmtDictName('WalletDetail.status', item.status) }}</text>
+                  <uv-tags class="ml10" style="margin-left: 10px;" size="mini" plain
+                           :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>
               </view>
@@ -63,7 +65,7 @@
 </template>
 
 <script setup lang="ts">
-import {onPullDownRefresh, onReachBottom, onShow} 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";
@@ -83,14 +85,14 @@ const tabs = ref([
     name: "充值",
     value: 1,
   },
-  {
-    name: "消费",
-    value: 3,
-  },
   {
     name: "退款",
     value: 2,
   },
+  {
+    name: "消费",
+    value: 3,
+  },
 ]);
 
 
@@ -98,20 +100,14 @@ const handleRefund = () => {
   to(`/pages-user/wallet/refund`)
 }
 
-/*const infiniteScroller = useInfiniteScroll(10, (page) => {
-  return fetchWallet(tab.value, page, 10).then((res: any) => {
-    if (res && res.length) {
-      res.forEach((item: any) => {
-        item.amount = (Number(item.amount) / 100).toFixed(2);
-      });
-    }
-    return res;
-  });
-});*/
-const scrollViewHeight = ref(0);
 
-onShow(() => {
-  // infiniteScroller.refresh();
+onLoad((options:any)=>{
+  if(options.tab){
+    tab.value = options.tab;
+  }
+})
+
+onShow((options:any) => {
   checkLogin().then(() => {
     loadData();
   })
@@ -236,8 +232,10 @@ const handleClickDetail = (walletDetail: any) => {
 
 
         &-status{
-          font-size: 13px;
+          font-size: 12px;
           margin-left: 6px;
+          border: 1px solid $uni-color-primary;
+          border-radius: 2rpx;
         }
 
         &-amt{

+ 8 - 4
src/pages-wash/device/index.vue

@@ -29,7 +29,11 @@ import {debounce} from "@/utils/common";
 import {get, post} from "@/utils/https";
 
 const initState = () => ({
-  device: {},
+  device: {
+    functions:[],
+    deviceName:'',
+    state:''
+  },
   time: "00:00:00",
   start: new Date()
 })
@@ -44,16 +48,16 @@ onLoad((options:any) => {
   console.log("device onLoad>>>>", options)
   let id = options?.shortId;
   if (!id) {
-    let query = decodeURIComponent(options);
+    let query = decodeURIComponent(options.q);
     let scanTime = options.scancode_time;
+    console.log(query,scanTime)
     if(query){
-      id   = query?.shortId||query?.id||query
+      id   = query.split("#")[1]
     }else{
     return;
     }
   }
   state.device = getApp<any>().globalData.last.device;
-  console.log(state.device)
   loadDeviceDetail(id);
 });
 

+ 2 - 1
src/pages-wash/scan/index.vue

@@ -133,7 +133,8 @@ const handleScancode = (e: any) => {
     uni.vibrateShort({});
     if (e.detail && e.detail.result) {
       console.log(e)
-      let {shortId} = e.detail.result;
+//https://dev-wash.kuaiyuman.cn/#000001
+      let shortId = e.detail.result.split("#")[1];
       uni.navigateTo({
         url:'/pages-wash/device/index?shortId='+shortId
       })

+ 64 - 46
src/pages/index/index.vue

@@ -9,6 +9,7 @@
           class="swiper-item-1"
           style="width: 100%"
           :list="state.swiperList"
+          @click="handleBannerClick"
           previousMargin="30"
           nextMargin="30"
           circular
@@ -17,11 +18,11 @@
           bgColor="#ffffff">
       </uv-swiper>
     </view>
-<!--
-    <view class="w100">
-      <uv-notice-bar mode="closable" speed="50" url="/pages/coupon/index" :text="state.notice"></uv-notice-bar>
-    </view>
--->
+    <!--
+        <view class="w100">
+          <uv-notice-bar mode="closable" speed="50" url="/pages/coupon/index" :text="state.notice"></uv-notice-bar>
+        </view>
+    -->
 
     <view class="w100 gap"></view>
 
@@ -38,7 +39,7 @@
     <view class="w100 gap"></view>
 
     <!--    站点清单  start-->
-    <view class="w100 content_station" >
+    <view class="w100 content_station">
       <WashStation v-for="item in state.stationList" :key="item.id" :item="item"></WashStation>
       <WashStation v-for="item in state.stationList" :key="item.id" :item="item"></WashStation>
       <WashStation v-for="item in state.stationList" :key="item.id" :item="item"></WashStation>
@@ -57,13 +58,13 @@
     </view>
     <!--    站点清单  end-->
 
-<!--    <cover-view class="login_bar">
-      <login-bar class="w100 text-center"></login-bar>
-    </cover-view>-->
-<!--    <cover-view class="login_bar" v-show="!isLogin">-->
-      <login-bar class="w100 text-center"></login-bar>
-<!--    </cover-view>-->
-    <tab-bar :index="0" ></tab-bar>
+    <!--    <cover-view class="login_bar">
+          <login-bar class="w100 text-center"></login-bar>
+        </cover-view>-->
+    <!--    <cover-view class="login_bar" v-show="!isLogin">-->
+    <login-bar class="w100 text-center"></login-bar>
+    <!--    </cover-view>-->
+    <tab-bar :index="0"></tab-bar>
   </view>
 </template>
 
@@ -85,6 +86,7 @@ const change = () => {
 }
 
 const initState = () => ({
+  bannerList: [],
   swiperList: [
     'https://cdn.uviewui.com/uview/swiper/swiper3.png',
     'https://cdn.uviewui.com/uview/swiper/swiper2.png',
@@ -122,29 +124,30 @@ onLoad((e: any) => {
   let query = decodeURIComponent(e);
   let scanTime = e.scancode_time;
   console.log(e)
-/*  if (query) {
-    uni.showToast({
-      title: query,
-      duration: 5000
-    })
-  }*/
+  /*  if (query) {
+      uni.showToast({
+        title: query,
+        duration: 5000
+      })
+    }*/
 
 })
 
 onShow(() => {
   const userData = getApp<any>().globalData.user;
-  if (userData&&userData.id) {
+  if (userData && userData.id) {
     isLogin.value = true;
   }
-  console.log("show index>>>>",isLogin.value,state.stationList,state.location)
-  let locationData = getApp<any>().globalData.location;
-  if(!locationData||!locationData.longitude){
 
-  loadCurrentLocation();
-  }else{
+  console.log("show index>>>>", isLogin.value, state.stationList, state.location)
+  let locationData = getApp<any>().globalData.location;
+  if (!locationData || !locationData.longitude) {
+    loadCurrentLocation();
+  } else {
     state.location = locationData;
     loadWashStationList();
   }
+  loadBannerList();
   uni.$on('loginEvent', function (data) {
     isLogin.value = data.isLogin;
   })
@@ -155,18 +158,32 @@ onHide(() => {
   Object.assign(state, initState());
 })
 
-const handleMenuClick =  (menu:any) => {
-   checkLogin().then((res)=>{
-     if(menu.title==='洗车'){
-       uni.navigateTo({
-         url:'/pages-wash/scan/index'
-       })
-     }else  if(menu.title==='充值'){
-       uni.navigateTo({
-         url:'/pages-user/wallet/recharge'
-       })
-     }
-   })
+const loadBannerList = () => {
+  get(`/banner`).then((res: any) => {
+    state.bannerList = res;
+    state.swiperList = res.map(k => k.bannerUrl);
+  })
+}
+
+const handleBannerClick = (index: number) => {
+  let ele = state.bannerList[index];
+  if (ele && ele.linkUrl) {
+    uni.navigateTo({url: ele.linkUrl})
+  }
+}
+
+const handleMenuClick = (menu: any) => {
+  checkLogin().then((res) => {
+    if (menu.title === '洗车') {
+      uni.navigateTo({
+        url: '/pages-wash/scan/index'
+      })
+    } else if (menu.title === '充值') {
+      uni.navigateTo({
+        url: '/pages-user/wallet/recharge'
+      })
+    }
+  })
 }
 
 /**
@@ -179,12 +196,12 @@ const loadCurrentLocation = () => {
       uni.getLocation({
         type: 'gcj02', //返回可以用于uni.openLocation的经纬度
         success: res => {
-         let location = {
+          let location = {
             latitude: res.latitude,
             longitude: res.longitude
           }
-          getApp<any>().globalData.location  = location;
-         state.location = location
+          getApp<any>().globalData.location = location;
+          state.location = location
           loadWashStationList();
           console.log("loadCurrentLocation location", res)
         }
@@ -205,14 +222,14 @@ const loadWashStationList = () => {
     list.forEach((station: any) => {
       if (station.location) {
         let stationLocation = JSON.parse(station.location);
-        station.distance = calcMapDistance(state.location.latitude,state.location.longitude,stationLocation.stationLat,stationLocation.stationLng);
+        station.distance = calcMapDistance(state.location.latitude, state.location.longitude, stationLocation.stationLat, stationLocation.stationLng);
       }
     })
     state.stationList = list;
   })
 }
 
-const handleNavMap = (station:any) => {
+const handleNavMap = (station: any) => {
   let location = JSON.parse(station.location)
   uni.openLocation({
     latitude: location.stationLat,
@@ -226,7 +243,7 @@ const handleNavMap = (station:any) => {
 const handleNavStation = (station: any) => {
   getApp<any>().globalData.pageData = {station}
   uni.navigateTo({
-    url: '/pages-wash/station/index?id='+station.id
+    url: '/pages-wash/station/index?id=' + station.id
   })
   console.log(station)
 }
@@ -275,9 +292,10 @@ const handleNavStation = (station: any) => {
   margin-bottom: 10rpx;
 }
 
-.swiper-content{
+.swiper-content {
   height: 200rpx;
 }
+
 .guide-content {
   text-align: center;
 }
@@ -287,8 +305,8 @@ const handleNavStation = (station: any) => {
   bottom: 20rpx;
 }
 
-.content_station{
-  height: calc(100vh - 600rpx );
+.content_station {
+  height: calc(100vh - 600rpx);
   overflow: scroll;
 }
 </style>

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

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

+ 0 - 3
src/utils/auth.ts

@@ -116,7 +116,6 @@ export function checkLogin() {
 
 function loadUserInfo() {
     get(`/user/me`).then((res: any) => {
-        console.log("userIfnop", res)
         getApp<any>().globalData.user = res;
         uni.$emit('loginEvent', {isLogin: true})
     })
@@ -137,7 +136,6 @@ export function refresh(): Promise<string> {
                 getApp<any>().globalData.token = "";
                 uni.removeStorageSync("token");
                 get(`/user/refresh`).then((res: any) => {
-                    console.log("refresh返回", res);
                     const {statusCode, data} = res;
                     if (
                         statusCode === 200 &&
@@ -172,7 +170,6 @@ export function onLogin(cb: (token: string) => void) {
 
 export function fetchToken() {
     let token = uni.getStorageSync("token")
-    console.log("fetchToken1", token)
     return token;
 }
 

+ 3 - 5
src/utils/common.ts

@@ -66,14 +66,15 @@ export function groupByKey(elements: Array<any>, key: string) {
 
 export function fmtDictName(code: string, value: string) {
     let dictStorage: any = uni.getStorageSync('dict');
-    console.log(dictStorage)
+
     if (!dictStorage) {
         return value;
     }
 
     let elements = dictStorage[code];
+    console.log(elements)
     if (elements) {
-        let ele = elements.find((k: any) => k.value === value);
+        let ele = elements.find((k: any) => k.value == value);
         if (ele) {
             return ele.name;
         }
@@ -86,9 +87,6 @@ export function fmtDateTime(date: any) {
     if (!date) {
         return "";
     }
-    if (!date instanceof Number && !date instanceof Date) {
-        return date;
-    }
     date = new Date(date);
     const year = date.getFullYear();
     const month = date.getMonth() + 1;

+ 4 - 5
src/utils/https.ts

@@ -42,7 +42,7 @@ const serverUrl = cfg.api.serverUrl;
 const fileUrl = cfg.api.fileUrl;
 
 const isEmptyOrNull = function (exp: any) {
-    return !exp || typeof (exp) == "undefined" || exp.length === 0 || exp === '' || JSON.stringify(exp) === "{}";
+    return !exp || typeof (exp) == "undefined" || exp.length === 0 || exp === '' || Object.keys(exp).length===0;
 };
 
 
@@ -53,7 +53,6 @@ const isEmptyOrNull = function (exp: any) {
  */
 const get = (url: string, param = {}) => {
     let token = fetchToken() || ""
-    console.log("request,token",token)
     if (!isEmptyOrNull(param)) {
         let params = [];
         for (let key in param) {
@@ -163,10 +162,10 @@ const upload = (url: string, param: any = {}) => {
     return new Promise((resolve, reject) => {
         uni.uploadFile({
             url: fillUrl(url),
-            filePath: param.filePath,
-            name: param.name,
+            filePath: param.filePath||param.url,
+            name: 'file',
             header: {
-                token
+                "satoken":token
             },
             success: function (res) {
                 console.log("upload file=>", res)