select.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <view class="page" :style="{'height':h+'px','padding-top':mt+'px'}">
  3. <c-nav-bar title="选择门店" backUrl="/pages/login/index" @goBack="goBack" :showHome="false"></c-nav-bar>
  4. <view class="card" v-for="(item,index) in list" :key="index" @tap="toHome(item)">
  5. <view>
  6. <text>{{item.merchantName}}</text>
  7. <text>{{item.typeName}}</text>
  8. </view>
  9. <view>进店</view>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. export default {
  15. data() {
  16. return {
  17. userInfo: null,
  18. merchantId: '',
  19. types: [],
  20. list: []
  21. }
  22. },
  23. created() {
  24. this.getType();
  25. },
  26. onLoad(option) {
  27. if (option.userInfo) this.userInfo = JSON.parse(decodeURIComponent(option.userInfo));
  28. this.getList();
  29. },
  30. methods: {
  31. goBack(e) {
  32. uni.clearStorageSync();
  33. },
  34. getType() {
  35. this.$api.post('/api/dict/getListByTypes', ['BusinessType']).then(res => {
  36. if (res.data.code === 0) {
  37. this.types = res.data.data
  38. } else this.$showToast(res.data.msg);
  39. })
  40. },
  41. getList() {
  42. this.$api.post('/merchant/register/getMerchantStoreList').then(res => {
  43. if (res.data.code === 0) {
  44. this.list = res.data.data;
  45. this.list.forEach(l => {
  46. let t = this.types.find(t => t.dictValue == l.merchantType);
  47. l.typeName = t ? t.dictLabel : ''
  48. })
  49. } else this.$showToast(res.data.msg);
  50. })
  51. },
  52. toHome(item) { //1711268640588517378 1721450548101648385
  53. uni.setStorageSync('userInfo', JSON.stringify(this.userInfo));
  54. if (item.merchantType == 2) {
  55. uni.setStorageSync('homestayId', item.merchantId);
  56. uni.setStorageSync('merchantId','');
  57. uni.reLaunch({
  58. url: '/pages/home/index'
  59. })
  60. } else {
  61. uni.setStorageSync('homestayId', '');
  62. uni.setStorageSync('merchantId', item.merchantId);
  63. uni.setStorageSync('merchantName', item.merchantName);
  64. uni.reLaunch({
  65. url: '/pagesHouse/home/index'
  66. })
  67. }
  68. }
  69. }
  70. }
  71. </script>
  72. <style scoped lang="less">
  73. .page {
  74. background: #F3F4F4;
  75. padding-bottom: 20rpx;
  76. box-sizing: border-box;
  77. overflow-y: auto;
  78. .card {
  79. width: calc(100% - 60rpx);
  80. height: 180rpx;
  81. background: #FFFFFF;
  82. border-radius: 10rpx 10rpx 10rpx 10rpx;
  83. margin: 20rpx 30rpx 0;
  84. padding: 0 30rpx 0 60rpx;
  85. box-sizing: border-box;
  86. background: url(https://i.ringzle.com/file/20240109/1ee084be17f74dde94617dcb7f7c8af3.png) no-repeat;
  87. background-size: 100% 100%;
  88. display: flex;
  89. align-items: center;
  90. justify-content: space-between;
  91. &>view {
  92. &:first-child {
  93. display: flex;
  94. flex-direction: column;
  95. text {
  96. font-size: 32rpx;
  97. font-family: PingFang SC, PingFang SC;
  98. font-weight: 800;
  99. color: #1E3A62;
  100. &:last-child {
  101. font-size: 24rpx;
  102. font-family: PingFang SC, PingFang SC;
  103. font-weight: 400;
  104. color: #1E3A62;
  105. margin-top: 10rpx;
  106. }
  107. }
  108. }
  109. &:last-child {
  110. width: 140rpx;
  111. height: 56rpx;
  112. border-radius: 36rpx 36rpx 36rpx 36rpx;
  113. border: 1rpx solid #70849F;
  114. background: transparent;
  115. line-height: 56rpx;
  116. text-align: center;
  117. font-size: 28rpx;
  118. font-family: PingFang SC, PingFang SC;
  119. font-weight: 800;
  120. color: #1E3A62;
  121. }
  122. }
  123. }
  124. }
  125. </style>