index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  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 disabled="true" 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" @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(item)">
  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 v-if="total>listdata.length" 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. import {
  150. myRequest
  151. } from '@/api/request.js'
  152. import qqmapsdk from '../../js_sdk/qqmap-wx-jssdk.js'
  153. const QQMapWX = new qqmapsdk({
  154. key: 'KNABZ-OAVCJ-O5IFJ-KBNST-SVIIZ-2EB3G'
  155. });
  156. export default {
  157. data() {
  158. return {
  159. offshow:false,
  160. chengshi:"南京",
  161. defaultValue: [],
  162. soso: '',
  163. aab: false,
  164. shoucangsrc: true,
  165. dianzan: true,
  166. dianzan1: true,
  167. list3: [],
  168. top: 60,
  169. sys: null,
  170. list2: [],
  171. list: [],
  172. list1: [],
  173. current: 0,
  174. current1: 0,
  175. listdata: [],
  176. pagesize:10,
  177. page:1,
  178. total:0,
  179. shopGoodsList:[]
  180. };
  181. },
  182. onLoad() {
  183. // #ifdef MP
  184. this.top = uni.upx2px(150);
  185. // #endif
  186. },
  187. created() {
  188. var that = this;
  189. setTimeout(function() {
  190. if (uni.getStorageSync("token") == "") {
  191. uni.redirectTo({
  192. url: "/pages/login/index"
  193. })
  194. }
  195. }, 1000)
  196. this.sys = uni.getSystemInfoSync();
  197. this.getService();
  198. this.getremmend();
  199. this.getHot();
  200. this.getPlan();
  201. this.biaoshen();
  202. this.getCity()
  203. },
  204. methods: {
  205. getCity(){
  206. var that=this;
  207. uni.getLocation({
  208. type: 'wgs84',
  209. geocode: true,
  210. success: (res) => {
  211. console.log("获取经纬度成功");
  212. this.latitude = res.latitude;
  213. this.longitude = res.longitude;
  214. },
  215. fail: () => {
  216. console.log("获取经纬度失败");
  217. },
  218. complete: () => {
  219. // 解析地址
  220. QQMapWX.reverseGeocoder({
  221. location: {
  222. latitude: this.latitude,
  223. longitude: this.longitude
  224. },
  225. success: function(res) {
  226. console.log("解析地址成功");
  227. console.log(res);
  228. // 省
  229. let province = res.result.ad_info.province;
  230. // 市
  231. let city = res.result.ad_info.city;
  232. that.chengshi=city;
  233. console.log(province);
  234. console.log(city);
  235. },
  236. fail: function(res) {
  237. // uni.showToast({
  238. // title: '定位失败',
  239. // duration: 2000,
  240. // icon: "none"
  241. // })
  242. },
  243. complete: function(res) {
  244. console.log(res);
  245. }
  246. })
  247. }
  248. })
  249. },
  250. biaoshen(){
  251. let that = this;
  252. myRequest({
  253. url: "/api/ShopGoods/shopGoodsList",
  254. method: 'get',
  255. data: {}
  256. }).then(res => {
  257. if (res.data.code == 200) {
  258. that.shopGoodsList=res.data.data;
  259. // res.data.data.forEach(item => {
  260. // that.list3.push({
  261. // icon: item.img,
  262. // text: item.name,
  263. // sort: item.sort
  264. // })
  265. // })
  266. } else {
  267. that.$refs.toast.show({
  268. model: 'error',
  269. label: res.data.msg
  270. })
  271. }
  272. })
  273. },
  274. qiehuandizhi(e){
  275. if(e[2]!=null){
  276. this.offshow=false;
  277. this.chengshi=e[1];
  278. }
  279. },
  280. xiangqing(data){
  281. uni.navigateTo({
  282. url: "/pages/shopdetail/index?cartId="+data.id+'&classId='+data.category_id,
  283. })
  284. },
  285. // 获取用户服务列表
  286. getService() {
  287. let that = this;
  288. myRequest({
  289. url: "/api/Service/serviceList",
  290. method: 'get',
  291. data: that.reqData
  292. }).then(res => {
  293. if (res.data.code == 200) {
  294. res.data.data.forEach(item => {
  295. that.list3.push({
  296. icon: item.img,
  297. text: item.name,
  298. sort: item.sort
  299. })
  300. })
  301. } else {
  302. that.$refs.toast.show({
  303. model: 'error',
  304. label: res.data.msg
  305. })
  306. }
  307. })
  308. },
  309. // 获取穿搭推荐
  310. getremmend() {
  311. let that = this;
  312. myRequest({
  313. url: "/api/Collocation/recommendList",
  314. method: 'get',
  315. data: that.reqData
  316. }).then(res => {
  317. if (res.data.code == 200) {
  318. res.data.data.forEach(item => {
  319. that.list.push({
  320. src: item.image,
  321. name: item.title,
  322. id:item.id
  323. })
  324. })
  325. } else {
  326. that.$refs.toast.show({
  327. model: 'error',
  328. label: res.data.msg
  329. })
  330. }
  331. })
  332. },
  333. // 获取明日计划
  334. getPlan() {
  335. let that = this;
  336. myRequest({
  337. url: "/api/Scene/sceneList",
  338. method: 'get',
  339. data: that.reqData
  340. }).then(res => {
  341. if (res.data.code == 200) {
  342. res.data.data.forEach(item => {
  343. that.list1.push({
  344. src: item.img,
  345. title: item.scene_name
  346. })
  347. })
  348. } else {
  349. that.$refs.toast.show({
  350. model: 'error',
  351. label: res.data.msg
  352. })
  353. }
  354. })
  355. },
  356. // 获取热门穿搭
  357. getHot() {
  358. let that = this;
  359. myRequest({
  360. url: "/api/ShopCollocation/hotList",
  361. method: 'post',
  362. data: {page:that.page,pagesize:that.pagesize}
  363. }).then(res => {
  364. if (res.data.code == 200) {
  365. res.data.data.data.forEach(item => {
  366. that.listdata.push({
  367. image: item.image,
  368. text: item.title,
  369. id:item.id
  370. })
  371. })
  372. that.total=res.data.data.total;
  373. } else {
  374. that.$refs.toast.show({
  375. model: 'error',
  376. label: res.data.msg
  377. })
  378. }
  379. })
  380. },
  381. tiaodapei(id) {
  382. console.log(id)
  383. uni.navigateTo({
  384. url: "/pages/shouyedetail/index?id="+id,
  385. })
  386. },
  387. tiao(e) {
  388. console.log(e)
  389. uni.navigateTo({
  390. url: "/pages/bianji/index",
  391. })
  392. },
  393. tiaoclick(e) {
  394. uni.navigateTo({
  395. url: "/pages/zidingyikan/index?id="+e.data.id+"&type=1",
  396. })
  397. },
  398. jinriFun(e) {
  399. this.current = e;
  400. },
  401. sosoFun() {
  402. uni.navigateTo({
  403. url: "/pages/sousuo/index",
  404. })
  405. },
  406. gengmore() {
  407. this.page=this.page+1;
  408. this.getHot();
  409. },
  410. jihuashang() {
  411. if (this.current1 == 0) {
  412. return
  413. }
  414. this.$refs.a_6.play()
  415. this.current1 = this.current1 - 1;
  416. },
  417. jihuaxia() {
  418. if (this.current1 > (this.list1.length - 5)) {
  419. return
  420. }
  421. this.$refs.a_4.play()
  422. this.current1 = this.current1 + 1;
  423. },
  424. shouc() {
  425. this.shoucangsrc = !this.shoucangsrc;
  426. this.$refs.a_3.play()
  427. },
  428. zan() {
  429. this.dianzan = !this.dianzan;
  430. this.$refs.a_2.play()
  431. },
  432. shang() {
  433. this.$refs.a_5.play()
  434. this.current = this.current + 1;
  435. },
  436. xia() {
  437. this.$refs.a_1.play()
  438. this.current = this.current - 1;
  439. }
  440. },
  441. }
  442. </script>
  443. <style lang="scss">
  444. /deep/ .tm-menubars .body {
  445. background-color: #1b1b1b !important;
  446. }
  447. /deep/ .aaa uni-image {
  448. width: 52px !important;
  449. height: 52px !important;
  450. }
  451. /deep/ .aaa uni-swiper-item {
  452. width: 55px !important;
  453. height: 80px !important;
  454. padding: 0 5px !important;
  455. }
  456. .xiangji image {
  457. width: 30px;
  458. height: 22px;
  459. }
  460. .suosou image {
  461. width: 40px;
  462. }
  463. /deep/ .icon-search {
  464. font-size: 23px !important;
  465. color: #8E8E93 !important;
  466. }
  467. /deep/ .tm-search {
  468. width: 94%;
  469. margin: 0 auto;
  470. background-color: #414141 !important;
  471. border-radius: 10px;
  472. }
  473. /deep/ .tm-search .grey-darken-5 {
  474. background-color: #414141 !important;
  475. }
  476. .dingwei {
  477. width: 92%;
  478. margin: 0 auto;
  479. margin-top: 20px;
  480. padding-bottom: 20px;
  481. }
  482. .dingwei image {
  483. width: 25px;
  484. margin-right: 10px;
  485. }
  486. /deep/ .tm-col {
  487. width: 20% !important;
  488. }
  489. .zhuti {
  490. padding: 10px 10px;
  491. }
  492. /deep/ .lunbo {
  493. margin: 0 !important;
  494. padding: 8px !important;
  495. margin-top: 50px !important;
  496. }
  497. .dianz image {
  498. width: 35px;
  499. vertical-align: middle;
  500. margin-right: 10px;
  501. }
  502. /deep/ .text-size-s span,
  503. /deep/ .text-size-g {
  504. font-size: 15px;
  505. }
  506. .touxiang image {
  507. width: 40px;
  508. margin-right: 10px;
  509. vertical-align: middle;
  510. }
  511. .shoucang image {
  512. width: 45px;
  513. }
  514. .qiehuan {
  515. float: right;
  516. }
  517. .qiehuan .a_1 {
  518. margin-top: 25%;
  519. }
  520. .qiehuan .anniu {
  521. width: 20px;
  522. height: 20px !important;
  523. }
  524. .di {
  525. background: #0D0D0D;
  526. width: 45px;
  527. height: 45px;
  528. text-align: center;
  529. line-height: 50px;
  530. border-radius: 30px;
  531. }
  532. .mingri image {
  533. width: 30px;
  534. margin-right: 12px;
  535. }
  536. .di image {
  537. width: 22px;
  538. margin: 0 !important;
  539. height: 20px !important;
  540. }
  541. .jihua image {
  542. width: 30px;
  543. height: 30px;
  544. }
  545. .jihua {
  546. position: relative;
  547. }
  548. .jihua .a_1 {
  549. position: absolute;
  550. top: 10%;
  551. }
  552. .bbb {
  553. width: 75% !important;
  554. margin: 0 auto !important;
  555. }
  556. /deep/ .bbb uni-swiper {
  557. width: 100% !important;
  558. height: 90px !important;
  559. }
  560. /deep/ .bbb .flex-start {
  561. background: rgba(0, 0, 0, 0) !important;
  562. padding: 0 !important;
  563. width: 100% !important;
  564. text-align: center;
  565. margin-top: 30px;
  566. }
  567. /deep/ .lunbo1 {
  568. margin: 0 !important;
  569. padding: 8px !important;
  570. margin-top: 20px !important;
  571. }
  572. .remenzan {
  573. width: 18px !important;
  574. margin-top: 10px;
  575. }
  576. .remen .logo {
  577. width: 100%;
  578. }
  579. .more {
  580. text-align: center;
  581. }
  582. .more image {
  583. margin-right: 10px;
  584. vertical-align: middle;
  585. }
  586. .chuandaimg {
  587. width: 50% !important;
  588. }
  589. .chuandazi {
  590. width: 48% !important;
  591. }
  592. /deep/ .lunbo1 .fulled {
  593. width: 100% !important;
  594. }
  595. /deep/ .gengduo {
  596. width: 30px !important;
  597. margin-top: 10px !important;
  598. }
  599. // 防止闪
  600. /deep/ .zhuti .tm-grid{min-height: 70px !important;}
  601. /deep/ .zhuti .bushan1{min-height: 160px !important;}
  602. /deep/ .zhuti .bushan2{min-height: 157px !important;}
  603. /deep/ .uni-tabbar{background-color: #1B1B1B !important;}
  604. </style>