index.vue 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100
  1. <template>
  2. <app-layout>
  3. <view class="tab-list">
  4. <view class="tab cross-center main-center">
  5. <view class="active">浏览记录</view>
  6. <view @click="toList">账单总结</view>
  7. </view>
  8. <view class="tab-date dir-left-nowrap">
  9. <view @click="chooseDate(today,today)" :class="[`${start_time == today && today !='' ? 'active' : ''}`]">今日</view>
  10. <view @click="chooseDate(yesterday,yesterday)" :class="[`${start_time == yesterday && yesterday !='' ? 'active' : ''}`]">昨日</view>
  11. <view @click="chooseDate(weekday,today)" :class="[`${start_time == weekday && weekday !='' ? 'active' : ''}`]">近7日</view>
  12. <view @click="chooseDate(monthday,today)" :class="[`${start_time == monthday && monthday !='' ? 'active' : ''}`]">近30日</view>
  13. <view @click="choose" :class="[`${otherday ? 'active customize' : 'customize'}`]">{{otherday && showTime ? showTime : '自定义时间'}}</view>
  14. </view>
  15. </view>
  16. <view class="tab-placeholder"></view>
  17. <view v-if="list.length > 0">
  18. <view v-for="item in list" :key="item.date" class='list'>
  19. <view class="date-info">{{item.date}}</view>
  20. <view class="dir-left-wrap">
  21. <view class="goods" @click="toDetail(goods)" :key="goods.goods_id" v-for="(goods,index) in item.goods">
  22. <image class="goods-img" :src="goods.goodsWarehouse.cover_pic"></image>
  23. <view class="out-dialog" v-if="goods.goods_stock == 0 && appSetting.is_show_stock == '1'">
  24. <image :src="appSetting.is_use_stock == '1' ? appImg.plugins_out : appSetting.sell_out_pic"></image>
  25. </view>
  26. <view class="goods-info">
  27. <view class="t-omit-two goods-name">{{goods.goodsWarehouse.name}}</view>
  28. <view class="main-between cross-center">
  29. <view>¥{{goods.price}}</view>
  30. <view @click.stop="toShow(goods,item,index)" class="more main-center cross-center">
  31. <image src="./../image/foot-more.png"></image>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="no-list main-center cross-center dir-top-nowrap" v-else>
  40. <image src="./../image/foot.png"></image>
  41. <view>暂无浏览的足迹哦~</view>
  42. <view @click="toMall" class="to-mall">去商城逛逛</view>
  43. </view>
  44. <view :catchtouchmove="!showMenu" v-if="showMenu" class="dialog">
  45. <view class="other-area" @click="closeMenu"></view>
  46. <view class="menu-card">
  47. <view @click="closeMenu" class="close-menu-icon">
  48. <image src="./../image/black-close.png"></image>
  49. </view>
  50. <view class="main-center menu-item">
  51. <view @click="toFavorite">
  52. <image class="menu-icon" src="./../image/to-favorite.png"></image>
  53. <view>收藏</view>
  54. </view>
  55. <!-- <view @click="clickAttr" v-if="detail.sign == ''">
  56. <image class="menu-icon" src="./../image/to-cart.png"></image>
  57. <view>购物车</view>
  58. </view> -->
  59. <view @click="beDelete=true">
  60. <image class="menu-icon" src="./../image/to-delete.png"></image>
  61. <view>删除</view>
  62. </view>
  63. </view>
  64. <view @click="closeMenu" class="close-menu">取消</view>
  65. </view>
  66. </view>
  67. <view :catchtouchmove="!beDelete" v-if="beDelete" class="tips-dialog cross-center main-center">
  68. <view class="delete-info">
  69. <view class="delete-content">是否删除该条足迹?</view>
  70. <view class="delete-btn main-between">
  71. <view @click="closeMenu" class="btn">取消</view>
  72. <view class="line"></view>
  73. <view @click="toDelete" class="btn submit-btn">确认</view>
  74. </view>
  75. </view>
  76. </view>
  77. <view v-if="showText" class="dialog-title cross-center main-center">
  78. <view>{{showText}}</view>
  79. </view>
  80. <!-- 选时间 -->
  81. <view :catchtouchmove="!chooseTime" class="time-dialog cross-center main-center" v-if="chooseTime">
  82. <view class="time-dialog-content">
  83. <view class="time-dialog-title">筛选时间</view>
  84. <view class="choose-time">
  85. <view class="time-title">起始时间</view>
  86. <view class="year-1">年</view>
  87. <view class="month-1">月</view>
  88. <view class="day-1">日</view>
  89. <view class="year-2">年</view>
  90. <view class="month-2">月</view>
  91. <view class="day-2">日</view>
  92. <picker-view :value="start" class="picker-view" @change="startChange">
  93. <picker-view-column>
  94. <view
  95. v-for="(item, index) in years"
  96. :class="{
  97. 'sure-color': chooseStart[0] === index,
  98. 'cardinal-color': chooseStart[0] === index + 1 || chooseStart[0] === index - 1,
  99. 'even-color': chooseStart[0] === index + 2 || chooseStart[0] === index - 2,
  100. }"
  101. :key="item">{{item}}
  102. </view>
  103. </picker-view-column>
  104. <picker-view-column>
  105. <view
  106. v-for="(item, index) in months"
  107. :class="{
  108. 'sure-color': chooseStart[1] === index,
  109. 'cardinal-color': chooseStart[1] === index + 1 || chooseStart[1] === index - 1,
  110. 'even-color': chooseStart[1] === index + 2 || chooseStart[1] === index - 2,
  111. }"
  112. :key="item">{{item}}
  113. </view>
  114. </picker-view-column>
  115. <picker-view-column>
  116. <view
  117. v-for="(item, index) in days"
  118. :class="{
  119. 'sure-color': chooseStart[2] === index,
  120. 'cardinal-color': chooseStart[2] === index + 1 || chooseStart[2] === index - 1,
  121. 'even-color': chooseStart[2] === index + 2 || chooseStart[2] === index - 2,
  122. }"
  123. :key="item">{{item}}
  124. </view>
  125. </picker-view-column>
  126. </picker-view>
  127. <view class="time-title">结束时间</view>
  128. <picker-view :value="end" indicator-style="height: 36px;color: #ff4544;font-size:14px;"class="picker-view" @change="endChange">
  129. <picker-view-column>
  130. <view
  131. v-for="(item, index) in years"
  132. :class="{
  133. 'sure-color': chooseEnd[0] === index,
  134. 'cardinal-color': chooseEnd[0] === index + 1 || chooseEnd[0] === index - 1,
  135. 'even-color': chooseEnd[0] === index + 2 || chooseEnd[0] === index - 2,
  136. }"
  137. :key="item">{{item}}
  138. </view>
  139. </picker-view-column>
  140. <picker-view-column>
  141. <view
  142. v-for="(item, index) in months"
  143. :class="{
  144. 'sure-color': chooseEnd[1] === index,
  145. 'cardinal-color': chooseEnd[1] === index + 1 || chooseEnd[1] === index - 1,
  146. 'even-color': chooseEnd[1] === index + 2 || chooseEnd[1] === index - 2,
  147. }"
  148. :key="item">{{item}}
  149. </view>
  150. </picker-view-column>
  151. <picker-view-column>
  152. <view
  153. v-for="(item, index) in days"
  154. :class="{
  155. 'sure-color': chooseEnd[2] === index,
  156. 'cardinal-color': chooseEnd[2] === index + 1 || chooseEnd[2] === index - 1,
  157. 'even-color': chooseEnd[2] === index + 2 || chooseEnd[2] === index - 2,
  158. }"
  159. :key="item">{{item}}
  160. </view>
  161. </picker-view-column>
  162. </picker-view>
  163. </view>
  164. <view class="main-center btn-area">
  165. <view class="submit-btn" @click='cancel'>取消</view>
  166. <view class="line"></view>
  167. <view class="submit-btn be-submit" @click='toChoose'>确认</view>
  168. </view>
  169. </view>
  170. </view>
  171. <!-- <app-attr
  172. :goodsId="detail.goods_id" :goods="detail" :attrGroupList="detail.attr_groups" :show="attrShow" @attrtap="onAttr">
  173. </app-attr> -->
  174. </app-layout>
  175. </template>
  176. <script>
  177. import { mapState,mapGetters } from "vuex";
  178. // import appAttr from "../../../components/page-component/app-attr/app-attr.vue";
  179. // import appGoodsAttr from "../../../components/page-component/goods/app-goods-attr.vue";
  180. const date = new Date()
  181. const years = []
  182. const months = []
  183. const days = []
  184. for (let i = 2015; i <= date.getFullYear(); i++) {
  185. years.push(i)
  186. }
  187. for (let i = 1; i <= 12; i++) {
  188. months.push(i)
  189. }
  190. for (let i = 1; i <= 31; i++) {
  191. days.push(i)
  192. }
  193. export default {
  194. data() {
  195. return {
  196. showMenu: false,
  197. otherday: false,
  198. beDelete: false,
  199. page: 1,
  200. detail: {},
  201. chooseTime: false,
  202. end_time: '',
  203. start_time: '',
  204. today: '',
  205. yesterday: '',
  206. showText: false,
  207. weekday: '',
  208. monthday: '',
  209. otherday: '',
  210. list: [],
  211. start: [],
  212. end: [],
  213. chooseStart: [],
  214. chooseEnd: [],
  215. showTime: '',
  216. years: years,
  217. months: months,
  218. days: days,
  219. selectAttr: null,
  220. loading: false,
  221. index: -1,
  222. dateList: null,
  223. buyText: '立即购买',
  224. sign: '',
  225. cartShow: 1,
  226. plugin: '',
  227. buyBool: false,
  228. previewUrl: '',
  229. submitUrl: '',
  230. attrShow: 0
  231. }
  232. },
  233. // components: {
  234. // appAttr,
  235. // appGoodsAttr
  236. // },
  237. computed: {
  238. ...mapState({
  239. theme: state => state.mallConfig.theme,
  240. appSetting: state => state.mallConfig.mall.setting,
  241. appImg: state => state.mallConfig.__wxapp_img.mall,
  242. userInfo: state => state.user.info,
  243. }),
  244. ...mapGetters('mallConfig', {
  245. getVideo: 'getVideo'
  246. }),
  247. },
  248. methods: {
  249. toList() {
  250. uni.redirectTo({
  251. url: '/pages/foot/summary/summary'
  252. });
  253. },
  254. toMall() {
  255. uni.redirectTo({
  256. url: '/pages/index/index'
  257. });
  258. },
  259. toDetail(item) {
  260. // #ifndef MP-BAIDU
  261. if (item.goodsWarehouse.video_url && this.getVideo == 1) {
  262. uni.navigateTo({
  263. url: `/pages/goods/video?goods_id=${item.goods_id}&sign=${item.sign}`
  264. });
  265. } else {
  266. if(item.mch_id > 0) {
  267. uni.navigateTo({
  268. url: '/plugins/mch/goods/goods?id=' + item.goods_id +'&mch_id=' + item.mch_id
  269. });
  270. }else if(item.sign =='advance') {
  271. uni.navigateTo({
  272. url: '/plugins/advance/detail/detail?id=' + item.goods_id
  273. });
  274. }else if(item.sign =='pintuan') {
  275. uni.navigateTo({
  276. url: '/plugins/pt/goods/goods?goods_id=' + item.goods_id
  277. });
  278. }else if(item.sign =='miaosha') {
  279. uni.navigateTo({
  280. url: '/plugins/miaosha/goods/goods?id=' + item.goods_id
  281. });
  282. } else if(item.sign =='gift') {
  283. uni.navigateTo({
  284. url: '/plugins/gift/goods/goods?id=' + item.goods_id
  285. });
  286. } else if(item.sign =='advance') {
  287. uni.navigateTo({
  288. url: '/plugins/advance/detail/detail?id=' + item.goods_id
  289. });
  290. } else if(item.sign =='booking') {
  291. uni.navigateTo({
  292. url: '/plugins/book/goods/goods?goods_id=' + item.goods_id
  293. });
  294. } else if(item.sign =='') {
  295. uni.navigateTo({
  296. url: '/pages/goods/goods?id=' + item.goods_id
  297. });
  298. } else {
  299. uni.navigateTo({
  300. url: '/plugins/'+item.sign+'/goods/goods?goods_id=' + item.goods_id
  301. });
  302. }
  303. }
  304. // #endif
  305. // #ifdef MP-BAIDU
  306. if(item.mch_id > 0) {
  307. uni.navigateTo({
  308. url: '/plugins/mch/goods/goods?id=' + item.goods_id +'&mch_id=' + item.mch_id
  309. });
  310. }else if(item.sign =='advance') {
  311. uni.navigateTo({
  312. url: '/plugins/advance/detail/detail?id=' + item.goods_id
  313. });
  314. }else if(item.sign =='pintuan') {
  315. uni.navigateTo({
  316. url: '/plugins/pt/goods/goods?goods_id=' + item.goods_id
  317. });
  318. }else if(item.sign =='miaosha') {
  319. uni.navigateTo({
  320. url: '/plugins/miaosha/goods/goods?id=' + item.goods_id
  321. });
  322. } else if(item.sign =='booking') {
  323. uni.navigateTo({
  324. url: '/plugins/book/goods/goods?goods_id=' + item.goods_id
  325. });
  326. } else if(item.sign =='gift') {
  327. uni.navigateTo({
  328. url: '/plugins/gift/goods/goods?id=' + item.goods_id
  329. });
  330. } else if(item.sign =='advance') {
  331. uni.navigateTo({
  332. url: '/plugins/advance/detail/detail?id=' + item.goods_id
  333. });
  334. } else if(item.sign =='') {
  335. uni.navigateTo({
  336. url: '/pages/goods/goods?id=' + item.goods_id
  337. });
  338. } else {
  339. uni.navigateTo({
  340. url: '/plugins/'+item.sign+'/goods/goods?goods_id=' + item.goods_id
  341. });
  342. }
  343. // #endif
  344. },
  345. // onAttr(data) {
  346. // this.selectAttr = data;
  347. // },
  348. // clickAttr(item) {
  349. // this.attrShow = Math.random();
  350. // },
  351. startChange: function(e) {
  352. this.chooseStart = e.detail.value;
  353. },
  354. endChange: function(e) {
  355. this.chooseEnd = e.detail.value;
  356. },
  357. toChoose() {
  358. let startYear = this.years[this.chooseStart[0]];
  359. let startMonth = this.months[this.chooseStart[1]];
  360. let startDay = this.days[this.chooseStart[2]];
  361. let endYear = this.years[this.chooseEnd[0]];
  362. let endMonth = this.months[this.chooseEnd[1]];
  363. let endDay = this.days[this.chooseEnd[2]];
  364. if (+endYear < +startYear) {
  365. uni.showToast({
  366. title: '结束时间不应早于开始时间',
  367. icon: 'none',
  368. duration: 1000
  369. })
  370. } else if (+endYear == +startYear) {
  371. if (+endMonth < +startMonth) {
  372. uni.showToast({
  373. title: '结束时间不应早于开始时间',
  374. icon: 'none',
  375. duration: 1000
  376. })
  377. } else if (endMonth == +startMonth) {
  378. if (+endDay < +startDay) {
  379. uni.showToast({
  380. title: '结束时间不应早于开始时间',
  381. icon: 'none',
  382. duration: 1000
  383. })
  384. } else {
  385. this.otherday = true;
  386. if (startMonth >= 1 && startMonth <= 9) {
  387. startMonth = "0" + startMonth;
  388. }
  389. if (startDay >= 1 && startDay <= 9) {
  390. startDay = "0" + startDay;
  391. }
  392. this.start_time = startYear + '-' + startMonth + '-' + startDay;
  393. if (endMonth >= 1 && endMonth <= 9) {
  394. endMonth = "0" + endMonth;
  395. }
  396. if (endDay >= 1 && endDay <= 9) {
  397. endDay = "0" + endDay;
  398. }
  399. this.end_time = endYear + '-' + endMonth + '-' + endDay;
  400. this.chooseTime = false;
  401. this.showTime = this.start_time.substr(5).replace('-','.') + '-' + this.end_time.substr(5).replace('-','.')
  402. uni.showLoading({
  403. title: '加载中...'
  404. });
  405. this.page = 1;
  406. this.list = [];
  407. this.getList();
  408. }
  409. } else {
  410. this.otherday = true;
  411. if (startMonth >= 1 && startMonth <= 9) {
  412. startMonth = "0" + startMonth;
  413. }
  414. if (startDay >= 1 && startDay <= 9) {
  415. startDay = "0" + startDay;
  416. }
  417. this.start_time = startYear + '-' + startMonth + '-' + startDay;
  418. if (endMonth >= 1 && endMonth <= 9) {
  419. endMonth = "0" + endMonth;
  420. }
  421. if (endDay >= 1 && endDay <= 9) {
  422. endDay = "0" + endDay;
  423. }
  424. this.end_time = endYear + '-' + endMonth + '-' + endDay;
  425. this.chooseTime = false;
  426. this.showTime = this.start_time.substr(5).replace('-','.') + '-' + this.end_time.substr(5).replace('-','.')
  427. uni.showLoading({
  428. title: '加载中...'
  429. });
  430. this.page = 1;
  431. this.list = [];
  432. this.getList();
  433. }
  434. } else {
  435. this.otherday = true;
  436. if (startMonth >= 1 && startMonth <= 9) {
  437. startMonth = "0" + startMonth;
  438. }
  439. if (startDay >= 1 && startDay <= 9) {
  440. startDay = "0" + startDay;
  441. }
  442. this.start_time = startYear + '-' + startMonth + '-' + startDay;
  443. if (endMonth >= 1 && endMonth <= 9) {
  444. endMonth = "0" + endMonth;
  445. }
  446. if (endDay >= 1 && endDay <= 9) {
  447. endDay = "0" + endDay;
  448. }
  449. this.end_time = endYear + '-' + endMonth + '-' + endDay;
  450. this.chooseTime = false;
  451. this.showTime = this.start_time.substr(5).replace('-','.') + '-' + this.end_time.substr(5).replace('-','.')
  452. uni.showLoading({
  453. title: '加载中...'
  454. });
  455. this.page = 1;
  456. this.list = [];
  457. this.getList();
  458. }
  459. },
  460. choose() {
  461. let that = this;
  462. that.start = [];
  463. that.end = [];
  464. let startDay;
  465. let endDay;
  466. if (that.start_time) {
  467. startDay = that.start_time;
  468. } else {
  469. startDay = that.today;
  470. }
  471. if (that.end_time) {
  472. endDay = that.end_time;
  473. } else {
  474. endDay = that.today;
  475. }
  476. that.years.forEach(function(row, index) {
  477. if (startDay.substring(0, 4) == that.years[index]) {
  478. that.start[0] = +index
  479. }
  480. })
  481. that.months.forEach(function(row, index) {
  482. if (startDay.substring(5, 7) == that.months[index]) {
  483. that.start[1] = +index
  484. }
  485. })
  486. that.days.forEach(function(row, index) {
  487. if (startDay.substring(8, 10) == that.days[index]) {
  488. that.start[2] = +index
  489. }
  490. })
  491. that.years.forEach(function(row, index) {
  492. if (endDay.substring(0, 4) == that.years[index]) {
  493. that.end[0] = +index
  494. }
  495. })
  496. that.months.forEach(function(row, index) {
  497. if (endDay.substring(5, 7) == that.months[index]) {
  498. that.end[1] = +index
  499. }
  500. })
  501. that.days.forEach(function(row, index) {
  502. if (endDay.substring(8, 10) == that.days[index]) {
  503. that.end[2] = +index
  504. }
  505. })
  506. that.chooseStart = that.start;
  507. that.chooseEnd = that.end;
  508. that.chooseTime = !that.chooseTime;
  509. },
  510. toDelete() {
  511. let that = this;
  512. that.$request({
  513. url: that.$api.foot.del,
  514. data: {
  515. id: that.detail.id
  516. }
  517. }).then(response=>{
  518. uni.hideLoading();
  519. that.$hideLoading();
  520. if(response.code == 0) {
  521. that.showText = response.msg;
  522. that.closeMenu();
  523. that.dateList.goods.splice(that.index,1)
  524. // that.list = [];
  525. setTimeout(v=>{
  526. that.showText = false;
  527. // uni.showLoading({
  528. // title: '加载中...'
  529. // });
  530. // that.getList();
  531. },1000)
  532. }else {
  533. uni.showToast({
  534. title: response.msg,
  535. icon: 'none',
  536. duration: 1000
  537. });
  538. }
  539. }).catch(response => {
  540. uni.hideLoading();
  541. that.$hideLoading();
  542. });
  543. },
  544. toShow(goods,item,index) {
  545. this.detail = goods;
  546. this.dateList = item;
  547. this.index = index;
  548. this.showMenu = true;
  549. },
  550. closeMenu() {
  551. this.detail = {};
  552. this.beDelete = false;
  553. this.showMenu = false;
  554. },
  555. cancel() {
  556. this.chooseTime = false;
  557. this.otherday = false;
  558. this.chooseStart = [];
  559. this.chooseEnd = [];
  560. },
  561. getList() {
  562. let that = this;
  563. if(that.loading) {
  564. return false
  565. }
  566. that.loading = true;
  567. that.$request({
  568. url: that.$api.foot.index,
  569. data: {
  570. start_time: that.start_time + ' 00:00:00',
  571. end_time: that.end_time + ' 23:59:59',
  572. page: that.page
  573. }
  574. }).then(response=>{
  575. that.loading = false;
  576. uni.hideLoading();
  577. that.$hideLoading();
  578. if(response.code == 0) {
  579. if(that.list.length > 0) {
  580. if(that.list[that.list.length-1].date == response.list[0].date) {
  581. that.list[that.list.length-1].goods = that.list[that.list.length-1].goods.concat(response.list.shift().goods);
  582. }
  583. that.list = that.list.concat(response.list)
  584. }else {
  585. that.list = that.list.concat(response.list)
  586. }
  587. }else {
  588. uni.showToast({
  589. title: response.msg,
  590. icon: 'none',
  591. duration: 1000
  592. });
  593. }
  594. }).catch(response => {
  595. that.loading = false;
  596. uni.hideLoading();
  597. that.$hideLoading();
  598. that.$event.on(that.$const.EVENT_USER_LOGIN).then(()=>{
  599. that.getList();
  600. });
  601. });
  602. },
  603. toFavorite() {
  604. let that = this;
  605. that.$request({
  606. url: that.$api.user.favorite_add,
  607. data: {
  608. goods_id: that.detail.goods_id,
  609. }
  610. }).then(response=>{
  611. if(response.code == 0 || response.msg == '已经收藏过啦!') {
  612. that.showText = response.msg;
  613. that.closeMenu();
  614. setTimeout(v=>{
  615. that.showText = false;
  616. },1000)
  617. }else {
  618. uni.showToast({
  619. title: response.msg,
  620. icon: 'none',
  621. duration: 1000
  622. });
  623. }
  624. })
  625. },
  626. // 获取日期
  627. getDate() {
  628. var myDate = new Date();
  629. // 今天
  630. let year = myDate.getFullYear();
  631. let month = myDate.getMonth() + 1;
  632. if (month >= 1 && month <= 9) {
  633. month = "0" + month;
  634. }
  635. let now = myDate.getDate();
  636. this.today = year + "-" + month + "-" + now;
  637. var timestamp = Date.parse(new Date());
  638. // 昨天
  639. let yesterTime = (timestamp / 1000 - 24 * 60 * 60) * 1000;
  640. let yesterDate = new Date(yesterTime)
  641. let yester_year = yesterDate.getFullYear();
  642. let yester_month = yesterDate.getMonth() + 1;
  643. if (yester_month >= 1 && yester_month <= 9) {
  644. yester_month = "0" + yester_month;
  645. }
  646. let yester_now = yesterDate.getDate();
  647. this.yesterday = yester_year + "-" + yester_month + "-" + yester_now;
  648. // 7天
  649. let weekTime = (timestamp / 1000 - 24 * 60 * 60 * 7) * 1000;
  650. let weekDate = new Date(weekTime)
  651. let week_year = weekDate.getFullYear();
  652. let week_month = weekDate.getMonth() + 1;
  653. if (week_month >= 1 && week_month <= 9) {
  654. week_month = "0" + week_month;
  655. }
  656. let week_now = weekDate.getDate();
  657. this.weekday = week_year + "-" + week_month + "-" + week_now;
  658. // 30天
  659. let monthTime = (timestamp / 1000 - 24 * 60 * 60 * 30) * 1000;
  660. let monthDate = new Date(monthTime)
  661. let month_year = monthDate.getFullYear();
  662. let month_month = monthDate.getMonth() + 1;
  663. if (month_month >= 1 && month_month <= 9) {
  664. month_month = "0" + month_month;
  665. }
  666. let month_now = monthDate.getDate();
  667. this.monthday = month_year + "-" + month_month + "-" + month_now;
  668. },
  669. chooseDate(start,end) {
  670. if(this.loading) {
  671. return false
  672. }
  673. uni.showLoading({
  674. title: '加载中...'
  675. });
  676. this.otherday = false;
  677. this.list = [];
  678. this.page = 1;
  679. this.start_time = start;
  680. this.end_time = end;
  681. this.getList();
  682. }
  683. },
  684. onLoad() {
  685. this.$showLoading({
  686. type: 'global',
  687. text: '加载中...'
  688. });
  689. this.getDate();
  690. this.start_time = this.today;
  691. this.end_time = this.today;
  692. this.getList();
  693. },
  694. onReachBottom() {
  695. this.page++;
  696. this.getList();
  697. }
  698. }
  699. </script>
  700. <style scoped lang="scss">
  701. .out-dialog {
  702. width: #{238rpx};
  703. height: #{238rpx};
  704. position: absolute;
  705. border-top-left-radius: #{16rpx};
  706. border-top-right-radius: #{16rpx};
  707. top: 0;
  708. left: 0;
  709. background-color: rgba(0,0,0,.5);
  710. image {
  711. border-top-left-radius: #{16rpx};
  712. border-top-right-radius: #{16rpx};
  713. width: #{238rpx};
  714. height: #{238rpx};
  715. }
  716. }
  717. .no-list {
  718. font-size: #{32rpx};
  719. color: #999999;
  720. height: #{800rpx};
  721. width: 100%;
  722. image {
  723. width: #{115rpx};
  724. height: #{122rpx};
  725. margin-bottom: #{40rpx};
  726. }
  727. .to-mall {
  728. width: #{320rpx};
  729. height: #{80rpx};
  730. line-height: #{80rpx};
  731. text-align: center;
  732. border-radius: #{40rpx};
  733. background-color: #FF4544;
  734. color: #fff;
  735. margin-top: #{40rpx};
  736. }
  737. }
  738. .dialog-title {
  739. position: fixed;
  740. top: 0;
  741. left: 0;
  742. width: 100%;
  743. height: 100%;
  744. view {
  745. padding: #{22rpx} #{32rpx};
  746. background-color: rgba(0,0,0,.8);
  747. border-radius: #{8rpx};
  748. color: #fff;
  749. font-size: #{26rpx};
  750. }
  751. }
  752. .tab-list {
  753. position: fixed;
  754. top: 0;
  755. left: 0;
  756. z-index: 10;
  757. background-color: #fff;
  758. padding: #{20rpx} 0;
  759. width: 100%;
  760. .tab {
  761. width: #{600rpx};
  762. height: #{72rpx};
  763. border-radius: #{40rpx};
  764. font-size: #{28rpx};
  765. color: #ff4544;
  766. border: #{2rpx} solid #ff4544;
  767. margin: 0 auto #{20rpx};
  768. view {
  769. width: #{300rpx};
  770. height: #{72rpx};
  771. text-align: center;
  772. line-height: #{72rpx};
  773. }
  774. .active {
  775. border-radius: #{36rpx};
  776. background-color: #ff4544;
  777. color: #fff;
  778. }
  779. }
  780. .tab-date {
  781. view {
  782. padding: 0 #{24rpx};
  783. height: #{60rpx};
  784. line-height: #{60rpx};
  785. margin-left: #{24rpx};
  786. border-radius: #{40rpx};
  787. color: #353535;
  788. font-size: #{26rpx};
  789. display: inline-block;
  790. }
  791. .customize {
  792. width: #{172rpx};
  793. padding: 0;
  794. text-align: center;
  795. }
  796. .active {
  797. background-color: #ff4544;
  798. color: #fff;
  799. }
  800. }
  801. }
  802. .tab-placeholder {
  803. height: #{192rpx};
  804. }
  805. .list {
  806. padding-left: #{9rpx};
  807. .date-info {
  808. padding-left: #{21rpx};
  809. color: #999999;
  810. font-size: #{26rpx};
  811. height: #{68rpx};
  812. line-height: #{68rpx};
  813. }
  814. .goods {
  815. background-color: #fff;
  816. font-size: #{28rpx};
  817. border-radius: #{16rpx};
  818. margin-right: #{9rpx};
  819. margin-bottom: #{9rpx};
  820. color: #353535;
  821. position: relative;
  822. .goods-img {
  823. height: #{238rpx};
  824. width: #{238rpx};
  825. border-top-left-radius: #{16rpx};
  826. border-top-right-radius: #{16rpx};
  827. }
  828. .goods-info {
  829. padding: #{8rpx} #{24rpx} #{16rpx};
  830. border-bottom-left-radius: #{16rpx};
  831. border-bottom-right-radius: #{16rpx};
  832. width: #{238rpx};
  833. position: relative;
  834. color: #ff4544;
  835. .goods-name {
  836. color: #353535;
  837. margin-bottom: #{10rpx};
  838. height: #{76rpx};
  839. }
  840. .more {
  841. position: absolute;
  842. right: 0;
  843. bottom: 0;
  844. height: #{60rpx};
  845. width: #{60rpx};
  846. image {
  847. width: #{32rpx};
  848. height: #{6rpx};
  849. }
  850. }
  851. }
  852. }
  853. }
  854. .dialog {
  855. position: fixed;
  856. top: 0;
  857. left: 0;
  858. width: 100%;
  859. height: 100%;
  860. z-index: 20;
  861. background-color: rgba(0,0,0,.5);
  862. .other-area {
  863. position: absolute;
  864. top: 0;
  865. left: 0;
  866. width: 100%;
  867. height: 100%;
  868. z-index: 21;
  869. }
  870. .menu-card {
  871. padding-top: #{50rpx};
  872. position: absolute;
  873. bottom: 0;
  874. left: 0;
  875. width: 100%;
  876. height: #{312rpx};
  877. z-index: 22;
  878. border-top-left-radius: #{16rpx};
  879. border-top-right-radius: #{16rpx};
  880. background-color: rgba(255,255,255,.85);
  881. .close-menu-icon {
  882. position: absolute;
  883. top: 0;
  884. right: 0;
  885. padding: #{24rpx};
  886. image {
  887. width: #{21rpx};
  888. height: #{21rpx};
  889. display: block;
  890. }
  891. }
  892. .close-menu {
  893. position: absolute;
  894. bottom: 0;
  895. left: 0;
  896. width: 100%;
  897. height: #{100rpx};
  898. background-color: #fff;
  899. font-size: #{30rpx};
  900. color: #545454;
  901. font-weight: bold;
  902. text-align: center;
  903. line-height: #{100rpx};
  904. }
  905. .menu-item {
  906. font-size: #{23rpx};
  907. color: #545454;
  908. >view {
  909. text-align: center;
  910. width: #{96rpx};
  911. margin: 0 #{17rpx};
  912. .menu-icon {
  913. width: #{96rpx};
  914. height: #{96rpx};
  915. margin-bottom: #{4rpx};
  916. }
  917. }
  918. }
  919. }
  920. }
  921. .tips-dialog {
  922. position: fixed;
  923. top: 0;
  924. left: 0;
  925. width: 100%;
  926. height: 100%;
  927. z-index: 200;
  928. background-color: rgba(0,0,0,.5);
  929. .delete-info {
  930. width: #{620rpx};
  931. height: #{280rpx};
  932. border-radius: #{16rpx};
  933. background-color: #fff;
  934. font-size: #{36rpx};
  935. color: #353535;
  936. position: relative;
  937. .delete-content {
  938. width: #{620rpx};
  939. text-align: center;
  940. margin-top: #{76rpx};
  941. }
  942. .delete-btn {
  943. position: absolute;
  944. width: 100%;
  945. bottom: 0;
  946. left: 0;
  947. height: #{88rpx};
  948. border-top: #{1rpx} solid #e2e2e2;
  949. .line {
  950. position: absolute;
  951. left: 50%;
  952. margin-left: #{-1rpx};
  953. bottom: #{28rpx};
  954. width: #{1rpx};
  955. height: #{32rpx};
  956. background-color: #e2e2e2;
  957. }
  958. .btn {
  959. width: 50%;
  960. height: #{88rpx};
  961. line-height: #{88rpx};
  962. text-align: center;
  963. color: #666666;
  964. }
  965. .btn.submit-btn {
  966. color: #ff4544;
  967. }
  968. }
  969. }
  970. }
  971. .time-dialog {
  972. position: fixed;
  973. top: 0;
  974. left: 0;
  975. width: 100%;
  976. height: 100%;
  977. z-index: 30;
  978. background-color: rgba(0,0,0,.3);
  979. .time-dialog-content {
  980. width: #{620rpx};
  981. height: #{778rpx};
  982. background-color: #fff;
  983. border-radius: #{16rpx};
  984. font-size: #{28rpx};
  985. .time-dialog-title {
  986. width: #{620rpx};
  987. text-align: center;
  988. margin-top: #{30rpx};
  989. font-size: #{32rpx};
  990. color: #353535;
  991. }
  992. .choose-time {
  993. margin-top: #{30rpx};
  994. padding: 0 #{33rpx} #{33rpx};
  995. font-size: #{28rpx};
  996. color: #353535;
  997. position: relative;
  998. .time-title {
  999. color: #666666;
  1000. }
  1001. .year-1 {
  1002. position: absolute;
  1003. left: #{192rpx};
  1004. top: #{128rpx};
  1005. }
  1006. .month-1 {
  1007. position: absolute;
  1008. left: #{380rpx};
  1009. top: #{128rpx};
  1010. }
  1011. .day-1 {
  1012. position: absolute;
  1013. right: #{32rpx};
  1014. top: #{128rpx};
  1015. }
  1016. .year-2 {
  1017. position: absolute;
  1018. left: #{192rpx};
  1019. bottom: #{148rpx};
  1020. }
  1021. .month-2 {
  1022. position: absolute;
  1023. left: #{380rpx};
  1024. bottom: #{148rpx};
  1025. }
  1026. .day-2 {
  1027. position: absolute;
  1028. right: #{32rpx};
  1029. bottom: #{148rpx};
  1030. }
  1031. }
  1032. .btn-area {
  1033. height: #{88rpx};
  1034. position: relative;
  1035. border-top: #{2rpx} solid #f1f1f1;
  1036. }
  1037. .btn-area.other-btn-area {
  1038. margin-top: #{10rpx};
  1039. }
  1040. .btn-area .line {
  1041. height: #{32rpx};
  1042. width: #{1rpx};
  1043. background-color: #e2e2e2;
  1044. position: absolute;
  1045. top: #{28rpx};
  1046. left: 0;
  1047. right: 0;
  1048. margin: 0 auto;
  1049. }
  1050. .submit-btn {
  1051. height: #{88rpx};
  1052. line-height: #{88rpx};
  1053. font-size: #{32rpx};
  1054. color: #666;
  1055. width: #{310rpx};
  1056. text-align: center;
  1057. }
  1058. .submit-btn.be-submit {
  1059. color: #ff4544;
  1060. }
  1061. .picker-view {
  1062. width: #{556rpx};
  1063. height: #{216rpx};
  1064. margin: 0 auto #{25rpx};
  1065. text-align: center;
  1066. .sure-color {
  1067. color: #ff4544;
  1068. }
  1069. .cardinal-color {
  1070. color: #999999;
  1071. }
  1072. .even-color {
  1073. color: #cdcdcd;
  1074. }
  1075. }
  1076. .picker-view view {
  1077. line-height: #{72rpx};
  1078. // color:#ff4544;
  1079. }
  1080. }
  1081. }
  1082. </style>