index.vue 16 KB

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