Browse Source

工单确认单修改

xiaohaizhao 1 year ago
parent
commit
9fb18985a3

+ 11 - 3
Eservice/agent/addServiceBill/index.js

@@ -34,6 +34,17 @@ Page({
             "id": "20230206091403",
             "content": this.data.form
         })
+        console.log("创建", res)
+        wx.showToast({
+            title: res.msg == '成功' ? '创建成功' : res.msg,
+            icon: "none",
+            mask: true
+        })
+        if (res.msg == '成功') setTimeout(() => {
+            wx.redirectTo({
+                url: '/Eservice/agent/serviceBillDetail/index?id=' + res.data.sa_serviceorderid,
+            })
+        }, 300)
         const rs = await api._post({
             "classname": "system.attachment.Attachment",
             "method": "createFileLink",
@@ -44,9 +55,6 @@ Page({
                 "attachmentids": data.detail.attachmentids
             }
         })
-        wx.navigateBack({
-            delta: 0
-        })
     },
     // setDefaultData () {
     //   let that = this

+ 2 - 12
Eservice/agent/billCanUseProduct/index.js

@@ -61,11 +61,8 @@ Page({
   },
   onConfirm () {
     let pages = getCurrentPages();
-
     let prePage = pages[pages.length - 2];
-
     prePage.getAdd(this.data.selection)
-
     wx.navigateBack()
   },
   /**
@@ -73,16 +70,9 @@ Page({
    */
   onLoad(options) {
     let pages = getCurrentPages();
-
     let prePage = pages[pages.length - 2];
-
-    this.data.param.content.sa_serviceorderid = sa_serviceorderid
-    this.data.param.content.sa_orderid = sa_orderid
-
-    this.setData({
-      param:this.data.param
-    })
-
+    this.data.param.content.sa_serviceorderid = prePage.data.sa_serviceorderid
+    this.data.param.content.sa_orderid = prePage.data.sa_orderid
     this.listData()
   },
 

+ 1 - 2
Eservice/agent/serviceBillList/index.js

@@ -52,7 +52,6 @@ Page({
      * 生命周期函数--监听页面加载
      */
     onLoad(options) {
-        this.listData()
     },
 
     /**
@@ -66,7 +65,7 @@ Page({
      * 生命周期函数--监听页面显示
      */
     onShow() {
-
+        this.listData()
     },
 
     /**

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

@@ -182,6 +182,7 @@ Component({
         },
 
         setObjectData(data) {
+            console.log(data)
             let that = this,
                 obj = {}
             that.setData({
@@ -191,7 +192,7 @@ Component({
                 if (e.type === 'upload') {
                     obj[e.id] = that.selectComponent("#upload").handleBind();
                 } else if (e.id == "provinceArr") {
-                    let arr = obj.provinceArr.split(",");
+                    let arr = e.inputValue.split(",");
                     obj.province = arr[0] || ""
                     obj.city = arr[1] || ""
                     obj.county = arr[2] || ""

+ 58 - 56
Eservice/installConfirmBill/index.js

@@ -6,113 +6,115 @@ Page({
    * 页面的初始数据
    */
   data: {
-    timerid:null,
-    bindSignNameData:{
+    timerid: null,
+    bindSignNameData: {
       "ownertable": "sa_workorder_confirmation",
       "ownerid": 0,
       "usetype": "signature",
     },
-    paidServiceAmount:0,
-    SignName:true
+    paidServiceAmount: 0,
+    SignName: true
   },
 
-  async billData () {
+  async billData() {
     const res = await api._post({
       "id": "20230211105803",
       "content": {
-        "sa_workorder_confirmationid":this.data.id
+        "sa_workorder_confirmationid": this.data.id
       }
     })
+    console.log("123123",res.data)
     this.setData({
-      mainData:res.data,
-      sa_serviceorderid:res.data.workorder.sa_serviceorderid,
-      sa_orderid:res.data.workorder.sa_orderid,
-      stopClick:res.data.status !== '新建'?'stopClick':this.data.stopClick
+      mainData: res.data,
+      sa_serviceorderid: res.data.workorder.sa_serviceorderid,
+      sa_orderid: res.data.workorder.sa_orderid,
+      stopClick: res.data.status !== '新建' ? 'stopClick' : this.data.stopClick
     })
     this.setInputData()
   },
-  setInputData () {
+  setInputData() {
     let that = this
-    that.data.mainData.confirmationcontent.forEach(e=>{
-      
-      Object.keys(e).map((key,index)=>{
+    that.data.mainData.confirmationcontent.forEach(e => {
+
+      Object.keys(e).map((key, index) => {
         that.setData({
-          paidServiceAmount:that.data.paidServiceAmount + e[key].amount
+          paidServiceAmount: that.data.paidServiceAmount + e[key].amount
         })
         if (key.includes('是否需要拆卸配件或整拆')) {
           that.setData({
-            node1:e[key].confirm_value
+            node1: e[key].confirm_value
           })
         }
-        if(key.includes('与现场协商确认维修方案')) {
+        if (key.includes('与现场协商确认维修方案')) {
           that.setData({
-            node2:e[key].confirm_value?e[key].confirm_value:e[key].textcontent
+            node2: e[key].confirm_value ? e[key].confirm_value : e[key].textcontent
           })
         }
-        if(key.includes('实施内容')) {
+        if (key.includes('实施内容')) {
           that.setData({
-            node3:e[key].confirm_value?e[key].confirm_value:e[key].textcontent
+            node3: e[key].confirm_value ? e[key].confirm_value : e[key].textcontent
           })
         }
-        if(key.includes('与现场协商试运行')) {
+        if (key.includes('与现场协商试运行')) {
           that.setData({
-            node4:e[key].confirm_value?e[key].confirm_value:e[key].textcontent
+            node4: e[key].confirm_value ? e[key].confirm_value : e[key].textcontent
           })
         }
-        if(key.includes('现场交代事项')){
+        if (key.includes('现场交代事项')) {
           that.setData({
-            node5:e[key].confirm_value?e[key].confirm_value:e[key].textcontent
+            node5: e[key].confirm_value ? e[key].confirm_value : e[key].textcontent
           })
         }
       })
     })
   },
-  async updateBill () {
+  async updateBill() {
     if (this.data.mainData.status !== '新建') return wx.showToast({
       title: '非新建状态,修改的数据将不会保存',
-      icon:'none'
+      icon: 'none'
     })
     const res = await api._post({
       "id": "20230211105703",
       "content": this.data.mainData
     })
   },
-   // 跳转到物料添加
-   addProduct () {
+  // 跳转到物料添加
+  addProduct() {
     wx.navigateTo({
       url: '/Eservice/agent/billCanUseProduct/index',
     })
   },
   // 添加物料
   async getAdd(selection) {
-    let arr = selection.map(e=>{
+    let arr = selection.map(e => {
       return {
-        "sa_workorder_node_itemsid":0,
-        "itemid":e.itemid,
-        "qty":1
+        "sa_workorder_node_itemsid": 0,
+        "itemid": e,
+        "qty": 1
       }
     })
     this.data.mainData.trainertitems = this.data.mainData.trainertitems.concat(arr)
     this.updateMaterial(this.data.mainData.trainertitems)
   },
-  async updateMaterial (trainertitems) {
+  async updateMaterial(trainertitems) {
     const res = await api._post({
       "id": "20230215201903",
       "content": {
-        "sa_workorder_confirmationid":this.data.mainData.sa_workorder_confirmationid,
-        "sa_workorderid":this.data.mainData.workorder.sa_workorderid,
-        "iteminfos":trainertitems
+        "sa_workorder_confirmationid": this.data.mainData.sa_workorder_confirmationid,
+        "sa_workorderid": this.data.mainData.workorder.sa_workorderid,
+        "iteminfos": trainertitems
       }
     })
     this.billData()
   },
   // 删除物料
-  async deleteMaterial (data) {
-    let itemid = data.detail.sa_serviceorderitemsid
+  async deleteMaterial(data) {
+    let itemid = data.detail.sa_workorder_node_itemsid
     const res = await api._post({
-      "id": "20230206162003", 
+      "id": "20230215202003",
+      "version": 1,
       "content": {
-        "sa_serviceorderitemsids": [itemid]
+        "sa_workorder_node_itemsids": [itemid]
       }
     })
     this.billData()
@@ -121,42 +123,42 @@ Page({
   onChange(e) {
     this.data.mainData[e.currentTarget.dataset.name] = e.detail.value
     this.setData({
-      mainData:this.data.mainData
+      mainData: this.data.mainData
     });
     this.updateBill()
   },
 
-  async submit () {
+  async submit() {
     const res = await api._post({
       "id": "20230211110003",
       "content": {
-        "sa_workorder_confirmationid":this.data.mainData.sa_workorder_confirmationid
+        "sa_workorder_confirmationid": this.data.mainData.sa_workorder_confirmationid
       }
     })
     if (res.code == 1) {
       wx.showToast({
         title: '提交成功',
-        icon:"success"
+        icon: "success"
       })
       this.billData()
     }
-    
+
   },
-  async delete () {
+  async delete() {
     const res = await api._post({
       "id": "20230211110103",
       "content": {
-        "sa_workorder_confirmationids":[this.data.mainData.sa_workorder_confirmationid]
+        "sa_workorder_confirmationids": [this.data.mainData.sa_workorder_confirmationid]
       }
     })
     if (res.code == 1) {
       wx.navigateBack()
     }
   },
-  inputChange (data) {
+  inputChange(data) {
     let keyValue = data.currentTarget.dataset.name
-    this.data.mainData.confirmationcontent.forEach(e=>{
-      Object.keys(e).map((key,index)=>{
+    this.data.mainData.confirmationcontent.forEach(e => {
+      Object.keys(e).map((key, index) => {
         if (key.includes(keyValue)) {
           console.log(e)
           e[key].confirm_value = data.detail.value
@@ -165,12 +167,12 @@ Page({
     })
     this.updateBill()
   },
-  createImage () {
+  createImage() {
     let token = wx.getStorageSync('userMsg').token
     let parentid = wx.getStorageSync('siteP').appfolderid
     let url = `${getApp().globalData.http.baseUrl}/comfirmBill/#/htmlToImage?token=${token}&parentid=${parentid}&ownerid=${this.data.mainData.sa_workorder_confirmationid}`
     this.setData({
-      url:url
+      url: url
     })
     wx.navigateTo({
       url: '/Eservice/webView/index',
@@ -182,8 +184,8 @@ Page({
   onLoad(options) {
     this.data.bindSignNameData.ownerid = options.id
     this.setData({
-      id:options.id,
-      bindSignNameData:this.data.bindSignNameData
+      id: options.id,
+      bindSignNameData: this.data.bindSignNameData
     })
     this.billData()
   },
@@ -200,7 +202,7 @@ Page({
    */
   onShow() {
     this.setData({
-      SignName:true
+      SignName: true
     })
   },
 
@@ -209,7 +211,7 @@ Page({
    */
   onHide() {
     this.setData({
-      SignName:false
+      SignName: false
     })
   },
 

+ 59 - 10
Eservice/installConfirmBill/index.scss

@@ -1,32 +1,40 @@
-page{
+page {
   background-color: #f1f2f3;
 }
-.title{
+
+.title {
   font-size: 26rpx;
-  padding:10px
+  padding: 10px
 }
-.flex-around{
+
+.flex-around {
   justify-content: space-around;
 }
-.panel{
-  padding:10px;
+
+.panel {
+  padding: 10px;
   background-color: #fff;
-  
+
 }
-.mt-10{
+
+.mt-10 {
   margin-bottom: 10px;
 }
+
 .small {
   font-size: 26rpx;
   color: #333;
   line-height: 25px;
 }
-.mr-5{
+
+.mr-5 {
   margin-right: 5px;
 }
-.mt-5{
+
+.mt-5 {
   margin-bottom: 5px;
 }
+
 .demo-rate {
   background-color: #fff;
   height: 96rpx;
@@ -47,3 +55,44 @@ page{
   padding-left: 32rpx;
   border: 0;
 }
+
+.footer {
+  display: flex;
+  justify-content: space-between;
+  padding: 0 30rpx;
+  position: fixed;
+  width: 100vw;
+  height: 130rpx;
+  background: #FFFFFF;
+  box-shadow: 0px -4rpx 16rpx 2rpx rgba(150, 157, 165, 0.16);
+  bottom: 0;
+  box-sizing: border-box;
+  z-index: 9999;
+  padding-top: 10rpx;
+
+  .count {
+    height: 90rpx;
+    line-height: 90rpx;
+    font-size: 32rpx;
+    font-weight: bold;
+    color: var(--error);
+  }
+
+  .but-box {
+    .but {
+      min-width: 156rpx;
+      height: 90rpx;
+      background: #3874F6;
+      border-radius: 8rpx;
+      font-size: 28rpx;
+      font-family: PingFang SC-Bold, PingFang SC;
+      font-weight: bold;
+      color: #FFFFFF;
+      margin-left: 8rpx;
+    }
+
+    .delete {
+      background: var(--warning);
+    }
+  }
+}

+ 27 - 26
Eservice/installConfirmBill/index.wxml

@@ -25,31 +25,31 @@
     产品
   </view>
   <t-tabs defaultValue="{{1}}" t-class="custom-tabs">
-      <t-tab-panel label="产品信息" value="1">
-        <view class="panel">
-          <card style="margin-top:10px" wx:for="{{mainData.servicetitems}}" wx:key="itemid">
-            <product-card style="flex:1" slot="content" data="{{item}}" changeQty="{{false}}" bind:delete="deleteMaterial" bind:input="qtyChange"></product-card>
-          </card>
-          <view class="flex-align-center flex-around panel">
-            <t-button size="extra-small" variant="primary" bind:tap="addProduct">添加产品</t-button>
-          </view>
+    <t-tab-panel label="产品信息" value="1">
+      <view class="panel">
+        <card style="margin-top:10px" wx:for="{{mainData.trainertitems}}" wx:key="itemid">
+          <product-card style="flex:1" slot="content" data="{{item}}" changeQty="{{false}}" bind:delete="deleteMaterial" bind:input="qtyChange"></product-card>
+        </card>
+        <view class="flex-align-center flex-around panel">
+          <t-button size="extra-small" variant="primary" bind:tap="addProduct">添加产品</t-button>
         </view>
-      </t-tab-panel>
+      </view>
+    </t-tab-panel>
   </t-tabs>
   <view class="title colorInfo">
     客诉情况
   </view>
-  <t-textarea style="margin-bottom:1px" label="客诉内容" value="{{mainData.workorder.reason}}" bind:blur="inputChange" t-class="external-class" placeholder="请输入客诉内容" disableDefaultPadding="{{true}}" autosize/>
+  <t-textarea style="margin-bottom:1px" label="客诉内容" value="{{mainData.workorder.reason}}" bind:blur="inputChange" t-class="external-class" placeholder="请输入客诉内容" disableDefaultPadding="{{true}}" autosize />
   <view class="title colorInfo">
     维修信息确认
   </view>
-  <t-cell title="是否需要拆卸配件或整拆" note="{{node1}}" hover/>
-  <t-textarea style="margin-bottom:1px" label="维修方案及周期" value="{{node2}}" data-name="与现场协商确认维修方案" bind:blur="inputChange" t-class="external-class" placeholder="维修方案" disableDefaultPadding="{{true}}" autosize/>
-  <t-cell title="是否有偿服务" note="{{paidServiceAmount > 0?'是':'否'}}" hover/>
-  <t-cell title="服务金额" note="{{paidServiceAmount}}" hover/>
-  <t-textarea style="margin-bottom:1px" label="实施内容" value="{{node3}}" data-name="实施内容" bind:blur="inputChange" t-class="external-class" placeholder="实施内容" disableDefaultPadding="{{true}}" autosize/>
-  <t-textarea style="margin-bottom:1px" label="服务测试内容描述" value="{{node4}}" data-name="与现场协商试运行" bind:blur="inputChange" t-class="external-class" placeholder="服务测试内容描述" disableDefaultPadding="{{true}}" autosize/>
-  <t-textarea style="margin-bottom:1px" label="现场交代事项" value="{{node5}}" data-name="现场交代事项" bind:blur="inputChange" t-class="external-class" placeholder="现场交代事项" disableDefaultPadding="{{true}}" autosize/>
+  <t-cell title="是否需要拆卸配件或整拆" note="{{node1}}" hover />
+  <t-textarea style="margin-bottom:1px" label="维修方案及周期" value="{{node2}}" data-name="与现场协商确认维修方案" bind:blur="inputChange" t-class="external-class" placeholder="维修方案" disableDefaultPadding="{{true}}" autosize />
+  <t-cell title="是否有偿服务" note="{{paidServiceAmount > 0?'是':'否'}}" hover />
+  <t-cell title="服务金额" note="{{paidServiceAmount}}" hover />
+  <t-textarea style="margin-bottom:1px" label="实施内容" value="{{node3}}" data-name="实施内容" bind:blur="inputChange" t-class="external-class" placeholder="实施内容" disableDefaultPadding="{{true}}" autosize />
+  <t-textarea style="margin-bottom:1px" label="服务测试内容描述" value="{{node4}}" data-name="与现场协商试运行" bind:blur="inputChange" t-class="external-class" placeholder="服务测试内容描述" disableDefaultPadding="{{true}}" autosize />
+  <t-textarea style="margin-bottom:1px" label="现场交代事项" value="{{node5}}" data-name="现场交代事项" bind:blur="inputChange" t-class="external-class" placeholder="现场交代事项" disableDefaultPadding="{{true}}" autosize />
 
   <view class="title colorInfo">
     评价
@@ -73,14 +73,15 @@
       <sign-name wx:if="{{SignName}}" bindData="{{bindSignNameData}}"></sign-name>
     </view>
   </card>
-  <view class="title colorInfo">
-    其他
-  </view>
-  <t-cell title="生成单据预览图" note="点击查看" bind:click="createImage" hover arrow/>
 </view>
 
-
-<view style="padding:10px">
-  <t-button style="margin-bottom: 10px;" disabled="{{mainData.status !== '新建'?true:false}}"  variant="primary" bind:tap="submit" block>提 交</t-button>
-  <t-button disabled="{{mainData.status !== '新建'?true:false}}"  variant="danger" bind:tap="delete" block>删 除</t-button>
-</view>
+<view style="height: 130rpx;" />
+<view class="footer">
+  <view class="count">
+  </view>
+  <view class="but-box">
+    <van-button custom-class='but' bind:click="createImage">单据预览</van-button>
+    <van-button custom-class='but delete' disabled="{{mainData.status !== '新建'?true:false}}" bind:click="delete">删 除</van-button>
+    <van-button custom-class='but' disabled="{{mainData.status !== '新建'?true:false}}" bind:click="submit">提 交</van-button>
+  </view>
+</view>

+ 59 - 10
Eservice/trainConfirmBill/index.scss

@@ -1,32 +1,40 @@
-page{
+page {
   background-color: #f1f2f3;
 }
-.title{
+
+.title {
   font-size: 26rpx;
-  padding:10px
+  padding: 10px
 }
-.flex-around{
+
+.flex-around {
   justify-content: space-around;
 }
-.panel{
-  padding:10px;
+
+.panel {
+  padding: 10px;
   background-color: #fff;
-  
+
 }
-.mt-10{
+
+.mt-10 {
   margin-bottom: 10px;
 }
+
 .small {
   font-size: 26rpx;
   color: #333;
   line-height: 25px;
 }
-.mr-5{
+
+.mr-5 {
   margin-right: 5px;
 }
-.mt-5{
+
+.mt-5 {
   margin-bottom: 5px;
 }
+
 .demo-rate {
   background-color: #fff;
   height: 96rpx;
@@ -47,3 +55,44 @@ page{
   padding-left: 32rpx;
   border: 0;
 }
+
+.footer {
+  display: flex;
+  justify-content: space-between;
+  padding: 0 30rpx;
+  position: fixed;
+  width: 100vw;
+  height: 130rpx;
+  background: #FFFFFF;
+  box-shadow: 0px -4rpx 16rpx 2rpx rgba(150, 157, 165, 0.16);
+  bottom: 0;
+  box-sizing: border-box;
+  z-index: 9999;
+  padding-top: 10rpx;
+
+  .count {
+    height: 90rpx;
+    line-height: 90rpx;
+    font-size: 32rpx;
+    font-weight: bold;
+    color: var(--error);
+  }
+
+  .but-box {
+    .but {
+      min-width: 156rpx;
+      height: 90rpx;
+      background: #3874F6;
+      border-radius: 8rpx;
+      font-size: 28rpx;
+      font-family: PingFang SC-Bold, PingFang SC;
+      font-weight: bold;
+      color: #FFFFFF;
+      margin-left: 8rpx;
+    }
+
+    .delete {
+      background: var(--warning);
+    }
+  }
+}

+ 22 - 19
Eservice/trainConfirmBill/index.wxml

@@ -33,23 +33,23 @@
           <t-button size="extra-small" variant="primary" bind:tap="addTrainers">添加人员</t-button>
         </view>
       </view>
-      </t-tab-panel>
-      <t-tab-panel label="工单物料" value="1">
-        <view class="panel">
-          <card style="margin-top:10px" wx:for="{{mainData.trainertitems}}" wx:key="itemid">
-            <product-card style="flex:1" slot="content" data="{{item}}" changeQty="{{true}}" bind:delete="deleteMaterial" bind:input="qtyChange"></product-card>
-          </card>
-          <view class="flex-align-center flex-around panel">
-            <t-button size="extra-small" variant="primary" bind:tap="addProduct">添加物料</t-button>
-          </view>
+    </t-tab-panel>
+    <t-tab-panel label="工单物料" value="1">
+      <view class="panel">
+        <card style="margin-top:10px" wx:for="{{mainData.trainertitems}}" wx:key="itemid">
+          <product-card style="flex:1" slot="content" data="{{item}}" changeQty="{{true}}" bind:delete="deleteMaterial" bind:input="qtyChange"></product-card>
+        </card>
+        <view class="flex-align-center flex-around panel">
+          <t-button size="extra-small" variant="primary" bind:tap="addProduct">添加物料</t-button>
         </view>
-      </t-tab-panel>
+      </view>
+    </t-tab-panel>
   </t-tabs>
   <view class="title colorInfo">
     工序内容填写
   </view>
-  <t-textarea style="margin-bottom:1px" label="现场培训内容" data-name="现场培训内容" value="{{trainerContent}}" bind:blur="inputChange" t-class="external-class" placeholder="请输入现场培训内容" disableDefaultPadding="{{true}}" autosize/>
-  <t-textarea label="现场互动及测试培训效果" data-name="现场互动及测试培训效果" value="{{trainerResult}}" bind:blur="inputChange" t-class="external-class" placeholder="请输入现场互动及测试培训效果" disableDefaultPadding="{{true}}" autosize/>
+  <t-textarea style="margin-bottom:1px" label="现场培训内容" data-name="现场培训内容" value="{{trainerContent}}" bind:blur="inputChange" t-class="external-class" placeholder="请输入现场培训内容" disableDefaultPadding="{{true}}" autosize />
+  <t-textarea label="现场互动及测试培训效果" data-name="现场互动及测试培训效果" value="{{trainerResult}}" bind:blur="inputChange" t-class="external-class" placeholder="请输入现场互动及测试培训效果" disableDefaultPadding="{{true}}" autosize />
   <view class="title colorInfo">
     评价
   </view>
@@ -72,13 +72,16 @@
       <sign-name wx:if="{{SignName}}" bindData="{{bindSignNameData}}"></sign-name>
     </view>
   </card>
-  <view class="title colorInfo">
-    其他
-  </view>
-  <t-cell title="生成单据预览图" note="点击查看" hover arrow bind:click="createImage"/>
 </view>
 
-<view wx:if="{{stopClick === 'undefined'}}" class="{{stopClick === 'undefined'}}" style="padding:10px">
-  <t-button style="margin-bottom: 10px;" disabled="{{mainData.status !== '新建'?true:false}}"  variant="primary" bind:tap="submit" block>提 交</t-button>
-  <t-button disabled="{{mainData.status !== '新建'?true:false}}"  variant="danger" bind:tap="delete" block>删 除</t-button>
+
+<view style="height: 130rpx;" />
+<view class="footer">
+  <view class="count">
+  </view>
+  <view class="but-box">
+    <van-button custom-class='but delete' disabled="{{mainData.status !== '新建'?true:false}}" bind:click="delete">删 除</van-button>
+    <van-button custom-class='but' bind:click="createImage">单据预览</van-button>
+    <van-button custom-class='but'  disabled="{{mainData.status !== '新建'?true:false}}" bind:click="submit">提 交</van-button>
+  </view>
 </view>