my.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  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 _tool from '@/static/zaiui/util/tools.js'; //工具函数
  128. export default {
  129. name: 'my',
  130. components: {
  131. barTitle
  132. },
  133. data() {
  134. return {
  135. toolsList: [{
  136. id: 1,
  137. icon: 'service',
  138. name: '会员',
  139. path: '/pages/my/vip'
  140. },{
  141. id: 2,
  142. icon: 'squarecheck',
  143. name: '代理',
  144. path: '/pages/my/agent'
  145. },{
  146. id: 3,
  147. icon: 'friend',
  148. name: '收藏'
  149. },{
  150. id: 4,
  151. icon: 'moneybag',
  152. name: '评价'
  153. },{
  154. id: 5,
  155. icon: 'read',
  156. name: '下载'
  157. },{
  158. id: 6,
  159. icon: 'settings',
  160. name: '设置',
  161. path: '/pages/my/personal-data'
  162. }],
  163. isLogin: false,
  164. user: {},
  165. orderInfo: []
  166. }
  167. },
  168. props: {
  169. show: {
  170. type: Boolean,
  171. default: true
  172. },
  173. scrollY: {
  174. type: Number,
  175. default: 0
  176. },
  177. scrollBottom: {
  178. type: Number,
  179. default: 0
  180. }
  181. },
  182. watch: {
  183. scrollY() {
  184. //通知他妈的滚动了。
  185. this.setPageScroll(this.scrollY);
  186. },
  187. scrollBottom() {
  188. if(this.scrollBottom != 0) {
  189. //通知他妈的触底了
  190. this.setReachBottom();
  191. }
  192. },
  193. },
  194. created() {
  195. this.loadUserInfo().then(res => {
  196. this.orderInfo = res.order;
  197. })
  198. },
  199. mounted() {
  200. _tool.setBarColor(false);
  201. uni.pageScrollTo({
  202. scrollTop: 0,
  203. duration: 0
  204. });
  205. },
  206. methods: {
  207. //页面被滚动
  208. setPageScroll(scrollTop) {
  209. //console.log(scrollTop);
  210. },
  211. //触底了
  212. setReachBottom() {
  213. console.log('触底了');
  214. },
  215. //购物车
  216. cartTap() {
  217. uni.navigateTo({
  218. url: "/pages/goods/my_cart"
  219. });
  220. },
  221. //足迹
  222. footmarkTap() {
  223. uni.navigateTo({
  224. url: "/pages/my/footmark"
  225. });
  226. },
  227. //我买到的
  228. order_list_tap(item) {
  229. uni.navigateTo({
  230. url: "/pages/order/list?type="+item.status
  231. });
  232. },
  233. loginUrlTap() {
  234. uni.navigateTo({
  235. url: "/pages/login/login"
  236. });
  237. },
  238. loginTap() {
  239. if(this.isLogin) {
  240. this.isLogin = false;
  241. } else {
  242. this.isLogin = true;
  243. }
  244. },
  245. realNameTap() {
  246. uni.navigateTo({
  247. url: "/pages/real_name/index"
  248. });
  249. },
  250. setupTap() {
  251. uni.navigateTo({
  252. url: "/pages/my/set-up"
  253. });
  254. },
  255. gridTap(item) {
  256. uni.navigateTo({
  257. url: item.path
  258. });
  259. },
  260. sponsoredTap() {
  261. uni.navigateTo({
  262. url: "/pages/my/sponsored"
  263. });
  264. },
  265. },
  266. watch: {
  267. show(newValue) {
  268. if(newValue && !this.user.id) {
  269. this.loadUserInfo()
  270. }
  271. }
  272. }
  273. }
  274. </script>
  275. <style lang="scss" scoped>
  276. .zaiui-my-box {
  277. width: 100%;
  278. display: none;
  279. .zaiui-head-box {
  280. padding-top: 0;
  281. padding-bottom: 72.72upx;
  282. .zaiui-user-info-box {
  283. /* #ifdef MP */
  284. padding-top: calc(var(--status-bar-height) + 50upx);
  285. /* #endif */
  286. .login-user-view {
  287. position: relative;
  288. text-align: center;
  289. .login-user-avatar-view {
  290. position: relative;
  291. margin-bottom: 18.18upx;
  292. }
  293. }
  294. .cu-list.menu-avatar>.cu-item {
  295. background-color: inherit;
  296. .content {
  297. width: calc(100% - 94.54upx - 59.99upx - 20upx);
  298. .text-white-bg {
  299. color: #e8e8e8;
  300. .text-border-x {
  301. margin-right: 25.45upx;
  302. position: relative;
  303. &:after {
  304. position: absolute;
  305. background: #dddddd;
  306. top: 5.45upx;
  307. width: 1.81upx;
  308. right: -12.72upx;
  309. height: 16.36upx;
  310. content: " ";
  311. }
  312. }
  313. }
  314. }
  315. &:after {
  316. width: 0;
  317. height: 0;
  318. border-bottom: 0;
  319. }
  320. }
  321. .cu-list.menu-avatar>.cu-item .content>view:first-child {
  322. font-size: 34.54upx;
  323. }
  324. }
  325. .zaiui-user-info-num-box {
  326. .cu-list.grid.no-border {
  327. padding: 0;
  328. }
  329. .cu-list.grid.no-border>.cu-item {
  330. padding-top: 27.27upx;
  331. padding-bottom: 9.09upx;
  332. }
  333. .cu-list.grid {
  334. background-color: inherit;
  335. }
  336. .cu-list.grid>.cu-item text {
  337. color: #e8e8e8;
  338. font-size: 20upx;
  339. line-height: 27.27upx;
  340. }
  341. }
  342. .zaiui-user-info-tip-box {
  343. position: relative;
  344. margin: 18.18upx 27.27upx;
  345. border-radius: 9.09upx;
  346. padding: 18.18upx 27.27upx;
  347. background: #ea8d8d;
  348. background-image: linear-gradient(45deg, #f7615f, #f553b3);
  349. .text-cut {
  350. padding-right: 45.45upx;
  351. }
  352. .icon {
  353. position: absolute;
  354. right: 27.27upx;
  355. top: 23.63upx;
  356. }
  357. }
  358. }
  359. .zaiui-view-content {
  360. padding: 0 27.27upx 54.54upx;
  361. margin-top: -63.63upx;
  362. .zaiui-user-info-order-box {
  363. border-radius: 18.18upx;
  364. .cu-list.grid.no-border {
  365. padding: 0;
  366. }
  367. .cu-list.grid.no-border>.cu-item {
  368. padding-bottom: 9.09upx;
  369. }
  370. }
  371. .cu-list.grid>.cu-item text {
  372. color: inherit;
  373. }
  374. .zaiui-user-info-money-box {
  375. border-radius: 18.18upx;
  376. .money-col {
  377. padding: 0 9.09upx 9.09upx;
  378. .money-item {
  379. position: relative;
  380. padding: 9.09upx;
  381. .money-item-view {
  382. border: 1.81upx solid #f3f2f3;
  383. border-radius: 18.18upx;
  384. position: relative;
  385. padding: 9.09upx;
  386. .cu-avatar {
  387. position: absolute;
  388. left: 9.09upx;
  389. }
  390. .money-content {
  391. position: relative;
  392. margin-left: 109.09upx;
  393. margin-bottom: 27.27upx;
  394. top: 12.72upx;
  395. }
  396. }
  397. }
  398. }
  399. }
  400. .zaiui-user-info-tools-box {
  401. border-radius: 18.18upx;
  402. .tools-view {
  403. position: relative;
  404. .tools-title {
  405. padding-right: 81.81upx;
  406. }
  407. .tools-right {
  408. position: absolute;
  409. right: 9.09upx;
  410. bottom: 23.63upx;
  411. }
  412. }
  413. }
  414. }
  415. }
  416. .zaiui-my-box.show {
  417. display: block;
  418. }
  419. </style>