acceptOrders.vue 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <view style="padding: 20rpx;">
  3. <view>
  4. <view v-for="item in orderList" :key="item.id" class="box" style="margin-bottom: 10rpx;"
  5. @click="goDetail(item.id)">
  6. <view style="display: flex; align-items: center; margin-bottom: 20rpx;">
  7. <view style="flex: 1;">
  8. <uni-tag text="餐品" size="small" type="success" v-if="item.type === '代取餐品'"></uni-tag>
  9. <uni-tag text="快递" size="small" type="primary" v-if="item.type === '代拿快递'"></uni-tag>
  10. <uni-tag text="零食" size="small" type="warning" v-if="item.type === '代买零食'"></uni-tag>
  11. <uni-tag text="鲜花" size="small" type="error" v-if="item.type === '代送鲜花'"></uni-tag>
  12. <text style="margin-left: 10rpx;">{{ item.name }}</text>
  13. </view>
  14. <view style="flex: 1; text-align: right;">
  15. <text style="color: #888;">跑腿费</text>
  16. <text style="color: red; font-size: 34rpx;">¥{{ item.price }}</text>
  17. </view>
  18. </view>
  19. <view style="display: flex; align-items: center;">
  20. <view style="flex: 1;">
  21. <text style="margin-right: 20rpx;"
  22. v-if="item.status === '待接单' || item.status === '待送达' || item.status === '待收货'">已下单{{ item.range }}分钟</text>
  23. <text style="color: #888;" v-if="item.status === '已取消'">{{ item.status }}</text>
  24. <text style="color: orange;" v-if="item.status === '待接单'">{{ item.status }}</text>
  25. <text style="color: dodgerblue" v-if="item.status === '待送达'">{{ item.status }}</text>
  26. <text style="color: mediumpurple;" v-if="item.status === '待收货'">{{ item.status }}</text>
  27. <text style="color: indianred;" v-if="item.status === '待评价'">{{ item.status }}</text>
  28. <text style="color: #18bc37;" v-if="item.status === '已完成'">{{ item.status }}</text>
  29. </view>
  30. <view style="flex: 1; text-align: right;">
  31. <uni-tag v-if="item.status === '待送达'" text="确认送达" type="primary" size="small"
  32. @click.native.stop="arrive(item)"></uni-tag>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. export default {
  41. data() {
  42. return {
  43. orderList: [],
  44. user: uni.getStorageSync('xm-user')
  45. }
  46. },
  47. onLoad() {
  48. this.load()
  49. },
  50. methods: {
  51. goDetail(orderId) {
  52. uni.navigateTo({
  53. url: '/pages/detail/detail?orderId=' + orderId
  54. })
  55. },
  56. load() {
  57. this.$request.get('/orders/selectAll', {
  58. acceptId: this.user.id
  59. }).then(res => {
  60. this.orderList = res.data || []
  61. })
  62. },
  63. arrive(orders) {
  64. orders.status = '待收货'
  65. this.$request.put('/orders/update', orders).then(res => {
  66. if (res.code === '200') {
  67. uni.showToast({
  68. icon: 'success',
  69. title: '操作成功'
  70. })
  71. this.load()
  72. } else {
  73. uni.showToast({
  74. icon: 'none',
  75. title: res.msg
  76. })
  77. }
  78. })
  79. }
  80. }
  81. }
  82. </script>
  83. <style>
  84. </style>