information.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179
  1. <template name="sale">
  2. <view class="container">
  3. <view :style="statusBarHeight" class="status_bar">
  4. </view>
  5. <!-- 小程序头部兼容 -->
  6. <!-- #ifdef MP -->
  7. <!-- <view class="mp-search-box">
  8. <input @click="naviageToPage('/pages/product/search')" class="ser-input" type="text" value="输入关键字搜索" disabled />
  9. </view> -->
  10. <!-- #endif -->
  11. <!-- 头部轮播 -->
  12. <view class="carousel-section">
  13. <swiper class="screen-swiper header-swiper" ::class="dotStyle?'square-dot':'round-dot'"
  14. :indicator-dots="true" :circular="true" :autoplay="true" interval="5000" @change="swiperChange"
  15. indicator-color="#8799a3" indicator-active-color="#0081ff">
  16. <swiper-item class="swiper-item" v-for="(item,index) in carouselList" :key="index"
  17. :class="cardCur==index?'text-white':''" @click="naviageToPage(item.url)">
  18. <image :src="item.imgUrl"></image>
  19. <!-- <view style='position:absolute;top:50%;left:50%;transform: translate(-50%,-50%);'>11111</view> -->
  20. </swiper-item>
  21. </swiper>
  22. <!-- <view class="swiper-dots">
  23. <text class="num">{{swiperCurrent+1}}</text>
  24. <text class="sign">/</text>
  25. <text class="num">{{swiperLength}}</text>
  26. </view> -->
  27. </view>
  28. <swiper-up :list="infoList"></swiper-up>
  29. <view class="guess-section-wrap">
  30. <view class='flex justify-between'>
  31. <view class='title Medium'>工厂价格</view>
  32. <view class='Regular' style='color:#B2B3BB;' @click='more("/pages/sale/plant")'>更多</view>
  33. </view>
  34. <swiper class="screen-swiper header-swiper" :autoplay="true" interval="6000" duration="500" :circular="true"
  35. :acceleration="true" style="min-height: 380px;">
  36. <swiper-item class="" v-for="(item1,index) in factoryPriceData.list" :key="index">
  37. <view class='Semibold guess-section-wrap-item clearfix' v-for='(item,index1) in item1' :key="index1">
  38. <view class='factory'>{{item.factory}}</view>
  39. <view class='wrap'>{{item.city}} {{item.factoryType}}</view>
  40. <view class='price'>
  41. <text class='currectprice NumberBold'>{{item.price}}</text>
  42. 较昨日
  43. <image v-if='item.comparePrice>0' style="width:7.5px;height:9px;"
  44. src='../../static/img/homepage/shangsheng.png'></image>
  45. <image v-if='item.comparePrice<0' style="width:7.5px;height:9px;"
  46. src='../../static/img/homepage/xiajiang.png'></image>
  47. <text v-if='item.comparePrice>0' class='yesterday up'>{{item.comparePrice}}</text>
  48. <text v-if='item.comparePrice<0' class='yesterday down'>{{-item.comparePrice}}</text>
  49. <text v-if='item.comparePrice==0' class='yesterday'>-</text>
  50. </view>
  51. </view>
  52. </swiper-item>
  53. </swiper>
  54. </view>
  55. <view class="guess-section-wrap">
  56. <view class='flex justify-between'>
  57. <view class='title Medium'>港口价格</view>
  58. <view class='Regular' style='color:#B2B3BB;' @click='more("/pages/sale/portprice")'>更多</view>
  59. </view>
  60. <!-- <uni-notice-bar scrollable="true" single="true" background-color="white" :portList="portList" ></uni-notice-bar> -->
  61. <swiper class="screen-swiper header-swiper-port" :autoplay="true" interval="0" duration="60000"
  62. :circular="true" :acceleration="true">
  63. <swiper-item class="" v-for="(item,index) in portList" :key="index">
  64. <view class='guess-section-wrap-item clearfix'>
  65. <!-- <view class='guess-section-wrap-item clearfix' v-for='(item,index1) in item1' :key="index1"> -->
  66. <view class='factory'>{{item.port}}</view>
  67. <view class='wrap'>{{item.goodsName}}</view>
  68. <view class='price'>
  69. <text class='currectprice NumberBold'>{{item.price}}</text>
  70. 较昨日
  71. <image v-if='item.comparePrice>0' style="width:7.5px;height:9px;"
  72. src='../../static/img/homepage/shangsheng.png'></image>
  73. <image v-if='item.comparePrice<0' style="width:7.5px;height:9px;"
  74. src='../../static/img/homepage/xiajiang.png'></image>
  75. <text v-if='item.comparePrice>0' class='yesterday up'>{{item.comparePrice}}</text>
  76. <text v-if='item.comparePrice<0' class='yesterday down'>{{-item.comparePrice}}</text>
  77. <text v-if='item.comparePrice==0' class='yesterday'>-</text>
  78. </view>
  79. <view style='color:#B2B3BB;' class='flex'>
  80. <view class="port-number-style NumberBold">
  81. <image style='width:11px;height:11px;' src='../../static/img/homepage/water@3x.png'>
  82. </image>
  83. <={{item.waterContent}} </view>
  84. <view class="port-number-style">
  85. <image style='width:11px;height:11px;'
  86. src='../../static/img/homepage/unitweight@3x.png'></image>
  87. >={{item.bulkDensity}}
  88. </view>
  89. </view>
  90. </view>
  91. </swiper-item>
  92. </swiper>
  93. </view>
  94. <view class="guess-section-wrap1">
  95. <view style='padding:15px;' class='flex justify-between'>
  96. <view class='title Medium'>行业新闻</view>
  97. <view class='Regular' style='color:#B2B3BB;' @click="more('/pages/sale/newsinfo')">更多</view>
  98. </view>
  99. <view style='border-bottom:1px solid #EEEEEE;' class='guess-section-wrap-content1'>
  100. <view style='border-bottom:1px solid #eee;padding:15px;' class='flex justify-between'
  101. v-for='(item, index) in newsInfo' :key="index" @click="navToDetailPage(item.id)">
  102. <view>
  103. <view class="list-row-titel Regular">{{item.title}}</view>
  104. <view style='color:#B2B3BB;font-size:12px;' class="Regular"><text
  105. style='margin-right:5px;'>{{item.from}}</text>{{item.gmtUpdate}}</view>
  106. </view>
  107. <view>
  108. <image style='width:100px;height:72px;border-radius:5px;' :src='item.titleImg'></image>
  109. </view>
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. </template>
  115. <script>
  116. import {
  117. formatDate
  118. } from '@/common/date.js';
  119. import dragButton from "@/components/drag-button/drag-button.vue";
  120. import swiperUp from "@/components/swiperup.vue";
  121. import {
  122. mapState
  123. } from 'vuex';
  124. export default {
  125. components: {
  126. dragButton,
  127. swiperUp
  128. },
  129. name: "sale",
  130. data() {
  131. return {
  132. titleNViewBackground: '',
  133. swiperCurrent: 0,
  134. swiperLength: 0,
  135. carouselList: [],
  136. windowSpuList: [],
  137. categoryPickList: [],
  138. categoryButtomList: [],
  139. salesTop: [],
  140. saleInfo: [],
  141. portInfo: [],
  142. plantList: [],
  143. portList: [],
  144. banner: undefined,
  145. isVip: false,
  146. pages: 1, //页数
  147. limit: 10, //每次取条目数
  148. loadStatus: 'loading', //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
  149. isLoadMore: false, //是否加载中
  150. showTran: true,
  151. list: [],
  152. scrollTop: 0,
  153. cardCur: 0,
  154. dotStyle: false,
  155. newsInfo: [],
  156. categoryList: [],
  157. pages: 1, //页数
  158. limit: 10, //每次取条目数
  159. loadStatus: 'loading', //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
  160. TabCur: 0,
  161. category: 0,
  162. current: 0,
  163. infoList1: [],
  164. statusBarHeight: "height:",
  165. factoryPriceData: {},
  166. portPriceData: {}
  167. };
  168. },
  169. onReady() {},
  170. onShow() {
  171. uni.showTabBar()
  172. this.pages = 1
  173. this.isLoadMore = false
  174. this.loadStatus = 'more'
  175. this.loadData()
  176. var userInfo = uni.getStorageSync("userInfo")
  177. var that = this
  178. this.$api.doRequest('get', '/salePlanInfo/getTips', {
  179. phone: userInfo.phone
  180. }).then(res => {
  181. if (res.data.data) {
  182. let name = 'myTip';
  183. let value = res.data.data.myTip;
  184. that.$store.commit('$uStore', {
  185. name,
  186. value
  187. });
  188. if (value != 0) {
  189. uni.setTabBarBadge({
  190. index: 3,
  191. text: value + ""
  192. })
  193. }
  194. name = 'taskTip';
  195. value = res.data.data.taskTip;
  196. that.$store.commit('$uStore', {
  197. name,
  198. value
  199. });
  200. name = 'contractTip';
  201. value = res.data.data.contractTip;
  202. that.$store.commit('$uStore', {
  203. name,
  204. value
  205. });
  206. }
  207. })
  208. },
  209. onLoad(options) {
  210. const value = uni.getStorageSync('launchFlag');
  211. if (value) {
  212. } else {
  213. uni.navigateTo({
  214. url: '/pages/index/index'
  215. });
  216. }
  217. var that = this
  218. uni.getSystemInfo({
  219. success: function(res) {
  220. console.log("statusBarHeight", res.statusBarHeight)
  221. that.statusBarHeight += res.statusBarHeight + "px"; //这就是状态栏的高度
  222. },
  223. });
  224. var infoList = [];
  225. uni.request({
  226. url: "https://hq.sinajs.cn/list=C0,C2109,C2111,C2201,C2203,C2205,C2207,A0,A2109,A2111,A2201,A2203,A2205,A2207",
  227. // url: "https://hq.sinajs.cn/list=C2109",
  228. header: {
  229. 'content-type': 'application/x-www-form-urlencoded'
  230. },
  231. success: function(result) {
  232. // resolve调用后,即可传递到调用方使用then或者async+await同步方式进行处理逻辑
  233. var tmp = result.data.split('"')
  234. for (var i = 1; i < tmp.length; i = i + 2) {
  235. var list = tmp[i].split(",")
  236. var data = {
  237. goodsName: list[0],
  238. newPrice: list[6],
  239. openPrice: list[2]
  240. }
  241. if (data.goodsName) {
  242. infoList.push(data)
  243. }
  244. }
  245. let name = 'infoList';
  246. let value = infoList;
  247. that.$store.commit('$uStore', {
  248. name,
  249. value
  250. });
  251. // console.log("infoList",infoList)
  252. },
  253. fail: function(e) {
  254. console.log('error in...')
  255. // reject调用后,即可传递到调用方使用catch或者async+await同步方式进行处理逻辑
  256. reject(e)
  257. },
  258. })
  259. uni.showTabBar()
  260. this.pages = 1
  261. this.isLoadMore = false
  262. this.loadStatus = 'more'
  263. this.loadData()
  264. var userInfo = uni.getStorageSync("userInfo")
  265. var that = this
  266. this.$api.doRequest('get', '/salePlanInfo/getTips', {
  267. phone: userInfo.phone
  268. }).then(res => {
  269. if (res.data.data) {
  270. let name = 'myTip';
  271. let value = res.data.data.myTip;
  272. that.$store.commit('$uStore', {
  273. name,
  274. value
  275. });
  276. if (value != 0) {
  277. uni.setTabBarBadge({
  278. index: 3,
  279. text: value + ""
  280. })
  281. }
  282. name = 'taskTip';
  283. value = res.data.data.taskTip;
  284. that.$store.commit('$uStore', {
  285. name,
  286. value
  287. });
  288. name = 'contractTip';
  289. value = res.data.data.contractTip;
  290. that.$store.commit('$uStore', {
  291. name,
  292. value
  293. });
  294. }
  295. })
  296. },
  297. onPageScroll(e) {
  298. this.scrollTop = e.scrollTop;
  299. },
  300. onReachBottom() { //上拉触底函数
  301. // if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
  302. // this.isLoadMore = true
  303. // this.pages += 1
  304. // this.getIndexSaleData()
  305. // }
  306. },
  307. onPullDownRefresh() {
  308. this.pages = 1
  309. this.isLoadMore = false
  310. this.loadStatus = 'loading'
  311. this.loadData()
  312. setTimeout(function() {
  313. uni.stopPullDownRefresh();
  314. }, 1000);
  315. },
  316. computed: {
  317. ...mapState(['hasLogin', 'userInfo'])
  318. },
  319. methods: {
  320. // makeportScrollData(valList) {
  321. // console.log(valList)
  322. // let _rowCount = valList.length;
  323. // let _pageSize = 2
  324. // let _newArray = []
  325. // if (_rowCount == null || _rowCount == "") {
  326. // this.portPriceData.totalPage = 0;
  327. // } else {
  328. // if (_pageSize != 0 && _rowCount % _pageSize == 0) {
  329. // this.portPriceData.totalPage = parseInt(_rowCount / _pageSize)
  330. // }
  331. // if (_pageSize != 0 && _rowCount % _pageSize != 0) {
  332. // this.portPriceData.totalPage = parseInt(_rowCount / _pageSize) + 1;
  333. // }
  334. // }
  335. // for (let i = 0; i < valList.length; i += 2) {
  336. // _newArray.push(valList.slice(i, i + 2))
  337. // }
  338. // this.portPriceData.list = _newArray
  339. // },
  340. makeScrollData(valList, size) {
  341. console.log(valList)
  342. let _rowCount = valList.length;
  343. let _pageSize = size
  344. let _newArray = []
  345. if (_rowCount == null || _rowCount == "") {
  346. if (size == 8) {
  347. this.factoryPriceData.totalPage = 0;
  348. } else {
  349. this.portPriceData.totalPage = 0;
  350. }
  351. } else {
  352. if (_pageSize != 0 && _rowCount % _pageSize == 0) {
  353. if (size == 8) {
  354. this.factoryPriceData.totalPage = parseInt(_rowCount / _pageSize)
  355. } else {
  356. this.portPriceData.totalPage = parseInt(_rowCount / _pageSize)
  357. }
  358. }
  359. if (_pageSize != 0 && _rowCount % _pageSize != 0) {
  360. if (size == 8) {
  361. this.factoryPriceData.totalPage = parseInt(_rowCount / _pageSize) + 1;
  362. } else {
  363. this.portPriceData.totalPage = parseInt(_rowCount / _pageSize) + 1;
  364. }
  365. }
  366. }
  367. for (let i = 0; i < valList.length; i += size) {
  368. _newArray.push(valList.slice(i, i + size))
  369. }
  370. if (size == 8) {
  371. this.factoryPriceData.list = _newArray
  372. } else {
  373. this.portPriceData.list = _newArray
  374. }
  375. },
  376. more(url) {
  377. console.log(url)
  378. uni.navigateTo({
  379. url: url
  380. })
  381. },
  382. DotStyle(e) {
  383. this.dotStyle = e.detail.value
  384. },
  385. cardSwiper(e) {
  386. this.cardCur = e.detail.current
  387. },
  388. hangqing() {
  389. uni.navigateTo({
  390. url: `/pageB/news/news`
  391. })
  392. },
  393. tabSelect(e) {
  394. this.TabCur = e.currentTarget.dataset.id;
  395. this.category = this.TabCur
  396. this.pages = 1
  397. this.loadData()
  398. },
  399. //回到顶部
  400. goTop(e) { // 一键回到顶部
  401. console.log(e)
  402. if (wx.pageScrollTo) {
  403. wx.pageScrollTo({
  404. scrollTop: 0
  405. })
  406. } else {
  407. wx.showModal({
  408. title: '提示',
  409. content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
  410. })
  411. }
  412. },
  413. async loadData() {
  414. console.log("sale loadData pages " + this.pages)
  415. const that = this
  416. // 新闻类型
  417. uni.showLoading({
  418. title: '正在加载',
  419. })
  420. that.$api.request('dict', 'getDictDataList', {
  421. dictType: "news_type"
  422. }, failres => {
  423. that.$api.msg(failres.errmsg)
  424. uni.hideLoading()
  425. }).then(res => {
  426. let data = res.data
  427. that.categoryList = data
  428. uni.hideLoading()
  429. })
  430. // 工厂价格
  431. that.$api.request('news', 'getFactoryPriceInfo', {
  432. category: this.category,
  433. page: 1,
  434. limit: 2
  435. }, failres => {
  436. that.$api.msg(failres.errmsg)
  437. this.isLoadMore = false
  438. this.loadStatus = 'nomore'
  439. if (this.pages > 1) {
  440. this.pages = 1
  441. }
  442. uni.hideLoading()
  443. }).then(res => {
  444. let data = res.data
  445. that.plantList = data
  446. that.makeScrollData(that.plantList, 8)
  447. uni.hideLoading()
  448. })
  449. // 港口价格
  450. that.$api.request('news', 'getPortPriceInfo', {
  451. category: this.category,
  452. page: 1,
  453. limit: 2
  454. }, failres => {
  455. that.$api.msg(failres.errmsg)
  456. this.isLoadMore = false
  457. this.loadStatus = 'nomore'
  458. if (this.pages > 1) {
  459. this.pages = 1
  460. }
  461. uni.hideLoading()
  462. }).then(res => {
  463. let data = res.data
  464. that.portList = data
  465. that.makeScrollData(that.portList, 2)
  466. uni.hideLoading()
  467. })
  468. // 新闻内容
  469. that.$api.request('news', 'getNewsInfo', {
  470. category: 2,
  471. page: 1,
  472. limit: 10
  473. }, failres => {
  474. that.$api.msg(failres.errmsg)
  475. this.isLoadMore = false
  476. this.loadStatus = 'nomore'
  477. if (this.pages > 1) {
  478. this.pages = 1
  479. }
  480. uni.hideLoading()
  481. }).then(res => {
  482. let data = res.data
  483. that.newsInfo = data
  484. uni.hideLoading()
  485. })
  486. that.$api.request('integral', 'getIndexData', failres => {
  487. that.$api.msg(failres.errmsg)
  488. this.isLoadMore = false
  489. this.loadStatus = 'nomore'
  490. if (this.pages > 1) {
  491. this.pages = 1
  492. }
  493. uni.hideLoading()
  494. uni.stopPullDownRefresh()
  495. }).then(res => {
  496. let data = res.data
  497. //橱窗
  498. that.windowSpuList = data.windowRecommend
  499. //轮播
  500. data.advertisement.t1.forEach(item => {
  501. if (!item.color) {
  502. item.color = 'rgb(205, 215, 218)'
  503. }
  504. })
  505. that.carouselList = data.advertisement.t1
  506. that.swiperLength = data.advertisement.t1.length
  507. that.titleNViewBackground = data.advertisement.t1[0].color
  508. //分类精选
  509. if (data.advertisement.t2) {
  510. that.categoryPickList = data.advertisement.t2
  511. }
  512. //横幅
  513. if (data.advertisement.t3 && data.advertisement.t3.length > 0) {
  514. that.banner = data.advertisement.t3[0]
  515. }
  516. //热销
  517. if (data.salesTop) {
  518. that.salesTop = data.salesTop
  519. }
  520. //销售信息
  521. if (data.saleInfo) {
  522. that.saleInfo = data.saleInfo
  523. }
  524. //价格简报
  525. if (data.portInfo) {
  526. that.portInfo = data.portInfo
  527. console.log("portInfo", that.portInfo)
  528. }
  529. //分类5Buttom
  530. if (data.advertisement.t4) {
  531. that.categoryButtomList = data.advertisement.t4
  532. }
  533. that.showTran = data.showTran
  534. that.list = data.message
  535. uni.setStorageSync("message", data.message);
  536. uni.setStorageSync("task", data.task);
  537. uni.setStorageSync('showTran', data.showTran);
  538. uni.hideLoading()
  539. uni.stopPullDownRefresh()
  540. })
  541. },
  542. //轮播图切换修改背景色
  543. swiperChange(e) {
  544. const index = e.detail.current;
  545. this.swiperCurrent = index;
  546. // this.titleNViewBackground = this.carouselList[index].color;
  547. },
  548. //详情
  549. navToDetailPage(item) {
  550. let id = item;
  551. uni.navigateTo({
  552. url: `/pageB/news/news_detail?id=${id}`
  553. })
  554. },
  555. naviageToPage(page) {
  556. uni.navigateTo({
  557. url: page,
  558. fail() {
  559. uni.switchTab({
  560. url: page
  561. })
  562. }
  563. })
  564. },
  565. getIndexSaleData() {
  566. // const that = this
  567. // var pages = that.pages
  568. // var limit = that.limit
  569. // uni.showLoading({
  570. // title: '正在加载'
  571. // })
  572. // that.$api.request('integral', 'getIndexSaleData', {
  573. // page: pages,
  574. // limit: limit
  575. // }, failres => {
  576. // that.$api.msg(failres.errmsg)
  577. // that.isLoadMore = false
  578. // that.loadStatus = 'nomore'
  579. // if (that.pages > 1) {
  580. // that.pages -= 1
  581. // }
  582. // uni.hideLoading()
  583. // }).then(res => {
  584. // let data = res.data
  585. // //销售信息
  586. // if (data.saleInfo.length > 0 ) {
  587. // that.saleInfo = that.saleInfo.concat(data.saleInfo)
  588. // that.isLoadMore = false
  589. // } else {
  590. // if (that.pages > 1) {
  591. // that.pages -= 1
  592. // }
  593. // that.isLoadMore = true
  594. // that.loadStatus = 'nomore'
  595. // }
  596. // if(data.saleInfo.length < that.limit){
  597. // if (that.pages > 1) {
  598. // that.pages -= 1
  599. // }
  600. // that.isLoadMore = true
  601. // that.loadStatus = 'nomore'
  602. // }
  603. // uni.hideLoading()
  604. // })
  605. const that = this
  606. var pages = that.pages
  607. var limit = that.limit
  608. uni.showLoading({
  609. title: '正在加载',
  610. })
  611. var pages = that.pages
  612. var limit = that.limit
  613. that.$api.request('news', 'getNewsInfo', {
  614. category: 2,
  615. page: 1,
  616. limit: 10
  617. }, failres => {
  618. that.$api.msg(failres.errmsg)
  619. that.isLoadMore = false
  620. that.loadStatus = 'nomore'
  621. if (that.pages > 1) {
  622. that.pages -= 1
  623. }
  624. uni.hideLoading()
  625. }).then(res => {
  626. let data = res.data
  627. that.newsInfo = data
  628. that.isLoadMore = false
  629. uni.hideLoading()
  630. })
  631. }
  632. },
  633. // #ifndef MP
  634. // 标题栏input搜索框点击
  635. onNavigationBarSearchInputClicked: async function(e) {
  636. uni.navigateTo({
  637. url: '/pageA/product/search'
  638. })
  639. },
  640. //点击导航栏 buttons 时触发
  641. // onNavigationBarButtonTap(e) {
  642. // const index = e.index;
  643. // if (index === 0) {
  644. // this.$api.msg('点击了扫描');
  645. // } else if (index === 1) {
  646. // // #ifdef APP-PLUS
  647. // const pages = getCurrentPages();
  648. // const page = pages[pages.length - 1];
  649. // const currentWebview = page.$getAppWebview();
  650. // currentWebview.hideTitleNViewButtonRedDot({
  651. // index
  652. // });
  653. // // #endif
  654. // uni.navigateTo({
  655. // url: '/pages/notice/notice'
  656. // })
  657. // }
  658. // }
  659. // #endif
  660. }
  661. </script>
  662. <style lang="scss" scoped>
  663. .container {
  664. margin: 10rpx 10rpx 10rpx 10rpx;
  665. }
  666. .cu-tag.badge {
  667. right: 26rpx;
  668. }
  669. .up,
  670. .down {
  671. // width: 8px;
  672. // height: 5px;
  673. vertical-align: middle;
  674. margin-left: 2px;
  675. }
  676. .gird-left,
  677. .gird-right {}
  678. .cu-tag.radius[class*="line"]::after {
  679. border-radius: 66rpx;
  680. }
  681. .goTop {
  682. height: 32px;
  683. width: 32px;
  684. position: fixed;
  685. bottom: 200rpx;
  686. right: 30rpx;
  687. border-radius: 50%;
  688. }
  689. .goTop image {
  690. width: 32px;
  691. height: 32px;
  692. }
  693. .flex {
  694. display: flex;
  695. }
  696. .text-white {
  697. color: #fff;
  698. }
  699. .cu-card {
  700. border-bottom: 1rpx solid #f8f8f8;
  701. text-align: center;
  702. }
  703. .factorytitle view {
  704. border-right: 1px solid #F8F8F8;
  705. }
  706. .factorytitle view:last-child {
  707. border-right: 1px solid transparent;
  708. }
  709. .factory {
  710. font-size: 26rpx;
  711. font-weight: 900;
  712. }
  713. .currectprice {
  714. color: rgba(253, 113, 79, 1);
  715. font-size: 18px;
  716. font-weight: 600;
  717. vertical-align: middle;
  718. margin-right: 10px;
  719. }
  720. .yesterday {
  721. font-size: 14px;
  722. font-weight: 600;
  723. vertical-align: middle;
  724. }
  725. .yesterday.up {
  726. color: rgba(253, 113, 79, 1);
  727. }
  728. .yesterday.down {
  729. color: #22C572;
  730. }
  731. .positive {
  732. color: #E63113;
  733. font-size: 26rpx;
  734. font-weight: 900;
  735. }
  736. .negative {
  737. color: #229453;
  738. font-size: 26rpx;
  739. font-weight: 900;
  740. }
  741. .wrap {
  742. font-size: 20rpx;
  743. color: rgba(0, 0, 0, 0.5);
  744. }
  745. .align-center {
  746. align-items: center;
  747. }
  748. .flex-direction-row {
  749. flex-direction: row;
  750. }
  751. .factoryItem {
  752. padding: 20rpx 0;
  753. }
  754. /* #ifdef MP */
  755. .mp-search-box {
  756. // position:relative;
  757. left: 0;
  758. top: 30upx;
  759. z-index: 9999;
  760. width: 100%;
  761. padding: 0 80upx;
  762. background: rgba(255, 170, 0, 0.6);
  763. .ser-input {
  764. flex: 1;
  765. height: 56upx;
  766. line-height: 56upx;
  767. text-align: center;
  768. font-size: 28upx;
  769. color: $font-color-base;
  770. border-radius: 10px;
  771. background: rgba(255, 255, 255, .6);
  772. }
  773. }
  774. .desc {
  775. width: 73%;
  776. margin-right: 2%;
  777. }
  778. .justify-between {
  779. justify-content: space-between;
  780. }
  781. page {
  782. .cate-section {
  783. position: relative;
  784. z-index: 5;
  785. border-radius: 16upx 16upx 0 0;
  786. margin-top: -20upx;
  787. }
  788. .carousel-section {
  789. padding: 0;
  790. .titleNview-placing {
  791. padding-top: 0;
  792. height: 0;
  793. }
  794. .carousel {
  795. .carousel-item {
  796. padding: 0;
  797. }
  798. }
  799. .swiper-dots {
  800. left: 50%;
  801. bottom: 5upx;
  802. transform: translateX(-50%);
  803. }
  804. }
  805. }
  806. /* #endif */
  807. .cuIcon-notification::before {
  808. color: #f37b1;
  809. }
  810. .cu-card.article>.cu-item .content>image {
  811. height: 3.4em;
  812. margin-right: 0rpx;
  813. margin-top: 24rpx;
  814. }
  815. .screen-swiper.price-swiper {
  816. height: 70rpx;
  817. min-height: 70rpx;
  818. background: #fff;
  819. margin-bottom: 10px;
  820. }
  821. .swiper-item {
  822. border-radius: 5%;
  823. }
  824. .guess-section-wrap {
  825. padding: 15px;
  826. margin: 10px 5px;
  827. border-radius: 5px;
  828. background: #fff;
  829. overflow: hidden;
  830. }
  831. .guess-section-wrap1 {
  832. margin: 10px 5px;
  833. border-radius: 5px;
  834. background: #fff;
  835. overflow: hidden;
  836. height: 366px;
  837. }
  838. .guess-section-wrap-content {
  839. width: 1500px;
  840. // display:flex;
  841. }
  842. .guess-section-wrap-content.port {
  843. width: 3000px;
  844. }
  845. .guess-section-wrap-item {
  846. float: left;
  847. width: 38vw;
  848. background: #F9F9FA;
  849. padding: 10px;
  850. margin: 20rpx;
  851. border-radius: 3px;
  852. // width:50%;
  853. }
  854. .guess-section-wrap-item:first-child {
  855. // margin-left:2px;
  856. }
  857. .clearfix:after {
  858. content: "";
  859. display: block;
  860. clear: both;
  861. }
  862. .guess-section-wrap .price {
  863. color: #B2B3BB;
  864. display: flex;
  865. align-items: center;
  866. }
  867. page {
  868. background: #f5f5f5;
  869. }
  870. .m-t {
  871. margin-top: 16upx;
  872. }
  873. .header-swiper {
  874. min-height: 300rpx;
  875. }
  876. /* 头部 轮播图 */
  877. .carousel-section {
  878. position: relative;
  879. // padding-top: 10px;
  880. .titleNview-placing {
  881. height: var(--status-bar-height);
  882. padding-top: 44px;
  883. box-sizing: content-box;
  884. }
  885. .titleNview-background {
  886. position: absolute;
  887. top: 0;
  888. left: 0;
  889. width: 100%;
  890. height: 426upx;
  891. transition: .4s;
  892. }
  893. }
  894. .tab-scroll-view {
  895. width: 750rpx;
  896. height: 300rpx;
  897. flex-direction: row;
  898. white-space: nowrap;
  899. .tab-item {
  900. display: inline-block;
  901. width: 350rpx;
  902. height: 250rpx;
  903. font-size: 16px;
  904. -moz-box-shadow: 2px 2px 5px #ccc;
  905. -webkit-box-shadow: 2px 2px 5px #ccc;
  906. box-shadow: 2px 2px 5px #ccc;
  907. color: #555;
  908. margin: 10rpx;
  909. }
  910. }
  911. .carousel {
  912. width: 100%;
  913. height: 350upx;
  914. .carousel-item {
  915. width: 100%;
  916. height: 100%;
  917. // padding: 0 28upx;
  918. overflow: hidden;
  919. }
  920. image {
  921. width: 100%;
  922. height: 100%;
  923. // border-radius: 10upx;
  924. }
  925. }
  926. .swiper-dots {
  927. display: flex;
  928. position: absolute;
  929. left: 60upx;
  930. bottom: 15upx;
  931. width: 72upx;
  932. height: 36upx;
  933. background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAABkCAYAAADDhn8LAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTMyIDc5LjE1OTI4NCwgMjAxNi8wNC8xOS0xMzoxMzo0MCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OTk4MzlBNjE0NjU1MTFFOUExNjRFQ0I3RTQ0NEExQjMiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OTk4MzlBNjA0NjU1MTFFOUExNjRFQ0I3RTQ0NEExQjMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTcgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6Q0E3RUNERkE0NjExMTFFOTg5NzI4MTM2Rjg0OUQwOEUiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6Q0E3RUNERkI0NjExMTFFOTg5NzI4MTM2Rjg0OUQwOEUiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4Gh5BPAAACTUlEQVR42uzcQW7jQAwFUdN306l1uWwNww5kqdsmm6/2MwtVCp8CosQtP9vg/2+/gY+DRAMBgqnjIp2PaCxCLLldpPARRIiFj1yBbMV+cHZh9PURRLQNhY8kgWyL/WDtwujjI8hoE8rKLqb5CDJaRMJHokC6yKgSCR9JAukmokIknCQJpLOIrJFwMsBJELFcKHwM9BFkLBMKFxNcBCHlQ+FhoocgpVwwnv0Xn30QBJGMC0QcaBVJiAMiec/dcwKuL4j1QMsVCXFAJE4s4NQA3K/8Y6DzO4g40P7UcmIBJxbEesCKWBDg8wWxHrAiFgT4fEGsB/CwIhYE+AeBAAdPLOcV8HRmWRDAiQVcO7GcV8CLM8uCAE4sQCDAlHcQ7x+ABQEEAggEEAggEEAggEAAgQACASAQQCCAQACBAAIBBAIIBBAIIBBAIABe4e9iAe/xd7EAJxYgEGDeO4j3EODp/cOCAE4sYMyJ5cwCHs4rCwI4sYBxJ5YzC84rCwKcXxArAuthQYDzC2JF0H49LAhwYUGsCFqvx5EF2T07dMaJBetx4cRyaqFtHJ8EIhK0i8OJBQxcECuCVutxJhCRoE0cZwMRyRcFefa/ffZBVPogePihhyCnbBhcfMFFEFM+DD4m+ghSlgmDkwlOgpAl4+BkkJMgZdk4+EgaSCcpVX7bmY9kgXQQU+1TgE0c+QJZUUz1b2T4SBbIKmJW+3iMj2SBVBWz+leVfCQLpIqYbp8b85EskIxyfIOfK5Sf+wiCRJEsllQ+oqEkQfBxmD8BBgA5hVjXyrBNUQAAAABJRU5ErkJggg==);
  934. background-size: 100% 100%;
  935. .num {
  936. width: 36upx;
  937. height: 36upx;
  938. border-radius: 50px;
  939. font-size: 24upx;
  940. color: #fff;
  941. text-align: center;
  942. line-height: 36upx;
  943. }
  944. .sign {
  945. position: absolute;
  946. top: 0;
  947. left: 50%;
  948. line-height: 36upx;
  949. font-size: 12upx;
  950. color: #fff;
  951. transform: translateX(-50%);
  952. }
  953. }
  954. /* 分类 */
  955. .cate-section {
  956. display: flex;
  957. justify-content: space-around;
  958. align-items: center;
  959. flex-wrap: wrap;
  960. padding: 30upx 22upx;
  961. background: #fff;
  962. .cate-item {
  963. display: flex;
  964. flex-direction: column;
  965. align-items: center;
  966. font-size: $font-sm + 2upx;
  967. color: $font-color-dark;
  968. }
  969. /* 原图标颜色太深,不想改图了,所以加了透明度 */
  970. image {
  971. width: 68upx;
  972. height: 68upx;
  973. margin-bottom: 14upx;
  974. // border-radius: 50%;
  975. opacity: .7;
  976. // box-shadow: 4upx 4upx 20upx rgba(250, 67, 106, 0.3);
  977. }
  978. .grid_icon {
  979. font-size: 48upx;
  980. margin-bottom: 18upx;
  981. color: #fa436a;
  982. }
  983. }
  984. .ad-1 {
  985. width: 100%;
  986. height: 210upx;
  987. padding: 10upx 0;
  988. background: #fff;
  989. image {
  990. width: 100%;
  991. height: 100%;
  992. }
  993. }
  994. /* 销售信息 */
  995. .introduce-section {
  996. background: #fff;
  997. padding: 20upx 30upx;
  998. padding-bottom: 100upx;
  999. .guess-item {
  1000. padding-bottom: 20upx;
  1001. border-bottom: 1px solid #ccc;
  1002. }
  1003. .title {
  1004. font-size: 28upx;
  1005. color: $font-color-dark;
  1006. font-weight: bold;
  1007. height: 50upx;
  1008. line-height: 50upx;
  1009. flex: 2.5;
  1010. }
  1011. .title-tip {
  1012. flex: 1;
  1013. }
  1014. .price-box {
  1015. display: flex;
  1016. align-items: baseline;
  1017. height: 70upx;
  1018. padding: 10upx 0;
  1019. font-size: 26upx;
  1020. color: $uni-color-primary;
  1021. }
  1022. .price {
  1023. font-size: $font-lg + 2upx;
  1024. }
  1025. .m-price {
  1026. margin: 0 12upx;
  1027. color: $font-color-light;
  1028. text-decoration: line-through;
  1029. }
  1030. .coupon-tip {
  1031. align-items: center;
  1032. padding: 4upx 10upx;
  1033. background: $uni-color-primary;
  1034. font-size: $font-sm;
  1035. color: #fff;
  1036. border-radius: 6upx;
  1037. line-height: 1;
  1038. transform: translateY(-4upx);
  1039. }
  1040. .bot-row {
  1041. display: flex;
  1042. align-items: center;
  1043. height: 50upx;
  1044. font-size: $font-sm;
  1045. color: $font-color-light;
  1046. view {
  1047. flex: 1;
  1048. }
  1049. }
  1050. .status_bar {
  1051. width: 100%;
  1052. }
  1053. }
  1054. .title {
  1055. font-size: 34rpx;
  1056. font-weight: 500;
  1057. color: #333333;
  1058. }
  1059. .list-row-titel {
  1060. text-overflow: -o-ellipsis-lastline;
  1061. overflow: hidden;
  1062. text-overflow: ellipsis;
  1063. display:
  1064. -webkit-box;
  1065. -webkit-line-clamp: 2;
  1066. -webkit-box-orient: vertical;
  1067. font-size: 16px;
  1068. height: 45px;
  1069. padding-right: 40rpx;
  1070. margin-bottom: 26rpx;
  1071. }
  1072. .header-swiper-port {
  1073. height: 120px;
  1074. min-height: 120px;
  1075. /deep/.uni-swiper-slide-frame {
  1076. width: 50% !important;
  1077. }
  1078. }
  1079. .port-number-style {
  1080. display: flex;
  1081. align-items: center;
  1082. margin-right: 14rpx;
  1083. }
  1084. </style>