123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322 |
- // index.js
- // 获取应用实例
- const app = getApp();
- const util = require('../../../utils/jmsUtil.js');
- const api = require('../../../api/jms.js');
- import moment from 'moment'
- Page({
- data: {
- id:'',
- fines:'',
- memo:'',
- resultList:[],
- scrollShow:false,
- result:[],
- serviceId:'',
- keywords:'',
- wholeList:[],
- orderInfo:{
- consignee:'',
- mobile:'',
- address:'',
- bookDate:'',
- time:'',
- workerName:'',
- workerId:'' ,
- workerTel:''
- },
- selectValue:'',
- selectVisible:false,
- selectKey:'',
- timeList:[],
- currentDate:new Date().getTime(),
- max:5,
- uploadShow:true,
- isFinish:false,
- feedbackInfo:{
- noticeType:'',
- sendTime:'',
- },
- fileList: [],
- pictures:[],
-
- },
- // 事件处理函数
-
- onLoad(options) {
- if(options.id){
- this.setData({
- id:options.id
- });
- }
-
- this.getResultList();
- },
- onshow(){
-
- },
- finesInput(e){
- this.setData({
- fines:e.detail.value
- });
- },
- bindMemo(e){
- this.setData({
- memo:e.detail.value
- });
- },
- getResultList(){
- util.request(api.TicketResult, {
-
- }, 'GET').then(res=>{
- if (res.errno == 0) {
-
- this.setData({
- resultList:res.data
- });
- }else{
- wx.showToast({
- title: res.errmsg,
- icon:'none'
- })
- }
-
- });
-
- },
- inputClue(e){
- let obj=e.currentTarget.dataset.obj;
- let item=`clueInfo.${obj}`;
- this.setData({
- [item]:e.detail.value
- });
- // console.log(this.data.clueInfo);
- },
- selectClue(e){
- let obj=e.currentTarget.dataset.obj;
-
- this.setData({
- selectKey:obj,
- selectVisible:true
- });
- console.log(this.data.selectKey);
- },
- onPickerConfirm(e){
- console.log(e);
- let obj={
- label:e.detail.value.text,
- value:e.detail.value.value
- }
- this.setData({
- 'orderInfo.changeReason':obj,
- selectVisible:false
- });
- },
- onPickerCancel(){
- this.setData({
- selectVisible:true
- });
- },
- selectDate(){
- this.setData({
- scrollShow:true
- });
- },
- hidePicker(){
- this.setData({
- dateTimeVisible:false
- });
- },
-
- onDateTimeConfirm(e){
- console.log(e);
- this.setData({
- currentDate:e.detail,
- 'orderInfo.bookDate':util.formetdate(new Date(e.detail)),
- dateTimeVisible:false
- });
- },
- onPickerConfirm(e){
- console.log(e);
-
- this.setData({
- 'orderInfo.time':e.detail.value,
- selectVisible:false
- });
- },
- onPickerCancel(){
- this.setData({
- selectVisible:false
- });
- },
- inputAddress(e){
- this.setData({
- address:e.detail.value
- });
- },
- deleteImage (event) {
- const { fileList = [] } = this.data;
- fileList.splice(event.detail.index, 1)
- this.setData({
- fileList: fileList
- })
- let urls=[];
- fileList.forEach(function(e){
- urls.push(e.url);
- })
- this.setData({
- "pictures": urls
- })
- },
- afterRead(event) {
- console.log(event);
- const { file } = event.detail
- let that = this;
- const uploadTask = wx.uploadFile({
- url: api.StorageUpload,
- filePath: file.url,
- name: 'file',
- header: {
- 'X-JZ-Admin-Token': wx.getStorageSync('token')},
- success: function (res) {
- console.log(res);
- var _res = JSON.parse(res.data);
- if (_res.errno === 0) {
- var url = _res.data.fileUrl;
- that.data.pictures.push(url)
- const { fileList = [] } = that.data;
- fileList.push({ ...file, url: url });
- that.setData({
- fileList: fileList
- })
- }
- },
- fail: function (e) {
- wx.showModal({
- title: '错误',
- content: '上传失败',
- showCancel: false
- })
- },
- })
- },
- workerTap(e){
- let id=e.currentTarget.dataset.id;
- let name=e.currentTarget.dataset.name;
- let current=[];
- if(this.data.result.indexOf(id)>=0){
- current=this.data.result;
-
- current.splice(this.data.result.indexOf(id),1);
-
- }else{
- current=this.data.result;
- current.push(id);
- }
- this.setData({
- result:current
- });
- let resultName=[];
- current.forEach(item=>{
- let matchRes=this.data.resultList.filter(obj=>{return obj.id==item});
- resultName.push(matchRes[0].name)
- });
- this.setData({
- resultName:resultName
- });
- },
- resultCancel(){
- this.setData({
- result:[],
- resultName:[],
- scrollShow:false,
- })
- },
- resultConf(){
- this.setData({
- scrollShow:false,
- })
- },
- confTap(){
- if(this.data.result.length==0){
- wx.showToast({
- title: '请选择处理结果',
- icon:'none'
- });
- return false;
- }
- if(this.data.memo==''){
- wx.showToast({
- title: '请输入处理备注',
- icon:'none'
- });
- return false;
- }
-
- wx.showLoading({
- title: '加载中',
- })
- let params={
- id:this.data.id,
- result:this.data.result,
- memo:this.data.memo,
- fines:Number(this.data.fines),
- fileUrl:this.data.pictures
- }
- util.request(api.HandleTicket,
- params
- , 'POST').then(res=>{
- wx.hideLoading();
- if (res.errno == 0) {
-
- wx.showModal({
- title: '提示',
- content: '操作成功',
- showCancel:false,
- complete: (res) => {
- if (res.cancel) {
-
- }
-
- if (res.confirm) {
- wx.navigateBack({
- delta:1
- });
-
- }
- }
- })
-
-
- }else{
- wx.showToast({
- title: res.errmsg,
- icon:'none'
- })
- }
-
- }).catch(err=>{
- wx.hideLoading();
- });
-
- },
-
- })
|