list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. <template>
  2. <view class="content">
  3. <view class="varHeight"></view>
  4. <view class="search flex">
  5. <view class="input-box flex">
  6. <view class=" input-content flex">
  7. <view class="iconfont iconsearch" ></view>
  8. <view class="input"><input type="text" placeholder="输入关键字搜索" @input='search' /></view>
  9. </view>
  10. </view>
  11. <view class="sousuo">
  12. 搜索
  13. </view>
  14. <!-- <picker mode="multiSelector" :range="listActionType" range-key='cate_name' @change="changeType"
  15. @columnchange='listChange'>
  16. <view class="shop-name clamp">分类</view>
  17. </picker>
  18. <view class="shop-name clamp" @click="initSearch">重置</view> -->
  19. </view>
  20. <view class="jg" style="height: 20rpx;"></view>
  21. <block :key="ind" v-for="(lss, ind) in list">
  22. <view class="goodsList-item" v-if="lss.show" @click="chooseStore(lss)">
  23. <view class="info-top flex">
  24. <image :src="lss.image" lazy-load mode="scaleToFill" style="width: 154rpx;height: 124rpx;"></image>
  25. <view class="store-name clamp2">{{ lss.name }}</view>
  26. <!-- <view class="ditu">
  27. <image src="" mode=""></image>
  28. </view> -->
  29. </view>
  30. <!-- <view class="tag">门店</view> -->
  31. <view class="dh" v-if="type == 0 || type == 5" @click.stop="markertap(lss)">导航</view>
  32. <view class="go" v-if="type == 7" @click.stop="navProduct(lss)">进入店铺</view>
  33. <view class="goodsList-content">
  34. <view class="info-tit">
  35. <image src="../../static/icon/md1.png" mode="" style="width: 28rpx;height: 25rpx; margin-right: 12rpx; margin-top: 20rpx;"></image>
  36. <text class="info-val">{{ lss.address }}</text>
  37. </view>
  38. <view class="info-tit">
  39. <image src="../../static/icon/md2.png" mode="" style="width: 28rpx;height: 28rpx; margin-right: 12rpx; "></image>
  40. <text class="info-val">{{ lss.phone }}</text>
  41. </view>
  42. <!-- <view class="info-tit">
  43. 地址:
  44. <text class="info-val">{{ lss.detailed_address }}</text>
  45. </view> -->
  46. <view class="tit">
  47. <text class="time">营业时间:08:30-18:30</text>
  48. </view>
  49. </view>
  50. </view>
  51. </block>
  52. <view class="jg" style="height: 20rpx;"></view>
  53. <uni-popup ref="popup" type="bottom" @click="close">
  54. <view class="popup_row">
  55. <view class="rows">
  56. <view class="rows-item" @click="toGaodeMap">高德地图</view>
  57. <view class="rows-item" @click="tobaiDuMap">百度地图</view>
  58. <!-- <view class="rows-item" @click="totengxunMap">腾讯地图</view> -->
  59. </view>
  60. </view>
  61. </uni-popup>
  62. </view>
  63. </template>
  64. <script>
  65. import {
  66. mapState,
  67. mapMutations
  68. } from 'vuex';
  69. import {
  70. store_list,
  71. getStoreType
  72. } from '@/api/index.js';
  73. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  74. export default {
  75. data() {
  76. return {
  77. // 当前选中的滑块
  78. list: [],
  79. keyword: '', //查询中的内容
  80. latitude1: '',
  81. longitude1: '',
  82. address: '',
  83. // 当前动态分类
  84. typeAction: {
  85. name: '分类',
  86. cid: ''
  87. },
  88. type: 0, //3->开通会员选择门店 4->自提选择门店 5->附近门店进入不做任何操作
  89. typeActionNum: 0, //当前选中的action
  90. typeList: [], //列表分类
  91. };
  92. },
  93. watch: {
  94. keyword(newValue, oldValue) {
  95. this.keyword = newValue;
  96. console.log(newValue);
  97. this.getShoping();
  98. }
  99. },
  100. computed: {
  101. ...mapState(['latitude', 'longitude']),
  102. listActionType() {
  103. if (this.typeList.length > 0) {
  104. return [this.typeList, this.typeList[this.typeActionNum].children]
  105. } else {
  106. return []
  107. }
  108. }
  109. },
  110. onLoad(opt) {
  111. if (opt.type) {
  112. this.type = opt.type;
  113. }
  114. this.getShoping();
  115. this.getStoreType();
  116. },
  117. // // #ifndef MP
  118. // // 点击键盘搜索事件
  119. // onNavigationBarSearchInputConfirmed(e) {
  120. // this.search();
  121. // },
  122. // // 搜索栏内容变化事件
  123. // onNavigationBarSearchInputChanged(e) {
  124. // this.keyword = e.text;
  125. // },
  126. // // #endif
  127. methods: {
  128. ...mapMutations(['setLat', 'setLon', 'setStoreInfo']),
  129. initSearch() {
  130. this.keyword = '';
  131. this.typeAction.cid = '';
  132. this.getShoping();
  133. },
  134. // 确认切换
  135. changeType(res) {
  136. console.log(res);
  137. const item = res.detail.value;
  138. const ar = this.typeList[item[0]].children[item[1]];
  139. this.typeAction.name = ar.cate_name
  140. this.typeAction.cid = ar.id
  141. this.getShoping();
  142. },
  143. // 列表切换
  144. listChange(res) {
  145. if (res.detail.column == 0) {
  146. this.typeActionNum = res.detail.value;
  147. }
  148. },
  149. // 查询店铺信息
  150. search(res) {
  151. this.keyword = res.detail.value;
  152. },
  153. markertap(e) {
  154. this.longitude1 = e.longitude;
  155. this.latitude1 = e.latitude;
  156. this.address = e.detailed_address;
  157. this.$refs.popup.open();
  158. },
  159. // 跳转店铺页面
  160. navProduct(item) {
  161. uni.navigateTo({
  162. url: './index?merid=' + item.id
  163. });
  164. },
  165. // 调用高德
  166. toGaodeMap() {
  167. let latitude = this.latitude1;
  168. let longitude = this.longitude1;
  169. let address = this.address;
  170. // console.log('选择高德', latitude, longitude, address);
  171. window.location.href = `https://uri.amap.com/marker?position=${longitude},${latitude}&name=${address}`;
  172. },
  173. // 调用腾讯
  174. totengxunMap() {
  175. let latitude = this.latitude1;
  176. let longitude = this.longitude1;
  177. let address = this.address;
  178. console.log('选择腾讯', latitude, longitude);
  179. window.location.href =
  180. `http://apis.map.qq.com/uri/v1/marker?marker=coord:${latitude},${longitude};addr:${address}`;
  181. },
  182. // 调用百度
  183. tobaiDuMap() {
  184. let latitude = this.latitude1;
  185. let longitude = this.longitude1;
  186. let latitude6 = this.latitude;
  187. let longitude6 = this.longitude;
  188. let address = this.address;
  189. // console.log('选择百度', latitude, longitude);
  190. // console.log('获取当前经纬度', latitude6, longitude6);
  191. window.location.href =
  192. `http://api.map.baidu.com/marker?location=${latitude},${longitude}&title=${address}&content=${address}&output=html&src=webapp.baidu.openAPIdemo`;
  193. },
  194. getStoreType() {
  195. let obj = this;
  196. getStoreType()
  197. .then(function({
  198. data
  199. }) {
  200. obj.typeList = data;
  201. })
  202. .catch(e => {
  203. console.log(e);
  204. });
  205. },
  206. //获取商店信息
  207. getShoping() {
  208. let obj = this;
  209. console.log(obj.longitude, obj.latitude);
  210. store_list({
  211. longitude: obj.longitude, //经度
  212. latitude: obj.latitude, //纬度
  213. keyword: obj.keyword,
  214. cid: obj.typeAction.cid
  215. })
  216. .then(function({
  217. data
  218. }) {
  219. console.log(data);
  220. obj.list = data.list.map(e => {
  221. e.show = true;
  222. return e;
  223. });
  224. })
  225. .catch(e => {
  226. console.log(e);
  227. });
  228. },
  229. //选择门店
  230. chooseStore(item) {
  231. if (this.type == 3) {
  232. this.$api.prePage().storeInfo = item;
  233. uni.navigateBack({});
  234. } else if (this.type == 4) {
  235. this.$api.prePage().shopAddress = item;
  236. uni.navigateBack({});
  237. } else if (this.type == 5) {} else if (this.type == 7) {
  238. this.navProduct(item);
  239. } else if (this.type == 6) {
  240. this.$api.prePage().storeInfo1 = item;
  241. uni.navigateBack({});
  242. } else {
  243. this.setStoreInfo(item);
  244. uni.navigateBack({});
  245. }
  246. }
  247. }
  248. };
  249. </script>
  250. <style lang="scss">
  251. page,
  252. .content {
  253. height: 100%;
  254. }
  255. .varHeight {
  256. height: var(--status-bar-height);
  257. }
  258. $slider-color: #fe9398; //滑块左侧颜色
  259. .goodsList-item {
  260. // background-color: #ffffff;
  261. // padding: 30rpx;
  262. // border-bottom: 1px solid $border-color-light;
  263. display: flex;
  264. align-items: center;
  265. margin: 0 auto 20rpx;
  266. width: 710rpx;
  267. height: 231rpx;
  268. padding: 25rpx 20rpx;
  269. background: #ffffff;
  270. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  271. border-radius: 10rpx;
  272. position: relative;
  273. .tag {
  274. width: 60rpx;
  275. line-height: 40rpx;
  276. // background: #ff6f0f;
  277. // border-radius: 5rpx;
  278. // font-size: 24rpx;
  279. // font-family: PingFang SC;
  280. // font-weight: 500;
  281. // color: #ffffff;
  282. text-align: center;
  283. position: absolute;
  284. top: 25rpx;
  285. right: 20rpx;
  286. }
  287. .dh {
  288. z-index: 3;
  289. width: 70rpx;
  290. line-height: 44rpx;
  291. border-radius: 10rpx;
  292. background: #000;
  293. font-size: 24rpx;
  294. font-family: PingFang SC;
  295. font-weight: 500;
  296. color: #ffffff;
  297. text-align: center;
  298. position: absolute;
  299. bottom: 25rpx;
  300. right: 20rpx;
  301. }
  302. .go {
  303. z-index: 3;
  304. width: 150rpx;
  305. line-height: 44rpx;
  306. border-radius: 10rpx;
  307. background: #ff5b53;
  308. font-size: 24rpx;
  309. font-family: PingFang SC;
  310. font-weight: 500;
  311. color: #ffffff;
  312. text-align: center;
  313. position: absolute;
  314. bottom: 25rpx;
  315. right: 20rpx;
  316. }
  317. .info-top {
  318. justify-content: flex-start;
  319. display: flex;
  320. justify-content: center;
  321. background-color: #E8E8E8;
  322. width: 180rpx;
  323. height: 180rpx;
  324. // background: #E8E8E8;
  325. border-radius: 10rpx;
  326. }
  327. .store-name {
  328. // width: 238rpx;
  329. // height: 40rpx;
  330. display: inline-block;
  331. font-size: 34rpx;
  332. font-family: PingFang SC;
  333. font-weight: bold;
  334. color: #333333;
  335. padding-left: 22rpx;
  336. text-align: center;
  337. position: absolute;
  338. top: 25rpx;
  339. left: 225rpx;
  340. }
  341. image {
  342. flex-shrink: 0;
  343. // border-radius: $border-radius-sm;
  344. // height: 180rpx;
  345. // width: 180rpx;
  346. width: 154rpx;
  347. height: 124rpx;
  348. // margin-left: 10rpx;
  349. // border-radius: 50%;
  350. }
  351. .slider {
  352. margin-top: 15rpx;
  353. justify-content: flex-start;
  354. .slider-box {
  355. width: 196rpx;
  356. border-radius: 99px;
  357. border: 1px solid $slider-color;
  358. height: 16rpx;
  359. .slider-action {
  360. background-color: $slider-color;
  361. height: 100%;
  362. }
  363. }
  364. .sales-nub {
  365. color: $font-color-light;
  366. font-size: 24rpx;
  367. height: 2.5em;
  368. overflow: hidden;
  369. }
  370. }
  371. .goodsList-content {
  372. // margin-left: 20rpx;
  373. margin-top: 14rpx;
  374. flex-grow: 1;
  375. // height: 180rpx;
  376. position: relative;
  377. padding-top: 20rpx;
  378. padding-left: 50rpx;
  379. .info-tit {
  380. // margin-top: 20rpx;
  381. line-height: 1.5;
  382. font-size: 24rpx;
  383. font-family: PingFang SC;
  384. font-weight: bold;
  385. color: #333333;
  386. .info-val {
  387. margin-bottom: 25rpx;
  388. font-weight: 500;
  389. // color:#666666
  390. }
  391. }
  392. .tit {
  393. // width: 239rpx;
  394. // height: 32rpx;
  395. // background: #FFece5 ;
  396. // opacity: 0.12;
  397. // border-radius: 16rpx 16rpx 16rpx 0rpx;
  398. margin-top: 25rpx;
  399. .time {
  400. // margin-top: 35rpx;
  401. line-height: 1.5;
  402. font-size: 20rpx;
  403. font-family: PingFang SC;
  404. font-weight: bold;
  405. color: #FF6309;
  406. }
  407. }
  408. .title {
  409. font-size: $font-base;
  410. color: $font-color-dark;
  411. font-weight: 500;
  412. width: 0;
  413. min-width: 100%;
  414. }
  415. .goods-money {
  416. position: absolute;
  417. left: 0;
  418. bottom: 0;
  419. width: 100%;
  420. .money-box {
  421. .money {
  422. font-size: $font-lg + 10rpx;
  423. color: $color-red;
  424. font-weight: bold;
  425. }
  426. .otMoney-box {
  427. font-size: $font-sm;
  428. .otMoney {
  429. color: $font-color-light;
  430. padding-right: 20rpx;
  431. }
  432. .sales {
  433. color: $font-color-light;
  434. }
  435. }
  436. }
  437. .cart {
  438. font-size: $font-base - 2rpx;
  439. border-radius: 99px;
  440. padding: 10rpx 20rpx;
  441. line-height: 1;
  442. color: #ffffff;
  443. background-color: $color-gray;
  444. &.seckill-action {
  445. border: 1px solid $color-red;
  446. background-color: $color-red;
  447. }
  448. }
  449. }
  450. }
  451. }
  452. .popup_row {
  453. width: 100%;
  454. height: 500rpx;
  455. background-color: #ffffff;
  456. border-radius: 20rpx;
  457. display: flex;
  458. justify-content: center;
  459. align-items: center;
  460. .rows {
  461. width: 100%;
  462. padding: 0 24rpx;
  463. .rows-item {
  464. height: 80rpx;
  465. line-height: 80rpx;
  466. text-align: center;
  467. width: 100%;
  468. font-size: 32rpx;
  469. color: #303133;
  470. // border-bottom: 1rpx solid #f0f0f0;
  471. }
  472. }
  473. }
  474. .search {
  475. justify-content: center;
  476. padding: 25rpx 24rpx 20rpx;
  477. align-items: center;
  478. background: #FFFFFF;
  479. .address {
  480. width: 32rpx;
  481. height: 38rpx;
  482. }
  483. // .shop-name {
  484. // height: 38rpx;
  485. // position: relative;
  486. // z-index: 100;
  487. // font-size: 30rpx;
  488. // font-family: PingFang SC;
  489. // font-weight: 500;
  490. // color: #ffffff;
  491. // padding-left: 10rpx;
  492. // flex-shrink: 0;
  493. // }
  494. .sousuo{
  495. height: 38rpx;
  496. position: relative;
  497. z-index: 100;
  498. font-size: 30rpx;
  499. font-family: PingFang SC;
  500. font-weight: 500;
  501. color: #666666;
  502. padding-left: 10rpx;
  503. flex-shrink: 0;
  504. }
  505. .input-box {
  506. position: relative;
  507. z-index: 99;
  508. // width: 700rpx;
  509. // height: 60rpx;
  510. // background: #FFF;
  511. box-shadow: 0px 9rpx 21rpx 0px rgba(4, 114, 69, 0.22);
  512. // border-radius: 30px;
  513. margin: 0 auto;
  514. width: 610rpx;
  515. height: 64rpx;
  516. background: #F6F6F6;
  517. border-radius: 10rpx;
  518. .input-content {
  519. justify-content: center;
  520. position: relative;
  521. z-index: 11;
  522. border-radius: 99rpx;
  523. flex-grow: 1;
  524. padding: 5rpx 30rpx;
  525. background: #F6F6F6;
  526. .iconsearch {
  527. font-size: 50rpx;
  528. color: #666666;
  529. margin-left: 120rpx;
  530. }
  531. .input {
  532. margin-left: 19rpx;
  533. color: #666666;
  534. flex-grow: 1;
  535. input {
  536. font-size: 26rpx;
  537. color: #666666;
  538. }
  539. }
  540. }
  541. .input-button {
  542. padding-left: 20rpx;
  543. font-size: $font-base;
  544. height: 100%;
  545. }
  546. }
  547. }
  548. </style>