select.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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('merchantType',item.merchantType);
  54. if (item.merchantType == 2) {//民宿
  55. uni.setStorageSync('homestayId', item.merchantId);
  56. uni.setStorageSync('merchantId','');
  57. url: '/pages/home/index'
  58. })
  59. } else {//渔家乐和餐饮
  60. uni.setStorageSync('homestayId', '');
  61. uni.setStorageSync('merchantId', item.merchantId);
  62. uni.setStorageSync('merchantName', item.merchantName);
  63. uni.reLaunch({
  64. url: '/pagesHouse/home/index'
  65. })
  66. }
  67. }
  68. }
  69. }
  70. </script>
  71. <style scoped lang="less">
  72. .page {
  73. background: #F3F4F4;
  74. padding-bottom: 20rpx;
  75. box-sizing: border-box;
  76. overflow-y: auto;
  77. .card {
  78. width: calc(100% - 60rpx);
  79. height: 180rpx;
  80. background: #FFFFFF;
  81. border-radius: 10rpx 10rpx 10rpx 10rpx;
  82. margin: 20rpx 30rpx 0;
  83. padding: 0 30rpx 0 60rpx;
  84. box-sizing: border-box;
  85. background: url(https://i.ringzle.com/file/20240109/1ee084be17f74dde94617dcb7f7c8af3.png) no-repeat;
  86. background-size: 100% 100%;
  87. display: flex;
  88. align-items: center;
  89. justify-content: space-between;
  90. &>view {
  91. &:first-child {
  92. display: flex;
  93. flex-direction: column;
  94. text {
  95. font-size: 32rpx;
  96. font-family: PingFang SC, PingFang SC;
  97. font-weight: 800;
  98. color: #1E3A62;
  99. &:last-child {
  100. font-size: 24rpx;
  101. font-family: PingFang SC, PingFang SC;
  102. font-weight: 400;
  103. color: #1E3A62;
  104. margin-top: 10rpx;
  105. }
  106. }
  107. }
  108. &:last-child {
  109. width: 140rpx;
  110. height: 56rpx;
  111. border-radius: 36rpx 36rpx 36rpx 36rpx;
  112. border: 1rpx solid #70849F;
  113. background: transparent;
  114. line-height: 56rpx;
  115. text-align: center;
  116. font-size: 28rpx;
  117. font-family: PingFang SC, PingFang SC;
  118. font-weight: 800;
  119. color: #1E3A62;
  120. }
  121. }
  122. }
  123. }
  124. </style>