my.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. <template>
  2. <view class="zaiui-my-box" :class="show?'show':''">
  3. <view class="bg-gradual-red zaiui-head-box">
  4. <!--标题栏-->
  5. <!--小程序端不显示-->
  6. <!-- #ifndef MP -->
  7. <bar-title :isBack="false" :fixed="false">
  8. <!-- <block slot="right">
  9. <text class="cuIcon-camera"/>
  10. <text class="cuIcon-settings" @tap="setupTap"/>
  11. </block> -->
  12. </bar-title>
  13. <!-- #endif -->
  14. <!--用户信息-->
  15. <view class="zaiui-user-info-box">
  16. <!--未登陆-->
  17. <view class="login-user-view" v-if="isLogin">
  18. <view class="login-user-avatar-view">
  19. <view class="cu-avatar round lg" style="background-image:url(/static/images/avatar/1.jpg);"/>
  20. </view>
  21. <button class="cu-btn sm radius" @tap="loginUrlTap">立即登录</button>
  22. </view>
  23. <!--已登陆-->
  24. <view class="cu-list menu-avatar" v-else>
  25. <view class="cu-item">
  26. <view class="cu-avatar round lg" :style="`background-image:url(${user.avatar});`"/>
  27. <view class="content text-xl">
  28. <view class="text-white">
  29. <text class="margin-right">{{user.name}}</text>
  30. <!-- <text class="text-sm" @tap="loginTap">切换未登陆页面</text> -->
  31. </view>
  32. <!-- <view class="text-white-bg text-sm">
  33. <text class="text-border-x">关注 2</text>
  34. <text>粉丝 9</text>
  35. </view> -->
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <!--用户数据-->
  41. <view class="zaiui-user-info-num-box">
  42. <view class="cu-list grid col-4 no-border" style="justify-content: space-around;">
  43. <view class="cu-item" @tap="cartTap">
  44. <view class="text-xl" v-if="isLogin">-</view>
  45. <view class="text-xl" v-else>{{user.cash}}</view>
  46. <text class="text-sm">钱包</text>
  47. </view>
  48. <view class="cu-item" @tap="footmarkTap">
  49. <view class="text-xl" v-if="isLogin">-</view>
  50. <view class="text-xl" v-else>{{user.score_cash}}</view>
  51. <text class="text-sm">积分</text>
  52. </view>
  53. </view>
  54. </view>
  55. <!--用户提示-->
  56. <!-- <view class="text-sm zaiui-user-info-tip-box" v-if="!login" @tap="realNameTap">
  57. <view class="text-cut">偷偷告诉你,实名认证后宝贝更易卖出哦~</view>
  58. <text class="cuIcon-right icon"/>
  59. </view> -->
  60. </view>
  61. <view class="zaiui-view-content">
  62. <!--用户数据-->
  63. <view class="padding-xs bg-white zaiui-user-info-order-box">
  64. <view class="text-black text-lg text-bold padding-sm">我的交易</view>
  65. <view class="cu-list grid col-4 no-border">
  66. <view class="cu-item" v-for="item in orderInfo" :key="item.name" @click="order_list_tap(item)">
  67. <view class="text-xxl text-red" v-if="isLogin">
  68. <text class="cuIcon-presentfill"></text>
  69. </view>
  70. <view class="text-xxl text-black" v-else>{{item.num}}</view>
  71. <text class="text-sm">{{item.name}}</text>
  72. </view>
  73. </view>
  74. </view>
  75. <!--天天有钱-->
  76. <!-- <view class="padding-xs bg-white margin-top zaiui-user-info-money-box">
  77. <view class="text-black text-lg text-bold padding-sm">天天有钱</view>
  78. <view class="grid col-2 money-col">
  79. <view class="money-item">
  80. <view class="money-item-view">
  81. <view class="cu-avatar lg" style="background-image:url(/static/images/my/1.png);"/>
  82. <view class="money-content">
  83. <view class="text-black text-cut">边逛边赚钱</view>
  84. <view class="text-gray text-sm text-cut">最高提现20元</view>
  85. </view>
  86. </view>
  87. </view>
  88. <view class="money-item">
  89. <view class="money-item-view">
  90. <view class="cu-avatar lg" style="background-image:url(/static/images/my/2.png);"/>
  91. <view class="money-content">
  92. <view class="text-black text-cut">发条借钱</view>
  93. <view class="text-gray text-sm text-cut">最高额度50000</view>
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. -->
  100. <!--推荐工具-->
  101. <view class="padding-xs bg-white margin-top zaiui-user-info-tools-box">
  102. <view class="padding-sm tools-view">
  103. <view class="text-black text-bold text-lg tools-title">工具</view>
  104. <!-- <view class="text-gray text-sm tools-right">
  105. <text>更多</text>
  106. <text class="cuIcon-right"/>
  107. </view> -->
  108. </view>
  109. <view class="zaiui-tools-list-box">
  110. <view class="cu-list grid col-4 no-border">
  111. <block v-for="(item,index) in toolsList" :key="index">
  112. <view class="cu-item" v-if="index < 12" @click="gridTap(item)">
  113. <view class="text-black" :class="['cuIcon-' + item.icon]"/>
  114. <text>{{item.name}}</text>
  115. </view>
  116. </block>
  117. </view>
  118. </view>
  119. </view>
  120. </view>
  121. <!--占位底部距离-->
  122. <view class="cu-tabbar-height"></view>
  123. </view>
  124. </template>
  125. <script>
  126. import barTitle from '@/components/zaiui-common/basics/bar-title';
  127. import _my_data from '@/static/zaiui/data/my.js'; //虚拟数据
  128. import _tool from '@/static/zaiui/util/tools.js'; //工具函数
  129. export default {
  130. name: 'my',
  131. components: {
  132. barTitle
  133. },
  134. data() {
  135. return {
  136. toolsList: [{
  137. id: 1,
  138. icon: 'service',
  139. name: '会员',
  140. path: '/pages/my/vip'
  141. },{
  142. id: 2,
  143. icon: 'squarecheck',
  144. name: '代理',
  145. path: '/pages/my/agent'
  146. },{
  147. id: 3,
  148. icon: 'friend',
  149. name: '收藏'
  150. },{
  151. id: 4,
  152. icon: 'moneybag',
  153. name: '评价'
  154. },{
  155. id: 5,
  156. icon: 'read',
  157. name: '下载'
  158. },{
  159. id: 6,
  160. icon: 'settings',
  161. name: '设置',
  162. path: '/pages/my/personal-data'
  163. }],
  164. isLogin: false,
  165. user: {},
  166. orderInfo: []
  167. }
  168. },
  169. props: {
  170. show: {
  171. type: Boolean,
  172. default: true
  173. },
  174. scrollY: {
  175. type: Number,
  176. default: 0
  177. },
  178. scrollBottom: {
  179. type: Number,
  180. default: 0
  181. }
  182. },
  183. watch: {
  184. scrollY() {
  185. //通知他妈的滚动了。
  186. this.setPageScroll(this.scrollY);
  187. },
  188. scrollBottom() {
  189. if(this.scrollBottom != 0) {
  190. //通知他妈的触底了
  191. this.setReachBottom();
  192. }
  193. },
  194. },
  195. created() {
  196. //加载虚拟数据
  197. // this.toolsList = _my_data.toolsListData();
  198. this.loadUserInfo().then(res => {
  199. this.orderInfo = res.order;
  200. })
  201. },
  202. mounted() {
  203. _tool.setBarColor(false);
  204. uni.pageScrollTo({
  205. scrollTop: 0,
  206. duration: 0
  207. });
  208. },
  209. methods: {
  210. //页面被滚动
  211. setPageScroll(scrollTop) {
  212. //console.log(scrollTop);
  213. },
  214. //触底了
  215. setReachBottom() {
  216. console.log('触底了');
  217. },
  218. //购物车
  219. cartTap() {
  220. uni.navigateTo({
  221. url: "/pages/goods/my_cart"
  222. });
  223. },
  224. //足迹
  225. footmarkTap() {
  226. uni.navigateTo({
  227. url: "/pages/my/footmark"
  228. });
  229. },
  230. //我买到的
  231. order_list_tap(item) {
  232. uni.navigateTo({
  233. url: "/pages/order/list?type="+item.status
  234. });
  235. },
  236. loginUrlTap() {
  237. uni.navigateTo({
  238. url: "/pages/login/login"
  239. });
  240. },
  241. loginTap() {
  242. if(this.isLogin) {
  243. this.isLogin = false;
  244. } else {
  245. this.isLogin = true;
  246. }
  247. },
  248. realNameTap() {
  249. uni.navigateTo({
  250. url: "/pages/real_name/index"
  251. });
  252. },
  253. setupTap() {
  254. uni.navigateTo({
  255. url: "/pages/my/set-up"
  256. });
  257. },
  258. gridTap(item) {
  259. uni.navigateTo({
  260. url: item.path
  261. });
  262. },
  263. sponsoredTap() {
  264. uni.navigateTo({
  265. url: "/pages/my/sponsored"
  266. });
  267. },
  268. }
  269. }
  270. </script>
  271. <style lang="scss" scoped>
  272. .zaiui-my-box {
  273. width: 100%;
  274. display: none;
  275. .zaiui-head-box {
  276. padding-top: 0;
  277. padding-bottom: 72.72upx;
  278. .zaiui-user-info-box {
  279. /* #ifdef MP */
  280. padding-top: calc(var(--status-bar-height) + 50upx);
  281. /* #endif */
  282. .login-user-view {
  283. position: relative;
  284. text-align: center;
  285. .login-user-avatar-view {
  286. position: relative;
  287. margin-bottom: 18.18upx;
  288. }
  289. }
  290. .cu-list.menu-avatar>.cu-item {
  291. background-color: inherit;
  292. .content {
  293. width: calc(100% - 94.54upx - 59.99upx - 20upx);
  294. .text-white-bg {
  295. color: #e8e8e8;
  296. .text-border-x {
  297. margin-right: 25.45upx;
  298. position: relative;
  299. &:after {
  300. position: absolute;
  301. background: #dddddd;
  302. top: 5.45upx;
  303. width: 1.81upx;
  304. right: -12.72upx;
  305. height: 16.36upx;
  306. content: " ";
  307. }
  308. }
  309. }
  310. }
  311. &:after {
  312. width: 0;
  313. height: 0;
  314. border-bottom: 0;
  315. }
  316. }
  317. .cu-list.menu-avatar>.cu-item .content>view:first-child {
  318. font-size: 34.54upx;
  319. }
  320. }
  321. .zaiui-user-info-num-box {
  322. .cu-list.grid.no-border {
  323. padding: 0;
  324. }
  325. .cu-list.grid.no-border>.cu-item {
  326. padding-top: 27.27upx;
  327. padding-bottom: 9.09upx;
  328. }
  329. .cu-list.grid {
  330. background-color: inherit;
  331. }
  332. .cu-list.grid>.cu-item text {
  333. color: #e8e8e8;
  334. font-size: 20upx;
  335. line-height: 27.27upx;
  336. }
  337. }
  338. .zaiui-user-info-tip-box {
  339. position: relative;
  340. margin: 18.18upx 27.27upx;
  341. border-radius: 9.09upx;
  342. padding: 18.18upx 27.27upx;
  343. background: #ea8d8d;
  344. background-image: linear-gradient(45deg, #f7615f, #f553b3);
  345. .text-cut {
  346. padding-right: 45.45upx;
  347. }
  348. .icon {
  349. position: absolute;
  350. right: 27.27upx;
  351. top: 23.63upx;
  352. }
  353. }
  354. }
  355. .zaiui-view-content {
  356. padding: 0 27.27upx 54.54upx;
  357. margin-top: -63.63upx;
  358. .zaiui-user-info-order-box {
  359. border-radius: 18.18upx;
  360. .cu-list.grid.no-border {
  361. padding: 0;
  362. }
  363. .cu-list.grid.no-border>.cu-item {
  364. padding-bottom: 9.09upx;
  365. }
  366. }
  367. .cu-list.grid>.cu-item text {
  368. color: inherit;
  369. }
  370. .zaiui-user-info-money-box {
  371. border-radius: 18.18upx;
  372. .money-col {
  373. padding: 0 9.09upx 9.09upx;
  374. .money-item {
  375. position: relative;
  376. padding: 9.09upx;
  377. .money-item-view {
  378. border: 1.81upx solid #f3f2f3;
  379. border-radius: 18.18upx;
  380. position: relative;
  381. padding: 9.09upx;
  382. .cu-avatar {
  383. position: absolute;
  384. left: 9.09upx;
  385. }
  386. .money-content {
  387. position: relative;
  388. margin-left: 109.09upx;
  389. margin-bottom: 27.27upx;
  390. top: 12.72upx;
  391. }
  392. }
  393. }
  394. }
  395. }
  396. .zaiui-user-info-tools-box {
  397. border-radius: 18.18upx;
  398. .tools-view {
  399. position: relative;
  400. .tools-title {
  401. padding-right: 81.81upx;
  402. }
  403. .tools-right {
  404. position: absolute;
  405. right: 9.09upx;
  406. bottom: 23.63upx;
  407. }
  408. }
  409. }
  410. }
  411. }
  412. .zaiui-my-box.show {
  413. display: block;
  414. }
  415. </style>