merchantlist.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <template>
  2. <div class="merchantlist">
  3. <div class="head">
  4. <div class="bg" v-if="IsMobile"></div>
  5. <div class="card" :style="{marginTop:IsMobile?'-110rpx':'30rpx'}">
  6. <div class="live_name">{{ typeto(localInfo.level_id) }}</div>
  7. <view class="regional">
  8. <template v-if="localInfo.regional">
  9. <img src="@/static/my/regional.png" alt="" srcset="" class="ico">
  10. <!-- <span class="ico iconfont">&#xf727;</span> -->
  11. <span class="txtinfo">区域节点:{{ localInfo.regional }}</span>
  12. </template>
  13. </view>
  14. <div class="mm">
  15. <span>账户余额</span>
  16. <span class="balance dinB">{{ localInfo.integral || 0 }}</span>
  17. </div>
  18. </div>
  19. </div>
  20. <div class="l_tabBar flex_r flex_jb">
  21. <div class="item" v-for="(i,s) in tabs" :key="s" @click="goto(i.url)">
  22. <img :src="i.ico" alt="" class="ico">
  23. <!-- <div class="tit">{{ i.tit }}</div> -->
  24. </div>
  25. </div>
  26. <view class="loadingBox" v-if="loading">
  27. <img class="loading" src="http://teaclub.oss-cn-chengdu.aliyuncs.com/CloudShop/head_pic/2caa2ae4dc849856f3eca4ff2b3abf7fd19e7632gif" />
  28. </view>
  29. <div class="list" v-else>
  30. <div class="li_item" v-for="(i,s) in merchantList" :key="s" @click="goMerchant(i)">
  31. <div class="li_title">{{ i.brand_name }}</div>
  32. <div class="logo_img">
  33. <img :src="i.restaurant_img" alt="">
  34. </div>
  35. <div class="con_box">
  36. <div class="p1 ellipsis">{{ i.restaurant_name }}</div>
  37. <div class="p2">{{ i.restaurant_address }}</div>
  38. <div class="p3">{{ $h.Div(i.distance, 1000).toFixed(2) }} km</div>
  39. </div>
  40. </div>
  41. </div>
  42. <activation ref="activation" tit="激活" :close="isActivation"/>
  43. </div>
  44. </template>
  45. <script>
  46. import activation from "@/components/activation/activation.vue"
  47. import tabs from './tabs'
  48. import { post } from "@/request/api.js";
  49. export default {
  50. name: "merchantlist",
  51. props: {},
  52. components: { activation },
  53. data() {
  54. return {
  55. IsMobile: true,
  56. loading: true,
  57. Query: {
  58. lat: 113.9367,
  59. lng: 22.5325,
  60. page: 1,
  61. rows: 20
  62. },
  63. merchant: {},
  64. merchantList: [],
  65. localInfo: {},
  66. tabs,
  67. };
  68. },
  69. methods: {
  70. // 获取附近商家
  71. getlists() {
  72. post("local/getMerchant", this.Query).then(res => {
  73. if (res.code == 0) {
  74. this.loading = false
  75. let merchantList = res.data.data
  76. delete res.data.data
  77. this.merchant = res.data
  78. this.merchantList = [...this.merchantList, ...merchantList]
  79. this.Query.page++
  80. }
  81. })
  82. },
  83. // 获取当前位置
  84. async getLocation() {
  85. let adres = await uni.Location();
  86. this.Query = { ...this.Query, ...adres };
  87. this.getlists();
  88. },
  89. // 去店铺
  90. goMerchant(da) {
  91. uni.setStorageSync("MerchantItem", da)
  92. this.goto("/pagesB/orderingfood/orderingfood", {
  93. brand_id: da.brand_id,
  94. restaurant_id: da.restaurant_id
  95. })
  96. },
  97. // 是否激活数智生活
  98. isActivation() {
  99. post("local/isActivation").then(res => {
  100. if (res.code == -1) {
  101. this.activation();
  102. } else {
  103. this.getLocation();
  104. this.getLU();
  105. }
  106. })
  107. },
  108. // 打开激活弹窗
  109. activation(){
  110. this.$refs.activation.open()
  111. },
  112. async getLU() {
  113. this.localInfo = await uni.Luserfun()
  114. },
  115. typeto(va) {
  116. switch (va) {
  117. case 1: return "消费商";
  118. case 2: return "推广大使";
  119. case 3: return "合伙人";
  120. case 4: return "联合创始人";
  121. case 5: return "联合发起人";
  122. default: return ""
  123. }
  124. }
  125. },
  126. onLoad(da){
  127. let app = uni.getSystemInfoSync();
  128. if(["android","ios","devtools"].includes(app.platform)){
  129. this.IsMobile = true
  130. }else this.IsMobile = false
  131. },
  132. onShow() {
  133. this.isActivation();
  134. },
  135. onReachBottom() {
  136. if (this.Query.page < this.merchant.last_page) this.getlists();
  137. },
  138. };
  139. </script>
  140. <style scoped lang='scss'>
  141. .head {
  142. .bg {
  143. height: 300rpx;
  144. background-image: url("http://teaclub.oss-cn-chengdu.aliyuncs.com/CloudShop/head_pic/a5500a3c12f967a83d123f774b333e2b2d9729bcpng");
  145. background-size: 100% 100%;
  146. }
  147. .card {
  148. width: calc(100% - 60rpx);
  149. margin: -110rpx 30rpx 0;
  150. // background-color: #473D31;
  151. background: url("http://teaclub.oss-cn-chengdu.aliyuncs.com/CloudShop/head_pic/33ce780a63d0cedd92868b1784a355d2bfaad827jpg");
  152. background-size: 100% 100%;
  153. border-radius: 16rpx;
  154. padding: 28rpx 30rpx;
  155. height: 280rpx;
  156. position: relative;
  157. .balance {
  158. font-size: 46rpx;
  159. margin-top: 8rpx;
  160. margin-left: 26rpx;
  161. &:before {
  162. content: "¥";
  163. font-size: 24rpx;
  164. }
  165. }
  166. .live_name {
  167. font-size: 36rpx;
  168. color: #CD7C2B;
  169. position: absolute;
  170. top: 16rpx;
  171. left: 90rpx;
  172. }
  173. .mm {
  174. margin: auto 0;
  175. text-align: center;
  176. line-height: 98rpx;
  177. }
  178. }
  179. .regional {
  180. height: 30rpx;
  181. line-height: 30rpx;
  182. margin-top: 40rpx;
  183. // .ico {
  184. // font-size: 26rpx;
  185. // margin-right: 12rpx;
  186. // }
  187. .ico {
  188. width: 32rpx;
  189. height: 32rpx;
  190. margin-right: 12rpx;
  191. }
  192. .txtinfo {
  193. font-size: 22rpx;
  194. color: #333;
  195. }
  196. .ico, .txtinfo {
  197. vertical-align: middle;
  198. }
  199. }
  200. }
  201. .list {
  202. padding: 30rpx;
  203. .li_item {
  204. margin-bottom: 20rpx;
  205. padding: 28rpx 32rpx;
  206. background-color: #fff;
  207. border-radius: 10rpx;
  208. box-shadow: 4rpx 4rpx 8rpx 4rpx rgba(0, 0, 0, 0.12);
  209. }
  210. .li_title {
  211. font-size: 36rpx;
  212. margin-bottom: 16rpx;
  213. }
  214. .logo_img,
  215. .con_box {
  216. display: inline-block;
  217. vertical-align: top;
  218. }
  219. .logo_img {
  220. img {
  221. height: 180rpx;
  222. width: 180rpx;
  223. border-radius: 10rpx;
  224. }
  225. }
  226. .con_box {
  227. height: 180rpx;
  228. width: calc(100% - 180rpx - 28rpx);
  229. margin-left: 28rpx;
  230. position: relative;
  231. .p1 {
  232. font-size: 32rpx;
  233. font-weight: bold;
  234. color: #333;
  235. margin-bottom: 6rpx;
  236. }
  237. .p2 {
  238. font-size: 24rpx;
  239. color: #999;
  240. }
  241. .p3 {
  242. font-size: 24rpx;
  243. color: #666;
  244. position: absolute;
  245. right: 0;
  246. bottom: 0;
  247. }
  248. }
  249. }
  250. .l_tabBar {
  251. margin: 32rpx 32rpx 0;
  252. background-color: #fff;
  253. padding: 10rpx 20rpx;
  254. border-radius: 10rpx;
  255. box-shadow: 4rpx 4rpx 8rpx 4rpx rgba(0, 0, 0, 0.12);
  256. flex-wrap: wrap;
  257. .item {
  258. width: 105rpx;
  259. margin: 10rpx 10rpx;
  260. }
  261. .ico {
  262. width: 100%;
  263. height: 138rpx;
  264. }
  265. // .tit{
  266. // font-size: 26rpx;
  267. // text-align: center;
  268. // }
  269. }
  270. .loadingBox {
  271. text-align: center;
  272. padding: 100rpx 0;
  273. .loading {
  274. width: 280rpx;
  275. height: 280rpx;
  276. }
  277. }
  278. </style>