Explorar o código

E服务修改

xiaohaizhao %!s(int64=2) %!d(string=hai) anos
pai
achega
d2b8775356

+ 17 - 21
Eservice/agent/billCanUseProduct/index.js

@@ -13,7 +13,7 @@ Page({
         "pageSize": 20,
         "pageNumber": 1,
         "sa_serviceorderid": 0,
-        "isAll": 1, // 1-服务单产品,0-产品库
+        "isAll": 0,
         "sa_orderid": 0,
         "where": {
           "condition": ""
@@ -24,11 +24,25 @@ Page({
     list: [],
     selection: []
   },
+  onLoad(options) {
+    let pages = getCurrentPages();
+    let prePage = pages[pages.length - 2];
+    this.data.param.content.sa_serviceorderid = prePage.data.sa_serviceorderid || prePage.data.billData.sa_serviceorderid
+    this.data.param.content.sa_orderid = prePage.data.sa_orderid || prePage.data.billData.sa_orderid
+    console.log(options)
+    if (options.id) {
+      this.data.param.id = 20230421095904;
+      this.data.param.content.sa_workorderid = options.id;
+    }
+    this.listData()
+  },
   tabChange(e) {
-    this.data.param.content.isAll = e.detail.title == '产品库' ? '0' : '1';
+    this.data.param.content.isAll = e.detail.title == '产品库' ? '1' : '0';
     this.data.param.content.pageNumber = 1;
+    this.setData({
+      list: []
+    })
     this.listData()
-
   },
   search(data) {
     this.data.param.content.where.condition = data.detail.value
@@ -72,29 +86,11 @@ Page({
     prePage.getAdd(this.data.selection)
     wx.navigateBack()
   },
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad(options) {
-    let pages = getCurrentPages();
-    let prePage = pages[pages.length - 2];
-    this.data.param.content.sa_serviceorderid = prePage.data.sa_serviceorderid || prePage.data.billData.sa_serviceorderid
-    this.data.param.content.sa_orderid = prePage.data.sa_orderid || prePage.data.billData.sa_orderid
-    this.listData()
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
   onPullDownRefresh() {
     this.data.list = []
     this.data.param.content.pageNumber = 1
     this.listData()
   },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
   onReachBottom() {
     this.data.param.content.pageNumber++
     this.listData()

+ 1 - 1
Eservice/agent/serviceBillDetail/index.js

@@ -54,7 +54,7 @@ Page({
   },
   addProduct() {
     wx.navigateTo({
-      url: '/Eservice/agent/billCanUseProduct/index',
+      url: '/Eservice/agent/billCanUseProduct/index?id=' + this.data.mainData.sa_workorderid,
     })
   },
 

+ 2 - 1
Eservice/components/form/form.js

@@ -162,7 +162,7 @@ Component({
                 }
                 return e
             })
-            let isValidate = !arr.some(item => item.errorMsg && item.errorMsg !== '')
+            let isValidate = !arr.some(item => (item.errorMsg && item.errorMsg !== '') && item.label !== '关联订单')
             fn(isValidate)
         },
         setErrorMsg(msg, index) {
@@ -204,6 +204,7 @@ Component({
         },
         formSubmit() {
             var that = this
+
             that.validate((valid) => {
                 console.log(valid)
                 if (valid) {

+ 3 - 9
Eservice/components/productCard/index.js

@@ -1,9 +1,5 @@
 const _Http = getApp().globalData.http;
-
 Component({
-  /**
-   * 组件的属性列表
-   */
   properties: {
     data: {
       value: '',
@@ -17,13 +13,11 @@ Component({
       type: String,
       value: 1
     },
-    changeItem: Function
+    changeItem: Function,
+    delete: Function
   },
-  /**
-   * 组件的方法列表
-   */
   methods: {
-    onIconTap(data) {
+    onIconTap() {
       this.triggerEvent("delete", this.data.data);
     },
     inputChange(e) {

+ 1 - 1
Eservice/components/productCard/index.wxml

@@ -35,7 +35,7 @@
     </view>
   </view>
   <view wx:if="{{model!=3}}" class="deleteBtn">
-    <t-icon size="36rpx" name="delete" data-item="{{item}}" bind:click="onIconTap" />
+    <t-icon size="36rpx" name="delete" bind:click="onIconTap" />
   </view>
   <block wx:if="{{model==2}}">
     <view class="input">

+ 2 - 2
Eservice/installConfirmBill/index.js

@@ -23,7 +23,7 @@ Page({
         "sa_workorder_confirmationid": this.data.id
       }
     })
-    console.log("123123",res.data)
+    console.log("123123", res.data)
     this.setData({
       mainData: res.data,
       sa_serviceorderid: res.data.workorder.sa_serviceorderid,
@@ -81,7 +81,7 @@ Page({
   // 跳转到物料添加
   addProduct() {
     wx.navigateTo({
-      url: '/Eservice/agent/billCanUseProduct/index',
+      url: '/Eservice/agent/billCanUseProduct/index?id=' + this.data.mainData.sa_workorderid,
     })
   },
   // 添加物料

+ 2 - 2
Eservice/materielConfirmBill/index.wxml

@@ -7,7 +7,7 @@
   <t-cell title="项目名称" note="{{mainData.workorder.projectname}}" hover />
   <t-cell title="是否有偿服务" note="{{paidServiceAmount > 0?'是':'否'}}" hover />
   <t-cell title="是否质保期内" note="{{inqualityguaranteeperiod ==1 ?'是':'否'}}" hover />
-  <t-cell title="申请原因" note="{{paidServiceAmount > 0?'是':'否'}}" hover />
+  <t-cell title="申请原因" note="{{mainData.reason}}" hover />
 
   <view class="title colorInfo">
     客户信息
@@ -23,7 +23,7 @@
   <t-cell title="客诉大类" note="{{mainData.workorder.class2}}" hover />
   <t-cell title="服务方式" note="{{mainData.workorder.type}}" hover />
 
-  <view class="title colorInfo">
+  <view class="title colorInfo" wx:if="{{mainData.trainertitems.length}}">
     产品
   </view>
   <card style="margin-top:10px" wx:for="{{mainData.trainertitems}}" wx:key="itemid">

+ 1 - 1
Eservice/workOrder/index.wxml

@@ -23,7 +23,7 @@
             {{item.status}}
           </view>
           <view wx:if="{{item.status !== '待接单' && item.status !== '已完成'}}" class="colorInfo small">
-            {{item.status=='待开始'?'待开始':'当前工序:'+item.curcontent}}
+            {{item.status=='待开始'?'待开始':'当前工序:'+(item.curcontent||item.templatename)}}
           </view>
           <view wx:if="{{item.status == '已完成'}}" class="colorInfo small">
             已完成

+ 46 - 7
Eservice/workOrderDetail/index.js

@@ -1,4 +1,6 @@
-const api = require("../api/api")
+const api = require("../api/api");
+const _Http = getApp().globalData.http;
+
 import Dialog from 'tdesign-miniprogram/dialog/index';
 Page({
   data: {
@@ -7,7 +9,7 @@ Page({
   // 跳转到物料添加
   addProduct() {
     wx.navigateTo({
-      url: '/Eservice/agent/billCanUseProduct/index',
+      url: '/Eservice/agent/billCanUseProduct/index?id=' + this.data.billData.sa_workorderid
     })
   },
   // 添加物料
@@ -31,11 +33,39 @@ Page({
       [`billData.titems[${index}]`]: detail
     })
   },
+  /* 移除物料 */
+  deleteMaterial({
+    detail
+  }) {
+    wx.showModal({
+      title: '提示',
+      content: `是否确认删除“${detail.itemname}”`,
+      complete: (res) => {
+        if (res.confirm) api._post({
+          "id": "20230215202003",
+          "version": 1,
+          "content": {
+            "sa_workorder_node_itemsids": [detail.sa_workorder_node_itemsid]
+          }
+        }).then(res => {
+          wx.showToast({
+            title: res.msg == '成功' ? '删除成功' : res.msg,
+            icon: "none",
+            mask: true
+          });
+          this.setData({
+            "billData.titems": this.data.billData.titems.filter(v => v.sa_workorder_node_itemsid != detail.sa_workorder_node_itemsid)
+          })
+        })
+      }
+    })
+  },
   async updateMaterial(titems) {
+    console.log(this.data.confirmBills[0])
     const res = await api._post({
       "id": "20230215201903",
       "content": {
-        "sa_workorder_confirmationid": this.data.confirmBills[0].sa_workorder_confirmationid,
+        "sa_workorder_confirmationid": 0,
         "sa_workorderid": this.data.billData.sa_workorderid,
         "iteminfos": titems
       }
@@ -77,7 +107,12 @@ Page({
 
   },
   changeBillStatus(data) {
-    let id = data.currentTarget.dataset.id
+    let id = data.currentTarget.dataset.id;
+    if (id == 20230209144903 && this.data.billData.titems.length == 0) return wx.showToast({
+      title: '还未添加产品,不可完结',
+      icon: "none",
+      mask: true
+    })
     const dialogConfig = {
       context: this,
       title: '提示',
@@ -119,7 +154,12 @@ Page({
         "responsescore": 0,
       }
     })
-    if (this.data.billData.type === '安装培训') {
+
+    if (this.data.billData.type === "维修") {
+      wx.navigateTo({
+        url: '/Eservice/materielConfirmBill/index?id=' + res.data.sa_workorder_confirmationid,
+      })
+    } else if (this.data.billData.type === '安装培训') {
       wx.navigateTo({
         url: '/Eservice/trainConfirmBill/index?id=' + res.data.sa_workorder_confirmationid,
       })
@@ -135,7 +175,7 @@ Page({
 
   },
   toConfirmBill(data) {
-    if (this.data.billData.actiontype === "非工序模板") {
+    if (this.data.billData.type === "维修") {
       wx.navigateTo({
         url: '/Eservice/materielConfirmBill/index?id=' + data.currentTarget.dataset.item.sa_workorder_confirmationid + '&class=' + this.data.stopClick,
       })
@@ -152,7 +192,6 @@ Page({
         url: '/Eservice/serviceConfirmBill/index?id=' + data.currentTarget.dataset.item.sa_workorder_confirmationid + '&class=' + this.data.stopClick,
       })
     }
-
   },
   async confirmBillList() {
     const res = await api._post({

+ 1 - 3
Eservice/workOrderDetail/index.wxml

@@ -51,13 +51,11 @@
   </card>
   <t-tabs defaultValue="{{0}}" bind:change="onTabsChange" bind:click="onTabsClick" t-class="custom-tabs">
     <t-tab-panel label="工单进度" value="0">
-
-      <view wx:if="{{billData.actiontype=='非工序模板'}}">
+      <view wx:if="{{billData.type=='维修'}}">
         <view class="panel">
           <card style="margin-top:10px" wx:for="{{billData.titems}}" wx:key="itemid">
             <product-card style="flex:1" model='2' slot="content" data="{{item}}" changeQty="{{false}}" bind:delete="deleteMaterial" bind:input="qtyChange" bind:changeItem="changeItem" />
           </card>
-
           <view style="width: 100%; text-align: center;">
             <t-button size="extra-small" variant="primary" bind:tap="addProduct">添加产品</t-button>
           </view>

+ 18 - 14
Eservice/workerLeader/agentList/index.js

@@ -38,7 +38,7 @@ Page({
   onSubmit(data) {
     this.data.param.content.where.condition = data.detail.value
     this.setData({
-      list:[]
+      list: []
     })
     this.data.param.content.pageNumber = 1
     this.listData()
@@ -46,18 +46,23 @@ Page({
   onClick(data) {
     let item = data.currentTarget.dataset.item
     let form = getApp().globalData.formData
-    form.data.formLayoutData.formInfo.unshift({
-      label: '经销商', //标题
-      type: 'cell', //表单类型 text,upload,picker,datepicker
-      id: 'enterprisename', //表单id
-      placeholder: '', //设置文本框默认提示
-      inputValue: item.enterprisename,
-      data: [], //填充表单的数据 例如下拉框
-      role: {
-        type: 'reg',
-      },
-      force: false, //是否必输入
-    })
+    let index = form.data.formLayoutData.formInfo.findIndex(v => v.label == '经销商');
+    if (index == -1) {
+      form.data.formLayoutData.formInfo.unshift({
+        label: '经销商', //标题
+        type: 'cell', //表单类型 text,upload,picker,datepicker
+        id: 'enterprisename', //表单id
+        placeholder: '', //设置文本框默认提示
+        inputValue: item.enterprisename,
+        data: [], //填充表单的数据 例如下拉框
+        role: {
+          type: 'reg',
+        },
+        force: false, //是否必输入
+      })
+    } else {
+      form.data.formLayoutData.formInfo[index].inputValue = item.enterprisename;
+    }
     form.data.formLayoutData.formInfo.forEach(e => {
       if (e.id === 'sys_enterpriseid') {
         e.inputValue = item.sys_enterpriseid
@@ -66,7 +71,6 @@ Page({
     form.setData({
       formLayoutData: form.data.formLayoutData
     })
-
     wx.navigateBack({
       delta: 0
     })

+ 0 - 48
Eservice/workerLeader/editServiceBill/index.js

@@ -30,9 +30,7 @@ Page({
   },
 
   async onClick (data) {
-    console.log(this.data.form,'---')
     this.data.form = Object.assign({},this.data.form,data.detail)
-    console.log(this.data.form)
     const res = await api._post({
       "id": "20230206091403",
       "version":1,
@@ -57,13 +55,9 @@ Page({
       delta:0
     })
   },
-  /**
-   * 生命周期函数--监听页面加载
-   */
   onLoad(options) {
     let that = this
     let obj = getApp().globalData.handelSelect.data.orderMainData
-
     that.data.form = Object.assign({},this.data.form,obj)
     Object.keys(that.data.form).map((key,index)=>{
       that.data.data.formLayout.formInfo.forEach(e=>{
@@ -79,53 +73,11 @@ Page({
       data:that.data.data
     })
   },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow() {
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
   onHide() {
     this.compData = this.selectComponent("#form")
     // this.compData.setObjectData(this.compData.data.formLayoutData.formInfo)
   },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
   onUnload() {
     getApp().globalData.pageData = null
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh() {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom() {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage() {
-
   }
 })

+ 2 - 1
Eservice/workerLeader/editworkOrderDetail/index.json

@@ -6,6 +6,7 @@
     "t-dialog": "tdesign-miniprogram/dialog/dialog",
     "t-tabs": "tdesign-miniprogram/tabs/tabs",
     "t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel",
-    "t-cell": "tdesign-miniprogram/cell/cell"
+    "t-cell": "tdesign-miniprogram/cell/cell",
+    "product-card": "../../components/productCard/index"
   }
 }

+ 9 - 1
Eservice/workerLeader/editworkOrderDetail/index.wxml

@@ -58,7 +58,15 @@
 
   <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 wx:if="{{billData.type=='维修'}}">
+        <view class="panel">
+          <card style="margin-top:10px" wx:for="{{billData.titems}}" wx:key="itemid">
+            <product-card style="flex:1" model='3' slot="content" data="{{item}}" changeQty="{{false}}" bind:delete="deleteMaterial" bind:input="qtyChange" bind:changeItem="changeItem" />
+          </card>
+        </view>
+      </view>
+      <view wx:else 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>