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

538 lines
14 KiB

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