selectStore.vue 973 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <template>
  2. <!-- 选择门店 -->
  3. <view>
  4. <u-navbar border title="选择门店" autoBack placeholder></u-navbar>
  5. <tree-item v-for="item in treeData" :key="item.id" :item="item" @confirm="confirm"></tree-item>
  6. </view>
  7. </template>
  8. <script>
  9. import TreeItem from '@/components/TreeItem.vue';
  10. export default {
  11. components: {
  12. TreeItem
  13. },
  14. data() {
  15. return {
  16. treeData: [],
  17. navTitle: '',
  18. selectiveType: '',
  19. }
  20. },
  21. onLoad(receive) {
  22. this.navTitle = receive.title
  23. this.selectiveType = receive.id
  24. this.getList()
  25. },
  26. methods: {
  27. getList() {
  28. this.$api.get('/api/store/all').then(res => {
  29. if (res.code == 200) {
  30. this.treeData = res.data
  31. }
  32. })
  33. },
  34. // 选择门店
  35. confirm(cmpCode) {
  36. console.log(cmpCode,666)
  37. uni.navigateTo({
  38. url: '/pages/order/delivery?id=' + this.selectiveType + '&title=' + this.navTitle +
  39. '&cmpCode=' + cmpCode
  40. });
  41. }
  42. }
  43. }
  44. </script>
  45. <style lang="scss">
  46. </style>