summary.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  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="{'zoom': indexRate}" 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" :style="{'font-size': rate*40 + 'rpx'}">
  16. <view>这是您在<text class="name" :style="{'font-size': rate*58 + 'rpx'}">{{mall.name}}</text></view>
  17. <view>的第<text class="day" :style="{'font-size': rate*95 + 'rpx'}">{{day}}</text>天</view>
  18. </view>
  19. <view :style="{'zoom': rate}" 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" :style="{'font-size': rate*40 + 'rpx'}">
  25. <view>截止到<text class="yesterday">{{yesterday}}</text></view>
  26. <view>您在本店共消费<text style="color: #fff7be">¥</text><text class="pay-price" :style="{'font-size': rate*95 + 'rpx'}">{{pay_price}}</text></view>
  27. </view>
  28. <view :style="{'zoom': rate}" 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" :style="{'font-size': rate*40 + 'rpx'}">
  34. <view>截止到<text class="yesterday" :style="{'font-size': rate*58 + 'rpx'}">{{yesterday}}</text></view>
  35. <view>您在本店共购买<text class="pay-price" :style="{'font-size': rate*95 + 'rpx'}">{{pay_num}}</text>件商品</view>
  36. </view>
  37. <view :style="{'zoom': rate}" 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: 20%" class="info cross-center dir-top-nowrap main-center" :style="{'font-size': rate*40 + 'rpx'}">
  43. <view>截止到<text class="yesterday" :style="{'font-size': rate*58 + 'rpx'}">{{yesterday}}</text></view>
  44. <view class="other" :style="{'margin': rate*30 + 'rpx 0 ' + rate*10 + 'rpx'}">您在本店的最高一次消费达到</view>
  45. <view><text style="color: #fff7be">¥</text><text class="pay-price" :style="{'font-size': rate*95 + 'rpx'}">{{highest_price}}</text></view>
  46. </view>
  47. <view :style="{'zoom': rate}" 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: 21%" class="info cross-center dir-top-nowrap main-center" :style="{'font-size': rate*40 + 'rpx'}">
  53. <view>截止到<text class="yesterday" :style="{'font-size': rate*58 + 'rpx'}">{{yesterday}}</text></view>
  54. <view>使用了<text class="yesterday" :style="{'font-size': rate*58 + 'rpx'}">{{coupon_num}}</text>张优惠券</view>
  55. <view>共计节省了<text style="color: #fff7be">¥</text><text class="pay-price" :style="{'font-size': rate*95 + 'rpx'}">{{coupon_discount_price}}</text></view>
  56. </view>
  57. <view :style="{'zoom': rate}" 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: 20%" class="info cross-center dir-top-nowrap main-center" :style="{'font-size': rate*40 + 'rpx'}">
  63. <view>截止到<text class="yesterday" :style="{'font-size': rate*58 + 'rpx'}">{{yesterday}}</text></view>
  64. <view class="other" :style="{'margin': rate*30 + 'rpx 0 ' + rate*10 + 'rpx'}">您作为会员,比普通用户节省</view>
  65. <view><text style="color: #fff7be">¥</text><text class="pay-price" :style="{'font-size': rate*95 + 'rpx'}">{{member_discount_price}}</text></view>
  66. </view>
  67. <view :style="{'zoom': rate}" 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" :style="{'font-size': rate*40 + 'rpx'}">
  73. <view class="other" :style="{'margin': rate*30 + 'rpx 0 ' + rate*10 + 'rpx'}">您的消费力度高于本店铺</view>
  74. <view><text class="pay-price" :style="{'font-size': rate*95 + 'rpx'}">{{percentageRate}}%</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 v-model="show" @close="show=false" :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. rate: 1,
  98. indexRate: 1,
  99. day: 0,
  100. posterUrl: this.$api.poster.footprint,
  101. coupon_discount_price: 0,
  102. coupon_num: 0,
  103. highest_price: 0,
  104. member_discount_price: 0,
  105. pay_num: 0,
  106. pay_price: 0,
  107. percentage: 0,
  108. percentageRate: 0,
  109. yesterday: '',
  110. active: 1,
  111. next: null,
  112. last: 0,
  113. height: 0,
  114. loading: false,
  115. show: false,
  116. list: [],
  117. size: [{width: '',height: ''},{width: '',height: ''},{width: '',height: ''},{width: '',height: ''},{width: '',height: ''},{width: '',height: ''},{width: '',height: ''},{width: '',height: ''},{width: '',height: ''}]
  118. }
  119. },
  120. components: {
  121. appGoodsPreviewPoster,
  122. },
  123. computed: {
  124. ...mapState({
  125. mall: state => state.mallConfig.mall,
  126. ttf: state => state.mallConfig.__wxapp_img.foot,
  127. userInfo: state => state.user.info,
  128. })
  129. },
  130. methods: {
  131. openPoster() {
  132. this.show = true;
  133. },
  134. toMall() {
  135. uni.reLaunch({
  136. url: '/pages/index/index'
  137. });
  138. },
  139. close() {
  140. this.show = false;
  141. },
  142. start(num) {
  143. if(this.loading) {
  144. return false
  145. }
  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. setTimeout(v=>{
  165. if(that.active == 6 && that.userInfo.identity.member_level == 0 && that.userInfo.is_vip_card_user == 0) {
  166. that.next = 8;
  167. }else {
  168. that.next = that.active + 1;
  169. }
  170. if(that.active == 8 && that.userInfo.identity.member_level == 0 && that.userInfo.is_vip_card_user == 0) {
  171. that.last = 6;
  172. }else {
  173. that.last = that.active - 1;
  174. }
  175. setTimeout(v=>{
  176. uni.pageScrollTo({
  177. scrollTop: that.height*2,
  178. duration: 1000
  179. });
  180. },100)
  181. setTimeout(v=>{
  182. that.next = 0;
  183. if(that.active == 6 && that.userInfo.identity.member_level == 0 && that.userInfo.is_vip_card_user == 0) {
  184. that.active = 8;
  185. }else {
  186. that.active++;
  187. }
  188. that.loading = false;
  189. },1000)
  190. },100)
  191. }else if(+that.list[0].changedTouches[0].clientY - +that.list[that.list.length - 1].changedTouches[0].clientY < -30 && that.active > 1) {
  192. if(that.active == 6 && that.userInfo.identity.member_level == 0 && that.userInfo.is_vip_card_user == 0) {
  193. that.next = 8;
  194. }else {
  195. that.next = that.active + 1;
  196. }
  197. if(that.active == 8 && that.userInfo.identity.member_level == 0 && that.userInfo.is_vip_card_user == 0) {
  198. that.last = 6;
  199. }else {
  200. that.last = that.active - 1;
  201. }
  202. uni.pageScrollTo({
  203. scrollTop: 0,
  204. duration: 0
  205. });
  206. that.next = 0;
  207. if(that.active == 8 && that.userInfo.identity.member_level == 0 && that.userInfo.is_vip_card_user == 0) {
  208. that.active = 6;
  209. }else {
  210. that.active--;
  211. }
  212. that.loading = false;
  213. }else {
  214. uni.pageScrollTo({
  215. scrollTop: 0,
  216. duration: 200
  217. });
  218. that.loading = false;
  219. }
  220. }
  221. },200)
  222. },
  223. toList() {
  224. uni.redirectTo({
  225. url: '/pages/foot/index/index'
  226. });
  227. },
  228. getList() {
  229. let that = this;
  230. that.$request({
  231. url: that.$api.foot.list,
  232. }).then(response=>{
  233. uni.hideLoading();
  234. that.$hideLoading();
  235. if(response.code == 0) {
  236. that.day = response.data.day;
  237. that.coupon_discount_price = response.data.coupon_discount_price;
  238. that.coupon_num = response.data.coupon_num;
  239. that.highest_price = response.data.highest_price;
  240. that.member_discount_price = response.data.member_discount_price;
  241. that.pay_num = response.data.pay_num;
  242. that.pay_price = response.data.pay_price;
  243. that.percentage = response.data.percentage;
  244. that.percentageRate = (response.data.percentage*100).toFixed(0);
  245. }else {
  246. uni.showToast({
  247. title: response.msg,
  248. icon: 'none',
  249. duration: 1000
  250. });
  251. }
  252. }).catch(() => {
  253. uni.hideLoading();
  254. that.$hideLoading();
  255. that.$event.on(that.$const.EVENT_USER_LOGIN).then(()=>{
  256. that.getList();
  257. });
  258. });
  259. },
  260. load(index,e) {
  261. this.size[index].width = e.detail.width + 'rpx';
  262. this.size[index].height = e.detail.height + 'rpx';
  263. }
  264. },
  265. onLoad() { this.$commonLoad.onload();
  266. this.height = uni.getSystemInfoSync().windowHeight;
  267. this.rate = +this.height / 599 > 1 ? 1 : +this.height / 599;
  268. this.indexRate = +this.height / 657 > 1 ? 1 : +this.height / 657
  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. this.getList();
  285. }
  286. }
  287. </script>
  288. <style scoped lang="scss">
  289. .poster-dialog {
  290. position: fixed;
  291. left: 0;
  292. top: 0;
  293. width: 100%;
  294. height: 100%;
  295. z-index: 500;
  296. background-color: rgba(0,0,0,0.5);
  297. }
  298. .tab-list {
  299. position: fixed;
  300. top: 0;
  301. left: 0;
  302. z-index: 300;
  303. background-color: #fff;
  304. padding: #{20rpx} 0;
  305. width: 100%;
  306. .tab {
  307. width: #{600rpx};
  308. border-radius: 40rpx;
  309. font-size: #{28rpx};
  310. color: #ff4544;
  311. border: #{2rpx} solid #ff4544;
  312. margin: 0 auto #{20rpx};
  313. view {
  314. width: #{300rpx};
  315. height: #{72rpx};
  316. text-align: center;
  317. line-height: #{72rpx};
  318. }
  319. .active {
  320. border-radius: #{36rpx};
  321. background-color: #ff4544;
  322. color: #fff;
  323. }
  324. }
  325. .tab-date {
  326. view {
  327. padding: 0 #{24rpx};
  328. height: #{60rpx};
  329. line-height: #{60rpx};
  330. margin-left: #{24rpx};
  331. border-radius: #{40rpx};
  332. color: #353535;
  333. font-size: #{26rpx};
  334. display: inline-block;
  335. }
  336. .customize {
  337. width: #{172rpx};
  338. padding: 0;
  339. text-align: center;
  340. }
  341. .active {
  342. background-color: #ff4544;
  343. color: #fff;
  344. }
  345. }
  346. }
  347. .list {
  348. padding-top: #{72rpx};
  349. display: none;
  350. position: absolute;
  351. top: 0;
  352. left: 0;
  353. width: 100%;
  354. height: 100%;
  355. background-size: 100% 100%;
  356. background-position: center;
  357. background-repeat: no-repeat;
  358. .show-icon {
  359. width: 100%;
  360. bottom: 0;
  361. left: 0;
  362. position: absolute;
  363. height: 70%;
  364. }
  365. .show-icon.first {
  366. padding-top: #{40rpx};
  367. }
  368. }
  369. .list.active {
  370. position: fixed;
  371. top: 0;
  372. z-index: 100;
  373. display: block;
  374. }
  375. .list.next {
  376. top: 100%;
  377. display: block;
  378. z-index: 200;
  379. }
  380. .info {
  381. font-size: #{40rpx};
  382. color: #fff;
  383. text-align: center;
  384. width: 100%;
  385. position: absolute;
  386. top: #{138rpx};
  387. font-family: hycyj;
  388. left: 0;
  389. height: 15%;
  390. .name {
  391. font-size: #{58rpx};
  392. color: #fff7be;
  393. }
  394. .day {
  395. color: #fff7be;
  396. font-size: #{95rpx};
  397. font-family: DIN;
  398. }
  399. .yesterday {
  400. font-size: #{58rpx};
  401. font-family: DIN;
  402. color: #fff7be;
  403. }
  404. .pay-price {
  405. font-size: #{95rpx};
  406. font-family: DIN;
  407. color: #fff7be;
  408. }
  409. .other {
  410. margin: #{30rpx} 0 #{10rpx};
  411. }
  412. }
  413. .total-gif {
  414. position: absolute;
  415. top: #{345rpx};
  416. left: #{30rpx};
  417. z-index: 20;
  418. width: #{691rpx};
  419. height: #{767rpx};
  420. }
  421. .buy-gif {
  422. position: absolute;
  423. top: #{450rpx};
  424. left: #{30rpx};
  425. z-index: 20;
  426. width: #{691rpx};
  427. height: #{663rpx};
  428. }
  429. .text-info {
  430. position: fixed;
  431. bottom: #{104rpx};
  432. left: 0;
  433. width: 100%;
  434. text-align: center;
  435. font-size: 29rpx;
  436. color: #fff;
  437. font-family: hycyj;
  438. z-index: 100;
  439. }
  440. .page-down {
  441. position: fixed;
  442. bottom: #{24rpx};
  443. left: 0;
  444. right: 0;
  445. width: #{70rpx};
  446. height: #{70rpx};
  447. margin: 0 auto;
  448. z-index: 100;
  449. }
  450. .more-menu {
  451. position: fixed;
  452. bottom: #{35rpx};
  453. left: 0;
  454. right: 0;
  455. width: 100%;
  456. height: #{89rpx};
  457. z-index: 100;
  458. image {
  459. width: #{89rpx};
  460. height: #{89rpx};
  461. margin: 0 #{100rpx};
  462. }
  463. }
  464. </style>