selectStore.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <!-- 选择门店 -->
  3. <view>
  4. <u-navbar border title="选择门店" autoBack placeholder></u-navbar>
  5. <view v-if="treeData.length > 0">
  6. <tree-item v-for="item in treeData" :key="item.id" :item="item" @confirm="confirm"></tree-item>
  7. </view>
  8. <view style="margin-top: 30%;" v-else>
  9. <u-empty mode="list" text="门店列表为空"></u-empty>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. import TreeItem from '@/components/TreeItem.vue';
  15. export default {
  16. components: {
  17. TreeItem
  18. },
  19. data() {
  20. return {
  21. treeData: [],
  22. navTitle: '',
  23. selectiveType: '',
  24. }
  25. },
  26. onLoad(receive) {
  27. this.navTitle = receive.title
  28. this.selectiveType = receive.id
  29. this.getList()
  30. },
  31. methods: {
  32. getList() {
  33. if (this.selectiveType == '25' || this.selectiveType == '27') {
  34. this.$api.get('/api/store/all2').then(res => {
  35. if (res.code == 200) {
  36. if (res.data) {
  37. this.treeData = res.data
  38. }
  39. }
  40. })
  41. } else {
  42. this.$api.get('/api/store/all').then(res => {
  43. if (res.code == 200) {
  44. if (res.data) {
  45. this.treeData = res.data
  46. }
  47. }
  48. })
  49. }
  50. },
  51. // 选择门店
  52. confirm(cmpCode) {
  53. uni.navigateTo({
  54. url: '/pages/order/delivery?id=' + this.selectiveType + '&title=' + this.navTitle +
  55. '&cmpCode=' + cmpCode
  56. });
  57. }
  58. }
  59. }
  60. </script>
  61. <style lang="scss">
  62. </style>