logistics-list.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <view class="container logistics clearfix">
  3. <view class="list-cell-item" :class="selectID == item.id ? 'active' : ''" v-for="(item,index) in companyList" :key="item.id" @click="checkLogics(item)">
  4. <view class="item-name">{{item.label}}</view>
  5. <view class="item-icon"><text class="iconfont icon-gou"></text></view>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. import authorize from '@/common/config/authorize.js'
  11. import { mapState,mapMutations } from 'vuex';
  12. import { queryShoppingCartList,shoppingCartUpdate,shoppingCartDelete } from "@/api/cart.js"
  13. export default{
  14. data(){
  15. return{
  16. CustomBar:this.CustomBar,// 顶部导航栏高度
  17. isIphoneX:this.$store.state.isIphoneX,
  18. isACtive:false,
  19. companyList:[],
  20. selectID:'',
  21. }
  22. },
  23. onLoad(option){
  24. console.log(option)
  25. this.selectID = option.selectID
  26. this.initGetLogisticsCompany();
  27. },
  28. computed: {
  29. ...mapState(['hasLogin','userInfo'])
  30. },
  31. methods:{
  32. initGetLogisticsCompany(){//初始化购物车 index:1
  33. let params = {userID:this.userID}
  34. this.ShopService.GetLogisticsCompany({}).then(response =>{
  35. console.log(response)
  36. this.companyList = response.data
  37. }).catch(error =>{
  38. this.$util.msg(error.msg,2000);
  39. })
  40. },
  41. checkLogics(item){//选择物流
  42. //是否需要返回地址(从订单确认页跳过来选收货地址)
  43. console.log(item)
  44. uni.setStorageSync('selectLogics',item)
  45. var pages = getCurrentPages();
  46. var prevPage = pages[pages.length - 2]; //上一个页面
  47. prevPage.setData({select:'select'})
  48. uni.navigateBack();
  49. }
  50. },
  51. onPullDownRefresh() {//下拉刷新
  52. this.initGetLogisticsCompany()
  53. uni.stopPullDownRefresh()
  54. },
  55. onShow(){
  56. },
  57. }
  58. </script>
  59. <style lang="scss">
  60. page{
  61. background: #f7f7f7;
  62. height: auto;
  63. }
  64. .logistics{
  65. width: 702rpx;
  66. padding: 0 24rpx;
  67. border-top: 1px solid #F7F7F7;
  68. background-color: #FFFFFF;
  69. .list-cell-item{
  70. width: 702rpx;
  71. height: 88rpx;
  72. line-height: 88rpx;
  73. border-bottom: 1px solid #F7F7F7;
  74. &.active{
  75. .item-name{
  76. color: $color-system;
  77. }
  78. .item-icon{
  79. color: $color-system;
  80. }
  81. }
  82. .item-name{
  83. float: left;
  84. font-size: $font-size-28;
  85. color: $text-color;
  86. }
  87. .item-icon{
  88. width:88rpx;
  89. height: 88rpx;
  90. float: right;
  91. line-height: 88rpx;
  92. text-align: center;
  93. .icon-gou{
  94. font-size: $font-size-44;
  95. }
  96. }
  97. }
  98. }
  99. </style>