You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

419 lines
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 || '游客'}}</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. 喂喂会员
  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">我的订单</view>
  40. <view class="item" @click="$api.navTo('/pages/order/order?state=0')" >查看全部订单
  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>待付款</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>待发货</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>待收货</text>
  59. </view>
  60. <view class="order-item" @click="$api.navTo('/pages/order/order?state=4')" 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>评价</text>
  64. </view>
  65. <view class="order-item" @click="$api.navTo('/pages/order/order?state=5')" 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>退款/售后</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="我的收藏" @eventClick="$api.navTo('/pages/favorite/favorite')"></list-cell>
  90. <list-cell icon="icon-setting" iconColor="#e07472" title="设置" 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. if (this.hasLogin) {
  123. this.getOrderNum();
  124. }
  125. },
  126. // #ifndef MP
  127. onNavigationBarButtonTap(e) {
  128. const index = e.index;
  129. if (index === 0) {
  130. this.navTo('/pages/set/set');
  131. }else if(index === 1){
  132. // #ifdef APP-PLUS
  133. const pages = getCurrentPages();
  134. const page = pages[pages.length - 1];
  135. const currentWebview = page.$getAppWebview();
  136. currentWebview.hideTitleNViewButtonRedDot({
  137. index
  138. });
  139. // #endif
  140. uni.navigateTo({
  141. url: '/pages/notice/notice'
  142. })
  143. }
  144. },
  145. // #endif
  146. computed: {
  147. ...mapState(['hasLogin','userInfo'])
  148. },
  149. methods: {
  150. /**
  151. * 会员卡下拉和回弹
  152. * 1.关闭bounce避免ios端下拉冲突
  153. * 2.由于touchmove事件的缺陷(以前做小程序就遇到,比如20跳到40,h5反而好很多),下拉的时候会有掉帧的感觉
  154. * transition设置0.1秒延迟,让css来过渡这段空窗期
  155. * 3.回弹效果可修改曲线值来调整效果,推荐一个好用的bezier生成工具 http://cubic-bezier.com/
  156. */
  157. coverTouchstart(e){
  158. if(pageAtTop === false){
  159. return;
  160. }
  161. this.coverTransition = 'transform .1s linear';
  162. startY = e.touches[0].clientY;
  163. },
  164. coverTouchmove(e){
  165. moveY = e.touches[0].clientY;
  166. let moveDistance = moveY - startY;
  167. if(moveDistance < 0){
  168. this.moving = false;
  169. return;
  170. }
  171. this.moving = true;
  172. if(moveDistance >= 80 && moveDistance < 100){
  173. moveDistance = 80;
  174. }
  175. if(moveDistance > 0 && moveDistance <= 80){
  176. this.coverTransform = `translateY(${moveDistance}px)`;
  177. }
  178. },
  179. coverTouchend(){
  180. if(this.moving === false){
  181. return;
  182. }
  183. this.moving = false;
  184. this.coverTransition = 'transform 0.3s cubic-bezier(.21,1.93,.53,.64)';
  185. this.coverTransform = 'translateY(0px)';
  186. },
  187. // 获取订单数量
  188. async getOrderNum(){
  189. let data = await this.$api.request('/order/count');
  190. if (data) {
  191. this.orderNum = {
  192. unpaid: data.unpaid ? data.unpaid : 0,
  193. undelivered: data.undelivered ? data.undelivered : 0,
  194. unreceived: data.unreceived ? data.unreceived : 0,
  195. uncomment: data.uncomment ? data.uncomment : 0,
  196. refund: data.refund ? data.refund : 0
  197. };
  198. }
  199. }
  200. }
  201. }
  202. </script>
  203. <style lang='scss'>
  204. page{
  205. background: #f5f5f5;
  206. }
  207. %flex-center {
  208. display:flex;
  209. flex-direction: column;
  210. justify-content: center;
  211. align-items: center;
  212. }
  213. %section {
  214. display:flex;
  215. justify-content: space-around;
  216. align-content: center;
  217. background: #fff;
  218. border-radius: 10upx;
  219. }
  220. .user-section{
  221. height: 520upx;
  222. padding: 100upx 30upx 0;
  223. position:relative;
  224. .bg{
  225. position:absolute;
  226. left: 0;
  227. top: 0;
  228. width: 100%;
  229. height: 100%;
  230. filter: blur(1px);
  231. opacity: .7;
  232. }
  233. }
  234. .user-info-box{
  235. height: 180upx;
  236. display:flex;
  237. align-items:center;
  238. position:relative;
  239. z-index: 1;
  240. .portrait{
  241. width: 130upx;
  242. height: 130upx;
  243. border-radius: 50%;
  244. }
  245. .username{
  246. font-size: $font-lg + 6upx;
  247. color: $font-color-dark;
  248. margin-left: 20upx;
  249. }
  250. }
  251. .vip-card-box{
  252. display:flex;
  253. flex-direction: column;
  254. color: #f7d680;
  255. height: 240upx;
  256. background: linear-gradient(left, rgba(0,0,0,.7), rgba(0,0,0,.8));
  257. border-radius: 16upx 16upx 0 0;
  258. overflow: hidden;
  259. position: relative;
  260. padding: 20upx 24upx;
  261. .card-bg{
  262. position:absolute;
  263. top: 20upx;
  264. right: 0;
  265. width: 380upx;
  266. height: 260upx;
  267. }
  268. .b-btn{
  269. position: absolute;
  270. right: 20upx;
  271. top: 16upx;
  272. width: 132upx;
  273. height: 40upx;
  274. text-align: center;
  275. line-height: 40upx;
  276. font-size: 22upx;
  277. color: #36343c;
  278. border-radius: 20px;
  279. background: linear-gradient(left, #f9e6af, #ffd465);
  280. z-index: 1;
  281. }
  282. .tit{
  283. font-size: $font-base+2upx;
  284. color: #f7d680;
  285. margin-bottom: 28upx;
  286. .yticon{
  287. color: #f6e5a3;
  288. margin-right: 16upx;
  289. }
  290. }
  291. .e-b{
  292. font-size: $font-sm;
  293. color: #d8cba9;
  294. margin-top: 10upx;
  295. }
  296. }
  297. .cover-container{
  298. margin-top: -150upx;
  299. padding: 0 30upx;
  300. position:relative;
  301. background: #f5f5f5;
  302. padding-bottom: 20upx;
  303. .arc{
  304. position:absolute;
  305. left: 0;
  306. top: -34upx;
  307. width: 100%;
  308. height: 36upx;
  309. }
  310. }
  311. .tj-sction{
  312. @extend %section;
  313. .tj-item{
  314. @extend %flex-center;
  315. flex-direction: column;
  316. height: 140upx;
  317. font-size: $font-sm;
  318. color: #75787d;
  319. }
  320. .num{
  321. font-size: $font-lg;
  322. color: $font-color-dark;
  323. margin-bottom: 8upx;
  324. }
  325. }
  326. .order-header {
  327. @extend %section;
  328. padding: 28upx 0 0;
  329. border-radius: 10upx 10upx 0 0;
  330. margin-top: 20upx;
  331. font-size: $font-base;
  332. .title {
  333. width: 50%;
  334. color: $font-color-dark;
  335. margin-left: 30upx;
  336. }
  337. .item {
  338. width: 50%;
  339. color:$font-color-base;
  340. text-align: right;
  341. margin-right: 8upx;
  342. }
  343. }
  344. .order-section{
  345. @extend %section;
  346. border-radius: 0 0 10upx 10upx;
  347. padding: 28upx 0;
  348. .order-item {
  349. @extend %flex-center;
  350. width: 120upx;
  351. height: 120upx;
  352. border-radius: 10upx;
  353. font-size: $font-sm;
  354. color: $font-color-dark;
  355. position: relative;
  356. .num{
  357. border: 4rpx solid #fa436a;
  358. width: 40rpx;
  359. height: 40rpx;
  360. color: #fa436a;
  361. text-align: center;
  362. border-radius: 40rpx;
  363. position: absolute;
  364. background: #ffffff;
  365. top: 0;
  366. right: 18rpx;
  367. }
  368. }
  369. .yticon{
  370. font-size: 48upx;
  371. margin-bottom: 18upx;
  372. color: #fa436a;
  373. }
  374. .icon-shouhoutuikuan{
  375. font-size:44upx;
  376. }
  377. }
  378. .history-section{
  379. padding: 0;
  380. margin-top: 20upx;
  381. background: #fff;
  382. border-radius:10upx;
  383. .sec-header{
  384. display:flex;
  385. align-items: center;
  386. font-size: $font-base;
  387. color: $font-color-dark;
  388. line-height: 40upx;
  389. margin-left: 30upx;
  390. .yticon{
  391. font-size: 44upx;
  392. color: #5eba8f;
  393. margin-right: 16upx;
  394. line-height: 40upx;
  395. }
  396. }
  397. .h-list{
  398. white-space: nowrap;
  399. padding: 30upx 30upx 0;
  400. image{
  401. display:inline-block;
  402. width: 160upx;
  403. height: 160upx;
  404. margin-right: 20upx;
  405. border-radius: 10upx;
  406. }
  407. }
  408. }
  409. </style>