integral.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <template>
  2. <view class="population">
  3. <view class="integral-left border-index">
  4. <view class="integral-title">
  5. <text>{{hasLogin?'亲爱的会员':'游客'}}</text>
  6. </view>
  7. <view class="integral-content">
  8. <view class="mark">
  9. </view>
  10. <view class="int-item" @click="loadMore('/user/page/scoreAccumulate')">
  11. <text class="tit">积分</text>
  12. <view class="val">{{ userInfo.integral*1 || '0' }}</view>
  13. <view class="look-more">立即查看</view>
  14. </view>
  15. <view class="int-item" @click="loadMore('/pages/product/discount')">
  16. <text class="tit">优惠券</text>
  17. <view class="val">{{couponNum || 0}}</view>
  18. <view class="look-more">立即查看</view>
  19. </view>
  20. <view class="int-item item-bt" @click="loadMore('/user/page/myex')">
  21. <text class="tit">兑换券</text>
  22. <view class="val">{{userInfo.uid ? ett : 0}}</view>
  23. <view class="look-more">立即查看</view>
  24. </view>
  25. <view class="int-item item-bt" @click="loadMore('/pages/money/wallet')">
  26. <text class="tit">余额</text>
  27. <view class="val ">{{getMoney(userInfo.now_money) || '0'}}</view>
  28. <view class="look-more">立即查看</view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="integral-right">
  33. <view class="own border-index" @click="load(1)">
  34. <view><image src="../../../static/img/take-from-oneself.png"></image></view>
  35. <view class="one">
  36. <b>门店自取</b><br/><text>下单免排队</text>
  37. </view>
  38. </view>
  39. <view class="takeaway border-index" @click="load(2)">
  40. <image src="../../../static/img/Takeaway.png"></image>
  41. <view class="one">
  42. <b>外送到家</b><br/><text>上门配送到家</text>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. import { saveUrl, interceptor } from '@/utils/loginUtils.js';
  50. import { mapState, mapMutations } from 'vuex';
  51. import { getMoneyStyle } from '@/utils/rocessor.js';
  52. export default {
  53. filters: {
  54. getMoneyStyle,
  55. },
  56. data() {
  57. return {
  58. }
  59. },
  60. computed: {
  61. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  62. },
  63. props: ["dhqList","couponNum",'ett'],
  64. methods: {
  65. ...mapMutations('user', ['setDistribution']),
  66. loadMore(url) {
  67. if(this.hasLogin) {
  68. uni.navigateTo({
  69. url:url
  70. })
  71. }else {
  72. saveUrl();
  73. // 登录拦截
  74. interceptor();
  75. }
  76. },
  77. load(url) {
  78. this.setDistribution(url)
  79. uni.switchTab({
  80. url: '/pages/menu/menu'
  81. });
  82. },
  83. getMoney(value) {
  84. if (typeof value == 'string') {
  85. value = (+value).toFixed(2)
  86. }
  87. if (typeof value == 'number') {
  88. value = value.toFixed(2)
  89. }
  90. if(value*1 > 1000 && value*1 <= 10000) {
  91. value = (value*1).toFixed(0)
  92. }
  93. if(value*1 > 10000 && value*1 <= 100000) {
  94. value = value*1/10000
  95. value = (value*1).toFixed(2) + '万'
  96. }
  97. if(value*1 > 100000 && value*1 < 984900) {
  98. value = value*1/10000
  99. value = (value*1).toFixed(1) + '万'
  100. }
  101. if(value*1 > 984900) {
  102. value = value*1/10000
  103. value = (value*1).toFixed(0) + '万'
  104. }
  105. return value;
  106. }
  107. }
  108. }
  109. </script>
  110. <style lang="scss" scoped>
  111. .population {
  112. display: flex;
  113. }
  114. .integral-left {
  115. margin: 27rpx;
  116. flex: 1;
  117. height: 423rpx;
  118. position: relative;
  119. }
  120. .integral-right {
  121. flex: 1;
  122. height: 423rpx;
  123. margin: 27rpx;
  124. margin-left: 0;
  125. display: grid;
  126. image {
  127. float: left;
  128. margin: 55rpx 5rpx 0 45rpx;
  129. }
  130. .one {
  131. text-align: center;
  132. margin: 55rpx 10rpx 0 0;
  133. text {
  134. color: #989B9F;
  135. font-size: 22rpx;
  136. margin-top: 4rpx;
  137. }
  138. b {
  139. color: #333333;
  140. font-family: PingFang-SC-Bold;
  141. font-size: 39rpx;
  142. }
  143. }
  144. view {
  145. // display: flex;
  146. }
  147. .own {
  148. margin-bottom: 14rpx;
  149. image {
  150. width: 75rpx;
  151. height: 83rpx;
  152. }
  153. }
  154. .takeaway {
  155. margin-top: 14rpx;
  156. image {
  157. width: 83rpx;
  158. height: 75rpx;
  159. }
  160. }
  161. }
  162. .integral-title {
  163. margin-top: 30rpx;
  164. text-align: center;
  165. height: 100rpx;
  166. color: #901B21;
  167. font-family: PingFang-SC-Bold;
  168. }
  169. .integral-content {
  170. width: 264rpx;
  171. height: 264rpx;
  172. background-color: #ecd49e;
  173. position: absolute;
  174. bottom: 34rpx;
  175. left: 0;
  176. right: 0;
  177. margin: auto;
  178. display: flex;
  179. justify-content: space-between;
  180. flex-wrap: wrap;
  181. // align-items: ;
  182. .int-item {
  183. width: 49.6%;
  184. height: 49.6%;
  185. background-color: #fff;
  186. text-align: center;
  187. display: flex;
  188. flex-direction: column;
  189. // flex-wrap: nowrap;
  190. justify-content: space-around;
  191. .tit {
  192. font-size: 30rpx;
  193. font-family: PingFang SC;
  194. font-weight: 500;
  195. color: #333333;
  196. }
  197. .val {
  198. font-size: 36rpx;
  199. font-family: PingFang SC;
  200. font-weight: bold;
  201. color: #333333;
  202. }
  203. .look-more {
  204. font-size: 20rpx;
  205. font-family: PingFang SC;
  206. font-weight: 500;
  207. color: #989B9F;
  208. }
  209. }
  210. .item-bt {
  211. align-self: flex-end;
  212. }
  213. .mark {
  214. width: 24rpx;
  215. height: 38rpx;
  216. position: absolute;
  217. top: 0;
  218. right: 0;
  219. left: 0;
  220. bottom: 0;
  221. margin: auto;
  222. background-color: #fff;
  223. }
  224. // // margin-top: -25rpx;
  225. // text-align: center;
  226. // // display: grid;
  227. // // grid-template-columns: 50% 50%;
  228. // // grid-template-rows: 60% 60%;
  229. // width: 100%;
  230. // display: flex;
  231. // flex-wrap: wrap;
  232. // position: relative;
  233. // .lines {
  234. // width: 2rpx;
  235. // height: 120rpx;
  236. // background: #DCB876;
  237. // position: absolute;
  238. // left: 0;
  239. // right: 0;
  240. // margin: auto;
  241. // }
  242. // .lineh {
  243. // width: 120rpx;
  244. // height: 2rpx;
  245. // background: #DCB876;
  246. // position: absolute;
  247. // top: 0;
  248. // bottom: 0;
  249. // margin: auto;
  250. // }
  251. // .line1 {
  252. // top: 0;
  253. // }
  254. // .line4 {
  255. // bottom: 0;
  256. // }
  257. // .line2 {
  258. // left: 35rpx;
  259. // }
  260. // .line3 {
  261. // right: 35rpx;
  262. // }
  263. // .int-item {
  264. // width: 50%;
  265. // height: 50%;
  266. // padding: 20rpx 0;
  267. // .val {
  268. // padding: 5rpx 0;
  269. // }
  270. // }
  271. // .int-item-t {
  272. // padding-top: 0;
  273. // }
  274. // view {
  275. // text-align: center;
  276. // }
  277. // text {
  278. // color: #333333;
  279. // font-size: 30rpx;
  280. // font-family: PingFang-SC-Medium;
  281. // }
  282. // .exchangeOsee {
  283. // color: #989B9F;
  284. // font-size: 20rpx;
  285. // }
  286. // $integral-border: solid 2rpx #DCB876;
  287. // .integral {
  288. // }
  289. // .exchange-certificate {
  290. // }
  291. // .extension {
  292. // }
  293. // .balance {
  294. // }
  295. }
  296. </style>