|
@@ -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
|
|
|
})
|
|
|
},
|
|
|
|