|
|
@@ -0,0 +1,565 @@
|
|
|
+const _Http = getApp().globalData.http,
|
|
|
+ getTime = require("../../utils/getTime");
|
|
|
+
|
|
|
+Page({
|
|
|
+ data: {
|
|
|
+ loading: false,
|
|
|
+ showAll: false,
|
|
|
+ disabled: true,
|
|
|
+ form: [{
|
|
|
+ label: "服务类型",
|
|
|
+ error: false,
|
|
|
+ errMsg: "",
|
|
|
+ hint: "",
|
|
|
+ type: "radio",
|
|
|
+ value: "",
|
|
|
+ interrupt: true,
|
|
|
+ radioList: [],
|
|
|
+ valueName: "servicetype", //绑定的字段名称
|
|
|
+ required: true, //必填
|
|
|
+ checking: `base`,
|
|
|
+ }, {
|
|
|
+ label: "单据日期",
|
|
|
+ error: false,
|
|
|
+ errMsg: "",
|
|
|
+ type: "date",
|
|
|
+ value: getTime.formatTime(new Date(), '-').split(' ')[0],
|
|
|
+ placeholder: "请选择日期",
|
|
|
+ valueName: "billdate",
|
|
|
+ required: true,
|
|
|
+ }, {
|
|
|
+ label: "省市县",
|
|
|
+ error: false,
|
|
|
+ errMsg: "",
|
|
|
+ type: "region",
|
|
|
+ value: [],
|
|
|
+ placeholder: "省,市,县",
|
|
|
+ valueName: "region",
|
|
|
+ required: true
|
|
|
+ }, {
|
|
|
+ label: "详细地址",
|
|
|
+ error: false,
|
|
|
+ errMsg: "",
|
|
|
+ type: "textarea",
|
|
|
+ value: "",
|
|
|
+ placeholder: "例: 科创园11栋1103室",
|
|
|
+ valueName: "address",
|
|
|
+ required: true,
|
|
|
+ checking: "base"
|
|
|
+ }, {
|
|
|
+ label: "现场联系人",
|
|
|
+ error: false,
|
|
|
+ errMsg: "",
|
|
|
+ type: "text",
|
|
|
+ value: "",
|
|
|
+ placeholder: "现场联系人",
|
|
|
+ valueName: "scenecontact",
|
|
|
+ required: true,
|
|
|
+ checking: "base"
|
|
|
+ }, {
|
|
|
+ label: "身份备注",
|
|
|
+ error: false,
|
|
|
+ errMsg: "",
|
|
|
+ type: "text",
|
|
|
+ value: "",
|
|
|
+ placeholder: "现场联系人身份备注",
|
|
|
+ valueName: "scenecontactrole",
|
|
|
+ required: false,
|
|
|
+ checking: "base"
|
|
|
+ }, {
|
|
|
+ label: "现场联系人电话",
|
|
|
+ error: false,
|
|
|
+ errMsg: "",
|
|
|
+ type: "number",
|
|
|
+ value: "",
|
|
|
+ placeholder: "联系人手机号码",
|
|
|
+ valueName: "scenecontactphonenumber",
|
|
|
+ required: true,
|
|
|
+ checking: "phone"
|
|
|
+ }, {
|
|
|
+ label: "应用系统",
|
|
|
+ error: false,
|
|
|
+ errMsg: "",
|
|
|
+ hint: "",
|
|
|
+ type: "radio",
|
|
|
+ value: "",
|
|
|
+ interrupt: false,
|
|
|
+ radioList: [],
|
|
|
+ valueName: "class1", //绑定的字段名称
|
|
|
+ required: true, //必填
|
|
|
+ checking: `base`,
|
|
|
+ }, {
|
|
|
+ label: "客诉大类",
|
|
|
+ error: false,
|
|
|
+ errMsg: "",
|
|
|
+ hint: "",
|
|
|
+ type: "radio",
|
|
|
+ value: "",
|
|
|
+ interrupt: false,
|
|
|
+ radioList: [],
|
|
|
+ valueName: "class2", //绑定的字段名称
|
|
|
+ required: true, //必填
|
|
|
+ checking: `base`,
|
|
|
+ }, {
|
|
|
+ label: "问题描述",
|
|
|
+ error: false,
|
|
|
+ errMsg: "",
|
|
|
+ type: "reason",
|
|
|
+ value: "",
|
|
|
+ placeholder: "请填写",
|
|
|
+ valueName: "reason",
|
|
|
+ required: true,
|
|
|
+ checking: "base"
|
|
|
+ }, {
|
|
|
+ label: "服务开始时间",
|
|
|
+ error: false,
|
|
|
+ errMsg: "",
|
|
|
+ type: "date",
|
|
|
+ value: '',
|
|
|
+ placeholder: "请选择服务开始时间",
|
|
|
+ valueName: "begdate",
|
|
|
+ required: true,
|
|
|
+ }, {
|
|
|
+ label: "服务结束时间",
|
|
|
+ error: false,
|
|
|
+ errMsg: "",
|
|
|
+ type: "date",
|
|
|
+ value: '',
|
|
|
+ placeholder: "请选择服务结束时间",
|
|
|
+ valueName: "enddate",
|
|
|
+ required: true,
|
|
|
+ }, {
|
|
|
+ label: "异常类型",
|
|
|
+ error: false,
|
|
|
+ errMsg: "",
|
|
|
+ hint: "",
|
|
|
+ type: "radio",
|
|
|
+ value: "",
|
|
|
+ interrupt: false,
|
|
|
+ radioList: [],
|
|
|
+ valueName: "exception_type", //绑定的字段名称
|
|
|
+ required: true, //必填
|
|
|
+ checking: `base`,
|
|
|
+ }, {
|
|
|
+ label: "服务等级",
|
|
|
+ error: false,
|
|
|
+ errMsg: "",
|
|
|
+ hint: "",
|
|
|
+ type: "radio",
|
|
|
+ value: "",
|
|
|
+ interrupt: false,
|
|
|
+ radioList: [],
|
|
|
+ valueName: "service_level", //绑定的字段名称
|
|
|
+ required: true, //必填
|
|
|
+ checking: `base`,
|
|
|
+ }, {
|
|
|
+ label: "评估意见",
|
|
|
+ error: false,
|
|
|
+ errMsg: "",
|
|
|
+ type: "textarea",
|
|
|
+ value: "",
|
|
|
+ placeholder: "请填写",
|
|
|
+ valueName: "evaluation_comment",
|
|
|
+ required: false,
|
|
|
+ checking: "base"
|
|
|
+ }, {
|
|
|
+ label: "备注",
|
|
|
+ error: false,
|
|
|
+ errMsg: "",
|
|
|
+ type: "textarea",
|
|
|
+ value: "",
|
|
|
+ placeholder: "请填写",
|
|
|
+ valueName: "remarks",
|
|
|
+ required: false,
|
|
|
+ checking: "base"
|
|
|
+ }],
|
|
|
+ "content": {
|
|
|
+ "sa_serviceorderid": "0"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onLoad(options) {
|
|
|
+ getApp().globalData.Language.getLanguagePackage(this, '新建申请单');
|
|
|
+ this.setData({
|
|
|
+ type: options.type || "default"
|
|
|
+ })
|
|
|
+ console.log("options.type", options.type)
|
|
|
+ if (options.type == 'admin') {
|
|
|
+ this.data.form.unshift({
|
|
|
+ label: "企业名称",
|
|
|
+ error: false,
|
|
|
+ errMsg: "",
|
|
|
+ type: "route",
|
|
|
+ url: "/select/agent/index",
|
|
|
+ params: {
|
|
|
+ "id": "20220920083901",
|
|
|
+ "content": {
|
|
|
+ "nocache": true,
|
|
|
+ "pageSize": 20,
|
|
|
+ "pageNumber": 1,
|
|
|
+ "where": {
|
|
|
+ "condition": "",
|
|
|
+ "type": 17
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ query: '&radio=true&idname=sys_enterpriseid',
|
|
|
+ value: "",
|
|
|
+ placeholder: "选择企业",
|
|
|
+ valueName: "sys_enterpriseid",
|
|
|
+ checking: "base",
|
|
|
+ required: true,
|
|
|
+ interrupt: true
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ form: this.data.form
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ this.getOptions()
|
|
|
+ this.setOrdeForm();
|
|
|
+ },
|
|
|
+ submit() {
|
|
|
+ this.setData({
|
|
|
+ loading: true
|
|
|
+ })
|
|
|
+ let content = {
|
|
|
+ ...this.data.content,
|
|
|
+ ...this.selectComponent("#Form").submit()
|
|
|
+ };
|
|
|
+ content.province = content.region[0] || "";
|
|
|
+ content.city = content.region[1] || "";
|
|
|
+ content.county = content.region[2] || "";
|
|
|
+ delete content.region
|
|
|
+ try {
|
|
|
+ if (content.sa_orderid.length) {
|
|
|
+ content.sa_orderid = content.sa_orderid[1][0]
|
|
|
+ } else {
|
|
|
+ content.sa_orderid = 0
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ content.sa_orderid = 0
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ if (content.sys_enterpriseid.length) {
|
|
|
+ content.sys_enterpriseid = content.sys_enterpriseid[1][0]
|
|
|
+ } else {
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ }
|
|
|
+
|
|
|
+ _Http.basic({
|
|
|
+ "id": "20230206091403",
|
|
|
+ content
|
|
|
+ }).then(res => {
|
|
|
+ this.setData({
|
|
|
+ loading: false
|
|
|
+ })
|
|
|
+ console.log("创建申请单", res)
|
|
|
+ if (res.code == 1) {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: `/E-service/serviceBillList/detail?id=${res.data.sa_serviceorderid}&type=${this.data.type}`,
|
|
|
+ success: () => {
|
|
|
+ wx.showToast({
|
|
|
+ title: getApp().globalData.Language.getMapText(content.sa_serviceorderid == 0 ? '创建成功' : '保存成功'),
|
|
|
+ icon: "none",
|
|
|
+ })
|
|
|
+ },
|
|
|
+ })
|
|
|
+
|
|
|
+ } else {
|
|
|
+ wx.showToast({
|
|
|
+ title: res.code != '1' ? res.msg : getApp().globalData.Language.getMapText('保存成功'),
|
|
|
+ icon: "none",
|
|
|
+ mask: true
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ interrupt({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ if (detail.data.valueName == "servicetype") {
|
|
|
+ detail.form[detail.form.findIndex(v => v.valueName == 'servicetype')] = detail.data;
|
|
|
+ this.setData({
|
|
|
+ form: detail.form
|
|
|
+ })
|
|
|
+ this.setOrdeForm();
|
|
|
+ } else if (detail.temporary.item.valueName == "sys_enterpriseid") {
|
|
|
+ detail.form[detail.form.findIndex(v => v.valueName == 'sys_enterpriseid')].value = detail.data.value;
|
|
|
+ this.setData({
|
|
|
+ form: detail.form
|
|
|
+ })
|
|
|
+ this.setOrdeForm();
|
|
|
+ wx.navigateBack()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ setOrdeForm(e) {
|
|
|
+ let value = this.data.form.find(v => v.valueName == 'servicetype').value,
|
|
|
+ type = this.data.type,
|
|
|
+ form = this.data.form;
|
|
|
+ if (['售中', '售后'].includes(value)) {
|
|
|
+ if (type == 'default') {
|
|
|
+ // 选择自己企业的订单
|
|
|
+ if (!form.some(v => v.valueName == 'sa_orderid')) form.splice(form.findIndex(v => v.valueName == 'billdate'), 0, {
|
|
|
+ label: "订单号",
|
|
|
+ error: false,
|
|
|
+ errMsg: "",
|
|
|
+ type: "route",
|
|
|
+ url: "/packageA/toolBill/modules/selectOrder/index",
|
|
|
+ params: {
|
|
|
+ "id": "20230206091503",
|
|
|
+ "content": {
|
|
|
+ "pageSize": 20,
|
|
|
+ "pageNumber": 1
|
|
|
+ }
|
|
|
+ },
|
|
|
+ query: '&radio=true',
|
|
|
+ value: "",
|
|
|
+ placeholder: "选择订单号",
|
|
|
+ valueName: "sa_orderid",
|
|
|
+ checking: "base",
|
|
|
+ required: true
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ let sys_enterpriseid = form[0].value
|
|
|
+ // 选择其他其他的订单
|
|
|
+ form.splice(form.findIndex(v => v.valueName == 'servicetype') + 1, form.some(v => v.valueName == 'sa_orderid') ? 1 : 0, {
|
|
|
+ label: "订单号",
|
|
|
+ error: false,
|
|
|
+ errMsg: "",
|
|
|
+ type: "route",
|
|
|
+ url: "/packageA/toolBill/modules/selectOrder/index",
|
|
|
+ params: {
|
|
|
+ "id": "20230206091503",
|
|
|
+ "content": {
|
|
|
+ "pageSize": 20,
|
|
|
+ "pageNumber": 1,
|
|
|
+ "sys_enterpriseid": sys_enterpriseid.length ? sys_enterpriseid[1][0] : '',
|
|
|
+ "where": {
|
|
|
+ "condition": ""
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ query: '&radio=true',
|
|
|
+ value: "",
|
|
|
+ placeholder: "选择订单号",
|
|
|
+ valueName: "sa_orderid",
|
|
|
+ disabled: sys_enterpriseid.length == 0,
|
|
|
+ checking: "base",
|
|
|
+ required: true
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ form
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.setData({
|
|
|
+ form: this.data.form.filter(v => v.valueName != 'sa_orderid')
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getOptions() {
|
|
|
+ let form = this.data.form;
|
|
|
+ // 服务类型
|
|
|
+ let servicetypes = _Http.servicetypes || [];
|
|
|
+ if (!servicetypes.length) {
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20230206112003,
|
|
|
+ "content": {},
|
|
|
+ }).then(res => {
|
|
|
+ console.log("服务类型", res)
|
|
|
+ if (res.code == 1) {
|
|
|
+ servicetypes = res.data.map(v => {
|
|
|
+ return {
|
|
|
+ id: v.value,
|
|
|
+ name: v.value,
|
|
|
+ }
|
|
|
+ });
|
|
|
+ let data = form.find(v => v.valueName == 'servicetype');
|
|
|
+ data.radioList = servicetypes;
|
|
|
+ data.value = data.value || servicetypes[0].id;
|
|
|
+ _Http.servicetypes = servicetypes;
|
|
|
+ this.setData({
|
|
|
+ form
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ let data = form.find(v => v.valueName == 'servicetype');
|
|
|
+ data.radioList = servicetypes;
|
|
|
+ data.value = data.value || servicetypes[0].id;
|
|
|
+ this.setData({
|
|
|
+ form
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // 应用系统
|
|
|
+ let class1s = _Http.class1s || [];
|
|
|
+ if (!class1s.length) {
|
|
|
+ _Http.basic({
|
|
|
+ "classname": "sysmanage.develop.optiontype.optiontype",
|
|
|
+ "method": "optiontypeselect",
|
|
|
+ "content": {
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 1000,
|
|
|
+ "typename": "systemapp",
|
|
|
+ },
|
|
|
+ }).then(res => {
|
|
|
+ console.log("应用系统", res)
|
|
|
+ if (res.code == 1) {
|
|
|
+ class1s = res.data.map(v => {
|
|
|
+ return {
|
|
|
+ id: v.value,
|
|
|
+ name: v.value,
|
|
|
+ }
|
|
|
+ });
|
|
|
+ let data = form.find(v => v.valueName == 'class1');
|
|
|
+ data.radioList = class1s;
|
|
|
+ data.value = data.value || class1s[0].id;
|
|
|
+ _Http.class1s = class1s;
|
|
|
+ this.setData({
|
|
|
+ form
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ let data = form.find(v => v.valueName == 'class1');
|
|
|
+ data.radioList = class1s;
|
|
|
+ data.value = data.value || class1s[0].id;
|
|
|
+ this.setData({
|
|
|
+ form
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // 客诉大类
|
|
|
+ let class2s = _Http.class2s || [];
|
|
|
+ if (!class2s.length) {
|
|
|
+ _Http.basic({
|
|
|
+ "classname": "sysmanage.develop.optiontype.optiontype",
|
|
|
+ "method": "optiontypeselect",
|
|
|
+ "content": {
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 1000,
|
|
|
+ "typename": "customerclass",
|
|
|
+ },
|
|
|
+ }).then(res => {
|
|
|
+ console.log("客诉大类", res)
|
|
|
+ if (res.code == 1) {
|
|
|
+ class2s = res.data.map(v => {
|
|
|
+ return {
|
|
|
+ id: v.value,
|
|
|
+ name: v.value,
|
|
|
+ }
|
|
|
+ });
|
|
|
+ let data = form.find(v => v.valueName == 'class2');
|
|
|
+ data.radioList = class2s;
|
|
|
+ data.value = data.value || class2s[0].id;
|
|
|
+ _Http.class2s = class2s;
|
|
|
+ this.setData({
|
|
|
+ form
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ let data = form.find(v => v.valueName == 'class2');
|
|
|
+ data.radioList = class2s;
|
|
|
+ data.value = data.value || class2s[0].id;
|
|
|
+ this.setData({
|
|
|
+ form
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // 异常类型
|
|
|
+ let exception_types = _Http.exception_types || [];
|
|
|
+ if (!exception_types.length) {
|
|
|
+ _Http.basic({
|
|
|
+ "classname": "sysmanage.develop.optiontype.optiontype",
|
|
|
+ "method": "optiontypeselect",
|
|
|
+ "content": {
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 1000,
|
|
|
+ "typename": "exceptiontype",
|
|
|
+ },
|
|
|
+ }).then(res => {
|
|
|
+ console.log("异常类型", res)
|
|
|
+ if (res.code == 1) {
|
|
|
+ exception_types = res.data.map(v => {
|
|
|
+ return {
|
|
|
+ id: v.value,
|
|
|
+ name: v.value,
|
|
|
+ }
|
|
|
+ });
|
|
|
+ let data = form.find(v => v.valueName == 'exception_type');
|
|
|
+ data.radioList = exception_types;
|
|
|
+ data.value = data.value || exception_types[0].id;
|
|
|
+ _Http.exception_types = exception_types;
|
|
|
+ this.setData({
|
|
|
+ form
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ let data = form.find(v => v.valueName == 'exception_type');
|
|
|
+ data.radioList = exception_types;
|
|
|
+ data.value = data.value || exception_types[0].id;
|
|
|
+ this.setData({
|
|
|
+ form
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // 服务等级
|
|
|
+ let service_levels = _Http.service_levels || [];
|
|
|
+ if (!service_levels.length) {
|
|
|
+ _Http.basic({
|
|
|
+ "classname": "sysmanage.develop.optiontype.optiontype",
|
|
|
+ "method": "optiontypeselect",
|
|
|
+ "content": {
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 1000,
|
|
|
+ "typename": "servicelevel",
|
|
|
+ },
|
|
|
+ }).then(res => {
|
|
|
+ console.log("服务等级", res)
|
|
|
+ if (res.code == 1) {
|
|
|
+ service_levels = res.data.map(v => {
|
|
|
+ return {
|
|
|
+ id: v.value,
|
|
|
+ name: v.value,
|
|
|
+ }
|
|
|
+ });
|
|
|
+ let data = form.find(v => v.valueName == 'service_level');
|
|
|
+ data.radioList = service_levels;
|
|
|
+ data.value = data.value || service_levels[0].id;
|
|
|
+ _Http.service_levels = service_levels;
|
|
|
+ this.setData({
|
|
|
+ form
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ let data = form.find(v => v.valueName == 'service_level');
|
|
|
+ data.radioList = service_levels;
|
|
|
+ data.value = data.value || service_levels[0].id;
|
|
|
+ this.setData({
|
|
|
+ form
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 是否显示全部
|
|
|
+ onChange({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ this.setData({
|
|
|
+ showAll: detail
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /* 表单必填项是否完成 */
|
|
|
+ onConfirm({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ this.setData({
|
|
|
+ disabled: detail
|
|
|
+ })
|
|
|
+ }
|
|
|
+})
|