Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

421 wiersze
12 KiB

  1. <template>
  2. <view class="container">
  3. <view class="user-section">
  4. <image class="bg" src="/static/user-bg.jpg"></image>
  5. <view class="user-info-box">
  6. <view class="portrait-box">
  7. <image class="portrait" :src="userInfo.avatar ? userInfo.avatar : '/static/missing-face.png'"></image>
  8. </view>
  9. <view class="info-box">
  10. <text class="username">{{userInfo.username || 'Tourist'}}</text>
  11. </view>
  12. </view>
  13. <view class="vip-card-box">
  14. <image class="card-bg" src="/static/vip-card-bg.png" mode=""></image>
  15. <!-- <view class="b-btn">
  16. 立即开通
  17. </view> -->
  18. <view class="tit">
  19. <text class="yticon icon-iLinkapp-"></text>
  20. VIP
  21. </view>
  22. <text class="e-m">uniShop</text>
  23. <!-- <text class="e-b">开通会员开发无bug 一测就上线</text> -->
  24. </view>
  25. </view>
  26. <view
  27. class="cover-container"
  28. :style="[{
  29. transform: coverTransform,
  30. transition: coverTransition
  31. }]"
  32. @touchstart="coverTouchstart"
  33. @touchmove="coverTouchmove"
  34. @touchend="coverTouchend"
  35. >
  36. <image class="arc" src="/static/arc.png"></image>
  37. <!-- 订单 -->
  38. <view class="order-header">
  39. <view class="title">My Order</view>
  40. <view class="item" @click="$api.navTo('/pages/order/order?state=0')" >All
  41. <text class="yticon right icon-you"></text>
  42. </view>
  43. </view>
  44. <view class="order-section">
  45. <view class="order-item" @click="$api.navTo('/pages/order/order?state=1')" hover-class="common-hover" :hover-stay-time="50">
  46. <text class="yticon icon-daifukuan"></text>
  47. <text class="num" v-if="orderNum.unpaid > 0">{{orderNum.unpaid}}</text>
  48. <text>Unpayment</text>
  49. </view>
  50. <!-- <view class="order-item" @click="$api.navTo('/pages/order/order?state=2')" hover-class="common-hover" :hover-stay-time="50">
  51. <text class="yticon icon-daifahuo"></text>
  52. <text class="num" v-if="orderNum.undelivered > 0">{{orderNum.undelivered}}</text>
  53. <text>Unshipped</text>
  54. </view> -->
  55. <!-- <view class="order-item" @click="$api.navTo('/pages/order/order?state=3')" hover-class="common-hover" :hover-stay-time="50">
  56. <text class="yticon icon-daishouhuo"></text>
  57. <text class="num" v-if="orderNum.unreceived > 0">{{orderNum.unreceived}}</text>
  58. <text>Shipped</text>
  59. </view> -->
  60. <view class="order-item" @click="$api.navTo('/pages/order/order?state=2')" hover-class="common-hover" :hover-stay-time="50">
  61. <text class="yticon icon-pingjia"></text>
  62. <text class="num" v-if="orderNum.uncomment > 0">{{orderNum.uncomment}}</text>
  63. <text>Completed</text>
  64. </view>
  65. <view class="order-item" @click="$api.navTo('/pages/order/order?state=3')" hover-class="common-hover" :hover-stay-time="50">
  66. <text class="yticon icon-shouhou"></text>
  67. <text class="num" v-if="orderNum.refund > 0">{{orderNum.refund}}</text>
  68. <text>Cancelled</text>
  69. </view>
  70. </view>
  71. <!-- 浏览历史 -->
  72. <view class="history-section icon">
  73. <!-- <view class="sec-header">
  74. <text class="yticon icon-lishijilu"></text>
  75. <text>浏览历史</text>
  76. </view> -->
  77. <!-- <scroll-view scroll-x class="h-list">
  78. <image @click="navTo('/pages/product/product')" src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1553105186633&di=c121a29beece4e14269948d990f9e720&imgtype=0&src=http%3A%2F%2Fimg004.hc360.cn%2Fm8%2FM04%2FDE%2FDE%2FwKhQplZ-QteEBvsbAAAAADUkobU751.jpg" mode="aspectFill"></image>
  79. <image @click="navTo('/pages/product/product')" src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1553105231218&di=09534b9833b5243296630e6d5b728eff&imgtype=0&src=http%3A%2F%2Fimg002.hc360.cn%2Fm1%2FM05%2FD1%2FAC%2FwKhQcFQ3iN2EQTo8AAAAAHQU6_8355.jpg" mode="aspectFill"></image>
  80. <image @click="navTo('/pages/product/product')" src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1553105320890&di=c743386be51f2c4c0fd4b75754d14f3c&imgtype=0&src=http%3A%2F%2Fimg007.hc360.cn%2Fhb%2FMTQ1OTg4ODY0MDA3Ny05OTQ4ODY1NDQ%3D.jpg" mode="aspectFill"></image>
  81. <image @click="navTo('/pages/product/product')" src="https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2691146630,2165926318&fm=26&gp=0.jpg" mode="aspectFill"></image>
  82. <image @click="navTo('/pages/product/product')" src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1553105443324&di=8141bf13f3f208c61524d67f9bb83942&imgtype=0&src=http%3A%2F%2Fimg.zcool.cn%2Fcommunity%2F01ac9a5548d29b0000019ae98e6d98.jpg" mode="aspectFill"></image>
  83. <image @click="navTo('/pages/product/product')" src="https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=191678693,2701202375&fm=26&gp=0.jpg" mode="aspectFill"></image>
  84. </scroll-view> -->
  85. <!-- <list-cell icon="icon-iconfontweixin" iconColor="#e07472" title="我的钱包" tips="您的会员还有3天过期"></list-cell> -->
  86. <!-- <list-cell icon="icon-dizhi" iconColor="#5fcda2" title="地址管理" @eventClick="$api.navTo('/pages/address/address')"></list-cell> -->
  87. <!-- <list-cell icon="icon-share" iconColor="#9789f7" title="分享" tips="邀请好友赢10万大礼"></list-cell> -->
  88. <!-- <list-cell icon="icon-pinglun-copy" iconColor="#ee883b" title="晒单" tips="晒单抢红包"></list-cell> -->
  89. <list-cell icon="icon-shoucang-setting" iconColor="#54b4ef" title="My Collection" @eventClick="$api.navTo('/pages/favorite/favorite')"></list-cell>
  90. <list-cell icon="icon-setting" iconColor="#e07472" title="Setting" border="" @eventClick="$api.navTo('/pages/set/set')"></list-cell>
  91. </view>
  92. </view>
  93. </view>
  94. </template>
  95. <script>
  96. import listCell from '@/components/mix-list-cell';
  97. import {
  98. mapState
  99. } from 'vuex';
  100. let startY = 0, moveY = 0, pageAtTop = true;
  101. export default {
  102. components: {
  103. listCell
  104. },
  105. data() {
  106. return {
  107. coverTransform: 'translateY(0px)',
  108. coverTransition: '0s',
  109. moving: false,
  110. orderNum: {
  111. unpaid: 0,
  112. undelivered: 0,
  113. unreceived: 0,
  114. uncomment: 0,
  115. refund: 0
  116. }
  117. }
  118. },
  119. onLoad(){
  120. },
  121. onShow() {
  122. this.$api.checkLogin();
  123. if (this.hasLogin) {
  124. this.getOrderNum();
  125. }
  126. },
  127. // #ifndef MP
  128. onNavigationBarButtonTap(e) {
  129. const index = e.index;
  130. if (index === 0) {
  131. this.navTo('/pages/set/set');
  132. }else if(index === 1){
  133. // #ifdef APP-PLUS
  134. const pages = getCurrentPages();
  135. const page = pages[pages.length - 1];
  136. const currentWebview = page.$getAppWebview();
  137. currentWebview.hideTitleNViewButtonRedDot({
  138. index
  139. });
  140. // #endif
  141. uni.navigateTo({
  142. url: '/pages/notice/notice'
  143. })
  144. }
  145. },
  146. // #endif
  147. computed: {
  148. ...mapState(['hasLogin','userInfo'])
  149. },
  150. methods: {
  151. /**
  152. * 会员卡下拉和回弹
  153. * 1.关闭bounce避免ios端下拉冲突
  154. * 2.由于touchmove事件的缺陷(以前做小程序就遇到,比如20跳到40,h5反而好很多),下拉的时候会有掉帧的感觉
  155. * transition设置0.1秒延迟,让css来过渡这段空窗期
  156. * 3.回弹效果可修改曲线值来调整效果,推荐一个好用的bezier生成工具 http://cubic-bezier.com/
  157. */
  158. coverTouchstart(e){
  159. if(pageAtTop === false){
  160. return;
  161. }
  162. this.coverTransition = 'transform .1s linear';
  163. startY = e.touches[0].clientY;
  164. },
  165. coverTouchmove(e){
  166. moveY = e.touches[0].clientY;
  167. let moveDistance = moveY - startY;
  168. if(moveDistance < 0){
  169. this.moving = false;
  170. return;
  171. }
  172. this.moving = true;
  173. if(moveDistance >= 80 && moveDistance < 100){
  174. moveDistance = 80;
  175. }
  176. if(moveDistance > 0 && moveDistance <= 80){
  177. this.coverTransform = `translateY(${moveDistance}px)`;
  178. }
  179. },
  180. coverTouchend(){
  181. if(this.moving === false){
  182. return;
  183. }
  184. this.moving = false;
  185. this.coverTransition = 'transform 0.3s cubic-bezier(.21,1.93,.53,.64)';
  186. this.coverTransform = 'translateY(0px)';
  187. },
  188. // 获取订单数量
  189. async getOrderNum(){
  190. let data = await this.$api.request('/order/count');
  191. if (data) {
  192. this.orderNum = {
  193. unpaid: data.unpaid ? data.unpaid : 0,
  194. undelivered: data.undelivered ? data.undelivered : 0,
  195. unreceived: data.unreceived ? data.unreceived : 0,
  196. uncomment: data.uncomment ? data.uncomment : 0,
  197. refund: data.refund ? data.refund : 0
  198. };
  199. }
  200. }
  201. }
  202. }
  203. </script>
  204. <style lang='scss'>
  205. page{
  206. background: #f5f5f5;
  207. }
  208. %flex-center {
  209. display:flex;
  210. flex-direction: column;
  211. justify-content: center;
  212. align-items: center;
  213. }
  214. %section {
  215. display:flex;
  216. justify-content: space-around;
  217. align-content: center;
  218. background: #fff;
  219. border-radius: 10upx;
  220. }
  221. .user-section{
  222. height: 520upx;
  223. padding: 100upx 30upx 0;
  224. position:relative;
  225. .bg{
  226. position:absolute;
  227. left: 0;
  228. top: 0;
  229. width: 100%;
  230. height: 100%;
  231. filter: blur(1px);
  232. opacity: .7;
  233. }
  234. }
  235. .user-info-box{
  236. height: 180upx;
  237. display:flex;
  238. align-items:center;
  239. position:relative;
  240. z-index: 1;
  241. .portrait{
  242. width: 130upx;
  243. height: 130upx;
  244. border-radius: 50%;
  245. }
  246. .username{
  247. font-size: $font-lg + 6upx;
  248. color: $font-color-dark;
  249. margin-left: 20upx;
  250. }
  251. }
  252. .vip-card-box{
  253. display:flex;
  254. flex-direction: column;
  255. color: #f7d680;
  256. height: 240upx;
  257. background: linear-gradient(left, rgba(0,0,0,.7), rgba(0,0,0,.8));
  258. border-radius: 16upx 16upx 0 0;
  259. overflow: hidden;
  260. position: relative;
  261. padding: 20upx 24upx;
  262. .card-bg{
  263. position:absolute;
  264. top: 20upx;
  265. right: 0;
  266. width: 380upx;
  267. height: 260upx;
  268. }
  269. .b-btn{
  270. position: absolute;
  271. right: 20upx;
  272. top: 16upx;
  273. width: 132upx;
  274. height: 40upx;
  275. text-align: center;
  276. line-height: 40upx;
  277. font-size: 22upx;
  278. color: #36343c;
  279. border-radius: 20px;
  280. background: linear-gradient(left, #f9e6af, #ffd465);
  281. z-index: 1;
  282. }
  283. .tit{
  284. font-size: $font-base+2upx;
  285. color: #f7d680;
  286. margin-bottom: 28upx;
  287. .yticon{
  288. color: #f6e5a3;
  289. margin-right: 16upx;
  290. }
  291. }
  292. .e-b{
  293. font-size: $font-sm;
  294. color: #d8cba9;
  295. margin-top: 10upx;
  296. }
  297. }
  298. .cover-container{
  299. margin-top: -150upx;
  300. padding: 0 30upx;
  301. position:relative;
  302. background: #f5f5f5;
  303. padding-bottom: 20upx;
  304. .arc{
  305. position:absolute;
  306. left: 0;
  307. top: -34upx;
  308. width: 100%;
  309. height: 36upx;
  310. }
  311. }
  312. .tj-sction{
  313. @extend %section;
  314. .tj-item{
  315. @extend %flex-center;
  316. flex-direction: column;
  317. height: 140upx;
  318. font-size: $font-sm;
  319. color: #75787d;
  320. }
  321. .num{
  322. font-size: $font-lg;
  323. color: $font-color-dark;
  324. margin-bottom: 8upx;
  325. }
  326. }
  327. .order-header {
  328. @extend %section;
  329. padding: 28upx 0 0;
  330. border-radius: 10upx 10upx 0 0;
  331. margin-top: 20upx;
  332. font-size: $font-base;
  333. .title {
  334. width: 50%;
  335. color: $font-color-dark;
  336. margin-left: 30upx;
  337. }
  338. .item {
  339. width: 50%;
  340. color:$font-color-base;
  341. text-align: right;
  342. margin-right: 8upx;
  343. }
  344. }
  345. .order-section{
  346. @extend %section;
  347. border-radius: 0 0 10upx 10upx;
  348. padding: 28upx 0;
  349. .order-item {
  350. @extend %flex-center;
  351. width: 120upx;
  352. height: 120upx;
  353. border-radius: 10upx;
  354. font-size: $font-sm;
  355. color: $font-color-dark;
  356. position: relative;
  357. .num{
  358. border: 4rpx solid #fa436a;
  359. width: 40rpx;
  360. height: 40rpx;
  361. color: #fa436a;
  362. text-align: center;
  363. border-radius: 40rpx;
  364. position: absolute;
  365. background: #ffffff;
  366. top: 0;
  367. right: 18rpx;
  368. }
  369. }
  370. .yticon{
  371. font-size: 48upx;
  372. margin-bottom: 18upx;
  373. color: #fa436a;
  374. }
  375. .icon-shouhoutuikuan{
  376. font-size:44upx;
  377. }
  378. }
  379. .history-section{
  380. padding: 0;
  381. margin-top: 20upx;
  382. background: #fff;
  383. border-radius:10upx;
  384. .sec-header{
  385. display:flex;
  386. align-items: center;
  387. font-size: $font-base;
  388. color: $font-color-dark;
  389. line-height: 40upx;
  390. margin-left: 30upx;
  391. .yticon{
  392. font-size: 44upx;
  393. color: #5eba8f;
  394. margin-right: 16upx;
  395. line-height: 40upx;
  396. }
  397. }
  398. .h-list{
  399. white-space: nowrap;
  400. padding: 30upx 30upx 0;
  401. image{
  402. display:inline-block;
  403. width: 160upx;
  404. height: 160upx;
  405. margin-right: 20upx;
  406. border-radius: 10upx;
  407. }
  408. }
  409. }
  410. </style>