regularPurchase.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <view class="container all-type-list-wrapper">
  3. <commodity-list ref="childList" :empty-text="emptyText"></commodity-list>
  4. </view>
  5. </template>
  6. <script>
  7. import commodityList from '@/components/module/listTemplate/commodityList'
  8. export default{
  9. components:{
  10. commodityList
  11. },
  12. data(){
  13. return{
  14. userID: '',
  15. serverUrl: '',
  16. emptyText: '',
  17. lastPageType: '',
  18. lastPageVal: ''
  19. }
  20. },
  21. onShow() {
  22. let pages = getCurrentPages(),
  23. thisPage = pages[pages.length - 1];
  24. if(thisPage.refresh) {
  25. this.setServerUrl(thisPage.listData);
  26. }
  27. this.$api.loginStatus().then((resolveData) => {
  28. this.$refs.childList.loginStatus = resolveData;
  29. });
  30. },
  31. onLoad() {
  32. this.$api.getStorage().then((resolve) =>{
  33. this.userID = resolve.userID
  34. this.setServerUrl();
  35. })
  36. },
  37. methods:{
  38. setServerUrl() {
  39. this.lastPageType = '再次购买';
  40. this.lastPageVal = '再次购买';
  41. // 空内容文案
  42. const emptyTxt = '您还没有购买过任何商品哟~';
  43. this.serverUrl = `/order/purchase?userID=${this.userID}`;
  44. this.$refs.childList.getListFromServer();
  45. }
  46. }
  47. }
  48. </script>
  49. <style lang="scss">
  50. page {
  51. background: $sub-bg-color;
  52. .all-type-list-wrapper {
  53. display: flex;
  54. flex-direction: column;
  55. }
  56. }
  57. </style>