时空网前端
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.

305 lines
8.7 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. <template>
  2. <view>
  3. <view class="lf-flex head">
  4. <image class="user-img" :src="info.avatar" @click="lookImg(info.avatar)" v-if="info.avatar"></image>
  5. <image class="user-img" src="../../static/logo.png" v-else></image>
  6. <view class="user-info">
  7. <view class="lf-font-40" style="width: 500rpx;">
  8. <text class="lf-font-bold">{{ info.nickname }}</text>
  9. <text class="user-label" v-for="(item, index) in info.tags" :key="index">{{ item }}</text>
  10. </view>
  11. <view class="lf-m-t-20 lf-font-28" style="color: #555555;">
  12. <text class="lf-m-r-30" v-if="isRight(info.virtual_id)">ID {{ info.virtual_id }}</text>
  13. <text>{{ hidePhone(info.tel) }}</text>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="list">
  18. <view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/center/wallet')">
  19. <view class="lf-row-center">
  20. <image class="icon-img" src="../../static/center/wallet.png"></image>
  21. <text class="lf-text-vertical lf-m-l-20 lf-font-32">我的钱包</text>
  22. </view>
  23. <view class="flex">
  24. <view class="lf-font-14 text-gray lf-m-r-10">
  25. 2000.48
  26. </view>
  27. <text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-32"></text>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="list">
  32. <view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/collect/index')">
  33. <view class="lf-row-center">
  34. <image class="icon-img" src="../../static/center/collect.png"></image>
  35. <text class="lf-text-vertical lf-m-l-20 lf-font-32">我的收藏</text>
  36. </view>
  37. <view>
  38. <text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-32"></text>
  39. </view>
  40. </view>
  41. <view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/center/fans')">
  42. <view class="lf-row-center">
  43. <image class="icon-img" src="../../static/center/fans.png"></image>
  44. <text class="lf-text-vertical lf-m-l-20 lf-font-32">粉丝列表</text>
  45. </view>
  46. <view>
  47. <text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-32"></text>
  48. </view>
  49. </view>
  50. <view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/center/invite')">
  51. <view class="lf-row-center">
  52. <image class="icon-img" src="../../static/center/invite.png"></image>
  53. <text class="lf-text-vertical lf-m-l-20 lf-font-32">邀请成为分销达人</text>
  54. </view>
  55. <view>
  56. <text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-32"></text>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="list">
  61. <view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/contactService/index')">
  62. <view class="lf-row-center">
  63. <image class="icon-img" src="../../static/center/service.png"></image>
  64. <text class="lf-text-vertical lf-m-l-16 lf-font-32">联系客服</text>
  65. </view>
  66. <view>
  67. <text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-32"></text>
  68. </view>
  69. </view>
  70. <view class="lf-row-between list-item" hover-class="lf-opacity">
  71. <view class="lf-row-center">
  72. <image class="icon-img" src="../../static/center/suggestion.png"></image>
  73. <text class="lf-text-vertical lf-m-l-16 lf-font-32">意见反馈</text>
  74. </view>
  75. <view>
  76. <text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-32"></text>
  77. </view>
  78. <button class="feedback-btn" open-type="feedback"></button>
  79. </view>
  80. <view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/FQA/index')">
  81. <view class="lf-row-center">
  82. <image class="icon-img" src="../../static/center/problem.png"></image>
  83. <text class="lf-text-vertical lf-m-l-16 lf-font-32">常见问题</text>
  84. </view>
  85. <view>
  86. <text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-32"></text>
  87. </view>
  88. </view>
  89. <!-- <view class="lf-row-between list-item" hover-class="lf-opacity" @click="quitLogin">
  90. <view class="lf-row-center">
  91. <image class="icon-img" src="../../static/center/loginout.png"></image>
  92. <text class="lf-text-vertical lf-m-l-16 lf-font-32">退出登录</text>
  93. </view>
  94. <view>
  95. <text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-32"></text>
  96. </view>
  97. </view> -->
  98. </view>
  99. <!-- 商家工具 -->
  100. <view class="lf-m-b-20 shop-list" v-if="isRight(info.store)">
  101. <view class="lf-row-between lf-m-b-20">
  102. <view class="lf-font-36 lf-font-bold">商家工具</view>
  103. <view class="lf-font-28 lf-line-1" style="color: #555555; max-width: 252rpx;">{{ info.store.name }}</view>
  104. </view>
  105. <view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/shopOrder/index')">
  106. <view class="lf-row-center">
  107. <image class="icon-img" src="../../static/center/order.png"></image>
  108. <text class="lf-text-vertical lf-m-l-16 lf-font-32">商家订单</text>
  109. </view>
  110. <view>
  111. <text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-32"></text>
  112. </view>
  113. </view>
  114. <view class="lf-row-between list-item" hover-class="lf-opacity" @click="chargeOff">
  115. <view class="lf-row-center">
  116. <image class="icon-img" src="../../static/center/scan.png"></image>
  117. <text class="lf-text-vertical lf-m-l-16 lf-font-32">卡券核销</text>
  118. </view>
  119. <view>
  120. <text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-32"></text>
  121. </view>
  122. </view>
  123. </view>
  124. </view>
  125. </template>
  126. <script>
  127. let time = null;
  128. export default {
  129. data() {
  130. return {
  131. info: {
  132. avatar: '',
  133. nickname: '',
  134. id: '',
  135. tel: '',
  136. tags: []
  137. },
  138. showLogin: true
  139. }
  140. },
  141. computed: {
  142. hidePhone(){
  143. return function(tel){
  144. if(tel.length == 11){
  145. var reg = /^(\d{3})\d{4}(\d{4})$/;
  146. var new_phone = tel.replace(reg, "$1****$2");
  147. return new_phone;
  148. }else{
  149. return tel;
  150. }
  151. }
  152. },
  153. isRight(){
  154. return function(val){
  155. return this.$shared.isRight(val);
  156. }
  157. }
  158. },
  159. onShow(e){
  160. this.verifyUserInfo();
  161. this.getData();
  162. },
  163. methods: {
  164. verifyUserInfo(){
  165. let userInfo = uni.getStorageSync('userinfo') || {};
  166. if(!userInfo.id || !userInfo.nickname || !userInfo.avatar){
  167. if(this.showLogin){
  168. this.showLogin = false;
  169. this.$url('/pages/login/index?type=userinfo');
  170. }else{
  171. this.showLogin = true;
  172. this.$url('/pages/index/index', {type: 'switch'});
  173. }
  174. }
  175. },
  176. getData(){
  177. this.$http(this.API.API_USER_CENTER).then(res => {
  178. this.info = res.data;
  179. })
  180. },
  181. // 预览图片
  182. lookImg(img){
  183. this.$u.throttle(() => {
  184. uni.previewImage({
  185. urls: [img]
  186. })
  187. }, 200);
  188. },
  189. // 卡券核销
  190. chargeOff(){
  191. uni.scanCode({
  192. complete: result => {
  193. console.log("resuly", result)
  194. if(result.errMsg == 'scanCode:ok'){
  195. let content = result.result; // 核销码
  196. this.$http(this.API.API_CONFIRM_CODE, {confirm_code: content}).then(res => {
  197. this.$msg(res.msg, {icon: 'success'});
  198. let order_id = res.data.id;
  199. time = setTimeout(() => {
  200. this.$url('/pages/shopOrder/order-details?order_id='+ order_id);
  201. }, 1000);
  202. });
  203. }
  204. }
  205. })
  206. },
  207. // 退出登录
  208. quitLogin(){
  209. uni.showModal({
  210. title: '温馨提示',
  211. content: '您确定退出当前登录状态吗?',
  212. success: result => {
  213. console.log(result);
  214. if(result.confirm){
  215. // uni.setStorageSync('quit_login_state', true);
  216. uni.removeStorageSync('userinfo');
  217. this.$msg('退出成功', {icon: 'success'});
  218. }
  219. }
  220. })
  221. }
  222. }
  223. }
  224. </script>
  225. <style>
  226. page{
  227. overflow-x: hidden;
  228. background-color: #f5f5f5;
  229. }
  230. </style>
  231. <style lang="scss" scoped>
  232. .head{
  233. height: max-content;
  234. width: 750rpx;
  235. background-color: #FFFFFF;
  236. padding: 30rpx 32rpx;
  237. box-sizing: border-box;
  238. display: flex;
  239. .user-img{
  240. width: 150rpx;
  241. height: 150rpx;
  242. border-radius: 50%;
  243. // background-color: #EEEEEE;
  244. margin-right: 20rpx;
  245. }
  246. .user-info{
  247. flex: auto;
  248. height: max-content;
  249. }
  250. .user-label{
  251. display: inline-block;
  252. font-size: 24rpx;
  253. color: #FFFFFF;
  254. background-color: #1E89FF;
  255. padding: 4rpx 16rpx;
  256. border-radius: 30rpx;
  257. margin-left: 8rpx;
  258. }
  259. }
  260. .list{
  261. margin-top: 20rpx;
  262. padding: 0 32rpx;
  263. background-color: #FFFFFF;
  264. width: 100%;
  265. height: auto;
  266. }
  267. .list-item{
  268. border-bottom: 1rpx solid #EEEEEE;
  269. height: 110rpx;
  270. box-sizing: border-box;
  271. position: relative;
  272. .icon-img{
  273. width: 50rpx;
  274. height: 50rpx;
  275. }
  276. .feedback-btn{
  277. position: absolute;
  278. width: 100%;
  279. height: 100%;
  280. z-index: 1;
  281. background: transparent;
  282. }
  283. &:last-child{
  284. border-bottom: none;
  285. }
  286. }
  287. .shop-list{
  288. margin-top: 20rpx;
  289. width: 750rpx;
  290. height: auto;
  291. background-color: #FFFFFF;
  292. padding: 30rpx 32rpx;
  293. padding-bottom: 0;
  294. box-sizing: border-box;
  295. }
  296. </style>