summary.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. <template>
  2. <app-layout>
  3. <view class="tab-list">
  4. <view class="tab cross-center main-center">
  5. <view @click="toList">浏览记录</view>
  6. <view class="active">账单总结</view>
  7. </view>
  8. </view>
  9. <view @touchstart="start(1)" @touchmove="enter" @touchend="leave" :class="[`list`,`${active == 1 ? 'active' : ''}`, `${last == 1 ? 'last' : ''}`]" :style="{'background-image': `url(${ttf.open_bg})`}">
  10. <view style="height: 100%" class="show-icon first cross-center main-center">
  11. <image :style="{'width': `${size[1].width}`,'height':`${size[1].height}`}" @load="load(1,$event)" :src="ttf.index"></image>
  12. </view>
  13. </view>
  14. <view @touchstart="start(2)" @touchmove="enter" @touchend="leave" :class="[`list`,`${active == 2 ? 'active' : ''}`, `${next == 2 ? 'next' : ''}`, `${last == 2 ? 'last' : ''}`]" :style="{'background-image': `url(${ttf.day_bg})`}">
  15. <view class="info cross-center dir-top-nowrap main-center">
  16. <view>这是您在<text class="name">{{mall.name}}</text></view>
  17. <view>的第<text class="day">{{day}}</text>天</view>
  18. </view>
  19. <view class="show-icon cross-center main-center">
  20. <image :style="{'width': `${size[2].width}`,'height':`${size[2].height}`}" @load="load(2,$event)" :src="ttf.day_icon"></image>
  21. </view>
  22. </view>
  23. <view @touchstart="start(3)" @touchmove="enter" @touchend="leave" :class="[`list`,`${active == 3 ? 'active' : ''}`, `${next == 3 ? 'next' : ''}`, `${last == 3 ? 'last' : ''}`]" :style="{'background-image': `url(${ttf.total_bg})`}">
  24. <view class="info cross-center dir-top-nowrap main-center">
  25. <view>截止到<text class="yesterday">{{yesterday}}</text></view>
  26. <view>您在本店共消费<text style="color: #fff7be">¥</text><text class="pay-price">{{pay_price}}</text></view>
  27. </view>
  28. <view class="show-icon cross-center main-center">
  29. <image :style="{'width': `${size[3].width}`,'height':`${size[3].height}`}" @load="load(3,$event)" :src="ttf.total"></image>
  30. </view>
  31. </view>
  32. <view @touchstart="start(4)" @touchmove="enter" @touchend="leave" :class="[`list`,`${active == 4 ? 'active' : ''}`, `${next == 4 ? 'next' : ''}`, `${last == 4 ? 'last' : ''}`]" :style="{'background-image': `url(${ttf.buy_bg})`}">
  33. <view class="info cross-center dir-top-nowrap main-center">
  34. <view>截止到<text class="yesterday">{{yesterday}}</text></view>
  35. <view>您在本店共购买<text class="pay-price">{{pay_num}}</text>件商品</view>
  36. </view>
  37. <view class="show-icon cross-center main-center">
  38. <image :style="{'width': `${size[4].width}`,'height':`${size[4].height}`}" @load="load(4,$event)" :src="ttf.buy"></image>
  39. </view>
  40. </view>
  41. <view @touchstart="start(5)" @touchmove="enter" @touchend="leave" :class="[`list`,`${active == 5 ? 'active' : ''}`, `${next == 5 ? 'next' : ''}`, `${last == 5 ? 'last' : ''}`]" :style="{'background-image': `url(${ttf.high_bg})`}">
  42. <view style="height: 25%" class="info cross-center dir-top-nowrap main-center">
  43. <view>截止到<text class="yesterday">{{yesterday}}</text></view>
  44. <view class="other">您在本店的最高一次消费达到</view>
  45. <view><text style="color: #fff7be">¥</text><text class="pay-price">{{highest_price}}</text></view>
  46. </view>
  47. <view class="show-icon cross-center main-center">
  48. <image :style="{'width': `${size[5].width}`,'height':`${size[5].height}`}" @load="load(5,$event)" :src="ttf.high_icon"></image>
  49. </view>
  50. </view>
  51. <view @touchstart="start(6)" @touchmove="enter" @touchend="leave" :class="[`list`,`${active == 6 ? 'active' : ''}`, `${next == 6 ? 'next' : ''}`, `${last == 6 ? 'last' : ''}`]" :style="{'background-image': `url(${ttf.coupon_bg})`}">
  52. <view style="height: 26%" class="info cross-center dir-top-nowrap main-center">
  53. <view>截止到<text class="yesterday">{{yesterday}}</text></view>
  54. <view>使用了<text class="yesterday">{{coupon_num}}</text>张优惠券</view>
  55. <view>共计节省了<text style="color: #fff7be">¥</text><text class="pay-price">{{coupon_discount_price}}</text></view>
  56. </view>
  57. <view class="show-icon cross-center main-center">
  58. <image :style="{'width': `${size[6].width}`,'height':`${size[6].height}`}" @load="load(6,$event)" :src="ttf.coupon_icon"></image>
  59. </view>
  60. </view>
  61. <view v-if="userInfo.identity.member_level > 0 || userInfo.is_vip_card_user == 1" @touchstart="start(7)" @touchmove="enter" @touchend="leave" :class="[`list`,`${active == 7 ? 'active' : ''}`, `${next == 7 ? 'next' : ''}`, `${last == 7 ? 'last' : ''}`]" :style="{'background-image': `url(${ttf.member_bg})`}">
  62. <view style="height: 25%" class="info cross-center dir-top-nowrap main-center">
  63. <view>截止到<text class="yesterday">{{yesterday}}</text></view>
  64. <view class="other">您作为会员,比普通用户节省</view>
  65. <view><text style="color: #fff7be">¥</text><text class="pay-price">{{member_discount_price}}</text></view>
  66. </view>
  67. <view class="show-icon cross-center main-center">
  68. <image :style="{'width': `${size[7].width}`,'height':`${size[7].height}`}" @load="load(7,$event)" :src="ttf.member_icon"></image>
  69. </view>
  70. </view>
  71. <view @touchstart="start(8)" @touchmove="enter" @touchend="leave" :class="[`list`,`${active == 8 ? 'active' : ''}`, `${next == 8 ? 'next' : ''}`, `${last == 8 ? 'last' : ''}`]" :style="{'background-image': `url(${ttf.buy_bg})`}">
  72. <view class="info cross-center dir-top-nowrap main-center">
  73. <view class="other">您的消费力度高于本店铺</view>
  74. <view><text class="pay-price">{{percentage*100}}%</text>的客户</view>
  75. </view>
  76. <view class="show-icon cross-center main-center">
  77. <image :style="{'width': `${size[8].width}`,'height':`${size[8].height}`}" @load="load(8,$event)" :src="ttf.rate_icon"></image>
  78. </view>
  79. </view>
  80. <view class="text-info" v-if="active == 2">更多惊喜,接着往下看</view>
  81. <image class="page-down" v-if="active < 8" src="./../image/pgdn.gif"></image>
  82. <view class="more-menu cross-center main-center" v-if="active == 8">
  83. <image @click="toMall" src="./../image/to-index.png"></image>
  84. <image @click="openPoster" src="./../image/share.png"></image>
  85. </view>
  86. <view v-if="show" class="poster-dialog">
  87. <app-goods-preview-poster @close="close" :url="posterUrl"></app-goods-preview-poster>
  88. </view>
  89. </app-layout>
  90. </template>
  91. <script>
  92. import { mapState } from "vuex";
  93. import appGoodsPreviewPoster from '../../../components/page-component/goods/app-goods-preview-poster.vue';
  94. export default {
  95. data() {
  96. return {
  97. day: 0,
  98. posterUrl: '',
  99. coupon_discount_price: 0,
  100. coupon_num: 0,
  101. highest_price: 0,
  102. member_discount_price: 0,
  103. pay_num: 0,
  104. pay_price: 0,
  105. percentage: 0,
  106. yesterday: '',
  107. active: 1,
  108. next: null,
  109. last: 0,
  110. height: 0,
  111. loading: false,
  112. show: false,
  113. list: [],
  114. size: [{width: '',height: ''},{width: '',height: ''},{width: '',height: ''},{width: '',height: ''},{width: '',height: ''},{width: '',height: ''},{width: '',height: ''},{width: '',height: ''},{width: '',height: ''}]
  115. }
  116. },
  117. components: {
  118. appGoodsPreviewPoster,
  119. },
  120. computed: {
  121. ...mapState({
  122. mall: state => state.mallConfig.mall,
  123. ttf: state => state.mallConfig.__wxapp_img.foot,
  124. userInfo: state => state.user.info,
  125. })
  126. },
  127. methods: {
  128. openPoster() {
  129. this.show = true;
  130. this.posterUrl = this.$api.poster.footprint;
  131. },
  132. toMall() {
  133. uni.reLaunch({
  134. url: '/pages/index/index'
  135. });
  136. },
  137. close() {
  138. this.show = false;
  139. this.posterUrl = '';
  140. },
  141. start(num) {
  142. if(this.loading) {
  143. return false
  144. }
  145. console.log(this.loading)
  146. this.list = [];
  147. this.active = num;
  148. },
  149. enter(e) {
  150. if(this.loading) {
  151. return false
  152. }
  153. this.list.push(e);
  154. },
  155. leave(e) {
  156. let that = this;
  157. if(that.loading) {
  158. return false
  159. }
  160. setTimeout(v=>{
  161. that.loading = true;
  162. if(that.list.length > 0) {
  163. if(+that.list[0].changedTouches[0].clientY - +that.list[that.list.length - 1].changedTouches[0].clientY > 30 && that.active < 8) {
  164. console.log('next')
  165. setTimeout(v=>{
  166. if(that.active == 6 && that.userInfo.identity.member_level == 0 && that.userInfo.is_vip_card_user == 0) {
  167. that.next = 8;
  168. }else {
  169. that.next = that.active + 1;
  170. }
  171. if(that.active == 8 && that.userInfo.identity.member_level == 0 && that.userInfo.is_vip_card_user == 0) {
  172. that.last = 6;
  173. }else {
  174. that.last = that.active - 1;
  175. }
  176. setTimeout(v=>{
  177. uni.pageScrollTo({
  178. scrollTop: that.height*2,
  179. duration: 1000
  180. });
  181. },100)
  182. setTimeout(v=>{
  183. that.next = 0;
  184. if(that.active == 6 && that.userInfo.identity.member_level == 0 && that.userInfo.is_vip_card_user == 0) {
  185. that.active = 8;
  186. }else {
  187. that.active++;
  188. }
  189. that.loading = false;
  190. },1000)
  191. },100)
  192. }else if(+that.list[0].changedTouches[0].clientY - +that.list[that.list.length - 1].changedTouches[0].clientY < -30 && that.active > 1) {
  193. console.log('last')
  194. if(that.active == 6 && that.userInfo.identity.member_level == 0 && that.userInfo.is_vip_card_user == 0) {
  195. that.next = 8;
  196. }else {
  197. that.next = that.active + 1;
  198. }
  199. if(that.active == 8 && that.userInfo.identity.member_level == 0 && that.userInfo.is_vip_card_user == 0) {
  200. that.last = 6;
  201. }else {
  202. that.last = that.active - 1;
  203. }
  204. uni.pageScrollTo({
  205. scrollTop: 0,
  206. duration: 0
  207. });
  208. that.next = 0;
  209. if(that.active == 8 && that.userInfo.identity.member_level == 0 && that.userInfo.is_vip_card_user == 0) {
  210. that.active = 6;
  211. }else {
  212. that.active--;
  213. }
  214. that.loading = false;
  215. }else {
  216. uni.pageScrollTo({
  217. scrollTop: 0,
  218. duration: 200
  219. });
  220. that.loading = false;
  221. }
  222. }
  223. },200)
  224. },
  225. toList() {
  226. uni.redirectTo({
  227. url: '/pages/foot/index/index'
  228. });
  229. },
  230. getList() {
  231. let that = this;
  232. that.$request({
  233. url: that.$api.foot.list,
  234. }).then(response=>{
  235. uni.hideLoading();
  236. that.$hideLoading();
  237. if(response.code == 0) {
  238. that.day = response.data.day;
  239. that.coupon_discount_price = response.data.coupon_discount_price;
  240. that.coupon_num = response.data.coupon_num;
  241. that.highest_price = response.data.highest_price;
  242. that.member_discount_price = response.data.member_discount_price;
  243. that.pay_num = response.data.pay_num;
  244. that.pay_price = response.data.pay_price;
  245. that.percentage = response.data.percentage;
  246. }else {
  247. uni.showToast({
  248. title: response.msg,
  249. icon: 'none',
  250. duration: 1000
  251. });
  252. }
  253. }).catch(response => {
  254. uni.hideLoading();
  255. that.$hideLoading();
  256. that.$event.on(that.$const.EVENT_USER_LOGIN).then(()=>{
  257. that.getList();
  258. });
  259. });
  260. },
  261. load(index,e) {
  262. this.size[index].width = e.detail.width + 'rpx';
  263. this.size[index].height = e.detail.height + 'rpx';
  264. }
  265. },
  266. onLoad() {
  267. let that = this;
  268. this.height = uni.getSystemInfoSync().windowHeight;
  269. this.$showLoading({
  270. type: 'global',
  271. text: '加载中...'
  272. });
  273. var timestamp = Date.parse(new Date());
  274. // 昨天
  275. let yesterTime = (timestamp / 1000 - 24 * 60 * 60) * 1000;
  276. let yesterDate = new Date(yesterTime)
  277. let yester_year = yesterDate.getFullYear();
  278. let yester_month = yesterDate.getMonth() + 1;
  279. if (yester_month >= 1 && yester_month <= 9) {
  280. yester_month = "0" + yester_month;
  281. }
  282. let yester_now = yesterDate.getDate();
  283. this.yesterday = yester_year + "." + yester_month + "." + yester_now;
  284. // uni.loadFontFace({
  285. // family: 'hycyj',
  286. // source: 'url("' + this.ttf.hycyj + '")',
  287. // success() {
  288. // console.log('success')
  289. // }
  290. // })
  291. this.getList();
  292. }
  293. }
  294. </script>
  295. <style scoped lang="scss">
  296. .poster-dialog {
  297. position: fixed;
  298. left: 0;
  299. top: 0;
  300. width: 100%;
  301. height: 100%;
  302. z-index: 500;
  303. background-color: rgba(0,0,0,0.5);
  304. }
  305. .tab-list {
  306. position: fixed;
  307. top: 0;
  308. left: 0;
  309. z-index: 300;
  310. background-color: #fff;
  311. padding: #{20rpx} 0;
  312. width: 100%;
  313. .tab {
  314. width: #{600rpx};
  315. border-radius: 40rpx;
  316. font-size: #{28rpx};
  317. color: #ff4544;
  318. border: #{2rpx} solid #ff4544;
  319. margin: 0 auto #{20rpx};
  320. view {
  321. width: #{300rpx};
  322. height: #{72rpx};
  323. text-align: center;
  324. line-height: #{72rpx};
  325. }
  326. .active {
  327. border-radius: #{36rpx};
  328. background-color: #ff4544;
  329. color: #fff;
  330. }
  331. }
  332. .tab-date {
  333. view {
  334. padding: 0 #{24rpx};
  335. height: #{60rpx};
  336. line-height: #{60rpx};
  337. margin-left: #{24rpx};
  338. border-radius: #{40rpx};
  339. color: #353535;
  340. font-size: #{26rpx};
  341. display: inline-block;
  342. }
  343. .customize {
  344. width: #{172rpx};
  345. padding: 0;
  346. text-align: center;
  347. }
  348. .active {
  349. background-color: #ff4544;
  350. color: #fff;
  351. }
  352. }
  353. }
  354. .list {
  355. padding-top: #{72rpx};
  356. display: none;
  357. position: absolute;
  358. top: 0;
  359. left: 0;
  360. width: 100%;
  361. height: 100%;
  362. background-size: 100% 100%;
  363. background-position: center;
  364. background-repeat: no-repeat;
  365. .show-icon {
  366. width: 100%;
  367. bottom: 0;
  368. left: 0;
  369. position: absolute;
  370. height: 70%;
  371. }
  372. .show-icon.first {
  373. padding-top: #{40rpx};
  374. }
  375. }
  376. .list.active {
  377. position: fixed;
  378. top: 0;
  379. z-index: 100;
  380. display: block;
  381. }
  382. .list.next {
  383. top: 100%;
  384. display: block;
  385. z-index: 200;
  386. }
  387. // .list.last {
  388. // top: 0;
  389. // display: block;
  390. // z-index: 200;
  391. // }
  392. .info {
  393. font-size: #{40rpx};
  394. color: #fff;
  395. text-align: center;
  396. width: 100%;
  397. position: absolute;
  398. top: #{120rpx};
  399. font-family: hycyj;
  400. left: 0;
  401. height: 20%;
  402. .name {
  403. font-size: #{58rpx};
  404. color: #fff7be;
  405. }
  406. .day {
  407. color: #fff7be;
  408. font-size: #{95rpx};
  409. font-family: DIN;
  410. }
  411. .yesterday {
  412. font-size: #{58rpx};
  413. font-family: DIN;
  414. color: #fff7be;
  415. }
  416. .pay-price {
  417. font-size: #{95rpx};
  418. font-family: DIN;
  419. color: #fff7be;
  420. }
  421. .other {
  422. margin: #{30rpx} 0 #{10rpx};
  423. }
  424. }
  425. .total-gif {
  426. position: absolute;
  427. top: #{345rpx};
  428. left: #{30rpx};
  429. z-index: 20;
  430. width: #{691rpx};
  431. height: #{767rpx};
  432. }
  433. .buy-gif {
  434. position: absolute;
  435. top: #{450rpx};
  436. left: #{30rpx};
  437. z-index: 20;
  438. width: #{691rpx};
  439. height: #{663rpx};
  440. }
  441. .text-info {
  442. position: fixed;
  443. bottom: #{104rpx};
  444. left: 0;
  445. width: 100%;
  446. text-align: center;
  447. font-size: 29rpx;
  448. color: #fff;
  449. font-family: hycyj;
  450. z-index: 100;
  451. }
  452. .page-down {
  453. position: fixed;
  454. bottom: #{24rpx};
  455. left: 0;
  456. right: 0;
  457. width: #{70rpx};
  458. height: #{70rpx};
  459. margin: 0 auto;
  460. z-index: 100;
  461. }
  462. .more-menu {
  463. position: fixed;
  464. bottom: #{35rpx};
  465. left: 0;
  466. right: 0;
  467. width: 100%;
  468. height: #{89rpx};
  469. z-index: 100;
  470. image {
  471. width: #{89rpx};
  472. height: #{89rpx};
  473. margin: 0 #{100rpx};
  474. }
  475. }
  476. </style>