123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- // index.js
- // 获取应用实例
- const app = getApp();
- const util = require('../../../utils/jmsUtil.js');
- const api = require('../../../api/jms.js');
- import moment from 'moment'
- Page({
- data: {
-
- serviceId:'',
- keywords:'',
- wholeList:[],
- workerList:[],
- workerId:'',
- scrollShow:false,
- orderInfo:{
- changeReason:{
- label: '请选择(必填)',
- value:''
- },
-
- },
- selectValue:'',
- selectVisible:false,
- selectKey:'',
-
- },
- // 事件处理函数
-
- onLoad(options) {
- if(options.serviceid){
- this.setData({
- serviceId:options.serviceid
- });
- }
- this.getWorkerList();
- },
- getWorkerList(){
- util.request(api.ServiceOrderPerson, {
- pageNo: 1, pageSize: 1000
- }, 'POST').then(res=>{
- if (res.errno == 0) {
-
- this.setData({
- wholeList:res.data.list,
- workerList:res.data.list,
- });
- }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
- });
- },
- inputWorker(e){
- // console.log(e);
- let keyworks=e.detail.value;
- let list=this.data.wholeList;
- let newList=[];
- if(keyworks==''){
- newList=this.data.wholeList;
- this.setData({
- workerId:''
- });
- }else{
- list.forEach(item=>{
- if(item.name.indexOf(keyworks)>-1){
- newList.push(item);
- }
-
- });
- }
- this.setData({
- workerList:newList
- });
-
- },
- selectWorker(){
- this.setData({
- scrollShow:true
- });
- },
- workerTap(e){
- let id=e.currentTarget.dataset.id;
- let name=e.currentTarget.dataset.name;
- this.setData({
- workerId:id,
- keywords:name,
- scrollShow:false,
- })
-
- },
- confTap(){
- if(this.data.workerId==''){
- wx.showToast({
- title: '请选择服务者',
- icon:'none'
- });
- }else{
- wx.showLoading({
- title: '加载中',
- })
- let params={
- serviceId: this.data.serviceId,
- tempWorkerId: this.data.workerId,
- }
- util.request(api.SelectServiceOrderPerson,
- 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();
- });
- }
- },
-
- })
|