多租户商城-商户小程序端
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.

508 lines
13 KiB

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