mine.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. <template>
  2. <view class="content">
  3. <view class="top hflex acenter jbetween">
  4. <view class="hflex acenter" @click="toLogin">
  5. <u-avatar :src="user.headimg"></u-avatar>
  6. <view class="user_name">{{user.nickname?user.nickname:'请先登录'}}</view>
  7. </view>
  8. <view class="message hflex acenter jcenter" @click="toMessage">
  9. <image src="/static/images/mine/message.png" style="width: 48rpx;height: 48rpx;"></image>
  10. <u-badge max="99" :absolute="true" :offset="[1,1]" :value="user.message_num" v-if="user.message_num>0"></u-badge>
  11. </view>
  12. </view>
  13. <view class="box">
  14. <view class="amount hflex acenter jbetween" @click="toMoney">
  15. <view class="amount_left">我的余额</view>
  16. <view class="amount_right">¥{{user.money}}</view>
  17. </view>
  18. <view class="order">
  19. <view class="order_top hflex acenter jbetween">
  20. <view class="order_title">商城订单</view>
  21. <view class="order_right" @click="toOrder(1)">查看全部</view>
  22. </view>
  23. <view class="order_list hflex acenter jcenter">
  24. <block v-for="(item,index) in orderList" :key="index">
  25. <view class="order_item vflex acenter jcenter" @click="toOrder(item.id)">
  26. <image :src="item.img" style="width: 52rpx;height: 52rpx;"></image>
  27. <u-badge :absolute="true" :offset="[1,20]" max="99" :value="item.number" v-if="item.number>0"></u-badge>
  28. <view class="order_text">{{item.name}}</view>
  29. </view>
  30. </block>
  31. </view>
  32. </view>
  33. <view class="cell">
  34. <view class="cell_item hflex acenter jbetween" @click="toService(1)">
  35. <view class="hflex acenter">
  36. <image src="/static/images/mine/cell1.png" style="width: 40rpx;height: 40rpx;"></image>
  37. <view class="cell_text">采购订单</view>
  38. </view>
  39. <u-icon name="arrow-right" color="#888888" size="12"></u-icon>
  40. </view>
  41. <view class="cell_item hflex acenter jbetween" @click="toService(2)">
  42. <view class="hflex acenter">
  43. <image src="/static/images/mine/cell2.png" style="width: 40rpx;height: 40rpx;"></image>
  44. <view class="cell_text">商家详情</view>
  45. </view>
  46. <u-icon name="arrow-right" color="#888888" size="12"></u-icon>
  47. </view>
  48. <view class="cell_item hflex acenter jbetween" @click="toService(3)">
  49. <view class="hflex acenter">
  50. <image src="/static/images/mine/cell3.png" style="width: 40rpx;height: 40rpx;"></image>
  51. <view class="cell_text">意见反馈</view>
  52. </view>
  53. <u-icon name="arrow-right" color="#888888" size="12"></u-icon>
  54. </view>
  55. <view class="cell_item hflex acenter jbetween" @click="toService(4)">
  56. <view class="hflex acenter">
  57. <image src="/static/images/mine/cell4.png" style="width: 40rpx;height: 40rpx;"></image>
  58. <view class="cell_text">平台规则</view>
  59. </view>
  60. <u-icon name="arrow-right" color="#888888" size="12"></u-icon>
  61. </view>
  62. <view class="cell_item hflex acenter jbetween" @click="toService(5)">
  63. <view class="hflex acenter">
  64. <image src="/static/images/mine/cell5.png" style="width: 40rpx;height: 40rpx;"></image>
  65. <view class="cell_text">设置</view>
  66. </view>
  67. <u-icon name="arrow-right" color="#888888" size="12"></u-icon>
  68. </view>
  69. </view>
  70. </view>
  71. <custom-tab-bar :current="3" />
  72. </view>
  73. </template>
  74. <script>
  75. import $api from '@/static/js/api.js'
  76. var that = ''
  77. export default {
  78. data() {
  79. return {
  80. user: {
  81. message_num: 12
  82. },
  83. login: true,
  84. orderList: [
  85. {
  86. id: 2,
  87. img: '/static/images/mine/order1.png',
  88. name: '待付款',
  89. number: 0
  90. },
  91. {
  92. id: 3,
  93. img: '/static/images/mine/order2.png',
  94. name: '待发货',
  95. number: 0
  96. },
  97. {
  98. id: 4,
  99. img: '/static/images/mine/order3.png',
  100. name: '待收货',
  101. number: 0
  102. },
  103. {
  104. id: 5,
  105. img: '/static/images/mine/order4.png',
  106. name: '退款/售后',
  107. number: 0
  108. }
  109. ]
  110. }
  111. },
  112. onLoad() {
  113. that = this
  114. that.getNum()
  115. },
  116. onShow() {
  117. that.isLogin()
  118. that.getUser()
  119. },
  120. methods: {
  121. getUser() {
  122. $api.req({
  123. url: '/data/api.business.User/user_info'
  124. }, function(res) {
  125. if(res.code == 1) {
  126. that.user = res.data
  127. } else if(res.code == 0) {
  128. uni.removeStorageSync('token')
  129. that.login = false
  130. that.user = {}
  131. }
  132. })
  133. },
  134. getNum() {
  135. $api.req({
  136. url: '/data/api.business.Order/order_statistics'
  137. }, function(res) {
  138. if(res.code == 1) {
  139. for(var i=0;i<that.orderList.length;i++) {
  140. that.$set(that.orderList[i],'number',res.data[i])
  141. }
  142. }
  143. })
  144. },
  145. isLogin() {
  146. var token = uni.getStorageSync('token')
  147. if(token) {
  148. that.login = true
  149. } else {
  150. that.login = false
  151. }
  152. },
  153. toLogin() {
  154. if(!that.login) {
  155. $api.jump('/pages/login/login/login')
  156. }
  157. },
  158. toMessage() {
  159. if(that.login) {
  160. $api.jump('/pages/mine/message/index')
  161. } else {
  162. $api.info('请先登录')
  163. }
  164. },
  165. toMoney() {
  166. if(that.login) {
  167. $api.jump('/pages/mine/wallet/wallet')
  168. } else {
  169. $api.info('请先登录')
  170. }
  171. },
  172. toOrder(id) {
  173. if(id != 5) {
  174. $api.jump('/pages/order/list?status=' + id)
  175. } else {
  176. $api.jump('/pages/order/refund')
  177. }
  178. },
  179. toService(index) {
  180. var url = ''
  181. switch(index) {
  182. case 1 :
  183. url = '/pages/mine/service/purOrder/list';
  184. break;
  185. case 2 :
  186. url = '/pages/mine/service/detail';
  187. break;
  188. case 3 :
  189. url = '/pages/mine/service/feed/feed';
  190. break;
  191. case 4 :
  192. url = '/pages/mine/service/rule';
  193. break;
  194. case 5 :
  195. url = '/pages/mine/service/setting/setting';
  196. break;
  197. }
  198. if(that.login) {
  199. $api.jump(url)
  200. } else {
  201. $api.info('请先登录')
  202. }
  203. },
  204. },
  205. }
  206. </script>
  207. <style lang="scss" scoped>
  208. .content {
  209. background: url('/static/images/mine/bg.png') no-repeat;
  210. background-size: 100%;
  211. // padding: 0 30rpx;
  212. .top {
  213. width: 100%;
  214. padding: 188rpx 0 0 30rpx;
  215. .user_name {
  216. font-size: 36rpx;
  217. font-weight: 500;
  218. color: #222222;
  219. line-height: 50rpx;
  220. padding-left: 16rpx;
  221. }
  222. .message {
  223. width: 104rpx;
  224. height: 68rpx;
  225. background: rgba(255,255,255,0.6);
  226. border-radius: 28rpx 0px 0px 28rpx;
  227. position: relative;
  228. }
  229. }
  230. .box {
  231. width: 100%;
  232. box-sizing: border-box;
  233. padding: 0 30rpx;
  234. .amount {
  235. width: 100%;
  236. height: 144rpx;
  237. box-sizing: border-box;
  238. padding: 0 24rpx;
  239. margin: 36rpx 0 20rpx;
  240. background: url('/static/images/mine/amount_bg.png') no-repeat;
  241. background-size: 100%;
  242. .amount_left {
  243. font-size: 30rpx;
  244. font-weight: 400;
  245. color: #FFFFFF;
  246. line-height: 42rpx;
  247. }
  248. .amount_right {
  249. font-size: 48rpx;
  250. font-weight: 400;
  251. color: #FFFFFF;
  252. line-height: 58rpx;
  253. }
  254. }
  255. .order {
  256. width: 100%;
  257. height: 240rpx;
  258. background: #FFFFFF;
  259. border-radius: 20rpx;
  260. .order_top {
  261. padding: 24rpx 30rpx 0;
  262. .order_title {
  263. font-size: 28rpx;
  264. font-weight: 500;
  265. color: #0A0A0A;
  266. line-height: 40rpx;
  267. }
  268. .order_right {
  269. font-size: 22rpx;
  270. font-weight: 400;
  271. color: #B4B4B4;
  272. line-height: 32rpx;
  273. }
  274. }
  275. .order_list {
  276. padding: 32rpx 0;
  277. .order_item {
  278. width: 25%;
  279. position: relative;
  280. .order_text {
  281. font-size: 24rpx;
  282. font-weight: 400;
  283. color: #0A0A0A;
  284. line-height: 34rpx;
  285. padding-top: 26rpx;
  286. }
  287. }
  288. }
  289. }
  290. .cell {
  291. margin: 20rpx 0 110rpx;
  292. width: 100%;
  293. height: 588rpx;
  294. background: #FFFFFF;
  295. border-radius: 20px;
  296. box-sizing: border-box;
  297. padding: 0 30rpx;
  298. .cell_item {
  299. height: 116rpx;
  300. padding: 34rpx 0;
  301. border-bottom: 1rpx solid #F4F4F4;
  302. .cell_text {
  303. padding-left: 20rpx;
  304. font-size: 26rpx;
  305. font-weight: 400;
  306. color: #222222;
  307. line-height: 36rpx;
  308. }
  309. }
  310. .cell_item:nth-last-child(1) {
  311. border-bottom: none;
  312. }
  313. }
  314. }
  315. }
  316. </style>