Bladeren bron

待接单工单完成

xiaohaizhao 4 maanden geleden
bovenliggende
commit
9ecf3fc828
11 gewijzigde bestanden met toevoegingen van 313 en 145 verwijderingen
  1. 2 1
      App.vue
  2. 3 7
      pages.json
  3. 19 8
      pages/index/home.vue
  4. 4 4
      pages/index/index.vue
  5. 1 1
      pages/workOrder/detail.vue
  6. 193 0
      pages/workOrder/index.vue
  7. 0 11
      pages/workOrder/my.vue
  8. 0 11
      pages/workOrder/saloon.vue
  9. 65 70
      static/iconfont.css
  10. 0 25
      tsconfig.json
  11. 26 7
      utils/Http.js

+ 2 - 1
App.vue

@@ -14,7 +14,8 @@ export default {
 				if (res.code == 1) {
 					uni.removeStorageSync('banner')
 					uni.setStorageSync('banner', res.data);
-					uni.redirectTo({
+					let currentPages = getCurrentPages()[getCurrentPages().length - 1];
+					if (currentPages.route == 'pages/login/login') uni.redirectTo({
 						url: '/pages/index/index',
 					});
 				}

+ 3 - 7
pages.json

@@ -16,20 +16,16 @@
 			"path": "pages/index/index"
 		},
 		{
-			"path": "pages/workOrder/finish"
+			"path": "pages/workOrder/index"
 		},
 		{
-			"path": "pages/workOrder/my"
-		},
-		{
-			"path": "pages/workOrder/saloon"
+			"path": "pages/workOrder/detail"
 		}
 	],
 	"globalStyle": {
 		"navigationBarTextStyle": "white",
 		"navigationBarTitleText": "美大服务",
-		"navigationBarBackgroundColor": "#276BF0",
-		"backgroundColor": "#ffffff"
+		"navigationBarBackgroundColor": "#276BF0"
 	},
 	"uniIdRouter": {}
 }

+ 19 - 8
pages/index/home.vue

@@ -3,7 +3,7 @@
 		@click="onClickSwiper" />
 	<view class="main">
 		<view class="serve">
-			服务
+			{{ enterprisename }}
 		</view>
 		<view class="name">
 			{{ welcomeText }}
@@ -33,9 +33,11 @@ import { ref, getCurrentInstance, computed } from 'vue'
 import { onLoad } from '@dcloudio/uni-app';
 const { $Http } = getCurrentInstance().proxy;
 const banner = ref([]);
+const enterprisename = ref('');
 const welcomeText = computed(() => {
 	return getTimeGreeting() + ',' + (uni.getStorageSync('userMsg').name);
 });
+
 function getTimeGreeting() {
 	const hour = new Date().getHours();
 
@@ -73,6 +75,15 @@ onLoad(() => {
 			}) || [];
 		}
 	})
+	$Http.basic({
+		id: "2025073015312903",
+		content: {}
+	}).then(res => {
+		if (res.code == 1) {
+			enterprisename.value = res.data.enterprisename;
+		}
+	})
+
 	uploadNumber()
 	$Http.uploadNumber = uploadNumber;
 });
@@ -97,15 +108,15 @@ function onClickSwiper(e) {
 			success: (result) => { },
 			fail: () => {
 				uni.previewImage({
-					current: 0, // 当前显示图片的http链接
-					urls: [item.imageUrl] // 需要预览的图片http链接列表
+					current: e,
+					urls: banner.value.map(v => v.imageUrl)
 				})
 			},
 		})
 	} else {
 		uni.previewImage({
-			current: 0, // 当前显示图片的http链接
-			urls: [item.imageUrl] // 需要预览的图片http链接列表
+			current: e,
+			urls: banner.value.map(v => v.imageUrl)
 		})
 	}
 }
@@ -113,17 +124,17 @@ const itemList = ref([{
 	label: '待接单',
 	icon: '/static/image/djd.png',
 	text: "故障维修排除",
-	path: "/pages/workOrder/saloon",
+	path: "/pages/workOrder/index?type=待接单",
 }, {
 	label: '进行中',
 	icon: '/static/image/jxz.png',
 	text: "专业上门安装",
-	path: "/pages/workOrder/my",
+	path: "/pages/workOrder/index?type=进行中",
 }, {
 	label: '已完结',
 	icon: '/static/image/ywj.png',
 	text: "精心维护保养",
-	path: "/pages/workOrder/finish",
+	path: "/pages/workOrder/index?type=已完结",
 }]);
 </script>
 

+ 4 - 4
pages/index/index.vue

@@ -3,18 +3,18 @@
 	<up-tabbar :fixed="true" :value="showPage" @change="change1">
 		<up-tabbar-item text="首页" name="home">
 			<template #active-icon>
-				<view class="iconfont icon-zhuye-xuanzhong" style="color: #1965E7;" />
+				<view class="iconfont icon-zhuye-weixuanzhong" style="color: #1965E7;" />
 			</template>
 			<template #inactive-icon>
-				<view class="iconfont icon-zhuye-xuanzhong" />
+				<view class="iconfont icon-zhuye-weixuanzhong" />
 			</template>
 		</up-tabbar-item>
 		<up-tabbar-item text="我的" name="my">
 			<template #active-icon>
-				<view class="iconfont icon-wode-xuanzhong" style="color: #1965E7;" />
+				<view class="iconfont icon-wode-weixuanzhong" style="color: #1965E7;" />
 			</template>
 			<template #inactive-icon>
-				<view class="iconfont icon-wode-xuanzhong" />
+				<view class="iconfont icon-wode-weixuanzhong" />
 			</template>
 		</up-tabbar-item>
 	</up-tabbar>

+ 1 - 1
pages/workOrder/finish.vue → pages/workOrder/detail.vue

@@ -1,6 +1,6 @@
 <template>
     <view>
-        已完成
+        详情
     </view>
 </template>
 

+ 193 - 0
pages/workOrder/index.vue

@@ -0,0 +1,193 @@
+<template>
+    <My_listbox ref="listBox" :empty="!list.length" @getlist="getList">
+        <view style="height: 18rpx;" />
+        <navigator class="item" v-for="item in list" :key="item.sa_workorderid" url="/pages/workOrder/detail"
+            hover-class="navigator-hover">
+            <view class="head">
+                <view class="tag"
+                    :style="{ 'background': { '安装': '#70B603', '维修': '#D9001B', '清洁': '#3874F6' }[item.type] || '#999999' }">
+                    {{ item.type }}
+                </view>
+                <view class="time">
+                    {{ item.createdate }}
+                </view>
+            </view>
+            <view class="address">
+                {{ item.address }}
+            </view>
+            <view class="user">
+                {{ item.customername + ' ' + item.customerphonenumber }}
+            </view>
+            <view class="but-box" @click.stop>
+                <view class="but-box-item">
+                    <My-button :customStyle="{
+                        'background-color': '#FFFFFF',
+                        'color': '#3874F6',
+                        height: '70rpx',
+                    }" frontIcon="icon-bodadianhua1" text="电话" :phonenumber="item.customerphonenumber" />
+                </view>
+                <view class="but-box-item" @click="openModel(item)">
+                    <My-button :customStyle="{
+                        height: '70rpx',
+                    }" frontIcon="icon-dianhua" text="接单" />
+                </view>
+            </view>
+        </navigator>
+    </My_listbox>
+
+    <up-modal :show="takeOrderShow" title="是否确认接单?" showCancelButton @confirm="takeOrders"
+        @cancel="takeOrderShow = false" ref="uModal" :asyncClose="true"></up-modal>
+</template>
+
+<script setup>
+import { ref, reactive, getCurrentInstance } from 'vue';
+const { $Http } = getCurrentInstance().proxy;
+import { onLoad } from '@dcloudio/uni-app';
+const listBox = ref(null);
+const content = reactive({
+    isadmin: 1,
+    "pageNumber": 1,
+    "pageSize": 20,
+    "where": {
+        "status": '',
+        "condition": ""
+    }
+});
+const list = ref([])
+
+onLoad((options) => {
+    content.where.status = options.type;
+    switch (options.type) {
+        case '待接单':
+            uni.setNavigationBarTitle({
+                title: '待接工单'
+            });
+            break;
+        case '进行中':
+            uni.setNavigationBarTitle({
+                title: '进行中工单'
+            });
+            break;
+        case '已完结':
+            uni.setNavigationBarTitle({
+                title: '已完结工单'
+            });
+            break;
+    }
+    getList();
+});
+
+function getList(init = false) {
+    if (init) content.pageNumber = 1;
+    $Http.basic({
+        "id": "20230208140203",
+        content
+    }).then(res => {
+        console.log("获取列表", res)
+        listBox.value.refreshToComplete();
+        listBox.value.setHeight();
+        if (res.code == 1) {
+            list.value = reactive(res.firstPage ? res.data : list.value.concat(res.data));
+            content.pageTotal = res.pageTotal;
+            content.pageNumber = res.pageNumber;
+        } else {
+            if (res.msg) uni.showToast({
+                title: res.msg,
+                icon: 'none'
+            });
+        }
+    })
+}
+
+let takeOrderShow = ref(false);
+let takeItem = null;
+function openModel(item) {
+    takeItem = item;
+    takeOrderShow.value = true;
+}
+function takeOrders() {
+    $Http.basic({
+        id: 20230210101103,
+        "content": {
+            "sa_workorderid": takeItem.sa_workorderid
+        }
+    }).then(res => {
+        console.log("接单结果", res)
+        if (res.code == 1) {
+            takeOrderShow.value = false;
+            wx.navigateTo({
+                url: '/pages/workOrder/detail?id=' + takeItem.sa_workorderid,
+                success: (result) => {
+                    uni.showToast({
+                        title: '接单成功',
+                        icon: 'none'
+                    });
+                },
+            })
+            $Http.updateList(content, getList)
+        } else {
+            if (res.msg) uni.showToast({
+                title: res.msg,
+                icon: 'none'
+            });
+        }
+    })
+}
+</script>
+
+<style lang="scss" scoped>
+.item {
+    width: 690rpx;
+    background: #FFFFFF;
+    box-shadow: 0rpx 4rpx 16rpx 2rpx rgba(150, 157, 165, 0.16);
+    margin: 0 auto 20rpx;
+    padding: 20rpx 40rpx;
+    box-sizing: border-box;
+
+    .head {
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
+
+        .tag {
+            font-family: PingFang SC, PingFang SC;
+            font-size: 24rpx;
+            color: #FFFFFF;
+            padding: 8rpx 20rpx;
+        }
+
+        .time {
+            font-family: Microsoft YaHei, Microsoft YaHei;
+            font-size: 24rpx;
+            color: #999999;
+        }
+    }
+
+    .address {
+        line-height: 38rpx;
+        font-family: Microsoft YaHei, Microsoft YaHei;
+        font-size: 28rpx;
+        color: #333333;
+        margin-top: 20rpx;
+    }
+
+    .user {
+        line-height: 32rpx;
+        font-family: Microsoft YaHei, Microsoft YaHei;
+        font-size: 24rpx;
+        color: #999999;
+        margin-top: 20rpx;
+    }
+
+    .but-box {
+        display: flex;
+        align-items: center;
+        justify-content: space-around;
+        margin-top: 20rpx;
+
+        .but-box-item {
+            width: 40%;
+        }
+    }
+}
+</style>

+ 0 - 11
pages/workOrder/my.vue

@@ -1,11 +0,0 @@
-<template>
-    <view>
-        进行中
-    </view>
-</template>
-
-<script setup>
-
-</script>
-
-<style lang="scss" scoped></style>

+ 0 - 11
pages/workOrder/saloon.vue

@@ -1,11 +0,0 @@
-<template>
-    <view>
-        待接单
-    </view>
-</template>
-
-<script setup>
-
-</script>
-
-<style lang="scss" scoped></style>

+ 65 - 70
static/iconfont.css

@@ -1,71 +1,66 @@
 @font-face {
-    font-family: "iconfont"; /* Project id 4985326 */
-    src: url('//at.alicdn.com/t/c/font_4985326_pp905a37qv.woff2?t=1753754541105') format('woff2'),
-         url('//at.alicdn.com/t/c/font_4985326_pp905a37qv.woff?t=1753754541105') format('woff'),
-         url('//at.alicdn.com/t/c/font_4985326_pp905a37qv.ttf?t=1753754541105') format('truetype');
-  }
-  
-  .iconfont {
-    font-family: "iconfont" !important;
-    font-size: 16px;
-    font-style: normal;
-    -webkit-font-smoothing: antialiased;
-    -moz-osx-font-smoothing: grayscale;
-  }
-  
-  .icon-anzhuang:before {
-    content: "\e6fe";
-  }
-  
-  .icon-weixiu:before {
-    content: "\e6ff";
-  }
-  
-  .icon-qita:before {
-    content: "\e700";
-  }
-  
-  .icon-qingxi:before {
-    content: "\e701";
-  }
-  
-  .icon-bianji:before {
-    content: "\e702";
-  }
-  
-  .icon-dianhua:before {
-    content: "\e703";
-  }
-  
-  .icon-yipaigong:before {
-    content: "\e6fa";
-  }
-  
-  .icon-yiwancheng:before {
-    content: "\e6fb";
-  }
-  
-  .icon-yiyuyue:before {
-    content: "\e6fc";
-  }
-  
-  .icon-yidadao:before {
-    content: "\e6fd";
-  }
-  
-  .icon-zhuye-weixuanzhong:before {
-    content: "\e6f6";
-  }
-  
-  .icon-zhuye-xuanzhong:before {
-    content: "\e6f7";
-  }
-  
-  .icon-wode-xuanzhong:before {
-    content: "\e6f8";
-  }
-  
-  .icon-wode-weixuanzhong:before {
-    content: "\e6f9";
-  }
-  
+  font-family: "iconfont"; /* Project id 4985326 */
+  src: url('//at.alicdn.com/t/c/font_4985326_dzcwlg84nhp.woff2?t=1753943776484') format('woff2'),
+       url('//at.alicdn.com/t/c/font_4985326_dzcwlg84nhp.woff?t=1753943776484') format('woff'),
+       url('//at.alicdn.com/t/c/font_4985326_dzcwlg84nhp.ttf?t=1753943776484') format('truetype');
+}
+
+.iconfont {
+  font-family: "iconfont" !important;
+  font-size: 16px;
+  font-style: normal;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+}
+
+.icon-bodadianhua1:before {
+  content: "\e6f7";
+}
+
+.icon-anzhuang:before {
+  content: "\e6fe";
+}
+
+.icon-weixiu:before {
+  content: "\e6ff";
+}
+
+.icon-qita:before {
+  content: "\e700";
+}
+
+.icon-qingxi:before {
+  content: "\e701";
+}
+
+.icon-bianji:before {
+  content: "\e702";
+}
+
+.icon-dianhua:before {
+  content: "\e703";
+}
+
+.icon-yipaigong:before {
+  content: "\e6fa";
+}
+
+.icon-yiwancheng:before {
+  content: "\e6fb";
+}
+
+.icon-yiyuyue:before {
+  content: "\e6fc";
+}
+
+.icon-yidadao:before {
+  content: "\e6fd";
+}
+
+.icon-zhuye-weixuanzhong:before {
+  content: "\e6f6";
+}
+
+.icon-wode-weixuanzhong:before {
+  content: "\e6f9";
+}

+ 0 - 25
tsconfig.json

@@ -1,25 +0,0 @@
-{
-    "compilerOptions": {
-        "sourceMap": true,
-        "baseUrl": ".",
-        "paths": {
-            "@/*": [
-                "./src/*"
-            ]
-        },
-        "lib": [
-            "esnext",
-            "dom"
-        ],
-        "types": [
-            "@dcloudio/types",
-            "uni-modules/uview-plus/types"
-        ]
-    },
-    "include": [
-        "src/**/*.ts",
-        "src/**/*.d.ts",
-        "src/**/*.tsx",
-        "src/**/*.vue"
-    ]
-}

+ 26 - 7
utils/Http.js

@@ -10,7 +10,12 @@ class HTTP {
             name: "楚楚",
             url: "https://cucu.cnyunl.com:8079"
         }];
-
+        this.updateList = (content, getList) => {
+            content.copyContent = JSON.parse(JSON.stringify(content));
+            content.pageSize = (content.pageNumber - 1) * (content.pageSize || 20); // 确保pageSize存在
+            content.pageNumber = 1;
+            getList()
+        }
         if (process.env.NODE_ENV === 'development') {
             this.baseUrl = this.urls[0].url;
         } else {
@@ -37,10 +42,11 @@ class HTTP {
         // 如果data.content.pageNumber存在但pageTotal不存在,则设置pageTotal为1
         // 如果pageNumber大于pageTotal,则直接返回空结果
         // 在接口中拿到的pageNumber自动加1,目的是在这里直接处理分页逻辑
-        if (data.content.pageNumber && !data.content.pageTotal) {
-            data.content.pageTotal = 1;
-            if (data.content.pageNumber > data.content.pageTotal) return new Promise((resolve) => resolve({ code: 0 }));;
-        }
+        try {
+            if (data.content.pageNumber) {
+                if (data.content.pageNumber > data.content.pageTotal) return new Promise((resolve) => resolve({ code: 0 }));;
+            }
+        } catch (error) { }
         return new Promise((resolve, reject) => {
             this._request(url, resolve, reject, data, method, header, showLoading);
         });
@@ -61,7 +67,21 @@ class HTTP {
             success: (res) => {
                 // 提取并保存JSESSIONID
                 this._handleSessionCookies(res);
-                if (res.data.pageNumber) res.data.pageNumber++
+                try {
+                    if (res.data.pageNumber) {
+                        res.data.firstPage = res.data.pageNumber === 1; // 判断是否为第一页
+                        if (data.content.copyContent) {
+                            res.data.pageNumber = data.content.copyContent.pageNumber;
+                            res.data.pageTotal = data.content.copyContent.pageTotal;
+                            data.content.pageSize = data.content.copyContent.pageSize;
+                            delete data.content.copyContent
+                        } else {
+                            res.data.pageNumber++
+                        }
+                    }
+                } catch (error) {
+
+                }
                 resolve(res.data);
             },
             fail: (err) => {
@@ -85,7 +105,6 @@ class HTTP {
                     this.jsessionid = '';
                     wx.removeStorageSync('JSESSIONID');
                     let currentPages = getCurrentPages()[getCurrentPages().length - 1];
-                    console.log("currentPages", currentPages)
                     // 如果当前页面不是登录页面,则跳转到登录页面
                     if (currentPages.route !== 'pages/login/login') {
                         uni.showModal({