sale-user-center.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. <template>
  2. <app-layout :haveBackground="false">
  3. <image style="height: 396rpx;width: 100%;position: absolute;top: 0;left: 0;" src="https://t17.9026.com/web/statics/image/index/sale_top_bg.png" mode=""></image>
  4. <app-nav-bar v-if="true" :fixed="true" :title="mall.name" color="#000" :hasMallSetting="2"
  5. background-color=""></app-nav-bar>
  6. <app-user-center-top
  7. :top-style="4"
  8. :top-pic-url="userCenter.top_pic_url"
  9. :member-pic-url="userCenter.member_pic_url"
  10. :is_icon_super_vip="is_icon_super_vip"
  11. user-name-color="#ffffff"
  12. :isRealname="false"
  13. ></app-user-center-top>
  14. <app-my-income></app-my-income>
  15. <view class="app-my-service" v-if="userCenter.is_menu_status == 1">
  16. <!-- <view class="title" v-if="userCenter.menu_title">{{userCenter.menu_title}}</view> -->
  17. <view class="list" :class="[listStyle]">
  18. <!-- #ifdef MP -->
  19. <!-- <view class="item" v-for="(item, index) in userCenter.menus" :key="index" >
  20. <app-jump-button form
  21. :url="item.link_url"
  22. :open_type="item.open_type"
  23. :item="item"
  24. :arrangement="'row'">
  25. <view style="width: 100%"
  26. class="item-container dir-left-nowrap cross-center"
  27. >
  28. <view class="box-grow-0">
  29. <image :src="item.icon_url" class="icon"></image>
  30. </view>
  31. <view class="box-grow-1" style="max-width: 100%">
  32. <view class="name">{{item.name}}</view>
  33. </view>
  34. <view class="box-grow-0" >
  35. <image src="https://shop.9026.com/web/statics/image/mall/static/icon/arrow-right.png" class="arrow"></image>
  36. </view>
  37. </view>
  38. </app-jump-button>
  39. </view> -->
  40. <view class="item" v-for="(item, index) in temporaryMenu" :key="index" >
  41. <app-jump-button form
  42. :url="item.link_url"
  43. :open_type="item.open_type"
  44. :item="item"
  45. :arrangement="'row'">
  46. <view style="width: 100%"
  47. class="item-container dir-left-nowrap cross-center"
  48. >
  49. <view class="box-grow-0">
  50. <image :src="item.icon_url" class="icon"></image>
  51. </view>
  52. <view class="box-grow-1" style="max-width: 100%">
  53. <view class="name">{{item.name}}</view>
  54. </view>
  55. <view class="box-grow-0" >
  56. <image src="https://shop.9026.com/web/statics/image/mall/static/icon/arrow-right.png" class="arrow"></image>
  57. <!-- <image src="https://t17.9026.com/web/statics/image/index/arrow-right-bgwrite.png" class="arrow"></image> -->
  58. </view>
  59. </view>
  60. </app-jump-button>
  61. </view>
  62. <!-- #endif -->
  63. <!-- #ifdef H5 -->
  64. <block v-for="(item, index) in menus" :key="index">
  65. <view class="item" v-if="item.open_type !== 'app'">
  66. <app-jump-button form
  67. :url="item.link_url"
  68. :open_type="item.open_type"
  69. :item="item"
  70. :arrangement="`${userCenter.menu_style === '1' ? 'row' : userCenter.menu_style === '2' ? 'column' : ''}`">
  71. <view style="width: 100%"
  72. class="item-container"
  73. :class="[
  74. userCenter.menu_style=='1'?'dir-left-nowrap cross-center':'',
  75. userCenter.menu_style=='2'?'dir-top-nowrap cross-center':'',
  76. ]">
  77. <view class="box-grow-0">
  78. <image :src="item.icon_url" class="icon"></image>
  79. </view>
  80. <view class="box-grow-1" style="max-width: 100%">
  81. <view class="name">{{item.name}}</view>
  82. </view>
  83. <view class="box-grow-0" v-if="userCenter.menu_style=='1'">
  84. <image src="https://shop.9026.com/web/statics/image/mall/static/icon/arrow-right.png" class="arrow"></image>
  85. </view>
  86. </view>
  87. </app-jump-button>
  88. </view>
  89. <view v-else :id="item.id" class="item"></view>
  90. </block>
  91. <!-- #endif -->
  92. </view>
  93. </view>
  94. <!-- #ifdef H5 -->
  95. <view v-if="userInfo && isShowSetting" class="bd-setting dir-left-nowrap main-between cross-center" @click="routerGo">
  96. <view>设置</view>
  97. <image src="https://shop.9026.com/web/statics/image/mall/static/icon/arrow-right.png" class="bd-arrow"></image>
  98. </view>
  99. <!-- #endif -->
  100. <app-copyright
  101. v-if="copyright && copyright.status == '1'"
  102. background-color="transparent"
  103. :link="copyrightLink"
  104. :pic-url="copyright.pic_url"
  105. :text="copyright.description"
  106. ></app-copyright>
  107. </app-layout>
  108. </template>
  109. <script>
  110. import {mapGetters, mapState} from 'vuex';
  111. import AppUserCenterTop from '../../components/page-component/app-user-center-top/app-user-center-top.vue';
  112. import AppCopyright from '../../components/page-component/app-copyright/app-copyright.vue';
  113. import AppNavBar from '@/components/page-component/index/app-nav-bar.vue';
  114. import AppMyIncome from '../sale/components/app-my-income.vue';
  115. export default {
  116. name: 'user-center',
  117. components: {
  118. AppCopyright,
  119. AppUserCenterTop,
  120. AppNavBar,
  121. AppMyIncome,
  122. },
  123. data(){
  124. return {
  125. temporaryMenu:[
  126. {
  127. icon_url: "https://t17.9026.com/web/statics/image/index/order-icon.png",
  128. key: "pintuan",
  129. link_url: "/pages/sale/mySaleOrder",
  130. name: "我的订单",
  131. open_type: "navigate",
  132. },
  133. {
  134. icon_url: "https://t17.9026.com/web/statics/image/index/kehu.png",
  135. key: "pintuan",
  136. link_url: "/pages/sale/cusmter/list",
  137. name: "我的客户",
  138. open_type: "navigate",
  139. },
  140. {
  141. icon_url: "https://t17.9026.com/web/statics/image/index/lp.png",
  142. key: "pintuan",
  143. link_url: "/pages/sale/properties/properties",
  144. name: "我负责的楼盘",
  145. open_type: "navigate",
  146. },
  147. {
  148. icon_url: "https://t17.9026.com/web/statics/image/index/xx.png",
  149. key: "pintuan",
  150. link_url: "/pages/user-center/news/news",
  151. name: "我的消息",
  152. open_type: "navigate",
  153. },
  154. {
  155. icon_url: "https://t17.9026.com/web/statics/image/index/m.png",
  156. key: "pintuan",
  157. link_url: "",
  158. name: "我的身份码",
  159. open_type: "navigate",
  160. },
  161. {
  162. icon_url: "https://t17.9026.com/web/statics/image/index/kf.png",
  163. key: "pintuan",
  164. link_url: "",
  165. name: "联系客服",
  166. open_type: "navigate",
  167. }
  168. ]
  169. }
  170. },
  171. computed: {
  172. ...mapState({
  173. copyright: state => state.mallConfig.copyright,
  174. userInfo: state => state.user.info,
  175. is_icon_super_vip: function (state) {
  176. return state.mallConfig.mall.setting.is_icon_super_vip;
  177. },
  178. foot_bar: function(state) {
  179. let val=this.$utils.deepClone(state.userCenter.data.foot_bar)
  180. if(val){
  181. val.splice(1, 0, {icon_url:'',name:'我的优惠券'})
  182. return val;
  183. }else{
  184. return state.userCenter.data.foot_bar
  185. }
  186. },
  187. account_bar_status: function() {
  188. return this.userCenter.account_bar ? this.userCenter.account_bar.status : 0;
  189. },
  190. // #ifdef H5
  191. isWechat: function() {
  192. return this.$jwx.isWechat();
  193. },
  194. menus: function() {
  195. let menus = this.userCenter.menus;
  196. menus.forEach(item => {
  197. if(item.open_type === 'app') {
  198. item.id = this.$utils.guid('user-center');
  199. let username = this.$utils.getUrlParamApp(item.link_url, 'username');
  200. let path = this.$utils.getUrlParamApp(item.link_url, 'path');
  201. let strImg = ``;
  202. let size = uni.upx2px(50) + 'px';
  203. let style = `
  204. <style>
  205. .app-button-row {
  206. height: 100%;
  207. width: 100%;
  208. display: flex;
  209. flex-direction: row;
  210. justify-content: center;
  211. align-items: center;
  212. }
  213. .app-button-column {
  214. height: 100%;
  215. width: 100%;
  216. display: flex;
  217. flex-direction: column;
  218. justify-content: center;
  219. align-items: center;
  220. }
  221. .box-grow-0 {
  222. min-width: 0;
  223. -webkit-box-flex: 0;
  224. -webkit-flex-grow: 0;
  225. -ms-flex-positive: 0;
  226. flex-grow: 0;
  227. -webkit-flex-shrink: 0;
  228. -ms-flex-negative: 0;
  229. flex-shrink: 0;
  230. }
  231. .box-grow-1 {
  232. min-width: 0;
  233. -webkit-box-flex: 1;
  234. -webkit-flex-grow: 1;
  235. -ms-flex-positive: 1;
  236. flex-grow: 1;
  237. -webkit-flex-shrink: 1;
  238. -ms-flex-negative: 1;
  239. flex-shrink: 1;
  240. }
  241. .name {
  242. color: #666666;
  243. white-space: nowrap;
  244. overflow: hidden;
  245. text-overflow: ellipsis;
  246. }
  247. .dir-left-nowrap {
  248. display: -webkit-box;
  249. display: -webkit-flex;
  250. display: flex;
  251. -webkit-flex-direction: row;
  252. flex-direction: row;
  253. flex-wrap: nowrap;
  254. }
  255. .dir-top-nowrap {
  256. display: -webkit-box;
  257. display: -webkit-flex;
  258. display: flex;
  259. -webkit-box-orient: vertical;
  260. -webkit-flex-direction: column;
  261. flex-direction: column;
  262. flex-wrap: nowrap;
  263. }
  264. .cross-center {
  265. display: -webkit-box;
  266. display: -webkit-flex;
  267. display: flex;
  268. -webkit-align-items: center;
  269. align-items: center;
  270. }
  271. </style>`;
  272. let classStr = '';
  273. let font = '';
  274. let padding = '';
  275. let arrow = require("https://shop.9026.com/web/statics/image/mall/static/icon/arrow-right.png");
  276. if (true) {
  277. let margin = uni.upx2px(16);
  278. strImg = `<img src="${item.icon_url}" width="${size}" height="${size}" style="margin-right: ${margin}px"/>`;
  279. font = '17px';
  280. padding = 0;
  281. } else if (this.userCenter.menu_style == 2) {
  282. let margin = uni.upx2px(28);
  283. strImg = `<img src="${item.icon_url}" width="${size}" height="${size}" style="margin-bottom: ${margin}px"/>`;
  284. classStr = 'name';
  285. font = uni.upx2px(24) + 'px';
  286. padding = `0px` + ' ' +uni.upx2px(12) +'px';
  287. }
  288. let str = `<div class="box-grow-0">${strImg}</div>
  289. <div class="box-grow-1" style="max-width: 100%;"><div style="padding:${padding};font-size: ${font}" class="${classStr}">${item.name}</div></div>`;
  290. if (true) {
  291. let width = uni.upx2px(12);
  292. let height = uni.upx2px(22);
  293. str+= ` <div class="box-grow-0">
  294. <img src="${arrow}" width="${width}px" height="${height}px"/>
  295. </div>`
  296. }
  297. let div = ``;
  298. let div1 = '';
  299. if (true) {
  300. let padding1 = uni.upx2px(20) + 'px';
  301. let padding2 = uni.upx2px(32) + 'px';
  302. div1 = `<div style="width: 100%;padding: ${padding1} ${padding2}" class="dir-left-nowrap cross-center">${str}</div>`
  303. } else {
  304. let padding = uni.upx2px(24) + 'px';
  305. div1 = `<div style="width: 100%;padding: ${padding} 0" class="dir-top-nowrap cross-center">${str}</div>`
  306. }
  307. if (true) {
  308. div = `<div class="app-button-row">${div1}</div>`
  309. } else {
  310. div = `<div class="app-button-column">${div1}</div>`
  311. }
  312. style += div;
  313. this.$utils.createWxOpenLaunchWeapp(item.id, username, path, style);
  314. }
  315. });
  316. return menus;
  317. }
  318. // #endif
  319. }),
  320. copyrightLink() {
  321. if (!this.copyright) return {};
  322. let { open_type, new_link_url, params } = this.copyright.link;
  323. return {
  324. openType: open_type,
  325. url: new_link_url,
  326. params: params ? params : []
  327. };
  328. },
  329. ...mapGetters('mallConfig', {
  330. getTheme: 'getTheme'
  331. }),
  332. ...mapGetters('userCenter',{
  333. userCenter: 'userCenter'
  334. }),
  335. listStyle() {
  336. // if (this.userCenter.menu_style == 1) return 'row';
  337. // if (this.userCenter.menu_style == 2) return 'grid dir-left-wrap';
  338. return 'row';
  339. },
  340. // #ifdef H5
  341. isShowSetting: function () {
  342. return this.$storage.getStorageSync('platform') !== 'wechat';
  343. }
  344. // #endif
  345. },
  346. onLoad() {
  347. this.$commonLoad.onload();
  348. // #ifdef H5
  349. this.$jwx.config();
  350. // #endif
  351. console.log('查看',this)
  352. },
  353. onShow() {
  354. this.$event.on(this.$const.EVENT_USER_LOGIN).then(() => {
  355. uni.redirectTo({
  356. url: `/pages/user-center/user-center`
  357. });
  358. });
  359. // if (this.$user.isLogin()) {
  360. // this.$store.dispatch('user/refresh');
  361. // }
  362. this.$nextTick().then(() => {
  363. this.$store.dispatch('userCenter/data');
  364. });
  365. },
  366. methods: {
  367. // #ifdef H5
  368. routerGo() {
  369. uni.navigateTo({
  370. url: '/pages/registered/setting'
  371. });
  372. },
  373. // #endif
  374. },
  375. }
  376. </script>
  377. <style scoped lang="scss">
  378. .app-my-service {
  379. width: #{702rpx};
  380. border-radius: #{16rpx};
  381. margin: #{24rpx} auto;
  382. box-shadow: 0 0 #{8rpx} rgba(0, 0, 0, .05);
  383. background: #fff;
  384. .title {
  385. padding: #{32rpx} #{32rpx} #{16rpx};
  386. }
  387. .list {
  388. .item {
  389. .icon {
  390. width: #{50rpx};
  391. height: #{50rpx};
  392. display: block;
  393. }
  394. .arrow {
  395. width: #{12rpx};
  396. height: #{22rpx};
  397. }
  398. }
  399. }
  400. .list.row {
  401. .item-container {
  402. padding: #{20rpx} #{32rpx};
  403. }
  404. .icon {
  405. margin-right: #{16rpx};
  406. }
  407. }
  408. .list.grid {
  409. .item {
  410. width: 25%;
  411. .icon {
  412. margin-bottom: #{28rpx};
  413. }
  414. .name {
  415. padding: 0 #{12rpx};
  416. font-size: $uni-font-size-weak-one;
  417. color: $uni-general-color-one;
  418. white-space: nowrap;
  419. overflow: hidden;
  420. text-overflow: ellipsis;
  421. }
  422. }
  423. .item-container {
  424. padding: #{24rpx} 0;
  425. }
  426. }
  427. }
  428. .u-foot-box {
  429. position: relative;
  430. height: 104upx;
  431. }
  432. .u-icon {
  433. margin-top: 44upx;
  434. width: 40upx;
  435. height: 40upx;
  436. margin-right: 17upx;
  437. }
  438. .u-foot-item {
  439. font-size: #{26rpx};
  440. color: #666666;
  441. padding-top: #{14rpx};
  442. width: 50%;
  443. }
  444. .u-foot-info {
  445. text-align: center;
  446. }
  447. .u-foot-num {
  448. font-size: 32upx;
  449. margin-bottom: 10upx;
  450. }
  451. .u-line {
  452. height: 40upx;
  453. width: 2upx;
  454. background-color: #666666;
  455. position: absolute;
  456. top: 45upx;
  457. left: 50%;
  458. margin-left: -2upx;
  459. }
  460. // #ifdef H5
  461. .bd-setting {
  462. width: 702upx;
  463. height: 100upx;
  464. line-height: 100upx;
  465. border-radius: 16upx;
  466. padding: 0 33upx;
  467. background: #ffffff;
  468. margin: 24upx auto;
  469. box-shadow: 0 0 #{8rpx} rgba(0, 0, 0, .05);
  470. font-size:32upx;
  471. color: #353535;
  472. }
  473. .bd-arrow {
  474. width: #{12rpx};
  475. height: #{22rpx};
  476. }
  477. // #endif
  478. </style>