select.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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.reLaunch({
  82. url: '/pages/home/index'
  83. })
  84. } else { //渔家乐和餐饮
  85. uni.setStorageSync('homestayId', '');
  86. uni.setStorageSync('merchantId', item.merchantId);
  87. uni.setStorageSync('merchantName', item.merchantName);
  88. uni.reLaunch({
  89. url: '/pagesHouse/home/index'
  90. })
  91. }
  92. }
  93. }
  94. }
  95. </script>
  96. <style scoped lang="less">
  97. .page {
  98. background: #F3F4F4;
  99. padding-bottom: 20rpx;
  100. box-sizing: border-box;
  101. overflow-y: auto;
  102. .card {
  103. width: calc(100% - 60rpx);
  104. height: 180rpx;
  105. background: #FFFFFF;
  106. border-radius: 10rpx 10rpx 10rpx 10rpx;
  107. margin: 20rpx 30rpx 0;
  108. padding: 0 30rpx 0 60rpx;
  109. box-sizing: border-box;
  110. background: url(https://i.ringzle.com/file/20240109/1ee084be17f74dde94617dcb7f7c8af3.png) no-repeat;
  111. background-size: 100% 100%;
  112. display: flex;
  113. align-items: center;
  114. justify-content: space-between;
  115. &>view {
  116. &:first-child {
  117. display: flex;
  118. flex-direction: column;
  119. text {
  120. font-size: 32rpx;
  121. font-family: PingFang SC, PingFang SC;
  122. font-weight: 800;
  123. color: #1E3A62;
  124. &:last-child {
  125. font-size: 24rpx;
  126. font-family: PingFang SC, PingFang SC;
  127. font-weight: 400;
  128. color: #1E3A62;
  129. margin-top: 10rpx;
  130. }
  131. }
  132. }
  133. &:last-child {
  134. width: 140rpx;
  135. height: 56rpx;
  136. border-radius: 36rpx 36rpx 36rpx 36rpx;
  137. border: 1rpx solid #70849F;
  138. background: transparent;
  139. line-height: 56rpx;
  140. text-align: center;
  141. font-size: 28rpx;
  142. font-family: PingFang SC, PingFang SC;
  143. font-weight: 800;
  144. color: #1E3A62;
  145. }
  146. }
  147. }
  148. }
  149. </style>