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.

143 lines
3.6 KiB

8 months ago
8 months ago
8 months ago
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(order,...args)
  90. }
  91. }, true)
  92. })
  93. },
  94. // 结束服务
  95. endVipService(order, callback, ...args) {
  96. let { useTime , startServiceTime } = order
  97. let isTimeout = new Date(startServiceTime).valueOf() + useTime * 1000 * 60
  98. if(Date.now() < isTimeout){
  99. return uni.showToast({
  100. title : '服务未结束',
  101. icon : 'none'
  102. })
  103. }
  104. this.$comfirm('确认结束服务?', () => {
  105. uni.chooseImage({
  106. count: 1, // 默认9,设置为1表示单选
  107. sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
  108. sourceType: ['camera'], // 可以指定来源是相册还是相机,默认二者都有
  109. success: (res) => {
  110. // tempFilePath可以作为img标签的src属性显示图片
  111. // 假设这里只选择了一个文件
  112. uni.showLoading({
  113. title: '正在提交...'
  114. });
  115. this.uploadFileToOSS(res.tempFiles[0]).then(imgPath => {
  116. this.$api('endVipService', {
  117. orderId: order.id,
  118. endPicture: imgPath
  119. }, res => {
  120. if (res.code == 200) {
  121. uni.hideLoading();
  122. uni.showToast({
  123. mask: true,
  124. duration: 1000,
  125. title: res.message
  126. });
  127. callback && callback(...args)
  128. }
  129. })
  130. })
  131. }
  132. });
  133. })
  134. }
  135. }
  136. }