Browse Source

no message

linwenxin 6 months ago
parent
commit
aaf3273ddc
1 changed files with 307 additions and 295 deletions
  1. 307 295
      src/packageWorkorder/pages/userWorkorderDetail.vue

+ 307 - 295
src/packageWorkorder/pages/userWorkorderDetail.vue

@@ -1,58 +1,61 @@
 <template>
   <!-- #ifdef H5 -->
-	<view>
-		<Loading
-			:type="3"
-			:loadStatus="loadStatus"
-		/>
-
-		<zj-page-layout
-			v-if="detail"
-			:hasFooter="false"
-			:isScroll="true"
-			:refresherTriggered="refresherTriggered"
-			@refresherrefresh="refresherrefresh">
-
-			<view class="detail-container">
-				<view class="top-container">
-					<view class="title">服务流程</view>
-					<u-steps :current="detail.serviceFlag" activeColor="#3D8FFD" v-if="orderStatus_v(detail.orderStatus) !== 'YQX'">
-						<u-steps-item title="提单"></u-steps-item>
-						<u-steps-item title="派工"></u-steps-item>
-						<u-steps-item title="服务"></u-steps-item>
-						<u-steps-item title="完工"></u-steps-item>
-						<u-steps-item title="评价"></u-steps-item>
-					</u-steps>
+  <view>
+    <Loading :type="3" :loadStatus="loadStatus" />
+
+    <zj-page-layout
+      v-if="detail"
+      :hasFooter="false"
+      :isScroll="true"
+      :refresherTriggered="refresherTriggered"
+      @refresherrefresh="refresherrefresh"
+    >
+      <view class="detail-container">
+        <view class="top-container">
+          <view class="title">服务流程</view>
+          <u-steps
+            :current="detail.serviceFlag"
+            activeColor="#3D8FFD"
+            v-if="orderStatus_v(detail.orderStatus) !== 'YQX'"
+          >
+            <u-steps-item title="提单"></u-steps-item>
+            <u-steps-item title="派工"></u-steps-item>
+            <u-steps-item title="服务"></u-steps-item>
+            <u-steps-item title="完工"></u-steps-item>
+            <u-steps-item title="评价"></u-steps-item>
+          </u-steps>
           <u-steps :current="3" activeColor="#3D8FFD" v-else>
-          	<u-steps-item title="提单"></u-steps-item>
-          	<u-steps-item title="派工"></u-steps-item>
-          	<u-steps-item title="服务"></u-steps-item>
-          	<u-steps-item title="取消"></u-steps-item>
+            <u-steps-item title="提单"></u-steps-item>
+            <u-steps-item title="派工"></u-steps-item>
+            <u-steps-item title="服务"></u-steps-item>
+            <u-steps-item title="取消"></u-steps-item>
           </u-steps>
-				</view>
+        </view>
 
-				<view class="list-container">
-					<logistics :logisticsData="logisticsData"></logistics>
-				</view>
+        <view class="list-container">
+          <logistics :logisticsData="logisticsData"></logistics>
+        </view>
 
-				<view class="main-container">
+        <view class="main-container">
           <block v-if="orderDetail">
             <view class="title">订单信息</view>
             <view class="orderid mt20">
-            	<view class="row">
-            		<view class="ellipsis">订单号<text>{{orderDetail.orderId}}</text></view>
-            		<view class="copy" @tap.stop="$copy(orderDetail.orderId)">复制</view>
-            	</view>
+              <view class="row">
+                <view class="ellipsis"
+                  >订单号<text>{{ orderDetail.orderId }}</text></view
+                >
+                <view class="copy" @tap.stop="$copy(orderDetail.orderId)">复制</view>
+              </view>
             </view>
             <view class="goods2">
-              <view class="item" v-for="(item, index) in orderDetail.orderDetails" :key='index'>
+              <view class="item" v-for="(item, index) in orderDetail.orderDetails" :key="index">
                 <image :src="item.imgUrl" mode="aspectFill"></image>
                 <view class="main">
-                  <view class="name">{{item.goodsName}}</view>
-                  <view class="text">{{item.goodsSpecValue}}</view>
+                  <view class="name">{{ item.goodsName }}</view>
+                  <view class="text">{{ item.goodsSpecValue }}</view>
                   <view class="bottom">
-                    <view class="price">¥{{item.price | priceFilter}}</view>
-                    <view class="num">x{{item.num}}</view>
+                    <view class="price">¥{{ item.price | priceFilter }}</view>
+                    <view class="num">x{{ item.num }}</view>
                   </view>
                 </view>
               </view>
@@ -64,46 +67,48 @@
           <view class="title">服务信息</view>
           <view class="orderid mt20">
             <view class="row">
-              <view class="ellipsis">工单号<text>{{detail.id}}</text></view>
+              <view class="ellipsis"
+                >工单号<text>{{ detail.id }}</text></view
+              >
               <view class="copy" @tap.stop="$copy(detail.id)">复制</view>
             </view>
           </view>
-					<view
-						class="goods"
-						:class="'goods'+idx"
-						v-for="(it, idx) in detail.pgOrderProducts"
-						:key='idx'>
-						<image :src="it.imgUrl" mode="aspectFill"></image>
-						<view class="main">
-							<view class="name ellipsis-2">{{it.smallName}}</view>
-							<view class="tags">
-								<view class="tag1">{{it.brandName}}</view>
-								<view class="tag2">{{it.mainName}}</view>
-							</view>
-						</view>
-					</view>
-					<view class="info">
-						<view class="row" v-if="detail.appointmentTime">
-							<view class="label">预约时间</view>
-							<view class="value">{{detail.appointmentTime.slice(0, 10)}}</view>
-						</view>
-						<view class="row" v-if="detail.workerName">
-							<view class="label">工&nbsp;程&nbsp;师</view>
-							<view class="value">{{detail.workerName}}</view>
-							<text class="iconfont icon-call" @tap="$callPhone(detail.workerMobile)"></text><text class="call" @tap="$callPhone(detail.workerMobile)">联系Ta</text>
-							<block v-if="locationData">
-								<text class="iconfont icon-dingwei1" @tap="toLocation"></text><text class="call" @tap="toLocation">查看位置</text>
-							</block>
-						</view>
-						<view class="row">
-							<view class="label">服务地址</view>
-							<view class="value">{{detail.province}}{{detail.city}}{{detail.area}}{{detail.street}}{{detail.address}}</view>
-						</view>
-						<view class="row">
-							<view class="label">备&emsp;&emsp;注</view>
-							<view class="value">{{detail.remark}}</view>
-						</view>
-					</view>
+          <view class="goods" :class="'goods' + idx" v-for="(it, idx) in detail.pgOrderProducts" :key="idx">
+            <image :src="it.imgUrl" mode="aspectFill"></image>
+            <view class="main">
+              <view class="name ellipsis-2">{{ it.smallName }}</view>
+              <view class="tags">
+                <view class="tag1">{{ it.brandName }}</view>
+                <view class="tag2">{{ it.mainName }}</view>
+              </view>
+            </view>
+          </view>
+          <view class="info">
+            <view class="row" v-if="detail.appointmentTime">
+              <view class="label">预约时间</view>
+              <view class="value">{{ detail.appointmentTime.slice(0, 10) }}</view>
+            </view>
+            <view class="row" v-if="detail.workerName">
+              <view class="label">工&nbsp;程&nbsp;师</view>
+              <view class="value">{{ detail.workerName }}</view>
+              <text class="iconfont icon-call" @tap="$callPhone(detail.workerMobile)"></text
+              ><text class="call" @tap="$callPhone(detail.workerMobile)">联系Ta</text>
+              <block v-if="locationData">
+                <text class="iconfont icon-dingwei1" @tap="toLocation"></text
+                ><text class="call" @tap="toLocation">查看位置</text>
+              </block>
+            </view>
+            <view class="row">
+              <view class="label">服务地址</view>
+              <view class="value"
+                >{{ detail.province }}{{ detail.city }}{{ detail.area }}{{ detail.street }}{{ detail.address }}</view
+              >
+            </view>
+            <view class="row">
+              <view class="label">备&emsp;&emsp;注</view>
+              <view class="value">{{ detail.remark }}</view>
+            </view>
+          </view>
 
           <block v-if="payList.length > 0">
             <u-divider></u-divider>
@@ -112,250 +117,258 @@
             <block v-for="(item, index) in payList" :key="index">
               <view class="orderid mt20">
                 <view class="row">
-                  <view class="ellipsis">支付单号<text>{{item.orderId}}</text></view>
+                  <view class="ellipsis"
+                    >支付单号<text>{{ item.orderId }}</text></view
+                  >
                   <view class="copy" @tap.stop="$copy(item.orderId)">复制</view>
                 </view>
               </view>
               <view class="product">
                 <view class="it" v-for="(it, idx) in item.workerOrderItems" :key="idx">
-                  <view class="name" v-if="it.chargeType == 'ACC'">{{it.goodsName}}<text>×{{it.num}}</text></view>
+                  <view class="name" v-if="it.chargeType == 'ACC'"
+                    >{{ it.goodsName }}<text>×{{ it.num }}</text></view
+                  >
                   <view class="name" v-else>服务费</view>
-                  <view class="price">¥{{it.totalAmount | priceFilter}}</view>
+                  <view class="price">¥{{ it.totalAmount | priceFilter }}</view>
                 </view>
                 <view class="total">
                   <view class="text">合计:</view>
-                  <view class="price">¥{{it.totalAmount | priceFilter}}</view>
+                  <view class="price"
+                    >¥{{
+                      item.workerOrderItems.map(it => it.totalAmount || 0).reduce((a, b) => a + b, 0) | priceFilter
+                    }}</view
+                  >
                 </view>
               </view>
             </block>
-
           </block>
-
-				</view>
-
-			</view>
-		</zj-page-layout>
-	</view>
+        </view>
+      </view>
+    </zj-page-layout>
+  </view>
   <!-- #endif -->
 
   <!-- #ifndef H5 -->
-  <web-view :src="webViewHref(`/packageWorkorder/pages/userWorkorderDetail`, pam, crossPagePam)" @message="crossPage.$listener"></web-view>
+  <web-view
+    :src="webViewHref(`/packageWorkorder/pages/userWorkorderDetail`, pam, crossPagePam)"
+    @message="crossPage.$listener"
+  ></web-view>
   <!-- #endif -->
 </template>
 
 <script>
-  // #ifdef H5
-	import Logistics from '@/components/logistics2/common-logistics.vue';
-
-	export default {
-		components: {
-			Logistics
+ // #ifdef H5
+import Logistics from '@/components/logistics2/common-logistics.vue';
+
+export default {
+	components: {
+		Logistics
+	},
+
+	data() {
+		return {
+			imageUrl: this.$imageUrl,
+			id: null, // 工单号
+			detail: null, // 详情数据
+       orderDetail: null, // 订单详情
+       payList: [],
+			loadStatus: 1,
+			refresherTriggered: false,
+			orderState: 0,
+			logisticsData: [],
+			locationData: null,
+		}
+	},
+
+	onLoad({id}) {
+		this.id = id;
+		this.refreshData();
+
+     this.crossPage.$on('refreshUserWorkorderDetail', data => {
+       this.refreshData();
+     })
+	},
+
+   onUnload() {
+     this.crossPage.$off('refreshUserWorkorderDetail');
+   },
+
+	methods: {
+     orderStatus_v(orderStatus){
+       if (["DYY"].includes(orderStatus)) {
+         // 待预约
+         return "DYY"
+       } else if (["DQD"].includes(orderStatus)) {
+         // 待抢单
+         return "DQD"
+       } else if (["DSHPG", "CJ", "YPD", "DXSPD", "DZBPG", "DWDSPGP", "DXSSPGP", "DTJXSSPGP", "DZBSPGP", "DFZXPD", "DFZXSPGP", 'XSBH', "TJXSBH", "ZBBH", "FZXBH", "FL"].includes(orderStatus)) {
+         // 待商户派工
+         return "DSHPG"
+       } else if (["DWDPG", "DWDPD", "WDBH"].includes(orderStatus)) {
+         // 待网点派工
+         return "DWDPG"
+       } else if (["DJD", "DSM", "YZP"].includes(orderStatus)) {
+         // 待接单
+         return "DJD"
+       } else if (["FWZ", "GCSZT", "BFWG"].includes(orderStatus)) {
+         // 服务中
+         return "FWZ"
+       } else if (["YCD"].includes(orderStatus)) {
+         // 异常单
+         return "YCD"
+       } else if (["YWG", "GCSZX", "WDWG", "YWGO"].includes(orderStatus)) {
+         // 已完工待结算
+         return "YWG"
+       } else if (["YJS", "LRCD"].includes(orderStatus)) {
+         // 已结算
+         return "YJS"
+       } else if (["YQX", "FWZT", "YCGB", "FWQX"].includes(orderStatus)) {
+         // 已取消
+         return "YQX"
+       }
+       return ""
+     },
+		// 获取详情
+		async getDetail() {
+			return new Promise((resolve, reject) => {
+				this.$api.post('/pg/order/base/detail', {
+		      orderBaseId: this.id,
+		    }).then((res) => {
+           const data = res.data;
+		      this.detail = data;
+
+           let list = [{
+             title: '已下单',
+             time: data.createTime,
+             content: '您的服务订单已提交成功'
+           }];
+           if(data.workerId) {
+             list.unshift({
+               title: '已接单',
+               time: data.workerReceTime,
+               content: `您的服务订单已成功接收,由【${data.websitName}】的工程师为您服务`
+             })
+             list.unshift({
+               title: '已派单',
+               time: data.dispatchTime,
+               content: `您的服务工程师为【${data.workerName}】员工号:${data.workerId},联系电话:${data.workerMobile}`
+             })
+           }
+           if(data.appointmentTime) {
+             list.unshift({
+               title: '已预约',
+               time: data.lastOperatorAppointmentTime,
+               content: `预约时间:${data.appointmentTime.slice(0, 10)}`
+             })
+           }
+           if(this.orderStatus_v(data.orderStatus)  == 'YWG' || this.orderStatus_v(data.orderStatus) == 'YJS') {
+             list.unshift({
+               title: '服务完成',
+               time: data.overTime,
+               content: '您本次服务已完成,感谢您的信任和监督'
+             })
+           }
+           if(data.appraiseStatus != 'N') {
+             const MAP = {
+               A: '好评',
+               B: '中评',
+               C: '差评',
+             }
+             list.unshift({
+               title: '已评价',
+               time: data.appraiseTime,
+               content: `评价结果:${MAP[data.appraiseStatus]}`
+             })
+           }
+           if(this.orderStatus_v(data.orderStatus) == 'YQX') {
+             list.unshift({
+               title: '取消工单',
+               time: data.lastOperatorTime,
+               content: '您本次服务已取消'
+             })
+           }
+           this.logisticsData = list;
+
+		      resolve(1);
+		    }).catch((res) => {
+		      reject(0);
+		    });
+			});
 		},
 
-		data() {
-			return {
-				imageUrl: this.$imageUrl,
-				id: null, // 工单号
-				detail: null, // 详情数据
-        orderDetail: null, // 订单详情
-        payList: [],
-				loadStatus: 1,
-				refresherTriggered: false,
-				orderState: 0,
-				logisticsData: [],
-				locationData: null,
-			}
+     async getOrderDetail() {
+       return new Promise((resolve, reject) => {
+         this.$api.get('/order/detail', {
+           orderId: this.detail.saleOrderId
+         }).then(res => {
+           this.orderDetail = res.data;
+         }).finally(res => {
+           resolve(1);
+         })
+     	})
+     },
+
+     // 获取支付信息
+     async getPayList() {
+     	return new Promise((resolve, reject) => {
+     		this.$api.post('/changeOrder/getOrderList', {
+     			workerOrderId: this.id,
+         }).then(async (res) => {
+           this.payList = res.data;
+           resolve(1);
+         }).catch((res) => {
+           reject(0);
+         });
+     	});
+     },
+
+     async refreshData() {
+     	try {
+     		await this.getDetail();
+         await this.getPayList();
+         if(this.detail.saleOrderId) {
+           await this.getOrderDetail();
+         }
+     		this.refresherTriggered = false;
+     		this.loadStatus = 0;
+     	} catch (e) {
+     		this.loadStatus = 2;
+     	}
+     },
+
+		// 触发下拉刷新
+		async refresherrefresh(e) {
+			this.refresherTriggered = true;
+			await this.refreshData();
 		},
 
-		onLoad({id}) {
-			this.id = id;
-			this.refreshData();
-
-      this.crossPage.$on('refreshUserWorkorderDetail', data => {
-        this.refreshData();
-      })
+		toLocation() {
+			this.$navPage(`/pages/mine/workOrder/map?location=${JSON.stringify(this.locationData)}`);
 		},
 
-    onUnload() {
-      this.crossPage.$off('refreshUserWorkorderDetail');
-    },
-
-		methods: {
-      orderStatus_v(orderStatus){
-        if (["DYY"].includes(orderStatus)) {
-          // 待预约
-          return "DYY"
-        } else if (["DQD"].includes(orderStatus)) {
-          // 待抢单
-          return "DQD"
-        } else if (["DSHPG", "CJ", "YPD", "DXSPD", "DZBPG", "DWDSPGP", "DXSSPGP", "DTJXSSPGP", "DZBSPGP", "DFZXPD", "DFZXSPGP", 'XSBH', "TJXSBH", "ZBBH", "FZXBH", "FL"].includes(orderStatus)) {
-          // 待商户派工
-          return "DSHPG"
-        } else if (["DWDPG", "DWDPD", "WDBH"].includes(orderStatus)) {
-          // 待网点派工
-          return "DWDPG"
-        } else if (["DJD", "DSM", "YZP"].includes(orderStatus)) {
-          // 待接单
-          return "DJD"
-        } else if (["FWZ", "GCSZT", "BFWG"].includes(orderStatus)) {
-          // 服务中
-          return "FWZ"
-        } else if (["YCD"].includes(orderStatus)) {
-          // 异常单
-          return "YCD"
-        } else if (["YWG", "GCSZX", "WDWG", "YWGO"].includes(orderStatus)) {
-          // 已完工待结算
-          return "YWG"
-        } else if (["YJS", "LRCD"].includes(orderStatus)) {
-          // 已结算
-          return "YJS"
-        } else if (["YQX", "FWZT", "YCGB", "FWQX"].includes(orderStatus)) {
-          // 已取消
-          return "YQX"
-        }
-        return ""
-      },
-			// 获取详情
-			async getDetail() {
-				return new Promise((resolve, reject) => {
-					this.$api.post('/pg/order/base/detail', {
-			      orderBaseId: this.id,
-			    }).then((res) => {
-            const data = res.data;
-			      this.detail = data;
-
-            let list = [{
-              title: '已下单',
-              time: data.createTime,
-              content: '您的服务订单已提交成功'
-            }];
-            if(data.workerId) {
-              list.unshift({
-                title: '已接单',
-                time: data.workerReceTime,
-                content: `您的服务订单已成功接收,由【${data.websitName}】的工程师为您服务`
-              })
-              list.unshift({
-                title: '已派单',
-                time: data.dispatchTime,
-                content: `您的服务工程师为【${data.workerName}】员工号:${data.workerId},联系电话:${data.workerMobile}`
-              })
-            }
-            if(data.appointmentTime) {
-              list.unshift({
-                title: '已预约',
-                time: data.lastOperatorAppointmentTime,
-                content: `预约时间:${data.appointmentTime.slice(0, 10)}`
-              })
-            }
-            if(this.orderStatus_v(data.orderStatus)  == 'YWG' || this.orderStatus_v(data.orderStatus) == 'YJS') {
-              list.unshift({
-                title: '服务完成',
-                time: data.overTime,
-                content: '您本次服务已完成,感谢您的信任和监督'
-              })
-            }
-            if(data.appraiseStatus != 'N') {
-              const MAP = {
-                A: '好评',
-                B: '中评',
-                C: '差评',
-              }
-              list.unshift({
-                title: '已评价',
-                time: data.appraiseTime,
-                content: `评价结果:${MAP[data.appraiseStatus]}`
-              })
-            }
-            if(this.orderStatus_v(data.orderStatus) == 'YQX') {
-              list.unshift({
-                title: '取消工单',
-                time: data.lastOperatorTime,
-                content: '您本次服务已取消'
-              })
-            }
-            this.logisticsData = list;
-
-			      resolve(1);
-			    }).catch((res) => {
-			      reject(0);
-			    });
-				});
-			},
-
-      async getOrderDetail() {
-        return new Promise((resolve, reject) => {
-          this.$api.get('/order/detail', {
-            orderId: this.detail.saleOrderId
-          }).then(res => {
-            this.orderDetail = res.data;
-          }).finally(res => {
-            resolve(1);
-          })
-      	})
-      },
-
-      // 获取支付信息
-      async getPayList() {
-      	return new Promise((resolve, reject) => {
-      		this.$api.post('/changeOrder/getOrderList', {
-      			workerOrderId: this.id,
-          }).then(async (res) => {
-            this.payList = res.data;
-            resolve(1);
-          }).catch((res) => {
-            reject(0);
-          });
-      	});
-      },
-
-      async refreshData() {
-      	try {
-      		await this.getDetail();
-          await this.getPayList();
-          if(this.detail.saleOrderId) {
-            await this.getOrderDetail();
-          }
-      		this.refresherTriggered = false;
-      		this.loadStatus = 0;
-      	} catch (e) {
-      		this.loadStatus = 2;
-      	}
-      },
-
-			// 触发下拉刷新
-			async refresherrefresh(e) {
-				this.refresherTriggered = true;
-				await this.refreshData();
-			},
-
-			toLocation() {
-				this.$navPage(`/pages/mine/workOrder/map?location=${JSON.stringify(this.locationData)}`);
-			},
-
-			// 预览图片
-			prevImg(urls, current) {
-				uni.previewImage({
-					current,
-					urls
-				})
-			},
+		// 预览图片
+		prevImg(urls, current) {
+			uni.previewImage({
+				current,
+				urls
+			})
+		},
 
-		}
 	}
-  // #endif
-  // #ifndef H5
-  export default {
-    data() {
-      return {
-        pam: {},
-      }
-    },
-    onLoad(pam) {
-      this.pam = pam;
-    }
-  }
-  // #endif
+}
+ // #endif
+ // #ifndef H5
+ export default {
+   data() {
+     return {
+       pam: {},
+     }
+   },
+   onLoad(pam) {
+     this.pam = pam;
+   }
+ }
+ // #endif
 </script>
 
 <style lang="scss" scoped>
@@ -564,7 +577,6 @@
         width: 128rpx;
       }
       .value {
-
       }
       .iconfont {
         margin-left: 16rpx;