|
|
@@ -15,6 +15,14 @@ Page({
|
|
|
bgColor: "#FCE4E4",
|
|
|
color: "#ED4949"
|
|
|
},
|
|
|
+ 紧急: {
|
|
|
+ bgColor: "#FCE4E4",
|
|
|
+ color: "#ED4949"
|
|
|
+ },
|
|
|
+ 历史售后: {
|
|
|
+ bgColor: "#eeeeee",
|
|
|
+ color: "#888888"
|
|
|
+ }
|
|
|
},
|
|
|
tabsList: [{
|
|
|
label: "服务商品",
|
|
|
@@ -23,7 +31,11 @@ Page({
|
|
|
}, {
|
|
|
label: "工单信息"
|
|
|
}],
|
|
|
- tabsActive: 2
|
|
|
+ tabsActive: 2,
|
|
|
+ reason: {
|
|
|
+ abortreason: ""
|
|
|
+ },
|
|
|
+ abortreasonShow: false
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
getApp().globalData.Language.getLanguagePackage(this, '工单详情');
|
|
|
@@ -49,6 +61,259 @@ Page({
|
|
|
detail: res.data
|
|
|
})
|
|
|
this.setPreview(res);
|
|
|
+ this.setTabbar()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onCancel() {
|
|
|
+ this.setData({
|
|
|
+ abortreasonShow: false,
|
|
|
+ backreasonShow: false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 中止
|
|
|
+ onSuspend() {
|
|
|
+ let abortreason = this.data.reason.abortreason;
|
|
|
+ if (abortreason == '') return wx.showToast({
|
|
|
+ title: getApp().globalData.Language.getMapText("请说明中止原因"),
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ _Http.basic({
|
|
|
+ "content": {
|
|
|
+ "sa_serviceorderid": this.data.detail.sa_serviceorderid,
|
|
|
+ abortreason
|
|
|
+ },
|
|
|
+ "id": 2026012714282702,
|
|
|
+ }).then(res => {
|
|
|
+ getApp().globalData.Language.showToast(res.code == '1' ? "中止成功" : res.msg)
|
|
|
+ if (res.code == 1) this.getDetail();
|
|
|
+ })
|
|
|
+ },
|
|
|
+ tabbarOnClick(e) {
|
|
|
+ let that = this,
|
|
|
+ detail = this.data.detail;
|
|
|
+ switch (e.detail.label) {
|
|
|
+ case '转工单':
|
|
|
+ let leader = '';
|
|
|
+ try {
|
|
|
+ leader = detail.team.find(v => v.isleader).userid || 0
|
|
|
+ } catch (error) {
|
|
|
+
|
|
|
+ }
|
|
|
+ _Http.basic({
|
|
|
+ id: 20230213143003,
|
|
|
+ content: {
|
|
|
+ pageSize: 9999
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log("转工单", res)
|
|
|
+ if (res.code != '1') return wx.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ users: res.data.map(v => {
|
|
|
+ v.disabled = v.userid == leader
|
|
|
+ return v
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case '编辑':
|
|
|
+ wx.navigateTo({
|
|
|
+ url: `/E-service/workOrder/insert`
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case '接单':
|
|
|
+ wx.navigateTo({
|
|
|
+ url: `/E-service/workOrder/takeOrder`
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case '中止':
|
|
|
+ this.setData({
|
|
|
+ abortreasonShow: true
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case '暂停':
|
|
|
+ wx.showModal({
|
|
|
+ title: getApp().globalData.Language.getMapText('提示'),
|
|
|
+ content: getApp().globalData.Language.getMapText(`确认暂停当前工单吗`) + '?',
|
|
|
+ confirmBtn: getApp().globalData.Language.getMapText('确定'),
|
|
|
+ cancelBtn: getApp().globalData.Language.getMapText('取消'),
|
|
|
+ complete: ({
|
|
|
+ confirm
|
|
|
+ }) => {
|
|
|
+ if (confirm) _Http.basic({
|
|
|
+ "content": {
|
|
|
+ "sa_workorderid": detail.sa_workorderid
|
|
|
+ },
|
|
|
+ "id": "20230209144603",
|
|
|
+ }).then(res => {
|
|
|
+ getApp().globalData.Language.showToast(res.code == '1' ? "暂停成功" : res.msg)
|
|
|
+ that.getDetail()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case '完结工单':
|
|
|
+ wx.showModal({
|
|
|
+ title: getApp().globalData.Language.getMapText('提示'),
|
|
|
+ content: getApp().globalData.Language.getMapText(`确认完结工单吗`) + '?',
|
|
|
+ confirmBtn: getApp().globalData.Language.getMapText('确定'),
|
|
|
+ cancelBtn: getApp().globalData.Language.getMapText('取消'),
|
|
|
+ complete: ({
|
|
|
+ confirm
|
|
|
+ }) => {
|
|
|
+ if (confirm) _Http.basic({
|
|
|
+ "content": {
|
|
|
+ "sa_workorderid": detail.sa_workorderid
|
|
|
+ },
|
|
|
+ "id": "20230209144903",
|
|
|
+ }).then(res => {
|
|
|
+ getApp().globalData.Language.showToast(res.code == '1' ? "完结成功" : res.msg)
|
|
|
+ that.getDetail()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case '开始工单':
|
|
|
+ wx.showModal({
|
|
|
+ title: getApp().globalData.Language.getMapText('提示'),
|
|
|
+ content: getApp().globalData.Language.getMapText(`确认开始工单吗`) + '?',
|
|
|
+ confirmBtn: getApp().globalData.Language.getMapText('确定'),
|
|
|
+ cancelBtn: getApp().globalData.Language.getMapText('取消'),
|
|
|
+ complete: ({
|
|
|
+ confirm
|
|
|
+ }) => {
|
|
|
+ if (confirm) _Http.basic({
|
|
|
+ "content": {
|
|
|
+ "sa_workorderid": detail.sa_workorderid
|
|
|
+ },
|
|
|
+ "id": "20230209144503",
|
|
|
+ }).then(res => {
|
|
|
+ getApp().globalData.Language.showToast(res.code == '1' ? "开始成功" : res.msg)
|
|
|
+ that.getDetail()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case '启用':
|
|
|
+ wx.showModal({
|
|
|
+ title: getApp().globalData.Language.getMapText('提示'),
|
|
|
+ content: getApp().globalData.Language.getMapText(`确认启用当前工单吗`) + '?',
|
|
|
+ confirmBtn: getApp().globalData.Language.getMapText('确定'),
|
|
|
+ cancelBtn: getApp().globalData.Language.getMapText('取消'),
|
|
|
+ complete: ({
|
|
|
+ confirm
|
|
|
+ }) => {
|
|
|
+ if (confirm) _Http.basic({
|
|
|
+ "content": {
|
|
|
+ "sa_workorderid": detail.sa_workorderid
|
|
|
+ },
|
|
|
+ "id": "20230209144703",
|
|
|
+ }).then(res => {
|
|
|
+ getApp().globalData.Language.showToast(res.code == '1' ? "启用成功" : res.msg)
|
|
|
+ that.getDetail()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onSelectLeader({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ const that = this;
|
|
|
+ wx.showModal({
|
|
|
+ title: getApp().globalData.Language.getMapText('提示'),
|
|
|
+ content: getApp().globalData.Language.getMapText(`是否确认选择`) + getApp().globalData.Language.getMapText(detail.name) + getApp().globalData.Language.getMapText(`执行工单`) + '?',
|
|
|
+ confirmBtn: getApp().globalData.Language.getMapText('确定'),
|
|
|
+ cancelBtn: getApp().globalData.Language.getMapText('取消'),
|
|
|
+ complete: ({
|
|
|
+ confirm
|
|
|
+ }) => {
|
|
|
+ if (confirm) _Http.basic({
|
|
|
+ "content": {
|
|
|
+ "sa_workorderid": that.data.detail.sa_workorderid,
|
|
|
+ "userid": detail.userid
|
|
|
+ },
|
|
|
+ "id": 2026012714183302,
|
|
|
+ }).then(res => {
|
|
|
+ getApp().globalData.Language.showToast(res.code == '1' ? "操作成功" : res.msg)
|
|
|
+ if (res.code == 1) {
|
|
|
+ that.getDetail()
|
|
|
+ that.clearUsers()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ clearUsers() {
|
|
|
+ this.setData({
|
|
|
+ "users": []
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /* 底部功能 */
|
|
|
+ async setTabbar() {
|
|
|
+ let status = this.data.detail.status,
|
|
|
+ tabbarList = [];
|
|
|
+ let options = {
|
|
|
+ 编辑: {
|
|
|
+ icon: "icon-bianji2",
|
|
|
+ label: "编辑"
|
|
|
+ },
|
|
|
+ 转工单: {
|
|
|
+ icon: "icon-dibu-biangengchengjiaozhuangtai",
|
|
|
+ label: "转工单"
|
|
|
+ },
|
|
|
+ 接单: {
|
|
|
+ icon: "icon-a-tonggaoshujuxiazailiang",
|
|
|
+ label: "接单"
|
|
|
+ },
|
|
|
+ 开始工单: {
|
|
|
+ icon: "icon-huifu1",
|
|
|
+ label: "开始工单"
|
|
|
+ },
|
|
|
+ 暂停: {
|
|
|
+ icon: "icon-zanhuan",
|
|
|
+ label: "暂停"
|
|
|
+ },
|
|
|
+ 完结工单: {
|
|
|
+ icon: "icon-dibu-chengjiao",
|
|
|
+ label: "完结工单"
|
|
|
+ },
|
|
|
+ 启用: {
|
|
|
+ icon: "icon-quxiaozanhuan",
|
|
|
+ label: "启用"
|
|
|
+ },
|
|
|
+ 中止: {
|
|
|
+ icon: "icon-zhongzhi",
|
|
|
+ label: "中止"
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ let userMsg = wx.getStorageSync("userMsg"),
|
|
|
+ isAdmin = userMsg.hrid == 0 && userMsg.usertype == 0;
|
|
|
+ /* '确认信息',
|
|
|
+ '确认信息', */
|
|
|
+ let statusOptions = {
|
|
|
+ 待接单: ['编辑', '转工单', '接单', '中止'],
|
|
|
+ 待开始: ['编辑', '开始工单', '中止'],
|
|
|
+ 进行中: ['编辑', '完结工单', '暂停', '中止'],
|
|
|
+ 暂停: ['编辑', '启用', '中止'],
|
|
|
+ };
|
|
|
+
|
|
|
+ /* if (isAdmin) {
|
|
|
+ statusOptions.新建 = [];
|
|
|
+ statusOptions.已提交 = [];
|
|
|
+ } */
|
|
|
+ /* const appAuth = wx.getStorageSync('auth').applyBill;
|
|
|
+ appAuth.optionnames = ['查询', '转工单', '退回', '中止']
|
|
|
+ statusOptions.已提交 = appAuth.optionnames.filter(v => ['转工单', '退回', '中止'].includes(v)) */
|
|
|
+ if (statusOptions[status]) {
|
|
|
+ tabbarList = statusOptions[status].map(v => options[v]);
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ tabbarList
|
|
|
})
|
|
|
},
|
|
|
setPreview(res) {
|
|
|
@@ -208,5 +473,26 @@ Page({
|
|
|
wx.makePhoneCall({
|
|
|
phoneNumber: e.currentTarget.dataset.number
|
|
|
})
|
|
|
+ },
|
|
|
+ onUnload() {
|
|
|
+ getCurrentPages().forEach(page => {
|
|
|
+ if (page.__route__ == 'E-service/workOrder/index') {
|
|
|
+ let content = JSON.parse(JSON.stringify(page.data.content));
|
|
|
+ content.pageSize = (content.pageNumber - 1) * content.pageSize;
|
|
|
+ content.pageNumber = 1;
|
|
|
+ _Http.basic({
|
|
|
+ id: page.data.id,
|
|
|
+ content
|
|
|
+ }).then(res => {
|
|
|
+ console.log("更新列表", res);
|
|
|
+ if (res.code == '1') {
|
|
|
+ page.setData({
|
|
|
+ list: res.data,
|
|
|
+ "content.total": res.total
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {}
|
|
|
+ })
|
|
|
}
|
|
|
})
|