list.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <!-- 门店列表 -->
  2. <template>
  3. <view class="page_box store-list-wrap">
  4. <view class="head_box"></view>
  5. <view class="content_box">
  6. <label v-for="store in storeList" :key="store.id" @tap="selStore(store.id)">
  7. <view class="store-item u-flex u-row-between">
  8. <view class="u-flex u-col-center">
  9. <view class="img-box"><image class="store-img" :src="store.image_first" mode="aspectFill" lazy-load></image></view>
  10. <view class="item-left u-flex-col u-row-left">
  11. <text class="store-title">{{ store.name }}</text>
  12. <text class="store-content">{{ store.city_name }}{{ store.area_name }}{{ store.address }}</text>
  13. </view>
  14. </view>
  15. <u-checkbox :value="storeId == store.id" activeColor="#4CB89D" shape="circle"></u-checkbox>
  16. </view>
  17. </label>
  18. </view>
  19. <view class="foot_box u-flex u-row-between u-col-center"><button class="u-reset-button save-btn" @tap="saveStore">确认</button></view>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. components: {},
  25. data() {
  26. return {
  27. storeList: [],
  28. storeId: uni.getStorageSync('storeId')
  29. };
  30. },
  31. computed: {},
  32. onLoad() {
  33. this.getStoreAddress();
  34. },
  35. methods: {
  36. // 选择门店
  37. selStore(id) {
  38. this.storeId = id;
  39. },
  40. // 确认门店
  41. saveStore() {
  42. uni.setStorageSync('storeId', this.storeId);
  43. if (!this.storeId) {
  44. this.$u.toast('请选选择门店');
  45. } else {
  46. this.$Router.replace({
  47. path: '/pages/app/merchant/index'
  48. });
  49. }
  50. },
  51. // 获取门店列表
  52. getStoreAddress() {
  53. let that = this;
  54. that.$http('store.list').then(res => {
  55. if (res.code == 1) {
  56. that.storeList = res.data;
  57. }
  58. });
  59. }
  60. }
  61. };
  62. </script>
  63. <style lang="scss">
  64. .store-item {
  65. padding: 0 30rpx;
  66. height: 180rpx;
  67. background-color: #fff;
  68. border-bottom: 1rpx solid rgba(223, 223, 223, 0.6);
  69. width: 100%;
  70. .img-box {
  71. width: 100rpx;
  72. height: 100rpx;
  73. border-radius: 6rpx;
  74. overflow: hidden;
  75. margin-right: 20rpx;
  76. .store-img {
  77. width: 100rpx;
  78. height: 100rpx;
  79. border-radius: 6rpx;
  80. }
  81. }
  82. .store-title {
  83. font-size: 30rpx;
  84. font-weight: 600;
  85. color: rgba(52, 52, 52, 1);
  86. margin-bottom: 10rpx;
  87. }
  88. .store-content {
  89. font-size: 24rpx;
  90. font-weight: 400;
  91. color: rgba(102, 102, 102, 1);
  92. }
  93. }
  94. .foot_box {
  95. height: 100rpx;
  96. background: rgba(255, 255, 255, 1);
  97. padding: 0 20rpx;
  98. .save-btn {
  99. width: 710rpx;
  100. line-height: 80rpx;
  101. background: linear-gradient(90deg, #2eae9c, #6cc29f);
  102. border: 1rpx solid rgba(238, 238, 238, 1);
  103. font-size: 30rpx;
  104. font-weight: 500;
  105. color: rgba(255, 255, 255, 1);
  106. padding: 0;
  107. border-radius: 40rpx;
  108. }
  109. }
  110. </style>