user.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. <template>
  2. <view class="container user clearfix">
  3. <view class="user-section" :class="[!isShowNoLogin ? 'show' : 'none']">
  4. <view class="u-header">
  5. <image src="https://admin-b.caimei365.com/userfiles/1/images/photo/2020/03/%E6%88%91%E7%9A%84%20%E2%80%93%201%403x.png" mode=""></image>
  6. <view class="u-header-main">
  7. <view class="user-item">
  8. <view class="logo-m">
  9. <image :src="headpic" mode=""></image>
  10. </view>
  11. </view>
  12. <view class="user-item">
  13. <text class="u-h1">{{name}}</text>
  14. </view>
  15. <view class="user-item">
  16. <text class="u-p">账户余额:{{userMoney}}元</text>
  17. </view>
  18. </view>
  19. </view>
  20. <!-- 订单 -->
  21. <view class="user-order">
  22. <view class="tab-title">我的订单</view>
  23. <view class="order-section">
  24. <view class="order-item" @click="navigator('/pages/user/order/order-list?state=1')" hover-class="common-hover" :hover-stay-time="50">
  25. <view class="order-icon">
  26. <image src="../../../static/temp/order1@3x.png" mode=""></image>
  27. <text v-if="paymentCount >0"
  28. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  29. :class="[paymentCount < 10 ? 'goleft':'']">
  30. {{paymentCount == 99? '99+' : paymentCount}}
  31. </text>
  32. </view>
  33. <text class="order-t">待付款</text>
  34. </view>
  35. <view class="order-item" @click="navigator('/pages/user/order/order-list?state=2')" hover-class="common-hover" :hover-stay-time="50">
  36. <view class="order-icon">
  37. <image src="../../../static/temp/order2@3x.png" mode=""></image>
  38. <text v-if="waitShipmentsCount >0"
  39. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num "
  40. :class="[waitShipmentsCount < 10 ? 'goleft':'']">
  41. {{waitShipmentsCount == 99? '99+' : waitShipmentsCount}}
  42. </text>
  43. </view>
  44. <text class="order-t">待发货</text>
  45. </view>
  46. <view class="order-item" @click="navigator('/pages/user/order/order-list?state=3')" hover-class="common-hover" :hover-stay-time="50">
  47. <view class="order-icon">
  48. <image src="../../../static/temp/order3@3x.png" mode=""></image>
  49. <text v-if="shipmentsCount >0"
  50. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  51. :class="[shipmentsCount < 10 ? 'goleft':'']">
  52. {{shipmentsCount == 99? '99+' : shipmentsCount}}
  53. </text>
  54. </view>
  55. <text class="order-t">已发货</text>
  56. </view>
  57. <view class="order-item" @click="navigator('/pages/user/order/order-list?state=4')" hover-class="common-hover" :hover-stay-time="50">
  58. <view class="order-icon">
  59. <image src="../../../static/temp/order4@3x.png" mode=""></image>
  60. <text v-if="salesReturnCount >0"
  61. class="uni-badge uni-badge-error uni-small uni-badge--small icon-num"
  62. :class="[salesReturnCount < 10 ? 'goleft':'']">
  63. {{salesReturnCount == 99? '99+' : salesReturnCount}}
  64. </text>
  65. </view>
  66. <text class="order-t">退货/款</text>
  67. </view>
  68. <view class="order-item" @click="navigator('/pages/user/order/order-list?state=0')" hover-class="common-hover" :hover-stay-time="50">
  69. <view class="order-icon">
  70. <image src="../../../static/temp/order5@3x.png" mode=""></image>
  71. </view>
  72. <text class="order-t">全部订单</text>
  73. </view>
  74. </view>
  75. </view>
  76. <!-- 底部跳转 -->
  77. <view class="foot-list">
  78. <view class="list-cell-item">
  79. <view class="list-cell" v-for="(item, index) in firstList" :key="index" @click="navigator(item.path)" hover-class="cell-hover" :hover-stay-time="50">
  80. <text class="cell-tit">{{item.name}}</text>
  81. <text class="cell-more iconfont icon-xiayibu"></text>
  82. </view>
  83. </view>
  84. <view class="list-cell-item">
  85. <view class="list-cell" v-for="(item, index) in twoList" :key="index" @click="navigator(item.path)" hover-class="cell-hover" :hover-stay-time="50">
  86. <text class="cell-tit">{{item.name}}</text>
  87. <text class="cell-more iconfont icon-xiayibu"></text>
  88. </view>
  89. </view>
  90. <view class="list-cell-item">
  91. <view class="list-cell" @click="navigator('/pages/user/regularPurchase/regularPurchase')" hover-class="cell-hover" :hover-stay-time="50">
  92. <text class="cell-tit">再次购买</text>
  93. <text class="cell-more iconfont icon-xiayibu"></text>
  94. </view>
  95. </view>
  96. <view class="list-cell-item">
  97. <view class="list-cell" @click="navigator('/pages/user/setting/setting')" hover-class="cell-hover" :hover-stay-time="50">
  98. <text class="cell-tit">用户设置</text>
  99. <text class="cell-more iconfont icon-xiayibu"></text>
  100. </view>
  101. </view>
  102. <view class="list-cell-item">
  103. <view class="list-cell" hover-class="cell-hover" :hover-stay-time="50">
  104. <text class="cell-tit">联系我们</text>
  105. <text class="cell-more" @click="toPhone">{{contactNumber}}</text>
  106. </view>
  107. <view class="list-cell last" @click="navigator('/pages/user/about/about')" hover-class="cell-hover" :hover-stay-time="50">
  108. <text class="cell-tit">关于我们</text>
  109. <text class="cell-more iconfont icon-xiayibu"></text>
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. </view>
  115. </template>
  116. <script>
  117. import uniBadge from '@/components/uni-badge/uni-badge.vue'
  118. import { mapState,mapMutations } from 'vuex';
  119. export default{
  120. components: {
  121. uniBadge
  122. },
  123. data() {
  124. return{
  125. name:'采美采购商城',
  126. headpic:'../../../static/temp/logo@3x.png',
  127. userMoney:0.00,
  128. contactNumber:'',
  129. openid:'',
  130. aboutHtml:'',
  131. telPhone:'',
  132. paymentCount:0, //待付款角标
  133. waitShipmentsCount:0, //待收货角标
  134. shipmentsCount:0, //已发货角标
  135. salesReturnCount:'',//退货/款角标
  136. isShowNoLogin:false,
  137. firstList:[
  138. {name:'运营人员管理',path:'/pages/user/operator/list'},
  139. {name:'机构资料',path:'/pages/user-module/information'},
  140. {name:'收货地址管理',path:'/pages/user/address/address'}
  141. ],
  142. twoList:[
  143. {name:'账户余额明细',path:'/pages/user/account/account'},
  144. {name:'发票信息',path:'/pages/user/invoice/invoice'}
  145. ]
  146. }
  147. },
  148. onLoad(){
  149. },
  150. methods:{
  151. initData(){
  152. this.$api.get('/personal/myCentre',{openid:this.openid,userOrganizeID:this.userOrganizeID},
  153. response => {
  154. if (response.code == "1") {
  155. this.$store.commit('updateAllNum',response.data.cartCount)
  156. let user_data =response.data;
  157. if(user_data.userMoney == 0){
  158. this.userMoney = '0.00';
  159. }else{
  160. let i = user_data.userMoney.toString().lastIndexOf('.');
  161. let money;
  162. if(i==-1){
  163. money = this.$api.FormatMoney(user_data.userMoney); //会所剩余余额
  164. this.userMoney = money +'.00'
  165. }else{
  166. money = this.$api.FormatMoney(user_data.userMoney); //会所剩余余额
  167. this.userMoney = money
  168. }
  169. }
  170. this.name = user_data.name //会所名称
  171. if(user_data.headpic!=''){
  172. this.headpic = user_data.headpic //会所头像
  173. }
  174. this.contactNumber = user_data.contactNumber //联系电话
  175. this.paymentCount = this.showBadge(user_data.paymentCount);
  176. this.waitShipmentsCount = this.showBadge(user_data.waitShipmentsCount);
  177. this.shipmentsCount = this.showBadge(user_data.shipmentsCount);
  178. this.salesReturnCount = this.showBadge(user_data.salesReturnCount);
  179. } else {
  180. this.$util.msg(response.msg,2000);
  181. }
  182. }
  183. )
  184. },
  185. toPhone(){
  186. uni.makePhoneCall({
  187. phoneNumber:this.contactNumber //仅为示例
  188. });
  189. },
  190. navigator(url){
  191. this.$api.navigateTo(url)
  192. },
  193. showBadge(n){
  194. let num ='';
  195. if(n>100){num = 99}else{num = n;}
  196. return num;
  197. },
  198. onPullDownRefresh() {//下拉刷新
  199. this.initData()
  200. uni.stopPullDownRefresh()
  201. },
  202. onShow(){
  203. this.$api.getStorage().then((resolve) => {
  204. console.log(resolve)
  205. if(resolve.code == '1'){
  206. this.openid = resolve.openid
  207. this.isShowNoLogin = false;
  208. this.initData();
  209. }else{
  210. this.isShowNoLogin = true;
  211. this.$api.navigateTo('/pages/user-module/login-accont')
  212. this.$store.commit('updateAllNum',0)
  213. }
  214. })
  215. }
  216. }
  217. }
  218. </script>
  219. <style lang="scss">
  220. @import "@/uni.scss";
  221. page{
  222. background-color: #F7F7F7;
  223. }
  224. .user{
  225. width: 100%;
  226. height: 100%;
  227. position:relative;
  228. background: rgba(247, 247, 247, 1);
  229. }
  230. .user-section.none{
  231. display: none;
  232. }
  233. .user-section.show{
  234. display: block;
  235. }
  236. .u-header{
  237. width: 100%;
  238. height: 400rpx;
  239. position: relative;
  240. image{
  241. width: 100%;
  242. height: 400rpx;
  243. }
  244. }
  245. .u-header-main{
  246. width: 100%;
  247. height: 284rpx;
  248. padding: 58rpx 0;
  249. position: absolute;
  250. top: 0;
  251. left: 0;
  252. .user-item{
  253. width: 100%;
  254. display: flex;
  255. flex-direction: column;
  256. align-items: center;
  257. margin-bottom: 16rpx;
  258. .u-h1{
  259. width: 410rpx;
  260. font-size: $font-size-28;
  261. line-height: 40rpx;
  262. color: #FFFFFF;
  263. margin-bottom: 8rpx;
  264. -o-text-overflow: ellipsis;
  265. text-overflow: ellipsis;
  266. display: -webkit-box;
  267. word-break: break-all;
  268. -webkit-box-orient: vertical;
  269. -webkit-line-clamp: 1;
  270. overflow: hidden;
  271. align-items: center;
  272. }
  273. .u-p{
  274. font-size: $font-size-24;
  275. line-height: 40rpx;
  276. color: #FFFFFF;
  277. }
  278. }
  279. .logo-m{
  280. width: 144rpx;
  281. height: 144rpx;
  282. border: 2rpx solid #FFFFFF;
  283. border-radius: 100%;
  284. background: $bg-color;
  285. image{
  286. width: 144rpx;
  287. height: 144rpx;
  288. border-radius: 100%;
  289. }
  290. }
  291. }
  292. .user-order{
  293. width: 702rpx;
  294. height: auto;
  295. padding: 0 24rpx;
  296. background-color: $bg-color;
  297. margin-bottom: 24rpx;
  298. }
  299. .tab-title{
  300. font-size: $font-size-28;
  301. line-height: 80rpx;
  302. color: #333333;
  303. text-align:left;
  304. border-bottom: 1px solid #F8F8F8;
  305. }
  306. .order-section{
  307. display: flex;
  308. justify-content: space-around;
  309. align-items: center;
  310. flex-wrap:wrap;
  311. height: 99rpx;
  312. padding: 24rpx 0;
  313. }
  314. .order-item{
  315. display: flex;
  316. flex-direction: column;
  317. align-items: center;
  318. width: 98rpx;
  319. position: relative;
  320. margin-right: 53rpx;
  321. &:last-child{
  322. margin-right: 0;
  323. }
  324. .order-icon{
  325. width: 52rpx;
  326. height: 52rpx;
  327. position: relative;
  328. image{
  329. width: 52rpx;
  330. height: 52rpx;
  331. }
  332. .icon-num{
  333. position: absolute;
  334. right:-24rpx;
  335. top: -9rpx;
  336. }
  337. .icon-num.goleft{
  338. right: -12rpx;
  339. }
  340. }
  341. .order-t{
  342. line-height: 50rpx;
  343. font-size: $font-size-24;
  344. color: $text-color;
  345. }
  346. }
  347. .foot-list{
  348. width: 100%;
  349. // margin-bottom: 150rpx;
  350. }
  351. .list-cell-item{
  352. width: 702rpx;
  353. height: auto;
  354. margin-bottom: 24rpx;
  355. padding:0 24rpx;
  356. background: $bg-color;
  357. }
  358. .list-cell{
  359. display:flex;
  360. width: 100%;
  361. align-items:baseline;
  362. line-height:100rpx;
  363. position:relative;
  364. background: $bg-color;
  365. justify-content: center;
  366. // border-bottom: 1px solid #EBEBEB;
  367. &.cell-hover{
  368. background:#fafafa;
  369. }
  370. .cell-more{
  371. align-self: baseline;
  372. font-size:$font-size-28;
  373. color:$text-color;
  374. margin-left:10rpx;
  375. }
  376. .cell-tit{
  377. flex: 1;
  378. font-size: $font-size-28;
  379. color: $text-color;
  380. margin-right:10rpx;
  381. }
  382. .cell-tip{
  383. font-size: $font-size-28;
  384. color: $text-color;
  385. }
  386. }
  387. .list-cell.last{
  388. border-bottom: none;
  389. }
  390. .uni-badge--small {
  391. -webkit-transform: scale(.8);
  392. -ms-transform: scale(.8);
  393. transform: scale(.8);
  394. -webkit-transform-origin: center center;
  395. -ms-transform-origin: center center;
  396. transform-origin: center center;
  397. }
  398. .uni-badge {
  399. font-family: 'Helvetica Neue', Helvetica, sans-serif;
  400. -webkit-box-sizing: border-box;
  401. box-sizing: border-box;
  402. font-size: 12px;
  403. line-height: 1;
  404. display: inline-block;
  405. padding: 3px 6px;
  406. color: #333;
  407. border-radius: 100px;
  408. background-color: #f1f1f1;
  409. }
  410. .uni-badge-error {
  411. color: #fff;
  412. background-color: #dd524d;
  413. }
  414. </style>