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

267 lines
7.3 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>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-32"></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-32"></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-32"></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-32"></text>
  53. </view>
  54. </view>
  55. <!-- <view class="lf-row-between list-item" hover-class="lf-opacity" @click="quitLogin">
  56. <view class="lf-row-center">
  57. <image class="icon-img" src="../../static/center/loginout.png"></image>
  58. <text class="lf-text-vertical lf-m-l-16 lf-font-32">退出登录</text>
  59. </view>
  60. <view>
  61. <text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-32"></text>
  62. </view>
  63. </view> -->
  64. </view>
  65. <!-- 商家工具 -->
  66. <view class="lf-m-b-20 shop-list" v-if="isRight(info.store)">
  67. <view class="lf-row-between lf-m-b-20">
  68. <view class="lf-font-36 lf-font-bold">商家工具</view>
  69. <view class="lf-font-28 lf-line-1" style="color: #555555; max-width: 252rpx;">{{ info.store.name }}</view>
  70. </view>
  71. <view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/shopOrder/index')">
  72. <view class="lf-row-center">
  73. <image class="icon-img" src="../../static/center/order.png"></image>
  74. <text class="lf-text-vertical lf-m-l-16 lf-font-32">商家订单</text>
  75. </view>
  76. <view>
  77. <text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-32"></text>
  78. </view>
  79. </view>
  80. <view class="lf-row-between list-item" hover-class="lf-opacity" @click="chargeOff">
  81. <view class="lf-row-center">
  82. <image class="icon-img" src="../../static/center/scan.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>
  90. </view>
  91. </template>
  92. <script>
  93. let time = null;
  94. export default {
  95. data() {
  96. return {
  97. info: {
  98. avatar: '',
  99. nickname: '',
  100. id: '',
  101. tel: '',
  102. tags: []
  103. },
  104. showLogin: true
  105. }
  106. },
  107. computed: {
  108. hidePhone(){
  109. return function(tel){
  110. if(tel.length == 11){
  111. var reg = /^(\d{3})\d{4}(\d{4})$/;
  112. var new_phone = tel.replace(reg, "$1****$2");
  113. return new_phone;
  114. }else{
  115. return tel;
  116. }
  117. }
  118. },
  119. isRight(){
  120. return function(val){
  121. return this.$shared.isRight(val);
  122. }
  123. }
  124. },
  125. onShow(e){
  126. this.verifyUserInfo();
  127. this.getData();
  128. },
  129. methods: {
  130. verifyUserInfo(){
  131. let userInfo = uni.getStorageSync('userinfo') || {};
  132. if(!userInfo.id || !userInfo.nickname || !userInfo.avatar){
  133. if(this.showLogin){
  134. this.showLogin = false;
  135. this.$url('/pages/login/index?type=userinfo');
  136. }else{
  137. this.showLogin = true;
  138. this.$url('/pages/index/index', {type: 'switch'});
  139. }
  140. }
  141. },
  142. getData(){
  143. this.$http(this.API.API_USER_CENTER).then(res => {
  144. this.info = res.data;
  145. })
  146. },
  147. // 预览图片
  148. lookImg(img){
  149. this.$u.throttle(() => {
  150. uni.previewImage({
  151. urls: [img]
  152. })
  153. }, 200);
  154. },
  155. // 卡券核销
  156. chargeOff(){
  157. uni.scanCode({
  158. complete: result => {
  159. console.log("resuly", result)
  160. if(result.errMsg == 'scanCode:ok'){
  161. let content = result.result; // 核销码
  162. this.$http(this.API.API_CONFIRM_CODE, {confirm_code: content}).then(res => {
  163. this.$msg(res.msg, {icon: 'success'});
  164. let order_id = res.data.id;
  165. time = setTimeout(() => {
  166. this.$url('/pages/shopOrder/order-details?order_id='+ order_id);
  167. }, 1000);
  168. });
  169. }
  170. }
  171. })
  172. },
  173. // 退出登录
  174. quitLogin(){
  175. uni.showModal({
  176. title: '温馨提示',
  177. content: '您确定退出当前登录状态吗?',
  178. success: result => {
  179. console.log(result);
  180. if(result.confirm){
  181. // uni.setStorageSync('quit_login_state', true);
  182. uni.removeStorageSync('userinfo');
  183. this.$msg('退出成功', {icon: 'success'});
  184. }
  185. }
  186. })
  187. }
  188. }
  189. }
  190. </script>
  191. <style>
  192. page{
  193. overflow-x: hidden;
  194. background-color: #f5f5f5;
  195. }
  196. </style>
  197. <style lang="scss" scoped>
  198. .head{
  199. height: max-content;
  200. width: 750rpx;
  201. background-color: #FFFFFF;
  202. padding: 30rpx 32rpx;
  203. box-sizing: border-box;
  204. display: flex;
  205. .user-img{
  206. width: 150rpx;
  207. height: 150rpx;
  208. border-radius: 50%;
  209. // background-color: #EEEEEE;
  210. margin-right: 20rpx;
  211. }
  212. .user-info{
  213. flex: auto;
  214. height: max-content;
  215. }
  216. .user-label{
  217. display: inline-block;
  218. font-size: 24rpx;
  219. color: #FFFFFF;
  220. background-color: #1E89FF;
  221. padding: 4rpx 16rpx;
  222. border-radius: 30rpx;
  223. margin-left: 8rpx;
  224. }
  225. }
  226. .list{
  227. margin-top: 20rpx;
  228. padding: 0 32rpx;
  229. background-color: #FFFFFF;
  230. width: 100%;
  231. height: auto;
  232. }
  233. .list-item{
  234. border-bottom: 1rpx solid #EEEEEE;
  235. height: 110rpx;
  236. box-sizing: border-box;
  237. position: relative;
  238. .icon-img{
  239. width: 50rpx;
  240. height: 50rpx;
  241. }
  242. .feedback-btn{
  243. position: absolute;
  244. width: 100%;
  245. height: 100%;
  246. z-index: 1;
  247. background: transparent;
  248. }
  249. &:last-child{
  250. border-bottom: none;
  251. }
  252. }
  253. .shop-list{
  254. margin-top: 20rpx;
  255. width: 750rpx;
  256. height: auto;
  257. background-color: #FFFFFF;
  258. padding: 30rpx 32rpx;
  259. padding-bottom: 0;
  260. box-sizing: border-box;
  261. }
  262. </style>