logistics-list.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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" v-show="selectID == item.id"><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. export default{
  13. data(){
  14. return{
  15. CustomBar:this.CustomBar,// 顶部导航栏高度
  16. isIphoneX:this.$store.state.isIphoneX,
  17. isACtive:false,
  18. companyList:[],
  19. selectID:'',
  20. }
  21. },
  22. onLoad(option){
  23. this.selectID = option.selectID
  24. this.initGetLogisticsCompany();
  25. },
  26. computed: {
  27. ...mapState(['hasLogin','userInfo'])
  28. },
  29. methods:{
  30. initGetLogisticsCompany(){//查询物流公司列表
  31. let params = {userID:this.userID}
  32. this.ShopService.GetLogisticsCompany({}).then(response =>{
  33. this.companyList = response.data
  34. }).catch(error =>{
  35. this.$util.msg(error.msg,2000);
  36. })
  37. },
  38. checkLogics(item){//选择物流
  39. uni.setStorageSync('selectLogics',item)
  40. var pages = getCurrentPages();
  41. var prevPage = pages[pages.length - 2]; //上一个页面
  42. prevPage.setData({select:'select'})
  43. uni.navigateBack();
  44. }
  45. },
  46. onPullDownRefresh() {//下拉刷新
  47. this.initGetLogisticsCompany()
  48. uni.stopPullDownRefresh()
  49. },
  50. onShow(){
  51. },
  52. }
  53. </script>
  54. <style lang="scss">
  55. page{
  56. background: #f7f7f7;
  57. height: auto;
  58. }
  59. .logistics{
  60. width: 702rpx;
  61. padding: 0 24rpx;
  62. border-top: 1px solid #F7F7F7;
  63. background-color: #FFFFFF;
  64. .list-cell-item{
  65. width: 702rpx;
  66. height: 88rpx;
  67. line-height: 88rpx;
  68. border-bottom: 1px solid #F7F7F7;
  69. &.active{
  70. .item-name{
  71. color: $color-system;
  72. }
  73. .item-icon{
  74. color: $color-system;
  75. }
  76. }
  77. .item-name{
  78. float: left;
  79. font-size: $font-size-28;
  80. color: $text-color;
  81. }
  82. .item-icon{
  83. width:88rpx;
  84. height: 88rpx;
  85. float: right;
  86. line-height: 88rpx;
  87. text-align: center;
  88. .icon-gou{
  89. font-size: $font-size-44;
  90. }
  91. }
  92. }
  93. }
  94. </style>