You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

136 lines
3.4 KiB

8 months ago
  1. export default {
  2. data() {
  3. return {}
  4. },
  5. methods: {
  6. // 确认接单
  7. confirmVipOrder(order, callback, ...args) {
  8. this.$comfirm('确认接单?确认后不可取消哦~', () => {
  9. this.$api('confirmVipOrder', {
  10. orderId: order.id
  11. }, res => {
  12. if (res.code == 200) {
  13. uni.showToast({
  14. mask: true,
  15. duration: 1000,
  16. title: res.message,
  17. });
  18. callback && callback(...args)
  19. }
  20. })
  21. })
  22. },
  23. // 技师出发
  24. startVipOrder(order, callback, ...args) {
  25. this.$comfirm('确认出发?出发后需按指定时间到达', () => {
  26. this.$api('startVipOrder', {
  27. orderId: order.id
  28. }, res => {
  29. if (res.code == 200) {
  30. uni.showToast({
  31. mask: true,
  32. duration: 1000,
  33. title: res.message,
  34. });
  35. callback && callback(...args)
  36. }
  37. }, true)
  38. })
  39. },
  40. // 技师到达
  41. arriveVipOrder(order, callback, ...args) {
  42. let self = this
  43. this.$comfirm('确认到达指定服务地址?', () => {
  44. uni.chooseImage({
  45. count: 1, // 默认9,设置为1表示单选
  46. sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
  47. sourceType: ['camera'], // 可以指定来源是相册还是相机,默认二者都有
  48. success: (res) => {
  49. // tempFilePath可以作为img标签的src属性显示图片
  50. // 假设这里只选择了一个文件
  51. uni.showLoading({
  52. title: '正在提交...'
  53. });
  54. this.uploadFileToOSS(res.tempFiles[0]).then(imgPath => {
  55. this.$utils.getLocation(loca => {
  56. self.$api('arriveVipOrder', {
  57. orderId: order.id,
  58. ...loca,
  59. arrivalPicture: imgPath
  60. }, res => {
  61. if (res.code == 200) {
  62. uni.hideLoading();
  63. uni.showToast({
  64. mask: true,
  65. duration: 1000,
  66. title: res.message,
  67. });
  68. callback && callback(...args)
  69. }
  70. })
  71. })
  72. })
  73. }
  74. });
  75. })
  76. },
  77. // 开始服务
  78. startVipService(order, callback, ...args) {
  79. this.$comfirm('开始服务?', () => {
  80. this.$api('startVipService', {
  81. orderId: order.id
  82. }, res => {
  83. if (res.code == 200) {
  84. uni.showToast({
  85. mask: true,
  86. duration: 1000,
  87. title: res.message,
  88. });
  89. callback && callback(...args)
  90. }
  91. }, true)
  92. })
  93. },
  94. // 结束服务
  95. endVipService(order, callback, ...args) {
  96. let self = this
  97. this.$comfirm('确认结束服务?', () => {
  98. uni.chooseImage({
  99. count: 1, // 默认9,设置为1表示单选
  100. sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
  101. sourceType: ['camera'], // 可以指定来源是相册还是相机,默认二者都有
  102. success: (res) => {
  103. // tempFilePath可以作为img标签的src属性显示图片
  104. // 假设这里只选择了一个文件
  105. uni.showLoading({
  106. title: '正在提交...'
  107. });
  108. this.uploadFileToOSS(res.tempFiles[0]).then(imgPath => {
  109. this.$api('endVipService', {
  110. orderId: order.id,
  111. endPicture: imgPath
  112. }, res => {
  113. if (res.code == 200) {
  114. uni.hideLoading();
  115. uni.showToast({
  116. mask: true,
  117. duration: 1000,
  118. title: res.message
  119. });
  120. callback && callback(...args)
  121. }
  122. })
  123. })
  124. }
  125. });
  126. })
  127. }
  128. }
  129. }