index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. <template>
  2. <view class="content">
  3. <!-- 我的 -->
  4. <image class="top-bg" src="../../../static/img/user/topBg.png"></image>
  5. <view class="page-content">
  6. <view class="user-info-box" @click="gologin" v-if="JSON.stringify(item) =='{}' ">
  7. <image class="user-image" src="../../../static/img/user/morentouxiang.png" mode="widthFix"></image>
  8. <view class="user-info">
  9. <view class="user-logoin-title">点击登录</view>
  10. <view class="user-logoin-lable">登录后享受更多权益~</view>
  11. </view>
  12. <image class="user-info-right" src="../../../static/img/user/back.png"></image>
  13. <view class="notice">
  14. <view class="messNum" v-if="useritem.notRead>0">{{useritem.notRead}}</view>
  15. </view>
  16. </view>
  17. <view class="user-info-box" v-else>
  18. <image class="user-image" @click="goinfo" v-if="useritem.headImage" :src="useritem.headImage"
  19. mode="widthFix" style="border-radius: 50%;"></image>
  20. <image class="user-image" v-else src="../../../static/img/user/morentouxiang.png" mode="widthFix">
  21. </image>
  22. <view class="user-info">
  23. <view class="user-logoin-title" v-if="useritem.name">{{useritem.name}}</view>
  24. <view class="user-logoin-title" v-else>{{infoitem.phone}}</view>
  25. <view class="experience flex-items" @click="goToMemberCenter">
  26. <label>成长值</label>
  27. <view class="experienceValue">{{useritem.growth}} / {{useritem.nextLevelGrowth}}</view>
  28. </view>
  29. </view>
  30. <view class="notice" @click="toMessage">
  31. <view class="messNum" v-if="useritem.notRead>0">{{useritem.notRead}}</view>
  32. </view>
  33. </view>
  34. <view class="order-box">
  35. <view class="order-item" @click="orderTap(1)">
  36. <image class="order-item-image" src="../../../static/img/user/daifukuan1.png" mode="widthFix">
  37. </image>
  38. <view class="order-item-text">待付款</view>
  39. <view class="quan" v-if="useritem.waitPayOrderCount>0">
  40. {{useritem.waitPayOrderCount}}
  41. </view>
  42. </view>
  43. <view class="order-item" @click="orderTap(2)">
  44. <image class="order-item-image" src="../../../static/img/user/daifahuo1.png" mode="widthFix">
  45. </image>
  46. <view class="order-item-text">待发货</view>
  47. <view class="quan" v-if="useritem.waitSendOrderCount>0">
  48. {{useritem.waitSendOrderCount}}
  49. </view>
  50. </view>
  51. <view class="order-item" @click="orderTap(3)">
  52. <image class="order-item-image" src="../../../static/img/user/daishouhuo.png" mode="widthFix">
  53. </image>
  54. <view class="order-item-text">待收货</view>
  55. <view class="quan" v-if="useritem.waitReceiveOrderCount>0">
  56. {{useritem.waitReceiveOrderCount}}
  57. </view>
  58. </view>
  59. <view class="order-item" @click="orderTap(0)">
  60. <image class="order-item-image" src="../../../static/img/user/dingdan.png" mode="widthFix"></image>
  61. <view class="order-item-text">全部订单</view>
  62. </view>
  63. </view>
  64. <!-- <view class="item-btn mt20" @click="toMessage">-->
  65. <!-- <image class="item-btn-icon" src="../../../static/images/mymessageIcon.png" mode="widthFix"></image>-->
  66. <!-- <view class="item-btn-text flex-row-plus flex-items">-->
  67. <!-- <label>消息中心</label>-->
  68. <!-- <view class="messNum" v-if="useritem.notRead>0">{{useritem.notRead}}</view>-->
  69. <!-- </view>-->
  70. <!-- <image class="item-btn-right" src="../../../static/img/user/arrow.png" mode="widthFix"></image>-->
  71. <!-- </view>-->
  72. <view class="itemBox">
  73. <view class="item-btn" @click="toCollection">
  74. <image class="item-btn-icon" src="../../../static/img/user/mycollectionIcon.png" mode="widthFix">
  75. </image>
  76. <view class="item-btn-text">我的收藏</view>
  77. </view>
  78. <view class="item-btn" @click="toQuestion">
  79. <image class="item-btn-icon" src="../../../static/img/user/myQuestionIcon.png" mode="widthFix">
  80. </image>
  81. <view class="item-btn-text">我的问答</view>
  82. </view>
  83. <view class="item-btn" @click="toFootprint">
  84. <image class="item-btn-icon" src="../../../static/img/user/myfootprintIcon.png" mode="widthFix">
  85. </image>
  86. <view class="item-btn-text">浏览足迹</view>
  87. </view>
  88. <view class="item-btn" @click="gouserEvaluate">
  89. <image class="item-btn-icon" src="../../../static/img/user/pingjia.png" mode="widthFix"></image>
  90. <view class="item-btn-text">我的评价</view>
  91. </view>
  92. <view class="item-btn" @click="memberAccountClick">
  93. <image class="item-btn-icon" src="../../../static/img/user/account.png" mode="widthFix"></image>
  94. <view class="item-btn-text">我的账户</view>
  95. </view>
  96. <view class="item-btn" @click="couponClick">
  97. <image class="item-btn-icon" src="../../../static/img/user/kaquan.png" mode="widthFix"></image>
  98. <view class="item-btn-text">我的卡券</view>
  99. </view>
  100. <view class="item-btn" @click="godistribution">
  101. <image class="item-btn-icon" src="../../../static/img/user/fenxiao.png" mode="widthFix"></image>
  102. <view class="item-btn-text">分销中心</view>
  103. </view>
  104. <view class="item-btn" @click="applySettle">
  105. <image class="item-btn-icon" src="../../../static/img/user/Settled.png" mode="widthFix"></image>
  106. <view class="item-btn-text">商家入驻</view>
  107. </view>
  108. </view>
  109. <view class="itemBox">
  110. <view class="item-btn" @click="addressClick">
  111. <image class="item-btn-icon" src="../../../static/img/user/dizhi1.png" mode="widthFix"></image>
  112. <view class="item-btn-text">地址管理</view>
  113. </view>
  114. <view class="item-btn" @click="goafterSale">
  115. <image class="item-btn-icon" src="../../../static/img/user/shouhou.png" mode="widthFix"></image>
  116. <view class="item-btn-text">我的售后</view>
  117. </view>
  118. <view class="item-btn" @click="goToMemberCenter">
  119. <image class="item-btn-icon" src="../../../static/img/user/VIP.png" mode="widthFix"></image>
  120. <view class="item-btn-text">会员中心</view>
  121. </view>
  122. <view class="item-btn" @click="goBankcard">
  123. <image class="item-btn-icon" src="../../../static/img/user/kaquan.png" mode="widthFix"></image>
  124. <view class="item-btn-text">银行卡</view>
  125. </view>
  126. <!-- <view class="item-btn" @click="goWxShop">-->
  127. <!-- <image class="item-btn-icon" src="../../../static/img/user/kaquan.png" mode="widthFix"></image>-->
  128. <!-- <view class="item-btn-text">测试</view>-->
  129. <!-- </view>-->
  130. </view>
  131. </view>
  132. <view class="copyright">
  133. <text>中科鑫智 版权所有</text>
  134. <text>粤ICP备19086489号-3</text>
  135. </view>
  136. </view>
  137. </template>
  138. <script>
  139. const NET = require('../../../utils/request')
  140. const API = require('../../../config/api')
  141. const SECRET = require('../../../utils/secret')
  142. export default {
  143. data() {
  144. return {
  145. item: {},
  146. infoitem: {},
  147. useritem: {}
  148. }
  149. },
  150. onLoad() {},
  151. onShow() {
  152. if (uni.getStorageSync('storage_key')) {
  153. this.item = uni.getStorageSync('storage_key');
  154. }
  155. this.getInfo()
  156. this.GetUser()
  157. },
  158. methods: {
  159. // goWxShop() {
  160. // uni.navigateTo({
  161. // url: `plugin-private://wxf0713a10bbae8732/pages/productDetail/productDetail?productId=59656518`,
  162. // })
  163. // },
  164. toMessage() {
  165. if (JSON.stringify(this.item) == '{}') {
  166. uni.navigateTo({
  167. url: '../../../pages_category_page2/userModule/login'
  168. })
  169. } else {
  170. uni.navigateTo({
  171. url: '../../../pages_category_page2/userModule/messageCenter'
  172. })
  173. }
  174. },
  175. toCollection() {
  176. if (JSON.stringify(this.item) == '{}') {
  177. uni.navigateTo({
  178. url: '../../../pages_category_page2/userModule/login'
  179. })
  180. } else {
  181. uni.navigateTo({
  182. url: '../../../pages_category_page2/userModule/collection'
  183. })
  184. }
  185. },
  186. toQuestion() {
  187. if (JSON.stringify(this.item) == '{}') {
  188. uni.navigateTo({
  189. url: '../../../pages_category_page2/userModule/login'
  190. })
  191. } else {
  192. uni.navigateTo({
  193. url: '../../../pages_category_page2/userModule/questionList'
  194. })
  195. }
  196. },
  197. toFootprint() {
  198. if (JSON.stringify(this.item) == '{}') {
  199. uni.navigateTo({
  200. url: '../../../pages_category_page2/userModule/login'
  201. })
  202. } else {
  203. uni.navigateTo({
  204. url: '../../../pages_category_page2/userModule/footprintList'
  205. })
  206. }
  207. },
  208. GetUser() {
  209. NET.request(API.GetUser, {}, 'GET').then(res => {
  210. this.useritem = res.data
  211. uni.setStorageSync('storage_userInfo', this.useritem);
  212. }).catch(res => {
  213. })
  214. },
  215. // 获取会员信息
  216. getInfo() {
  217. NET.request(API.Info, {
  218. token: this.item.token,
  219. }, 'GET').then(res => {
  220. this.infoitem = res.data
  221. }).catch(res => {
  222. })
  223. },
  224. // 个人信息 登录页面
  225. gologin() {
  226. uni.navigateTo({
  227. url: '../../../pages_category_page2/userModule/login'
  228. })
  229. },
  230. goinfo() {
  231. uni.navigateTo({
  232. url: '../../../pages_category_page2/userModule/personalDetails?infoitem=' + JSON.stringify(this
  233. .infoitem)
  234. })
  235. },
  236. // 我的评论
  237. gouserEvaluate() {
  238. if (JSON.stringify(this.item) == '{}') {
  239. uni.navigateTo({
  240. url: '../../../pages_category_page2/userModule/login'
  241. })
  242. } else {
  243. uni.navigateTo({
  244. url: '../../../pages_category_page1/goodsModule/userEvaluate'
  245. })
  246. }
  247. },
  248. // 分销中心
  249. godistribution() {
  250. if (JSON.stringify(this.item) == '{}') {
  251. uni.navigateTo({
  252. url: '../../../pages_category_page2/userModule/login'
  253. })
  254. } else {
  255. uni.navigateTo({
  256. url: '../../../pages_category_page1/distributionModule/index'
  257. })
  258. }
  259. },
  260. goToMemberCenter() {
  261. uni.navigateTo({
  262. url: '../../../pages_category_page1/memberCenter/index'
  263. })
  264. },
  265. applySettle() {
  266. const res = uni.getStorageSync('storage_key');
  267. let token = SECRET.Encrypt(res.token)
  268. let username = this.useritem.name
  269. let test = SECRET.Decrypt(token)
  270. // #ifdef H5
  271. console.log('h5 test')
  272. window.open(API.SettledMerchantPrefix + `/#/?username=${username}&user=${token}`)
  273. // #endif
  274. // #ifdef APP-PLUS
  275. plus.runtime.openURL(API.SettledMerchantPrefix + `/#/?username=${username}&user=${token}`, function(e) {
  276. console.log(e);
  277. })
  278. // #endif
  279. // #ifdef MP-WEIXIN
  280. console.log('wx test')
  281. var url = API.SettledMerchantPrefix + `/#/?username=${username}&user=${token}`
  282. uni.navigateTo({
  283. url: `../../../pages_category_page1/linkOthers/index?url=${url}`
  284. // 此处的链接为小程序上面新建的webview页面路径,参数url为要跳转外链的地址
  285. // url: '../../../pages_category_page1/linkOthers/index?url=' + encodeURIComponent(url)
  286. // url:'../../../pages_category_page2/userModule/coupon'
  287. })
  288. // #endif
  289. // #ifdef MP-ALIPAY
  290. var url = API.SettledMerchantPrefix + `/#/?username=${username}&user=${token}`
  291. uni.navigateTo({
  292. url: `../../../pages_category_page1/linkOthers/index?url=${url}`
  293. // 此处的链接为小程序上面新建的webview页面路径,参数url为要跳转外链的地址
  294. // url: '../../../pages_category_page1/linkOthers/index?url=' + encodeURIComponent(url)
  295. // url:'../../../pages_category_page2/userModule/coupon'
  296. })
  297. // #endif
  298. },
  299. //我的账户
  300. memberAccountClick() {
  301. if (JSON.stringify(this.item) == '{}') {
  302. uni.navigateTo({
  303. url: '../../../pages_category_page2/userModule/login'
  304. })
  305. } else {
  306. uni.navigateTo({
  307. url: '../../../pages_category_page2/userModule/memberAccount'
  308. })
  309. }
  310. },
  311. //我的优惠券
  312. couponClick() {
  313. if (JSON.stringify(this.item) == '{}') {
  314. uni.navigateTo({
  315. url: '../../../pages_category_page2/userModule/login'
  316. })
  317. } else {
  318. uni.navigateTo({
  319. url: '../../../pages_category_page2/userModule/coupon'
  320. })
  321. }
  322. },
  323. // 地址管理
  324. addressClick() {
  325. if (JSON.stringify(this.item) == '{}') {
  326. uni.navigateTo({
  327. url: '../../../pages_category_page2/userModule/login'
  328. })
  329. } else {
  330. uni.navigateTo({
  331. url: '../../../pages_category_page2/userModule/address'
  332. })
  333. }
  334. },
  335. // 我的售后
  336. goafterSale() {
  337. if (JSON.stringify(this.item) == '{}') {
  338. uni.navigateTo({
  339. url: '../../../pages_category_page2/userModule/login'
  340. })
  341. } else {
  342. uni.navigateTo({
  343. url: '../../../pages_category_page1/orderModule/afterSale'
  344. })
  345. }
  346. },
  347. // 我的银行卡
  348. goBankcard() {
  349. if (JSON.stringify(this.item) == '{}') {
  350. uni.navigateTo({
  351. url: '../../../pages_category_page2/userModule/login'
  352. })
  353. } else {
  354. uni.navigateTo({
  355. url: '../../../pages_category_page2/userModule/bankcard'
  356. })
  357. }
  358. },
  359. //判断是否是分销员
  360. getApplyState() {
  361. NET.request(API.HasApply, {
  362. tenantCode: this.currentId
  363. }, 'POST').then(res => {
  364. uni.hideLoading()
  365. this.slist = res.data
  366. }).catch(res => {
  367. uni.hideLoading()
  368. })
  369. },
  370. orderTap(type) {
  371. if (JSON.stringify(this.item) == '{}') {
  372. uni.navigateTo({
  373. url: '../../../pages_category_page2/userModule/login'
  374. })
  375. } else {
  376. uni.navigateTo({
  377. url: '../../../pages_category_page1/orderModule/index?type=' + type
  378. })
  379. }
  380. }
  381. }
  382. }
  383. </script>
  384. <style lang='scss'>
  385. page {
  386. background: #f8f8f8;
  387. }
  388. .content {
  389. height: 100%;
  390. position: relative;
  391. padding-bottom: 150rpx;
  392. .itemBox {
  393. display: flex;
  394. flex-flow: wrap;
  395. padding-top: 30rpx;
  396. background: #FFFFFF;
  397. width: 690rpx;
  398. margin: 30rpx auto 0 auto;
  399. }
  400. /* background-color: #f8f8f8; */
  401. .top-bg {
  402. width: 100%;
  403. height: 400rpx;
  404. margin-top: -50rpx;
  405. }
  406. .page-content {
  407. width: 100%;
  408. height: 100%;
  409. display: flex;
  410. flex-direction: column;
  411. z-index: 10;
  412. margin-top: -320upx;
  413. .user-info-box {
  414. width: 100%;
  415. box-sizing: border-box;
  416. padding: 30upx;
  417. display: flex;
  418. flex-direction: row;
  419. align-items: center;
  420. position: relative;
  421. .notice {
  422. width: 60rpx;
  423. height: 60rpx;
  424. position: absolute;
  425. top: 0;
  426. right: 50rpx;
  427. background: url("../../../static/images/notice.png") no-repeat center center;
  428. background-size: contain;
  429. .messNum {
  430. background: #C83732;
  431. border-radius: 50%;
  432. color: #FFFFFF;
  433. text-align: center;
  434. margin: 0rpx 0 0 30rpx;
  435. width: 30rpx;
  436. height: 30rpx;
  437. line-height: 30rpx;
  438. font-size: 20rpx;
  439. }
  440. }
  441. .user-image {
  442. width: 126upx;
  443. height: 126upx;
  444. }
  445. .user-info {
  446. flex: 1;
  447. display: flex;
  448. flex-direction: column;
  449. padding-left: 20upx;
  450. box-sizing: border-box;
  451. z-index: 10;
  452. .user-logoin-title {
  453. font-size: 36upx;
  454. font-weight: 500;
  455. color: rgba(255, 255, 255, 1);
  456. }
  457. .user-logoin-lable {
  458. font-size: 24upx;
  459. font-weight: 400;
  460. color: rgba(255, 255, 255, 1);
  461. margin-top: 20upx;
  462. }
  463. .experience {
  464. label {
  465. font-size: 26rpx;
  466. color: #FFFFFF;
  467. opacity: 0.7;
  468. }
  469. .experienceValue {
  470. width: auto;
  471. padding: 0 28rpx;
  472. height: 40rpx;
  473. font-weight: 400;
  474. color: #FFFFFF;
  475. border-radius: 25rpx;
  476. line-height: 40rpx;
  477. border: 2rpx solid rgba(0, 0, 0, 0);
  478. background: linear-gradient(88deg, #C5AA7B 0%, #F5DEB2 100%);
  479. font-size: 20rpx;
  480. margin-left: 20rpx;
  481. }
  482. }
  483. }
  484. .user-info-right {
  485. width: 30upx;
  486. height: 30upx;
  487. }
  488. }
  489. .order-box {
  490. width: 690upx;
  491. height: 196upx;
  492. background: rgba(255, 255, 255, 1);
  493. box-shadow: 0px 0px 10upx 0px rgba(51, 51, 51, 0.1);
  494. display: flex;
  495. flex-direction: row;
  496. align-items: center;
  497. margin-left: 30upx;
  498. z-index: 10;
  499. .order-item {
  500. flex: 1;
  501. display: flex;
  502. flex-direction: column;
  503. align-items: center;
  504. justify-content: center;
  505. position: relative;
  506. .quan {
  507. position: absolute;
  508. right: 40upx;
  509. top: 10upx;
  510. border: 1px solid red;
  511. color: #FFFFFF;
  512. background-color: red;
  513. border-radius: 50%;
  514. font-size: 16rpx;
  515. width: 30upx;
  516. height: 30upx;
  517. line-height: 30upx;
  518. text-align: center;
  519. }
  520. .order-item-image {
  521. width: 90upx;
  522. height: 90upx;
  523. }
  524. .order-item-text {
  525. font-size: 28upx;
  526. margin-top: 10upx;
  527. font-weight: 500;
  528. color: rgba(102, 102, 102, 1);
  529. }
  530. }
  531. }
  532. .item-btn {
  533. width: 25%;
  534. box-sizing: border-box;
  535. background-color: #fff;
  536. text-align: center;
  537. margin-bottom: 40rpx;
  538. .item-btn-icon {
  539. width: 90upx;
  540. height: 90upx;
  541. }
  542. .item-btn-text {
  543. font-size: 28upx;
  544. font-weight: 500;
  545. flex: 1;
  546. color: rgba(102, 102, 102, 1);
  547. }
  548. .messNum {
  549. margin-left: 10rpx;
  550. font-size: 16rpx;
  551. background-color: red;
  552. color: #FFFFFF;
  553. width: 30rpx;
  554. height: 30rpx;
  555. border-radius: 50%;
  556. margin-top: -5rpx;
  557. line-height: 30rpx;
  558. text-align: center;
  559. }
  560. .item-btn-right {
  561. width: 24upx;
  562. height: 24upx;
  563. }
  564. }
  565. .mt20 {
  566. margin-top: 20upx;
  567. }
  568. .mt1 {
  569. margin-top: 1upx;
  570. }
  571. }
  572. .copyright {
  573. text-align: center;
  574. padding: 30rpx 0 20rpx;
  575. position: absolute;
  576. bottom: 0;
  577. left: 0;
  578. width: 100%;
  579. text {
  580. display: block;
  581. font-size: 20rpx;
  582. line-height: 30rpx;
  583. color: #C5CACF;
  584. }
  585. }
  586. }
  587. </style>