select.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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. if(uni.getStorageSync('userInfo')) this.getType();
  25. else{
  26. // #ifdef APP-PLUS
  27. uni.reLaunch({
  28. url: '/pages/login/appIndex'
  29. })
  30. // #endif
  31. // #ifdef MP-WEIXIN
  32. uni.reLaunch({
  33. url: '/pages/login/index'
  34. })
  35. // #endif
  36. }
  37. },
  38. onLoad(option) {
  39. //if (option.userInfo) this.userInfo = JSON.parse(decodeURIComponent(option.userInfo));
  40. if(uni.getStorageSync('userInfo')) this.getList();
  41. else{
  42. // #ifdef APP-PLUS
  43. uni.reLaunch({
  44. url: '/pages/login/appIndex'
  45. })
  46. // #endif
  47. // #ifdef MP-WEIXIN
  48. uni.reLaunch({
  49. url: '/pages/login/index'
  50. })
  51. // #endif
  52. }
  53. },
  54. methods: {
  55. goBack(e) {
  56. uni.clearStorageSync();
  57. },
  58. getType() {
  59. this.$api.post('/api/dict/getListByTypes', ['BusinessType']).then(res => {
  60. if (res.data.code === 0) {
  61. this.types = res.data.data
  62. } else this.$showToast(res.data.msg);
  63. })
  64. },
  65. getList() {
  66. this.$api.post('/merchant/register/getMerchantStoreList').then(res => {
  67. if (res.data.code === 0) {
  68. this.list = res.data.data;
  69. this.list.forEach(l => {
  70. let t = this.types.find(t => t.dictValue == l.merchantType);
  71. l.typeName = t ? t.dictLabel : ''
  72. })
  73. } else this.$showToast(res.data.msg);
  74. })
  75. },
  76. toHome(item) { //1711268640588517378 1721450548101648385
  77. uni.setStorageSync('merchantType', item.merchantType);
  78. if (item.merchantType == 2) { //民宿
  79. uni.setStorageSync('homestayId', item.merchantId);
  80. uni.setStorageSync('merchantId', '');
  81. uni.setStorageSync('merchantName', item.merchantName);
  82. uni.reLaunch({
  83. url: '/pages/home/index'
  84. })
  85. } else { //渔家乐和餐饮
  86. uni.setStorageSync('homestayId', '');
  87. uni.setStorageSync('merchantId', item.merchantId);
  88. uni.setStorageSync('merchantName', item.merchantName);
  89. uni.reLaunch({
  90. url: '/pagesHouse/home/index'
  91. })
  92. }
  93. }
  94. }
  95. }
  96. </script>
  97. <style scoped lang="less">
  98. .page {
  99. background: #F3F4F4;
  100. padding-bottom: 20rpx;
  101. box-sizing: border-box;
  102. overflow-y: auto;
  103. .card {
  104. width: calc(100% - 60rpx);
  105. height: 180rpx;
  106. background: #FFFFFF;
  107. border-radius: 10rpx 10rpx 10rpx 10rpx;
  108. margin: 20rpx 30rpx 0;
  109. padding: 0 30rpx 0 60rpx;
  110. box-sizing: border-box;
  111. background: url(https://fsy.shengsi.gov.cn/file/20240109/1ee084be17f74dde94617dcb7f7c8af3.png) no-repeat;
  112. background-size: 100% 100%;
  113. display: flex;
  114. align-items: center;
  115. justify-content: space-between;
  116. &>view {
  117. &:first-child {
  118. display: flex;
  119. flex-direction: column;
  120. text {
  121. font-size: 32rpx;
  122. font-family: PingFang SC, PingFang SC;
  123. font-weight: 800;
  124. color: #1E3A62;
  125. &:last-child {
  126. font-size: 24rpx;
  127. font-family: PingFang SC, PingFang SC;
  128. font-weight: 400;
  129. color: #1E3A62;
  130. margin-top: 10rpx;
  131. }
  132. }
  133. }
  134. &:last-child {
  135. width: 140rpx;
  136. height: 56rpx;
  137. border-radius: 36rpx 36rpx 36rpx 36rpx;
  138. border: 1rpx solid #70849F;
  139. background: transparent;
  140. line-height: 56rpx;
  141. text-align: center;
  142. font-size: 28rpx;
  143. font-family: PingFang SC, PingFang SC;
  144. font-weight: 800;
  145. color: #1E3A62;
  146. }
  147. }
  148. }
  149. }
  150. </style>