index.vue 6.8 KB

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