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

506 lines
13 KiB

2 years ago
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. if (url.startsWith('function')) {
  198. const [key, funcName] = url.split(':')
  199. this[funcName]()
  200. } else {
  201. this.$jump(url)
  202. }
  203. },
  204. /**
  205. * 获取用户信息
  206. */
  207. handleGetUser() {
  208. this.loading = true
  209. NET.request(API.GetUser, {}, 'GET').then(res => {
  210. this.userItem = res.data
  211. uni.setStorageSync('storage_userInfo', this.userItem);
  212. this.isFirstComeIn=false
  213. this.loading = true
  214. })
  215. },
  216. /**
  217. * 客服
  218. * @return {Promise<void>}
  219. */
  220. async flyToService() {
  221. (await Services()).flyToService();
  222. },
  223. /**
  224. * 商家入驻
  225. */
  226. handleApplySettle() {
  227. const res = uni.getStorageSync('storage_key');
  228. let token = Encrypt(res.token)
  229. let username = this.userItem.name
  230. let url = null
  231. // #ifdef H5
  232. window.location.href = API.SettledMerchantPrefix + `/#/?username=${ username }&user=${ token }`
  233. // #endif
  234. // #ifdef APP-PLUS
  235. plus.runtime.openURL(API.SettledMerchantPrefix + `/#/?username=${ username }&user=${ token }`, function (e) {
  236. })
  237. // #endif
  238. // #ifdef MP-WEIXIN
  239. url = API.SettledMerchantPrefix
  240. uni.navigateTo({
  241. url: `../../../pages_category_page1/linkOthers/index?url=${ url }&username=${ username }&user=${ token }`
  242. // 此处的链接为小程序上面新建的webview页面路径,参数url为要跳转外链的地址
  243. // url: '../../../pages_category_page1/linkOthers/index?url=' + encodeURIComponent(url)
  244. // url:'../../../pages_category_page2/userModule/coupon'
  245. })
  246. // #endif
  247. // #ifdef MP-ALIPAY
  248. url = API.SettledMerchantPrefix
  249. uni.navigateTo({
  250. url: `../../../pages_category_page1/linkOthers/index?url=${ url }&username=${ username }&user=${ token }`
  251. // 此处的链接为小程序上面新建的webview页面路径,参数url为要跳转外链的地址
  252. // url: '../../../pages_category_page1/linkOthers/index?url=' + encodeURIComponent(url)
  253. // url:'../../../pages_category_page2/userModule/coupon'
  254. })
  255. // #endif
  256. },
  257. }
  258. }
  259. </script>
  260. <style lang="scss">
  261. page {
  262. background: #f8f8f8;
  263. }
  264. .content {
  265. height: 100%;
  266. position: relative;
  267. padding-bottom: 150rpx;
  268. .itemBox {
  269. display: flex;
  270. flex-flow: wrap;
  271. padding-top: 30rpx;
  272. background: #FFFFFF;
  273. width: 690rpx;
  274. margin: 30rpx auto 0 auto;
  275. }
  276. /* background-color: #f8f8f8; */
  277. .top-bg {
  278. width: 100%;
  279. height: 400rpx;
  280. margin-top: -50rpx;
  281. }
  282. .page-content {
  283. width: 100%;
  284. height: 100%;
  285. display: flex;
  286. flex-direction: column;
  287. z-index: 10;
  288. margin-top: -320upx;
  289. .user-info-box {
  290. width: 100%;
  291. box-sizing: border-box;
  292. padding: 30upx;
  293. display: flex;
  294. flex-direction: row;
  295. align-items: center;
  296. position: relative;
  297. .notice {
  298. width: 60rpx;
  299. height: 60rpx;
  300. position: absolute;
  301. top: 0;
  302. right: 50rpx;
  303. background: url("https://ceres.zkthink.com/static/images/notice.png") no-repeat center center;
  304. background-size: contain;
  305. .messNum {
  306. background: #C83732;
  307. border-radius: 50%;
  308. color: #FFFFFF;
  309. text-align: center;
  310. margin: 0rpx 0 0 30rpx;
  311. width: 30rpx;
  312. height: 30rpx;
  313. line-height: 30rpx;
  314. font-size: 20rpx;
  315. }
  316. }
  317. .user-image {
  318. width: 126upx;
  319. height: 126upx;
  320. }
  321. .user-info {
  322. flex: 1;
  323. display: flex;
  324. flex-direction: column;
  325. padding-left: 20upx;
  326. box-sizing: border-box;
  327. z-index: 10;
  328. .user-logoin-title {
  329. font-size: 36upx;
  330. font-weight: 500;
  331. color: rgba(255, 255, 255, 1);
  332. }
  333. .user-logoin-lable {
  334. font-size: 24upx;
  335. font-weight: 400;
  336. color: rgba(255, 255, 255, 1);
  337. margin-top: 20upx;
  338. }
  339. .experience {
  340. label {
  341. font-size: 26rpx;
  342. color: #FFFFFF;
  343. opacity: 0.7;
  344. }
  345. .experienceValue {
  346. width: auto;
  347. padding: 0 28rpx;
  348. height: 40rpx;
  349. font-weight: 400;
  350. color: #FFFFFF;
  351. border-radius: 25rpx;
  352. line-height: 40rpx;
  353. border: 2rpx solid rgba(0, 0, 0, 0);
  354. background: linear-gradient(88deg, #C5AA7B 0%, #F5DEB2 100%);
  355. font-size: 20rpx;
  356. margin-left: 20rpx;
  357. }
  358. }
  359. }
  360. .user-info-right {
  361. width: 30upx;
  362. height: 30upx;
  363. }
  364. }
  365. .order-box {
  366. width: 690upx;
  367. height: 196upx !important;
  368. background: rgba(255, 255, 255, 1);
  369. box-shadow: 0px 0px 10upx 0px rgba(51, 51, 51, 0.1);
  370. display: flex;
  371. flex-direction: row;
  372. align-items: center;
  373. margin-left: 30upx;
  374. z-index: 10;
  375. .order-item {
  376. flex: 1;
  377. display: flex;
  378. flex-direction: column;
  379. align-items: center;
  380. justify-content: center;
  381. position: relative;
  382. .quan {
  383. position: absolute;
  384. right: 40upx;
  385. top: 10upx;
  386. border: 1px solid red;
  387. color: #FFFFFF;
  388. background-color: red;
  389. border-radius: 50%;
  390. font-size: 16rpx;
  391. width: 30upx;
  392. height: 30upx;
  393. line-height: 30upx;
  394. text-align: center;
  395. }
  396. .order-item-image {
  397. width: 90upx;
  398. height: 90upx;
  399. }
  400. .order-item-text {
  401. font-size: 28upx;
  402. margin-top: 10upx;
  403. font-weight: 500;
  404. color: rgba(102, 102, 102, 1);
  405. }
  406. }
  407. }
  408. .item-btn {
  409. width: 25%;
  410. box-sizing: border-box;
  411. background-color: #fff;
  412. text-align: center;
  413. margin-bottom: 40rpx;
  414. .item-btn-icon {
  415. width: 90upx;
  416. height: 90upx !important;
  417. }
  418. .item-btn-text {
  419. font-size: 28upx;
  420. font-weight: 500;
  421. flex: 1;
  422. color: rgba(102, 102, 102, 1);
  423. }
  424. .messNum {
  425. margin-left: 10rpx;
  426. font-size: 16rpx;
  427. background-color: red;
  428. color: #FFFFFF;
  429. width: 30rpx;
  430. height: 30rpx;
  431. border-radius: 50%;
  432. margin-top: -5rpx;
  433. line-height: 30rpx;
  434. text-align: center;
  435. }
  436. .item-btn-right {
  437. width: 24upx;
  438. height: 24upx;
  439. }
  440. }
  441. .btnNone {
  442. margin: 0;
  443. padding: 0;
  444. line-height: normal;
  445. &::after {
  446. display: none;
  447. }
  448. }
  449. .mt20 {
  450. margin-top: 20upx;
  451. }
  452. .mt1 {
  453. margin-top: 1upx;
  454. }
  455. }
  456. .copyright {
  457. text-align: center;
  458. padding: 30rpx 0 20rpx;
  459. position: absolute;
  460. bottom: 0;
  461. left: 0;
  462. width: 100%;
  463. display: none;
  464. text {
  465. display: block;
  466. font-size: 20rpx;
  467. line-height: 30rpx;
  468. color: #C5CACF;
  469. }
  470. }
  471. }
  472. </style>