index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  1. <template>
  2. <view :style="{ minHeight: sys.windowHeight + 'px' }" :class="[$tm.vx.state().tmVuetify.black ? 'black' : ' ']">
  3. <tm-menubars title="" :shadow="0" :showback="false"></tm-menubars>
  4. <view class="C1b1b1b">
  5. <tm-search v-model="soso" color="white" confirm-text="" @click="sosoFun">
  6. <!-- <template #right>
  7. <view class="xiangji">
  8. <image src="/static/img/xiangji.png" mode="widthFix"></image>
  9. </view>
  10. </template> -->
  11. </tm-search>
  12. <view class="dingwei">
  13. <tm-quickCity color="blue" v-model="offshow" :defaultValue.sync="defaultValue" @change="qiehuandizhi">
  14. <image style="vertical-align: middle;" src="/static/img/dingwei.png" mode="widthFix"></image>
  15. <text style="vertical-align: middle;" class="text-size-g">{{chengshi}}</text>
  16. </tm-quickCity>
  17. </view>
  18. </view>
  19. <view class="zhuti mt-50">
  20. <tm-grid :grid="5" :list="list3" :icon-size="140" font-color="white"></tm-grid>
  21. <!-- 今日穿搭 -->
  22. <tm-sheet class="lunbo bushan1">
  23. <view class="py-10 text-size-g dianz">
  24. <image src="/static/img/6.png" mode="widthFix"></image>
  25. <text class="text-white">今日穿搭推荐</text>
  26. </view>
  27. <view class="pb-20 text-size-g">
  28. <view class="text-white" style="display: flex;justify-content: space-between;">
  29. <view v-if="list.length !=0"
  30. style="display: flex;align-items: center; justify-content: center;width: 46%;font-size: 16px;font-weight: bold;">
  31. {{list[current].name}}
  32. </view>
  33. <view class="qiehuan" v-if="list.length !=0">
  34. <tm-translate class="fl a_1" :auto="true" ref="a_1" :duration="80" animation-name="zoomIn">
  35. <image v-if="current==0" class="anniu mr-10" src="/static/img/14.png" mode="widthFix">
  36. </image>
  37. <image v-if="current!=0" @click="xia()" class="anniu mr-10" src="/static/img/12.png"
  38. mode="widthFix"></image>
  39. </tm-translate>
  40. <tm-swiper @click="tiaoclick" @change="jinriFun" class="tu fl" :previmage="false"
  41. :noSwiping="true" :height="220" :width="250" :current="current" :margin="8"
  42. :autoplay="false" :list="list"></tm-swiper>
  43. <tm-translate class="fl a_1" :auto="true" ref="a_5" :duration="80" animation-name="zoomIn">
  44. <image v-if="current<(list.length-1)" @click="shang()" class="anniu fl ml-10"
  45. src="/static/img/13.png" mode="widthFix"></image>
  46. <image v-if="current>(list.length-2)" class="anniu fl ml-10" src="/static/img/11.png"
  47. mode="widthFix"></image>
  48. </tm-translate>
  49. </view>
  50. </view>
  51. <tm-empty v-if="list.length ==0" label="暂无推荐" color="white" icon="icon-paperplane-fill"></tm-empty>
  52. </view>
  53. </tm-sheet>
  54. <!-- 明日计划 -->
  55. <tm-sheet class="lunbo1 bushan2">
  56. <view class="py-10 text-size-g dianz mingri">
  57. <image src="/static/img/17.png" mode="widthFix"></image>
  58. <text class="text-white">明日计划</text>
  59. </view>
  60. <view class="mt-20 text-size-g jihua">
  61. <tm-translate class="a_1" ref="a_6" :auto="true" :duration="80" animation-name="zoomIn">
  62. <image @click="jihuashang()" class="anniu mr-10" src="/static/img/18.png" mode="widthFix">
  63. </image>
  64. </tm-translate>
  65. <view class="bbb">
  66. <tm-swiper @click="tiao" class="aaa" :previmage="false" :noSwiping="true" :current="current1"
  67. :autoplay="false" :list="list1"></tm-swiper>
  68. </view>
  69. <tm-translate class="a_1" ref="a_4" :auto="true" :duration="80" animation-name="zoomIn"
  70. style="right: 0px;">
  71. <image @click="jihuaxia()" class="anniu mr-10" src="/static/img/19.png" mode="widthFix"></image>
  72. </tm-translate>
  73. <view style="clear: both;"></view>
  74. </view>
  75. </tm-sheet>
  76. <!-- 热门穿搭 -->
  77. <tm-sheet class="lunbo1" style="margin-bottom: 70px !important;">
  78. <view class="py-10 text-size-g dianz mingri">
  79. <image src="/static/img/24.png" mode="widthFix"></image>
  80. <text class="text-white">热门穿搭</text>
  81. </view>
  82. <view class="text-size-g jihua remen">
  83. <view style="width: 48%;" class="fl">
  84. <view @click="tiaodapei(item.id)" v-for="(item,index) in listdata" v-if="index%2==0"
  85. class="round-3 shadow-2 overflow pa-10 mt-20"
  86. :class="[$tm.vx.state().tmVuetify.black ? 'black' : 'white']">
  87. <image class="logo" :src="item.image" mode="widthFix"></image>
  88. <view class="pa-10 text-size-s">
  89. <view class="text-overflow-2">
  90. <text>{{item.text}}</text>
  91. </view>
  92. <view class="mt-2 flex-between flex-center">
  93. <view>
  94. <!-- <tm-translate ref="a_2" :duration="80" animation-name="fadeIn"> -->
  95. <!-- <image class="remenzan" :src="dianzan1?'/static/img/29.png':'/static/img/9.png'" mode="widthFix"></image> -->
  96. <!-- </tm-translate> -->
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. <view style="width: 46%;" class="fr">
  103. <view style="width: 100%;" class="fr round-3 shadow-2 overflow pa-10 mt-20"
  104. :class="[$tm.vx.state().tmVuetify.black ? 'black' : 'white']">
  105. <view class="py-10 text-size-m dianz mingri">
  106. <text style="vertical-align: middle;" class="text-white">销量飙升榜</text>
  107. <image style="width: 25px;margin-left: 8px;" src="/static/img/36.png" mode="widthFix">
  108. </image>
  109. </view>
  110. <view class="py-10 text-size-s dianz mingri">
  111. <text class="text-white">亿万新品趋势洞察</text>
  112. </view>
  113. <view class="mt-10" v-for="item in shopGoodsList" @click="xiangqing()">
  114. <image class="chuandaimg fl" :src="item.image" mode="widthFix"></image>
  115. <view class="chuandazi fr">
  116. <view class="text-size-m text-weight-b text-overflow-2">{{item.goods_name}}</view>
  117. <view class="tm-cartCellListFood-label text-size-s text-grey py-8">{{item.goods_details}}
  118. </view>
  119. <image class="gengduo fr" src="/static/img/40.png" mode="widthFix"></image>
  120. </view>
  121. <view style="clear: both;"></view>
  122. </view>
  123. </view>
  124. <view style="clear: both;"></view>
  125. <view @click="tiaodapei(item.id)" v-for="(item,index) in listdata" v-if="index%2==1"
  126. class="round-3 shadow-2 overflow pa-10 mt-20"
  127. :class="[$tm.vx.state().tmVuetify.black ? 'black' : 'white']">
  128. <image class="logo" :src="item.image" mode="widthFix"></image>
  129. <view class="pa-10 text-size-s">
  130. <view class="text-overflow-2">
  131. <text>{{item.text}}</text>
  132. </view>
  133. <view class="mt-24 flex-between flex-center">
  134. </view>
  135. </view>
  136. </view>
  137. </view>
  138. <view style="clear: both;"></view>
  139. <!-- <view style="clear: both;" class="more ma-40 pt-40" @click="gengmore()">
  140. <image src="/static/img/30.png" mode="widthFix"></image>
  141. <text class="text-size-s">下拉加载更多~</text>
  142. </view> -->
  143. </view>
  144. </tm-sheet>
  145. </view>
  146. </view>
  147. </template>
  148. <script>
  149. // 引入腾讯sdk
  150. import qqmapsdk from '@/js_sdk/qqmap-wx-jssdk.js'
  151. const QQMapWX = new qqmapsdk({
  152. key: '5WNBZ-2JYR6-SPUSL-M3WGH-U4KDT-K2FYV'
  153. });
  154. import {
  155. myRequest
  156. } from '@/api/request.js'
  157. export default {
  158. data() {
  159. return {
  160. offshow:false,
  161. chengshi:"南京",
  162. defaultValue: [],
  163. soso: '',
  164. aab: false,
  165. shoucangsrc: true,
  166. dianzan: true,
  167. dianzan1: true,
  168. list3: [],
  169. top: 60,
  170. sys: null,
  171. list2: [{
  172. img: '/static/img/39.png',
  173. title: '单品推荐',
  174. text: '3.9万人追捧'
  175. }, {
  176. img: '/static/img/37.png',
  177. title: '单品推荐',
  178. text: '3.9万人追捧'
  179. }, {
  180. img: '/static/img/38.png',
  181. title: '单品推荐',
  182. text: '3.9万人追捧'
  183. }],
  184. list: [],
  185. list1: [],
  186. current: 0,
  187. current1: 0,
  188. listdata: [],
  189. pagesize:2,
  190. page:1,
  191. shopGoodsList:[]
  192. };
  193. },
  194. onLoad() {
  195. // #ifdef MP
  196. this.top = uni.upx2px(150);
  197. // #endif
  198. },
  199. onShow(){
  200. },
  201. created() {
  202. var that = this;
  203. console.log("1111")
  204. setTimeout(function() {
  205. if (uni.getStorageSync("token") == "") {
  206. uni.redirectTo({
  207. url: "/pages/login/index"
  208. })
  209. }
  210. }, 1000)
  211. this.sys = uni.getSystemInfoSync();
  212. this.getService();
  213. this.getremmend();
  214. this.getHot();
  215. this.getPlan();
  216. this.biaoshen();
  217. },
  218. methods: {
  219. getLocation() {
  220. var that=this;
  221. uni.getSetting({
  222. success(res) {
  223. if (!res.authSetting['scope.userLocation']) {
  224. // 未授权
  225. uni.authorize({
  226. scope: 'scope.userLocation',
  227. success() { //1.1 允许授权
  228. console.log("允许授权")
  229. that.getLocation()
  230. },
  231. fail(){ //1.2 拒绝授权
  232. console.log("你拒绝了授权,无法获得周边信息")
  233. }
  234. })
  235. }else{
  236. // 已授权 ..(获取位置信息)
  237. that.getLocation()
  238. }
  239. }
  240. });
  241. // uni.getLocation({
  242. // type: 'wgs84',
  243. // altitude: true,
  244. // success(res) {
  245. // console.log(res)
  246. // let latAndLon = {
  247. // mylog: res.longitude,
  248. // mylat: res.latitude
  249. // }
  250. // that.getUserLocation(latAndLon)
  251. // }
  252. // })
  253. },
  254. //腾讯地图逆解析,解决跨域
  255. getUserLocation(e) {
  256. const that = this;
  257. let locationObj = e.mylat + ',' + e.mylog;
  258. QQMapWX.reverseGeocoder({
  259. location: {
  260. latitude: e.mylat,
  261. longitude: e.mylog
  262. },
  263. success: function(res) {
  264. console.log("解析地址成功");
  265. console.log(res);
  266. // 省
  267. let province = res.result.ad_info.province;
  268. // 市
  269. let city = res.result.ad_info.city;
  270. console.log(province);
  271. console.log(city);
  272. },
  273. fail: function(res) {
  274. uni.showToast({
  275. title: '定位失败',
  276. duration: 2000,
  277. icon: "none"
  278. })
  279. console.log(res);
  280. },
  281. complete: function(res) {
  282. // console.log(res);
  283. },
  284. })
  285. },
  286. biaoshen(){
  287. let that = this;
  288. myRequest({
  289. url: "/api/ShopGoods/shopGoodsList",
  290. method: 'get',
  291. data: {}
  292. }).then(res => {
  293. if (res.data.code == 200) {
  294. that.shopGoodsList=res.data.data;
  295. // res.data.data.forEach(item => {
  296. // that.list3.push({
  297. // icon: item.img,
  298. // text: item.name,
  299. // sort: item.sort
  300. // })
  301. // })
  302. } else {
  303. that.$refs.toast.show({
  304. model: 'error',
  305. label: res.data.msg
  306. })
  307. }
  308. })
  309. },
  310. qiehuandizhi(e){
  311. if(e[2]!=null){
  312. this.offshow=false;
  313. this.chengshi=e[1];
  314. }
  315. },
  316. xiangqing(){
  317. uni.navigateTo({
  318. url: "/pages/shopdetail/index",
  319. })
  320. },
  321. // 获取用户服务列表
  322. getService() {
  323. let that = this;
  324. myRequest({
  325. url: "/api/Service/serviceList",
  326. method: 'get',
  327. data: that.reqData
  328. }).then(res => {
  329. if (res.data.code == 200) {
  330. res.data.data.forEach(item => {
  331. that.list3.push({
  332. icon: item.img,
  333. text: item.name,
  334. sort: item.sort
  335. })
  336. })
  337. } else {
  338. that.$refs.toast.show({
  339. model: 'error',
  340. label: res.data.msg
  341. })
  342. }
  343. })
  344. },
  345. // 获取穿搭推荐
  346. getremmend() {
  347. let that = this;
  348. myRequest({
  349. url: "/api/Collocation/recommendList",
  350. method: 'get',
  351. data: that.reqData
  352. }).then(res => {
  353. if (res.data.code == 200) {
  354. res.data.data.forEach(item => {
  355. that.list.push({
  356. src: item.image,
  357. name: item.title,
  358. id:item.id
  359. })
  360. })
  361. } else {
  362. that.$refs.toast.show({
  363. model: 'error',
  364. label: res.data.msg
  365. })
  366. }
  367. })
  368. },
  369. // 获取明日计划
  370. getPlan() {
  371. let that = this;
  372. myRequest({
  373. url: "/api/Scene/sceneList",
  374. method: 'get',
  375. data: that.reqData
  376. }).then(res => {
  377. if (res.data.code == 200) {
  378. res.data.data.forEach(item => {
  379. that.list1.push({
  380. src: item.img,
  381. title: item.scene_name
  382. })
  383. })
  384. } else {
  385. that.$refs.toast.show({
  386. model: 'error',
  387. label: res.data.msg
  388. })
  389. }
  390. })
  391. },
  392. // 获取热门穿搭
  393. getHot() {
  394. let that = this;
  395. myRequest({
  396. url: "/api/ShopCollocation/hotList",
  397. method: 'get',
  398. data: {page:that.page,pagesize:that.pagesize}
  399. }).then(res => {
  400. if (res.data.code == 200) {
  401. res.data.data.data.forEach(item => {
  402. that.listdata.push({
  403. image: item.image,
  404. text: item.title,
  405. id:item.id
  406. })
  407. })
  408. } else {
  409. that.$refs.toast.show({
  410. model: 'error',
  411. label: res.data.msg
  412. })
  413. }
  414. })
  415. },
  416. tiaodapei(id) {
  417. console.log(id)
  418. uni.navigateTo({
  419. url: "/pages/shouyedetail/index?id="+id,
  420. })
  421. },
  422. tiao() {
  423. uni.navigateTo({
  424. url: "/pages/bianji/index",
  425. })
  426. },
  427. tiaoclick(e) {
  428. uni.navigateTo({
  429. url: "/pages/zidingyikan/index?id="+e.data.id+"&type=1",
  430. })
  431. },
  432. jinriFun(e) {
  433. this.current = e;
  434. },
  435. sosoFun() {
  436. uni.navigateTo({
  437. url: "/pages/sousuo/index",
  438. })
  439. },
  440. gengmore() {
  441. },
  442. jihuashang() {
  443. if (this.current1 == 0) {
  444. return
  445. }
  446. this.$refs.a_6.play()
  447. this.current1 = this.current1 - 1;
  448. },
  449. jihuaxia() {
  450. if (this.current1 > (this.list1.length - 5)) {
  451. return
  452. }
  453. this.$refs.a_4.play()
  454. this.current1 = this.current1 + 1;
  455. },
  456. shouc() {
  457. this.shoucangsrc = !this.shoucangsrc;
  458. this.$refs.a_3.play()
  459. },
  460. zan() {
  461. this.dianzan = !this.dianzan;
  462. this.$refs.a_2.play()
  463. },
  464. shang() {
  465. this.$refs.a_5.play()
  466. this.current = this.current + 1;
  467. },
  468. xia() {
  469. this.$refs.a_1.play()
  470. this.current = this.current - 1;
  471. }
  472. },
  473. }
  474. </script>
  475. <style lang="scss">
  476. /deep/ .tm-menubars .body {
  477. background-color: #1b1b1b !important;
  478. }
  479. /deep/ .aaa uni-image {
  480. width: 52px !important;
  481. height: 52px !important;
  482. }
  483. /deep/ .aaa uni-swiper-item {
  484. width: 55px !important;
  485. height: 80px !important;
  486. padding: 0 5px !important;
  487. }
  488. .xiangji image {
  489. width: 30px;
  490. height: 22px;
  491. }
  492. .suosou image {
  493. width: 40px;
  494. }
  495. /deep/ .icon-search {
  496. font-size: 23px !important;
  497. color: #8E8E93 !important;
  498. }
  499. /deep/ .tm-search {
  500. width: 94%;
  501. margin: 0 auto;
  502. background-color: #414141 !important;
  503. border-radius: 10px;
  504. }
  505. /deep/ .tm-search .grey-darken-5 {
  506. background-color: #414141 !important;
  507. }
  508. .dingwei {
  509. width: 92%;
  510. margin: 0 auto;
  511. margin-top: 20px;
  512. padding-bottom: 20px;
  513. }
  514. .dingwei image {
  515. width: 25px;
  516. margin-right: 10px;
  517. }
  518. /deep/ .tm-col {
  519. width: 20% !important;
  520. }
  521. .zhuti {
  522. padding: 10px 10px;
  523. }
  524. /deep/ .lunbo {
  525. margin: 0 !important;
  526. padding: 8px !important;
  527. margin-top: 50px !important;
  528. }
  529. .dianz image {
  530. width: 35px;
  531. vertical-align: middle;
  532. margin-right: 10px;
  533. }
  534. /deep/ .text-size-s span,
  535. /deep/ .text-size-g {
  536. font-size: 15px;
  537. }
  538. .touxiang image {
  539. width: 40px;
  540. margin-right: 10px;
  541. vertical-align: middle;
  542. }
  543. .shoucang image {
  544. width: 45px;
  545. }
  546. .qiehuan {
  547. float: right;
  548. }
  549. .qiehuan .a_1 {
  550. margin-top: 25%;
  551. }
  552. .qiehuan .anniu {
  553. width: 20px;
  554. height: 20px !important;
  555. }
  556. .di {
  557. background: #0D0D0D;
  558. width: 45px;
  559. height: 45px;
  560. text-align: center;
  561. line-height: 50px;
  562. border-radius: 30px;
  563. }
  564. .mingri image {
  565. width: 30px;
  566. margin-right: 12px;
  567. }
  568. .di image {
  569. width: 22px;
  570. margin: 0 !important;
  571. height: 20px !important;
  572. }
  573. .jihua image {
  574. width: 30px;
  575. height: 30px;
  576. }
  577. .jihua {
  578. position: relative;
  579. }
  580. .jihua .a_1 {
  581. position: absolute;
  582. top: 10%;
  583. }
  584. .bbb {
  585. width: 75% !important;
  586. margin: 0 auto !important;
  587. }
  588. /deep/ .bbb uni-swiper {
  589. width: 100% !important;
  590. height: 90px !important;
  591. }
  592. /deep/ .bbb .flex-start {
  593. background: rgba(0, 0, 0, 0) !important;
  594. padding: 0 !important;
  595. width: 100% !important;
  596. text-align: center;
  597. margin-top: 30px;
  598. }
  599. /deep/ .lunbo1 {
  600. margin: 0 !important;
  601. padding: 8px !important;
  602. margin-top: 20px !important;
  603. }
  604. .remenzan {
  605. width: 18px !important;
  606. margin-top: 10px;
  607. }
  608. .remen .logo {
  609. width: 100%;
  610. }
  611. .more {
  612. text-align: center;
  613. }
  614. .more image {
  615. margin-right: 10px;
  616. vertical-align: middle;
  617. }
  618. .chuandaimg {
  619. width: 50% !important;
  620. }
  621. .chuandazi {
  622. width: 48% !important;
  623. }
  624. /deep/ .lunbo1 .fulled {
  625. width: 100% !important;
  626. }
  627. /deep/ .gengduo {
  628. width: 30px !important;
  629. margin-top: 10px !important;
  630. }
  631. // 防止闪
  632. /deep/ .zhuti .tm-grid{min-height: 70px !important;}
  633. /deep/ .zhuti .bushan1{min-height: 160px !important;}
  634. /deep/ .zhuti .bushan2{min-height: 157px !important;}
  635. </style>