index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. <template>
  2. <view class="content u-skeleton">
  3. <!-- 骨架屏 -->
  4. <Skeleton el-color="#efefef" bg-color="#fff" :loading="loading && isFirstComeIn" :animation="true"></Skeleton>
  5. <!-- 我的 -->
  6. <image class="top-bg" src="../../../static/images/origin/topBg.png"></image>
  7. <view class="page-content">
  8. <!-- 用户未登录 -->
  9. <view
  10. v-if="userItem.name === undefined" class="user-info-box"
  11. @click="$jump('../../../pages_category_page2/userModule/login')"
  12. >
  13. <image class="user-image u-skeleton-circle" src="../../../static/images/origin/morentouxiang.png" mode="widthFix">
  14. </image>
  15. <view class="user-info">
  16. <view class="user-logoin-title u-skeleton-fillet">点击登录</view>
  17. <view class="user-logoin-lable u-skeleton-fillet">登录后享受更多权益~</view>
  18. </view>
  19. <image class="user-info-right" src="../../../static/images/origin/back.png"></image>
  20. <view class="notice">
  21. <view v-if="userItem.notRead > 0" class="messNum">
  22. {{ userItem.notRead }}
  23. </view>
  24. </view>
  25. </view>
  26. <!-- 用户已登陆 -->
  27. <view v-else class="user-info-box ">
  28. <image
  29. v-if="userItem.headImage" class="user-image u-skeleton-fillet" :src="userItem.headImage" mode="widthFix"
  30. style="border-radius: 50%;" @click="handleJump('../../../pages_category_page2/userModule/personalDetails')"
  31. >
  32. </image>
  33. <image v-else class="user-image" src="../../../static/images/origin/morentouxiang.png" mode="widthFix">
  34. </image>
  35. <view class="user-info">
  36. <view v-if="userItem.name" class="user-logoin-title">
  37. {{ userItem.name }}
  38. </view>
  39. <view class="experience flex-items" @click="handleJump('../../../pages_category_page1/memberCenter/index')">
  40. <label>成长值</label>
  41. <view class="experienceValue">{{ userItem.growth || 0 }} / {{ userItem.nextLevelGrowth || 0 }}</view>
  42. </view>
  43. </view>
  44. <view class="notice" @click="handleJump('../../../pages_category_page2/userModule/messageCenter')">
  45. <view v-if="userItem.notRead > 0" class="messNum">
  46. {{ userItem.notRead > 99 ? '99+' : userItem.notRead }}
  47. </view>
  48. </view>
  49. </view>
  50. <!-- 订单卡片 -->
  51. <view class="order-box">
  52. <view
  53. v-for="orderCardItem in orderCardList" :key="orderCardItem.id" class="order-item"
  54. @click="handleJump(orderCardItem.jumpUrl)"
  55. >
  56. <image class="order-item-image u-skeleton-circle" :src="orderCardItem.icon" mode="widthFix">
  57. </image>
  58. <view class="order-item-text u-skeleton-fillet">{{ orderCardItem.label }}</view>
  59. <view v-if="userItem[orderCardItem.key] > 0" class="quan">
  60. {{ userItem[orderCardItem.key] }}
  61. </view>
  62. </view>
  63. </view>
  64. <!-- 第一个卡片 -->
  65. <view class="itemBox">
  66. <view v-for="item in fastCardOneList" :key="item.id" class="item-btn" @click="handleJump(item.jumpUrl)">
  67. <image class="item-btn-icon u-skeleton-circle" :src="item.icon" mode="widthFix">
  68. </image>
  69. <view class="item-btn-text u-skeleton-fillet">{{ item.label }}</view>
  70. </view>
  71. </view>
  72. <!-- 第二个卡片 -->
  73. <view class="itemBox">
  74. <view v-for="item in fastCardTwoList" :key="item.id" class="item-btn" @click="handleJump(item.jumpUrl)">
  75. <image class="item-btn-icon u-skeleton-circle" :src="item.icon" mode="widthFix"></image>
  76. <view class="item-btn-text u-skeleton-fillet">{{ item.label }}</view>
  77. </view>
  78. <!-- <button open-type="contact"
  79. class="item-btn btnNone">
  80. <image class="item-btn-icon"
  81. src="../../../static/images/origin/service.png"
  82. mode="widthFix"></image>
  83. <view class="item-btn-text">平台客服</view>
  84. </button> -->
  85. </view>
  86. </view>
  87. <view class="copyright">
  88. <text>中科鑫智 版权所有</text>
  89. <text>粤ICP备19086489号-3</text>
  90. </view>
  91. </view>
  92. </template>
  93. <script>
  94. import Skeleton from '../../../components/Skeleton'
  95. import { fastCardOneList, fastCardTwoList, orderCardList } from './index.data'
  96. import { Services } from '../../../utils/services'
  97. import { Encrypt } from '../../../utils/secret'
  98. const NET = require('../../../utils/request')
  99. const API = require('../../../config/api')
  100. export default {
  101. components: { Skeleton },
  102. data() {
  103. return {
  104. isFirstComeIn: true,
  105. loading: true,
  106. orderCardList,
  107. fastCardOneList,
  108. fastCardTwoList,
  109. cacheUserItem: {},
  110. userItem: {
  111. headImage: '',
  112. name: undefined
  113. }
  114. }
  115. },
  116. onShow() {
  117. this.isFirstComeIn = true
  118. if (uni.getStorageSync('storage_key')) {
  119. this.cacheUserItem = uni.getStorageSync('storage_key')
  120. }
  121. this.handleGetUser()
  122. },
  123. methods: {
  124. /**
  125. * 处理跳转
  126. * @param url
  127. */
  128. handleJump(url) {
  129. if (JSON.stringify(this.cacheUserItem) === '{}') {
  130. return this.$jump('../../../pages_category_page2/userModule/login')
  131. }
  132. if (url.startsWith('function')) {
  133. const [key, funcName] = url.split(':')
  134. this[funcName]()
  135. } else {
  136. this.$jump(url)
  137. }
  138. },
  139. /**
  140. * 获取用户信息
  141. */
  142. handleGetUser() {
  143. this.loading = true
  144. NET.request(API.GetUser, {}, 'GET').then((res) => {
  145. this.userItem = res.data
  146. uni.setStorageSync('storage_userInfo', this.userItem)
  147. this.isFirstComeIn = false
  148. this.loading = true
  149. })
  150. },
  151. /**
  152. * 客服
  153. * @return {Promise<void>}
  154. */
  155. async flyToService() {
  156. (await Services()).flyToService()
  157. },
  158. /**
  159. * 商家入驻
  160. */
  161. handleApplySettle() {
  162. const res = uni.getStorageSync('storage_key')
  163. const token = Encrypt(res.token)
  164. const username = this.userItem.name
  165. let url = null
  166. // #ifdef H5
  167. window.location.href = API.SettledMerchantPrefix + `/#/?username=${username}&user=${token}`
  168. // #endif
  169. // #ifdef APP-PLUS
  170. plus.runtime.openURL(API.SettledMerchantPrefix + `/#/?username=${username}&user=${token}`, function (e) {
  171. })
  172. // #endif
  173. // #ifdef MP-WEIXIN
  174. url = API.SettledMerchantPrefix
  175. uni.navigateTo({
  176. url: `../../../pages_category_page1/linkOthers/index?url=${url}&username=${username}&user=${token}`
  177. // 此处的链接为小程序上面新建的webview页面路径,参数url为要跳转外链的地址
  178. // url: '../../../pages_category_page1/linkOthers/index?url=' + encodeURIComponent(url)
  179. // url:'../../../pages_category_page2/userModule/coupon'
  180. })
  181. // #endif
  182. // #ifdef MP-ALIPAY
  183. url = API.SettledMerchantPrefix
  184. uni.navigateTo({
  185. url: `../../../pages_category_page1/linkOthers/index?url=${url}&username=${username}&user=${token}`
  186. // 此处的链接为小程序上面新建的webview页面路径,参数url为要跳转外链的地址
  187. // url: '../../../pages_category_page1/linkOthers/index?url=' + encodeURIComponent(url)
  188. // url:'../../../pages_category_page2/userModule/coupon'
  189. })
  190. // #endif
  191. }
  192. }
  193. }
  194. </script>
  195. <style lang="scss">
  196. page {
  197. background: #f8f8f8;
  198. }
  199. .content {
  200. height: 100%;
  201. position: relative;
  202. padding-bottom: 150rpx;
  203. .itemBox {
  204. display: flex;
  205. flex-flow: wrap;
  206. padding-top: 30rpx;
  207. background: #FFFFFF;
  208. width: 690rpx;
  209. margin: 30rpx auto 0 auto;
  210. }
  211. /* background-color: #f8f8f8; */
  212. .top-bg {
  213. width: 100%;
  214. height: 400rpx;
  215. margin-top: -50rpx;
  216. }
  217. .page-content {
  218. width: 100%;
  219. height: 100%;
  220. display: flex;
  221. flex-direction: column;
  222. z-index: 10;
  223. margin-top: -320upx;
  224. .user-info-box {
  225. width: 100%;
  226. box-sizing: border-box;
  227. padding: 30upx;
  228. display: flex;
  229. flex-direction: row;
  230. align-items: center;
  231. position: relative;
  232. .notice {
  233. width: 60rpx;
  234. height: 60rpx;
  235. position: absolute;
  236. top: 0;
  237. right: 50rpx;
  238. background: url("../../../static/images/origin/notice.png") no-repeat center center;
  239. background-size: contain;
  240. .messNum {
  241. background: #C83732;
  242. border-radius: 50%;
  243. color: #FFFFFF;
  244. text-align: center;
  245. margin: 0rpx 0 0 30rpx;
  246. width: 30rpx;
  247. height: 30rpx;
  248. line-height: 30rpx;
  249. font-size: 20rpx;
  250. }
  251. }
  252. .user-image {
  253. width: 126upx;
  254. height: 126upx;
  255. }
  256. .user-info {
  257. flex: 1;
  258. display: flex;
  259. flex-direction: column;
  260. padding-left: 20upx;
  261. box-sizing: border-box;
  262. z-index: 10;
  263. .user-logoin-title {
  264. font-size: 36upx;
  265. font-weight: 500;
  266. color: rgba(255, 255, 255, 1);
  267. }
  268. .user-logoin-lable {
  269. font-size: 24upx;
  270. font-weight: 400;
  271. color: rgba(255, 255, 255, 1);
  272. margin-top: 20upx;
  273. }
  274. .experience {
  275. label {
  276. font-size: 26rpx;
  277. color: #FFFFFF;
  278. opacity: 0.7;
  279. }
  280. .experienceValue {
  281. width: auto;
  282. padding: 0 28rpx;
  283. height: 40rpx;
  284. font-weight: 400;
  285. color: #FFFFFF;
  286. border-radius: 25rpx;
  287. line-height: 40rpx;
  288. border: 2rpx solid rgba(0, 0, 0, 0);
  289. background: linear-gradient(88deg, #C5AA7B 0%, #F5DEB2 100%);
  290. font-size: 20rpx;
  291. margin-left: 20rpx;
  292. }
  293. }
  294. }
  295. .user-info-right {
  296. width: 30upx;
  297. height: 30upx;
  298. }
  299. }
  300. .order-box {
  301. width: 690upx;
  302. height: 196upx !important;
  303. background: rgba(255, 255, 255, 1);
  304. box-shadow: 0px 0px 10upx 0px rgba(51, 51, 51, 0.1);
  305. display: flex;
  306. flex-direction: row;
  307. align-items: center;
  308. margin-left: 30upx;
  309. z-index: 10;
  310. .order-item {
  311. flex: 1;
  312. display: flex;
  313. flex-direction: column;
  314. align-items: center;
  315. justify-content: center;
  316. position: relative;
  317. .quan {
  318. position: absolute;
  319. right: 40upx;
  320. top: 10upx;
  321. border: 1px solid red;
  322. color: #FFFFFF;
  323. background-color: red;
  324. border-radius: 50%;
  325. font-size: 16rpx;
  326. width: 30upx;
  327. height: 30upx;
  328. line-height: 30upx;
  329. text-align: center;
  330. }
  331. .order-item-image {
  332. width: 90upx;
  333. height: 90upx;
  334. }
  335. .order-item-text {
  336. font-size: 28upx;
  337. margin-top: 10upx;
  338. font-weight: 500;
  339. color: rgba(102, 102, 102, 1);
  340. }
  341. }
  342. }
  343. .item-btn {
  344. width: 25%;
  345. box-sizing: border-box;
  346. background-color: #fff;
  347. text-align: center;
  348. margin-bottom: 40rpx;
  349. .item-btn-icon {
  350. width: 90upx;
  351. height: 90upx !important;
  352. }
  353. .item-btn-text {
  354. font-size: 28upx;
  355. font-weight: 500;
  356. flex: 1;
  357. color: rgba(102, 102, 102, 1);
  358. }
  359. .messNum {
  360. margin-left: 10rpx;
  361. font-size: 16rpx;
  362. background-color: red;
  363. color: #FFFFFF;
  364. width: 30rpx;
  365. height: 30rpx;
  366. border-radius: 50%;
  367. margin-top: -5rpx;
  368. line-height: 30rpx;
  369. text-align: center;
  370. }
  371. .item-btn-right {
  372. width: 24upx;
  373. height: 24upx;
  374. }
  375. }
  376. .btnNone {
  377. margin: 0;
  378. padding: 0;
  379. line-height: normal;
  380. &::after {
  381. display: none;
  382. }
  383. }
  384. .mt20 {
  385. margin-top: 20upx;
  386. }
  387. .mt1 {
  388. margin-top: 1upx;
  389. }
  390. }
  391. .copyright {
  392. text-align: center;
  393. padding: 30rpx 0 20rpx;
  394. position: absolute;
  395. bottom: 0;
  396. left: 0;
  397. width: 100%;
  398. text {
  399. display: block;
  400. font-size: 20rpx;
  401. line-height: 30rpx;
  402. color: #C5CACF;
  403. }
  404. }
  405. }
  406. </style>