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.

144 lines
3.6 KiB

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