123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- // pages/agent/serviceBillDetail/index.js
- import api from '../../api/api'
- import Dialog from 'weui-miniprogram/dialog/index';
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- refresh:true,
- orderMainData:{},
- list:[]
- },
- async mainData () {
- const res = await api._post({
- "id": "20230206091603",
- "version":1,
- "content": {
- "sa_serviceorderid":this.data.id
- }
- })
- this.setData({
- orderMainData:res.data
- })
- this.fileData()
- this.linkWorkOrder()
- },
- async fileData () {
- const res = await api._post({
- "method": "queryFileLink",
- "classname": "system.attachment.Attachment",
- "content": {
- "ownertable": "sa_serviceorder",
- "ownerid": this.data.id,
- "usetype":"附件"//传空返回有所
- }
- })
- this.setData({
- filelist:res.data,
- refresh:true
- })
- },
- addProduct () {
- wx.navigateTo({
- url: '/pages/saler/billCanUseProduct/index',
- })
- },
- async getAdd(selection) {
- const res = await api._post({
- "id": "20230206161803",
- "version": 1,
- "content": {
- "sa_serviceorderid": this.data.id,
- "iteminfos":selection.map(e=>{
- return {
- "sa_serviceorderitemsid": 0,
- "itemid": e,
- "reason": ""
- }
- })
- }
- })
- this.productmx()
- },
- async productmx () {
- const res = await api._post({
- "id": "20230206161903",
- "version": 1,
- "content": {
- "sa_serviceorderid": this.data.id
- }
- })
- this.setData({
- list:res.data
- })
- },
- async onDelete (data) {
- let itemid = data.detail.sa_serviceorderitemsid
- const res = await api._post({
- "id": "20230206162003",
- "content": {
- "sa_serviceorderitemsids": [itemid]
- }
- })
- this.productmx()
- },
- onEdit () {
- getApp().globalData.handelSelect = this
- wx.navigateTo({
- url: '/pages/saler/editServiceBill/index',
- })
- },
- onSubmit() {
- let that = this
- const dialogConfig = {
- context: this,
- title: '提示',
- content: '确认提交当前申请单吗',
- confirmBtn: '确定',
- cancelBtn: '取消',
- };
- Dialog.confirm(dialogConfig)
- .then(async () => {
- const res = await api._post({
- "id": "20230206101403",
- "version":1,
- "content": {
- "sa_serviceorderid":that.data.id,
- "issumbit":1,
- }
- })
- that.mainData()
- })
- .catch((err) => console.log(err))
- .finally(() => Dialog.close());
- },
- onDelete() {
- let that = this
- const dialogConfig = {
- context: this,
- title: '提示',
- content: '确认删除当前申请单吗',
- confirmBtn: '确定',
- cancelBtn: '取消',
- };
- Dialog.confirm(dialogConfig)
- .then(async () => {
- const res = await api._post({
- "id": "20230206091803",
- "version":1,
- "content": {
- "sa_serviceorderids":[that.data.id],
- }
- })
- wx.navigateBack()
-
- })
- .catch((err) => console.log(err))
- .finally(() => Dialog.close());
- },
- async linkWorkOrder() {
- const res = await api._post({
- "id": "20230207154203",
- "version":1,
- "content": {
- "sa_serviceorderid":this.data.id
- }
- })
- this.setData({
- linkWorkOrders:res.data
- })
- },
- tolinkWorkOrder (e) {
- let id = e.currentTarget.dataset.item.sa_workorderid
- let app = getApp()
- app.globalData.action = ['editLeader']
- wx.navigateTo({
- url: '/pages/workOrderDetail/index?class=stopClick&id=' + id
- })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- this.setData({
- id:options.id
- })
-
- this.productmx()
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- this.mainData()
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|