Browse Source

工单修改

xiaohaizhao 2 years ago
parent
commit
3709e3d985

+ 7 - 4
Eservice/workOrder/index.js

@@ -25,7 +25,8 @@ Page({
     list: [],
     pageNumber: 1,
     pageSize: 20,
-    status: '待接单'
+    status: '待接单',
+    statistics: {}
   },
   async listData() {
     const res = await api._post({
@@ -40,13 +41,15 @@ Page({
         }
       }
     })
-    if (res.data.length === 0) return false
+    if (res.data.length === 0) return false;
     this.setData({
-      list: this.data.list.concat(res.data)
+      list: this.data.list.concat(res.data),
+      statistics: res.data[0].rows_total[0]
     })
+    console.log(this.data.statistics)
   },
   onTabsChange(e) {
-    this.data.status = e.detail.label
+    this.data.status = e.detail.value;
     this.onPullDownRefresh()
   },
   onLoad(options) {

+ 6 - 6
Eservice/workOrder/index.wxml

@@ -1,9 +1,9 @@
-<t-tabs defaultValue="{{0}}" bind:change="onTabsChange" bind:click="onTabsClick" t-class="custom-tabs">
-  <t-tab-panel label="待接单" value="0" badge-props="{{ { count: 0, offset: ['-16rpx', '8rpx'] } }}" />
-  <t-tab-panel label="待开始" value="4" badge-props="{{ { count: 0, offset: ['-16rpx', '8rpx'] } }}" />
-  <t-tab-panel label="暂停" value="1" badge-props="{{ { count: 0, offset: ['-16rpx', '8rpx'] } }}" />
-  <t-tab-panel label="进行中" value="2" badge-props="{{ { count: 0, offset: ['-16rpx', '8rpx'] } }}" />
-  <t-tab-panel label="已完成" value="3" badge-props="{{ { count: 0, offset: ['-16rpx', '8rpx'] } }}" />
+<t-tabs defaultValue="待接单" bind:change="onTabsChange" bind:click="onTabsClick" t-class="custom-tabs">
+  <t-tab-panel label="待接单{{statistics.toacceptCount}}" value="待接单" badge-props="{{ { count: 0, offset: ['-16rpx', '8rpx'] } }}" />
+  <t-tab-panel label="待开始{{statistics.tostartCount}}" value="待开始" badge-props="{{ { count: 0, offset: ['-16rpx', '8rpx'] } }}" />
+  <t-tab-panel label="进行中{{statistics.startingCount}}" value="进行中" badge-props="{{ { count: 0, offset: ['-16rpx', '8rpx'] } }}" />
+  <t-tab-panel label="暂停{{statistics.tostopCount}}" value="暂停" badge-props="{{ { count: 0, offset: ['-16rpx', '8rpx'] } }}" />
+  <t-tab-panel label="已完成{{statistics.completeCount}}" value="已完成" badge-props="{{ { count: 0, offset: ['-16rpx', '8rpx'] } }}" />
 </t-tabs>
 <t-pull-down-refresh style="padding-bottom:60px" value="{{baseRefresh.value}}" loadingProps="{{loadingProps}}" loadingTexts="{{['下拉刷新', '松手刷新', '正在刷新', '刷新完成']}}" bind:refresh="onPullDownRefresh" bind:scrolltolower="onReachBottom">
   <view style="padding:10px">

+ 34 - 79
Eservice/workOrderDetail/index.js

@@ -1,26 +1,31 @@
 const api = require("../api/api")
 import Dialog from 'tdesign-miniprogram/dialog/index';
-
-// pages/workOrderDetail/index.js
 Page({
-
-  /**
-   * 页面的初始数据
-   */
   data: {
 
   },
-  async mainData () {
+  /* 是否阻止跳转 */
+  isStopToPage() {
+    if (this.data.billData.status != '进行中') {
+      wx.showToast({
+        title: '当前工单状态不支持操作!',
+        icon: "none"
+      })
+    }
+  },
+  async mainData() {
     const res = await api._post({
       "id": "20230208140103",
       "content": {
-        "sa_workorderid":this.data.id
+        nocache: true,
+        "sa_workorderid": this.data.id
       }
     })
+    console.log("详情", res)
     this.setData({
-      billData:res.data
+      billData: res.data
     })
-    
+
   },
   changeBillStatus(data) {
     let id = data.currentTarget.dataset.id
@@ -43,26 +48,26 @@ Page({
           const res = await api._post({
             "id": id,
             "content": {
-              "sa_workorderid":this.data.id
+              "sa_workorderid": this.data.id
             }
           })
           this.mainData()
         }
-        
+
       })
       .catch(() => console.log('点击了取消'))
       .finally(() => Dialog.close());
   },
 
-  async addConfirmBill () {
+  async addConfirmBill() {
     const res = await api._post({
       "id": "20230211105703",
-      "version":1,
+      "version": 1,
       "content": {
-        "sa_workorder_confirmationid":0,
-        "sa_workorderid":this.data.id,
-        "attitudescore":0,
-        "responsescore":0,
+        "sa_workorder_confirmationid": 0,
+        "sa_workorderid": this.data.id,
+        "attitudescore": 0,
+        "responsescore": 0,
       }
     })
     if (this.data.billData.type === '安装培训') {
@@ -78,9 +83,9 @@ Page({
         url: '/Eservice/serviceConfirmBill/index?id=' + res.data.sa_workorder_confirmationid,
       })
     }
-    
+
   },
-  toConfirmBill (data) {
+  toConfirmBill(data) {
     if (this.data.billData.type === '安装培训') {
       wx.navigateTo({
         url: '/Eservice/trainConfirmBill/index?id=' + data.currentTarget.dataset.item.sa_workorder_confirmationid + '&class=' + this.data.stopClick,
@@ -94,89 +99,39 @@ Page({
         url: '/Eservice/serviceConfirmBill/index?id=' + data.currentTarget.dataset.item.sa_workorder_confirmationid + '&class=' + this.data.stopClick,
       })
     }
-     
+
   },
-  async confirmBillList () {
+  async confirmBillList() {
     const res = await api._post({
       "id": "20230211105903",
       "content": {
-        "where":{
-          "condition":"",
-          "sa_workorderid":this.data.id
+        "where": {
+          "condition": "",
+          "sa_workorderid": this.data.id
         }
       }
     })
     this.setData({
-      confirmBills:res.data
+      confirmBills: res.data
     })
   },
 
-  toWorkConfirmInfo () {
+  toWorkConfirmInfo() {
     getApp().globalData.handelSelect = this
 
     wx.navigateTo({
       url: '/Eservice/workBillConfirmInfo/index?class=' + this.data.stopClick,
     })
   },
-  
-  /**
-   * 生命周期函数--监听页面加载
-   */
   onLoad(options) {
     this.setData({
-      id:options.id,
-      stopClick:options.class
+      id: options.id,
+      stopClick: options.class
     })
-    
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady() {
 
   },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
   onShow() {
     this.mainData()
     this.confirmBillList()
   },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload() {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh() {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom() {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage() {
-
-  }
 })

+ 7 - 0
Eservice/workOrderDetail/index.scss

@@ -34,4 +34,11 @@ page{
 .smallChild{
   font-size: 24rpx;
   color:#666
+}
+
+.footer{
+  width: 100vw;
+  position: fixed;
+  bottom: 0;
+  background-color: #fff;
 }

+ 31 - 15
Eservice/workOrderDetail/index.wxml

@@ -21,7 +21,9 @@
   <card>
     <view slot="content">
       <view style="margin-bottom: 5px;" class="small"><text class="label">工单编号:</text>{{billData.billno}}</view>
-      <view  style="margin-bottom: 5px;" class="small"><t-button size="extra-small" theme="light" bind:tap="toWorkConfirmInfo">查看工单确认信息</t-button></view>
+      <view style="margin-bottom: 5px;" class="small">
+        <t-button size="extra-small" theme="light" bind:tap="toWorkConfirmInfo">查看工单确认信息</t-button>
+      </view>
       <view style="margin-bottom: 5px;" class="small"><text class="label">现场联系人:</text>{{billData.scenecontact}}</view>
       <view class="small flex-align-center"><text class="label">联系电话:</text>
         <t-call phone="{{billData.scenecontactphonenumber}}">{{billData.scenecontactphonenumber}}</t-call>
@@ -31,11 +33,14 @@
       <view class="small"><text class="label">结束时间:</text>{{billData.enddate}}</view>
     </view>
   </card>
-  <card >
-  <view slot="content">
-    <view class="small"><text class="label">业务员:</text>{{billData.scenecontact}}</view>
-    <view class="small flex-align-center"><text class="label">联系电话:</text><t-call phone="{{billData.scenecontactphonenumber}}">{{billData.scenecontactphonenumber}}</t-call></view>
-  </view>
+  <card>
+    <view slot="content">
+      <view class="small"><text class="label">业务员:</text>{{billData.saler_name||" --"}}</view>
+      <view class="small flex-align-center"><text class="label">联系电话:</text>
+        <t-call wx:if="{{billData.salerphonenumber}}" phone="{{billData.salerphonenumber}}" />
+        <text wx:else> --</text>
+      </view>
+    </view>
   </card>
   <view style="margin-bottom: 5px;" class="small"><text class="label">项目成员</text></view>
   <card>
@@ -46,18 +51,26 @@
   <t-tabs defaultValue="{{0}}" bind:change="onTabsChange" bind:click="onTabsClick" t-class="custom-tabs">
     <t-tab-panel label="工单进度" value="0">
       <view style="padding:10px">
+
         <view class="small mt-5" wx:for="{{billData.nodes}}" wx:key="sa_workorder_nodeid">
+
           {{index + 1}}.{{item.workpresetjson.workname}}
-          <image-view isdelete="{{false}}" wx:if="{{item.attinfos.length > 0}}" list="{{item.attinfos}}"></image-view>
-          <navigator url="{{'/Eservice/nodeDetail/index?id=' + child.sa_workorder_nodeid + '&wid=' + id +'&class=' + stopClick}}" class="textIndentNodeChild smallChild" wx:for="{{item.child}}" wx:key="sa_workorder_nodeid" wx:for-item="child" wx:for-index="childIndex">
+
+          <image-view isdelete="{{false}}" wx:if="{{item.attinfos.length > 0}}" list="{{item.attinfos}}" />
+
+          <navigator url="{{billData.status=='进行中'?('/Eservice/nodeDetail/index?id=' + child.sa_workorder_nodeid + '&wid=' + id +'&class=' + stopClick):'#'}}" class="textIndentNodeChild smallChild" wx:for="{{item.child}}" wx:key="sa_workorder_nodeid" bindtap="isStopToPage" wx:for-item="child" wx:for-index="childIndex">
             {{index + 1}}-{{childIndex + 1}}.{{child.workpresetjson.workname}}
-            <image-view isdelete="{{false}}" wx:if="{{child.attinfos.length > 0}}" list="{{child.attinfos}}"></image-view>
+            <image-view isdelete="{{false}}" wx:if="{{child.attinfos.length > 0}}" list="{{child.attinfos}}" />
             <view class="small">
-              <text class="colorInfo">{{child.finishdate}}</text><t-tag class="mr-5 mt-5" variant="dark" theme="{{child.status == 0?'danger':child.status == 1?'success':'primary'}}" size="small">{{child.status == 0?'未完成':child.status == 1?'完成':'进行中'}}</t-tag> <t-tag wx:if="{{child.finishby}}" class="mr-5 mt-5" variant="dark" theme="primary" size="small">{{child.finishby}}</t-tag>
+              <text class="colorInfo">{{child.finishdate}}</text>
+              <t-tag class="mr-5 mt-5" variant="dark" theme="{{child.status == 0?'danger':child.status == 1?'success':'primary'}}" size="small">{{child.status == 0?'未完成':child.status == 1?'完成':'进行中'}}</t-tag>
+              <t-tag wx:if="{{child.finishby}}" class="mr-5 mt-5" variant="dark" theme="primary" size="small">{{child.finishby}}</t-tag>
             </view>
           </navigator>
           <t-divider dashed />
         </view>
+
+
       </view>
     </t-tab-panel>
     <t-tab-panel label="确认单" value="1">
@@ -66,13 +79,16 @@
       </view>
       <t-cell wx:for="{{confirmBills}}" wx:key="sa_workorder_confirmationid" note="{{item.status}}" title="{{item.confirmationno}}" data-item="{{item}}" hover arrow bind:click="toConfirmBill"></t-cell>
     </t-tab-panel>
-  </t-tabs>  
+  </t-tabs>
 </view>
 
-<view wx:if="{{!stopClick}}" class="{{stopClick}}" style="padding:0 10px 10px 10px">
-  <t-button wx:if="{{billData.status === '待接单'}}" theme="dark" variant="primary" data-id="20230210101103" bind:tap="changeBillStatus" block>接单</t-button>
-  <t-button wx:if="{{billData.status === '待开始'}}" theme="dark" variant="primary" data-id="20230209144503" bind:tap="changeBillStatus" block>开始工单</t-button>
-  <t-button wx:if="{{billData.status === '进行中'}}" theme="dark" variant="primary" data-id="20230209144903" bind:tap="changeBillStatus" block>完结工单</t-button>
+<view style="height: 160rpx;" />
+<view class="footer">
+  <view wx:if="{{!stopClick}}" class="{{stopClick}}" style="padding:0 10px 10px 10px">
+    <t-button wx:if="{{billData.status === '待接单'}}" theme="dark" variant="primary" data-id="20230210101103" bind:tap="changeBillStatus" block>接单</t-button>
+    <t-button wx:if="{{billData.status === '待开始'}}" theme="dark" variant="primary" data-id="20230209144503" bind:tap="changeBillStatus" block>开始工单</t-button>
+    <t-button wx:if="{{billData.status === '进行中'}}" theme="dark" variant="primary" data-id="20230209144903" bind:tap="changeBillStatus" block>完结工单</t-button>
+  </view>
 </view>
 
 <t-dialog id="t-dialog" />