index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. <template>
  2. <view :style="colorStyle">
  3. <!-- #ifdef MP || APP -->
  4. <view class="storeTitle">
  5. <view :style="{height:getHeight.barTop+'px'}"></view>
  6. <view class="sysTitle acea-row row-center-wrapper" :style="{height:getHeight.barHeight+'px'}">
  7. <view>门店列表</view>
  8. <text class="iconfont icon-ic_leftarrow" @click="goarrow"></text>
  9. </view>
  10. </view>
  11. <view :style="{height:(getHeight.barTop+getHeight.barHeight)+'px'}"></view>
  12. <!-- #endif -->
  13. <view class="header acea-row row-between-wrapper">
  14. <view class="item" :class="content.store_type==item.type?'on':''" v-for="(item, index) in navList" :key="index" @click="navChange(item.type)">{{item.name}}</view>
  15. <view class="search acea-row row-middle">
  16. <view class="name" @click="btnFn">{{ addressInfo.length ? addressInfo[1].label : '全部' }}<text class="iconfont icon-ic_down2"></text></view>
  17. <input class="input" placeholder="请输入门店名称" placeholder-class="placeholders" @confirm="searchSubmit" v-model="content.keyword"></input>
  18. <text class="iconfont icon-ic_search" @click="searchSubmit"></text>
  19. </view>
  20. <view class="pictrue" @click="goMap">
  21. <image src="../static/map.png"></image>
  22. </view>
  23. </view>
  24. <view class="list" v-if="storeList.length">
  25. <view class="item acea-row row-between-wrapper" :class="sortIndex==item.id?'on':''" v-for="(item, index) in storeList" :key="index" @click="activeFn(item)">
  26. <text class="iconfont icon-a-icon_cornermark" v-if="sortIndex==item.id"></text>
  27. <view class="left">
  28. <view class="name line2">{{item.name}}</view>
  29. <view class="address acea-row">
  30. <text class="iconfont icon-ic_location51 pt-2"></text>
  31. <view class="flex-1">{{item.address}}{{item.detailed_address}}</view>
  32. </view>
  33. <view class="address time"><text class="iconfont icon-icon_clock"></text>营业时间:{{item.day_time}}</view>
  34. </view>
  35. <view class="right">
  36. <view class="gostore">进店选购</view>
  37. <view class="distance">距离{{item.range}}km</view>
  38. <view class="telephone acea-row row-center-wrapper">
  39. <view class="phone acea-row row-center-wrapper" @click.stop="callPhone(item)">
  40. <text class="iconfont icon-ic_Phone"></text>
  41. </view>
  42. <view class="phone acea-row row-center-wrapper" @click.stop="showMaoLocation(item)">
  43. <text class="iconfont icon-icon_Location"></text>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. <view class="emptyPage px-20" v-else>
  50. <emptyPage title="暂无门店信息~" src="/statics/images/noOrder.gif"></emptyPage>
  51. </view>
  52. <areaWindow ref="areaWindow" :display="display" :cityShow="2" :address="addressInfo" @submit="OnChangeAddress" @changeClose="changeClose"></areaWindow>
  53. </view>
  54. </template>
  55. <script>
  56. import {
  57. HTTP_REQUEST_URL
  58. } from '@/config/app';
  59. import colors from "@/mixins/color";
  60. import {
  61. getList
  62. } from '@/api/new_store.js'
  63. import areaWindow from '@/components/areaWindow';
  64. import emptyPage from '@/components/emptyPage.vue';
  65. export default {
  66. components: {
  67. areaWindow,
  68. emptyPage
  69. },
  70. mixins:[colors],
  71. data() {
  72. return {
  73. imgHost: HTTP_REQUEST_URL,
  74. getHeight: this.$util.getWXStatusHeight(),
  75. navList:[
  76. {name:'附近',type:1},
  77. {name:'常用',type:2}
  78. ],
  79. storeList:[],
  80. content: {
  81. // 自己的位置
  82. latitude: uni.getStorageSync('user_latitude'),
  83. longitude: uni.getStorageSync('user_longitude'),
  84. store_type: 1,
  85. keyword: "",
  86. province: 0,
  87. city: 0,
  88. area: 0,
  89. },
  90. display: false,
  91. addressInfo: [],
  92. sortIndex: 0,
  93. comeType: 0,
  94. isCollage:0
  95. };
  96. },
  97. onLoad(options) {
  98. this.comeType = options.type
  99. this.sortIndex = options.storeId
  100. this.isCollage = options.isCollage
  101. this.content.product_id = options.product_id || 0
  102. this.getlist()
  103. },
  104. onShow() {
  105. },
  106. methods: {
  107. goarrow(){
  108. uni.navigateBack()
  109. },
  110. navChange(type) {
  111. this.content.store_type = type;
  112. this.getlist();
  113. },
  114. // 输入关键字搜索门店
  115. searchSubmit() {
  116. this.getlist()
  117. },
  118. // 门店列表
  119. getlist() {
  120. getList(this.content).then(res => {
  121. this.storeList = res.data
  122. })
  123. },
  124. btnFn() {
  125. this.display = true;
  126. },
  127. changeClose() {
  128. this.display = false;
  129. },
  130. OnChangeAddress(address) {
  131. this.addressInfo = address;
  132. this.content.province = address[0].value;
  133. this.content.city = address[1].value;
  134. this.content.area = address[2].value;
  135. this.getlist();
  136. },
  137. goMap() {
  138. uni.navigateTo({
  139. // #ifdef APP
  140. url: `/pages/store/mapnvue/index?province=${this.content.province}&city=${this.content.city}&area=${this.content.area}`
  141. // #endif
  142. // #ifndef APP
  143. url: `/pages/store/map/index?province=${this.content.province}&city=${this.content.city}&area=${this.content.area}`
  144. // #endif
  145. })
  146. },
  147. // 点击高亮
  148. activeFn(row) {
  149. this.sortIndex = row.id
  150. if (this.comeType) {
  151. if (this.isCollage == 1) {
  152. uni.$emit('activeFn', row);
  153. uni.navigateBack();
  154. return;
  155. }
  156. uni.reLaunch({
  157. url: `/pages/store_cate/store_cate?mapFrom=1&id=` + row.id
  158. });
  159. }
  160. },
  161. // 打电话
  162. callPhone(row) {
  163. uni.makePhoneCall({
  164. phoneNumber: row.phone
  165. });
  166. },
  167. showMaoLocation(e) {
  168. let self = this;
  169. // #ifdef H5
  170. if (self.$wechat.isWeixin()) {
  171. return self.$wechat.seeLocation({
  172. latitude: Number(e.latitude),
  173. longitude: Number(e.longitude),
  174. name: e.name,
  175. scale: 13,
  176. address: `${e.address}-${e.detailed_address}`,
  177. }).then(res => {})
  178. }
  179. // #endif
  180. uni.openLocation({
  181. latitude: Number(e.latitude),
  182. longitude: Number(e.longitude),
  183. name: e.name,
  184. address: `${e.address}-${e.detailed_address}`,
  185. success: function() {
  186. Number
  187. }
  188. });
  189. }
  190. }
  191. }
  192. </script>
  193. <style lang="scss" scoped>
  194. .emptyPage{
  195. position: relative;
  196. }
  197. .storeTitle{
  198. background: linear-gradient(90deg, var(--view-theme) 0%, var(--view-gradient) 100%);
  199. position: fixed;
  200. left:0;
  201. top:0;
  202. width: 100%;
  203. z-index: 99;
  204. .sysTitle{
  205. width: 100%;
  206. position: relative;
  207. font-weight: 500;
  208. color: #fff;
  209. font-size: 30rpx;
  210. .iconfont{
  211. position: absolute;
  212. font-size: 36rpx;
  213. left:11rpx;
  214. width: 60rpx;
  215. }
  216. }
  217. }
  218. .header{
  219. background: linear-gradient(90deg, var(--view-theme) 0%, var(--view-gradient) 100%);
  220. padding: 40rpx 20rpx 42rpx 32rpx;
  221. position: relative;
  222. &::before{
  223. position: absolute;
  224. content: ' ';
  225. width: 50%;
  226. height: 90rpx;
  227. background: linear-gradient(180deg, var(--view-gradient) 0%, #F5F5F5 100%);
  228. right: 0;
  229. bottom: -90rpx;
  230. }
  231. &::after{
  232. position: absolute;
  233. content: ' ';
  234. width: 50%;
  235. height: 90rpx;
  236. background: linear-gradient(180deg, var(--view-theme) 0%, #F5F5F5 100%);
  237. left: 0;
  238. bottom: -90rpx;
  239. }
  240. .item{
  241. font-family: PingFang SC, PingFang SC;
  242. font-weight: 400;
  243. font-size: 28rpx;
  244. color: rgba(255,255,255,0.6);
  245. margin-right: 22rpx;
  246. &.on{
  247. font-weight: 500;
  248. color: #FFFFFF;
  249. position: relative;
  250. font-size: 30rpx;
  251. &::after{
  252. position: absolute;
  253. content: '';
  254. width: 36rpx;
  255. height: 30rpx;
  256. border: 2px solid #FFFFFF;
  257. border-left: 2px solid transparent !important;
  258. border-top: 2px solid transparent !important;
  259. border-right: 2px solid transparent !important;
  260. border-radius: 50%;
  261. left:50%;
  262. bottom: -12rpx;
  263. margin-left: -24rpx;
  264. }
  265. }
  266. }
  267. .search{
  268. width: 416rpx;
  269. height: 58rpx;
  270. background: rgba(255,255,255,0.3);
  271. border-radius: 50rpx;
  272. font-size: 24rpx;
  273. padding: 0 24rpx;
  274. .icon-ic_search{
  275. font-size: 32rpx;
  276. color: rgba(255,255,255,0.6);
  277. padding-left: 20rpx;
  278. }
  279. .name{
  280. color: #FFFFFF;
  281. position: relative;
  282. .iconfont{
  283. font-size: 16rpx;
  284. margin-left: 6rpx;
  285. }
  286. &:before{
  287. position: absolute;
  288. content: '';
  289. width: 1px;
  290. height: 24rpx;
  291. background-color: rgba(255,255,255,0.4);
  292. right: 0;
  293. top: 50%;
  294. margin-top: -12rpx;
  295. }
  296. padding-right: 20rpx;
  297. }
  298. .input{
  299. font-size: 24rpx;
  300. color: #FFFFFF;
  301. flex: 1;
  302. margin-left: 20rpx;
  303. }
  304. /deep/.placeholders{
  305. color: rgba(255,255,255,0.6);
  306. font-size: 24rpx;
  307. }
  308. }
  309. .pictrue{
  310. width: 58rpx;
  311. height: 58rpx;
  312. image {
  313. width: 100%;
  314. height: 100%;
  315. border-radius: 50%;
  316. }
  317. }
  318. }
  319. .list{
  320. position: relative;
  321. padding-bottom: 1rpx;
  322. .item{
  323. background-color: #fff;
  324. width: 710rpx;
  325. margin: 0 auto 20rpx auto;
  326. border-radius: 16rpx;
  327. padding: 30rpx 0 30rpx 24rpx;
  328. font-family: PingFang SC, PingFang SC;
  329. position: relative;
  330. overflow: hidden;
  331. &.on{
  332. border: 1px solid var(--view-theme);
  333. }
  334. .icon-a-icon_cornermark{
  335. position: absolute;
  336. right: -2rpx;
  337. top: -4rpx;
  338. color:var(--view-theme);
  339. font-size: 50rpx;
  340. }
  341. .left{
  342. flex: 1;
  343. position: relative;
  344. border-right: 1px solid #eee;
  345. padding-right: 20rpx;
  346. .name{
  347. font-weight: 500;
  348. font-size: 28rpx;
  349. color: #333333;
  350. }
  351. .address{
  352. font-weight: 400;
  353. font-size: 22rpx;
  354. color: #999999;
  355. margin-top: 16rpx;
  356. .iconfont{
  357. color: #666;
  358. font-size: 24rpx;
  359. margin-right: 14rpx;
  360. }
  361. .icon-icon_clock{
  362. font-size: 22rpx;
  363. }
  364. }
  365. .time{
  366. margin-top: 10rpx;
  367. }
  368. }
  369. .right{
  370. width: 182rpx;
  371. text-align: center;
  372. .gostore{
  373. font-weight: 400;
  374. font-size: 22rpx;
  375. color: var(--view-theme);
  376. }
  377. .distance{
  378. font-weight: 400;
  379. font-size: 20rpx;
  380. color: #999999;
  381. margin-top: 14rpx;
  382. }
  383. .telephone{
  384. .phone{
  385. width: 40rpx;
  386. height: 40rpx;
  387. border-radius: 50%;
  388. background: var(--view-minorColorT);
  389. margin: 20rpx 10rpx 0 10rpx;
  390. .iconfont{
  391. font-size: 20rpx;
  392. color: var(--view-theme);
  393. }
  394. }
  395. }
  396. }
  397. }
  398. }
  399. </style>