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

239 lines
6.4 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
  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 lf-font-bold" style="width: 500rpx;">
  8. <text>{{ 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">
  12. <text>ID {{ info.id }}</text>
  13. <text class="lf-m-l-30">{{ 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/collect/index')">
  19. <view class="lf-row-center">
  20. <image class="icon-img" src="../../static/center/collect.png"></image>
  21. <text class="lf-text-vertical lf-m-l-20 lf-font-32">我的收藏</text>
  22. </view>
  23. <view>
  24. <text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-40"></text>
  25. </view>
  26. </view>
  27. <view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/contactService/index')">
  28. <view class="lf-row-center">
  29. <image class="icon-img" src="../../static/center/service.png"></image>
  30. <text class="lf-text-vertical lf-m-l-16 lf-font-32">联系客服</text>
  31. </view>
  32. <view>
  33. <text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-40"></text>
  34. </view>
  35. </view>
  36. <view class="lf-row-between list-item" hover-class="lf-opacity">
  37. <view class="lf-row-center">
  38. <image class="icon-img" src="../../static/center/suggestion.png"></image>
  39. <text class="lf-text-vertical lf-m-l-16 lf-font-32">意见反馈</text>
  40. </view>
  41. <view>
  42. <text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-40"></text>
  43. </view>
  44. <button class="feedback-btn" open-type="feedback"></button>
  45. </view>
  46. <view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/FQA/index')">
  47. <view class="lf-row-center">
  48. <image class="icon-img" src="../../static/center/problem.png"></image>
  49. <text class="lf-text-vertical lf-m-l-16 lf-font-32">常见问题</text>
  50. </view>
  51. <view>
  52. <text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-40"></text>
  53. </view>
  54. </view>
  55. <!-- TODO 退出登录逻辑 -->
  56. <view class="lf-row-between list-item" hover-class="lf-opacity">
  57. <view class="lf-row-center">
  58. <image class="icon-img" src="../../static/center/loginout.png"></image>
  59. <text class="lf-text-vertical lf-m-l-16 lf-font-32">退出登录</text>
  60. </view>
  61. <view>
  62. <text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-40"></text>
  63. </view>
  64. </view>
  65. </view>
  66. <!-- 商家工具 -->
  67. <view class="lf-m-b-20 shop-list" v-if="isRight(info.store)">
  68. <view class="lf-row-between lf-m-b-20">
  69. <view class="lf-font-36 lf-font-bold">商家工具</view>
  70. <view class="lf-font-28" style="color: #555555;">{{ info.store.name }}</view>
  71. </view>
  72. <view class="lf-row-between list-item" hover-class="lf-opacity">
  73. <view class="lf-row-center">
  74. <image class="icon-img" src="../../static/center/order.png"></image>
  75. <text class="lf-text-vertical lf-m-l-16 lf-font-32">商家订单</text>
  76. </view>
  77. <view>
  78. <text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-40"></text>
  79. </view>
  80. </view>
  81. <view class="lf-row-between list-item" hover-class="lf-opacity" @click="chargeOff">
  82. <view class="lf-row-center">
  83. <image class="icon-img" src="../../static/center/scan.png"></image>
  84. <text class="lf-text-vertical lf-m-l-16 lf-font-32">卡券核销</text>
  85. </view>
  86. <view>
  87. <text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-40"></text>
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. </template>
  93. <script>
  94. export default {
  95. data() {
  96. return {
  97. info: {
  98. avatar: '',
  99. nickname: '',
  100. id: '',
  101. tel: '',
  102. tags: []
  103. }
  104. }
  105. },
  106. computed: {
  107. hidePhone(){
  108. return function(tel){
  109. if(tel.length == 11){
  110. var reg = /^(\d{3})\d{4}(\d{4})$/;
  111. var new_phone = tel.replace(reg, "$1****$2");
  112. return new_phone;
  113. }else{
  114. return tel;
  115. }
  116. }
  117. },
  118. isRight(){
  119. return function(val){
  120. return this.$shared.isRight(val);
  121. }
  122. }
  123. },
  124. onLoad() {
  125. this.verifyUserInfo();
  126. this.getData();
  127. },
  128. methods: {
  129. verifyUserInfo(){
  130. let userInfo = uni.getStorageSync('userinfo') || {};
  131. if(!userInfo.id || !userInfo.nickname || !userInfo.avatar){
  132. this.$url('/pages/login/index?type=userinfo');
  133. }
  134. },
  135. getData(){
  136. this.$http(this.API.API_USER_CENTER).then(res => {
  137. console.log("res" , res);
  138. this.info = res.data;
  139. })
  140. },
  141. // 预览图片
  142. lookImg(img){
  143. uni.previewImage({
  144. urls: [img]
  145. })
  146. },
  147. // 卡券核销
  148. chargeOff(){
  149. uni.scanCode({
  150. complete: result => {
  151. console.log("resuly", result)
  152. if(result.errMsg == 'scanCode:ok'){
  153. let content = result.result; // 核销码
  154. this.$http(this.API.API_CONFIRM_CODE, {confirm_code: content}).then(res => {
  155. this.$msg(res.msg);
  156. });
  157. }
  158. }
  159. })
  160. }
  161. }
  162. }
  163. </script>
  164. <style>
  165. page{
  166. overflow-x: hidden;
  167. background-color: #f5f5f5;
  168. }
  169. </style>
  170. <style lang="scss" scoped>
  171. .head{
  172. height: max-content;
  173. width: 750rpx;
  174. background-color: #FFFFFF;
  175. padding: 30rpx 32rpx;
  176. box-sizing: border-box;
  177. display: flex;
  178. .user-img{
  179. width: 150rpx;
  180. height: 150rpx;
  181. border-radius: 50%;
  182. // background-color: #EEEEEE;
  183. margin-right: 20rpx;
  184. }
  185. .user-info{
  186. flex: auto;
  187. height: max-content;
  188. }
  189. .user-label{
  190. display: inline-block;
  191. font-size: 24rpx;
  192. color: #FFFFFF;
  193. background-color: #1E89FF;
  194. padding: 4rpx 16rpx;
  195. border-radius: 30rpx;
  196. margin-left: 8rpx;
  197. }
  198. }
  199. .list{
  200. margin-top: 20rpx;
  201. padding: 0 32rpx;
  202. background-color: #FFFFFF;
  203. width: 100%;
  204. height: auto;
  205. }
  206. .list-item{
  207. border-bottom: 1rpx solid #EEEEEE;
  208. height: 110rpx;
  209. box-sizing: border-box;
  210. position: relative;
  211. .icon-img{
  212. width: 42rpx;
  213. height: 42rpx;
  214. }
  215. .feedback-btn{
  216. position: absolute;
  217. width: 100%;
  218. height: 100%;
  219. z-index: 1;
  220. background: transparent;
  221. }
  222. &:last-child{
  223. border-bottom: none;
  224. }
  225. }
  226. .shop-list{
  227. margin-top: 20rpx;
  228. width: 750rpx;
  229. height: auto;
  230. background-color: #FFFFFF;
  231. padding: 30rpx 32rpx;
  232. padding-bottom: 0;
  233. box-sizing: border-box;
  234. }
  235. </style>