index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <view class="login">
  3. <!-- header -->
  4. <cu-custom custom bgColor="bg-gradual-blue"><view slot="content">我的</view></cu-custom>
  5. <!-- header -->
  6. <view class="header flex align-center justify-center" :style="{ backgroundImage: 'url(' + bg + ')', padding: CustomBarHeight + 'px 0px' }">
  7. <view class="userInfo flex align-center justify-center flex-direction">
  8. <view v-if="face" class="userInfo-image flex align-center justify-center" :style="{ backgroundImage: 'url(' + face + ')' }">
  9. </view>
  10. <view v-else class="userInfo-image flex align-center justify-center">
  11. <text class="cuIcon-picfill text-xxl text-gray"></text>
  12. </view>
  13. <view v-if="bind == 0" @click="show = true" class="userInfo-nickname padding-top-sm text-white text-lg">立即登录</view>
  14. <view v-else class="userInfo-nickname padding-top-sm text-white text-lg">{{ name }}</view>
  15. </view>
  16. </view>
  17. <!-- section -->
  18. <view class="section">
  19. <!-- 我的订单 -->
  20. <view class="order bg-white radius">
  21. <view class="order-header flex align-center justify-between padding-tb-sm">
  22. <view class="text-black">我的订单</view>
  23. <view @click="orderFunc(1)" class="text-grey">
  24. 全部订单
  25. <text class="cuIcon-right lg text-gray"></text>
  26. </view>
  27. </view>
  28. <view class="cu-list grid col-5 no-border">
  29. <view @click="orderFunc(index + 2)" class="cu-item text-center" v-for="(item, index) in order" :key="index">
  30. <view class="list-icon" :style="{ backgroundImage: 'url(' + item.icon + ')' }">
  31. <view class="cu-tag badge" v-if="item.badge">{{ item.badge > 99 ? '99+' : item.badge }}</view>
  32. </view>
  33. <text class="text-black margin-top-sm">{{ item.label }}</text>
  34. </view>
  35. </view>
  36. </view>
  37. <!-- 功能列表 -->
  38. <view class="cu-list menu">
  39. <!-- 更新资料 -->
  40. <view @click="updateUserInfo" class="cu-item">
  41. <view class="content">
  42. <text class="cuIcon-profilefill text-red"></text>
  43. <text class="text-grey">更新资料</text>
  44. </view>
  45. <view class=" cuIcon-refresh text-grey"></view>
  46. </view>
  47. <!-- 我的收藏 -->
  48. <view class="cu-item arrow">
  49. <view class="content">
  50. <text class="cuIcon-likefill text-red"></text>
  51. <text class="text-grey">我的收藏</text>
  52. </view>
  53. <view class="text-grey">999+</view>
  54. </view>
  55. <!-- 评价中心 -->
  56. <view @click="handler('/loginPages/evaluate/index')" class="cu-item arrow">
  57. <view class="content">
  58. <text class="cuIcon-evaluate_fill text-yellow"></text>
  59. <text class="text-grey">评价中心</text>
  60. </view>
  61. </view>
  62. <!-- 收货地址 -->
  63. <view @click="handler('/loginPages/addressList/index')" class="cu-item arrow">
  64. <view class="content">
  65. <text class="cuIcon-locationfill text-green"></text>
  66. <text class="text-grey ">收货地址</text>
  67. </view>
  68. </view>
  69. <!-- 分销中心 -->
  70. <view @click="handler('/loginPages/distribution/index')" class="cu-item arrow">
  71. <view class="content">
  72. <text class="cuIcon-fork text-red"></text>
  73. <text class="text-grey">分销中心</text>
  74. </view>
  75. </view>
  76. <!-- 余额-->
  77. <!--<view class="cu-item arrow">
  78. <view class="content">
  79. <text class="cuIcon-moneybag text-yellow"></text>
  80. <text class="text-grey">余额</text>
  81. </view>
  82. <view class="text-price text-red">999</view>
  83. </view> -->
  84. <!-- 积分-->
  85. <view class="cu-item arrow">
  86. <view class="content">
  87. <text class="cuIcon-coin text-yellow"></text>
  88. <text class="text-grey">积分</text>
  89. </view>
  90. <view class="text-yellow">999+</view>
  91. </view>
  92. </view>
  93. </view>
  94. <!-- footer -->
  95. <cu-bar active="3" />
  96. <!-- 工具 -->
  97. <cu-modalB
  98. :show.sync="show"
  99. @confirm="e => wxbind(e.detail)"
  100. title="登录提醒"
  101. openType="getPhoneNumber"
  102. confirmText="微信快捷登录"
  103. content="您还未登录,请先登录再进行操作!"
  104. />
  105. </view>
  106. </template>
  107. <script>
  108. import { statusBarHeight, CustomBarHeight } from '@/common/device/index.js';
  109. import dzf from '@/static/login/dzf.png';
  110. import dfh from '@/static/login/dfh.png';
  111. import ysz from '@/static/login/ysz.png';
  112. import ywc from '@/static/login/ywc.png';
  113. import dpj from '@/static/login/dpj.png';
  114. import bg from '@/static/bg.png';
  115. import { mapState, mapActions } from 'vuex';
  116. export default {
  117. computed: {
  118. ...mapState(['bind', 'face', 'name'])
  119. },
  120. data() {
  121. return {
  122. show: false,
  123. statusBarHeight,
  124. CustomBarHeight,
  125. bg,
  126. userInfo: {
  127. avator: 'https://gd-hbimg.huaban.com/1f50f2135ba51e4b9aa20caef41860b15005c9386f0b-LxqWsh_fw658/format/webp',
  128. nickname: '用户昵称/立即登录'
  129. },
  130. order: [
  131. {
  132. id: 2,
  133. icon: dzf,
  134. badge: 99,
  135. label: '待支付'
  136. },
  137. {
  138. id: 3,
  139. icon: dfh,
  140. label: '待发货'
  141. },
  142. {
  143. id: 4,
  144. icon: ysz,
  145. label: '运输中'
  146. },
  147. {
  148. id: 5,
  149. icon: ywc,
  150. label: '已完成'
  151. },
  152. {
  153. id: 6,
  154. icon: dpj,
  155. label: '待评价'
  156. }
  157. ]
  158. };
  159. },
  160. onLoad() {},
  161. methods: {
  162. ...mapActions(['getUserProfile', 'wxbind', 'getUserProfile']),
  163. orderFunc(val) {
  164. uni.navigateTo({
  165. url: `/pages/order/index?key=${val}`
  166. });
  167. },
  168. // 更新用户资料
  169. async updateUserInfo() {
  170. if (this.bind == 0) {
  171. this.show = true;
  172. }
  173. await this.getUserProfile();
  174. uni.showToast({
  175. title: '更新完成',
  176. icon: 'success'
  177. });
  178. },
  179. handler(path) {
  180. uni.navigateTo({
  181. url: path
  182. });
  183. }
  184. },
  185. onShareAppMessage() {
  186. return {};
  187. },
  188. onShareTimeline() {
  189. return {};
  190. }
  191. };
  192. </script>
  193. <style lang="scss" scoped>
  194. .login {
  195. .header {
  196. box-sizing: border-box;
  197. background-position: center;
  198. background-size: cover;
  199. .userInfo {
  200. .userInfo-image {
  201. width: 120upx;
  202. height: 120upx;
  203. background-color: #fff;
  204. border-radius: 50%;
  205. background-position: center;
  206. background-size: cover;
  207. }
  208. }
  209. }
  210. .section {
  211. .order {
  212. padding: 20upx 30upx;
  213. .list-icon {
  214. position: relative;
  215. width: 80upx;
  216. height: 80upx;
  217. margin: 0 auto;
  218. margin-top: 20upx;
  219. background-position: center;
  220. background-size: cover;
  221. }
  222. }
  223. }
  224. }
  225. </style>