index.vue 16 KB

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