cancelOrder.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. // index.js
  2. // 获取应用实例
  3. const app = getApp();
  4. const util = require('../../../utils/jmsUtil.js');
  5. const api = require('../../../api/jms.js');
  6. import moment from 'moment'
  7. Page({
  8. data: {
  9. serviceId:'',
  10. orderInfo:{
  11. changeReason:{
  12. label: '请选择(必填)',
  13. value:''
  14. },
  15. },
  16. selectValue:'',
  17. selectVisible:false,
  18. selectKey:'',
  19. list:[
  20. { value: 1, text: '用户退款取消' },
  21. { value: 2, text: '用户改期取消' },
  22. { value: 3, text: '用户改派取消' },
  23. { value: 4, text: '保洁师请假取消' },
  24. { value: 5, text: '保洁师解约取消' },
  25. { value: 6, text: '修改订单地址取消' },
  26. { value: 7, text: '退还权益取消' },
  27. { value: 16, text: '无法联系到客户' },
  28. { value: 17, text: '团单不适用无法服务' },
  29. ]
  30. },
  31. // 事件处理函数
  32. onLoad(options) {
  33. if(options.serviceid){
  34. this.setData({
  35. serviceId:options.serviceid
  36. });
  37. }
  38. },
  39. inputClue(e){
  40. let obj=e.currentTarget.dataset.obj;
  41. let item=`clueInfo.${obj}`;
  42. this.setData({
  43. [item]:e.detail.value
  44. });
  45. // console.log(this.data.clueInfo);
  46. },
  47. selectClue(e){
  48. let obj=e.currentTarget.dataset.obj;
  49. this.setData({
  50. selectKey:obj,
  51. selectVisible:true
  52. });
  53. console.log(this.data.selectKey);
  54. },
  55. onPickerConfirm(e){
  56. console.log(e);
  57. let obj={
  58. label:e.detail.value.text,
  59. value:e.detail.value.value
  60. }
  61. this.setData({
  62. 'orderInfo.changeReason':obj,
  63. selectVisible:false
  64. });
  65. },
  66. onPickerCancel(){
  67. this.setData({
  68. selectVisible:false
  69. });
  70. },
  71. confTap(){
  72. if(this.data.orderInfo.changeReason.value==''){
  73. wx.showToast({
  74. title: '请选择取消原因',
  75. icon:'none'
  76. });
  77. }else{
  78. wx.showLoading({
  79. title: '加载中',
  80. })
  81. let params={
  82. serviceId: this.data.serviceId,
  83. changeReason: this.data.orderInfo.changeReason.value
  84. }
  85. util.request(api.HangUpServiceOrder,
  86. params
  87. , 'GET').then(res=>{
  88. wx.hideLoading();
  89. if (res.errno == 0) {
  90. wx.showModal({
  91. title: '提示',
  92. content: '操作成功',
  93. showCancel:false,
  94. complete: (res) => {
  95. if (res.cancel) {
  96. }
  97. if (res.confirm) {
  98. wx.navigateBack({
  99. delta:1
  100. });
  101. }
  102. }
  103. })
  104. }else{
  105. wx.showToast({
  106. title: res.errmsg,
  107. icon:'none'
  108. })
  109. }
  110. }).catch(err=>{
  111. wx.hideLoading();
  112. });
  113. }
  114. },
  115. })